/*
 * Argon2ID-Derivator — Präzisionswerkzeug.
 *
 * Dunkel, eine Schriftfamilie (System-Monospace), Chroma nur an drei Stellen:
 * Fokus, Primäraktion und das abgeleitete Passwort. Keine Web-Fonts — ein
 * CDN-Font bräche die Zero-Network-Zusage. Auf macOS ist das SF Mono.
 *
 * Die eine laute Stelle ist das Ergebnis: das Passwort ist das Artefakt, alles
 * drumherum tritt zurück.
 */

:root {
  --bg: #0b0e12;
  --surface: #11161c;
  --surface-raised: #161d25;
  --border: #232c38;
  --border-strong: #313d4d;
  --text: #e6edf3;
  --text-muted: #8b98a5;
  --accent: #2dd4bf;
  --accent-ink: #04211d;
  --success: #4ade80;
  --danger: #f87171;

  --radius: 4px;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --step: 8px;

  /* Eine Skala, damit Abstände und Schriftgrößen nicht aus dem Ruder laufen. */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-display: 1.375rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: calc(var(--step) * 6) calc(var(--step) * 3) calc(var(--step) * 8);

  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 33rem;
  display: flex;
  flex-direction: column;
  gap: calc(var(--step) * 3.5);
}

/* --- Hinweis, wenn die Seite aus dem Dateisystem geoeffnet wurde ---------- */

.boot-hint {
  padding: calc(var(--step) * 2);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--surface);
}

.boot-hint strong {
  display: block;
  margin-bottom: var(--step);
  color: var(--danger);
}

.boot-hint p {
  margin: 0 0 var(--step);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.boot-hint p:last-child {
  margin-bottom: 0;
}

.boot-hint code,
.dialog code {
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg);
  color: var(--accent);
}

/* --- Kopfzeile ------------------------------------------------------------ */

/*
 * Nur hier Versalien: die Wortmarke. Feldbeschriftungen und Knöpfe bleiben in
 * Normalschreibung — Versalien auf jedem Label sind eine Konvention, die
 * nichts über diesen Gegenstand sagt.
 */
.masthead {
  padding-bottom: calc(var(--step) * 2);
  border-bottom: 1px solid var(--border);
}

.masthead__title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Formular ------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: calc(var(--step) * 2.5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--step);
}

.field__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.field input {
  width: 100%;
  padding: calc(var(--step) * 1.5) calc(var(--step) * 1.75);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
  transition: border-color 120ms ease;
}

.field input:hover {
  border-color: var(--border-strong);
}

.field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.field__hint {
  margin: 0;
  min-height: 1.2em;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.field__hint[data-status='ok'] {
  color: var(--success);
}

.field__hint[data-status='short'] {
  color: var(--danger);
}

/* --- Knöpfe --------------------------------------------------------------- */

.button {
  padding: calc(var(--step) * 1.5) calc(var(--step) * 2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    opacity 120ms ease;
}

/*
 * Der Primärknopf ist umrandet, nicht gefüllt: die gefüllte Akzentfläche bleibt
 * dem Ergebnis vorbehalten. Zwei laute Stellen wären keine Hierarchie.
 */
.button--primary {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.button--primary:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-ink);
}

.button--primary:disabled {
  opacity: 0.5;
  cursor: progress;
}

.button--copy {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text);
}

.button--copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  padding-inline: 0;
}

.button--ghost:hover {
  color: var(--text);
}

/* --- Ergebnis: die eine laute Stelle ------------------------------------- */

/*
 * Das Passwort ist das, wofür die App existiert. Es bekommt die einzige
 * erhabene Fläche der Seite, größere Schrift und eine Akzentkante. Der
 * Dienstname steht als Beschriftung darüber, damit klar ist, wozu das
 * Passwort gehört.
 */
.result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: calc(var(--step) * 1.5) calc(var(--step) * 2);

  padding: calc(var(--step) * 2.5);
  border: 1px solid var(--border-strong);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-raised);

  animation: result-in 160ms ease-out;
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.result__label {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.result__value {
  font-size: var(--text-display);
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
  user-select: all;
}

/* --- Meldungen ------------------------------------------------------------ */

/*
 * Die drei Meldungen teilen sich eine Zeile Reserve. Vorher reservierte jede
 * für sich eine — das riss eine Lücke von fast 200 px zwischen Ergebnis und
 * Fußzeile.
 */
.messages {
  display: flex;
  flex-direction: column;
  gap: calc(var(--step) / 2);
  min-height: 1.2em;
}

.status,
.error,
.clear-hint {
  margin: 0;
  font-size: var(--text-sm);
}

.status,
.clear-hint {
  color: var(--text-muted);
}

.error {
  color: var(--danger);
}

.footer {
  padding-top: calc(var(--step) * 2);
  border-top: 1px solid var(--border);
}

/* --- Info-Dialog ---------------------------------------------------------- */

.dialog {
  max-width: 30rem;
  padding: calc(var(--step) * 3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
}

.dialog::backdrop {
  background: rgb(0 0 0 / 0.72);
}

.dialog__title {
  margin: 0 0 calc(var(--step) * 2);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dialog__subtitle {
  margin: calc(var(--step) * 3) 0 var(--step);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text);
}

.dialog__text,
.dialog__list {
  margin: 0 0 var(--step);
  font-size: var(--text-sm);
}

.dialog__list {
  padding-left: calc(var(--step) * 2.5);
  display: flex;
  flex-direction: column;
  gap: var(--step);
}

.dialog__actions {
  margin-top: calc(var(--step) * 3);
  display: flex;
  justify-content: flex-end;
}

/* --- Fokus und Bewegung --------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Muss jede display-Regel der Klasse schlagen. */
[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Schmale Geräte: der Kopieren-Knopf rutscht unter das Passwort. */
@media (max-width: 26rem) {
  .result {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .result .button--copy {
    justify-self: start;
  }

  .result__value {
    font-size: var(--text-base);
  }
}
