/* EchoTrail Studio — "closing hour".
   A deep blue-green dark room where the only warm light is the lamp on a wall
   label. Separation by hairline and surface step; no shadows anywhere. Amber is
   functional only: playing state, progress fill, focus ring, current marker. */

:root {
  --canvas: #0E1417;
  --plinth: #161F23;
  --vitrine: #1E2A2F;
  --seam: #2C3A40;
  --seam-soft: #222E33;
  --body: #C3CFD2;
  --dim: #8C9BA0;
  --daylight: #EEF3F3;
  --amber: #E8A33D;
  --verdigris: #4FB8A5;
  --oxide: #D9705A;

  --ui: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r: 4px;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px; --s8: 64px; --s12: 96px; --s16: 128px;
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--ui);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
}

body.bare { background: #fff; color: #111; }
body.bare main { max-width: 34em; margin: 0 auto; padding: 24px 20px 64px; font-family: var(--read); }
body.bare .mono { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #555; }
body.bare h1 { font-family: var(--ui); font-weight: 400; font-size: 28px; line-height: 1.1; }
body.bare .print-back { font-family: var(--ui); font-size: 13px; }
@media print { body.bare .print-back { display: none; } }

/* ── skip link ───────────────────────────────────────────────────────────── */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--vitrine); color: var(--daylight);
  padding: 12px 18px; border: 1px solid var(--amber); border-radius: var(--r);
}
.skip:focus { left: 12px; top: 12px; }

/* ── links ───────────────────────────────────────────────────────────────── */
a { color: var(--daylight); text-decoration: none; border-bottom: 1px solid var(--seam); }
a:hover { border-bottom-color: var(--body); }
a.plain, .topbar a, .foot a, .wordmark { border-bottom: 0; }
.foot a:hover, .topbar a:hover { border-bottom: 1px solid var(--seam); }

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

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar { border-bottom: 1px solid var(--seam); background: var(--canvas); position: sticky; top: 0; z-index: 20; }
.topbar-in {
  max-width: 1060px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
}
.wordmark {
  font-size: 15px; font-weight: 500; color: var(--daylight);
  letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 10px;
}
.wordmark span { color: var(--dim); font-weight: 400; }
.wm-mark { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.wm-mark i { display: block; width: 2px; background: var(--body); }
.wm-mark i:nth-child(1) { height: 9px; }
.wm-mark i:nth-child(2) { height: 16px; }
.wm-mark i:nth-child(3) { height: 6px; }
.wm-mark i:nth-child(4) { height: 11px; background: var(--amber); }

.topbar nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.topbar nav a {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--dim); padding: 8px 10px; border-radius: var(--r); min-height: 36px;
  display: inline-flex; align-items: center;
}
.topbar nav a:hover { color: var(--daylight); background: var(--plinth); border-bottom: 0; }
.topbar nav a[aria-current="page"] { color: var(--daylight); background: var(--plinth); }

/* ── layout ──────────────────────────────────────────────────────────────── */
main { padding: var(--s6) 20px var(--s12); margin: 0 auto; }
.col-read { max-width: 720px; }
.col-wide { max-width: 1060px; }
section + section { margin-top: var(--s12); }
@media (max-width: 640px) { section + section { margin-top: var(--s8); } main { padding-top: var(--s4); } }

/* ── type ────────────────────────────────────────────────────────────────── */
h1 {
  font-size: clamp(34px, 7vw, 64px); font-weight: 300; line-height: 1.05;
  letter-spacing: -0.02em; color: var(--daylight); margin: 0 0 var(--s3);
  text-wrap: balance;
}
h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 300; line-height: 1.1; letter-spacing: -0.02em; color: var(--daylight); margin: 0 0 var(--s2); }
h3 { font-size: 19px; font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; color: var(--daylight); margin: 0 0 var(--s1); }
p { margin: 0 0 var(--s2); max-width: 68ch; }
.lede { font-size: 19px; color: var(--body); max-width: 60ch; }
.dim { color: var(--dim); }
.small { font-size: 14px; }

.mono {
  font-family: var(--mono); font-size: 11px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .16em; color: var(--dim);
}
.eyebrow { display: block; margin: 0 0 var(--s2); }

.rule { border: 0; border-top: 1px solid var(--seam); margin: var(--s4) 0; }

ul.plainlist, ol.plainlist { margin: 0 0 var(--s2); padding-left: 1.1em; }
ul.plainlist li, ol.plainlist li { margin-bottom: 8px; max-width: 66ch; }

/* ── wall label ──────────────────────────────────────────────────────────── */
.label {
  background: var(--plinth); border: 1px solid var(--seam-soft); border-radius: var(--r);
  padding: var(--s3); margin: 0 0 var(--s2);
}
.label-index { display: flex; gap: var(--s2); align-items: baseline; margin: 0 0 6px; flex-wrap: wrap; }
.label-meta { color: var(--dim); }
.label-title { margin: 0 0 var(--s1); }
.label-title a { border-bottom: 0; }
.label-title a:hover { border-bottom: 1px solid var(--seam); }
.label-body { border-top: 1px solid var(--seam); padding-top: var(--s2); }
.label-body > :last-child { margin-bottom: 0; }
.label-tail { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--seam); }
.label.tone-work { border-left: 2px solid var(--amber); }
.label.tone-done { border-left: 2px solid var(--verdigris); }
.label.tone-alert { border-left: 2px solid var(--oxide); }
.label.tone-wait { border-left: 2px solid var(--seam); }

/* ── chips ───────────────────────────────────────────────────────────────── */
.chip {
  display: inline-block; padding: 3px 9px; border: 1px solid var(--seam);
  border-radius: var(--r); color: var(--dim); background: transparent;
}
.chip-done { color: var(--verdigris); border-color: rgba(79,184,165,.4); }
.chip-work { color: var(--amber); border-color: rgba(232,163,61,.4); }
.chip-alert { color: var(--oxide); border-color: rgba(217,112,90,.45); }
.chip-quiet { color: var(--dim); }

/* ── fiction banner ──────────────────────────────────────────────────────── */
.fiction {
  border: 1px solid var(--seam); border-left: 2px solid var(--oxide);
  border-radius: var(--r); padding: var(--s2) var(--s3); margin: 0 0 var(--s4);
  background: var(--plinth);
}
.fiction p { margin: 0; font-size: 14px; max-width: 64ch; }
.fiction p.mono { color: var(--oxide); margin-bottom: 6px; }

/* ── stop list / guide ───────────────────────────────────────────────────── */
.stop { border-top: 1px solid var(--seam); padding: var(--s3) 0; }
.stop:last-of-type { border-bottom: 1px solid var(--seam); }
.stop-head { display: flex; gap: var(--s3); align-items: flex-start; }
.mark { width: 64px; height: 64px; flex: 0 0 64px; background: var(--plinth); border-radius: var(--r); }
.stop-heads { flex: 1 1 auto; min-width: 0; }
.stop-index { display: flex; gap: var(--s2); align-items: baseline; margin: 0 0 6px; flex-wrap: wrap; }
.stop h2 { font-size: clamp(22px, 3.2vw, 28px); margin-bottom: 6px; }
.stop-stand { font-family: var(--read); font-size: 17px; color: var(--dim); margin: 0; max-width: 54ch; }
.stop.is-playing .stop-index .mono:first-child { color: var(--amber); }

.stop-actions { display: flex; gap: var(--s1); flex-wrap: wrap; margin-top: var(--s2); }

details.stop-panel { margin-top: var(--s2); }
details.stop-panel > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--dim); border: 1px solid var(--seam); border-radius: var(--r);
  padding: 10px 14px; min-height: 40px;
}
details.stop-panel > summary::-webkit-details-marker { display: none; }
details.stop-panel > summary:hover { color: var(--daylight); background: var(--plinth); }
details[open].stop-panel > summary { color: var(--daylight); background: var(--plinth); }
.panel-in { background: var(--vitrine); border: 1px solid var(--seam); border-radius: var(--r); padding: var(--s3); margin-top: var(--s2); }

/* ── transcript ──────────────────────────────────────────────────────────── */
.transcript { font-family: var(--read); font-size: 18px; line-height: 1.65; max-width: 68ch; }
.transcript p { margin: 0 0 var(--s2); }
.transcript p:last-child { margin-bottom: 0; }
@media (max-width: 480px) { .transcript { font-size: 17px; } }

/* ── player ──────────────────────────────────────────────────────────────── */
.player { margin: 0; }
.player-row { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.btn {
  font-family: var(--ui); font-size: 14px; font-weight: 400;
  background: transparent; color: var(--body);
  border: 1px solid var(--seam); border-radius: var(--r);
  padding: 10px 14px; min-height: 44px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { color: var(--daylight); background: var(--plinth); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--daylight); color: var(--canvas); border-color: var(--daylight); font-weight: 500; }
.btn-primary:hover { background: #fff; color: var(--canvas); }
.btn-play { min-width: 104px; justify-content: center; }
.btn-play[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.btn-mono { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .16em; }

.seek { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.timecode { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); min-width: 44px; }
.track {
  position: relative; flex: 1 1 auto; height: 24px; display: flex; align-items: center;
  cursor: pointer; border-radius: 2px;
}
.track-bed { position: absolute; left: 0; right: 0; height: 2px; background: var(--seam); }
.track-fill { position: absolute; left: 0; height: 2px; width: 0; background: var(--amber); }
.track-knob {
  position: absolute; left: 0; width: 2px; height: 14px; background: var(--amber);
  transform: translateX(-1px);
}
@media (prefers-reduced-motion: no-preference) {
  .track-fill, .track-knob { transition: width .15s linear, left .15s linear; }
}
.player-meta { margin-top: var(--s2); }
.player-meta .mono { color: var(--dim); }

.no-audio {
  border: 1px solid var(--seam); border-radius: var(--r);
  padding: var(--s2); background: var(--plinth);
}
.no-audio p { margin: 0; font-size: 14px; }
.no-audio .mono { color: var(--dim); display: block; margin-bottom: 4px; }

/* ── forms ───────────────────────────────────────────────────────────────── */
form.card, .card {
  background: var(--plinth); border: 1px solid var(--seam-soft);
  border-radius: var(--r); padding: var(--s3);
}
.field { margin-bottom: var(--s3); }
.field:last-child { margin-bottom: 0; }
label { display: block; }
.field > label > span.lab,
label > span.lab {
  display: block; font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .16em; color: var(--dim); margin-bottom: 8px;
}
.hint { font-size: 13px; color: var(--dim); margin: 6px 0 0; }
input[type=text], input[type=email], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--daylight);
  background: var(--vitrine); border: 1px solid var(--seam); border-radius: var(--r);
  padding: 12px 13px; min-height: 46px;
}
textarea { min-height: 120px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6E7C81; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--amber); }
.row { display: grid; gap: var(--s2); grid-template-columns: 1fr 1fr; }
.row-3 { display: grid; gap: var(--s2); grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .row, .row-3 { grid-template-columns: 1fr; } }
.actions { margin-top: var(--s3); display: flex; gap: var(--s1); align-items: center; flex-wrap: wrap; }

.err, .ok {
  border: 1px solid var(--seam); border-radius: var(--r); padding: var(--s2) var(--s3);
  margin: 0 0 var(--s3); background: var(--plinth);
}
.err { border-left: 2px solid var(--oxide); }
.ok { border-left: 2px solid var(--verdigris); }
.err p, .ok p { margin: 0; font-size: 15px; }
.err .mono { color: var(--oxide); display: block; margin-bottom: 4px; }
.ok .mono { color: var(--verdigris); display: block; margin-bottom: 4px; }
.field-err { color: var(--oxide); font-size: 13px; margin: 6px 0 0; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--oxide); }

/* ── tables / ledger ─────────────────────────────────────────────────────── */
.grid-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid-table th, .grid-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--seam); vertical-align: top; }
.grid-table th {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .16em; color: var(--dim); font-weight: 400;
}
.grid-table tr:last-child td { border-bottom: 0; }
.scroller { overflow-x: auto; }

/* ── estimate output ─────────────────────────────────────────────────────── */
.signals { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.signal { background: var(--vitrine); border: 1px solid var(--seam); border-radius: var(--r); padding: var(--s2); }
.signal .k { display: block; margin-bottom: 6px; }
.signal .v { font-size: 22px; font-weight: 300; color: var(--daylight); line-height: 1.1; }
.band { font-size: clamp(28px, 5vw, 44px); font-weight: 300; color: var(--daylight); letter-spacing: -0.02em; line-height: 1.05; }

/* ── qr sheet ────────────────────────────────────────────────────────────── */
.qr-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.qr-card { background: var(--plinth); border: 1px solid var(--seam); border-radius: var(--r); padding: var(--s2); text-align: center; }
.qr-card img { width: 100%; max-width: 168px; height: auto; background: #fff; border-radius: 2px; padding: 8px; }
.qr-card h3 { font-size: 15px; margin-top: var(--s2); }

/* ── footer ──────────────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--seam); margin-top: var(--s12); }
.foot-in { max-width: 1060px; margin: 0 auto; padding: var(--s4) 20px var(--s8); }
.foot-in nav { display: flex; gap: var(--s3); flex-wrap: wrap; margin: var(--s2) 0; }
.foot-in nav a { font-size: 14px; color: var(--body); }
.foot-note { font-size: 13px; color: var(--dim); max-width: 70ch; margin: var(--s2) 0 0; }

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

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

/* Printable pages use a light palette, including headings and links. */
body.bare h1, body.bare h2, body.bare h3, body.bare a { color: #17252b; }
body.bare a { text-decoration: underline; }
