/* ==========================================================================
   Post-Training Adaptation Taxonomy — layout and components

   Spacing is owned by layout containers only. Section-level and element-level
   selectors never both set block margins, which is where cancelling
   specificity bugs come from.
   ========================================================================== */

/* Self-hosted. src: local() alone would only work for visitors who already
   had the fonts installed — which meant the monospace display face, the whole
   typographic idea here, was silently falling back to system mono. */

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;              /* variable */
  font-display: swap;
  src: url('../fonts/DMSans-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url('../fonts/DMSans-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/DMMono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/DMMono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/DMMono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/DMMono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); }

p, li { text-wrap: pretty; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, samp { font-family: var(--font-mono); font-size: .92em; }

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

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

/* ---------- Layout ---------- */

.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }

.section { padding-block: var(--sp-6); }
.section + .section { border-top: 1px solid var(--border); }
.section--surface { background: var(--surface); }
.section--band { background: var(--band); color: var(--band-text); }
.section--band a { color: var(--accent-warm); }

.stack > * + * { margin-block-start: var(--sp-3); }
.stack-lg > * + * { margin-block-start: var(--sp-5); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Navigation ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  display: flex; align-items: center; gap: var(--sp-3);
  padding-block: var(--sp-2); flex-wrap: wrap;
}
.nav__brand {
  font-family: var(--font-mono); font-weight: 500;
  color: var(--text); text-decoration: none; margin-inline-end: auto;
}
.nav__links { display: flex; gap: var(--sp-3); flex-wrap: wrap; list-style: none; padding: 0; }
.nav__links a { font-size: var(--step--1); color: var(--text-muted); text-decoration: none; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--accent); }
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--font-mono); font-size: var(--step--2);
  padding: var(--sp-1) var(--sp-2); cursor: pointer;
}

/* ---------- THE PROFILE STRIP — the site's signature element ---------- */

.profile-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  overflow: hidden;
}
.profile-cell { background: var(--surface); padding: var(--sp-2); min-width: 0; }
.profile-cell__dim {
  display: block;
  font-size: var(--step--2);
  letter-spacing: .1em;
  color: var(--dim-color);
  border-bottom: 2px solid var(--dim-color);
  padding-bottom: 3px;
  margin-bottom: var(--sp-1);
}
.profile-cell__values { font-size: var(--step--1); line-height: 1.4; }
.profile-cell__values span { display: block; }
.profile-cell:nth-child(1) { --dim-color: var(--d1); }
.profile-cell:nth-child(2) { --dim-color: var(--d2); }
.profile-cell:nth-child(3) { --dim-color: var(--d3); }
.profile-cell:nth-child(4) { --dim-color: var(--d4); }
.profile-cell:nth-child(5) { --dim-color: var(--d5); }
.profile-cell:nth-child(6) { --dim-color: var(--d6); }
.profile-cell--outside {
  outline: 2px dashed var(--accent-warm);
  outline-offset: -2px;
}
.profile-strip--compact .profile-cell { padding: var(--sp-1) var(--sp-2); }

/* ---------- Chips ---------- */

.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .88em;
  padding: 1px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--chip-color, var(--border));
  color: var(--chip-color, var(--text));
  white-space: nowrap;
  text-decoration: none;
}
.chip[data-dim="d1"] { --chip-color: var(--d1); }
.chip[data-dim="d2"] { --chip-color: var(--d2); }
.chip[data-dim="d3"] { --chip-color: var(--d3); }
.chip[data-dim="d4"] { --chip-color: var(--d4); }
.chip[data-dim="d5"] { --chip-color: var(--d5); }
.chip[data-dim="d6"] { --chip-color: var(--d6); }
a.chip:hover { background: color-mix(in srgb, var(--chip-color) 12%, transparent); }

sup.cite { font-size: .7em; color: var(--text-muted); }

/* ---------- Cards, tables, provenance ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.grid { display: grid; gap: var(--sp-3); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
th, td { text-align: left; padding: var(--sp-2); border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
tbody tr:hover { background: var(--surface-2); }

/* Provenance: three visually distinct classes of text (spec 8.2). */
.provenance {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.editorial {
  border-left: 3px solid var(--accent-warm);
  padding-left: var(--sp-3);
  background: var(--surface);
}
.computed { border-left: 3px solid var(--border); padding-left: var(--sp-3); }
.verbatim { }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--sp-3);
  background: var(--surface);
}
.callout--warn { border-left-color: var(--accent-warm); }

.placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
}

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
  transition: background var(--transition);
}
.btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn--solid { background: var(--accent); color: var(--bg); }
.btn--solid:hover { background: color-mix(in srgb, var(--accent) 85%, black); }

pre {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  overflow-x: auto;
}

/* ---------- Footer ---------- */

.footer {
  background: var(--band);
  color: var(--band-text);
  padding-block: var(--sp-5);
  /* Secondary metadata: a step below body copy so it settles under the page
     rather than competing with it. */
  font-size: var(--step--1);
  line-height: 1.5;
}
.footer a { color: var(--accent-warm); }
.footer__grid {
  display: grid;
  gap: var(--sp-3) var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.footer ul { list-style: none; padding: 0; }
.footer li + li { margin-top: 2px; }
.footer .eyebrow { margin-bottom: var(--sp-2); opacity: .8; }
.footer__fineprint {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: var(--step--2);
  line-height: 1.5;
  max-width: 72ch;
  opacity: .7;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .profile-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding-block: var(--sp-5); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Explorer ---------- */

.explorer {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: minmax(220px, 300px) 1fr;
  align-items: start;
}
.explorer__facets { position: sticky; top: 4.5rem; }
.facet {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.facet > summary {
  cursor: pointer;
  padding: var(--sp-2);
  font-size: var(--step--1);
  list-style: none;
}
.facet > summary::-webkit-details-marker { display: none; }
.facet > summary::before { content: "+ "; color: var(--text-muted); }
.facet[open] > summary::before { content: "− "; }
.facet__opts {
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: 0 var(--sp-2) var(--sp-2);
  max-height: 15rem; overflow-y: auto;
}
.facet__opt {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--step--1); cursor: pointer;
}
#results tbody tr[hidden] { display: none; }

@media (max-width: 860px) {
  .explorer { grid-template-columns: 1fr; }
  .explorer__facets { position: static; }
}

.explorer__bar { display: flex; gap: var(--sp-2); align-items: center; }
.explorer__bar input {
  flex: 1; min-width: 0; padding: var(--sp-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-family: var(--font-body);
}
.tech-cell { min-width: 12rem; }
.tech-cell__family {
  display: block; font-size: var(--step--2); color: var(--text-muted);
  margin-top: 2px;
}

/* Wizard option lists: full width, no inner scroll. */
.optgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--sp-1) var(--sp-3);
}
.opt {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius); cursor: pointer;
}
.opt:hover { background: var(--surface-2); }
.opt input { flex: none; }

/* ---------- Video facade ---------- */

.video-facade {
  position: relative; display: block; width: 100%; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; overflow: hidden;
  aspect-ratio: 16 / 9;
}
.video-facade img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-facade__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 3rem; color: #fff;
  background: rgba(79, 4, 51, .35);
  transition: background var(--transition);
}
.video-facade:hover .video-facade__play { background: rgba(79, 4, 51, .55); }
.video-frame {
  width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Hero ----------
   The one loud moment on the site. Everything around it stays quiet. */

.hero { max-width: 46rem; }
.hero__said {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero__tabs {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-block: var(--sp-2) var(--sp-3);
}
.hero__tab {
  font-family: var(--font-display);
  font-size: var(--step-0);
  white-space: nowrap;
  line-height: 1.2;
  padding: var(--sp-1) var(--sp-2);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.hero__tab:hover { color: var(--text); }
.hero__tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.hero__asks {
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  max-width: 34rem;
}
.hero__caption {
  margin-top: var(--sp-2);
  font-size: var(--step--1);
  color: var(--text-muted);
}

@keyframes hero-cell {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .profile-cell { animation: none !important; }
}

/* ---------- Small screens ----------
   The nav carries ten destinations and the hero three full phrases; both need
   to give way before they push the page sideways. */

@media (max-width: 560px) {
  .nav__inner { gap: var(--sp-2); }
  .nav__links { gap: var(--sp-2) var(--sp-3); font-size: var(--step--2); }
  .nav__links a { font-size: var(--step--2); }

  .hero__tabs { gap: var(--sp-1); }
  .hero__tab {
    white-space: normal;          /* a long phrase may wrap rather than overflow */
    font-size: var(--step--1);
    padding: var(--sp-1);
  }

  .section { padding-block: var(--sp-5); }
  .card { padding: var(--sp-3); }
  .btn { font-size: var(--step--2); }
}

@media (max-width: 420px) {
  /* Six columns of coordinates do not fit; three rows of two still read as
     one strip because each cell keeps its D-label. */
  .profile-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: var(--step-2); }
}

/* ---------- Lifecycle ----------
   A vertical rule marks the one boundary that matters: the model exists.
   Everything below it is in scope, whether or not it has shipped. */

.lifecycle {
  display: grid;
  grid-template-columns: minmax(0, 14rem) 3px minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}
.lifecycle__line {
  align-self: stretch;
  background: linear-gradient(to bottom, var(--d1), var(--d6));
  border-radius: 2px;
  min-height: 6rem;
}
.lifecycle__before { opacity: .65; }

@media (max-width: 720px) {
  .lifecycle { grid-template-columns: 1fr; gap: var(--sp-3); }
  .lifecycle__line { min-height: 3px; width: 100%; }
}

/* ---------- Citations and references ---------- */

sup.cite { font-size: .72em; white-space: nowrap; }
.cite__n {
  color: var(--accent);
  text-decoration: none;
  padding: 0 1px;
  border-bottom: 1px dotted currentColor;
  cursor: help;
}
.cite__n:hover { border-bottom-style: solid; }

.reflist {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
  font-size: var(--step--1);
}
.reflist li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: var(--sp-2);
  align-items: baseline;
  scroll-margin-top: 5rem;      /* clear the sticky nav when jumped to */
}
.reflist li:target .ref__body {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.ref__n { font-family: var(--font-mono); color: var(--text-muted); }
.ref__venue { color: var(--text-muted); }
