/* Hindsight · the Positioning Audit
   Chrome on the brand token canon (studio-home-b). Light-first: cream ground, ink
   punctuation, oxblood accent. Data colors are the audit's own (authorship pair). */

:root {
  --ink: #1A1813;
  --cream: #F2EEE4;
  --bone: #E5DFD1;
  --taupe: #8C8474;
  --hairline: #CBC3B0;
  --oxblood: #2F5570;
  --ox-lift: #82AACB;

  --ground: var(--cream);
  --panel: var(--bone);
  --text: var(--ink);
  --muted: #6E6759;
  --line: var(--hairline);
  --accent: var(--oxblood);

  /* audit data colors */
  --you: var(--oxblood);        /* authored by you */
  --foryou: #A05A2C;            /* authored for you: warm sienna against the blues */
  --inferred: var(--taupe);
  --gate: #8A5A00;
  --match: #1D6E4F;
  --miss: #A03030;

  --serif: "Instrument Serif", "Didot", "Bodoni 72", "Baskerville", serif;
  --editorial: "Cormorant Garamond", "Baskerville", serif;
  --body: "Geist", "Helvetica Neue", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Menlo", monospace;
}

:root[data-theme="dark"] {
  --ground: #12100C;
  --panel: #1C1913;
  --text: #E9E4D6;
  --muted: #9A9078;
  --line: #35301F;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--ground); color: var(--text); font-family: var(--body);
  font-size: 15.5px; line-height: 1.6; margin: 0; min-height: 100vh; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.05; letter-spacing: -0.01em; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
h2 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.12; }
.editorial { font-family: var(--editorial); font-style: italic;
  font-size: clamp(16px, 2vw, 19px); line-height: 1.5; color: var(--muted); max-width: 58ch; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.eyebrow .dot { color: var(--accent); }

/* ---------- topbar ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--ink); color: var(--cream); }
.topbar .row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: baseline; gap: 14px; padding: 16px 0; }
.wordmark { font-family: var(--serif); font-size: 24px; letter-spacing: 0.005em; }
.wordmark .istem { position: relative; font-style: normal; }
.wordmark .istem::before { content: ""; position: absolute; top: 0.13em; left: 50%;
  transform: translateX(-50%); width: 0.11em; height: 0.11em; border-radius: 50%;
  background: var(--ox-lift); }
.brand-sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.13em;
  text-transform: uppercase; color: #9A9078; }
.tabs { display: flex; gap: 26px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.13em; text-transform: uppercase; }
.tabs a { color: var(--cream); text-decoration: none; padding: 6px 0;
  border-bottom: 1px solid transparent; }
.tabs a:hover { border-bottom-color: var(--ox-lift); }
.tabs a.dim { color: #9A9078; }

/* ---------- views ---------- */
.view { display: none; padding: 48px 0 80px; }
.view.active { display: block; }

/* ---------- intake ---------- */
.intake { margin-top: 40px; max-width: 620px; display: flex; flex-direction: column; gap: 22px; }
.intake label { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); }
.field-note { font-family: var(--editorial); font-style: italic; font-size: 14.5px;
  color: var(--muted); }
.intake input, .intake textarea { background: var(--panel); border: 1px solid var(--line);
  color: var(--text); font-family: var(--body); font-size: 16px; padding: 13px 14px;
  border-radius: 2px; resize: vertical; }
.intake input:focus, .intake textarea:focus { outline: none; border-color: var(--accent); }
.btn { display: inline-block; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase; background: transparent;
  color: var(--text); border: 1px solid var(--text); padding: 13px 22px; cursor: pointer;
  text-decoration: none; text-align: center; border-radius: 2px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-solid { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--cream); }
.btn-wide { display: block; width: 100%; margin-top: 18px; }

/* ---------- run ---------- */
.stages { list-style: none; margin: 36px 0 0; padding: 0; max-width: 680px; }
.stages li { display: grid; grid-template-columns: 150px 1fr auto; gap: 16px;
  align-items: baseline; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.st-name { font-family: var(--serif); font-size: 20px; }
.st-note { font-size: 13px; color: var(--muted); }
.st-state { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.stages li.on .st-state { color: var(--accent); }
.stages li.on .st-state::after { content: " ●"; animation: pulse 1.2s infinite; }
.stages li.done .st-state { color: var(--match); }
@keyframes pulse { 50% { opacity: 0.25; } }
.run-log { margin-top: 22px; font-size: 11px; color: var(--muted); white-space: pre-line;
  max-width: 680px; }
.error-card { margin-top: 24px; border: 1px solid var(--miss); padding: 18px 20px;
  max-width: 680px; border-radius: 2px; }
.error-card code { font-family: var(--mono); font-size: 12px; }

/* ---------- instrument ---------- */
.verdict-strip { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line);
  background: var(--panel); margin-bottom: 26px; }
.verdict-cell { flex: 1 1 200px; padding: 18px 22px; border-right: 1px solid var(--line); }
.verdict-cell:last-child { border-right: none; }
.v-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.v-value { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.v-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ratio-bar { height: 8px; background: var(--foryou); margin-top: 10px; position: relative;
  border-radius: 1px; overflow: hidden; }
.ratio-bar i { position: absolute; inset: 0 auto 0 0; background: var(--you); display: block; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 26px; align-items: start; }
.col-graph, .col-side { min-width: 0; }
.panel { border: 1px solid var(--line); background: var(--panel); padding: 20px 22px;
  margin-bottom: 26px; border-radius: 2px; }
.panel-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; margin: 0 0 14px; }
.chart-scroll { overflow-x: auto; }
#migration-svg { display: block; min-width: 640px; width: 100%; }
.scrub-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.scrub-row input[type="range"] { flex: 1; accent-color: var(--accent); }
#scrub-label { font-size: 10.5px; letter-spacing: 0.1em; color: var(--muted); min-width: 90px;
  text-align: right; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin: 12px 0 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px;
  vertical-align: -1px; }
.sw-you { background: var(--you); }
.sw-foryou { background: var(--foryou); }
.sw-inferred { background: transparent; border: 1.5px dashed var(--inferred); }

/* ledger */
.hop { display: grid; grid-template-columns: 86px 1fr auto; gap: 14px; padding: 13px 2px;
  border-bottom: 1px solid var(--line); cursor: pointer; align-items: baseline; }
.hop:hover { background: color-mix(in srgb, var(--line) 30%, transparent); }
.hop:last-child { border-bottom: none; }
.hop-era { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); }
.hop-body b { font-weight: 600; font-size: 14.5px; }
.hop-body .carrier { font-size: 12.5px; color: var(--muted); }
.hop-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.hop-tag.you { background: var(--you); color: var(--cream); }
.hop-tag.for_you { background: var(--foryou); color: var(--cream); }
.hop-tag.inferred { background: transparent; border: 1px dashed var(--inferred);
  color: var(--muted); }
.hop.dimmed { opacity: 0.25; }

/* present panels */
.lens { margin-bottom: 18px; }
.lens:last-child { margin-bottom: 0; }
.lens-title { font-family: var(--serif); font-size: 19px; margin-bottom: 6px; }
.lens p { margin: 6px 0; font-size: 14px; }
.quote-pair { display: grid; gap: 8px; margin: 8px 0; }
.quote-pair .q { font-family: var(--editorial); font-style: italic; font-size: 14.5px;
  border-left: 2px solid var(--line); padding-left: 10px; }
.quote-pair .q.self { border-left-color: var(--you); }
.quote-pair .q.recv { border-left-color: var(--foryou); }
.code-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.code-row > span:first-child { flex: 1 1 auto; min-width: 0; }
.code-row:last-child { border-bottom: none; }
.traj { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; white-space: nowrap; }
.traj.ascending { color: var(--match); }
.traj.stable { color: var(--muted); }
.traj.curdling { color: var(--miss); }

/* decode seam */
.seam { border-left: 3px solid var(--accent); }
.seam ul { margin: 8px 0 10px; padding-left: 18px; font-size: 14px; }
.seam .seam-cta { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); }

/* backtest panel */
.bt-row { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bt-row:last-child { border-bottom: none; }
.bt-verdict { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; }
.bt-verdict.match { color: var(--match); }
.bt-verdict.miss { color: var(--miss); }
.gate-note { font-family: var(--editorial); font-style: italic; color: var(--gate);
  font-size: 14.5px; }

/* receipts drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  background: var(--ground); border-left: 1px solid var(--line); transform: translateX(102%);
  transition: transform 0.22s ease; z-index: 40; overflow-y: auto; padding: 20px 22px; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; }
.drawer-x { background: none; border: none; font-size: 26px; color: var(--muted);
  cursor: pointer; line-height: 1; }
.drawer-veil { position: fixed; inset: 0; background: rgba(26, 24, 19, 0.35); z-index: 30; }
.receipt { border: 1px solid var(--line); background: var(--panel); padding: 13px 15px;
  margin-bottom: 12px; border-radius: 2px; }
.receipt .r-id { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--accent); }
.receipt .r-title { font-size: 14px; font-weight: 600; margin: 4px 0; }
.receipt .r-meta { font-family: var(--mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; }
.receipt .r-excerpt { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.receipt a { color: var(--accent); font-size: 12px; }

/* ---------- dossier ---------- */
.dossier { max-width: 720px; margin: 0 auto; }
.dossier .d-head { border-bottom: 2px solid var(--ink); padding-bottom: 22px;
  margin-bottom: 30px; }
.dossier h1 { font-size: clamp(30px, 4.6vw, 46px); }
.dossier h2 { font-size: 26px; margin: 40px 0 12px; }
.dossier p, .dossier li { font-size: 15.5px; }
.dossier .lede { font-family: var(--editorial); font-style: italic; font-size: 19px;
  color: var(--muted); }
.d-ratio { display: flex; align-items: baseline; gap: 14px; margin: 20px 0; }
.d-ratio .big { font-family: var(--serif); font-size: 52px; color: var(--foryou); }
.rcite { font-family: var(--mono); font-size: 10px; color: var(--accent);
  letter-spacing: 0.06em; cursor: pointer; }
.d-hop { border-left: 2px solid var(--line); padding: 2px 0 2px 14px; margin: 14px 0; }
.d-hop.you { border-left-color: var(--you); }
.d-hop.for_you { border-left-color: var(--foryou); }
.d-hop .who { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); }
.dossier .print-btn { margin: 30px 0; }

.foot { padding: 26px 28px 40px; font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted); }

@media (max-width: 860px) {
  .grid-main { grid-template-columns: 1fr; }
  .stages li { grid-template-columns: 1fr; gap: 4px; }
}

@media print {
  .topbar, .foot, .print-btn, #btn-dossier { display: none !important; }
  body { background: #fff; color: #111; font-size: 12pt; }
  .view { display: none; padding: 0; }
  .view.print-target { display: block; }
  .dossier { max-width: none; }
}
