/* hddn — UI styles. Self-contained, no external fonts or assets (offline-first). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #5c6470;
  --border: #d9dde3;
  --primary: #2f6f4f;
  --primary-text: #ffffff;
  --accent: #1f6feb;
  --warn-bg: #fff4e5;
  --warn-border: #e0a03a;
  --error: #b3261e;
  --ok: #1f7a3d;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --border: #2a313b;
    --primary: #3ea06a;
    --accent: #4d9bff;
    --warn-bg: #2a2114;
    --warn-border: #a9791f;
    --error: #ff6b61;
    --ok: #5ac47c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1.5rem 1rem 3rem;
  max-width: 46rem;
  margin-inline: auto;
  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.site-header { position: relative; }
.site-header h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.tagline { color: var(--muted); margin: 0.35rem 0 0.75rem; }

.lang-switch { position: absolute; top: 0; right: 0; }
.lang-switch select {
  font: inherit; font-size: 0.85rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.2rem 0.4rem;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.status { font-size: 0.9rem; margin: 0.25rem 0 0; }
.status--loading { color: var(--muted); }
.status--ready { color: var(--ok); }
.status--error { color: var(--error); }

.tabs { display: flex; gap: 0.25rem; margin: 1.25rem 0 1rem; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; padding: 0.6rem 0.9rem; font-size: 1rem;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.field-label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.95rem; }
.mt { margin-top: 0.5rem; }

input[type="password"], input[type="number"], textarea, select {
  width: 100%; padding: 0.55rem 0.65rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, .dropzone:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.25rem;
  text-align: center; cursor: pointer; color: var(--muted); background: var(--bg);
}
.dropzone.is-dragover { border-color: var(--accent); color: var(--text); }
.dropzone__info { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text); }

.field-head { display: flex; align-items: center; gap: 0.4rem; }
.help-toggle {
  flex: none; width: 1.35rem; height: 1.35rem; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  font-size: 0.8rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.help-toggle:hover { border-color: var(--muted); color: var(--text); }
.help-toggle[aria-expanded="true"] { background: var(--accent); color: #fff; border-color: transparent; }
.help {
  margin: 0.5rem 0; padding: 0.6rem 0.75rem; font-size: 0.85rem; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.help code { background: var(--surface); padding: 0 0.3rem; border-radius: 4px; }

.counter { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted); }
.counter--over { color: var(--error); font-weight: 600; }
.counter__max { color: var(--muted); }

.advanced summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.argon { border: 1px solid var(--border); border-radius: 8px; margin-top: 0.75rem; padding: 0.5rem 0.75rem; }
.argon legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.35rem; }
.argon label { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin: 0.35rem 0; font-size: 0.9rem; }
.argon input { width: 6rem; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.25rem; align-items: center; }

.btn {
  display: inline-block; padding: 0.55rem 1rem; font: inherit; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--primary-text); border-color: transparent; font-weight: 600; }
.btn--primary:hover { filter: brightness(1.06); }
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1.1em; height: 1.1em;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  color: var(--primary-text); animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.msg { margin-top: 1rem; padding: 0.6rem 0.8rem; border-radius: 8px; font-size: 0.95rem; }
.msg--info { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.msg--error { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); border: 1px solid var(--error); }

.result { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.result__ok { color: var(--ok); font-weight: 600; margin-top: 0; }
.result__warn { color: var(--warn-border); font-weight: 600; margin-top: 0;
  background: var(--warn-bg); border: 1px solid var(--warn-border); padding: 0.6rem 0.8rem; border-radius: 8px; }
.note { color: var(--muted); font-size: 0.9rem; }

.secret {
  white-space: pre-wrap; word-break: break-word; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem; margin: 0.75rem 0;
  font: 15px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.secret--masked { color: var(--muted); font-style: italic; user-select: none; }

.caveats { margin-top: 2rem; color: var(--muted); font-size: 0.9rem; }
.caveats h2 { font-size: 1rem; color: var(--text); }
.caveats ul { padding-left: 1.1rem; }
.caveats li { margin: 0.35rem 0; }
.caveats code { background: var(--bg); padding: 0 0.3rem; border-radius: 4px; }

/* The legal half of the footer: the warranty disclaimer, then the copyright
   line. Quieter than the caveats above it — present and legible, not shouting. */
.disclaimer { margin: 1rem 0 0; padding-top: 0.85rem; border-top: 1px solid var(--border); font-size: 0.85rem; }
.disclaimer code { background: var(--bg); padding: 0 0.3rem; border-radius: 4px; }
.copyright { margin: 0.5rem 0 0; font-size: 0.8rem; }

/* The same disclaimer in short form, immediately above the Hide button. The
   rule is scoped to .note--risk so the result notes keep their plain styling. */
.note--risk { margin: 1.25rem 0 0; padding-left: 0.7rem; border-left: 2px solid var(--border); }

/* --- rendered specification ------------------------------------------------
   The Spec panel holds markup generated from SPEC.md by `make spec`, so these
   rules style goldmark's output rather than hand-written elements. Everything
   uses the existing tokens, which is what keeps dark mode working without a
   second set of colours. */
.spec { line-height: 1.65; overflow-wrap: break-word; }
.spec > :first-child { margin-top: 0; }
.spec h1, .spec h2, .spec h3, .spec h4 { line-height: 1.25; margin: 1.6em 0 .6em; }
.spec h1 { font-size: 1.5rem; }
.spec h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.spec h3 { font-size: 1.05rem; }
.spec a { color: var(--accent); }
.spec code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .35em;
  font-size: .9em;
}
/* The border and padding belong to the block, not to each span inside it. */
.spec pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  overflow-x: auto;
}
.spec pre code { background: none; border: 0; padding: 0; font-size: .875rem; }
.spec blockquote {
  margin: 1em 0;
  padding: .1rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
/* Wrapped in its own scroll container: a wide table must not widen the page
   on a phone, which is the whole reason the panel is not just `overflow: auto`. */
.spec table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .925rem; display: block; overflow-x: auto; }
.spec th, .spec td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.spec th { background: var(--bg); }
.spec hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
