/* Editorial, Swiss-style design: Migra titles, grotesk body text and small
   uppercase monospace labels on a fine square grid, in a dark theme by
   default with a light alternative. */
/* Migra (Pangram Pangram) for titles: Extralight and Extrabold, each with
   an italic. */
@font-face {
  font-family: "Migra";
  src: url("/fonts/migra/Migra-Extralight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Migra";
  src: url("/fonts/migra/MigraItalic-ExtralightItalic.woff2") format("woff2");
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Migra";
  src: url("/fonts/migra/Migra-Extrabold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Migra";
  src: url("/fonts/migra/MigraItalic-ExtraboldItalic.woff2") format("woff2");
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Theme colours. Dark is the default; [data-theme="light"] on <html>
     (set by the toggle in the nav, remembered per visitor) switches to the
     light palette below. "Ink" is the solid fill of buttons and "paper" the
     text on them, so they swap between themes. */
  color-scheme: dark;
  --color-bg: #212121;
  --color-surface: #2a2a2a;
  --color-text: #f1f0ec;
  --color-muted: #8a8984;
  --color-border: rgba(241, 240, 236, 0.14);
  --color-accent: #f1f0ec;
  --color-ink: #f1f0ec;
  --color-paper: #212121;
  --grid-line: #282828;
  /* Glass panels and buttons */
  --glass-fill: rgba(255, 255, 255, 0.03);
  --glass-sheen: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.01) 55%, rgba(255, 255, 255, 0.05) 100%);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.14);
  --glass-shadow: rgba(0, 0, 0, 0.45);
  /* "Design goes here" windows */
  --window-bg: #262626;
  --window-edge: rgba(255, 255, 255, 0.08);
  --window-shadow: rgba(0, 0, 0, 0.4);
  --window-rule: rgba(255, 255, 255, 0.07);
  --window-dot: rgba(255, 255, 255, 0.16);
  /* Background grid: 16px squares starting at the top-left corner of the
     page. Everything is laid out on it: page margins, column widths and
     gaps are whole squares (CSS round()), and src/scripts/grid-snap.ts
     drops the top edge of each content block onto a grid row. */
  --grid: 16px;
  /* One physical screen pixel, so grid lines are hairline-sharp on
     high-density screens rather than two device pixels wide. */
  --hairline: 1px;
  --page-margin: 16px;
  --font-sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Migra", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #dddddd;
  --color-surface: #d2d2d2;
  --color-text: #0b0b0b;
  --color-muted: #6c6c6c;
  --color-border: rgba(11, 11, 11, 0.14);
  --color-accent: #0b0b0b;
  --color-ink: #0b0b0b;
  --color-paper: #dddddd;
  --grid-line: #d6d6d6;
  --glass-fill: rgba(255, 255, 255, 0.22);
  --glass-sheen: linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.12) 55%, rgba(255, 255, 255, 0.3) 100%);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --glass-shadow: rgba(11, 11, 11, 0.07);
  --window-bg: #ffffff;
  --window-edge: rgba(0, 0, 0, 0.08);
  --window-shadow: rgba(0, 0, 0, 0.08);
  --window-rule: rgba(0, 0, 0, 0.07);
  --window-dot: rgba(0, 0, 0, 0.12);
}

@media (min-resolution: 2dppx) {
  :root {
    --hairline: 0.5px;
  }
}

@media (min-resolution: 3dppx) {
  :root {
    --hairline: 0.34px;
  }
}

@media (min-width: 768px) {
  :root {
    --page-margin: 32px;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Square grid over the whole page, drawn from the top-left corner. The
     page margin is a whole number of squares, so content edges sit on a
     line. */
  background-image:
    linear-gradient(to right, var(--grid-line) var(--hairline), transparent var(--hairline)),
    linear-gradient(to bottom, var(--grid-line) var(--hairline), transparent var(--hairline));
  background-size: var(--grid) var(--grid);
  background-position: 0 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Cursor circle: trails the pointer and inverts what's beneath it. The
   wrapper is positioned by JS (transform on .cursor-dot); the visible
   circle is the ::before, centred on the pointer. */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  width: 0;
  height: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cursor-dot::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  transform: translate(-50%, -50%);
  transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out);
}

.cursor-dot.is-active {
  opacity: 1;
}

/* Grows over the big display titles. */
.cursor-dot.is-title::before {
  width: 64px;
  height: 64px;
}

@media (hover: none), (pointer: coarse) {
  .cursor-dot {
    display: none;
  }
}

/* Main content sits below the fixed header. Flush pages (Home) manage
   their own top spacing. */
.site-main {
  flex: 1 0 auto;
  margin: 0;
  padding: 6rem var(--page-margin) 4rem;
}

.site-main--flush {
  padding: 0;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1;
  font-weight: 200;
  word-spacing: 0.04em;
  color: var(--color-text);
  text-wrap: balance;
}

/* Smaller headings (job titles, decision titles) stay in the sans. */
h3 {
  font-family: var(--font-sans);
  font-weight: 500;
}

h1 em, h2 em, h3 em {
  font-style: inherit;
}

p {
  color: var(--color-text);
  text-wrap: pretty;
}

/* Page titles: big, tight grotesk. */
h1 {
  font-size: clamp(3.25rem, 10vw, 9rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 1.5rem;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0 0 1rem;
}

a {
  color: inherit;
}

.lede {
  font-size: 1.1rem;
  line-height: 1.4;
  max-width: 34rem;
  letter-spacing: -0.01em;
}

/* An intro paragraph sits snug under its page title. */
h1 + .lede {
  margin-top: -1rem;
}

/* On wider screens a page's intro fills the left half, ending where the
   left column of the two-column sections below ends (just short of the
   middle), in whole grid squares. */
@media (min-width: 701px) {
  h1 + .lede {
    max-width: round(down, calc((100% - 64px) / 2), var(--grid));
  }
}

/* Small uppercase monospace label — the site's secondary voice. */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.muted {
  color: var(--color-muted);
}

/* Bracketed count shown after a section title, e.g. "Featured works [003]". */
.mono-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--color-muted);
  vertical-align: baseline;
  margin-left: 0.35rem;
}

/* Header: fixed, mono, blended with `difference` so it stays legible over
   whatever scrolls beneath it, in either theme. */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 250;
  color: #ffffff;
  mix-blend-mode: difference;
}

/* Name on the left; links, theme toggle and (on phones) the menu button
   grouped on the right. */
.site-nav {
  display: flex;
  align-items: center;
  padding: 0.85rem var(--page-margin);
}

.site-nav .brand {
  margin-right: auto;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  text-decoration: none;
  color: #ffffff;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  text-decoration: none;
  color: #ffffff;
}

/* "Let's talk" as a pill matching the page buttons. The header is blended
   with `difference`, so a white pill with black text renders as the
   inverse of the page: a black pill on the light theme, a white one on
   the dark. */
.nav-links a.nav-cta {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
}

.nav-links a:hover .btn-slide {
  transform: translateY(-1.2em);
}

/* Theme toggle: a small outlined circle at the right end of the nav, with
   a sun in the dark theme (switch to light) and a moon in the light theme.
   White, like the rest of the header, which inverts it to suit the page. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 16px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: none;
  color: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: #ffffff;
}

.theme-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon--sun circle {
  fill: none;
}

.theme-icon--moon,
:root[data-theme="light"] .theme-icon--sun {
  display: none;
}

:root[data-theme="light"] .theme-icon--moon {
  display: block;
}

/* Theme switch reveal (see the toggle script in BaseLayout): turn off the
   default cross-fade so the new theme is revealed purely by the growing
   circle, drawn above the old snapshot. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
}

/* Mobile menu: hamburger morphs into an X over a full-screen paper overlay
   with large stacked links. */
.menu-toggle {
  display: none;
  position: relative;
  z-index: 201;
  width: 24px;
  height: 14px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: #ffffff;
  transition: transform 0.35s var(--ease-in-out), top 0.35s var(--ease-in-out);
}

.menu-toggle-bar:first-child {
  top: 2px;
}

.menu-toggle-bar:last-child {
  top: 11px;
}

.menu-toggle.is-open .menu-toggle-bar:first-child,
.menu-toggle.is-open .menu-toggle-bar:last-child {
  top: 6px;
}

.menu-toggle.is-open .menu-toggle-bar:first-child {
  transform: rotate(45deg);
}

.menu-toggle.is-open .menu-toggle-bar:last-child {
  transform: rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  background: var(--color-bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s ease, visibility 0s linear 0s;
}

.mobile-menu-links {
  display: flex;
  flex-direction: column;
  padding: 0 var(--page-margin) 3rem;
}

.mobile-menu-links a {
  font-family: var(--font-display);
  font-size: clamp(3rem, 16vw, 5rem);
  font-weight: 200;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-text);
  text-decoration: none;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.mobile-menu.is-open .mobile-menu-links a {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu.is-open .mobile-menu-links a:nth-child(1) {
  transition-delay: 0.1s;
}

.mobile-menu.is-open .mobile-menu-links a:nth-child(2) {
  transition-delay: 0.18s;
}

.mobile-menu.is-open .mobile-menu-links a:nth-child(3) {
  transition-delay: 0.26s;
}

body.menu-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: block;
    margin-left: 20px;
  }
}

/* Hero */
.hero {
  padding: 4rem 0 3rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 2rem;
}

/* Buttons: black pills with mono labels. */
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  background: var(--color-ink);
  color: var(--color-paper);
  border: 1px solid var(--color-ink);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.2;
}

/* Outline buttons are glass (see the glass panel rule), without the drop
   shadow. */
.button.button-outline {
  color: var(--color-text);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* Hover text-swap: a one-line window with two stacked identical labels
   that slides up by one line on hover. */
.btn-window {
  display: block;
  height: 1.2em;
  line-height: 1.2;
  overflow: hidden;
}

.btn-slide {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 0.45s var(--ease-in-out);
  will-change: transform;
}

.btn-label {
  display: block;
  height: 1.2em;
  line-height: 1.2;
  flex-shrink: 0;
}

.button:hover .btn-slide {
  transform: translateY(-1.2em);
}

/* About */
.about-detail {
  position: relative;
  padding: 2rem 0;
}

/* Two columns, each a whole number of grid squares, 64px apart. */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, round(down, calc((100% - 64px) / 2), var(--grid)));
  gap: 48px 64px;
  align-items: start;
}

.case-section > .about-grid {
  max-width: none;
}

.about-photo,
.about-copy {
  width: 100%;
  max-width: 720px;
}

.about-photo {
  perspective: 800px;
}

.about-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--color-surface);
  --rx: 0deg;
  --ry: 0deg;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.5s var(--ease-out);
  will-change: transform;
}

.about-copy p {
  font-size: 1.1rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}

@media (max-width: 700px) {
  .about-grid {
    grid-template-columns: round(down, 100%, var(--grid));
  }
}

.about-header {
  padding-bottom: 3rem;
}

/* No divider between the About intro and its first section. */
.about-header + .case-section::before {
  display: none;
}

/* Experience */
.experience {
  position: relative;
  padding: 2rem 0;
}

.experience-list {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
}

.experience-item {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.35rem 32px;
  padding: 1.5rem 0;
}

.experience-item:first-child {
  padding-top: 0;
}

.experience-item:first-child::before {
  display: none;
}

.experience-main {
  grid-column: 2;
  grid-row: 1;
}

@media (max-width: 640px) {
  .experience-item {
    grid-template-columns: 1fr;
  }

  .experience-period,
  .experience-main {
    grid-column: 1;
    grid-row: auto;
  }

  .experience-period {
    order: -1;
  }
}

.experience-main h3 {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

.experience-company {
  margin: 0 0 0.75rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.experience-description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.experience-description + .experience-description {
  margin-top: 0.85rem;
}

.experience-period {
  grid-column: 1;
  grid-row: 1;
  margin: 0.3rem 0 0;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.featured-work {
  position: relative;
  padding: 2rem 0;
}

.page-header {
  padding: 3rem 0 2rem;
}

/* Line-reveal dividers: hairlines that draw in left to right the first
   time each one scrolls into view (JS adds .is-visible). */
.about-detail::before,
.experience::before,
.experience-item::before,
.featured-work::before,
.case-section::before,
.meta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-border);
}

@media (prefers-reduced-motion: no-preference) {
  .about-detail::before,
  .experience::before,
  .experience-item::before,
  .featured-work::before,
  .case-section::before,
  .meta::before {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s var(--ease-out);
  }

  .about-detail.is-visible::before,
  .experience.is-visible::before,
  .experience-item.is-visible::before,
  .featured-work.is-visible::before,
  .case-section.is-visible::before,
  .meta.is-visible::before {
    transform: scaleX(1);
  }
}

/* Project grid */
/* One, two or three columns depending on width, each a whole number of
   grid squares, with 32px between them. */
.project-grid {
  display: grid;
  grid-template-columns: round(down, 100%, var(--grid));
  gap: 48px 32px;
  margin-top: 32px;
}

@media (min-width: 640px) {
  .project-grid {
    grid-template-columns: repeat(2, round(down, calc((100% - 32px) / 2), var(--grid)));
  }
}

@media (min-width: 960px) {
  .project-grid {
    grid-template-columns: repeat(3, round(down, calc((100% - 64px) / 3), var(--grid)));
  }
}

.project-card {
  text-decoration: none;
  color: inherit;
  display: block;
  perspective: 800px;
}

/* Frosted glass panel (project thumbnails and case study heroes): a
   translucent white sheen over a blur of the page grid behind it, with a
   bright hairline edge and a soft shadow. */
.project-card-media,
.case-hero,
.button-outline {
  background-color: var(--glass-fill);
  background-image: var(--glass-sheen);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 18px 40px var(--glass-shadow);
}

/* Every image is clipped to 12px corners (6px for small ones, below). */
.case-hero-image,
.case-visual-image,
.project-card-image,
.case-images img,
.about-photo img {
  border-radius: 12px;
  overflow: hidden;
}

/* Images shown small (phone screens in a row, project card thumbnails)
   get tighter 6px corners so they don't look over-rounded. */
.case-visuals--phones .case-visual-image,
.project-card-image {
  border-radius: 6px;
}

/* Image panels and design windows also get 12px corners. */
.project-card-media,
.project-card-window,
.case-hero,
.case-hero-window,
.case-visual-frame,
.cover,
.about-photo img,
.case-images--split img {
  border-radius: 12px;
}

/* Thumbnail: glass panel with a white window frame where the design
   goes. The whole block tilts on hover. */
.project-card-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 8%;
  margin-bottom: 0.6rem;
  overflow: hidden;
  --rx: 0deg;
  --ry: 0deg;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.5s var(--ease-out);
  will-change: transform;
}

.project-card-window {
  position: relative;
  width: 100%;
  background: var(--window-bg);
  border: 1px solid var(--window-edge);
  overflow: hidden;
  box-shadow: 0 12px 32px var(--window-shadow);
}

.project-card-window .case-hero-bar {
  padding: 0.5rem 0.65rem;
}

.project-card-window .case-hero-bar span {
  width: 0.45rem;
  height: 0.45rem;
}

.project-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
}

/* Cover screenshot on the card's glass panel, scaled to fit inside it
   (the box hugs the image so its rounded corners land on the picture). */
.project-card-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

/* Card caption: numbered mono label, e.g. "001_Training vision". */
.project-card-label {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.project-card-label span {
  color: var(--color-muted);
}

.project-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  max-width: 30rem;
}

/* Case study */
.case-header {
  padding: 3rem 0 1.5rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-muted);
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--color-text);
}

.meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin: 2.5rem 0 0;
  padding-top: 1.25rem;
}

.meta dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
}

.meta dd {
  margin: 0;
  font-size: 0.95rem;
}

.cover {
  width: 100%;
  background: var(--color-surface);
  margin: 1rem 0 2.5rem;
}

/* Project hero: glass panel (see above) with a window frame. */
.case-hero {
  position: relative;
  display: flex;
  justify-content: center;
  padding: clamp(1.5rem, 6vw, 5rem);
  margin: 1rem 0 2.5rem;
  overflow: hidden;
}

.case-hero-window {
  position: relative;
  width: 100%;
  max-width: 1100px;
  background: var(--window-bg);
  border: 1px solid var(--window-edge);
  overflow: hidden;
  box-shadow: 0 24px 60px var(--window-shadow);
}

.case-hero-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--window-rule);
}

.case-hero-bar span {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--window-dot);
}

.case-hero-placeholder {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  color: var(--color-muted);
}

/* Cover screenshot straight on the hero's glass panel, no window frame. */
.case-hero-image {
  display: block;
  width: 100%;
  max-width: 1100px;
  height: auto;
}

.case-section {
  position: relative;
  padding: 2rem 0;
  width: 100%;
}

.case-section > * {
  max-width: 720px;
}

.case-section-title {
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: -0.015em;
  line-height: 1.06;
  margin: 0 0 1.5rem;
}

/* Section label: mono, uppercase, with a bracketed number — "[01] About". */
.case-section-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.3;
  text-transform: uppercase;
  margin: 0 0 1rem;
}

.case-section-number {
  color: var(--color-muted);
  margin-right: 0.5rem;
}

.case-section-number::before {
  content: '[';
}

.case-section-number::after {
  content: ']';
}

/* Pull quote */
.case-quote {
  margin: 2rem 0 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--color-text);
}

.case-quote blockquote {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.case-quote figcaption {
  margin-top: 0.75rem;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* Stats row */
.case-stats {
  display: grid;
  grid-template-columns: repeat(3, round(down, calc((100% - 64px) / 3), var(--grid)));
  gap: 32px;
  margin: 2rem 0 0;
}

/* Four stats sit two by two rather than three and one. */
.case-stats:has(> .case-stat:nth-child(4)) {
  grid-template-columns: repeat(2, round(down, calc((100% - 32px) / 2), var(--grid)));
}

.case-stat dt {
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}

.case-stat dd {
  margin: 0.5rem 0 0;
  color: var(--color-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.case-stats-note {
  margin: 1rem 0 0;
  color: var(--color-muted);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .case-stats {
    grid-template-columns: round(down, 100%, var(--grid));
  }
}

/* Table */
.case-table-wrap {
  margin: 2rem 0 0;
  overflow-x: auto;
}

.case-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
}

.case-table th,
.case-table td {
  padding: 0.85rem 1rem 0.85rem 0;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--color-border);
}

.case-table thead th {
  padding-top: 0;
  border-top: none;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
}

.case-table tbody th {
  font-weight: 500;
}

/* "Impact" line under a decision */
.case-list-impact {
  margin-top: 0.6rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.case-list-impact span {
  margin-right: 0.6rem;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

/* Image placeholders inside a section */
.case-visuals {
  display: grid;
  gap: 2rem;
  margin: 2.5rem 0 0;
}

.case-visual {
  margin: 0;
}

.case-visual-frame {
  position: relative;
  background: var(--window-bg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

/* Phone screens sit side by side across the whole section, below its two
   columns: four across, or two on small screens, each a whole number of
   grid squares wide. */
.case-section > .case-visuals--phones {
  grid-column: 1 / -1;
  max-width: none;
  width: 100%;
  margin: 0;
  grid-template-columns: repeat(2, round(down, calc((100% - 16px) / 2), var(--grid)));
  gap: 32px 16px;
}

@media (min-width: 701px) {
  .case-section > .case-visuals--phones {
    grid-template-columns: repeat(4, round(down, calc((100% - 96px) / 4), var(--grid)));
    gap: 32px;
  }
}

/* Wide flow diagrams: full width of the section, one per row. */
.case-section > .case-visuals--wide {
  grid-column: 1 / -1;
  max-width: none;
  width: 100%;
  margin: 0;
  grid-template-columns: round(down, 100%, var(--grid));
  gap: 32px;
}

.case-visuals--phones figcaption {
  font-size: 0.8rem;
}

/* A real screenshot in place of the placeholder: shown whole, no grid. */
/* A real screenshot sits on the same glass gradient panel as the hero,
   with room around it, rather than in a window frame. */
.case-visual-frame--image {
  padding: clamp(16px, 4vw, 48px);
  background-color: var(--glass-fill);
  background-image: var(--glass-sheen);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.case-visuals--phones .case-visual-frame--image {
  padding: 16px;
}

.case-visual-frame--image::after {
  display: none;
}

.case-visual-image {
  display: block;
  width: 100%;
  height: auto;
}

.case-visual-placeholder {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  aspect-ratio: 16 / 9;
  padding: 1.5rem;
  text-align: center;
  color: var(--color-muted);
}

.case-visual-placeholder span,
.case-hero-placeholder span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.case-visual-placeholder small,
.case-hero-placeholder small {
  max-width: 28rem;
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.case-visual figcaption {
  margin-top: 0.75rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Label/value rows (e.g. Product, Audience, My role). */
/* flow-root stops the first row's margin merging with the list's, so
   grid-snap.ts can nudge that row onto the grid. */
.case-details {
  display: flow-root;
  margin: 1.5rem 0 0;
}

.case-details-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.25rem 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
}

.case-details-row dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  padding-top: 0.2rem;
}

.case-details-row dd {
  margin: 0;
  white-space: pre-line;
}

@media (max-width: 640px) {
  .case-details-row {
    grid-template-columns: 1fr;
  }
}

/* Split section: label on the left, content on the right. */
.case-section--split {
  display: grid;
  grid-template-columns: repeat(2, round(down, calc((100% - 64px) / 2), var(--grid)));
  gap: 32px 64px;
  align-items: start;
}

.case-section--split > * {
  width: 100%;
}

.case-section-content > :first-child {
  margin-top: 0;
}

.case-section--split .experience-list {
  margin-top: 0;
}

@media (max-width: 700px) {
  .case-section--split {
    grid-template-columns: round(down, 100%, var(--grid));
  }
}

.case-section > .project-grid {
  max-width: none;
}

/* Numbered list (e.g. Key decisions). */
.case-list {
  display: flow-root; /* rows keep their own margins (see grid-snap.ts) */
  list-style: none;
  margin: 0;
  padding: 0;
}

.case-list-item {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.5rem 1rem;
  padding: 1.25rem 0;
}

.case-list-item + .case-list-item {
  border-top: 1px solid var(--color-border);
}

.case-list-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.9;
  color: var(--color-muted);
}

.case-list-title {
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.4rem;
}

.case-list-item p {
  margin: 0;
}

/* Section bodies come from a plain text field in Sanity, so keep the
   line breaks Angela types. */
.case-section p {
  white-space: pre-line;
}

/* Case study image galleries: "split" is a two-up grid in the text column;
   "full" breaks out to the full viewport width. */
.case-images {
  margin-top: 1.5rem;
}

.case-images--split {
  display: grid;
  grid-template-columns: repeat(2, round(down, calc((100% - 16px) / 2), var(--grid)));
  gap: 16px;
}

.case-images--split img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.case-images--full {
  max-width: none;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.case-images--full img {
  aspect-ratio: 21 / 9;
  object-fit: cover;
}

.case-images img {
  display: block;
  width: 100%;
  background: var(--color-surface);
}

@media (max-width: 640px) {
  .case-images--split {
    grid-template-columns: round(down, 100%, var(--grid));
  }

  .case-images--full img {
    aspect-ratio: 4 / 3;
  }
}

/* Contact */
.social-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.social-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-muted);
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--color-text);
}

/* Footer: same background, grid and colours as the page, with a huge
   "Get in touch" and mono links and credits underneath. */
.site-footer {
  position: relative;
  margin-top: 6rem;
  padding: 12rem var(--page-margin) 1.5rem;
  color: var(--color-text);
}

.footer-cta {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 19.5vw, 26rem);
  font-weight: 200;
  letter-spacing: -0.025em;
  word-spacing: 0.04em;
  line-height: 1;
  color: var(--color-text);
  text-decoration: none;
}

.footer-cta .btn-window,
.footer-cta .btn-label {
  height: 1.05em;
  line-height: 1.05;
}

.footer-cta:hover .btn-slide {
  transform: translateY(-1.05em);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-top: 48px;
}

/* Links start five-twelfths across and credits two-thirds across, both
   rounded to the grid. */
@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns:
      round(down, calc(100% * 5 / 12), var(--grid))
      round(down, calc(100% * 3 / 12), var(--grid))
      1fr;
    gap: 0;
  }

  .footer-links {
    grid-column: 2;
  }

  .footer-meta {
    grid-column: 3;
  }
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-links a {
  color: var(--color-text);
  text-decoration: none;
  width: fit-content;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* SVG arrow after external links (ArrowIcon.astro). */
.link-arrow {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.3em;
  vertical-align: -0.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease-out);
}

a:hover .link-arrow {
  transform: translate(2px, -2px);
}

.footer-meta p {
  margin: 0 0 0.2rem;
  color: var(--color-muted);
}

.footer-meta span {
  color: var(--color-text);
}

/* Contact page: no big CTA (you're already there), so the footer is slim. */
.site-footer--slim {
  padding-top: 2rem;
}

.site-footer--slim .footer-grid {
  margin-top: 0;
}

/* Smooth scroll (Lenis) takes over from native smooth scrolling. */
html.lenis,
html.lenis body {
  height: auto;
  /* No scroll anchoring: when something on the page changes height (like a
     content switcher opening a description), the browser's small scroll
     correction fights Lenis and the page glides away. */
  overflow-anchor: none;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* Entrance animations (src/scripts/animations.ts). Elements are tagged
   with anim-* classes before first paint and stay hidden until they
   scroll into view and get .is-in; .anim-done marks one that has finished
   and had its original markup restored. */
.anim-write:not(.is-in):not(.anim-done),
.anim-lines:not(.is-in):not(.anim-done),
.anim-rise:not(.is-in):not(.anim-done) {
  visibility: hidden;
}

/* Write: each character is swept in by a solid block that shrinks away. */
.w-char {
  position: relative;
  display: inline-block;
}

.w-glyph {
  opacity: 0;
}

.w-block {
  position: absolute;
  inset: 0.1em -0.02em;
  background: currentColor;
  opacity: 0;
  transform-origin: right center;
}

.is-in .w-glyph {
  animation: write-glyph 0.3s var(--ease-in-out) forwards;
  animation-delay: calc(var(--i) * var(--step, 28ms));
}

.is-in .w-block {
  animation: write-block 0.2s var(--ease-in-out) forwards;
  animation-delay: calc(var(--i) * var(--step, 28ms));
}

@keyframes write-glyph {
  to {
    opacity: 1;
  }
}

@keyframes write-block {
  0% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
    transform: scaleX(0);
  }
}

/* Lines: each visual line fades up from half a line below. */
.l-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(50%);
}

.is-in .l-word {
  animation: line-up 0.7s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 90ms);
}

@keyframes line-up {
  to {
    opacity: 1;
    transform: none;
  }
}

/* Rise: words slide up from behind a mask, one after another. */
/* The mask reaches a little above and below the line box (padding,
   cancelled by negative margins) so tall ascenders and descenders aren't
   cropped while words rise, even in tightly set titles. */
.r-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0.15em 0 0.12em;
  margin: -0.15em 0 -0.12em;
}

.r-word {
  display: inline-block;
  transform: translateY(110%);
}

.is-in .r-word {
  animation: rise-up 0.9s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes rise-up {
  to {
    transform: none;
  }
}

/* Media: wipes up into view while coming into focus. */
.anim-media {
  clip-path: inset(100% 0 0 0);
  filter: blur(8px);
}

.anim-media.is-in {
  clip-path: inset(0 0 0 0);
  filter: blur(0);
  transition: clip-path 1.1s var(--ease-in-out), filter 1.2s var(--ease-out), transform 0.5s var(--ease-out);
}

/* Live prototype (case study): a design window spanning the section that
   shows a poster until someone loads the prototype, then an iframe. */
.case-section > .proto-window {
  grid-column: 1 / -1;
  max-width: none;
}

.proto-window {
  position: relative;
  background: var(--window-bg);
  border: 1px solid var(--window-edge);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px var(--window-shadow);
}

.proto-bar {
  align-items: center;
}

.proto-open {
  margin-left: auto;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  text-decoration: none;
}

.proto-open:hover,
.proto-open:focus-visible {
  text-decoration: underline;
}

.proto-stage {
  position: relative;
  /* Fits on screen with the window bar, so the whole app is visible. */
  height: min(80vh, 760px);
  background: #ffffff;
}

.proto-poster,
.proto-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.proto-poster {
  object-fit: cover;
  object-position: top left;
}

/* Dark scrim so the button and note read clearly over the screenshot. */
.proto-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  background: rgba(11, 11, 11, 0.62);
}

/* Fixed light button in both themes: it always sits on the dark scrim. */
.proto-overlay .button {
  background: #f1f0ec;
  border-color: #f1f0ec;
  color: #0b0b0b;
  cursor: pointer;
  padding: 0.9rem 1.4rem;
  font-size: 0.78rem;
}

.proto-note {
  margin: 0;
  color: #f1f0ec;
  font-size: 0.85rem;
}

.proto-link {
  display: none;
}

.proto-steps {
  margin: 1.25rem 0 0;
  padding-left: 1.25rem;
}

.proto-steps li + li {
  margin-top: 0.5rem;
}

/* Phones: the prototype is a desktop layout, so open it in its own tab
   instead of squeezing it into the page. */
@media (max-width: 700px) {
  .proto-stage {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .proto-load {
    display: none;
  }

  .proto-overlay .proto-link {
    display: inline-flex;
  }
}


/* Bleed frame: a cropped close-up on the same glass panel as every other
   image, set in from the top left and running off the right and bottom
   edges, so it reads as a zoomed-in part of a bigger screen. */
.case-visual-frame--bleed {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background-color: var(--glass-fill);
  background-image: var(--glass-sheen);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* Inside a frame that is already glass (the content switcher). */
.shot-bleed {
  position: relative;
  overflow: hidden;
}

/* The image box always runs past the right and bottom edges; the screenshot
   fills it from its top-left corner (the real corner of the window), so
   only the cropped edges are hidden, whatever the image's shape. */
.shot-bleed-image {
  position: absolute;
  left: 10%;
  top: 7%;
  width: 92%;
  height: 97%;
  max-width: none;
  object-fit: cover;
  object-position: left top;
  border-radius: 12px 0 0 0;
  box-shadow: 0 24px 60px var(--glass-shadow);
}


/* Key points with sketches: a two-up grid of cards across the section, each
   a lo-fi wireframe on glass with its number, title, text and impact. */
.case-section > .case-cards {
  grid-column: 1 / -1;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, round(down, calc((100% - 32px) / 2), var(--grid)));
  gap: 48px 32px;
}

.case-card-frame {
  padding: clamp(12px, 2.5vw, 28px);
}

.case-card-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.case-card-body {
  padding-top: 1.25rem;
}

.case-card-body .case-list-title {
  margin-top: 0;
}

@media (max-width: 700px) {
  .case-section > .case-cards {
    grid-template-columns: round(down, 100%, var(--grid));
  }
}


/* Three cards sit in one row on wide screens rather than two and one. */
@media (min-width: 1001px) {
  .case-section > .case-cards:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, round(down, calc((100% - 64px) / 3), var(--grid)));
  }
}

/* Footnote under the cards. */
.case-section > .case-cards-note {
  grid-column: 1 / -1;
  max-width: none;
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-muted);
}


/* At a glance: problem, my part and outcome under the header, for readers
   who skim. Same label style as the meta row above it. */
.case-glance {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem 2.5rem;
  margin: 0 0 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.case-glance dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.4rem;
}

.case-glance dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (max-width: 700px) {
  .case-glance {
    grid-template-columns: 1fr;
  }
}
