/* 0x13d::Research — portal styles.
 *
 * The token values are the portfolio palette from
 * `com.0x13d.n2/podcast-admin/src/renderer/design/tokens.css`. They are copied rather than
 * imported here because this is a static site with no build step and nothing to resolve an
 * @import across repositories — but the values are the terminal's and should be changed there
 * first. The verdict ramp is not carried: this page does not render verdicts, and a palette that
 * ships colours nobody uses invites somebody to use them wrong.
 *
 * Fonts are self-hosted in ./fonts/ (copied from the @ibm/plex-* packages via podcast-admin). No
 * font host, no CDN, no analytics — which is what lets netlify.toml set `script-src 'none'`.
 */

:root {
  --surface-canvas: #111014;
  --surface-panel: #131217;
  --surface-card: #16151b;
  --surface-field: #191820;
  --surface-raised: #2e2d38;

  --border-subtle: #24232b;
  --border-default: #33323d;
  --border-strong: #3b3a46;

  --text-display: #e8e6ef;
  --text-title: #eae8f1;
  --text-body: #a9a7b6;
  --text-read: #bfbdcb;
  --text-data: #c4c2d0;
  --text-micro: #57555f;
  --text-dim: #67657a;

  --accent: oklch(0.72 0.11 245);
  --accent-text: oklch(0.86 0.06 250);
  --focus-ring: oklch(0.62 0.12 250);
  --live: oklch(0.74 0.1 190);

  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "IBM Plex Serif", Georgia, serif;

  --tracking-micro: 0.1em;
  --radius-control: 5px;
  --radius-panel: 8px;

  --measure: 66ch;
  --gutter: clamp(20px, 5vw, 64px);
}

@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("fonts/IBMPlexSerif-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("fonts/IBMPlexSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--surface-canvas);
  color: var(--text-body);
  font: 400 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid color-mix(in oklch, var(--accent) 45%, transparent); }
a:hover { border-bottom-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: var(--radius-control); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); }

/* ── Micro label — the mono all-caps rule used as the page's connective tissue ─────────────── */
.micro {
  font: 400 10px/1.4 var(--font-mono);
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  color: var(--text-micro);
}

/* ── Masthead ─────────────────────────────────────────────────────────────────────────────── */

header.masthead {
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: color-mix(in oklch, var(--surface-canvas) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 16px/1 var(--font-mono);
  color: var(--text-display);
  border: none;
}
.wordmark .sep { color: var(--accent); }
.wordmark svg { flex: none; }

nav.top { display: flex; gap: 22px; flex-wrap: wrap; }
nav.top a { border: none; font: 400 13px/1 var(--font-sans); color: var(--text-body); }
nav.top a:hover { color: var(--text-title); }

/* ── Hero ─────────────────────────────────────────────────────────────────────────────────── */

.hero { padding: clamp(56px, 11vw, 120px) 0 clamp(40px, 7vw, 72px); }

h1 {
  font: 600 clamp(30px, 5.2vw, 52px)/1.12 var(--font-sans);
  color: var(--text-display);
  letter-spacing: -0.02em;
  margin: 14px 0 0;
  max-width: 20ch;
}

.hero p.lede {
  font: 400 clamp(16px, 2vw, 19px)/1.62 var(--font-serif);
  color: var(--text-read);
  max-width: var(--measure);
  margin: 22px 0 0;
}

/* ── Figures strip — real numbers, which is the house rule about adjectives ─────────────────── */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  overflow: hidden;
  margin-top: clamp(32px, 5vw, 52px);
}

.figure { background: var(--surface-panel); padding: 18px 20px; }
.figure b {
  display: block;
  font: 600 26px/1.1 var(--font-mono);
  color: var(--text-title);
  font-variant-numeric: tabular-nums;
}
.figure span { display: block; margin-top: 6px; }

/* The caveat under the figures. Constrained rather than full-bleed: it is uppercase mono, which is
   the least readable setting on the page, and a 140-character line of it reads as a legal notice
   nobody finishes. Two short lines get read; one long one does not. */
.figures-note { max-width: 78ch; margin-top: 12px; line-height: 1.6; }

/* ── Section frame ────────────────────────────────────────────────────────────────────────── */

section { padding: clamp(48px, 8vw, 88px) 0; border-top: 1px solid var(--border-subtle); }

.section-head { margin-bottom: clamp(26px, 4vw, 44px); }
.section-head h2 {
  font: 600 clamp(21px, 3vw, 28px)/1.2 var(--font-sans);
  color: var(--text-title);
  letter-spacing: -0.01em;
  margin: 10px 0 0;
}
.section-head p { max-width: var(--measure); margin: 12px 0 0; color: var(--text-body); }

/* ── Projects — a numbered index rather than a card grid ──────────────────────────────────── */

ol.projects { list-style: none; margin: 0; padding: 0; }

.project {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(14px, 3vw, 36px);
  padding: 26px 0;
  border-top: 1px solid var(--border-subtle);
  align-items: start;
}
.project:last-child { border-bottom: 1px solid var(--border-subtle); }

.project .n { font: 400 11px/1.9 var(--font-mono); color: var(--text-micro); }

.project h3 {
  font: 600 18px/1.3 var(--font-sans);
  color: var(--text-title);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.project .role { margin: 7px 0 0; }
.project .body { margin: 0; color: var(--text-body); }
.project .body + .body { margin-top: 10px; }

.project .links { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.project .links a { font: 400 13px/1 var(--font-sans); }

/* Status pill. `shipping` is the only one that gets the live hue; everything else is grey, so a
   glance down the column reads as a real state and not as decoration. */
.pill {
  font: 600 9px/1 var(--font-mono);
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.pill[data-state="shipping"] { color: var(--live); border-color: color-mix(in oklch, var(--live) 45%, transparent); }
.pill[data-state="new"] { color: var(--accent-text); border-color: color-mix(in oklch, var(--accent) 45%, transparent); }

@media (max-width: 760px) {
  .project { grid-template-columns: 30px minmax(0, 1fr); }
  .project .right { grid-column: 2; }
}

/* ── Publications ─────────────────────────────────────────────────────────────────────────── */

.shelf { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }

.shelf article {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  padding: 20px;
}
.shelf h3 { font: 600 15px/1.3 var(--font-sans); color: var(--text-title); margin: 10px 0 8px; }
.shelf p { margin: 0; font-size: 14px; }
.shelf .links { margin-top: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.shelf .links a { font-size: 13px; }

/* ── Method note — the one long-form passage on the page ──────────────────────────────────── */

.note {
  border-left: 2px solid var(--border-strong);
  padding-left: clamp(16px, 3vw, 28px);
  max-width: var(--measure);
}
.note p { font: 400 16px/1.72 var(--font-serif); color: var(--text-read); margin: 0 0 14px; }
.note p:last-child { margin-bottom: 0; }
.note em { font-style: italic; }

/* ── Footer ───────────────────────────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border-subtle);
  padding: 36px 0 56px;
}
footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: baseline; }
footer a { border: none; color: var(--text-body); font-size: 13px; }
footer a:hover { color: var(--text-title); }
footer .cols { display: flex; gap: 22px; flex-wrap: wrap; }

/* ── Figures — the two homepage charts ─────────────────────────────────────────────────────────
   Data is baked in at build time by scripts/refresh-figures.mjs; the page makes no requests.
   Everything here is measured, so nothing may imply a precision the archive does not have. */

#figures .wrap { display: flex; flex-direction: column; gap: 22px; }

.fig {
  margin: 0;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  padding: clamp(22px, 3vw, 32px);
}
.fig__head { display: block; }
.fig__head h2 {
  font: 600 clamp(21px, 3vw, 28px)/1.2 var(--font-sans);
  color: var(--text-title);
  letter-spacing: -0.01em;
  margin: 10px 0 0;
  text-wrap: balance;
}
.fig__lede { max-width: 66ch; margin: 12px 0 0; color: var(--text-body); }
.fig__head--split { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; flex-wrap: wrap; }
.fig__note {
  margin: 24px 0 0; padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  max-width: 96ch; font-size: 13px; color: var(--text-dim);
}
.fig__cta { margin: 12px 0 0; font-size: 13px; color: var(--text-dim); }
.fig__cta a { color: var(--accent-text); border-bottom: 1px solid var(--border-default); }
.fig__cta a:hover { color: var(--text-title); border-bottom-color: var(--accent); }

/* Figure 01 — technique counts. One series: length carries magnitude, so no legend and no hue. */
.techs { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.tech { display: grid; grid-template-columns: minmax(120px, 230px) minmax(0, 1fr) 68px; gap: 16px; align-items: center; }
.tech__name { text-align: right; }
.tech__name > span:first-child { display: block; font-size: 13.5px; line-height: 1.3; color: var(--text-read); }
.tech__name .micro { display: block; margin-top: 2px; font-size: 9.5px; }
.tech__bar { height: 24px; display: flex; align-items: center; }
.tech__bar i { height: 24px; background: var(--accent); border-radius: 3px; transform-origin: 0 50%; animation: fig-growx 750ms cubic-bezier(.2,.7,.2,1) both; }
.tech__id { margin-left: 10px; font: 400 10px/1.4 var(--font-mono); letter-spacing: 0.08em; color: var(--live); white-space: nowrap; }
.tech__n { font: 600 14px/1 var(--font-mono); color: var(--text-data); font-variant-numeric: tabular-nums; text-align: right; }
.tech:nth-child(2) .tech__bar i { animation-delay: 70ms; }
.tech:nth-child(3) .tech__bar i { animation-delay: 140ms; }
.tech:nth-child(4) .tech__bar i { animation-delay: 210ms; }
.tech:nth-child(5) .tech__bar i { animation-delay: 280ms; }
.tech:nth-child(6) .tech__bar i { animation-delay: 350ms; }
@keyframes fig-growx { from { transform: scaleX(0) } to { transform: scaleX(1) } }

/* Figure 02 — four weeks. Transposed from the terminal's chart: weeks run down, the 0–1 evidence
   axis runs across. Truth score and technique share are both proportions, so they share one ruler. */
.weeks { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 30px; margin-top: 26px; }
.weeks__mode { display: flex; align-items: center; gap: 9px; margin: 4px 0 0; white-space: nowrap; }
.weeks__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.weeks__mode.is-pinned .weeks__dot { background: var(--text-micro); }
.weeks__axis { display: flex; justify-content: space-between; padding: 0 0 8px 74px; font-size: 9.5px; }
.weeks__rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.wk {
  width: 100%; display: grid; grid-template-columns: 74px minmax(0, 1fr);
  align-items: center; gap: 0; padding: 9px 10px 9px 0;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background 300ms ease, border-color 300ms ease;
}
.wk:hover { background: var(--surface-card); }
.wk.is-on { background: #171922; border-color: #2b3a4a; }
.wk:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.wk__label { padding-left: 12px; }
.wk__label b { display: block; font: 600 11.5px/1.2 var(--font-mono); color: var(--text-body); }
.wk.is-on .wk__label b, .wk:hover .wk__label b { color: var(--text-display); }
.wk__label .micro { display: block; margin-top: 2px; font-size: 9.5px; font-variant-numeric: tabular-nums; }

.wk__strip { position: relative; display: block; height: 46px; }
.wk__strip::before, .wk__strip::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-subtle);
}
.wk__strip::before { left: 0; } .wk__strip::after { right: 0; }
.wk__strip i {
  position: absolute; width: 4px; height: 4px; margin: -2px 0 0 -2px;
  border-radius: 50%; background: #54788f; transition: background 300ms ease;
}
.wk.is-on .wk__strip i { background: #8dc6f7; }
.wk__tick { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--live); }
.wk__pct {
  position: absolute; top: -16px; transform: translateX(-50%);
  font: 600 10.5px/1 var(--font-mono); font-style: normal; color: var(--live);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.weeks__key { display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.key { display: flex; align-items: center; gap: 7px; font: 400 10.5px/1 var(--font-mono); letter-spacing: 0.05em; color: var(--text-body); }
.key__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.key__tick { width: 2px; height: 12px; background: var(--live); }

/* The breakdown panel. Fades on change; `is-in` is re-applied per render to restart it. */
.weeks__panel { border-left: 1px solid var(--border-subtle); padding-left: 28px; opacity: 0; transform: translateY(6px); }
.weeks__panel.is-in { animation: fig-fade 420ms ease forwards; }
@keyframes fig-fade { to { opacity: 1; transform: translateY(0) } }
.panel__n { margin: 8px 0 0; font-size: 14px; color: var(--text-body); }
.panel__n b { font: 600 40px/1 var(--font-mono); color: var(--text-title); font-variant-numeric: tabular-nums; margin-right: 10px; }
.panel__meta { margin: 8px 0 0; }
.panel__h { margin: 22px 0 9px; }
.mix { display: flex; gap: 2px; height: 26px; }
.mix span {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 2px; font: 600 9.5px/1 var(--font-mono); color: var(--surface-canvas);
  font-variant-numeric: tabular-nums;
}
.mix__key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.mix__key span { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-body); }
.mix__key i { width: 8px; height: 8px; border-radius: 2px; }
.tops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.tops li { position: relative; display: flex; align-items: center; height: 20px; }
.tops__bar { position: absolute; left: 0; top: 0; bottom: 0; background: #1e2a35; border-radius: 3px; }
.tops__label { position: relative; padding-left: 8px; font-size: 12px; color: var(--text-read); white-space: nowrap; }
.tops__n { margin-left: auto; position: relative; font: 600 12px/1 var(--font-mono); color: var(--text-data); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .weeks { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .weeks__panel { border-left: none; border-top: 1px solid var(--border-subtle); padding: 22px 0 0; }
  .tech { grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) 54px; gap: 10px; }
  .tech__id { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tech__bar i, .weeks__panel.is-in { animation: none; }
  .weeks__panel { opacity: 1; transform: none; }
}

/* Narrow-viewport guards for the figures. The page must never scroll sideways: a horizontal
   scrollbar on a page whose whole argument is "look at the record" reads as carelessness. */
#figures .wrap, .fig, .weeks, .weeks__plot, .weeks__panel { min-width: 0; }
.tops li { min-width: 0; }
.tops__label { overflow: hidden; text-overflow: ellipsis; }
.tops__n { padding-left: 10px; flex: none; }
.weeks__mode { flex-wrap: wrap; white-space: normal; }

@media (max-width: 560px) {
  .fig { padding: 20px 16px; }
  .fig__head--split { gap: 14px; }
  .weeks__axis { padding-left: 60px; font-size: 9px; }
  .wk { grid-template-columns: 60px minmax(0, 1fr); padding-right: 6px; }
  .wk__label { padding-left: 8px; }
  .tech { grid-template-columns: minmax(0, 1fr) 46px; grid-template-areas: "name n" "bar bar"; row-gap: 5px; }
  .tech__name { grid-area: name; text-align: left; }
  .tech__bar { grid-area: bar; }
  .tech__n { grid-area: n; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure b { font-size: 22px; }
}
