/* Jack Weigand. Blueprint copy: the same site on cobalt, gold for the accent. Not the deployed site. */

/* Newsreader (roman, variable opsz 6..72 and wght 200..700) and IBM Plex Mono, the latin subsets Google Fonts serves,
   hosted here. Newsreader blocks rather than swaps: the hero name must never render in a fallback face, and
   its smoke twin in the tunnel was rasterized from exactly this font. */
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 200 700; font-display: block;
  src: url("fonts/newsreader-latin.woff2") format("woff2");
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/plexmono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/plexmono-500-latin.woff2") format("woff2");
}

:root {
  --ink: #0f1c39;
  --ink-2: #132245;
  --ink-rgb: 15, 28, 57;      /* --ink as rgb, for shades that must fade into the page without a seam */
  --deep: 5, 11, 26;          /* shadows on the blue (rgb) */
  --fg: #f4f1ea;
  --fg-dim: rgba(244, 241, 234, 0.74);
  --fg-faint: rgba(244, 241, 234, 0.4);
  --paper: #d6d0c4;
  --paper-ink: #1b1814;
  --paper-dim: rgba(27, 24, 20, 0.62);
  --red: #c8472d;             /* the search plate's settled wing, baked into the art */
  --accent: #e3b04b;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4.2vw, 64px);
  /* Full-screen stages fill the large viewport, the whole screen behind iOS Safari's floating toolbar, so no strip
     of bare page shows under it. Content pinned to a stage's bottom lifts by the toolbar's height (--ui-inset,
     0 on desktop) so it stays clear of it. */
  --screen: 100vh;
  --ui-inset: 0px;
  --col: min(1360px, calc(100vw - 2 * var(--gutter)));
}

@supports (height: 100lvh) {
  :root { --screen: 100lvh; --ui-inset: calc(100lvh - 100svh); }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overscroll-behavior-x: none; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

img, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
figure { margin: 0; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }
ol, ul { list-style: none; margin: 0; padding: 0; }

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

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--fg); color: var(--ink); padding: 8px 12px;
  font: 500 12px/1 var(--mono);
}
.skip:focus { top: 12px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- nav ---------- */
/* Centred, in the serif, in the page's cream, dimmed a little; gold appears only as the underline drawn on hover.
   (Gold text was tried: flat, it read as mustard and cheap.) Over the light bands (the studio render, the search
   plate, the About paper) an ink copy (.nav-ink, made in main.js) is revealed, clipped to exactly the part of the
   line a band covers. */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: center; gap: clamp(18px, 2.4vw, 36px);
  padding: 20px var(--gutter);
  font: 400 16px/1.2 var(--serif);
  color: rgba(244, 241, 234, .8);
  pointer-events: none;
}
.nav.nav-ink { z-index: 51; color: var(--ink); clip-path: inset(0 0 100% 0); }
.nav a { position: relative; padding: 4px 0; pointer-events: auto; transition: color .3s; }
.nav:not(.nav-ink) a:hover { color: var(--fg); }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .5s cubic-bezier(.2,.7,.1,1);
}
.nav:not(.nav-ink) a::after { background: var(--accent); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav .short { display: none; }
@media (max-width: 560px) {
  .nav { gap: 16px; padding-top: 14px; }
  .nav .long { display: none; }
  .nav .short { display: inline; }
}
@media (max-width: 350px) {
  .nav { gap: 12px; font-size: 15px; }
}

/* ---------- shared type ---------- */
/* both giant words share one size: "Aerodynamics" (5.59em wide in Newsreader 300)
   spans the page between the gutters exactly, and "Robotics" sits on the same scale */
.mega {
  --w: 5.59;
  font-weight: 300;
  font-size: calc((100vw - 2 * var(--gutter)) / var(--w));
  line-height: 1;
  letter-spacing: -0.055em;
  font-variation-settings: "opsz" 72;
  white-space: nowrap;
  overflow-x: clip;          /* the slide-in never widens the page; tops and tails stay visible */
  padding: 0.04em 0 0.1em;
}
.mega-inner { display: inline-block; will-change: transform; padding-left: var(--gutter); }

.statement {
  width: var(--col);
  margin: 0 auto;
  max-width: 30ch;
  margin-left: max(var(--gutter), calc((100vw - 1360px) / 2 + 20%));
  font-size: clamp(26px, 3.1vw, 46px);
  line-height: 1.16;
  letter-spacing: -0.018em;
  font-weight: 350;
  font-variation-settings: "opsz" 48;
}

.sub {
  font-size: clamp(30px, 3.6vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 350;
  font-variation-settings: "opsz" 60;
}

.body {
  font-size: clamp(17px, 1.22vw, 20px);
  line-height: 1.55;
  color: var(--fg-dim);
  max-width: 38ch;
  font-variation-settings: "opsz" 14;
}
.body + .body { margin-top: 1em; }

.clip { overflow: hidden; width: 100%; height: 100%; }
.clip img, .clip video { width: 100%; height: 100%; object-fit: cover; }
.finished-video .clip, .am .clip, .so .clip { height: auto; }

/* captions under the photos and videos: the body serif, small, sentence case */
.cap {
  display: block; margin-top: 12px;
  font-size: clamp(14px, 1.02vw, 16px); line-height: 1.4;
  font-variation-settings: "opsz" 14;
  color: var(--fg-dim);
  text-wrap: pretty;
}

/* ---------- hero: the tunnel ---------- */
.hero { position: relative; height: 457.2vh; }   /* 100vh + the hero timeline's 357.2 (main.js) */
.hero-stage {
  position: sticky; top: 0; height: var(--screen);
  overflow: hidden; background: var(--ink);
}
.tunnel { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-veil {
  position: absolute; inset: 0; background: var(--ink); opacity: 0; pointer-events: none;
}
/* flex column: the lines' negative margins add instead of collapsing, so they sit 0.8em apart,
   the pitch the smoke name in the tunnel frames was printed at */
.hero-name {
  display: flex; flex-direction: column; align-items: flex-start;
  position: absolute; left: var(--gutter); bottom: clamp(18px, 4vh, 48px);
  font-weight: 300;
  font-size: clamp(76px, 15.5vw, 300px);
  line-height: 0.8;
  letter-spacing: -0.058em;
  font-variation-settings: "opsz" 72;
  color: var(--fg);
  pointer-events: none;
}
/* the mask is padded well past the glyphs so no ascender or descender is ever shaved */
.hn-line { display: block; overflow: hidden; padding: 0.2em 0.06em 0.16em 0; margin: -0.2em 0 -0.16em; }
.hn-word { display: inline-block; will-change: transform; }
.hn-line + .hn-line { margin-left: 0.62em; }

/* the lead takes the place the name leaves */
.hero-lead {
  position: absolute; left: var(--gutter); bottom: calc(clamp(28px, 8vh, 96px) + var(--ui-inset));
  width: min(27ch, 84vw);
  font-size: clamp(22px, 2.05vw, 36px);
  line-height: 1.24;
  letter-spacing: -0.012em;
  font-weight: 350;
  color: var(--fg);
  opacity: 0;
  font-variation-settings: "opsz" 36;
  text-wrap: pretty;
}
@media (max-aspect-ratio: 1/1) {
  .hero-name { font-size: clamp(64px, 21vw, 200px); bottom: auto; top: 12vh; }
  .hero-lead { left: var(--gutter); right: var(--gutter); bottom: calc(clamp(28px, 6vh, 64px) + var(--ui-inset)); width: auto; max-width: 30ch; font-size: clamp(21px, 5.6vw, 28px); }
}

/* ---------- aerodynamics ---------- */
.aero { position: relative; padding: 18vh 0 26vh; background: var(--ink); }
.aero .mega { margin-bottom: 12vh; }

/* On the car: a studio band that matches the render's own backdrop */
.studio {
  position: relative; overflow: hidden;
  background: linear-gradient(100deg, #fdfdfd 0%, #f1f2f5 45%, #e2e4ec 100%);
  color: #16171a;
}
.oncar {
  display: grid; grid-template-columns: 1.7fr 1fr; gap: clamp(20px, 4vw, 72px);
  align-items: center; min-height: 100vh;
  padding: 10vh max(var(--gutter), calc((100vw - 1360px) / 2)) 10vh 0;
}
.oncar-fig img {
  width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(to right, #000 62%, transparent 97%), linear-gradient(to bottom, transparent 0%, #000 8%, #000 72%, transparent 98%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, #000 62%, transparent 97%), linear-gradient(to bottom, transparent 0%, #000 8%, #000 72%, transparent 98%);
          mask-composite: intersect;
}
.studio .body { color: rgba(22, 23, 26, 0.66); margin-top: 1.1em; }
.oncar-fig .cap { color: rgba(22, 23, 26, 0.6); padding-left: var(--gutter); margin-top: 0; }
@media (max-width: 860px) {
  .oncar { grid-template-columns: 1fr; padding: 12vh var(--gutter); min-height: 0; }
  .oncar-fig .cap { padding-left: 0; }
}

/* ---------- search plate ---------- */
.search { position: relative; padding: 16vh 0 14vh; background: var(--ink); }
.plate {
  position: relative;
  width: min(calc(100vw - 2 * var(--gutter)), 1560px, calc(78vh * 2400 / 1180));
  margin: 0 auto;
  box-shadow: 0 50px 110px -30px rgba(var(--deep), .85);
}
.plate img { width: 100%; height: auto; }
.plate-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.plate.is-live .plate-canvas { opacity: 1; }
@media (max-aspect-ratio: 1/1) {
  .plate { width: min(calc(100vw - 2 * var(--gutter)), calc(80vh * 1200 / 1980)); }
}
.search-text {
  width: var(--col); margin: 12vh auto 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 96px);
  align-items: start;
}
.search-text .sub { max-width: 14ch; }
@media (max-width: 860px) { .search-text { grid-template-columns: 1fr; } }

/* ---------- build: carbon + process ---------- */
/* the carbon holds the screen behind the section; its softbox sweeps the weave while you scroll through it */
.build { position: relative; background: var(--ink); }
.build-bg {
  position: sticky; top: 0; overflow: hidden;
  height: var(--screen);
  margin-bottom: calc(-1 * var(--screen));
}
.carbon { position: absolute; inset: 0; width: 100%; height: 100%; }
.build-shade {
  position: absolute; inset: 0; pointer-events: none;
  /* only the heading needs help reading over the lit weave; the rest of the carbon shows */
  background: linear-gradient(180deg, rgba(var(--ink-rgb), .74) 0%, rgba(var(--ink-rgb), .42) 38%, rgba(var(--ink-rgb), 0) 60%);
}
.build-content {
  position: relative; z-index: 1;
  width: var(--col); margin: 0 auto;
  min-height: var(--screen);
  padding: 14vh 0 calc(12vh + var(--ui-inset));
  display: flex; flex-direction: column; justify-content: center;
}
.build-head { max-width: 34ch; }
.build-head .body { margin-top: 1em; }
/* the five process photos, one aligned row */
.deck {
  --gap: clamp(12px, 1.6vw, 28px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap);
  margin-top: 8vh;
}
.card-img {
  aspect-ratio: 3 / 4; overflow: hidden; background: var(--ink-2);
  box-shadow: 0 30px 60px -18px rgba(var(--deep), .75), 0 2px 6px rgba(var(--deep), .4);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card .cap { margin-top: 14px; }
/* on a wide screen the heading and the row hold the screen too, for the whole sweep; the row is sized to fit the height,
   leaving room for the heading and two lines of caption */
@media (min-width: 861px) {
  .build { height: 260vh; }
  .build-content { position: sticky; top: 0; height: var(--screen); min-height: 0; padding: 12vh 0 calc(10vh + var(--ui-inset)); }
  .deck { max-width: calc((70vh - 270px) * 3.75 + 4 * var(--gap)); }
}
/* two columns on a phone, the fifth centred under them at the same width; the page scrolls through them over the carbon */
@media (max-width: 860px) {
  .deck { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; margin-top: 6vh; }
  .card:last-child { grid-column: 1 / -1; justify-self: center; width: calc(50% - var(--gap) / 2); }
}

/* ---------- finished ---------- */
.finished {
  position: relative; background: var(--ink);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 16vh var(--gutter) 20vh;
}
.finished-title { font-size: clamp(30px, 3.6vw, 58px); line-height: 1.02; letter-spacing: -0.03em; font-weight: 350; }
.finished-video { grid-column: 2; width: min(42vh, 70vw); }
.finished-video .clip { aspect-ratio: 9 / 16; }
@media (max-width: 760px) {
  .finished { grid-template-columns: 1fr; gap: 6vh; }
  .finished-video { grid-column: 1; justify-self: center; width: 78vw; }
}

/* ---------- robotics ---------- */
.robotics { position: relative; background: var(--ink); padding-bottom: 12vh; }
/* the gearbox holds the screen while it spins up; the title rides up and off over it */
.gear-plate { position: relative; height: 400vh; }
.gear-stage { position: sticky; top: 0; height: var(--screen); overflow: hidden; background: var(--ink); }
.gear-img { position: absolute; inset: 0; will-change: clip-path; }
.gear-img canvas, .gear-img img { position: absolute; inset: 0; width: 100%; height: 100%; }
.gear-img img { object-fit: contain; opacity: 0; }   /* reduced motion: the whole rosette, on any screen */
.gear-title {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; color: var(--fg); pointer-events: none;
  /* the small viewport, so the word lands above iOS Safari's toolbar, not under it */
  height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 4vh;
}

.project { width: var(--col); margin: 22vh auto 0; }
.so101 { margin-top: 18vh; }

.arm { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(28px, 6vw, 120px); align-items: start; }
.arm-text { position: sticky; top: 22vh; }
.arm-text .body:first-of-type { margin-top: 1.2em; }
.arm-media { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 2vw, 32px); align-items: start; }
/* the PS5 clip is a screen recording of an app panel; show only the camera image inside it
   (x 57..663, y 95..700 of 720x756), not the panel's title, FPS chip or rounded frame */
.am-ps5 { grid-column: 1 / -1; }
.am-ps5 .clip { position: relative; aspect-ratio: 606 / 605; }
.am-ps5 video { position: absolute; left: -9.406%; top: -15.702%; width: 118.81%; height: 124.96%; max-width: none; object-fit: fill; }
.am-pre .clip, .am-gear .clip, .am-kb .clip { aspect-ratio: 9 / 16; }
.am-pre { grid-column: 1; grid-row: 2; }
.am-gear { grid-column: 2; grid-row: 2 / span 2; margin-top: 22%; }
.am-kb { grid-column: 1; grid-row: 3; }
.am-pre video { object-position: 50% 0; }
@media (max-width: 860px) {
  .arm { grid-template-columns: 1fr; }
  .arm-text { position: relative; top: auto; }
}

/* the arm replay bleeds to the page edges and holds the screen while the scroll plays the demonstration through */
.strobe-pin { position: relative; width: 100vw; height: 300vh; margin: 8vh 0 0 calc(50% - 50vw); }
.strobe-stage { position: sticky; top: 0; height: var(--screen); display: flex; align-items: center; overflow: hidden; }
/* the film fades into the ink top and bottom */
.armfilm {
  position: relative; width: 100%; height: 62.5vw; max-height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 88%, transparent 100%);
}
.armfilm canvas, .armfilm img { position: absolute; inset: 0; width: 100%; height: 100%; }
.armfilm img { object-fit: cover; opacity: 0; }

.so-head { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(28px, 6vw, 120px); align-items: end; }
.so { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); align-items: start; margin-top: 8vh; }
.so-main { grid-column: 1 / span 9; grid-row: 1; }
.so-main .clip { aspect-ratio: 16 / 9; }
.so-main .cap { max-width: 80%; }
.so-side { grid-column: 9 / span 4; grid-row: 1; margin-top: 30%; z-index: 2; }
.so-side .clip { aspect-ratio: 9 / 16; box-shadow: 0 40px 80px -20px rgba(var(--deep), .7); }
@media (max-width: 860px) {
  .so-head { grid-template-columns: 1fr; gap: 1.2em; }
  .so-main { grid-column: 1 / -1; }
  /* on a phone the teleop clip no longer tucks under the main one, which would cover its caption */
  .so-main .cap { max-width: none; }
  .so-side { grid-column: 6 / -1; grid-row: 2; margin-top: 28px; }
}

/* ---------- about (paper) ---------- */
.about {
  position: relative; background: var(--paper); color: var(--paper-ink);
  display: grid; grid-template-columns: minmax(200px, 0.8fr) 2fr;
  gap: clamp(28px, 6vw, 120px); align-items: end;
  padding: 24vh max(var(--gutter), calc((100vw - 1360px) / 2)) 24vh;
}
.about::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
/* the paper photograph is fetched when the section is about two screens away (main.js), not with the page */
.about.is-near::before { background: url("art/paper.webp") center / cover; }
.about > * { position: relative; }
.about-photo { aspect-ratio: 1; max-width: 380px; }
.about-photo img { filter: saturate(.9) contrast(1.02); }
.about-lead {
  font-size: clamp(26px, 3vw, 46px); line-height: 1.16; letter-spacing: -0.018em;
  font-weight: 350; max-width: 26ch; font-variation-settings: "opsz" 48;
}
.about .body { color: var(--paper-dim); margin-top: 1.6em; }
/* words that must not be split across lines (SplitText turns &nbsp; into a plain space) */
.nb { white-space: nowrap; }
@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 62vw; }
}

/* ---------- contact ---------- */
.contact {
  position: relative; min-height: var(--screen); overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 20vh var(--gutter) calc(clamp(28px, 6vh, 72px) + var(--ui-inset));
  background: var(--ink);
}
.contact-art { position: absolute; inset: 0; opacity: .9; }
.contact-art img { width: 100%; height: 100%; object-fit: cover; }
.contact-head {
  position: relative; font-weight: 300;
  font-size: clamp(44px, 7.6vw, 150px); line-height: 0.92; letter-spacing: -0.045em;
  max-width: 13ch; font-variation-settings: "opsz" 72;
}
.contact-links { position: relative; margin-top: 10vh; display: flex; flex-wrap: wrap; gap: 12px clamp(24px, 4vw, 64px); }
/* cream like the rest of the type, with a full gold hairline underline (the site's link mark) */
.contact-links a {
  font: 400 clamp(17px, 1.35vw, 20px)/1.3 var(--serif);
  color: var(--fg); padding: 6px 0;
  text-decoration-line: underline; text-decoration-color: rgba(227, 176, 75, .6);
  text-decoration-thickness: 1px; text-underline-offset: .3em;
  transition: text-decoration-color .3s;
}
.contact-links a:hover { text-decoration-color: var(--accent); }

/* ---------- motion helpers ---------- */
/* SplitText wraps every line in a clipping mask the height of the line box; tight
   leading would shave ascenders and descenders, so the masks get generous padding */
.split-line-mask { padding: 0.18em 0 0.2em; margin: -0.18em 0 -0.2em; }

@media (prefers-reduced-motion: reduce) {
  .hero { height: 100vh; }
  .build { height: auto; }
  .build-content { position: relative; height: auto; min-height: 100vh; }
  .plate-canvas, .armfilm canvas, .gear-img canvas { display: none; }
  .armfilm img, .gear-img img { opacity: 1; }
  .gear-plate { height: var(--screen); }
  .strobe-pin { height: auto; }
  .strobe-stage { position: relative; height: auto; }
  /* the tunnel holds its first frame: the name over the lit section, the lead in the dark above it */
  .hero-lead { opacity: 1; bottom: auto; top: 16vh; left: auto; right: var(--gutter); }
}
@media (prefers-reduced-motion: reduce) and (max-aspect-ratio: 1/1) {
  .hero-lead { top: auto; bottom: calc(clamp(28px, 6vh, 64px) + var(--ui-inset)); left: var(--gutter); }
}
