/* site.css — THE LAB REGISTER. MIT-Media-Lab starkness on the FIT color system:
   black on white, heavy rules, expanded-grotesque display (Archivo wdth-variable),
   IBM Plex Mono spec text, FIT electric blue + pop chips from fitnyc.edu.
   Token hexes mirror lib/tokens.mjs verbatim (enforced by test/contrast.test.mjs). */

/* ---------- Faces (self-hosted, latin subsets) ---------- */
@font-face {
  font-family: 'Archivo';
  font-style: normal; font-weight: 100 900; font-stretch: 62% 125%;
  font-display: swap; src: url('fonts/archivo-var.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('fonts/plexmono-roman-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('fonts/plexmono-roman-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600;
  font-display: swap; src: url('fonts/plexmono-roman-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: italic; font-weight: 400;
  font-display: swap; src: url('fonts/plexmono-italic-400.woff2') format('woff2');
}

:root {
  --paper:   #ffffff;
  --paper2:  #f3f1f1;
  --ink:     #000000;
  --soft:    #4d4d4d;
  --blue:    #0036f9;
  --navy:    #001049;
  --gold:    #febf3a;
  --pink:    #fc7687;
  --magenta: #ff2eaa;
  --green:   #12c477;
  --cyan:    #bcdadf;
  --red:     #b70000;
  --line:    #d8d8d8;

  --font-display: Archivo, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-body:    Archivo, 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --s1: .5rem; --s2: 1rem; --s3: 2rem; --s4: 4rem; --s5: 8rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  border-top: 8px solid var(--ink);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 118%;
  line-height: .96; letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0;
}
p { max-width: 68ch; }
a { color: var(--blue); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
img { max-width: 100%; }
small, time, .credits { font-family: var(--font-mono); color: var(--soft); }
::selection { background: var(--blue); color: var(--paper); }

/* Chips — the FIT accent set. Solid grounds, black text (blue chip runs white). */
.chip-0 { background: var(--gold);    color: var(--ink);   }
.chip-1 { background: var(--pink);    color: var(--ink);   }
.chip-2 { background: var(--magenta); color: var(--ink);   }
.chip-3 { background: var(--green);   color: var(--ink);   }
.chip-4 { background: var(--cyan);    color: var(--ink);   }
.chip-5 { background: var(--blue);    color: var(--paper); }

/* ---------- The seal (inline SVG; ring rotates, mark stays) ---------- */
.seal { display: inline-block; width: 122px; height: 122px; }
.seal svg { width: 100%; height: 100%; overflow: visible; }
.seal .seal-ring-g { transform-origin: 50% 50%; animation: seal-turn 32s linear infinite; }
.seal .seal-ring { font-family: var(--font-mono); font-weight: 600; font-size: 10.6px;
  letter-spacing: .22em; fill: var(--blue); }
.seal .seal-frs { font-family: var(--font-display); font-weight: 800; font-size: 33px;
  letter-spacing: .01em; fill: var(--blue); }
@keyframes seal-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .seal .seal-ring-g { animation: none; } }

/* ---------- Home: masthead ---------- */
.masthead {
  position: relative;
  padding: clamp(2.5rem, 7vh, 5rem) var(--gutter) 0;
  max-width: 1440px; margin: 0 auto;
}
.masthead .seal {
  position: absolute; top: clamp(2rem, 6vh, 4rem); right: var(--gutter);
}
.masthead .kicker {
  font-family: var(--font-mono); font-weight: 600; font-size: 12px; line-height: 1;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 clamp(1.5rem, 4vh, 2.75rem);
}
.masthead .kicker::before {
  content: ''; display: inline-block; width: 12px; height: 12px;
  background: var(--blue); margin-right: 12px; vertical-align: -1px;
}
.masthead h1 {
  font-size: clamp(2.6rem, 8.6vw, 8rem);
  max-width: 14ch;
}
.masthead h1 em { font-style: normal; color: var(--blue); }
.masthead-season {
  display: flex; flex-wrap: wrap; gap: .5em 0; align-items: baseline;
  margin: clamp(1.75rem, 5vh, 3rem) 0 0; padding: 14px 0;
  border-top: 4px solid var(--ink); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-weight: 500; font-size: 12.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.masthead-season span { white-space: nowrap; }
.masthead-season span + span::before { content: '/'; color: var(--blue); margin: 0 1.1em; }
.masthead .masthead-sub {
  max-width: 52ch; margin: clamp(1.5rem, 4vh, 2.25rem) 0 0;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.4; color: var(--ink);
}
.masthead .masthead-credit {
  max-width: 64ch; margin: 14px 0 0;
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; color: var(--soft);
}

/* Masthead entrance — pure CSS stagger, disabled under reduced motion */
.masthead > * { animation: rise .8s cubic-bezier(.2,.65,.25,1) both; }
.masthead > :nth-child(2) { animation-delay: .07s; }
.masthead > :nth-child(3) { animation-delay: .14s; }
.masthead > :nth-child(4) { animation-delay: .21s; }
.masthead > :nth-child(5) { animation-delay: .28s; }
.masthead > :nth-child(6) { animation-delay: .35s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .masthead > * { animation: none; } }

/* ---------- Home: the season index ---------- */
.index {
  position: relative;
  max-width: 1440px; margin: clamp(2.5rem, 7vh, 4.5rem) auto 0;
  padding: 0 var(--gutter);
}
.index-head {
  font-family: var(--font-mono); font-weight: 600; font-size: 12px;
  letter-spacing: .3em; text-transform: uppercase; color: var(--blue);
  margin: 0 0 10px;
}
.index ol { list-style: none; margin: 0; padding: 0; border-top: 4px solid var(--ink); }
.index li { border-bottom: 1px solid var(--line); }
.index a {
  display: grid; align-items: center;
  grid-template-columns: 3.5ch minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .9fr) 7.5ch;
  gap: 0 clamp(.75rem, 2vw, 2rem);
  padding: 12px 2px;
  text-decoration: none; color: var(--ink);
  transition: background .15s ease, padding-left .15s ease;
}
.index a:hover, .index a:focus-visible { background: var(--paper2); padding-left: 12px; }
.ix-no { font-family: var(--font-mono); font-weight: 600; font-size: .8rem; color: var(--blue); }
.ix-title {
  font-family: var(--font-display); font-weight: 700; font-stretch: 110%;
  font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.15; text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.index a:hover .ix-title { color: var(--blue); }
.ix-credit, .ix-date {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ix-thread {
  justify-self: start;
  font-family: var(--font-mono); font-weight: 500; font-size: .68rem;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.ix-date { text-align: right; }
/* hover preview (created by landing.js on fine pointers only) */
.index-preview {
  position: fixed; z-index: 9; pointer-events: none;
  width: min(300px, 26vw); aspect-ratio: 4 / 3;
  background: var(--paper2); border: 2px solid var(--ink);
  box-shadow: 10px 10px 0 0 var(--blue);
  opacity: 0; transform: scale(.97);
  transition: opacity .15s ease, transform .15s ease;
  overflow: hidden;
}
.index-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.index-preview.on { opacity: 1; transform: scale(1); }

/* ---------- Home: the plates ---------- */
.entries {
  max-width: 1440px; margin: 0 auto; padding: clamp(2.5rem, 8vh, 5rem) var(--gutter) 0;
}
.entry {
  position: relative;
  display: grid; align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(3rem, 8vh, 5.5rem) 0;
  border-top: 1px solid var(--line);
}
.entry:first-child { border-top: 0; padding-top: clamp(1rem, 3vh, 2rem); }
/* plate rhythm: wide-left / offset-right / even — repeats every three */
.entry:nth-child(3n+1) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.entry:nth-child(3n+2) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.entry:nth-child(3n+2) .entry-img { order: 2; }
.entry:nth-child(3n+2) .entry-body { order: 1; padding-left: clamp(0rem, 6vw, 6rem); }
.entry:nth-child(3n) { grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }

.entry-no {
  position: absolute; top: clamp(.5rem, 2vh, 1.25rem); right: 0;
  font-family: var(--font-display); font-weight: 900; font-stretch: 125%;
  font-size: clamp(4rem, 10vw, 9rem); line-height: 1; letter-spacing: -0.03em;
  background: none !important;
  opacity: .92; user-select: none; pointer-events: none;
}
/* numerals take the chip PALETTE as solid type color (decorative) */
.entry-no.chip-0 { color: var(--gold); }
.entry-no.chip-1 { color: var(--pink); }
.entry-no.chip-2 { color: var(--magenta); }
.entry-no.chip-3 { color: var(--green); }
.entry-no.chip-4 { color: var(--cyan); }
.entry-no.chip-5 { color: var(--blue); }

.entry-img { background: var(--paper2); overflow: hidden; }
.entry-img img {
  width: 100%; height: 100%; min-height: 340px; max-height: 64vh;
  object-fit: cover; display: block;
  transition: transform 1s cubic-bezier(.2,.65,.25,1);
}
.entry:hover .entry-img img { transform: scale(1.03); }

.entry-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; line-height: 1.5;
  letter-spacing: .14em; text-transform: uppercase; margin: 0 0 16px; color: var(--soft);
}
.entry-idx { color: var(--blue); font-weight: 600; }
.entry-idx::before { content: 'No.\2009'; }
.entry-tag { padding: 3px 8px; font-weight: 500; letter-spacing: .08em; }
.entry-title {
  font-size: clamp(1.7rem, 3.2vw, 2.9rem);
  margin: 0 0 16px;
  text-wrap: balance; max-width: 18ch;
}
.entry-lead {
  margin: 0 0 16px; font-size: 1.04rem; line-height: 1.6; max-width: 50ch;
}
.entry-achieved {
  margin: 0 0 16px; padding-left: 16px; border-left: 4px solid var(--blue);
  font-size: .95rem; line-height: 1.6; color: var(--soft); max-width: 52ch;
}
.entry-achieved .label {
  display: block; font-family: var(--font-mono); font-weight: 600; font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--blue); margin-bottom: 4px;
}
.entry-credit {
  margin: 0 0 20px; font-family: var(--font-mono);
  font-size: .82rem; letter-spacing: .04em; color: var(--soft);
}
.entry-link {
  font-family: var(--font-mono); font-weight: 600; font-size: 12.5px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue); text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
  padding-bottom: 4px; border-bottom: 2px solid var(--blue);
}
.entry-link span { transition: transform .25s ease; }
.entry-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.entry-link:hover span { transform: translateX(6px); }

/* Scroll-reveal — only once landing.js sets body.js-reveal.
   Without JS, or under reduced motion, entries are simply visible. */
body.js-reveal .entry { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.65,.25,1); }
body.js-reveal .entry.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  body.js-reveal .entry { opacity: 1 !important; transform: none !important; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Colophon (black panel) ---------- */
.colophon {
  margin-top: clamp(3.5rem, 10vh, 6rem);
  background: var(--ink); color: var(--paper);
  padding: clamp(2.5rem, 7vh, 4.5rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
}
.colophon-inner { max-width: 1440px; margin: 0 auto; display: grid;
  grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: end; }
.colophon h2 {
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  max-width: 24ch; color: var(--paper);
}
.colophon h2 em { font-style: normal; color: var(--gold); }
.colophon-lines { margin: 20px 0 0; font-family: var(--font-mono); font-size: .78rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--paper); opacity: .85; }
.colophon-lines span { display: block; margin-top: 4px; }
.colophon .seal .seal-ring, .colophon .seal .seal-frs { fill: var(--paper); }

/* ---------- Responsive: home ---------- */
@media (max-width: 899px) {
  .index a { grid-template-columns: 3.5ch minmax(0, 1fr) 7.5ch; }
  .ix-credit, .ix-thread { display: none; }
}
@media (max-width: 719px) {
  .masthead .seal { position: static; display: block; margin-bottom: var(--s3); width: 92px; height: 92px; }
  .entry, .entry:nth-child(3n+1), .entry:nth-child(3n+2), .entry:nth-child(3n) { grid-template-columns: 1fr; }
  .entry:nth-child(3n+2) .entry-img { order: 0; }
  .entry:nth-child(3n+2) .entry-body { order: 1; padding-left: 0; }
  .entry-img img { min-height: 0; aspect-ratio: 16 / 11; }
  .entry-no { font-size: 3.5rem; top: .4rem; }
  .colophon-inner { grid-template-columns: 1fr; }
}

/* ---------- Case-study pages ---------- */
.case-study { padding-bottom: 0; background: var(--paper); }
.back {
  display: inline-block; margin: var(--s2) var(--gutter);
  font-family: var(--font-mono); font-weight: 600; font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; color: var(--soft);
}
.back:hover { color: var(--blue); }

/* Hero: full-bleed plate, then the title block on paper */
.hero { margin: 0 0 clamp(2rem, 6vh, 4rem); }
.hero img {
  display: block; width: 100vw; max-width: 100%;
  height: min(66vh, 620px); object-fit: cover;
  border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink);
}
.hero-panel { max-width: 1440px; margin: 0 auto; padding: clamp(1.5rem, 4vh, 2.25rem) var(--gutter) 0; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 10px 0; align-items: center;
  font-family: var(--font-mono); font-weight: 500; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--soft); margin: 0 0 18px;
}
.hero-meta span { white-space: nowrap; }
.hero-meta span + span::before { content: '/'; color: var(--blue); margin: 0 1.1em; }
.hero-meta span[class*="chip-"] { padding: 3px 8px; letter-spacing: .08em; margin-left: 1.1em; }
.hero-meta span[class*="chip-"]::before { content: none; }
.hero-meta .look-no { color: var(--blue); font-weight: 600; }
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 4.6rem);
  max-width: 20ch; text-wrap: balance;
}
.hero .hook {
  margin: 20px 0 0;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.42; color: var(--ink); max-width: 52ch;
}
.hero .credits { margin: 16px 0 0; font-size: .8rem; letter-spacing: .03em; max-width: 80ch; }

/* Story beats — label rail + reading column */
.case-study main { padding: 0 var(--gutter); max-width: 1440px; margin: 0 auto; counter-reset: beat; }
.beat {
  display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 62ch);
  gap: var(--s2) clamp(1.5rem, 4vw, 4rem);
  padding: clamp(1.75rem, 4.5vh, 2.75rem) 0; margin: 0;
  border-top: 1px solid var(--line);
}
.beat:first-of-type { border-top: 4px solid var(--ink); }
.beat h2 {
  counter-increment: beat;
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  color: var(--ink);
}
.beat h2::before {
  content: counter(beat, decimal-leading-zero); display: block;
  font-family: var(--font-mono); font-weight: 600; font-size: .72rem;
  letter-spacing: .2em; color: var(--blue); margin-bottom: 6px;
}
.beat p { font-size: 1.06rem; line-height: 1.7; margin: 0; grid-column: 2; }
.beat h2 + p { grid-row: 1; }
.beat figure { margin: var(--s2) 0 0; grid-column: 2; }
.beat figure img {
  display: block; width: 100%; max-width: 640px;
  background: var(--paper2); border: 1px solid var(--line); padding: var(--s2);
}
@media (max-width: 719px) {
  .beat { grid-template-columns: 1fr; }
  .beat p, .beat figure { grid-column: 1; }
  .beat h2 + p { grid-row: auto; }
}

/* Process strip — horizontal scroll plates */
.process-strip { margin: clamp(2rem, 6vh, 3.5rem) auto; max-width: 1440px; padding: 0; }
.process-strip h2 {
  font-family: var(--font-mono); font-weight: 600; font-size: 12px;
  letter-spacing: .3em; text-transform: uppercase; color: var(--blue);
  margin: 0 var(--gutter) 12px;
}
.strip { display: flex; overflow-x: auto; gap: 10px; padding: 14px var(--gutter);
  border-top: 4px solid var(--ink); border-bottom: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--blue) var(--paper); }
.strip a { flex: 0 0 auto; }
.strip img { display: block; height: 230px; width: auto; background: var(--paper2); }

/* Videos + interactives */
.videos { display: grid; gap: var(--s2); max-width: 1440px; margin: clamp(2rem, 6vh, 3.5rem) auto; padding: 0 var(--gutter); }
.videos video, .videos iframe.video-wall {
  width: 100%; aspect-ratio: 16 / 9; border: 2px solid var(--ink);
  display: block; background: var(--ink);
}
iframe.interactive {
  width: 100%; min-height: 520px; border: 2px solid var(--ink);
  background: var(--paper2); margin: var(--s3) auto; display: block; max-width: 1440px;
}

/* Live-link buttons — FIT blue blocks */
.live-links { max-width: 1440px; margin: var(--s3) auto; padding: 0 var(--gutter); }
.live-link {
  display: inline-block; padding: 12px 22px; margin: 0 var(--s1) var(--s1) 0;
  font-family: var(--font-mono); font-weight: 600; font-size: 12.5px;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--paper); background: var(--blue);
  border: 2px solid var(--blue); text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.live-link:hover { color: var(--paper); background: var(--navy); border-color: var(--navy); }

/* Threads footer — black panel, mirrors the colophon */
.threads-footer {
  margin-top: clamp(2.5rem, 8vh, 4.5rem); padding: clamp(2rem, 6vh, 3.5rem) var(--gutter);
  background: var(--ink); color: var(--paper);
}
.threads-footer h2, .threads-footer h3 { color: var(--paper); }
.threads-footer h2 { font-size: clamp(1.3rem, 2.4vw, 1.8rem); margin: 0 0 var(--s2); }
.threads-footer h3 {
  font-family: var(--font-mono); font-weight: 600; font-size: 12px;
  letter-spacing: .26em; text-transform: uppercase; margin: var(--s3) 0 var(--s2);
}
.threads-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.threads-footer a { font-family: var(--font-mono); font-size: .85rem; color: var(--paper); }
.threads-footer a:hover { color: var(--gold); }

/* Portable-export video poster links */
.video-link { position: relative; display: block; max-width: 1440px; margin: var(--s2) auto; }
.video-link img { display: block; width: 100%; }
.video-link span {
  position: absolute; inset: auto 0 0 0; padding: var(--s1) var(--s2);
  background: var(--ink); color: var(--paper); font-family: var(--font-mono); font-size: .85rem;
}
