/* ---------------------------------------------------------------
   Friction Playground
   A near-white research surface. Two typefaces doing two jobs:
   a light grotesque for structure, a serif italic for annotation.
   One accent, used sparingly.
   --------------------------------------------------------------- */

:root {
  /* surface */
  --bg:        #fbfbfa;
  --bg-tint:   #f6f6f4;
  --line:      #e6e5e2;
  --line-soft: #efeeeb;

  /* ink */
  --ink:       #111110;
  --ink-2:     #55544f;
  --ink-3:     #8e8d86;
  --ink-4:     #b4b3ac;

  /* accent */
  --coral:     #e8503a;
  --coral-dim: rgba(232, 80, 58, 0.06);

  /* pattern hues */
  --hue-01: #e8503a;
  --hue-02: #7e9dc4;
  --hue-03: #dfa53c;
  --hue-04: #8fb89b;
  --hue-05: #a99bc8;
  --hue-06: #a99885;

  --sans:  "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", "Times New Roman", Times, Georgia, serif;

  --pad:  clamp(1.5rem, 4.5vw, 4.5rem);
  --max:  90rem;
  --foot: 0rem;                  /* the footer is in the flow again */
}

* { box-sizing: border-box; }

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

/* The rules that separate bands of the page — under the header, under
   the rail, above the footer — belong to the window, not to the content
   column, so each is drawn by a full-width pseudo-element rather than by
   a border on a column-width box. Rules inside the content stay in the
   column.

   The width is `100vw` minus the scrollbar (`--sbw`, measured in
   js/shell.js), not `100vw`: 100vw includes the scrollbar and would push
   out a horizontal one. The obvious cure — `overflow-x: clip` on the
   page — is worse than the disease, because any non-visible overflow on
   an ancestor makes it the scroll container for sticky descendants, and
   the sticky header and rail silently stop sticking. */

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--coral); color: #fff; }

:focus-visible { outline: 1.5px solid var(--coral); outline-offset: 3px; }

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

/* --- type roles ------------------------------------------------- */

.display {
  font-size: clamp(3.4rem, 8.2vw, 7.1rem);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0;
}

.annot {                       /* the serif italic voice */
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.06rem;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 2.4rem;
  max-width: 20rem;
}

.h2 {
  font-size: clamp(1.55rem, 2.6vw, 1.95rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
}

.micro {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.dim { color: var(--ink-3); }

/* --- arrow links ------------------------------------------------ */

.arrow-link {
  display: inline-flex; align-items: center; gap: 0.9rem;
  font-size: 0.9rem; font-weight: 500;
  background: none; border: 0; padding: 0;
  font-family: inherit; color: inherit; cursor: pointer;
}
.arrow-link__line {
  position: relative; display: block;
  width: 7.5rem; height: 1px; background: currentColor;
  transition: width 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.arrow-link__line::after {
  content: ''; position: absolute; right: 0; top: 50%;
  width: 6px; height: 6px; border-top: 1px solid currentColor;
  border-right: 1px solid currentColor; transform: translateY(-50%) rotate(45deg);
}
.arrow-link:hover .arrow-link__line { width: 9.5rem; }

.act {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.85rem; font-weight: 500; color: var(--coral);
  background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer;
  transition: gap 200ms ease, opacity 160ms ease;
}
.act:hover:not(:disabled) { gap: 0.95rem; }
.act:disabled { color: var(--ink-4); cursor: not-allowed; }
.act::after { content: '→'; font-size: 0.95em; }

/* --- nav / footer ----------------------------------------------- */

header[data-nav] {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
}
header[data-nav].is-stuck::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: calc(100vw - var(--sbw, 0px)); border-top: 1px solid var(--line);
}

.nav, .foot-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; padding: 1.35rem 0;
}
.foot-bar { position: relative; margin-top: 0; }
.foot-bar::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: calc(100vw - var(--sbw, 0px)); border-top: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 2.6rem; }
.brand__mark { font-size: 1.06rem; font-weight: 600; letter-spacing: -0.03em; }
.brand__name { font-size: 0.86rem; font-weight: 500; }

.nav__links { display: flex; gap: clamp(1.4rem, 3.4vw, 3.4rem); align-items: center; }
.nav__links a { font-size: 0.86rem; color: var(--ink-2); transition: color 160ms ease; }
.nav__links a:hover { color: var(--ink); }
.nav__links a[aria-current="page"] { color: var(--ink); }
.foot-bar { justify-content: flex-start; }
.foot-bar__what { font-size: 0.76rem; color: var(--ink-3); }

/* --- hero -------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: var(--pad);
  align-items: center;
  min-height: min(82vh, 46rem);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2rem;
}
.hero__text { max-width: 33rem; }
.hero__lede {
  margin: 2.1rem 0 3rem;
  max-width: 26rem;
  color: var(--ink-2);
  font-size: 0.97rem;
  line-height: 1.65;
}
.hero--landing {
  border-bottom: 0;
  min-height: calc(100vh - 11rem);
  padding-bottom: 0;
}
.hero--landing .hero__text { position: relative; z-index: 1; }

/* The landing page is composed to one reference frame: a 1448×1086
   mock, whose figure tools/trace-field.mjs traced into
   img/field-traced.svg. The header and the type are the site's own, the
   same as on every other page; only the composition — the spacing and
   where the figure sits — is in the mock's pixels. `--u` is one of them,
   and it never grows past a real pixel, so a wide screen gets the mock
   at its own size rather than a blown-up one. */
@media (min-width: 52.01rem) {
  .wrap--landing { --u: min(1px, calc((100vw - var(--sbw, 0px)) / 1448)); }

  .wrap--landing .hero--landing {
    display: flex; align-items: center;
    position: relative;
    min-height: calc(100vh - var(--nav, 4.5rem));
    padding-bottom: calc(160 * var(--u));
  }
  .wrap--landing .eyebrow { max-width: none; }

  /* the figure's box is the traced one, placed as in the mock: it starts
     468 in from the text and runs toward the right edge, its centre a
     little below the text's */
  .wrap--landing .hero__field {
    position: absolute; z-index: 0;
    left: calc(468 * var(--u)); width: calc(888 * var(--u));
    height: calc(940 * var(--u));
    top: calc(50% - 503 * var(--u));
  }
}
.hero--landing .hero__field img { object-fit: contain; }

/* on a tall screen a short page should not strand its pager halfway up:
   the main section takes the slack, the tail sits at the bottom */
.wrap--tall { display: flex; flex-direction: column; min-height: 100vh; }
.wrap--tall .hero,
.wrap--tall > .section--first { flex: 1; }

.hero__field { position: relative; height: min(74vh, 42rem); }
.hero__field img {
  display: block; width: 100%; height: 100%;
  object-fit: contain;          /* the figure scales, it does not crop */
}
/* --- where a pattern comes from --------------------------------- */
/* Folded shut by default: the interaction is the argument, the
   provenance is the footnote. Native <details>, so it works with no JS
   and the browser handles the semantics. */
.lit {
  border-top: 1px solid var(--line);
  margin-top: clamp(3rem, 5vw, 4.5rem);
  padding-top: 0.4rem;
}
.lit > summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem;
  padding: 1.7rem 0; cursor: pointer; list-style: none;
  transition: color 160ms ease;
}
.lit > summary::-webkit-details-marker { display: none; }
.lit > summary::before {
  content: '+';
  width: 1.5rem; flex: none;
  color: var(--coral); font-size: 1.15rem; line-height: 1;
}
.lit[open] > summary::before { content: '–'; }
.lit__label { font-size: 1.02rem; letter-spacing: -0.01em; color: var(--ink); }
.lit__count {
  font-family: var(--serif); font-style: italic;
  font-size: 1rem; color: var(--ink-3);
}
.lit > summary:hover .lit__count { color: var(--ink-2); }
.lit__body { padding: 0.6rem 0 3.2rem 1.5rem; max-width: 62rem; }
.lit__draft {
  margin: 0 0 1.6rem; padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--coral); background: var(--coral-dim);
  font-size: 0.78rem; line-height: 1.55; color: var(--ink-2);
}
.lit__draft code { font-size: 0.76rem; }
.lit__cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2.2rem clamp(2rem, 4vw, 3.4rem);
}
.lit__cols h4 {
  margin: 0 0 0.8rem; font-size: 0.78rem; font-weight: 500; color: var(--ink-3);
}
.lit__cols p { margin: 0; font-size: 0.96rem; line-height: 1.72; color: var(--ink-2); }

/* the references themselves: a reading list, not a bibliography block */
ol.ref { list-style: none; margin: 3rem 0 0; padding: 0; }
ol.ref li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 1rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem; line-height: 1.55;
}
.ref__who { color: var(--ink); }
.ref__year { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.ref__title {
  grid-column: 1 / -1;
  font-family: var(--serif); font-style: italic; color: var(--ink-2);
}
.ref__title a { color: inherit; }
.ref__venue { grid-column: 1 / -1; color: var(--ink-3); font-size: 0.82rem; }

/* the pattern's sources sit under both columns of the drop-down */
.drop__in > .lit, .exp .lit { grid-column: 1 / -1; }

@media (prefers-reduced-motion: no-preference) {
  .lit[open] .lit__body { animation: litIn 260ms ease both; }
}
@keyframes litIn { from { opacity: 0; transform: translateY(-3px); } }

/* --- section scaffolding ---------------------------------------- */

.section { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.section--first { padding-top: clamp(2.5rem, 5vw, 4rem); }
.section + .section { border-top: 1px solid var(--line); }

.section__head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--pad); align-items: start; margin-bottom: 2.6rem;
}
.section__head p {
  margin: 0.25rem 0 0; max-width: 24rem; color: var(--ink-2); font-size: 0.94rem;
}

/* --- breadcrumb ------------------------------------------------- */

.crumb {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding-top: 1.5rem;
  font-size: 0.82rem; color: var(--ink-3);
}
.crumb a { color: var(--ink-2); }
.crumb a:hover { color: var(--ink); }

/* --- pager ------------------------------------------------------- */

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  border-top: 1px solid var(--line); margin-top: clamp(3rem, 6vw, 5rem);
}
.pager__side {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1.15rem 1.9rem 1.25rem;
  transition: background 200ms ease;
}
.pager__side--next { border-left: 1px solid var(--line); text-align: right; }
.pager__side:hover { background: var(--bg-tint); }
.pager__name {
  font-size: 0.92rem; font-weight: 400; letter-spacing: -0.01em;
  border-bottom: 1.5px solid transparent; align-self: flex-start;
}
.pager__side--next .pager__name { align-self: flex-end; }
.pager__side:hover .pager__name { border-color: var(--hue); }
.pager__tag, .pager__dir { display: none; }

/* --- gallery table ---------------------------------------------- */

.gallery { border-top: 1px solid var(--line); }

/* --- a snippet: enough of a pattern to choose with --------------- */
.snip {
  display: grid;
  grid-template-columns: 4px 4.2rem minmax(10rem, 1.6fr) minmax(7rem, 0.8fr) 3rem;
  align-items: center;
  gap: 0 1.4rem;
  border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none;
  transition: background 200ms ease;
}
.snip:hover, .snip:focus-visible { background: var(--bg-tint); }

.snip__swatch {
  align-self: stretch; background: var(--hue);
  opacity: 0.45; transition: opacity 200ms ease;
}
.snip:hover .snip__swatch, .snip:focus-visible .snip__swatch { opacity: 1; }

.snip__num {
  font-size: 0.8rem; color: var(--ink-3);
  padding-left: 1.4rem; font-variant-numeric: tabular-nums;
}
.snip__body { display: flex; flex-direction: column; gap: 0.3rem; padding: 1.25rem 0 1.35rem; }
.snip__name { font-size: 1.02rem; font-weight: 500; letter-spacing: -0.015em; }
.snip__tag {
  font-family: var(--serif); font-style: italic;
  font-size: 0.94rem; color: var(--ink-2);
}
.snip__asks {
  justify-self: end;
  font-size: 0.78rem; color: var(--ink-3);
  border-bottom: 1px solid var(--hue); padding-bottom: 0.15rem;
}
.snip:hover .snip__asks { color: var(--ink-2); }
.snip__go {
  font-size: 0.95rem; color: var(--ink-3);
  text-align: right; padding-right: 0.4rem;
  transition: transform 200ms ease, color 200ms ease;
}
.snip:hover .snip__go { color: var(--ink); transform: translateX(3px); }

/* --- the rail: the set, carried with the page ------------------- */
/* it sticks under the header, so the six are reachable from anywhere
   in a pattern — `--nav` is the header's measured height (js/shell.js) */
#rail {
  position: sticky; top: var(--nav, 3.5rem); z-index: 25;
  background: var(--bg);
  padding-top: 0.9rem;
}
#rail.is-stuck::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: calc(100vw - var(--sbw, 0px)); border-top: 1px solid var(--line);
}

.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
}
.rail__item {
  display: flex; flex-direction: column; gap: 0.45rem;
  padding-bottom: 0.2rem;
  color: inherit; text-decoration: none;
}
/* the bar sits in a slot of fixed height and grows downward inside it,
   so marking the current plate cannot shift its label */
.rail__bar { height: 5px; position: relative; }
.rail__bar::after {
  content: ''; position: absolute; inset: auto 0 0 0;
  height: 3px; background: var(--hue); opacity: 0.3;
  transition: opacity 200ms ease, height 200ms ease;
}
.rail__item:hover .rail__bar::after,
.rail__item:focus-visible .rail__bar::after { opacity: 0.7; }
.rail__item[aria-current="page"] .rail__bar::after { opacity: 1; height: 5px; }
.rail__num {
  font-size: 0.7rem; color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.rail__name {
  font-size: 0.78rem; color: var(--ink-3); line-height: 1.3;
}
.rail__item:hover .rail__name { color: var(--ink-2); }
.rail__item[aria-current="page"] .rail__num,
.rail__item[aria-current="page"] .rail__name { color: var(--ink); }

/* --- experiment detail ------------------------------------------ */

.detail {
  display: grid;
  grid-template-columns: 15.5rem repeat(3, minmax(0, 1fr));
  gap: 0;
}
.detail > * { padding: 0 1.9rem; }
.detail > * + * { border-left: 1px solid var(--line); }
.detail > *:first-child { padding-left: 0; }

/* pattern card */
.card__num  { font-size: 0.8rem; color: var(--hue); margin-bottom: 0.5rem; }
.card__name { font-size: 1.45rem; font-weight: 400; letter-spacing: -0.025em; margin: 0 0 0.9rem; }
.card__desc { font-size: 0.87rem; color: var(--ink-2); line-height: 1.6; margin: 0 0 1.9rem; }

.card__meta { display: flex; flex-direction: column; gap: 1.05rem; }
.card__meta dt { font-size: 0.74rem; color: var(--ink-3); }
.card__meta dd { margin: 0.15rem 0 0; font-size: 0.83rem; color: var(--ink); line-height: 1.45; }
.card__meta dd a { color: var(--ink-2); border-bottom: 1px solid var(--line); }
.card__meta dd a:hover { color: var(--coral); border-color: var(--coral); }

/* intensity + condition */
.intensity { margin: 0 0 1.9rem; }
.intensity input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 12px; background: none; cursor: pointer; margin: 0;
}
.intensity input::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
.intensity input::-moz-range-track { height: 1px; background: var(--line); }
.intensity input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 9px; height: 9px; border-radius: 50%;
  background: var(--hue); margin-top: -4px;
}
.intensity input::-moz-range-thumb {
  width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--hue);
}
.intensity__val { font-size: 0.74rem; color: var(--ink-2); margin-top: 0.45rem; }
.intensity__val b { color: var(--hue); font-weight: 500; }

.cond { display: flex; gap: 1.1rem; margin: 0 0 1.5rem; }
.cond button {
  background: none; border: 0; padding: 0 0 0.3rem; font-family: inherit;
  font-size: 0.78rem; color: var(--ink-3); cursor: pointer;
  border-bottom: 1px solid transparent;
}
.cond button[aria-pressed="true"] { color: var(--ink); border-color: var(--hue); }

/* steps */
.step__head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 1.5rem; }
.step__n { font-size: 0.8rem; color: var(--ink-4); }
.step__label {
  font-size: 0.85rem; color: var(--ink-3); padding-bottom: 0.35rem;
  border-bottom: 1.5px solid transparent;
}
.step[data-state="active"] .step__n { color: var(--coral); }
.step[data-state="active"] .step__label { color: var(--ink); border-color: var(--coral); }
.step[data-state="done"] .step__label { color: var(--ink-2); }
.step[data-state="locked"] { opacity: 0.4; }
.step[data-state="locked"] * { pointer-events: none; }

.step__q { font-size: 0.98rem; font-weight: 500; letter-spacing: -0.012em; margin: 0 0 1.3rem; }

/* options */
.opts { display: flex; flex-direction: column; margin: 0 0 1.6rem; }
.opt {
  display: grid; grid-template-columns: 1.65rem 1fr; align-items: center; gap: 0.9rem;
  padding: 0.7rem 0; background: none; border: 0; border-bottom: 1px solid var(--line-soft);
  font-family: inherit; text-align: left; cursor: pointer; color: var(--ink-2);
  transition: color 160ms ease;
}
.opt:hover { color: var(--ink); }
.opt__key {
  width: 1.65rem; height: 1.65rem; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; font-size: 0.72rem; color: var(--ink-3);
  transition: all 180ms ease;
}
.opt__label { font-family: var(--serif); font-style: italic; font-size: 0.93rem; }
.opt[aria-pressed="true"] { color: var(--ink); }
.opt[aria-pressed="true"] .opt__key { border-color: var(--hue); background: var(--hue); color: #fff; }

/* scale (confidence) */
.scale { display: flex; gap: 0.4rem; margin: 0 0 1.6rem; }
.scale button {
  flex: 1; background: none; border: 1px solid var(--line); padding: 0.5rem 0.2rem;
  font-family: inherit; font-size: 0.74rem; color: var(--ink-3); cursor: pointer;
}
.scale button[aria-pressed="true"] { border-color: var(--hue); color: var(--ink); }

/* recommendation */
.rec__label { margin-bottom: 0.75rem; }
.rec__headline {
  display: flex; align-items: baseline; gap: 0.65rem;
  font-size: 1.02rem; font-weight: 500; letter-spacing: -0.015em; margin: 0 0 1rem;
}
.rec__headline span { color: var(--coral); font-weight: 400; }
.rec__body { font-size: 0.89rem; color: var(--ink-2); line-height: 1.65; margin: 0 0 1.4rem; }
.rec__body + .rec__body { margin-top: -0.6rem; }

.aside-block {
  border-left: 1.5px solid var(--hue); padding: 0.1rem 0 0.1rem 0.9rem;
  margin: 0 0 1.4rem; font-size: 0.87rem; color: var(--ink-2); line-height: 1.6;
}

.ev { list-style: none; margin: 0 0 1.4rem; padding: 0; }
.ev li {
  display: grid; grid-template-columns: 1.9rem 1fr; gap: 0.6rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem; color: var(--ink-2);
}
.ev li > span:first-child { font-size: 0.72rem; color: var(--ink-4); padding-top: 0.15rem; }
.ev li > button { grid-column: 1 / -1; }
.ev button {
  display: grid; grid-template-columns: 1.9rem 1fr; gap: 0.6rem; width: 100%;
  background: none; border: 0; padding: 0; font-family: inherit; font-size: 0.85rem;
  color: var(--ink-2); text-align: left; cursor: pointer;
}
.ev button:hover { color: var(--ink); }
.ev li[aria-pressed="true"] { color: var(--ink); }
.ev li[aria-pressed="true"] > span:first-child { color: var(--hue); }

.veil { position: relative; }
.veil[data-veiled="true"] > *:not(.veil__note) { filter: blur(5px); opacity: 0.45; user-select: none; }
.veil[data-veiled="true"] * { pointer-events: none; }
.veil__note {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  font-family: var(--serif); font-style: italic; font-size: 0.9rem; color: var(--ink-3);
  padding: 1rem;
}
.veil[data-veiled="false"] .veil__note { display: none; }

/* reflect */
.ruled {
  width: 100%; border: 0; padding: 0; resize: none; overflow: hidden;
  font-family: var(--serif); font-style: italic; font-size: 0.93rem; color: var(--ink);
  line-height: 1.75rem; background:
    repeating-linear-gradient(to bottom,
      transparent 0, transparent 1.7rem,
      var(--line) 1.7rem, var(--line) calc(1.7rem + 1px));
  margin: 0 0 1.4rem;
}
.ruled::placeholder { color: var(--ink-4); }
.ruled:focus { outline: none; }
.ruled:focus-visible { outline: none; }

.reflect__prompt { font-size: 0.89rem; color: var(--ink-2); line-height: 1.6; margin: 0 0 1.1rem; }

/* --- mechanism (withheld until after the reflection) ------------- */

.mech { border-top: 1px solid var(--line); margin-top: 3.5rem; padding-top: 2.2rem; }
.mech__grid {
  display: grid; gap: 2.4rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-top: 1.6rem;
}
.mech__grid h4 { margin: 0 0 0.6rem; font-size: 0.74rem; font-weight: 500; color: var(--ink-3); }
.mech__grid p { margin: 0; font-size: 0.89rem; color: var(--ink-2); line-height: 1.65; }
.mech__trace { margin-top: 2.4rem; }
.mech__trace ol { list-style: none; margin: 0.9rem 0 0; padding: 0; max-width: 32rem; }
.mech__trace li {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem;
  font-size: 0.8rem; color: var(--ink-2);
  padding: 0.35rem 0; border-bottom: 1px solid var(--line-soft);
}
.mech__trace li span:first-child { color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* --- prose pages ------------------------------------------------- */

.prose { max-width: 36rem; }
.prose > p { color: var(--ink-2); font-size: 0.98rem; line-height: 1.7; }
.prose h2 {
  font-size: 1.15rem; font-weight: 500; letter-spacing: -0.015em;
  margin: 2.9rem 0 0.7rem;
}
.prose strong, .prose b { color: var(--ink); font-weight: 500; }
.prose a { color: var(--coral); }
.lede-lg {
  font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 300; line-height: 1.4;
  letter-spacing: -0.02em; color: var(--ink); max-width: 34rem;
}
.flow {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.76rem; line-height: 1.9; color: var(--ink-2);
  white-space: pre; overflow-x: auto; margin: 1.6rem 0 0;
}
.flow b { color: var(--coral); font-weight: 400; }

/* a short definition list: term, then what it means, nothing else */
.steps { display: grid; gap: 0; max-width: 34rem; margin: 1.6rem 0 1.8rem; }
.steps > div {
  display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.2rem;
  padding: 0.85rem 0; border-top: 1px solid var(--line);
}
.steps dt { font-size: 0.86rem; }
.steps dd { margin: 0; font-size: 0.86rem; color: var(--ink-2); }

.stub { display: grid; gap: 1.5rem; max-width: 34rem; }
.stub__row { display: grid; grid-template-columns: 5rem 1fr; gap: 1.4rem; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.stub__row span { font-size: 0.78rem; color: var(--ink-3); }
.stub__row p { margin: 0; font-size: 0.92rem; color: var(--ink-2); }

.hidden { display: none !important; }

/* --- responsive -------------------------------------------------- */

@media (max-width: 68rem) {
  .detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail > *:nth-child(3) { border-left: 0; padding-left: 0; }
  .detail > *:nth-child(n+3) { border-top: 1px solid var(--line); padding-top: 2.4rem; margin-top: 2.4rem; }
  .snip { grid-template-columns: 4px 3.4rem minmax(6rem, 1fr) minmax(0, 0.9fr) 2rem; }
}

@media (max-width: 52rem) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; padding-top: 1rem; }
  .hero__field { height: 18rem; order: -1; }
  .section__head { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail > * { padding: 0; border-left: 0 !important; }
  .detail > * + * { border-top: 1px solid var(--line); padding-top: 2.2rem; margin-top: 2.2rem; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager__side { padding: 1.3rem 0 1.5rem; }
  .pager__side--next { border-left: 0; border-top: 1px solid var(--line); text-align: left; }
  .pager__side--next .pager__name { align-self: flex-start; }
  .snip { grid-template-columns: 3px 2.6rem minmax(0, 1fr); row-gap: 0; }
  .snip__swatch { grid-row: 1 / -1; }
  .snip__num { padding-left: 0.9rem; align-self: start; padding-top: 1.35rem; }
  .snip__go { display: none; }
  .snip__asks {
    grid-column: 3 / -1; justify-self: start; margin-bottom: 1.2rem;
  }
  #rail { padding-top: 0.6rem; }
  .rail {
    grid-auto-columns: 7.5rem;
    overflow-x: auto; scroll-snap-type: x proximity;
    margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad);
    /* the bar itself shows position, so the scrollbar is noise across it */
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail__item { scroll-snap-align: start; }
  .nav__links { gap: 1.1rem; }
  .brand { gap: 1.1rem; }
  .brand__name { display: none; }
  .foot-bar { flex-wrap: wrap; gap: 1rem; }
}

/* ---------------------------------------------------------------
   Motion — short, small, and only where something actually happened.
   Nothing loops, nothing bounces, nothing moves more than a few
   pixels. Every rule here sits inside `no-preference`, and the
   `reduce` block below switches the lot off.
   --------------------------------------------------------------- */

@keyframes rise { from { opacity: 0; transform: translateY(7px); } }
@keyframes settle { from { opacity: 0; transform: translateY(-4px); } }
@keyframes unveil { from { filter: blur(5.5px); opacity: 0.5; } }

@media (prefers-reduced-motion: no-preference) {
  /* the page arrives, once */
  [data-motion] .hero__text > *,
  [data-motion] .section__head > *,
  [data-motion] .prose > * {
    animation: rise 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  [data-motion] .hero__text > *:nth-child(2) { animation-delay: 60ms; }
  [data-motion] .hero__text > *:nth-child(3) { animation-delay: 120ms; }
  [data-motion] .hero__text > *:nth-child(4) { animation-delay: 180ms; }
  [data-motion] .hero--landing .hero__field {
    animation: rise 900ms ease-out both; animation-delay: 120ms;
  }

  /* the six, in order, so the gallery reads as a list being laid down */
  [data-motion] .snip { animation: rise 460ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  [data-motion] .snip:nth-child(2) { animation-delay: 50ms; }
  [data-motion] .snip:nth-child(3) { animation-delay: 100ms; }
  [data-motion] .snip:nth-child(4) { animation-delay: 150ms; }
  [data-motion] .snip:nth-child(5) { animation-delay: 200ms; }
  [data-motion] .snip:nth-child(6) { animation-delay: 250ms; }

  /* a pattern page: the caption, then the stage it describes */
  [data-motion] .drop__meta { animation: rise 480ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  [data-motion] .chat__panel {
    animation: rise 560ms cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: 70ms;
  }

  /* only the message that just arrived, never the whole log again */
  .turn.is-new { animation: rise 340ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .bub p.is-new { animation: settle 420ms ease-out both; }

  /* the veil coming off is the moment the whole thing is about, so it
     is the one animation allowed to take its time */
  .bub.is-unveiling { animation: unveil 620ms cubic-bezier(0.3, 0.8, 0.3, 1) both; }
  .bub p.is-lifting { animation: unveil 620ms cubic-bezier(0.3, 0.8, 0.3, 1) both; }

  .chip, .snip__go, .act--go, .rail__bar::after { transition: all 220ms ease; }
}

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

/* ---------------------------------------------------------------
   Footer — an imprint, not a second navigation. It sits at the end of
   the page: nothing expands in place any more, so nothing moves it
   --------------------------------------------------------------- */

footer[data-footer] { background: var(--bg); }
footer[data-footer] .foot-bar { margin: 0; }

/* ---------------------------------------------------------------
   The pattern's own layout — meta column beside the chat
   --------------------------------------------------------------- */

/* the rail already separates this from the page above it, so the
   section's own opening padding is only doubling the gap */
#bench.section--first { padding-top: 0; }

/* Two columns with a rule between them: what the pattern is on the left,
   the pattern happening on the right. The stage takes the larger share —
   it is the argument, the column beside it is the caption. */
.drop__in {
  display: grid;
  grid-template-columns: minmax(0, 0.62fr) minmax(0, 1.6fr);
  gap: 0 clamp(2rem, 4vw, 3.4rem);
  padding: clamp(1rem, 1.8vw, 1.5rem) 0 clamp(2.4rem, 5vw, 3.6rem);
  align-items: start;
}
/* The stage holds still while the column beside it scrolls: it stops
   under the rail (`--nav` + `--rail`, both measured) and the
   conversation scrolls inside it rather than moving the page. */
.drop__in > [data-chat] {
  border-left: 1px solid var(--line);
  padding-left: clamp(2rem, 4vw, 3.4rem);
  margin-left: calc(clamp(2rem, 4vw, 3.4rem) * -1);
}

.drop__meta { display: flex; flex-direction: column; gap: 1.5rem; }
.drop__desc { font-size: 0.87rem; color: var(--ink-2); line-height: 1.6; margin: 0; }
.drop__meta dl { display: flex; flex-direction: column; gap: 0.95rem; margin: 0; }
.exp__num {
  margin: 0; font-size: 0.8rem; color: var(--hue, var(--coral));
  font-variant-numeric: tabular-nums;
}
.drop__meta .exp__title { margin: 0.5rem 0 0.6rem; }
.drop__meta .exp__q { margin: 0 0 0.4rem; }
.drop__meta { gap: 1.2rem; }
.drop__meta dl { border-top: 1px solid var(--line); padding-top: 1.2rem; }
.drop__meta dt { font-size: 0.74rem; color: var(--ink-3); }
.drop__meta dd { margin: 0.1rem 0 0; font-size: 0.82rem; line-height: 1.45; }

/* ---------------------------------------------------------------
   Chat — a real chat window, in this system's terms
   --------------------------------------------------------------- */

/* The chat is the stage, not a widget parked in a column: a tinted
   ground in the pattern's own hue, with room to work in. The tint is
   what divides doing from reading — everything outside it is about the
   pattern, everything inside it is the pattern happening. */
.chat { width: 100%; }

.chat__panel {
  display: flex; flex-direction: column;
  gap: 1.1rem;
  /* the stage holds still; the mechanism panel below it scrolls past
     normally, which is why this sticks rather than the whole column */
  position: sticky;
  top: calc(var(--nav, 3.5rem) + var(--rail, 4rem) + 1.4rem);
  /* a window, not a box that grows: the same height whether the
     conversation is empty or long, so the page does not move under you
     as it fills and the stage reads as a place rather than an output */
  height: min(calc(100vh - var(--nav, 3.5rem) - var(--rail, 4rem) - 5rem), 48rem);
  min-height: 30rem;
  padding: clamp(1.1rem, 2vw, 1.6rem);
  border-radius: 10px;
  /* the ground is the pattern's own colour, plainly: each stage should
     be recognisable as this friction and not that one */
  background:
    linear-gradient(color-mix(in srgb, var(--hue) 7%, var(--bg)),
                    color-mix(in srgb, var(--hue) 12%, var(--bg)));
}


.chat__top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.chat__clear {
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
  font-size: 0.74rem; color: var(--ink-4);
  border-bottom: 1px solid transparent;
}
.chat__clear:hover { color: var(--ink-2); border-bottom-color: var(--line); }
.chat .cond { margin: 0; }
/* the selected one is a white pill on the tint — no outline needed */
.chat .cond button { padding: 0.3rem 0.75rem; border-radius: 100px; border: 0; }
.chat .cond button[aria-pressed="true"] {
  background: var(--bg); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* The log grows with the conversation and only scrolls once it is long.
   An empty chat is a composer, not a 500px void — and the wheel is left
   free to chain to the page when the log has nothing more to give, which
   `overscroll-behavior: contain` was preventing.
   No scroll-behavior here either: render() replaces this element, so a
   smooth setting animates it from the top on every single redraw. */
.chat__log {
  display: flex; flex-direction: column; gap: 0.55rem;
  flex: 1; min-height: 0; overflow-y: auto;
  /* the log is its own scroll area inside a stage that holds still, so
     reaching its end should stop there rather than handing the wheel to
     the page — which, with the page already at its end, rubber-bands the
     whole document */
  overscroll-behavior: contain;
}
/* nothing said yet: the log takes no room, so the invitation sits at the
   top of the stage rather than under a column of empty tint */
.chat__log:empty { flex: 0 0 auto; }

.chat__log:not(:empty) { padding: 0.2rem 0.2rem 0.4rem; }

/* --- bubbles ---------------------------------------------------- */

.turn { display: flex; flex-direction: column; align-items: flex-start; }
.turn--you { align-items: flex-end; }
.turn + .turn { margin-top: 0.15rem; }

/* the speaker's name, only where the speaker changes */
.turn__who {
  display: flex; gap: 0.5rem; align-items: baseline;
  margin: 0.75rem 0 0.3rem; padding: 0 0.2rem;
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
}
.turn__who span { color: var(--ink-4); letter-spacing: 0; text-transform: none; }
.turn--you .turn__who { flex-direction: row-reverse; }

.bub {
  max-width: 82%;
  padding: 0.8rem 1rem 0.85rem;
  font-size: 0.95rem; line-height: 1.58;
}
.bub p { margin: 0; }
.bub p + p { margin-top: 0.7rem; }

/* your own messages carry the pattern's colour, so the conversation is
   visibly inside this friction and not a generic chat */
.bub--you {
  background: var(--hue, var(--ink)); color: #fff;
  border-radius: 14px 14px 3px 14px;
}
.bub--ai {
  background: var(--bg);
  border: 0;
  border-radius: 14px 14px 14px 3px;
  color: var(--ink);
}

/* the system line: the case everyone is looking at */
.turn--note { justify-content: center; }
.bub--note {
  max-width: 92%; text-align: center; padding: 0 1rem 0.4rem;
  font-family: var(--serif); font-style: italic;
  font-size: 0.88rem; line-height: 1.5; color: var(--ink-3);
}

/* when nothing answered: the chat says so rather than pretending */
.bub--off { border-color: var(--coral); background: var(--coral-dim); }
.bub--off code { font-size: 0.86em; }

/* the veil: the answer is there, it is just not readable yet */
.bub--veiled p, .bub p.is-held {
  filter: blur(5.5px);
  opacity: 0.5;
  user-select: none;
  transition: filter 420ms ease, opacity 420ms ease;
}

.bub__aside {
  border-left: 1.5px solid var(--hue, var(--coral));
  padding: 0.1rem 0 0.1rem 0.8rem;
  margin: 0.9rem 0 0;
  font-size: 0.89rem; color: var(--ink-2); line-height: 1.55;
}
.bub__aside .micro { display: block; margin-bottom: 0.3rem; }

.typing { display: inline-flex; gap: 0.24rem; align-items: center; height: 1.58em; }
.typing i {
  width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--ink-3);
  animation: typing 1.1s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.bub__list { margin: 0.7rem 0 0; padding-left: 1.05rem; }
.bub__list li { margin: 0.3rem 0; color: var(--ink-2); }
.bub__list li.is-marked { color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--hue); text-underline-offset: 3px; }

/* your own part, kept under what it was put against: set apart from the
   system's voice by the annotation face and a neutral rule */
.bub__yours {
  border-left: 1.5px solid var(--line);
  padding: 0.1rem 0 0.1rem 0.8rem; margin: 0.9rem 0 0;
  font-family: var(--serif); font-style: italic;
  font-size: 0.92rem; color: var(--ink-2); line-height: 1.5;
}
.bub__yours .micro { display: block; margin-bottom: 0.3rem; font-family: var(--sans); font-style: normal; }

/* other side: two answers of equal standing */
.bub:has(.pair) { max-width: 100%; }
.pair { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.pair__one { border-top: 1.5px solid var(--line); padding-top: 0.6rem; }
.pair__one .micro { display: block; margin-bottom: 0.35rem; }
.pair__one.is-picked { border-top-color: var(--hue); }

/* what is worth asking next — the conversation has somewhere to go */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }
.chips + .chat__form { margin-top: -0.3rem; }
.chip {
  border: 1px solid color-mix(in srgb, var(--hue) 18%, var(--line));
  border-radius: 100px;
  background: var(--bg); color: var(--ink-2);
  padding: 0.35rem 0.8rem; font-family: inherit; font-size: 0.78rem;
  cursor: pointer; transition: border-color 160ms ease, color 160ms ease;
}
.chip:hover { border-color: var(--hue, var(--coral)); color: var(--ink); }

/* your own question, carried over from wherever you last asked it */
.carry { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; margin-top: auto; }
.carry + .chips { margin-top: 0; }
.carry + .chat__form { margin-top: -0.3rem; }
.carry__from {
  margin: 0; font-family: var(--serif); font-style: italic;
  font-size: 0.82rem; color: var(--ink-3);
}
.chip--carry {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-color: color-mix(in srgb, var(--hue) 45%, var(--line)); color: var(--ink);
}

/* --- the gate: what the friction asks before it lets go --------- */

.gate {
  margin-top: auto;
  border: 0; border-radius: 8px;
  background: var(--bg);
  padding: 1.2rem 1.3rem 1.1rem;
  box-shadow: inset 0 3px 0 -1px var(--hue, var(--coral));
}
.gate__foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line);
}
.gate__note {
  margin: 0; font-family: var(--serif); font-style: italic;
  font-size: 0.84rem; color: var(--ink-3);
}
.act--go {
  padding: 0.55rem 1rem; border-radius: 4px;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
}
.act--go:disabled { background: var(--paper-2); color: var(--ink-4); border-color: var(--line); }
.act--go::after { content: none; }
.gate__sub {
  margin: -0.6rem 0 0.9rem; font-size: 0.8rem; color: var(--ink-3);
  font-family: var(--serif); font-style: italic;
}
.gate__write {
  width: 100%; resize: vertical; margin-bottom: 1rem;
  border: 0; border-radius: 4px; background: var(--paper-2);
  padding: 0.7rem 0.8rem; color: var(--ink);
  font-family: inherit; font-size: 0.9rem; line-height: 1.55;
}
.gate__write:focus { outline: 1px solid var(--ink-4); }
.gate .act:disabled { color: var(--ink-4); border-color: var(--line); cursor: not-allowed; }
.gate__q { font-size: 0.93rem; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 0.95rem; }
.gate .opts, .gate .scale, .gate .ev { margin-bottom: 1rem; }
.gate .opt, .gate .choice { background: var(--bg); }
.gate__verdict {
  border-left: 1.5px solid var(--hue, var(--coral));
  padding-left: 0.85rem; margin: 0 0 1rem;
  font-size: 0.88rem; color: var(--ink-2); line-height: 1.55;
}
.gate__reading {
  border-left: 1.5px solid var(--line);
  padding: 0.1rem 0 0.1rem 0.85rem; margin: 0 0 0.8rem;
  font-size: 0.88rem; color: var(--ink-2); line-height: 1.55;
}
.gate__reading .micro { display: block; margin-bottom: 0.3rem; }

/* --- the composer ----------------------------------------------- */

.chat__form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem; align-items: end;
  /* no auto margin here: the invitation above already pushes everything
     after it to the foot of the stage, and a second one split the gap so
     the openers floated in the middle instead of sitting on the input */
  border: 0; border-radius: 8px;
  background: var(--bg);
  padding: 0.9rem 0.9rem 0.9rem 1.2rem;
}
.chat__input {
  width: 100%; border: 0; padding: 0.45rem 0; resize: none; overflow: hidden;
  background: none; color: var(--ink);
  font-family: inherit; font-size: 0.95rem; line-height: 1.5;
}
.chat__input::placeholder { color: var(--ink-4); }
.chat__input:focus { outline: none; }
.chat__input:disabled { color: var(--ink-4); }

.chat__send {
  width: 2.4rem; height: 2.4rem; padding: 0; flex: none;
  border: 0; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-size: 0.9rem; line-height: 1;
}
.chat__send:disabled { background: var(--line); color: var(--ink-4); }

.chat__hint {
  font-size: 0.74rem; color: var(--ink-3); line-height: 1.5;
  margin: 0.9rem 0 0; max-width: 34rem;
}
.chat__hint b { color: var(--ink-2); font-weight: 500; }

.chat .cond { margin: 0 0 0.9rem; }

@media (max-width: 60rem) {
  .drop__in { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .drop__in > [data-chat] { border-left: 0; padding-left: 0; margin-left: 0; }
  .chat__panel { position: static; height: min(72vh, 40rem); min-height: 26rem; }
  .bub { max-width: 88%; }
  .chat__log:not(:empty) { padding: 0.2rem 0.1rem 0.4rem; }
}
