/* Vault — design tokens */
:root {
  --bg-000: #000000;
  --bg-100: #0a0a0a;
  --bg-200: #131313;
  --bg-300: #1c1c1c;
  --bg-400: #242424;
  --line-100: #1f1f1f;
  --line-200: #2e2e2e;
  --line-300: #3d3d3d;
  --ink-100: #f2f2f2;
  --ink-200: #a8a8a8;
  --ink-300: #7a7a7a;
  --ink-400: #4a4a4a;
  --accent-100: #be5784;
  --accent-200: #d77ca1;
  --accent-300: #8c3c60;
  --accent-050: #2a1620;
  --on-accent: #0b0409;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --space-10: 64px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.6);

  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --nav-h: 52px;
  --gap: 12px;
  --cols: 12;
}

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

html { color-scheme: dark; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + var(--space-4)); }

body {
  margin: 0;
  background: var(--bg-000);
  color: var(--ink-100);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Type scale */
.display-xl { font-size: 56px; line-height: 58px; font-weight: 600; letter-spacing: -0.03em; margin: 0; }
.display-lg { font-size: 40px; line-height: 44px; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.h2 { font-size: 21px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.body { font-size: 15px; line-height: 25px; font-weight: 400; margin: 0; }
.caption { font-size: 12px; line-height: 18px; color: var(--ink-200); margin: 0; }
.mono { font-family: var(--mono); font-size: 11px; line-height: 16px; font-weight: 450; letter-spacing: 0.02em; }

.eyebrow {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin: 0;
}
.eyebrow--accent { color: var(--accent-100); }

a { color: var(--accent-100); }
a:hover { color: var(--accent-200); }

:is(a, button):focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-100);
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-8);
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-100);
}
.nav__brand {
  color: var(--ink-100);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.12em;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  flex-shrink: 0;
}
.nav__brand:hover { color: var(--accent-200); border-color: var(--line-300); }
.nav__links { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav__links::-webkit-scrollbar { display: none; }
.nav__link {
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-200);
  text-decoration: none;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: background 120ms ease-out, color 120ms ease-out;
}
.nav__link:hover { color: var(--ink-100); background: var(--bg-300); }
.nav__link[aria-current="true"] { color: var(--ink-100); background: var(--bg-200); }
.nav__cta {
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-100);
  text-decoration: none;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.nav__cta:hover { color: var(--ink-100); border-color: var(--accent-100); }


/* Intro — the front page is just the About: text and the wigglegram,
   filling the first screen. The bento boards start below the fold. */
.intro {
  position: relative;
  min-height: calc(100svh - var(--nav-h));
  max-width: 1500px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-10);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: var(--space-10);
}
.intro__text { display: flex; flex-direction: column; gap: var(--space-4); max-width: 620px; }
.intro .display-xl { font-size: clamp(44px, 6vw, 84px); line-height: 0.98; letter-spacing: -0.035em; }
.intro__lead { margin: var(--space-2) 0 0; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; color: var(--ink-100); max-width: 34ch; }
.intro__body { margin: 0; font-size: 15px; line-height: 1.65; color: var(--ink-200); max-width: 56ch; }
.intro__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: var(--space-3) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-100);
}
.intro__facts dt { font-size: 11px; line-height: 16px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-300); font-weight: 600; }
.intro__facts dd { margin: 2px 0 0; font-size: 14px; line-height: 20px; }
.intro__facts div:nth-child(2) dd { color: var(--accent-100); font-weight: 600; }
.intro__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }

.intro__photo {
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1151 / 1400;
  max-height: calc(100svh - var(--nav-h) - 2 * var(--space-8));
  border: 1px solid var(--line-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-200);
}
.intro__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.intro__scroll {
  position: absolute;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink-300);
  text-decoration: none;
}
.intro__scroll:hover { color: var(--ink-100); }
.intro__scroll .icon { stroke: currentColor; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: translateY(4px); } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink-100);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  background: var(--bg-200);
  transition: background 120ms ease-out, border-color 120ms ease-out;
}
.btn:hover { color: var(--ink-100); background: var(--bg-300); border-color: var(--line-300); }
.btn--accent { background: var(--accent-100); border-color: var(--accent-100); color: var(--on-accent); }
.btn--accent:hover { background: var(--accent-200); border-color: var(--accent-200); color: var(--on-accent); }
.btn--accent .icon { stroke: var(--on-accent); }
.nav__cta { display: inline-flex; align-items: center; gap: 6px; }


/* Route — a map of the whole page in the header. Every stop is labeled and
   joined by a line; passed stops fill with the accent, the current one is
   bright. It reads as stops on one scroll, not separate pages. */
.nav { justify-content: space-between; }
.route { flex: 1; min-width: 0; display: flex; justify-content: center; }
.route__stops {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0 var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.route__stops::-webkit-scrollbar { display: none; }
/* when the line doesn't fit, it scrolls sideways — fade the edges to show it */
.route__stops.is-overflowing {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 28px), transparent);
}
@media (max-width: 1100px) {
  .route__stops li + li::before { width: 14px; margin: 0 5px; }
}
.route__stops li { display: flex; align-items: center; flex-shrink: 0; }
/* connector from the previous stop */
.route__stops li + li::before {
  content: "";
  width: 22px;
  height: 2px;
  margin: 0 8px;
  border-radius: 2px;
  background: var(--line-200);
  transition: background 200ms ease-out;
}
.route__stops li.is-passed + li.is-passed::before { background: var(--accent-100); }
.route__stop {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 4px;
  border-radius: var(--radius-md);
  color: var(--ink-300);
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease-out;
}
.route__stop:hover { color: var(--ink-100); }
.route__dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 2px solid var(--line-300);
  background: var(--bg-000);
  transition: border-color 160ms ease-out, background 160ms ease-out, box-shadow 160ms ease-out;
}
.is-passed .route__dot { border-color: var(--accent-100); background: var(--accent-100); }
.route__stop[aria-current] { color: var(--ink-100); }
.route__stop[aria-current] .route__dot { background: var(--bg-000); box-shadow: 0 0 0 3px var(--accent-050); }
.route__label { display: flex; align-items: baseline; gap: 5px; font-size: 13px; line-height: 20px; }
.route__num { font-size: 10px; color: var(--ink-400); }
.route__stop[aria-current] .route__num { color: var(--accent-100); }

.board__num { color: var(--ink-300); margin-right: var(--space-1); }

/* Page and boards */
.page {
  padding: var(--space-5) var(--space-8) var(--space-8);
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.board { container-type: inline-size; scroll-margin-top: calc(var(--nav-h) + var(--space-3)); }
.board__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 0 var(--space-1) var(--space-3);
}

/* The bento: square cells, 12 across; tiles span --w × --h cells. */
.bento {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols));
  grid-auto-flow: dense;
  gap: var(--gap);
}

.tile {
  grid-column: span var(--w);
  grid-row: span var(--h);
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-xl);
  background: var(--bg-200);
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  margin: 0;
  transition: border-color 120ms ease-out, transform 160ms ease-out;
}
button.tile { cursor: pointer; }
button.tile:hover { border-color: var(--line-300); transform: translateY(-1px); }
button.tile:active { transform: none; }

/* Image tiles — the image fills the tile; tile spans are chosen to match its
   aspect ratio, and CAD renders use contain on white so nothing is clipped. */
.tile--img img, .tile__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile__label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 36px var(--space-4) var(--space-3);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.media__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 44px;
  height: 44px;
  padding: 11px 9px 11px 13px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.25);
  fill: #fff;
  pointer-events: none;
}

/* Text-ish tiles */
.tile--stat, .tile--text, .tile--chips, .tile--contact, .tile--name {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(8px, 1.3cqw, 16px);
  gap: 2px;
}
.tile__figure {
  font-size: clamp(22px, 2.4cqw, 40px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.tile--accent .tile__figure { color: var(--accent-100); }
.tile__caption { font-size: clamp(11px, 0.95cqw, 12px); line-height: 1.3; color: var(--ink-200); }
.tile--text > span {
  font-size: clamp(13px, 1.25cqw, 17px);
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink-200);
}
.tile--chips { gap: var(--space-3); }
.tile--chips .chips { gap: 6px; }

.tile--name {
  background: var(--bg-100);
  padding: var(--space-6);
  gap: var(--space-3);
}
.tile--name .display-xl { font-size: clamp(30px, 4.2cqw, 60px); line-height: 1.02; }
.tile__line { color: var(--ink-200); max-width: 44ch; font-size: clamp(13px, 1.1cqw, 15px); line-height: 1.55; }

.tile--contact { background: var(--bg-100); }
.tile--contact a {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-100);
  text-decoration: none;
  border-bottom: 1px solid var(--line-100);
  padding: 4px 0 6px;
  word-break: break-word;
}
.tile--contact a:hover { color: var(--accent-200); }
.tile--contact .caption { padding-top: 6px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; font-family: var(--mono); }
.chip {
  font-size: 11px;
  line-height: 16px;
  font-weight: 450;
  letter-spacing: 0.02em;
  color: var(--ink-200);
  background: var(--bg-200);
  border: 1px solid var(--line-200);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}
.tile--chips .chip { background: var(--bg-300); }
.chips--footer { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--line-100); }

.footer {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--space-8) var(--space-8);
  color: var(--ink-300);
}

/* Modal media */
.media {
  position: relative;
  border: 1px solid var(--line-100);
  border-radius: var(--radius-lg);
  background: var(--bg-000);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  overflow: hidden;
}
.media--lg { min-height: 240px; max-height: 62vh; aspect-ratio: 16 / 10; margin-top: var(--space-5); }
.media--lg img, .media--lg video { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--bg-000); }
.media__glyph { width: 36px; height: 36px; fill: none; stroke: var(--ink-400); stroke-width: 1.5; stroke-linecap: square; }
.media__label { font-family: var(--mono); font-size: 11px; line-height: 16px; letter-spacing: 0.02em; color: var(--ink-300); text-align: center; }

/* Modal */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  z-index: 50;
}
.scrim[hidden] { display: none; }

.sheet {
  position: relative;
  width: 86%;
  max-width: 1040px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-100);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  padding: 40px;
  animation: pop 200ms ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sheet { animation: none; }
  .tile, .nav__link, .route__dot, .route__stop, .route__stops li::before { transition: none; }
  .intro__scroll .icon { animation: none; }
}

.sheet__close {
  position: sticky;
  top: 0;
  float: right;
  margin: -8px -8px 0 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-200);
  background: var(--bg-200);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.sheet__close:hover { background: var(--bg-300); border-color: var(--line-300); }
.icon { width: 16px; height: 16px; fill: none; stroke: var(--ink-100); stroke-width: 1.5; stroke-linecap: square; }

.sheet__head { padding-right: var(--space-8); }
.sheet__head .display-lg { margin-top: var(--space-3); }
.sheet__meta { margin: var(--space-2) 0 0; color: var(--ink-300); }
.sheet__lead { margin-top: var(--space-5); max-width: 72ch; }
.sheet__cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); margin-top: var(--space-6); }
.sheet__label { padding-bottom: var(--space-2); border-bottom: 1px solid var(--line-100); }

/* Gallery */
.gallery__strip { display: flex; gap: var(--space-2); margin-top: var(--space-3); overflow-x: auto; padding-bottom: var(--space-1); scrollbar-width: thin; }
.gallery__strip[hidden] { display: none; }
.thumb {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  background: var(--bg-000);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 120ms ease-out, border-color 120ms ease-out;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .media__play { width: 24px; height: 24px; padding: 6px 4px 6px 7px; }
.thumb:hover { opacity: 1; border-color: var(--line-300); }
.thumb[aria-current="true"] { opacity: 1; border-color: var(--accent-100); }
.gallery__count { margin: var(--space-2) 0 0; color: var(--ink-400); }

.bullets { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.bullets li { display: flex; gap: var(--space-3); align-items: flex-start; font-size: 15px; line-height: 25px; color: var(--ink-200); }
.bullets li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: var(--radius-full);
  background: var(--accent-100);
  margin-top: 10px;
  flex-shrink: 0;
}

/* Stage chips — every photo is labeled with where it sits in the
   engineering process: Analysis · CAD · Prototype · Built · In competition. */
.stage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 14px;
  font-weight: 450;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  pointer-events: none;
}
.stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--stage-c, #fff); }
.stage--analysis  { --stage-c: #9aa7ff; }
.stage--cad       { --stage-c: #6cc4ff; }
.stage--prototype { --stage-c: #f2b45a; }
.stage--built     { --stage-c: #7fd38a; }
.stage--field     { --stage-c: var(--accent-200); }
.stage--corner { position: absolute; top: 10px; left: 10px; z-index: 2; }

/* Process tile — a mechanism's progression, left to right. Each step's width
   follows its image's aspect ratio, so steps sit at equal height uncropped. */
.tile--process { background: var(--bg-100); }
.process {
  position: absolute;
  inset: 8px 8px 8px 8px;
  display: flex;
  gap: 18px;
}
.process__step {
  position: relative;
  flex-basis: 0;
  min-width: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-000);
}
.process__step.is-white { background: #fff; }
.process__step img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.process__step.is-white img { object-fit: contain; }
.process__step .stage { position: absolute; top: 6px; left: 6px; }
.process__step.is-pending {
  background: repeating-linear-gradient(135deg, var(--bg-200) 0 8px, var(--bg-100) 8px 16px);
  border: 1px dashed var(--line-300);
}
.process__pending {
  position: absolute;
  inset: auto 8px 44px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-200);
}
.process__pending .mono { font-size: 10px; color: var(--ink-300); text-transform: uppercase; letter-spacing: 0.06em; }
.process__arrow {
  position: relative;
  flex: 0 0 0;
  align-self: center;
  z-index: 2;
}
.process__arrow svg {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 50%;
  background: var(--bg-000);
  border: 1px solid var(--line-300);
  fill: none;
  stroke: var(--accent-100);
  stroke-width: 2;
}
.tile--process .tile__label { border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
button.tile--process:hover .process__arrow svg { border-color: var(--accent-100); }

/* Labeled groups inside one board (e.g. two labs under Research) */
.subgroup + .subgroup { margin-top: var(--space-6); }
.subgroup__head { display: flex; align-items: baseline; gap: var(--space-3); padding: 0 var(--space-1) var(--space-3); border-top: 1px solid var(--line-100); padding-top: var(--space-4); }
.subgroup:first-child .subgroup__head { border-top: 0; padding-top: 0; }
.subgroup__title { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }

/* Link tile — opens an external page */
.tile--link { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-3); text-decoration: none; background: var(--accent-050); border-color: var(--accent-300); }
.tile--link > span { color: var(--accent-200); }
.tile--link .icon { stroke: var(--accent-200); width: 18px; height: 18px; }
a.tile--link:hover { border-color: var(--accent-100); transform: translateY(-1px); }
.sheet__link { margin-top: var(--space-4); }
.sheet__link[hidden] { display: none; }
.sheet__link .icon { width: 14px; height: 14px; }

/* Elevator lineage */
.lineage {
  border: 1px solid var(--line-200);
  border-radius: var(--radius-xl);
  background: var(--bg-100);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.lineage__top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-6); align-items: center; }
.lineage__intro { color: var(--ink-200); max-width: 68ch; }
.lineage__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.lineage__stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-lg);
  background: var(--bg-200);
}
.lineage__stat .tile__figure { font-size: clamp(18px, 1.9cqw, 28px); color: var(--accent-100); }

/* version scrubber */
.lineage__track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  position: relative;
}
.lineage__track li { position: relative; display: flex; }
.lineage__track li + li::before {          /* connector to previous version */
  content: "";
  position: absolute;
  top: 17px;
  right: calc(100% - 17px);
  width: 100%;
  height: 2px;
  background: var(--line-200);
}
.lineage__track li.is-passed + li.is-passed::before { background: var(--accent-100); }
.lineage__node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px 12px 10px 10px;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--ink-300);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.lineage__node:hover { color: var(--ink-100); }
.lineage__node { overflow: hidden; }
.lineage__progress {
  position: absolute;
  left: 10px; right: 10px; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-100);
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
}
.is-cycling .lineage__node[aria-selected="true"] .lineage__progress {
  opacity: 1;
  animation: lineage-progress var(--dwell, 6000ms) linear forwards;
}
@keyframes lineage-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lineage__dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-300);
  background: var(--bg-100);
  margin-bottom: 4px;
  transition: background 160ms ease-out, border-color 160ms ease-out, box-shadow 160ms ease-out;
}
.is-passed .lineage__dot { border-color: var(--accent-100); background: var(--accent-100); }
.lineage__node[aria-selected="true"] { color: var(--ink-100); background: var(--bg-200); }
.lineage__node[aria-selected="true"] .lineage__dot { background: var(--bg-100); box-shadow: 0 0 0 4px var(--accent-050); }
.lineage__v { color: inherit; opacity: 0.8; }
.lineage__name { font-size: 14px; line-height: 19px; font-weight: 600; }

/* selected version */
.lineage__panel { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.lineage__media { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.lineage__stages { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.lineage__stage {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; line-height: 18px; font-weight: 600;
  color: var(--ink-200);
  background: var(--bg-200);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-full);
  padding: 4px 11px;
  cursor: pointer;
}
.lineage__stage .mono { color: var(--ink-400); font-size: 10px; }
.lineage__stage:hover { color: var(--ink-100); border-color: var(--line-300); }
.lineage__stage[aria-pressed="true"] { color: var(--on-accent); background: var(--accent-100); border-color: var(--accent-100); }
.lineage__stage[aria-pressed="true"] .mono { color: var(--on-accent); opacity: 0.7; }
.lineage__stage-arrow svg, .gallery__arrow svg { width: 14px; height: 14px; fill: none; stroke: var(--ink-400); stroke-width: 2; display: block; }
.lineage__frame {
  aspect-ratio: 4 / 3;
  max-height: 64vh;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-000);
}
.lineage__frame.is-white { background: #fff; }
.lineage__frame img, .lineage__frame video { width: 100%; height: 100%; object-fit: contain; display: block; }
.lineage__thumbs { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.lineage__thumbs:empty { display: none; }
.lineage__info { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.lineage__info .eyebrow { margin-top: var(--space-3); }
.lineage__when { margin: 0; color: var(--accent-100); }
.lineage__title { margin: 0; font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.015em; }
.lineage__req { margin: 0; font-size: 15px; line-height: 23px; }
.lineage__drivers { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip--accent { color: var(--accent-200); border-color: var(--accent-300); background: var(--accent-050); }
.lineage__changes { margin-top: 0; }
.lineage__nav { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.lineage__open { flex: 1; justify-content: center; }

/* comparison matrix */
.lineage__matrix-wrap { overflow-x: auto; scrollbar-width: thin; }
.lineage__matrix { width: 100%; border-collapse: collapse; min-width: 640px; }
.lineage__matrix caption { text-align: left; padding-bottom: var(--space-3); }
.lineage__matrix th, .lineage__matrix td { padding: 9px 10px; border-top: 1px solid var(--line-100); font-size: 13px; line-height: 18px; }
.lineage__matrix thead th { border-top: 0; color: var(--ink-300); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; text-align: center; }
.lineage__matrix tbody th { text-align: left; font-weight: 600; color: var(--ink-200); white-space: nowrap; }
.lineage__matrix tbody th .mono { color: var(--ink-400); margin-right: 4px; }
.lineage__matrix td { text-align: center; }
.lineage__matrix tbody tr { cursor: pointer; transition: background 120ms ease-out; }
.lineage__matrix tbody tr:hover { background: var(--bg-200); }
.lineage__matrix tbody tr.is-active { background: var(--bg-200); }
.lineage__matrix tbody tr.is-active th { color: var(--ink-100); }
.lineage__matrix tbody tr.is-active th .mono { color: var(--accent-100); }
.mark, .nomark { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.mark { background: var(--accent-100); box-shadow: 0 0 0 3px var(--accent-050); }
.nomark { width: 4px; height: 4px; background: var(--line-300); }

/* Modal: gallery grouped by stage */
.gallery__strip { align-items: flex-end; gap: var(--space-2); }
.gallery__group { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.gallery__stage { font-family: var(--mono); font-size: 10px; line-height: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-300); }
.gallery__thumbs { display: flex; gap: var(--space-2); }
.gallery__arrow { align-self: flex-end; padding-bottom: 24px; flex-shrink: 0; }
#sheet-media.is-white, #sheet-media.is-white img { background: #fff; }

/* Breakpoints */
@media (max-width: 1100px) {
  .nav { padding: 0 var(--space-5); }
  .page { padding: var(--space-4) var(--space-5) var(--space-6); }
  .footer { padding: 0 var(--space-5) var(--space-6); }
  .intro { padding: var(--space-6) var(--space-5) var(--space-10); gap: var(--space-8); }
  .lineage__top { grid-template-columns: 1fr; }
  .lineage__panel { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-5); }
  .sheet { width: 92%; padding: var(--space-6); }
  .scrim { padding: var(--space-5); }
}

/* Phone: two columns. Wide tiles take the full width, others one column;
   each tile keeps its designed aspect ratio so images are never cropped
   differently from desktop. */
@media (max-width: 680px) {
  :root { --gap: 8px; }
  .nav { padding: 0 var(--space-4); gap: var(--space-3); }
  .nav__cta { display: none; }
  .page { padding: var(--space-4) var(--space-4) var(--space-6); gap: var(--space-5); }
  .footer { padding: 0 var(--space-4) var(--space-6); }
  .intro { grid-template-columns: 1fr; min-height: 0; padding: var(--space-5) var(--space-4) var(--space-8); gap: var(--space-6); }
  .intro__photo { order: -1; justify-self: stretch; max-width: none; max-height: 70svh; }
  .intro__scroll { display: none; }
  /* Phone bento: its own 4-column grid of square cells, with phone spans
     (--mw × --mh) set per tile in script.js. */
  .bento { --cols: 4; }
  .tile { grid-column: span var(--mw); grid-row: span var(--mh); border-radius: 12px; }
  .tile__label { padding: 28px var(--space-3) var(--space-2); font-size: 12px; line-height: 16px; }
  .media__play { width: 36px; height: 36px; padding: 9px 7px 9px 11px; }
  .tile__figure { font-size: 22px; }
  .tile__caption { font-size: 11px; }
  .tile--text > span { font-size: 13px; }
  .tile--stat, .tile--text, .tile--chips, .tile--contact { padding: 10px 12px; }
  .tile--chips .chip { font-size: 10px; padding: 2px 6px; }
  .board__head { flex-wrap: wrap; row-gap: 2px; }
  .process { inset: 5px; gap: 12px; }
  .process__step { border-radius: 8px; }
  .process__arrow svg { width: 20px; height: 20px; padding: 3px; }
  .process__pending { inset: auto 6px 34px 6px; font-size: 11px; line-height: 14px; }
  .stage { font-size: 9px; padding: 1px 5px; }
  .stage--corner { top: 7px; left: 7px; }
  .lineage { padding: var(--space-4); gap: var(--space-5); border-radius: 12px; }
  .lineage__stats { gap: 6px; }
  .lineage__stat { padding: 8px 10px; }
  .lineage__stat .tile__figure { font-size: 17px; }
  .lineage__track {
    display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4);
    scroll-snap-type: x mandatory;
  }
  .lineage__track::-webkit-scrollbar { display: none; }
  .lineage__track li { flex: 0 0 62%; scroll-snap-align: start; }
  .lineage__panel { grid-template-columns: 1fr; }
  .lineage__title { font-size: 20px; line-height: 26px; }
  .lineage__matrix { min-width: 520px; }
  .lineage__matrix th, .lineage__matrix td { padding: 8px 6px; font-size: 12px; }
  .board__head .h2 { flex-basis: 100%; }
  .route { justify-content: flex-start; }
  .route__stops li + li::before { width: 12px; margin: 0 5px; }
  .route__label { font-size: 12px; }
  .display-lg { font-size: 26px; line-height: 32px; }
  .sheet { width: 100%; max-height: 92vh; padding: var(--space-5); }
  .sheet__cols { grid-template-columns: 1fr; gap: var(--space-5); }
  .scrim { padding: var(--space-3); }
  .sheet__head { padding-right: var(--space-6); }
  .media--lg { aspect-ratio: 4 / 3; }
}
