/* ADDIE Chat — product stylesheet.
 *
 * Reads only the vendored, generated tokens (vendor/brand-tokens.css, vendor/console-tokens.css).
 * No colour value is typed here: tests/test_p9_surfaces.py fails on any hex, rgb() or hsl() literal.
 * Colours come from the brand's named roles; spacing, radii, type and motion from the console package.
 * The whole treatment flips on [data-aod-surface]: light by default, dark when the visitor's system asks.
 */

@font-face {
  /* The console package and the brand pack both name the family "AoD Inter" (clearspring-studio #589).
     This product serves the approved cuts from its own origin under that name. */
  font-family: "AoD Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/Inter-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "AoD Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/Inter-ExtraBold.woff2") format("woff2");
}

:root {
  --gutter: var(--container-gutter-desktop);
  --visitor-plate: var(--aod-paper);
  --shadow: var(--elev-raised);
  --mute: var(--aod-mute);
  --mute-fill: var(--aod-mute-fill);
  --mute-line: var(--aod-mute-line);
}
[data-aod-surface="dark"] {
  --visitor-plate: var(--aodPlate);
  --shadow: none;
  --mute: var(--aodInkSoft);
  --mute-fill: var(--aodChipFill);
  --mute-line: var(--aodChipLine);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--aodGround);
  color: var(--aodInkBody);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  font-variant-numeric: tabular-nums;
}
[data-aod-surface="light"] body { background: var(--aodBg); }
a { color: var(--aodAccent); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- chrome ---------------------------------------------------------------------------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  height: 56px; padding: 0 var(--gutter); border-bottom: 1px solid var(--aodLine);
}
.bar .brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.bar .mark { width: 24px; height: 24px; display: block; }
.bar .name { font-weight: 800; font-size: var(--text-sm); color: var(--aodInk); letter-spacing: 0.02em; }
.bar .right { display: flex; align-items: center; gap: var(--space-3); }
.bar .mark-dark { display: none; }
[data-aod-surface="dark"] .bar .mark-light { display: none; }
[data-aod-surface="dark"] .bar .mark-dark { display: block; }

.on-signal { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--aodInk); }
.on-signal::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--aodOn); }
.on-signal[hidden] { display: none; }

/* ---- chips: nouns, 11px, 500, pill; three families that never mix ---------------------- */
.chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 9px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em; border: 1px solid; white-space: nowrap;
}
.chip-mute { color: var(--mute); background: var(--mute-fill); border-color: var(--mute-line); }
.chip-agent { color: var(--aodAgent); background: var(--aodAgentFill); border-color: var(--aodAgentLine); }
.chip-ok { color: var(--aodOk); background: var(--aodOkFill); border-color: var(--aodOkLine); }
.chip-warn { color: var(--aodWarn); background: var(--aodWarnFill); border-color: var(--aodWarnLine); }
.chip-fail { color: var(--aodFail); background: var(--aodFailFill); border-color: var(--aodFailLine); }

/* ---- the conversation ------------------------------------------------------------------ */
main { flex: 1 1 auto; width: 100%; max-width: var(--container-max); margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-2); }
.welcome { display: flex; flex-direction: column; align-items: center; gap: var(--space-5); text-align: center; padding: var(--space-5) 0; }
.welcome img { width: min(320px, 70vw); height: auto; }
.welcome h1 { margin: 0; font-weight: 800; font-size: var(--text-xl); letter-spacing: var(--tracking-display); line-height: var(--leading-tight); color: var(--aodInk); }
.welcome .subtitle { margin: 0; max-width: 560px; font-size: var(--text-base); line-height: var(--leading-body); color: var(--aodInkBody); }
.starters { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; max-width: 820px; }

.transcript { display: flex; flex-direction: column; gap: var(--space-5); }
.turn-visitor { display: flex; justify-content: flex-end; }
.turn-visitor .words {
  max-width: min(620px, 85%); padding: var(--space-3) var(--space-4); background: var(--visitor-plate);
  color: var(--aodInkBody); border-radius: var(--radius-lg); white-space: pre-wrap; overflow-wrap: anywhere;
}
.turn-addie { display: flex; gap: 14px; align-items: flex-start; }
.turn-addie .avatar { width: 44px; height: 44px; flex-shrink: 0; }
.turn-addie .body { display: flex; flex-direction: column; gap: var(--space-3); max-width: 760px; min-width: 0; }
.turn-addie .reply { white-space: pre-wrap; overflow-wrap: anywhere; }
.receipt { font-size: var(--text-xs); color: var(--aodInkSoft); }
/* The reply footer: the receipt, then how long the turn took. The timing pill is a mute-family
   chip (.chip .chip-mute above), so it carries no colour of its own in either surface. */
.foot { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-width: 0; }
.foot .receipt { min-width: 0; overflow-wrap: anywhere; }
.timing { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* The busy row: the working state, in the transcript (C9; operator ruling 2026-09-13).
   Ink and mute tones only — amber is the one AGENTS ON signal and lives in the app bar, so
   nothing here carries a status colour. The pulse is micro-motion under a second, and the
   reduced-motion rule at the foot of this file stills it without taking the words away. */
.busy { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); color: var(--aodInkSoft); }
.busy .dots { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.busy .dot {
  width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--mute-line);
  opacity: 0.35; animation: addie-busy-pulse 900ms var(--ease-standard) infinite;
}
.busy .dot:nth-child(2) { animation-delay: 150ms; }
.busy .dot:nth-child(3) { animation-delay: 300ms; }
.busy .stage { min-width: 0; overflow-wrap: anywhere; }
.busy .elapsed { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--mute); }
@keyframes addie-busy-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.cards { display: flex; flex-direction: column; gap: var(--space-2); }
.card {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  padding: 10px 14px; background: var(--aodPlate); border: 1px solid var(--aodLine); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card .what { display: flex; align-items: center; gap: var(--space-2); min-width: 0; overflow-wrap: anywhere; }
/* The callback receipt is one sentence with the reference inside it (M3-D33): a block, so its text and
   the .mono span flow as one run instead of becoming three flex columns, and the reference never splits. */
.card[data-receipt="callback"] .what { display: block; flex: 1 1 16em; }
.card[data-receipt="callback"] .what .mono { white-space: nowrap; }
.card .chips { display: flex; gap: var(--space-2); }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ---- the callback card ----------------------------------------------------------------- */
.callback { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--aodPlate); border: 1px solid var(--aodLine); border-radius: var(--radius-lg); box-shadow: var(--shadow); max-width: 460px; }
.callback .head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; font-weight: 800; }
.callback input, .callback textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; color: var(--aodInkBody); background: var(--aodBg);
  border: 1px solid var(--aodLineStrong); border-radius: var(--radius-md);
}
.callback textarea { min-height: 72px; resize: vertical; }
.callback .trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* A refusal the visitor can fix, shown inside the card so the form stays editable (C8). */
.callback .note { font-size: var(--text-xs); color: var(--aodFail); }

/* ---- buttons: 10px radius, one indigo primary per screen ------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  font: inherit; font-weight: 800; border-radius: var(--radius-md); cursor: pointer;
  background: transparent; color: var(--aodInk); border: 1px solid var(--aodLineStrong);
  transition: background var(--motion-fast) var(--ease-standard);
}
button.primary { background: var(--aodIndigo); color: var(--aodWhite); border-color: var(--aodIndigo); }
[data-aod-surface="dark"] button.primary { background: var(--aodLift); border-color: var(--aodLift); }
button:disabled { opacity: 0.55; cursor: default; }
.starters button { font-weight: 500; }

/* ---- the composer ---------------------------------------------------------------------- */
.composer-bar { border-top: 1px solid var(--aodLine); }
.composer { display: flex; gap: 10px; padding: var(--space-4) var(--gutter) 20px; max-width: var(--container-max); width: 100%; margin: 0 auto; }
.composer input {
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 var(--space-4); font: inherit; color: var(--aodInkBody);
  background: var(--aodBg); border: 1px solid var(--aodLineStrong); border-radius: var(--radius-lg);
}

/* ---- the mic button and the voice line (V3; wave M4 §5) --------------------------------- */
/* Idle it is an outline icon button beside Send; listening it swaps the glyph for a pulsing dot
   and shows the seconds. No status colour: amber stays the one AGENTS ON signal in the app bar,
   and every value here is a named role from the vendored tokens. */
.composer .mic { flex: 0 0 auto; gap: var(--space-2); padding: 0 14px; }
.composer .mic[hidden] { display: none; }
.mic .mic-icon { width: 18px; height: 18px; flex: 0 0 auto; display: block; }
.mic .mic-dot {
  width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--aodInk);
  flex: 0 0 auto; display: none;
}
.mic .mic-elapsed { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--mute); }
.mic .mic-elapsed[hidden] { display: none; }
.mic.listening { border-color: var(--aodInk); }
.mic.listening .mic-icon { display: none; }
.mic.listening .mic-dot { display: block; animation: addie-busy-pulse 900ms var(--ease-standard) infinite; }

/* The read-aloud toggle, beside the mic (V5). Off it is an outline icon button; on, the pressed
   state is the filled treatment buttons already use for a primary, so "pressed" reads the same way
   everywhere. Speaking adds the same micro-pulse the busy row uses, to the wave arc only. */
.composer .speak { flex: 0 0 auto; gap: var(--space-2); padding: 0 12px; }
.composer .speak[hidden] { display: none; }
.speak .speak-icon { width: 18px; height: 18px; flex: 0 0 auto; display: block; }
.speak .speak-state { font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--mute); }
.speak.on { border-color: var(--aodInk); }
.speak.on .speak-state { color: var(--aodInk); }
.speak.speaking .speak-wave { animation: addie-busy-pulse 900ms var(--ease-standard) infinite; }

/* The one line under the composer: what the microphone is doing, or a refusal the visitor can act
   on. It reuses the busy row's dots while a clip is being transcribed, so there is one animation
   in this stylesheet and one reduced-motion rule that stills it. */
.voice-note {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-width: 0;
  width: 100%; max-width: var(--container-max); margin: 0 auto;
  padding: 0 var(--gutter) 12px; font-size: var(--text-xs); color: var(--aodInkSoft);
  overflow-wrap: anywhere;
}
.voice-note[hidden] { display: none; }
.voice-note.error { color: var(--aodFail); }

/* ---- the privacy notice and its links (wave M3 P8) --------------------------------------- */
/* Mute and small, like the voice line: a link that is always there, never a banner. The page itself
   is one readable column; every colour is a named role, so light and dark follow the surface. */
.privacy-note {
  width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--gutter) 12px;
  font-size: var(--text-xs); color: var(--aodInkSoft);
}
.privacy-note a, .card-privacy a, .back-link { color: var(--aodInkSoft); }
.card-privacy { margin: 0; font-size: var(--text-xs); }
.back-link { font-size: var(--text-xs); }
.privacy {
  width: 100%; max-width: 680px; margin: 0 auto; padding: var(--space-6) var(--gutter) var(--space-8);
  color: var(--aodInkBody); overflow-wrap: anywhere;
}
.privacy h1 { font-size: var(--text-xl); font-weight: 800; color: var(--aodInk); margin: 0 0 var(--space-4); }
.privacy h2 { font-size: var(--text-base); font-weight: 800; color: var(--aodInk); margin: var(--space-6) 0 var(--space-3); }
.privacy .facts { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.privacy .period { font-weight: 800; color: var(--aodInk); }

@media (max-width: 640px) {
  :root { --gutter: var(--container-gutter-phone); }
  .turn-addie .avatar { width: 36px; height: 36px; }
  .welcome h1 { font-size: var(--text-lg); }
  .starters button { width: 100%; }
  /* M3-D34: the phone's first screen holds the whole welcome, the composer and the privacy link at
     390x844. The bubble, the spacing and the composer's side padding give up the room; no copy goes. */
  main { padding-top: var(--space-3); }
  .welcome { gap: var(--space-3); padding: 0; }
  .welcome img { width: min(240px, 60vw); }
  .starters { gap: var(--space-2); }
  .composer { gap: var(--space-2); padding-top: var(--space-3); padding-bottom: var(--space-3); }
  .composer input { padding: 0 var(--space-3); text-overflow: ellipsis; }
  .composer input::placeholder { font-size: var(--text-xs); }
  .composer button#send { padding: 0 var(--space-3); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  /* The pulse goes; the stage word and the counter stay, and the dots sit at a legible rest. */
  .busy .dot { animation: none !important; opacity: 0.6; }
  /* Same rule for the mic's listening dot, which is a state indicator rather than decoration, so
     it rests fully opaque and the button still reads as recording without moving. */
  .mic.listening .mic-dot { animation: none !important; opacity: 1; }
  /* And the speaking arc: the word on the toggle still says what is happening. */
  .speak.speaking .speak-wave { animation: none !important; }
}

/* The operator face (wave MO P4): the wit-dials link in the app bar and each reply's meta line —
   persona version, the operator dials the turn ran under, and its credits. Mute, like the receipt. */
.wit-link { font-size: var(--text-xs); color: var(--aodInkSoft); margin-right: var(--space-3); }
.meta { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-width: 0;
        font-size: var(--text-xs); color: var(--aodInkSoft); margin-top: var(--space-2); }
.meta .dials { min-width: 0; overflow-wrap: anywhere; }
.meta[data-no-persona="true"] .dials { font-style: italic; }
.credits { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
