/* ==========================================================================
   Journey page -- assets/css/terminal.css supplies the reset, the site
   chrome and every :root token except the chart ones below. Load this
   AFTER terminal.css.

   GENERATED by scripts/split_mockup.py from the mockup in analysis/.
   Edit the mockup, not this file, until the mockup is retired.
   ========================================================================== */
:root {
  /* --- new: chart tokens, validated against the #1a1a2e ground --- */
  --c-waist: #4a9ada;
  --c-weight: #c07f2e;
  --c-post: #9d6fd6;
  /* VO2max sits in its own panel, so it only has to separate from the page
     ground and from the grid -- never from another line on the same axis. */
  --c-vo2: #46b3a6;
  --grid: rgba(255, 255, 255, 0.07);
  --axis: rgba(255, 255, 255, 0.14);
}
.lede { max-width: 65ch; color: #bcbcbc; }

/* ---------- Stat tiles ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin: 28px 0; }
.tile { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: 14px 18px 16px; border-top: 2px solid var(--tile-accent, var(--border-light)); }
.tile .k { font-family: var(--font-heading); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.tile .v { font-family: var(--font-code); font-size: 30px; line-height: 1.1; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.tile .v .u { font-size: 15px; color: var(--text-secondary); margin-left: 3px; }
.tile .d { font-family: var(--font-code); font-size: 12.5px; color: var(--text-secondary); margin-top: 7px; font-variant-numeric: tabular-nums; }

/* ---------- Chart shell ---------- */
.instrument { background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 16px 20px 14px; position: relative; }

/* Legend items are real buttons — they toggle their series, so they must look
   pressable rather than like a static key. */
.legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.legend .item { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-code);
  font-size: 12.5px; color: var(--text-secondary); padding: 4px 9px; border-radius: var(--radius-md);
  border: 1px solid transparent; background: none; }
button.item { cursor: pointer; border-color: var(--border-subtle); transition: background .2s ease, border-color .2s ease, color .2s ease; }
button.item:hover { background: var(--bg-hover); border-color: var(--border-light); color: var(--text-primary); }
button.item[aria-pressed="false"] { opacity: .42; }
button.item[aria-pressed="false"] .sw { filter: grayscale(1); }
.legend .sw { width: 15px; height: 3px; border-radius: 2px; flex: none; }
.legend .sw.dot { width: 9px; height: 9px; border-radius: 50%; }
.legend .sw.hatch { width: 15px; height: 11px; border-radius: 2px;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 2px, transparent 2px 5px); border: 1px solid rgba(255,255,255,.1); }
.legend .sw.ring { width: 9px; height: 9px; border-radius: 50%; background: none; border: 2px solid var(--c-waist); }

.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 12px; }
.grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.grp > .lbl { font-family: var(--font-heading); font-size: 10px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-faint); margin-right: 2px; }
.btn { display: inline-block; padding: 5px 12px; color: rgba(255,255,255,.75); background: var(--bg-hover);
  border: 1px solid var(--border-light); border-radius: var(--radius-md); font-family: var(--font-body);
  font-size: 13px; cursor: pointer; transition: background .2s ease, border-color .2s ease, color .2s ease; }
.btn:hover { background: var(--bg-hover-strong); border-color: rgba(255,255,255,.2); color: #fff; }
.btn[aria-pressed="true"] { background: rgba(100,180,232,.16); border-color: rgba(100,180,232,.45); color: #dbeeff; }
.btn.sm { padding: 4px 9px; font-family: var(--font-code); font-size: 12px; }
.btn:disabled { opacity: .3; cursor: default; }
.btn:disabled:hover { background: var(--bg-hover); border-color: var(--border-light); color: rgba(255,255,255,.75); }

.chartwrap { position: relative; }
svg.plot { display: block; width: 100%; height: auto; }
svg.plot:focus-visible { outline: 2px solid var(--link-color); outline-offset: 3px; border-radius: var(--radius-md); }
svg text { font-family: var(--font-code); fill: var(--text-faint); font-size: 11px; }
svg .ylab { font-size: 10.5px; }
svg .phase-label { font-family: var(--font-heading); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
svg .axis-title { font-family: var(--font-heading); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; fill: var(--text-muted); }

.hit { cursor: crosshair; }
.pin { cursor: pointer; }
.pin:focus-visible { outline: none; }
.pin:focus-visible .pinhead { stroke: #fff; stroke-width: 2.5; }
.phaseband { cursor: pointer; }

.hint { font-family: var(--font-code); font-size: 11.5px; color: var(--text-faint);
  margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.hint kbd { font-family: var(--font-code); background: rgba(255,255,255,.07); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 0 4px; font-size: 11px; color: var(--text-secondary); }

/* ---------- Tooltip ---------- */
.tip { position: absolute; pointer-events: none; z-index: 5; background: #12122a;
  border: 1px solid rgba(100,140,200,.28); border-radius: var(--radius-md); padding: 9px 12px;
  font-family: var(--font-code); font-size: 12.5px; line-height: 1.6; color: var(--text-primary);
  box-shadow: 0 4px 18px rgba(0,0,0,.55); white-space: nowrap; opacity: 0;
  transition: opacity .12s ease; font-variant-numeric: tabular-nums; text-shadow: none; }
.tip.on { opacity: 1; }
.tip .t-d { color: var(--text-muted); font-size: 11px; letter-spacing: .04em; margin-bottom: 3px; }
.tip .t-r { display: flex; gap: 8px; align-items: baseline; }
.tip .t-r i { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; position: relative; top: -1px; }
.tip .t-r b { font-weight: 500; color: var(--text-bright); margin-left: auto; padding-left: 14px; }
.tip .t-n { color: var(--text-muted); font-size: 11px; margin-top: 4px; max-width: 30ch; white-space: normal; }

/* ---------- Readout ---------- */
.readout { background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--ro-accent, var(--c-post)); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-top: 18px; }
.readout .head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.readout .head > div:first-child { flex: 1 1 auto; min-width: 0; }
.readout .eyebrow { font-family: var(--font-heading); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.readout h3 { margin-bottom: 4px; }
.readout .when { font-family: var(--font-code); font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; }
.readout .grid { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 12px; }
.readout .grid div { font-family: var(--font-code); font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.readout .grid strong { display: block; font-size: 19px; color: var(--text-bright); font-weight: 500; }
.readout .grid span { display: block; font-size: 11.5px; color: var(--text-faint); }
.readout p { margin: 0; color: #bcbcbc; max-width: 62ch; font-size: 15px; }
.readout p.empty { color: var(--text-faint); font-style: italic; }
.readout .go { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  font-family: var(--font-code); font-size: 13px; padding: 6px 13px; border-radius: var(--radius-md);
  border: 1px solid rgba(157,111,214,.4); background: rgba(157,111,214,.12); color: #d3bcf2; }
.readout .go:hover { background: rgba(157,111,214,.22); border-color: rgba(157,111,214,.6); color: #ecdfff; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-family: var(--font-code); font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-family: var(--font-heading); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 400; border-bottom-color: var(--border-light); }
tbody tr:hover { background: rgba(255,255,255,.03); }
tbody tr.on { background: rgba(100,180,232,.1); }
td .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; }
.thin { color: #d9a05b; }
tbody tr.nb td { color: var(--text-secondary); }
.tierbadge { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.note { font-size: 13.5px; color: var(--text-faint); max-width: 68ch; }
.note code { background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: var(--radius-sm); font-family: var(--font-code); font-size: .9em; }

/* ---------- Explainers ----------
   The page used to carry its caveats as prose under every panel: how to read a
   broken line, which phase rates are comparable, why the writing and the
   measuring barely overlap. All of it still exists, unabridged, one click
   away — each .explain button opens the <dialog> it names. Nothing is
   dropped, and the page reads as an instrument instead of an essay.

   Buttons rather than anchors: these open a dialog, they do not navigate. */
.explain { font-family: var(--font-code); font-size: 12.5px; line-height: 1.5;
  color: var(--link-color); background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; text-align: left; text-decoration: underline;
  text-decoration-color: rgba(108,180,232,.35); text-underline-offset: 3px; }
.explain:hover { color: var(--link-hover); text-decoration-color: var(--link-hover); }
.explain::before { content: "?"; display: inline-block; width: 14px; height: 14px;
  margin-right: 7px; border: 1px solid currentColor; border-radius: 50%;
  font-size: 10px; line-height: 12px; text-align: center; vertical-align: 1px; }
.explain-row { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 12px 0 0; }
.sechead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.sechead h2 { margin-bottom: 16px; }

/* max-height + scroll: an explainer runs to several paragraphs, which is
   taller than a phone viewport. Without this the tail is unreachable. */
dialog.explainer { max-width: 64ch; width: calc(100% - 28px);
  max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px 26px 26px;
  color: var(--text-primary); background: var(--bg-deep);
  border: 1px solid var(--border-accent); border-radius: var(--radius-lg);
  box-shadow: 0 18px 60px rgba(0,0,0,.6); }
dialog.explainer::backdrop { background: rgba(8, 8, 22, .68); }
dialog.explainer p { font-size: 14.5px; color: #bcbcbc; }
dialog.explainer p:last-child { margin-bottom: 0; }
dialog.explainer strong { color: var(--text-bright); font-weight: 500; }
/* Sticky rather than absolute: the dialog is the scroll container, so an
   absolutely-positioned close button scrolls off the top of a long explainer
   and leaves the panel looking uncloseable. */
dialog.explainer .x { position: sticky; top: -4px; float: right; margin: -4px -6px 0 14px;
  width: 28px; height: 28px; padding: 0; font-size: 18px; line-height: 1;
  color: var(--text-muted); background: var(--bg-deep);
  border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer;
  box-shadow: 0 0 0 7px var(--bg-deep); }
dialog.explainer .x:hover { color: var(--text-bright); background: var(--bg-hover); border-color: var(--border-light); }

/* ---------- Post list ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { display: flex; gap: 16px; padding: 11px 8px; border-bottom: 1px solid var(--border-subtle);
  align-items: baseline; flex-wrap: wrap; border-radius: var(--radius-md); transition: background .2s ease; }
.post-list li:hover, .post-list li.on { background: rgba(157,111,214,.09); }
.post-list .date { font-family: var(--font-code); font-size: 12.5px; color: var(--text-secondary); width: 105px; flex: none; }
.post-list .ttl { font-size: 15px; }
.post-list .state { margin-left: auto; font-family: var(--font-code); font-size: 12px; color: var(--text-faint); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

@media (max-width: 780px) {
  body { font-size: 15px; }
  .stat-strip { grid-template-columns: 1fr; gap: 10px; }
  .tile .v { font-size: 26px; }
  .post-list .state { margin-left: 0; width: 100%; }
  .post-list .date { width: 100%; }
  .instrument { padding: 14px 12px 12px; }
  /* A 2.5-year axis squeezed into 320px is unreadable. The chart keeps its
     size and scrolls inside its own container; the page body never scrolls. */
  .chartwrap { overflow-x: auto; overscroll-behavior-x: contain; }
  svg.plot { min-width: 720px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
