/* ==========================================================================
   Reese Lienau — main stylesheet
   1. Tokens   2. Base   3. Navigation   4. Intro   5. Project boxes
   6. Floating field   7. Page scaffolds   8. Footer   9. Motion prefs
   ========================================================================== */

/* Alte Haas Grotesk, self-hosted. Uses the copy installed on this computer if
   there is one, otherwise the files in assets/fonts/. */
@font-face {
  font-family: "Alte Haas Grotesk";
  src: local("Alte Haas Grotesk"), local("AlteHaasGrotesk"),
    url("../fonts/AlteHaasGroteskRegular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Alte Haas Grotesk";
  src: local("Alte Haas Grotesk Bold"), local("AlteHaasGrotesk-Bold"),
    url("../fonts/AlteHaasGroteskBold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

/* 1. Tokens -------------------------------------------------------------- */
:root {
  /* Color: deep black, warm off-white, a short grayscale ramp */
  --c-bg: #050505;
  --c-bg-raised: #0c0c0c;
  --c-ink: #f2f0eb;
  --c-ink-2: #a8a6a1;
  --c-ink-3: #6b6a67;
  --c-line: #262626;
  --c-line-strong: #4a4a4a;
  --c-focus: #f2f0eb;
  --c-dim: #343331;
  /* The same colors as bare R, G, B, for see-through panels and fades */
  --c-bg-rgb: 5, 5, 5;
  --c-raised-rgb: 12, 12, 12;
  --c-raised-alt-rgb: 30, 30, 30;
  --c-model-glow: #1a1a1a;

  /* Statement accents: one color per hoverable phrase */
  --c-accent-name: #f2994a;
  --c-accent-art: #e879d4;
  --c-accent-engineering: #6ea8fe;
  --c-accent-strategy: #5fcf80;

  /* Gallery categories: one color per filter on the experiments page */
  --c-cat-puzzles: var(--c-accent-engineering);
  --c-cat-sculpture: var(--c-accent-strategy);
  --c-cat-games: var(--c-accent-name);
  --c-cat-illustration: var(--c-accent-art);
  --c-cat-film: #f2d45c;
  --c-cat-twistable: #ff3da5;
  color-scheme: dark;

  /* Type */
  --f-h1: "Caudex", Georgia, serif;
  --f-sans: "Alte Haas Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif; /* regular weight */
  --f-grotesk: "Alte Haas Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --t-hero: clamp(3.5rem, 11vw, 10.5rem);
  --t-h1: clamp(2.75rem, 7vw, 6rem);
  --t-statement: clamp(2.125rem, 4.4vw, 4.5rem);
  --t-lede: clamp(1.125rem, 1.6vw, 1.375rem);
  --t-card: clamp(1.75rem, 2.6vw, 2.5rem);
  --t-label: 0.75rem;

  /* Space & layout */
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --max: 1440px;
  --radius: 2px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --dur: 500ms;
}

/* Light theme: warm paper and near-black ink. theme.js sets data-theme on
   <html> from the visitor's system setting or their pick in the header.
   Accents are a shade deeper so they stay readable on white. */
:root[data-theme="light"] {
  --c-bg: #f6f4ef;
  --c-bg-raised: #ecebe5;
  --c-ink: #141414;
  --c-ink-2: #55534f;
  --c-ink-3: #85837e;
  --c-line: #dcd9d2;
  --c-line-strong: #b3b0a9;
  --c-focus: #141414;
  --c-dim: #cfccc5;
  --c-bg-rgb: 246, 244, 239;
  --c-raised-rgb: 236, 235, 229;
  --c-raised-alt-rgb: 218, 216, 207;
  --c-model-glow: #ffffff;
  --c-accent-name: #c9620f;
  --c-accent-art: #b13a9e;
  --c-accent-engineering: #2563d0;
  --c-accent-strategy: #1f8a45;
  --c-cat-film: #9a7d00;
  --c-cat-twistable: #c8006e;
  color-scheme: light;
}
/* The logo is drawn in white; flip it to black on the light theme. */
:root[data-theme="light"] .wordmark__mark { filter: invert(1); }

/* 2. Base ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--c-bg);
  color: var(--c-ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

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

:focus-visible {
  outline: 1px solid var(--c-focus);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--c-ink);
  color: var(--c-bg);
  font: 500 0.875rem/1 var(--f-sans);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

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

.label {
  font-family: var(--f-grotesk);
  font-weight: 700;
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-3);
}

main { flex: 1; position: relative; z-index: 2; }

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

/* 3. Navigation ---------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: clamp(1.25rem, 2.5vw, 2rem);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  line-height: 1;
}
/* The logo. To swap it, replace assets/images/logo-mark.png (white artwork on transparent). */
.wordmark__mark {
  width: 2.5rem;
  height: 2.5rem;
  transition: transform var(--dur) var(--ease);
}
.wordmark:hover .wordmark__mark { transform: rotate(-8deg); }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--c-line-strong);
  border-radius: 999px;
  font: 500 0.875rem/1 var(--f-sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.nav-link:hover,
.nav-link[aria-current="page"] {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-bg);
}
/* Sun/moon button added to the header by theme.js; shows what you'd switch to. */
.site-header nav { display: flex; align-items: center; gap: 0.5rem; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border: 1px solid var(--c-line-strong);
  border-radius: 50%;
  background: none;
  color: var(--c-ink);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.theme-toggle:hover { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }
.theme-toggle svg { width: 1rem; height: 1rem; }
.theme-toggle__moon { display: none; }
:root[data-theme="light"] .theme-toggle__sun { display: none; }
:root[data-theme="light"] .theme-toggle__moon { display: block; }

.nav-link__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 4. Intro --------------------------------------------------------------- */
.intro {
  position: relative;
  padding-block: clamp(3rem, 12vh, 9rem) clamp(3rem, 9vh, 6rem);
}
/* A soft pool of black behind the text keeps it readable over the floaters. */
.intro::before {
  content: "";
  position: absolute;
  inset: -10% 0;
  z-index: -1;
  background: radial-gradient(ellipse 55% 60% at 30% 50%, rgba(var(--c-bg-rgb), 0.85), transparent 75%);
  pointer-events: none;
}

.intro__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}
.intro__eyebrow::before {
  content: "";
  width: 2.5rem;
  height: 1px;
  background: var(--c-line-strong);
}

/* The big statement. Key phrases sit in color; hovering one turns the rest
   of the sentence dark and shows that phrase's note underneath. */
.statement {
  max-width: 17em;
  margin: 0;
  font-family: var(--f-h1);
  font-weight: 400;
  font-size: var(--t-statement);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  text-wrap: balance;
  transition: color var(--dur) var(--ease);
}
.statement__hot {
  position: relative;
  z-index: 3;
  color: var(--accent);
  font-style: italic;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.statement__hot--name { color: var(--c-ink); font-style: normal; }
.statement__star {
  margin-left: 0.04em;
  color: var(--accent);
  font-family: var(--f-sans);
  font-style: normal;
  font-weight: 300;
  font-size: 0.6em;
  vertical-align: super;
  line-height: 0;
  transition: color var(--dur) var(--ease);
}
[data-key="name"] { --accent: var(--c-accent-name); }
[data-key="art"] { --accent: var(--c-accent-art); }
[data-key="engineering"] { --accent: var(--c-accent-engineering); }
[data-key="strategy"] { --accent: var(--c-accent-strategy); }
[data-note="name"] { --accent: var(--c-accent-name); }
[data-note="art"] { --accent: var(--c-accent-art); }
[data-note="engineering"] { --accent: var(--c-accent-engineering); }
[data-note="strategy"] { --accent: var(--c-accent-strategy); }

.statement.is-hovering,
.statement.is-hovering .statement__hot,
.statement.is-hovering .statement__star { color: var(--c-dim); }
.statement.is-hovering .statement__hot.is-active,
.statement.is-hovering .statement__hot.is-active .statement__star { color: var(--accent); }

/* Notes stack in one slot, so showing one never shifts the layout. */
.statement-notes {
  display: grid;
  justify-content: end;
  max-width: var(--statement-w, none); /* set from JS so notes line up with the sentence's end */
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  min-height: 5.5em;
}
.statement-note {
  grid-area: 1 / 1;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  max-width: 25rem;
  margin: 0;
  color: var(--accent);
  font-family: var(--f-grotesk);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 350ms var(--ease), transform 350ms var(--ease);
}
.statement-note.is-visible { opacity: 1; transform: none; }
.statement-note svg { flex: none; width: 1.4em; height: 1.4em; margin-top: 0.05em; }
/* Touch screens show a note when its phrase is tapped (main.js). */

/* 5. Project boxes ------------------------------------------------------- */
.projects {
  padding-bottom: clamp(4rem, 10vh, 7rem);
}
.projects__head .label,
.site-footer .label {
  font-family: var(--f-grotesk);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}
.projects__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--c-line);
}
.projects__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.4vw, 1.25rem);
}
/* Selected work gets the wider share of the row, Playground a narrower one. */
.projects {
  display: grid;
  grid-template-columns: minmax(0, 2.24fr) minmax(0, 0.76fr);
  column-gap: clamp(0.75rem, 1.4vw, 1.25rem);
}
.projects__group { display: flex; flex-direction: column; }
.projects__group .projects__grid { flex: 1; }
.projects__grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.projects__grid--one { grid-template-columns: minmax(0, 1fr); }
.projects__group--play .projects__head { justify-content: flex-end; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: clamp(24rem, 36vw, 32rem);
  padding: clamp(1.25rem, 2vw, 1.75rem);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: rgba(var(--c-raised-rgb), 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-decoration: none;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.card:hover,
.card:focus-visible {
  border-color: var(--c-ink);
  background: rgba(var(--c-raised-rgb), 0.92);
}
.card:focus-visible { outline-offset: 6px; }
/* Playground's card sits a shade apart from the work cards. */
.projects__group--play .card { background: rgba(var(--c-raised-alt-rgb), 0.72); }
.projects__group--play .card:hover,
.projects__group--play .card:focus-visible { background: rgba(var(--c-raised-alt-rgb), 0.92); }
.card__top .card__arrow { margin-left: auto; }

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card__arrow {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--c-line-strong);
  border-radius: 50%;
  overflow: hidden;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.card__arrow svg {
  width: 14px; height: 14px;
  transition: transform var(--dur) var(--ease);
}
.card:hover .card__arrow,
.card:focus-visible .card__arrow {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-bg);
}
.card:hover .card__arrow svg,
.card:focus-visible .card__arrow svg { transform: rotate(45deg); }

/* Image slot. Drop a cover image into the <img> inside .card__media. */
.card__media {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  margin-block: 1.25rem;
  min-height: 9rem;
}
.card__media img {
  max-height: 14rem;
  width: auto;
  border-radius: var(--radius);
  object-fit: contain;
  transition: transform 900ms var(--ease);
}
.card:hover .card__media img,
.card:hover .card__media .placeholder {
  transform: translateY(-8px) rotate(-3deg) scale(1.04);
}
.card__media .placeholder {
  width: 62%;
  aspect-ratio: 1;
  transition: transform 900ms var(--ease), border-color var(--dur) var(--ease);
}
.card:hover .card__media .placeholder { border-color: var(--c-ink-3); }
/* Playground: a column of thumbnails drifting upward, faded at both ends. */
.card__media.card__media--strip { min-height: 18rem; }
.strip {
  position: absolute;
  inset: 0;
  display: grid;
  justify-items: center;
  overflow: hidden;
}
.strip.is-ready {
  display: block;
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
.strip__track {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: strip-scroll linear infinite;
}
.strip__track img {
  width: 52%;
  max-width: 11rem;
  max-height: none;
  margin-bottom: 0.75rem;
}
.card:hover .card__media .strip__track img { transform: none; }
.strip__cols { display: none; } /* phones only, below */
@keyframes strip-scroll {
  to { transform: translateY(-50%); }
}
/* A look-only spinning model in place of a cover image. */
.model.model--card {
  width: 100%;
  height: 17rem;
  aspect-ratio: auto;
  border: 0;
  background: none;
  pointer-events: none;
  transition: transform 900ms var(--ease);
}
.card:hover .model--card { transform: translateY(-8px) scale(1.04); }
.model--card .model__status { display: none; }

.card__title {
  margin: 0;
  font-family: var(--f-h1);
  font-weight: 400;
  font-size: var(--t-card);
  line-height: 1;
  letter-spacing: -0.02em;
}
.card__sub {
  margin: 0.6rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--c-line);
  font-size: 0.9375rem;
  color: var(--c-ink-2);
  transition: border-color var(--dur) var(--ease);
}
.card:hover .card__sub { border-color: var(--c-line-strong); }

/* Generic placeholder look: dashed frame, crosshair, label. Used by cards and floaters. */
.placeholder {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px dashed var(--c-line-strong);
  border-radius: 50%;
  color: var(--c-ink-3);
  font-family: var(--f-grotesk);
  font-weight: 700;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.4;
}
.placeholder::before,
.placeholder::after {
  content: "";
  position: absolute;
  background: var(--c-line-strong);
  opacity: 0.6;
}
.placeholder::before { left: 50%; top: 18%; bottom: 18%; width: 1px; }
.placeholder::after { top: 50%; left: 18%; right: 18%; height: 1px; }
.placeholder span {
  position: relative;
  z-index: 1;
  padding: 0.3em 0.5em;
  background: var(--c-bg);
}
.placeholder--square { border-radius: 4px; }
.placeholder--wide { border-radius: 4px; aspect-ratio: 16 / 9 !important; }

/* 6. Floating field ------------------------------------------------------ */
/* Decorative only: aria-hidden, never clickable, always behind content. */
.float-field {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.floater {
  position: absolute;
  /* --size and --opacity are set per item from JS; JS also moves it via transform */
  left: 0;
  top: 0;
  width: var(--size);
  opacity: var(--opacity, 0.35);
  will-change: transform;
  transition: opacity 0.25s ease;
}
/* Objects that link somewhere brighten under the pointer (main.js). */
.floater.is-pointed { opacity: calc(var(--opacity, 0.35) + 0.3); }
.floater-pointed body, .floater-pointed body * { cursor: pointer; }
.floater img { width: 100%; height: auto; filter: grayscale(var(--gray, 0)); }
.floater .placeholder { width: 100%; aspect-ratio: 1; }
.floater--model { aspect-ratio: 1; }
.floater--model canvas { display: block; width: 100%; height: 100%; }
/* Farther objects are softer. */
.floater[data-depth="far"] { filter: blur(1.5px); }

/* 7. Page scaffolds ------------------------------------------------------ */
.page-hero {
  padding-block: clamp(3rem, 10vh, 7rem) clamp(2rem, 6vh, 4rem);
  border-bottom: 1px solid var(--c-line);
}
.page-hero h1 {
  margin: 1rem 0 0;
  font-family: var(--f-h1);
  font-weight: 400;
  font-size: var(--t-h1);
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.page-hero p {
  max-width: 36rem;
  margin: 1.5rem 0 0;
  font-size: var(--t-lede);
  color: var(--c-ink-2);
}
/* A longer intro paragraph: smaller type on a wider measure. */
.page-hero .page-hero__intro {
  max-width: 50rem;
  margin-top: 2.75rem;
  font-size: clamp(0.9375rem, 1.15vw, 1.0625rem);
  line-height: 1.6;
}
.page-hero .page-hero__intro + .page-hero__intro { margin-top: 1em; }
.scaffold-note {
  margin-block: 3rem 5rem;
  padding: 1.5rem;
  border: 1px dashed var(--c-line-strong);
  color: var(--c-ink-3);
  font-family: var(--f-grotesk);
  font-weight: 700;
  font-size: 0.8125rem;
}
.back-link {
  display: inline-flex;
  gap: 0.5rem;
  color: var(--c-ink-2);
  text-decoration: none;
}
.back-link:hover { color: var(--c-ink); }

/* PDF viewer (assets/js/pdf-viewer.js): pages stack in one scrolling column. */
.pdf { margin-block: clamp(2.5rem, 6vh, 4rem) clamp(4rem, 10vh, 6rem); }
.pdf__bar, .pdf__pages { max-width: 60rem; margin-inline: auto; } /* slides read fine narrower than the page */
.pdf__bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--c-line);
}
.pdf__bar a { color: var(--c-ink-2); text-decoration: none; }
.pdf__bar a:hover { color: var(--c-ink); }
.pdf__pages { display: grid; gap: clamp(0.75rem, 1.5vw, 1.125rem); }
.pdf__page {
  position: relative;
  aspect-ratio: 16 / 9; /* replaced with the PDF's own shape once it loads */
  background: var(--c-bg-raised);
  border: 1px solid var(--c-line);
  overflow: hidden;
}
.pdf__page canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 400ms var(--ease);
}
.pdf__page.is-drawn canvas { opacity: 1; }
.pdf__page { cursor: zoom-in; } /* opens full screen (pdf-viewer.js) */
.pdf-zoom img { cursor: default; }
/* A PDF inside a case study section, at the width of the text column. */
.case__pdf { margin-block: 2rem 0; }
.case__pdf .pdf__bar,
.case__pdf .pdf__pages { max-width: none; }
/* Long documents scroll inside their own box instead of the page. */
.case__pdf--scroll .pdf__pages {
  max-height: min(80vh, 52rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
  display: block; /* a grid would squash the pages to fit the box */
}
/* A live web page shown in a window, e.g. the Touch Pass roadmap. */
.case__embed { margin: 1.5rem 0 2.25rem; }
/* A mini browser window: a slim title bar over a scaled-down desktop page. */
.embed__window {
  border: 1px solid var(--c-line-strong);
  border-radius: 0.75rem;
  overflow: hidden;
  background: rgb(var(--c-raised-rgb));
}
.embed__chrome {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--c-line);
}
.embed__dots { display: flex; gap: 0.3rem; }
.embed__dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c-line-strong); }
.embed__url {
  flex: 1;
  max-width: 22rem;
  margin-inline: auto;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  background: var(--c-line);
  font-size: 0.6875rem;
  color: var(--c-ink-3);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.embed__open { display: none; } /* phones only, below */
.embed__screen {
  position: relative;
  aspect-ratio: 16 / 10; /* replaced by embed-scale.js with the page's own size */
  overflow: hidden;
  background: #fff;
}
.embed__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  transform-origin: 0 0;
}
.case__pdf--scroll .pdf__page + .pdf__page { margin-top: clamp(0.75rem, 1.5vw, 1.125rem); }

/* Experiments gallery (assets/js/experiments.js) ---------------------------- */
.gallery { padding-block: clamp(2rem, 5vh, 3.5rem) clamp(4rem, 10vh, 7rem); }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--c-line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--c-ink-2);
  font: 700 0.8125rem/1 var(--f-grotesk);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.chip:hover { color: var(--c-ink); border-color: var(--c-ink-3); }
.chip[aria-pressed="true"] {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-bg);
}
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chip__count { opacity: 0.5; }

/* Masonry: three equal columns, each tile keeps its image's shape (--ar,
   width / height). experiments.js places the tiles on 1px rows. */
.gallery__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1px;
  column-gap: clamp(0.75rem, 1.4vw, 1.25rem);
  row-gap: 0;
}
.tile {
  align-self: start;
  aspect-ratio: var(--ar);
  min-width: 0;
}
.tile[hidden] { display: none; }

.tile__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-bg-raised);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 400ms var(--ease), border-color var(--dur) var(--ease);
}
.tile__btn:hover,
.tile__btn:focus-visible { border-color: var(--accent); }
.tile__btn:focus-visible { outline-offset: 4px; }

.tile__media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease);
}
.tile__media .placeholder {
  height: 42%;
  aspect-ratio: 1;
  margin-bottom: 12%; /* sit above the caption */
  transition: transform 900ms var(--ease), border-color var(--dur) var(--ease);
}
.tile__btn:hover .tile__media img { transform: scale(1.05); }
.tile__btn:hover .tile__media .placeholder {
  transform: rotate(-4deg) scale(1.06);
  border-color: var(--accent);
}

.tile__num { position: absolute; top: 1rem; left: 1rem; }

/* Caption sits at the bottom over a soft fade, and lifts a little on hover. */
.tile__caption {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 0.4rem;
  padding: 2.5rem 1rem 1rem;
  background: linear-gradient(to top, rgba(var(--c-bg-rgb), 0.9), rgba(var(--c-bg-rgb), 0));
  transform: translateY(0.35rem);
  transition: transform var(--dur) var(--ease);
}
.tile__btn:hover .tile__caption,
.tile__btn:focus-visible .tile__caption { transform: none; }
.tile__title {
  font-family: var(--f-h1);
  font-size: clamp(1.25rem, 1.7vw, 1.625rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.tile__meta { display: inline-flex; align-items: center; gap: 0.45rem; }
.tile__dot {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Enlarged view: a native dialog, so Esc and focus handling come for free. */
.viewer {
  width: min(100% - 2 * var(--gutter), 72rem);
  max-height: calc(100% - 2 * var(--gutter));
  padding: 0;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius);
  background: var(--c-bg);
  color: var(--c-ink);
  overflow: auto;
}
.viewer::backdrop {
  background: rgba(var(--c-bg-rgb), 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.viewer[open] { animation: viewer-in 400ms var(--ease); }
@keyframes viewer-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}
.viewer__body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 1fr);
}
.viewer__media {
  display: grid;
  place-items: center;
  min-height: min(70vh, 40rem);
  background: var(--c-bg-raised);
  border-right: 1px solid var(--c-line);
}
.viewer__media img { width: 100%; height: 100%; max-height: 80vh; object-fit: contain; }
.viewer__media .placeholder { width: min(50%, 18rem); aspect-ratio: 1; }
.viewer__text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  padding-top: 4.5rem;
}
.viewer__meta { display: flex; align-items: center; gap: 0.45rem; margin: 0; }
.viewer__count { margin-left: auto; }
.viewer__title {
  margin: 0;
  font-family: var(--f-h1);
  font-weight: 400;
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.viewer__note { margin: 0; color: var(--c-ink-2); }
.viewer__link { color: var(--c-ink-2); text-decoration: none; }
.viewer__link:hover { color: var(--c-ink); }
.viewer__controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}
.viewer__btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--c-line-strong);
  border-radius: 50%;
  background: var(--c-bg);
  color: var(--c-ink);
  font: 400 1rem/1 var(--f-sans);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.viewer__btn:hover { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }

@media (max-width: 960px) {
  .viewer__body { grid-template-columns: 1fr; }
  .viewer__media { min-height: 50vh; border-right: 0; border-bottom: 1px solid var(--c-line); }
  .viewer__text { padding-top: clamp(1.5rem, 3vw, 2.5rem); }
}
@media (max-width: 560px) {
  .gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile__title { font-size: 1.125rem; }
}

/* Project pages (experiments/<slug>/) ---------------------------------------- */
.project-hero__text { margin-top: 3.75rem; }
.project-hero__text p {
  max-width: none;
  margin: 0 0 1em;
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.5;
  color: var(--c-ink-2);
}
.project-hero__text p:last-child { margin-bottom: 0; }
.project-hero__text a { color: var(--c-ink); text-underline-offset: 0.2em; }
.project-hero__text strong { color: var(--c-ink); font-weight: 700; }

/* Photos and videos flow down three columns, like a scrapbook. */
.project-media {
  columns: 3 18rem;
  column-gap: clamp(0.75rem, 1.4vw, 1.25rem);
  padding-block: clamp(2rem, 5vh, 3.5rem) clamp(4rem, 10vh, 6rem);
}
.pmedia {
  break-inside: avoid;
  margin: 0 0 clamp(0.75rem, 1.4vw, 1.25rem);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-bg-raised);
}
.pmedia--wide { column-span: all; }
.pmedia img,
.pmedia video {
  display: block;
  width: 100%;
  height: auto;
}
.pmedia video { background: #000; }
.pmedia--embed { aspect-ratio: 16 / 9; background: #000; }
.pmedia--embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.pmedia__zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.pmedia__zoom img { transition: transform 900ms var(--ease), opacity var(--dur) var(--ease); }
.pmedia__zoom:hover img { transform: scale(1.03); }
.pmedia__zoom:focus-visible { outline-offset: -3px; }
.pmedia--missing { padding: 12% 0; border: 1px dashed var(--c-line-strong); background: transparent; }
.pmedia--missing .placeholder { width: 55%; margin-inline: auto; aspect-ratio: 1; }

.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(var(--c-bg-rgb), 0.94);
  overflow: hidden;
}
.lightbox[open] { display: grid; place-items: center; animation: viewer-in 300ms var(--ease); }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: calc(100vw - 2 * var(--gutter)); max-height: calc(100vh - 7rem); object-fit: contain; cursor: zoom-out; }



a.tile__btn { text-decoration: none; }
/* About page ---------------------------------------------------------------- */
.page--about .page-hero { border-bottom: 0; }
.about {
  display: grid;
  grid-template-columns: clamp(8rem, 14vw, 13rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  padding-block: clamp(2.5rem, 7vh, 5rem);
}
.about__photo {
  margin: 0;
  border: 1px solid var(--c-line);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--c-bg-raised);
}
.about__photo img { width: 100%; height: auto; aspect-ratio: 10 / 13; object-fit: cover; }
.about__photos { display: grid; gap: 1.5rem; }
.about__figure { margin: 0; }
.about__caption {
  margin-top: 0.7rem;
  font-family: var(--f-grotesk);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink-3);
}
.about__bio p {
  max-width: 52rem;
  margin: 0 0 1.25em;
  font-family: var(--f-sans);
  font-weight: 400;
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.6;
  color: var(--c-ink);
}
.about__bio p:last-child { margin-bottom: 0; }
.about__bio a { color: var(--c-ink); text-underline-offset: 0.2em; }

.contact {
  display: grid;
  justify-items: start;
  gap: 1.25rem;
  padding-block: clamp(3rem, 8vh, 5rem) clamp(4rem, 10vh, 7rem);
}
.contact__links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }

@media (max-width: 560px) {
  .about { grid-template-columns: 1fr; }
  .about__photos { grid-template-columns: repeat(2, 9rem); gap: 1rem; }
}

/* Case study pages (touch-pass/) ------------------------------------------ */
/* Title and details on the left, the CAD model floating free on the right. */
.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
}
.model.model--bare { aspect-ratio: 1; border: 0; background: none; }
/* Keep the viewer's hint at label size, not the hero's paragraph size. */
.case-hero .model p { max-width: none; margin: 0; font-size: var(--t-label); }
.page-hero .case-hero__sub {
  max-width: 44rem;
  margin-top: 1.25rem;
  font-family: var(--f-h1);
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  line-height: 1.15;
  color: var(--c-ink);
}
.page-hero .case-hero__tags { max-width: none; margin-top: 1.25rem; font-size: var(--t-label); color: var(--c-ink-2); }
.case-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-line);
}
.case-meta dt { color: var(--c-ink-3); }
.case-meta dd { margin: 0.5rem 0 0; font-size: 1rem; line-height: 1.4; color: var(--c-ink); }

.case__section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.5rem clamp(1.5rem, 4vw, 4rem);
  padding-block: clamp(3rem, 8vh, 5.5rem);
}
.case__section + .case__section { border-top: 1px solid var(--c-line); }
.case__section:last-child { padding-bottom: clamp(4rem, 10vh, 6rem); }
/* The section title stays in view while its text scrolls past. */
.case__head { position: sticky; top: 2rem; align-self: start; }
.case__num { color: var(--c-accent-strategy); }
.case__head h2 {
  margin: 0.9rem 0 0;
  font-family: var(--f-h1);
  font-weight: 400;
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.case__body { max-width: 44rem; }
.case__body p {
  margin: 0 0 1.1em;
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.65;
  color: var(--c-ink-2);
}
.case__body h3 {
  margin: 2.25rem 0 0.75rem;
  font-family: var(--f-sans);
  font-weight: 400;
  font-size: clamp(1.125rem, 1.5vw, 1.3rem);
  color: var(--c-ink);
}
.case__body > :first-child { margin-top: 0; }
.case__body > :last-child { margin-bottom: 0; }
.case__list { display: grid; gap: 0.9rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.case__list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.6;
  color: var(--c-ink-2);
}
.case__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent-strategy);
}
.case__list strong, .case__body strong { font-weight: 400; color: var(--c-ink); }
.case__quote { margin: 2rem 0; padding-left: 1.25rem; border-left: 2px solid var(--c-accent-strategy); }
.case__body .case__quote p {
  margin: 0;
  font-family: var(--f-h1);
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  line-height: 1.25;
  color: var(--c-ink);
}

@media (max-width: 960px) {
  .case__section { grid-template-columns: 1fr; }
  .case__head { position: static; }
  .case-hero { grid-template-columns: 1fr; }
}

/* 3D model viewer (assets/js/model-viewer.js) ------------------------------- */
.model-section { display: grid; gap: 1rem; padding-block: clamp(2rem, 5vh, 3.5rem) 0; }
.model-section:last-child { padding-bottom: clamp(4rem, 10vh, 6rem); }
.model {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 40%, var(--c-model-glow), var(--c-bg-raised) 70%);
  overflow: hidden;
}
.model__canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none; /* lets one-finger drags rotate instead of scrolling */
  opacity: 0;
  transition: opacity 600ms var(--ease);
}
.model__canvas:active { cursor: grabbing; }
.model.is-ready .model__canvas { opacity: 1; }
.model__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--c-ink-3);
  pointer-events: none; /* never block dragging the model */
}
.model__status[hidden] { display: none; }
.model__hint,
.model__reset {
  position: absolute;
  bottom: 0.9rem;
  margin: 0;
  color: var(--c-ink-3);
  pointer-events: none;
}
.model__hint { left: 1rem; }
.model__reset {
  right: 0.9rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--c-line-strong);
  border-radius: 999px;
  background: var(--c-bg);
  color: var(--c-ink-2);
  cursor: pointer;
  pointer-events: auto;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.model__reset:hover { color: var(--c-ink); border-color: var(--c-ink); }
/* Twisty puzzles (twisty.js): a row of buttons, with the hint up top. */
.model.twisty { aspect-ratio: 16 / 10; }
.twisty__tools {
  position: absolute;
  right: 0.9rem;
  bottom: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}
.twisty__tools .model__reset { position: static; }
.twisty .model__hint { top: 0.9rem; bottom: auto; }
@media (max-width: 560px) {
  .model { aspect-ratio: 1; }
  .model__hint { display: none; }
}

/* 8. Footer -------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--c-line);
}
/* Equal outer columns keep the middle label centered on the page itself. */
.site-footer .wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 0.75rem 2rem;
  padding-block: 1.5rem;
}
.site-footer .wrap > :last-child { justify-self: end; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--c-ink); }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 960px) {
  .projects { grid-template-columns: 1fr; row-gap: clamp(3rem, 8vh, 4.5rem); }
  .projects__grid,
  .projects__grid--two { grid-template-columns: 1fr; }
  .projects__group--play .projects__head { justify-content: space-between; }
  .card { min-height: 0; }
  .card__media { min-height: 0; margin-block: 1.5rem; }
  .card__media .placeholder { width: 40%; max-width: 11rem; }
}
@media (max-width: 560px) {
  .site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; }
  /* Fewer floaters on phones keeps it calm. */
  .floater[data-mobile="hide"] { display: none; }
}

/* Phones ------------------------------------------------------------------ */
@media (max-width: 560px) {
  /* Floaters: all three, larger. */
  .floater { width: calc(var(--size) * 1.8); }

  /* Footer: just the copyright line. */
  .site-footer .wrap > :not(:first-child) { display: none; }

  /* Home: two columns of bigger Playground thumbnails, each scrolling on
     its own (playground-strip.js). */
  .card__media.card__media--strip { min-height: 22rem; }
  .strip > .strip__track { display: none; }
  .strip__cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
    padding-inline: 1rem;
  }
  .strip__cols img { width: 100%; max-width: none; }

  /* About: contact links in a column. */
  .contact__links { flex-direction: column; align-items: flex-start; }

  /* Case studies: each section's title sticks to the top while its text
     scrolls, until the next section's title takes its place. */
  .case__head {
    position: sticky;
    top: 0;
    z-index: 4;
    margin-inline: calc(-1 * var(--gutter));
    padding: 0.9rem var(--gutter) 0.85rem;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-line);
  }
  .case__head h2 { margin-top: 0.5rem; font-size: 1.5rem; }

  /* Touch Pass roadmap: a link instead of an unreadably small window. */
  .embed__window { display: none; }
  .embed__open { display: inline-flex; }

  /* Twisty puzzles: square-ish, with the buttons in their own strip below. */
  .model.twisty { aspect-ratio: 1 / 1.14; }
  .twisty .model__canvas { height: calc(100% - 3.6rem); }
  .twisty__tools { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; justify-content: center; flex-wrap: nowrap; }

  /* Project photos in two columns; videos stay full width. */
  .project-media { columns: 2; column-gap: 0.6rem; }
  .pmedia { margin-bottom: 0.6rem; }
  .pmedia:has(video), .pmedia--embed { column-span: all; }
}

/* Bigger tap areas for small text links, without moving anything. */
@media (pointer: coarse) {
  .back-link { padding-block: 0.8rem; margin-block: -0.8rem; }
  .pdf__bar a { padding-block: 0.8rem; }
}

/* 9. Motion preferences -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
