/* ==========================================================================
   SRE-Bench
   A realistic, contamination-free benchmark for agentic reverse engineering
   Visual system shared with the Pasta Lab site; one blue accent instead of
   terracotta.
   ========================================================================== */

/* --- Fonts ---------------------------------------------------------------- */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/jetbrains-mono-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Tokens --------------------------------------------------------------- */

:root {
  /* surfaces and ink */
  --canvas: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ecece9;
  --surface-inset: #e6e6e2;
  --ink: #17171a;
  --ink-2: #4a4a50;
  --ink-3: #5f5f67;
  --line: #e0e0dc;
  --line-strong: #cfcfc9;

  /* one accent, tonal per theme */
  --accent: #1f5fd1;
  --accent-hover: #1a52b6;
  --accent-on: #ffffff;
  /* For small text sitting on an accent-wash background, where the plain
     accent drops below 4.5:1. */
  --accent-strong: #184aa6;
  --accent-wash: rgba(31, 95, 209, 0.09);
  --accent-line: rgba(31, 95, 209, 0.28);
  /* how strongly a 100% cell is tinted; lower on dark so ink stays readable */
  --tint-max: 0.6;

  /* shape: square corners, as on the lab site */
  --r-sm: 0;
  --r-md: 0;
  --r-lg: 0;
  --r-pill: 0;

  /* depth, tinted with ink rather than black */
  --shadow-sm: 0 1px 2px rgba(23, 23, 26, 0.05);
  --shadow-md: 0 2px 4px rgba(23, 23, 26, 0.04), 0 8px 20px rgba(23, 23, 26, 0.06);
  --shadow-lg: 0 4px 8px rgba(23, 23, 26, 0.05), 0 18px 44px rgba(23, 23, 26, 0.1);

  /* type */
  --font-sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* layout */
  --shell: 1200px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --nav-h: 68px;

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 260ms;

  color-scheme: light;
}

:root[data-theme='dark'] {
  --canvas: #131315;
  --surface: #1b1b1e;
  --surface-2: #232327;
  --surface-inset: #101012;
  --ink: #edede9;
  --ink-2: #b4b4ba;
  --ink-3: #9a9aa2;
  --line: #2c2c31;
  --line-strong: #3a3a41;

  --accent: #8ab4ff;
  --accent-hover: #a3c4ff;
  --accent-on: #131315;
  --accent-strong: #9dbfff;
  --accent-wash: rgba(138, 180, 255, 0.12);
  --accent-line: rgba(138, 180, 255, 0.32);
  --tint-max: 0.45;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.3), 0 18px 44px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* --- Base ----------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.12;
  text-wrap: balance;
}

p { margin: 0 0 1rem; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

ul, ol { margin: 0; padding: 0; }

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

::selection { background: var(--accent-wash); color: var(--ink); }

main:focus { outline: none; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  color: var(--accent-on);
  background: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 160ms var(--ease);
}

.skip-link:focus { top: 0.5rem; color: var(--accent-on); }

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

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nav[data-stuck='true'] {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--canvas) 94%, transparent);
}

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: none;
}

.brand__mark { width: 28px; height: 28px; }
.brand__name { font-size: 1.0625rem; }

.brand:hover { color: var(--ink); }
.brand:hover .brand__mark { transform: rotate(-6deg) scale(1.06); }
.brand__mark { transition: transform var(--dur) var(--ease); }

.nav__menu { margin-left: auto; }

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 1.4vw, 1rem);
  list-style: none;
}

.nav__links a {
  display: block;
  padding: 0.4rem 0.55rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nav__links a:hover { color: var(--ink); background: var(--surface-2); }
.nav__links a[aria-current='page'] { color: var(--accent); }

.nav__tools { display: flex; align-items: center; gap: 0.35rem; flex: none; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  padding: 0;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.icon-btn:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }

.theme-toggle .theme-toggle__moon { display: none; }
:root[data-theme='dark'] .theme-toggle .theme-toggle__moon { display: block; }
:root[data-theme='dark'] .theme-toggle .theme-toggle__sun { display: none; }

.nav__burger { display: none; }

@media (max-width: 860px) {
  .nav__burger { display: grid; }
  .nav__menu { margin-left: auto; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--gutter) 1rem;
    background: var(--canvas);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms var(--ease), transform 180ms var(--ease),
      visibility 180ms;
  }
  .nav__links[data-open='true'] { opacity: 1; transform: none; visibility: visible; }
  .nav__links a { padding: 0.75rem 0.5rem; font-size: 1rem; }
}

/* --- Sections and headings ------------------------------------------------ */

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section--edge { border-top: 1px solid var(--line); }

.section__head { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.section__head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section__head h2 { font-size: clamp(1.65rem, 3.2vw, 2.35rem); }
.section__head p { margin-top: 0.85rem; max-width: none; line-height: 1.7; color: var(--ink-2); }

.eyebrow {
  display: block;
  margin-bottom: 0.7rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-head { padding-block: clamp(2.5rem, 6vw, 4.25rem) clamp(1.5rem, 3vw, 2.25rem); }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 3.35rem); }
/* Intro copy spans its container so the text edges line up with the cards and
   section blocks below, rather than stopping at the default reading measure. */
.page-head p { margin-top: 1rem; max-width: none; font-size: 1.0625rem; line-height: 1.7; color: var(--ink-2); }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
    border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }

.btn--primary { background: var(--accent); color: var(--accent-on); }
.btn--primary:hover { background: var(--accent-hover); color: var(--accent-on); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink-3); color: var(--ink); }

.btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  padding-top: clamp(2.5rem, 6vw, 5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.hero__kicker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin-bottom: 1.1rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__kicker b { color: var(--accent-strong); font-weight: 600; }

.hero__title {
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero__lede {
  margin-top: 1.4rem;
  max-width: 34ch;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: pretty;
}

.hero__sub {
  margin-top: 1.1rem;
  max-width: 56ch;
  font-size: clamp(1rem, 1.4vw, 1.1rem);
  color: var(--ink-2);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.9rem; }

.hero__prose { margin-top: clamp(1.75rem, 4vw, 2.75rem); }

/* --- Prose ---------------------------------------------------------------- */

.prose { max-width: 72ch; }
.prose h2 { margin-top: 2.2rem; font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.5rem; font-size: 1.05rem; }
.prose p { max-width: none; color: var(--ink-2); line-height: 1.7; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0.6rem 0 1rem; display: grid; gap: 0.4rem; }
.prose li { color: var(--ink-2); line-height: 1.65; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  padding: 0.05em 0.35em;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.checklist { list-style: none; padding: 0; margin: 0.9rem 0 1.2rem; display: grid; gap: 0.7rem; }
.checklist li { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); gap: 0.5rem; }
.checklist li::before {
  content: '\2713';
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

.callout {
  margin-top: 1.5rem;
  padding: clamp(1.15rem, 2.5vw, 1.6rem) clamp(1.25rem, 3vw, 1.85rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}

.callout p { max-width: none; line-height: 1.7; }
.callout .chip-row { margin-top: 0.9rem; }

.note { color: var(--ink-3); font-size: 0.9rem; max-width: none; }

/* --- Leaderboard ---------------------------------------------------------- */

.table-scroll { overflow-x: auto; }

.board {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
}

.board th, .board td {
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.board th {
  color: var(--ink-3);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.board tr:last-child td { border-bottom: 0; }

.board__rank {
  width: 4rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.board__model { display: block; color: var(--ink); font-weight: 600; }
.board__org { display: block; margin-top: 0.1rem; color: var(--ink-3); font-size: 0.82rem; }
.board__note { display: block; margin-top: 0.2rem; color: var(--ink-3); font-size: 0.8rem; font-style: italic; }
.board__rate { width: 45%; min-width: 13rem; }

.rate { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr); align-items: center; gap: 0.75rem; }
.rate__num { color: var(--ink); font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600; }
.rate__bar { display: block; height: 0.6rem; background: var(--surface-inset); overflow: hidden; }
.rate__fill { display: block; height: 100%; width: calc(var(--value, 0) * 1%); background: var(--accent); }

.board tr.is-top td { background: var(--accent-wash); }
.board tr.is-top .board__rank { color: var(--accent-strong); font-weight: 700; }

.board-caption { margin-top: 0.85rem; color: var(--ink-3); font-size: 0.85rem; max-width: none; }

@media (max-width: 640px) {
  .board th, .board td { padding: 0.7rem 0.7rem; }
  .board__rate { min-width: 10rem; }
}

/* --- Toolbar (matrix groups, leaderboard metric) --------------------------- */

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin-bottom: 1rem;
}

.tools__label {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.filters { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.filter {
  padding: 0.42rem 0.95rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.filter:hover { color: var(--ink); border-color: var(--line-strong); }

.filter[aria-pressed='true'] {
  color: var(--accent-on);
  background: var(--accent);
  border-color: var(--accent);
}

.filter__count {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  opacity: 0.65;
}

/* --- Task matrix ---------------------------------------------------------- */

/* Scrolls sideways only; every row is always in view. */
.matrix-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.matrix {
  border-collapse: separate;
  border-spacing: 0;
  min-width: max-content;
  font-size: 0.82rem;
}

.matrix th, .matrix td {
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
  text-align: center;
}

.matrix__group {
  height: 2.2rem;
  padding: 0 0.75rem !important;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.matrix__variant {
  top: 2.2rem !important;
  height: 3.4rem;
  width: 5.6rem;
  min-width: 5.6rem;
  padding: 0 0.3rem !important;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.25;
  white-space: normal;
  cursor: help;
}

.matrix__corner, .matrix__program {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  text-align: left;
  border-right: 2px solid var(--line-strong) !important;
}

.matrix__corner { z-index: 4; background: var(--surface-2); padding: 0 0.9rem !important; }

.matrix__program { min-width: 13rem; padding: 0.5rem 0.9rem !important; }

.matrix__program b {
  display: block;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

.matrix__program span { display: block; margin-top: 0.1rem; color: var(--ink-3); font-size: 0.74rem; }

.matrix__section th, .matrix__section td {
  background: var(--canvas);
  color: var(--ink);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.matrix__section th { padding: 0.55rem 0.9rem !important; }

.matrix__coming-cell { padding: 0.55rem 0.9rem !important; color: var(--ink-3); font-size: 0.8rem; text-align: left; }

.matrix .is-group-start { border-left: 2px solid var(--line-strong); }

.cell {
  display: block;
  width: 100%;
  height: 3rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  line-height: 3rem;
  text-align: center;
  cursor: default;
}

.cell--scored {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  line-height: 1.1;
  background: color-mix(in srgb, var(--accent) calc(var(--score, 0) * var(--tint-max) * 1%), var(--surface));
  color: var(--ink);
  font-family: var(--font-mono);
  cursor: pointer;
}

.cell__score { font-size: 0.86rem; font-weight: 600; }
.cell__model {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell--scored:hover,
.cell--scored:focus-visible,
.cell--scored[aria-expanded='true'] {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.cell--solved { box-shadow: inset 0 0 0 2px var(--accent-line); }
.cell--solved .cell__score { color: var(--accent-strong); }

/* --- Popover -------------------------------------------------------------- */

.popover {
  position: absolute;
  z-index: 60;
  min-width: 15rem;
  max-width: 22rem;
  padding: 0.8rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
}

.popover[hidden] { display: none; }

.popover__title { margin: 0 0 0.55rem; color: var(--ink); font-family: var(--font-mono); font-size: 0.84rem; font-weight: 600; max-width: none; }
.popover__title span { display: block; margin-top: 0.15rem; color: var(--ink-3); font-family: var(--font-sans); font-size: 0.76rem; font-weight: 400; }

.popover__list { list-style: none; display: grid; gap: 0.3rem; }
.popover__row { display: flex; justify-content: space-between; gap: 1rem; color: var(--ink-2); }
.popover__row b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.popover__row.is-best, .popover__row.is-best b { color: var(--accent-strong); }
.popover__empty { margin: 0; color: var(--ink-3); }

/* --- Legend --------------------------------------------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.6rem;
  margin-top: 1rem;
  color: var(--ink-3);
  font-size: 0.82rem;
}

.legend__item { display: inline-flex; align-items: center; gap: 0.45rem; }

.legend__swatch {
  display: inline-block;
  width: 1.7rem;
  height: 1.1rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) calc(var(--score, 0) * var(--tint-max) * 1%), var(--surface));
}

.legend__swatch--solved { box-shadow: inset 0 0 0 2px var(--accent-line); }
.legend__swatch--empty { background: var(--surface); }

/* --- Collaborators -------------------------------------------------------- */

.partner-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(0.75rem, 1.6vw, 1rem);
}

.partner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: clamp(1.15rem, 2.2vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.partner:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Every logo sits in the same band and keeps its own colours; --logo-h per
   logo balances compact icons against wide wordmarks. In the dark theme the
   band becomes a white plate so dark wordmarks stay legible. */
.partner__band {
  display: flex;
  align-items: center;
  width: 100%;
  height: 46px;
  margin-bottom: 0.9rem;
}

.partner__logo {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

:root[data-theme='dark'] .partner__band {
  padding: 0 0.75rem;
  background: #ffffff;
}

.partner__mark {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

:root[data-theme='dark'] .partner__mark { color: #1f5fd1; }

.partner__name { color: var(--ink); font-weight: 600; font-size: 1rem; }
.partner__where { color: var(--ink-3); font-size: 0.85rem; }

/* --- Citation ------------------------------------------------------------- */

.cite {
  position: relative;
  padding: 1.25rem 1.35rem;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  overflow-x: auto;
}

.cite pre {
  margin: 0;
  padding-right: 7rem;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

.cite__copy { position: absolute; top: 0.7rem; right: 0.7rem; }

.btn--small { padding: 0.42rem 0.8rem; font-size: 0.8rem; }

@media (max-width: 640px) {
  .cite pre { padding-right: 0; padding-top: 2.2rem; }
}

/* --- Contributors --------------------------------------------------------- */

.roles { display: grid; gap: clamp(1.75rem, 3.5vw, 2.75rem); }

.role { padding-top: 1.35rem; border-top: 1px solid var(--line); }
.role h2 { font-size: clamp(1.3rem, 2.3vw, 1.7rem); }

.role h3 {
  margin-top: 1.5rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.people {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.person {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--dur) var(--ease);
}

.person:hover { border-color: var(--accent-line); }

.person__name { display: block; color: var(--ink); font-weight: 600; font-size: 0.97rem; }
.person__name a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.person__name a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.person__contact { color: var(--ink-3); font-weight: 400; font-size: 0.85rem; }
.person__affil { display: block; margin-top: 0.15rem; color: var(--ink-3); font-size: 0.82rem; }
.person__note { color: var(--ink-3); font-size: 0.78rem; font-style: italic; }

.role__empty { margin-top: 0.9rem; color: var(--ink-3); font-size: 0.92rem; }

/* --- Tags and meta chips -------------------------------------------------- */

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; }

.tag {
  padding: 0.24rem 0.62rem;
  color: var(--ink-3);
  background: var(--surface-2);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.15rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.75rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    background var(--dur) var(--ease);
}

.chip:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-wash); }

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

.footer {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-block: clamp(2.25rem, 4vw, 3.25rem);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}

.footer__slogan {
  margin-top: 0.85rem;
  max-width: 34ch;
  font-size: 0.925rem;
  color: var(--ink-3);
}

.footer h2 {
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.footer ul { list-style: none; display: grid; gap: 0.45rem; }
.footer ul a { color: var(--ink-2); font-size: 0.92rem; text-decoration: none; }
.footer ul a:hover { color: var(--accent); }

.footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-3);
}

@media (max-width: 700px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__grid > :first-child { grid-column: 1 / -1; }
}

/* --- States --------------------------------------------------------------- */

.state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}

.state p { margin-inline: auto; }
.state--error { border-color: var(--accent-line); color: var(--ink-2); }

/* --- Reveal on scroll ----------------------------------------------------- */

/* Scoped to .js, set synchronously in the document head, so the page is fully
   readable when scripting is off instead of stuck at zero opacity. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 620ms var(--ease), transform 620ms var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms);
  }
  .js [data-reveal].is-visible { opacity: 1; transform: none; }

  .js .hero [data-reveal] { transition-duration: 760ms; }
}

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

/* --- Print ---------------------------------------------------------------- */

@media print {
  .nav, .footer, .filters, .popover { display: none; }
  body { background: #fff; color: #000; }
}
