/* ==========================================================================
   page-results.css  /results (results.html) only. Loaded after kd.css.
   The results ledger: a poster hero with the four figures typeset as a ruled row, a sticky filter, then one
   band per category (group name at poster scale, one kd-result--feature row, then kd-result--compact rows),
   the testimonials (one large in the display face, two smaller), the split closing band.
   Prefix res-. Reusable candidates are marked "SYSTEM?" (see the Stage 2 report).
   Sections: hero · stats ledger · filter · groups + rows · slate · facts · voices · motion
   Colour: semantic tokens only (kd.css section 2): light and dark come from the same rules, no dark selector here.
   ========================================================================== */

/* ── hero ──────────────────────────────────────────────────────────────── */
.res-hero { padding-bottom: 0; }
.res-hero__dateline { color: var(--ink); }
.res-hero__grid {
  display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); column-gap: clamp(24px, 3.5vw, 56px);
  align-items: end; margin-top: clamp(24px, 3vw, 44px);
}
.kd-hero--page .res-hero__h { font-size: clamp(3.6rem, 9.4vw, 9rem); line-height: 0.9; max-width: none; text-wrap: wrap; }
.res-hero__h .kd-mark { --mk-top: 0.5em; --mk-bot: 0.1em; }
.res-nw { white-space: nowrap; }
.res-hero__side { padding-bottom: 0.55rem; }
.res-hero__side .kd-hero__lead { margin-top: 0; max-width: 24rem; }

/* the four figures: a ruled ledger row, not boxes (SYSTEM? a kd-ledger--strip variant) */
.res-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(40px, 5vw, 72px);
  border-top: 1px solid var(--rule-strong);
}
.res-stats > div { display: flex; flex-direction: column; padding: 18px var(--s-5) clamp(28px, 3.4vw, 48px) 0; }
.res-stats > div + div { border-left: 1px solid var(--rule); padding-left: var(--s-5); }
.res-stats dd { order: -1; font-family: var(--font-display); font-weight: 400; font-size: clamp(3.75rem, 7.4vw, 7.25rem); line-height: 0.84; letter-spacing: -0.004em; }
.res-stats dt { margin-top: 12px; font-size: var(--t-label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.35; color: var(--ink-2); }

/* ── filter: a ruled row of bold text tabs, sticky under the nav (SYSTEM? kd-tabs--filter, aria-pressed) ── */
.res-list { --bar-h: 56px; position: relative; }
.res-filter { position: sticky; top: var(--nav-h); z-index: 40; background: var(--surface); border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.res-filter__row { display: flex; gap: 0 var(--s-6); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.res-filter__row::-webkit-scrollbar { display: none; }
.res-filter .kd-tab {
  flex: none; min-height: var(--bar-h); margin: 0; padding: 0; border: 0; border-bottom: 3px solid transparent; background: none;
  min-width: 44px; justify-content: flex-start; font-size: 1rem; white-space: nowrap; cursor: pointer;
}
.res-filter .kd-tab.active, .res-filter .kd-tab[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.res-filter .kd-tab:not([aria-pressed="true"]):not(.active):hover { border-bottom-color: var(--rule); }   /* hover: a quiet underline, the pressed one stays the accent */
.res-filter .kd-tab:active { transform: translateY(1px); }
.res-filter .kd-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ── groups: one band per category ─────────────────────────────────────── */
.res-group {
  padding-block: clamp(56px, 7.5vw, 112px) clamp(48px, 6vw, 96px);
  scroll-margin-top: calc(var(--nav-h) + var(--bar-h) + 1px);
}
.res-group__h {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(3.75rem, 8.6vw, 8.25rem); line-height: 0.86;
  letter-spacing: -0.006em; padding-bottom: clamp(18px, 2.2vw, 28px);
}
.res-results { border-top: 1px solid var(--rule-strong); }
.res-row { counter-increment: res; }
.res-desc { color: var(--ink-2); text-wrap: pretty; }

/* feature row: the big 9:16 frame + its slate, the headline at display-3 */
.res-row--feature { grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); column-gap: clamp(32px, 6vw, 104px); padding-block: clamp(32px, 4vw, 56px); border-bottom-color: var(--rule-strong); }
.res-row--feature.kd-result--flip { grid-template-columns: minmax(0, 1fr) minmax(220px, 340px); }
.res-row--feature .kd-result__film { max-width: 340px; width: 100%; }
.res-row--feature .kd-result__body { align-self: center; gap: var(--s-4); max-width: 44rem; padding-bottom: 38px; }
.res-row--feature .kd-result__name { font-size: clamp(2.5rem, 4.6vw, 4.25rem); line-height: 0.92; max-width: 13em; }
.res-row--feature .res-desc { font-size: 1.1875rem; line-height: 1.5; max-width: 52ch; }
.res-row--feature .kd-result__act { margin-top: var(--s-3); }

/* compact rows: small frame, the body carries the slate as a credit line */
.res-compacts { grid-template-columns: 1fr; }
.res-row--compact { grid-template-columns: 150px minmax(0, 1fr); column-gap: var(--s-5); padding-block: var(--s-6); }
.res-row--compact .kd-result__body { gap: 10px; max-width: 40rem; }
.res-row--compact .kd-result__name { font-size: 1.3125rem; line-height: 1.22; }
.res-row--compact .res-desc { font-size: 0.9688rem; line-height: 1.55; }
.res-row--compact .kd-result__act { margin-top: 0; }
@media (min-width: 1200px) {
  .res-compacts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(40px, 4.4vw, 72px); }
}
/* rhythm (gen_results.py wide_set): every third compact row, and a row left alone at the end of a group, is a wide
   closing row: across both columns from 1200px, head + slate left and the rest right (from 960px in the single column) */
@media (min-width: 960px) {
  .res-compacts > .res-row--wide { grid-column: 1 / -1; }
  .res-compacts > .res-row--wide .kd-result__body {
    max-width: none; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(40px, 4.4vw, 72px); align-content: start;
  }
  .res-compacts > .res-row--wide .kd-result__label,
  .res-compacts > .res-row--wide .kd-result__name,
  .res-compacts > .res-row--wide .res-slate { grid-column: 1; }
  .res-compacts > .res-row--wide .kd-result__name { font-size: 1.75rem; line-height: 1.12; }
  .res-compacts > .res-row--wide .res-desc,
  .res-compacts > .res-row--wide .res-facts,
  .res-compacts > .res-row--wide .kd-result__act { grid-column: 2; }
  /* right column reads desc, facts, action with no hole: desc beside label + name, facts level with the slate */
  .res-compacts > .res-row--wide .res-desc { grid-row: 1 / span 2; max-width: 54ch; }
  .res-compacts > .res-row--wide .res-facts { grid-row: 3; align-self: start; }
  .res-compacts > .res-row--wide .kd-result__act { grid-row: 4; }
}

/* the text action carries the drawn arrow; the outline action on features too */
.res-row .kd-btn svg { width: 14px; height: 14px; }
.res-row .kd-btn--text { justify-self: start; }

/* ── slate: number (CSS counter, not copy) · name · the two tags that sat on the old film overlay ─── */
.res-slate { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; font-size: 0.875rem; line-height: 1.35; }
.res-slate::before {
  content: counter(res, decimal-leading-zero); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.1em; color: var(--accent);
}
.res-slate__name { font-weight: 800; color: var(--ink); }
.res-slate__tags { display: inline-flex; flex-wrap: wrap; gap: 0 10px; }
.res-slate__tag { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.res-slate__tag { white-space: nowrap; }
.res-slate__tag:not(:last-child)::after { content: "/"; margin-left: 10px; color: var(--ink-3); font-weight: 400; }
.kd-result__film > .res-slate { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule-strong); }

/* ── facts: the old chips, re-set ─────────────────────────────────────── */
.res-facts { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule-strong); }
.res-facts > li { padding: 12px var(--s-5) 0 0; font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.res-facts > li + li { padding-left: var(--s-5); border-left: 1px solid var(--rule); }
.res-facts--quiet { border-top: 0; gap: 2px 0; }
.res-facts--quiet > li, .res-facts--quiet > li + li { padding: 0; border-left: 0; font-size: 0.875rem; font-weight: 700; color: var(--ink); }
.res-facts--quiet > li:not(:last-child)::after { content: ""; display: inline-block; width: 1px; height: 0.95em; margin: 0 12px; vertical-align: -0.12em; background: var(--ink); }
.res-glyph { font-family: var(--font-text); }

/* ── testimonials ─────────────────────────────────────────────────────── */
.res-voices { border-top: 1px solid var(--rule-strong); }
.res-voices__head > .kd-display-2 { max-width: 9em; }
.res-voices__grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(40px, 7vw, 120px); row-gap: var(--s-7);
  align-items: start;
}
.res-q--1 { grid-row: 1 / span 2; }
.res-q--1 .kd-quote__text { font-family: var(--font-display); font-weight: 400; font-size: clamp(3rem, 5.4vw, 5.25rem); line-height: 0.96; letter-spacing: -0.004em; max-width: 11em; }
.res-q--1 .kd-quote__mark { font-size: 8rem; left: -0.34em; top: 0.02em; }
.res-q--2 { margin-top: clamp(0px, 6vw, 96px); }

/* ── phones and tablets ───────────────────────────────────────────────── */
@media (max-width: 1199px) {
  .res-q--1 .kd-quote__mark { font-size: 6rem; height: 0.42em; }
}
@media (max-width: 959px) {
  .res-hero__grid { grid-template-columns: 1fr; row-gap: var(--s-5); }
  .res-hero__side .kd-hero__lead { max-width: 34rem; }
  .res-voices__grid { grid-template-columns: 1fr; }
  .res-q--1 { grid-row: auto; }
  .res-q--2 { margin-top: 0; }
}
@media (max-width: 719px) {
  .kd-hero--page .res-hero__h { font-size: min(calc((100vw - 2 * var(--gutter)) / 4.6), 5.25rem); line-height: 0.9; }
  .res-hero__side { padding-bottom: 0; }
  .res-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: var(--s-7); }
  .res-stats > div { padding: 16px var(--s-4) 20px 0; }
  .res-stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .res-stats > div:nth-child(even) { padding-left: var(--s-4); }
  .res-stats > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .res-stats dd { font-size: 4rem; }

  .res-list { --bar-h: 52px; }
  .res-filter__row { gap: 0 var(--s-5); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
  .res-filter .kd-tab { font-size: 0.9375rem; }

  .res-group__h { font-size: clamp(3.25rem, 15vw, 4.5rem); }

  /* feature: frame + slate beside the label and name; the rest runs full width under them */
  .res-row--feature, .res-row--feature.kd-result--flip { grid-template-columns: minmax(0, 42fr) minmax(0, 58fr); column-gap: var(--s-4); row-gap: var(--s-4); padding-block: var(--s-6); }
  .res-row--feature .kd-result__film { grid-row: 1 / span 2; align-self: start; }
  .res-row--feature .kd-result__body { display: contents; }
  .res-row--feature .kd-result__label { grid-column: 2; grid-row: 1; align-self: end; }
  .res-row--feature .kd-result__name { grid-column: 2; grid-row: 2; align-self: start; font-size: 2.25rem; }
  .res-row--feature .res-desc, .res-row--feature .res-facts, .res-row--feature .kd-result__act { grid-column: 1 / -1; }
  .res-row--feature .res-desc { font-size: 1.0625rem; }
  .res-row--feature .kd-result__act .kd-btn { width: 100%; }
  .res-row--feature .kd-result__film > .res-slate { font-size: 0.8125rem; }

  /* compact: frame beside label, name and slate; paragraph, facts and action full width */
  .res-row--compact { grid-template-columns: 104px minmax(0, 1fr); column-gap: var(--s-4); row-gap: 10px; padding-block: var(--s-6); }
  .res-row--compact .kd-result__film { grid-row: 1 / span 3; align-self: start; }
  .res-row--compact .kd-result__body { display: contents; }
  .res-row--compact .kd-result__label { grid-column: 2; grid-row: 1; }
  .res-row--compact .kd-result__name { grid-column: 2; grid-row: 2; font-size: 1.1875rem; }
  .res-row--compact .res-slate { grid-column: 2; grid-row: 3; align-self: start; }
  .res-row--compact .res-desc, .res-row--compact .res-facts, .res-row--compact .kd-result__act { grid-column: 1 / -1; }
  .res-row--compact .res-desc { margin-top: 6px; }
  .res-facts > li { font-size: 1rem; }
  .res-row--feature .res-facts { display: grid; border-top: 0; }
  .res-row--feature .res-facts > li, .res-row--feature .res-facts > li + li { padding: 10px 0; border-left: 0; border-top: 1px solid var(--rule); }
  .res-row--feature .res-facts > li:first-child { border-top-color: var(--rule-strong); }
  .kd-result__film > .res-slate { display: grid; gap: 2px; }
  .res-hero__h br { display: none; }
  .res-hero__h { text-wrap: balance; }
  .res-facts--quiet > li { font-size: 0.875rem; }

  .res-q--1 .kd-quote__text { font-size: clamp(2.6rem, 11vw, 3.25rem); }
}

/* ── motion: filtering only fades the groups it shows (opacity, never layout) ── */
.res-group.is-shown { animation: res-in 280ms var(--ease-out) both; }
@keyframes res-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .res-group.is-shown { animation: none; } }
