/* ============================================================
   VoicePub design tokens + shared primitives.
   Loaded first by every page; landing.css and app.css build on it.

   Palette: forest green primary, waterway teal accent, cool paper
   ground, green-biased neutrals. Teal carries the audio motif —
   play buttons, waveforms, progress — while green stays the brand.
   ============================================================ */

:root {
  --forest: #173D2E;
  --forest-2: #2F6B4F;
  --forest-deep: #0F2A20;

  --accent: #1C6E6A;      /* teal for text on paper — the fill teal is
                             only ~4.05:1 there, this one clears AA */
  --accent-2: #2E8C88;    /* teal for fills */
  --accent-soft: #D8E7E3;

  --paper: #F1F0E9;
  --paper-2: #E8E8DD;     /* app/workspace ground: sits under --card */
  --paper-3: #DEDED0;
  --card: #FBFAF3;

  --ink: #16211C;
  --ink-soft: #394A44;
  --ink-faint: #69746F;
  --line: #CFCFC0;

  --danger: #9C3B2E;

  /* The hero band is dark in both themes, so anything drawn on it
     resolves against --on-forest rather than --ink. */
  --hero-bg: #0F2A20;
  --on-forest: #F1F0E9;
  --on-forest-soft: rgba(241, 240, 233, .62);
  --on-forest-faint: rgba(241, 240, 233, .34);
  --hero-panel: rgba(241, 240, 233, .07);
  --hero-panel-line: rgba(241, 240, 233, .14);

  /* Steps you haven't reached yet: clearly secondary, still readable.
     Three levels rather than one flat opacity — at a single value the
     small notes disappear before the labels do. */
  --step-idle: rgba(241, 240, 233, .62);
  --step-idle-icon: rgba(241, 240, 233, .52);
  --step-idle-note: rgba(241, 240, 233, .46);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, "Seravek", "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --measure: 62ch;
  --page: 1040px;
  --narrow: 720px;
}

/* Dark theme. Only the tokens change — never style components inside
   a media query, or the data-theme overrides below cannot win. */
@media (prefers-color-scheme: dark) {
  :root {
    --forest: #2F6B4F;
    --forest-2: #63AB88;
    --forest-deep: #0B1712;
    --accent: #46B4AE;
    --accent-2: #57C6C0;
    --accent-soft: #1B3733;
    --paper: #121E19;
    --paper-2: #0E1815;
    --paper-3: #1F312B;
    --card: #172420;
    --ink: #E8EAE0;
    --ink-soft: #B4BEB7;
    --ink-faint: #86958D;
    --line: #293933;
    --danger: #D97A68;
    --hero-bg: #0A1511;
    --on-forest: #E8EAE0;
  }
}

/* The viewer's explicit toggle must beat the OS preference both ways. */
:root[data-theme="light"] {
  --forest: #173D2E;
  --forest-2: #2F6B4F;
  --forest-deep: #0F2A20;
  --accent: #1C6E6A;
  --accent-2: #2E8C88;
  --accent-soft: #D8E7E3;
  --paper: #F1F0E9;
  --paper-2: #E8E8DD;
  --paper-3: #DEDED0;
  --card: #FBFAF3;
  --ink: #16211C;
  --ink-soft: #394A44;
  --ink-faint: #69746F;
  --line: #CFCFC0;
  --danger: #9C3B2E;
  --hero-bg: #0F2A20;
  --on-forest: #F1F0E9;
}

:root[data-theme="dark"] {
  --forest: #2F6B4F;
  --forest-2: #63AB88;
  --forest-deep: #0B1712;
  --accent: #46B4AE;
  --accent-2: #57C6C0;
  --accent-soft: #1B3733;
  --paper: #121E19;
  --paper-2: #0E1815;
  --paper-3: #1F312B;
  --card: #172420;
  --ink: #E8EAE0;
  --ink-soft: #B4BEB7;
  --ink-faint: #86958D;
  --line: #293933;
  --danger: #D97A68;
  --hero-bg: #0A1511;
  --on-forest: #E8EAE0;
}

/* ============================================================
   BASE
   ============================================================ */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  /* iOS inflates text in blocks it judges too wide, which throws off every
     width derived from a font size — buttons most visibly. */
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

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

/* The browser implements `hidden` as [hidden] { display: none } in its own
   stylesheet, and author styles beat UA styles unconditionally — so any
   component that sets its own `display` (every .vopt, .filechip, .redrop)
   silently ignores the attribute. `hidden` states intent; it has to win. */
[hidden] { display: none !important; }

/* ============================================================
   BRAND LOCKUP
   The small horizontal mark, used in both pages' top bars. The
   hero's larger treatment is .hero-brand in landing.css.
   ============================================================ */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink);
}
.brand em { font-style: normal; color: var(--accent); }
.brand svg { display: block; }
.brand svg path { stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  /* Padding inside the width, not added to it: without this a .btn-block at
     width:100% is 100% PLUS its padding, and runs past its container. */
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;             /* an icon needs air between it and its label */
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  padding: 12px 22px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  /* nowrap makes the label the button's min-content width, so neither
     width:100% nor a narrow parent can shrink it — without this cap a long
     label on a long word overflows the page rather than the button. */
  max-width: 100%;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.btn-lg { font-size: 17px; padding: 15px 40px; }
.btn-sm { font-size: 14px; padding: 9px 18px; }
/* Stacked full-width buttons: the shape a decision takes inside a dialog,
   where two side-by-side buttons of different weight read as a toolbar. */
.btn-block { width: 100%; }

/* The 40px inline padding on .btn-lg is affordable at desk width and not on a
   phone, where it is a fifth of the screen. Wrapping is the safety net. */
@media (max-width: 560px) {
  .btn { white-space: normal; }
  .btn-lg { font-size: 16px; padding: 15px 20px; }
}

.btn-primary { background: var(--accent-2); color: #06201F; }
.btn-primary:hover { background: color-mix(in oklab, var(--accent-2) 84%, #FFF); transform: translateY(-1px); }
.btn-primary[disabled] { background: var(--paper-3); color: var(--ink-faint); cursor: not-allowed; transform: none; }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent); }

.btn-danger { background: var(--danger); color: #FFF; }
.btn-danger:hover { background: color-mix(in oklab, var(--danger) 86%, #000); }

/* ============================================================
   SMALL PARTS
   ============================================================ */
.pill {
  display: inline-block;
  vertical-align: 1px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
}

/* ============================================================
   MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
