/* WITTS Phone — shared design system.
 *
 * The single source of visual truth for both pages. Every value here traces to
 * DESIGN.md (and its approved style tile, docs/style-tile.html): the candlelit
 * night sky, Georgia headings with a soft glow, Cinzel only as small tracked
 * whispers, one gold gradient fill per view, glows instead of gray shadows.
 *
 * Dark is the primary appearance (defined here). The operator console layers a
 * fully-specified light appearance on top (operator.css) for daylit studios;
 * the caller widget stays candlelit by design.
 */

:root {
  --bg-deep: #020608;
  --bg-panel: rgba(13, 27, 42, .55);
  --bg-ghost: rgba(15, 32, 52, .3);

  --ink: #cfd8e3;
  --ink-bright: #e2e8f0;
  --ink-dim: #8294a8;

  --blue: #4ea3ff;
  --blue-soft: #9cc6ee;
  --blue-glow: rgba(64, 140, 220, .45);
  --blue-border: rgba(110, 160, 210, .45);

  --gold: #e8c25a;
  --gold-deep: #c89224;
  --gold-fill: linear-gradient(180deg, #ffe9a8, #d8a93f);
  --on-gold: #1d0d03;
  --input-bg: rgba(2, 6, 8, .35);
  --input-line: rgba(120, 160, 205, .34); /* fields need a clearer edge than panels */
  --line: rgba(110, 150, 195, .18);
  --line-gold: rgba(232, 194, 90, .28);
  --gold-halo: 0 0 26px rgba(216, 169, 63, .35);
  --gold-halo-lit: 0 0 40px rgba(240, 193, 75, .6);
  --gold-glow-text: 0 0 18px rgba(216, 169, 63, .4);

  --danger: #f0836f;
  --danger-fill: linear-gradient(180deg, #b04836, #8e2c1c);
  --on-danger: #fdf1ee;
  --pos: #8fce9f;

  --serif: Georgia, 'Times New Roman', serif;
  --display: 'Cinzel', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);

  --panel-pad: 28px 30px;
  --radius-panel: 8px;
  --radius-control: 5px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font: 17px/1.65 var(--serif);
  color: var(--ink);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(28, 66, 110, .55) 0%, rgba(10, 25, 44, .25) 45%, rgba(2, 6, 8, 0) 72%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(16, 38, 62, .35) 0%, rgba(2, 6, 8, 0) 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- typography ------------------------------------------------------- */

.kicker {
  font: 600 .72rem var(--display);
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--blue);
}
.kicker.gold { color: var(--gold); }

h1, h2, h3 { overflow-wrap: break-word; }
h1 {
  font: normal 1.45rem/1.2 var(--serif);
  color: var(--ink-bright);
  text-shadow: 0 0 18px var(--blue-glow);
}
.hero {
  font-size: clamp(1.9rem, 4.6vw, 3rem);
}
h2 {
  font: normal 1.45rem/1.2 var(--serif);
  color: var(--ink-bright);
  text-shadow: 0 0 18px var(--blue-glow);
}
h3 {
  font: normal 1.12rem/1.2 var(--serif);
  color: var(--ink-bright);
  text-shadow: 0 0 12px var(--blue-glow);
}
.lede { font-size: 1.12rem; color: var(--ink-bright); max-width: 68ch; }
.meta { color: var(--ink-dim); font-size: .95rem; }
.dim, .muted { color: var(--ink-dim); }
.note { font-size: .85rem; color: var(--ink-dim); max-width: 68ch; }

/* State label — Cinzel whisper (§ card & state labels .82/.26em). Neutral by
 * default; gold is reserved for a *live* label (a person is here: AVAILABLE,
 * RINGING, INCOMING CALL) so the gold light stays scarce and meaningful. */
.state {
  display: inline-block;
  font: 600 .82rem var(--display);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--ink-bright);
}
.state.live { color: var(--gold); }
.state.pos { color: var(--pos); }
.state.dim { color: var(--ink-dim); }

/* The live dot: a small danger dot + italic serif line (site idiom). */
.live-dot { font-style: italic; color: var(--ink-dim); font-size: .95rem; }
.live-dot::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); margin-right: 9px; vertical-align: 1px;
}
.pos-dot::before { background: var(--pos); }

/* Gradient rule divider (§ the site's .rule). */
.rule {
  width: 170px; height: 1px; border: 0;
  background: linear-gradient(90deg, var(--blue-glow), transparent);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- surfaces --------------------------------------------------------- */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: var(--panel-pad);
}

/* A live call: hairline turns gold and the heading glows gold (§ signature). */
.panel.connected { border-color: var(--line-gold); box-shadow: 0 0 24px rgba(216, 169, 63, .12); }
.panel.connected h2, .panel.connected h3 { text-shadow: var(--gold-glow-text); }

.timer {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.45rem; color: var(--ink-bright);
}

/* ---- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  font: 600 .8rem var(--display);
  letter-spacing: .16em; text-transform: uppercase;
  padding: 13px 30px; border-radius: var(--radius-control); border: 0;
  cursor: pointer; text-decoration: none;
  /* Scoped, never `all` — text color must not animate (§ Motion). */
  transition: box-shadow .3s, transform .3s, border-color .3s, background-color .3s;
  color: var(--ink-bright); background: transparent;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-gold { color: var(--on-gold); background: var(--gold-fill); box-shadow: var(--gold-halo); }
.btn-gold:not(:disabled):hover { box-shadow: var(--gold-halo-lit); transform: translateY(-2px); }
.btn-gold:not(:disabled):active { box-shadow: var(--gold-halo); transform: translateY(0); }

.btn-ghost {
  color: var(--blue-soft);
  border: 1px solid var(--blue-border);
  background: var(--bg-ghost);
  padding: 12px 29px;
}
.btn-ghost:not(:disabled):hover { color: var(--ink-bright); border-color: var(--blue-soft); box-shadow: 0 0 22px rgba(80, 150, 220, .3); }

.btn-danger { color: var(--on-danger); background: var(--danger-fill); box-shadow: 0 0 22px rgba(176, 72, 54, .25); }
.btn-danger:not(:disabled):hover { box-shadow: 0 0 34px rgba(200, 90, 60, .4); transform: translateY(-2px); }
.btn-danger:not(:disabled):active { transform: translateY(0); }

/* Deliberate focus ring in the gold idiom — never the default blue ring. */
.btn:focus-visible {
  outline: 0;
  box-shadow: var(--gold-halo), 0 0 0 2px var(--bg-deep), 0 0 0 4px var(--gold);
}

/* ---- form fields ------------------------------------------------------ */

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block; margin-bottom: 7px;
  font-size: .95rem; color: var(--ink-dim);
}
.input {
  width: 100%;
  font: 1rem var(--serif); color: var(--ink-bright);
  background: var(--input-bg);
  border: 1px solid var(--input-line);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  transition: border-color .3s, box-shadow .3s;
}
.input::placeholder { color: var(--ink-dim); }
.input:focus-visible {
  outline: 0;
  border-color: var(--line-gold);
  box-shadow: 0 0 0 1px var(--line-gold), 0 0 20px rgba(216, 169, 63, .18);
}

/* ---- feedback text ---------------------------------------------------- */

.error { color: var(--danger); font-size: .95rem; min-height: 1.4em; }
.error:empty { display: none; }

/* ---- the kindle: availability lights, it doesn't appear --------------- */
/* The gold action starts unlit; adding .lit blooms it over 600ms (a lamp
 * warming). Removing .lit is the 300ms lamp going out — never a delete. */

.kindle {
  opacity: 0;
  transform: translateY(2px);
  box-shadow: none;
  transition: opacity 600ms var(--ease), box-shadow 600ms var(--ease), transform 600ms var(--ease);
}
.kindle.lit {
  opacity: 1;
  transform: translateY(0);
  box-shadow: var(--gold-halo);
}
.kindle.lit:not(:disabled):hover { box-shadow: var(--gold-halo-lit); transform: translateY(-2px); }
/* Unlit: the lamp is out — no fill at all (beats .btn:disabled's 40%), space
 * still held so nothing reflows. Going out is quicker than kindling. */
.btn.kindle:not(.lit) {
  opacity: 0;
  box-shadow: none;
  pointer-events: none;
  transition-duration: 300ms;
}

/* ---- ringing breath --------------------------------------------------- */

@keyframes witts-breathe {
  0%, 100% { box-shadow: 0 0 26px rgba(216, 169, 63, .25); }
  50%      { box-shadow: 0 0 26px rgba(240, 193, 75, .45); }
}
.ringing { animation: witts-breathe 2.4s var(--ease) infinite; border-color: var(--line-gold); }

/* ---- state transitions ------------------------------------------------ */
/* Screen/panel changes fade in over 300ms; nothing reflows or blinks. */

.screen[hidden], .panel[hidden] { display: none; }
.screen, .panel { animation: witts-fade-in 300ms ease-out both; }
@keyframes witts-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- reduced motion --------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .ringing { animation: none; box-shadow: 0 0 26px rgba(216, 169, 63, .4); }
  .btn, .kindle, .input { transition: opacity 120ms linear; }
  .btn:hover, .btn-danger:hover, .btn-gold:hover { transform: none; }
  .screen, .panel { animation: none; }
  .kindle { transform: none; }
}
