/* =========================================================
   Design tokens
   Two themes, set on <html data-theme> by the inline script in Base.astro (dark unless the visitor picked light).
   Cool, violet-tinted neutrals do almost all the work. --accent (muted lavender) is for links, the focus ring and key numbers;
   --accent-2 (sage) is kept to the terminal cursor and small markers.
   ========================================================= */
:root {
  /* Type */
  --font-sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;   /* terminal bar and tiny data labels only */

  /* Layout */
  --header-h:    58px;
  --footer-h:    37px;
  --content-pad: 48px;
  --content-max: 1264px;
  --radius:      4px;
  --section-gap: clamp(72px, 10vw, 136px);

  --transition-fast: 120ms ease;
  --transition-base: 240ms ease;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:         #131216;
  --surface:    #1b1a20;
  --text:       #eceaf1;
  --text-2:     #c8c5d1;
  --muted:      #9d99a8;
  --line:       #2a2831;
  --field-line: #6f6b7b;   /* form fields and outline buttons: 3:1 against the page */
  --accent:     #b2a4ee;
  --accent-2:   #8cc0a0;
  /* The potion's three ingredients (home page background): stakeholders, business, users */
  --ing-1:      #8c7bd0;
  --ing-2:      #6fa585;
  --ing-3:      #5f9e9b;   /* sage, sparingly: the terminal cursor and small markers */
  --error:      #ff9d90;
  /* Turnaround figure: the four groups, as neutral steps */
  --u-design:   #eceaf1;
  --u-dev:      #bcb8c6;
  --u-ops:      #918d9c;
  --u-product:  #6f6b7b;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:         #f3f2f6;
  --surface:    #ffffff;
  --text:       #17161b;
  --text-2:     #3a3743;
  --muted:      #5d5967;
  --line:       #e0dde7;
  --field-line: #8a8696;
  --accent:     #5a48a6;
  --accent-2:   #3f7a58;
  --ing-1:      #7d6bc4;
  --ing-2:      #5f9675;
  --ing-3:      #4f8b88;
  --error:      #a4221a;
  --u-design:   #17161b;
  --u-dev:      #4a4654;
  --u-ops:      #6e6a78;
  --u-product:  #8a8696;
}

/* =========================================================
   Reset & base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: lining-nums;
  /* The sticky .c-terminal bar would otherwise cover focused elements */
  scroll-padding-bottom: 64px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2, h3 { font-weight: 500; color: var(--text); text-wrap: balance; }
p, li, dd, figcaption { text-wrap: pretty; }   /* no single word left alone on the last line */
ul[role="list"],
ol[role="list"] { list-style: none; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
strong, b { font-weight: 600; }
code { font-family: var(--font-mono); font-size: 0.85em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

.u-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Links inside running text: the accent's main job */
.c-inline-link,
.c-case__link,
.c-proto-jump,
.c-diagnostic__link a,
.s-comms__direct a,
.c-monitor__log a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.c-inline-link:hover,
.c-case__link:hover,
.c-proto-jump:hover,
.c-diagnostic__link a:hover,
.s-comms__direct a:hover,
.c-monitor__log a:hover { color: var(--text); }

/* =========================================================
   Primitives: button, plain labels
   ========================================================= */
.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: var(--radius);
  color: var(--bg);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.c-btn:hover { background: var(--text-2); border-color: var(--text-2); }
/* Secondary button: outline only */
.c-btn--ghost { background: transparent; color: var(--text); border-color: var(--field-line); }
.c-btn--ghost:hover { background: transparent; border-color: var(--text); color: var(--text); }

/* Used by the password-protected case studies (assets/locked): plain text, no pills or caps */
.c-kicker { font-size: 15px; line-height: 22px; color: var(--muted); }
.c-badge { color: var(--muted); font-size: 15px; line-height: 22px; }
.c-badge:not(:last-child)::after { content: ' ·'; }

/* =========================================================
   Header
   ========================================================= */
.c-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 32px;
  min-height: var(--header-h);
  padding: 12px max(var(--content-pad), calc((100% - var(--content-max)) / 2));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.c-header__logo {
  font-weight: 600;
  font-size: 17px;
  line-height: 24px;
  color: var(--text);
  white-space: nowrap;
}
.c-header__nav { margin-left: auto; }
.c-header__nav ul {
  position: relative;
  display: flex;
  align-items: center;
  gap: 32px;
}
.c-nav-link {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.c-nav-link::after {
  content: '';
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}
.c-nav-link:hover,
.c-nav-link.is-active { color: var(--text); }
.c-nav-link.is-active::after { transform: scaleX(1); }
/* With JS, one shared underline (nav-ink.js) travels between the links instead; the per-link one keeps its space */
.c-header__nav ul.has-ink .c-nav-link::after { visibility: hidden; }
.c-header__ink {
  position: absolute; left: 0; top: 0; width: 0; height: 1px; pointer-events: none;
  background: var(--text);
  transition: opacity 200ms ease;
}

/* Theme toggle: the visible word is the theme it switches to (the accessible name comes from theme.js) */
.c-theme-toggle {
  flex: none;
  padding: 2px 8px;
  background: none;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.c-theme-toggle::after { content: 'Light'; }
:root[data-theme="light"] .c-theme-toggle::after { content: 'Dark'; }
.c-theme-toggle:hover { border-color: var(--text); }

/* =========================================================
   Shell
   ========================================================= */
.l-shell {
  flex: 1;
  display: flex;
  align-items: stretch;
}
.l-main {
  flex: 1;
  min-width: 0;
  padding: clamp(40px, 7vw, 96px) var(--content-pad) var(--section-gap);
}
.l-main:focus { outline: none; }

/* =========================================================
   Focus mode + sticky return bar
   Used by project pages (html[data-mode="focus"]), the library, the arcade and the CV page:
   no header, just a pinned way back and a centered column.
   ========================================================= */
.c-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.c-topbar[hidden] { display: none; }
.c-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px clamp(20px, 6vw, 72px);
}
html[data-mode="focus"] .l-main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) clamp(20px, 6vw, 72px) clamp(56px, 8vw, 96px);
}

.c-back {
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
  color: var(--muted);
  transition: color var(--transition-fast);
}
.c-back:hover { color: var(--text); }

/* =========================================================
   Page rhythm
   ========================================================= */
.v-view {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  max-width: var(--content-max);
  margin: 0 auto;
}
.v-view[hidden] { display: none; }

/* =========================================================
   Hero: one quiet line of who, the statement, then everything on the statement's left edge
   ========================================================= */
.s-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}
/* One line of running text: the name (h1) and role flow together and wrap like a sentence; the nbsp keeps the first dot with the name */
.s-hero__who { font-size: 15px; line-height: 22px; color: var(--muted); }
.s-hero__name, .s-hero__role { display: inline; font-size: inherit; line-height: inherit; }
.s-hero__name { font-weight: 600; color: var(--text); }
.s-hero__line {
  max-width: 22ch;   /* two or three lines at any width */
  margin-bottom: 8px;
  font-weight: 500;
  font-size: clamp(40px, 5.8vw, 84px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--text);
  text-wrap: balance;
}
.s-hero__summary {
  max-width: 36em;
  margin-top: 8px;
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.45;
  color: var(--text-2);
}
.s-hero__key { color: var(--accent); }
.s-hero__potion { display: flex; flex-direction: column; gap: 10px; max-width: 36em; }
.s-hero__bottle { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.45; color: var(--text); }
.s-hero__ingredients { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.s-hero__dot { width: 8px; height: 8px; margin: 0 6px 0 16px; border-radius: 50%; background: var(--c); }
.s-hero__dot:first-child { margin-left: 0; }

/* The potion (home page): a fixed WebGL canvas behind everything; the page background shows through until it starts */
/* Still picture of the blobs, for when the canvas can't run (tools/potion-still.mjs renders it from the live shader) */
.c-potion-still { display: none; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url('/assets/potion/still-dark.webp') center / cover no-repeat; }
:root[data-theme="light"] .c-potion-still { background-image: url('/assets/potion/still-light.webp'); }
.c-potion-still.is-on { display: block; }
.c-potion { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; display: block; pointer-events: none; opacity: 0; transition: opacity 900ms ease; }
.c-potion.is-on { opacity: 1; }
/* Pause motion sits in the terminal bar (potion.js moves it there), styled like the Commands key */
.c-potion-pause {
  flex: none; padding: 1px 8px; border: 1px solid var(--field-line); border-radius: var(--radius);
  background: transparent; color: var(--muted); font: inherit; font-size: 11px; line-height: 18px; cursor: pointer;
}
.c-potion-pause:hover { border-color: var(--text); color: var(--text); }
.c-potion-pause[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .c-potion { transition: none; } }
.s-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
/* Hero "See work" (/#work) lands below the sticky header */
.s-work { scroll-margin-top: calc(var(--header-h) + 32px); }

/* =========================================================
   Section header
   ========================================================= */
.s-work {
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 4vw, 56px);
}
.c-section-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
}
.c-section-header__title,
.s-bio__title,
.s-comms__title {
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.c-section-header__sub { font-size: 19px; line-height: 1.45; max-width: 36em; }

/* =========================================================
   Project media — one shared structure for every project:
     .c-project-media
       __bg      full-bleed project image
       (reel or team figure on top, from prototype/)
   ========================================================= */
.c-project-media {
  position: relative;
  aspect-ratio: 378 / 220;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  background: var(--surface);
}
.c-project-media__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.c-project-media--hero { max-width: 960px; }

/* Interactive prototype section on a project page */
.v-proto {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.v-proto__header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
}
.v-proto__title {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.v-proto__header strong { color: var(--text); font-weight: 500; }
.v-proto__tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 24px;
}
.v-proto__tips li { display: block; font-size: 14px; line-height: 20px; }
.v-proto__tips span { margin-right: 8px; color: var(--muted); }
.v-proto__tips em { font-style: normal; color: var(--text); }
.v-proto__note { font-size: 13px; line-height: 18px; color: var(--muted); }

@media (max-width: 860px) {
  .v-proto__tips { grid-template-columns: minmax(0, 1fr); }
  .v-proto__title { font-size: 26px; }
}

/* =========================================================
   Project cards: image, then plain text under it
   ========================================================= */
.s-work__grid {
  display: grid;
  /* Two across on wide screens, so four cards read as a 2×2 set instead of 3 + 1 */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 56px 32px;
}
@media (min-width: 900px) {
  .s-work__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.c-project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}
/* Full-width card (case study 05): spans the grid; media and text side by side on wide screens */
.c-project-card--wide .c-project-media { aspect-ratio: 4 / 3; }   /* room for the scene above its caption */
.s-work__grid > .s-work__wide { grid-column: 1 / -1; }
/* Between 900 and 1199px the wide card spans the whole row, so it stacks like the others (media on top, full width) */
@media (min-width: 900px) and (max-width: 1199px) {
  .c-project-card--wide .c-project-media { aspect-ratio: 16 / 9; }
}
/* Wide screens: product work on one row of three, leadership on the next (Team turnaround + the wide team card).
   The grid uses the full content width here so each card stays large enough for its reel. */
@media (min-width: 1200px) {
  .s-work__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .s-work__grid > .s-work__wide { grid-column: span 2; }
  .c-project-card--wide { flex-direction: row; gap: 32px; }
  .c-project-card--wide .c-project-media { flex: 0 0 60%; aspect-ratio: auto; align-self: stretch; }
  .c-project-card--wide .c-project-card__body { justify-content: flex-end; }
}

.c-project-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.c-project-card__meta { font-size: 14px; line-height: 20px; color: var(--muted); }
.c-project-card__title {
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-decoration: underline transparent 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--transition-fast);
}
.c-project-card:hover .c-project-card__title { text-decoration-color: currentColor; }
.c-project-card__desc { font-size: 16px; line-height: 1.5; }

/* =========================================================
   Library band and "How I work": plain sections under one hairline
   ========================================================= */
.c-library-teaser,
.c-diagnostic--band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px 48px;
  margin-top: calc(var(--section-gap) * -0.5);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.c-library-teaser__text,
.c-diagnostic__text {
  min-width: 0;
  max-width: 44em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.c-library-teaser__title,
.c-diagnostic__title { font-size: 26px; line-height: 1.2; letter-spacing: -0.015em; }
.c-library-teaser__desc { font-size: 17px; }
.c-diagnostic__link { font-size: 15px; color: var(--muted); }
@media (max-width: 640px) {
  .c-library-teaser,
  .c-diagnostic--band { grid-template-columns: minmax(0, 1fr); }
  .c-library-teaser .c-btn,
  .c-diagnostic--band .c-btn { justify-self: start; }
}

/* Results lists on case studies */
.c-diagnostic__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}
.c-diagnostic__list li::marker { color: var(--accent-2); }
.c-diagnostic__note { margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--muted); }

/* =========================================================
   Project page
   ========================================================= */
.v-project { gap: clamp(32px, 5vw, 56px); }
.v-project__header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 860px;
}
.v-project__meta { font-size: 15px; line-height: 22px; color: var(--muted); }
.v-project__title {
  font-size: clamp(40px, 6.4vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.v-project__sub { max-width: 34em; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.42; color: var(--text); }
.v-project__sub code { padding: 1px 4px; border-radius: 3px; background: var(--surface); }
.v-project__body {
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 6vw, 72px);
  max-width: 960px;
}
.v-project__desc { max-width: 760px; }
.v-project__tags { font-size: 14px; line-height: 22px; color: var(--muted); }
.v-project__footer { max-width: 960px; padding-top: 24px; border-top: 1px solid var(--line); }

/* =========================================================
   About
   ========================================================= */
.s-bio {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 64px;
  scroll-margin-top: calc(var(--header-h) + 32px);
}
.s-bio__aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.s-bio__spec { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.s-bio__spec dt { font-size: 14px; line-height: 20px; color: var(--muted); }
.s-bio__spec dd { margin: 0; font-size: 16px; line-height: 1.4; color: var(--text); }

.s-bio__main {
  display: flex;
  flex-direction: column;
  gap: 48px;
  max-width: 780px;
}
.s-bio__intro {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.s-bio__title { margin-bottom: 8px; }
.s-bio__group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.s-bio__heading { font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; font-weight: 600; }
.s-bio__events { display: flex; flex-direction: column; }
.s-bio__event {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 32px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 16px;
}
.s-bio__event-role { line-height: 1.4; color: var(--text); }
.s-bio__event-date {
  flex: none;
  font-size: 15px;
  line-height: 22px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.s-bio__event-clients { display: block; margin-top: 4px; color: var(--muted); font-size: 15px; line-height: 1.4; }
.s-bio__event-note { display: block; margin-top: 2px; color: var(--text-2); font-size: 15px; }
.s-bio__event-note:empty { display: none; }
.s-bio__lead-list { display: flex; flex-direction: column; gap: 12px; padding-left: 18px; list-style: disc; }
.s-bio__lead-list li::marker { color: var(--muted); }
.s-bio__more { font-size: 16px; }

/* =========================================================
   Contact
   ========================================================= */
.s-comms {
  display: flex;
  flex-direction: column;
  gap: 40px;
  scroll-margin-top: calc(var(--header-h) + 32px);
}
.s-comms__intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.s-comms__intro p { max-width: 36em; }
.s-comms__title { margin-bottom: 8px; }
.s-comms__intro .c-monitor { margin-top: 12px; }

/* Form */
.c-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}
.c-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.c-field__label { font-size: 15px; line-height: 20px; font-weight: 500; color: var(--text); }
.c-field__input {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;   /* 16px also stops iOS zooming on focus */
  line-height: 24px;
  transition: border-color var(--transition-fast);
}
.c-field__input::placeholder { color: var(--muted); opacity: 1; }
.c-field__input--area {
  height: 132px;
  min-height: 132px;
  resize: vertical;
}
.c-field__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.c-field__input[aria-invalid="true"] { border-color: var(--error); }
.c-field__error { font-size: 14px; line-height: 20px; color: var(--error); }
.c-form .c-btn[disabled] { opacity: 0.6; cursor: progress; }

/* Other ways to reach me, and the form's status lines */
.c-monitor__log {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text-2);
}
.c-monitor__log li { scroll-margin-bottom: calc(var(--footer-h) + 24px); overflow-wrap: anywhere; }
/* Form status lines (Sending…, sent, errors): a little apart from the contact details */
.c-monitor__log .is-event { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text); animation: log-in 240ms ease-out; }
.c-monitor__log .is-warn { color: var(--error); }
@keyframes log-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .c-monitor__log .is-event { animation: none; } }

/* =========================================================
   Terminal footer: a thin, quiet status line
   ========================================================= */
.c-terminal {
  position: sticky;
  bottom: 0;
  z-index: 20;
  min-height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 6px max(var(--content-pad), calc((100% - var(--content-max)) / 2));
  background: var(--bg);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
}
/* The terminal's input is visually hidden, so show focus on the whole bar */
.c-terminal:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.c-terminal__line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 12px;
  line-height: 18px;
}
.c-terminal__prompt { white-space: nowrap; }
.c-terminal__cmd {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Steady on purpose: nothing on the page loops on its own, so nothing needs a pause button */
.c-terminal__cursor {
  flex: none;
  width: 7px;
  height: 14px;
  background: var(--accent-2);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
  :root { --content-pad: 32px; }
  .c-header__nav ul { gap: 24px; }
  .s-bio { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; }
  .c-form { max-width: 560px; }
}

@media (max-width: 860px) {
  .s-bio { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  /* The header wraps to two rows here; anchor jumps back up the page land below it */
  :root { --content-pad: 16px; --header-h: 88px; }

  .c-header { padding: 10px 16px; justify-content: space-between; }
  /* Scrolling down tucks the top bar away, scrolling up brings it back (scripts/header-autohide.js).
     It stays focusable while tucked, so tabbing to a nav link slides it back in. :focus-visible, not
     :focus-within, so a link that keeps focus after a tap doesn't pin the bar open. */
  .c-header,
  .c-topbar { transition: transform 0.25s ease; }
  .c-header.is-tucked:not(:has(:focus-visible)),
  .c-topbar.is-tucked:not(:has(:focus-visible)) { transform: translateY(-100%); }
  .c-header__nav { order: 3; width: 100%; margin-left: 0; }
  .c-header__nav ul { justify-content: space-between; gap: 12px; }
  .c-nav-link { font-size: 15px; }

  .l-main { padding-top: 32px; }

  .s-bio__event { flex-direction: column; }
  .c-form .c-btn { align-self: stretch; }
  .c-terminal { padding: 6px 16px; }
}

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

/* =========================================================
   Footnotes (value estimate method) and small content helpers
   ========================================================= */
.c-fnref { font-size: 0.7em; line-height: 0; vertical-align: super; margin-left: 1px; }
.c-fnref a { color: var(--accent); text-decoration: none; padding: 0 2px; }
.c-fnref a:hover, .c-fnref a:focus-visible { text-decoration: underline; }
.c-footnote {
  display: flex; gap: 8px; max-width: 720px; margin-top: 12px;
  color: var(--muted); font-size: 14px; line-height: 20px;
  border-radius: var(--radius); outline-offset: 4px;
  scroll-margin-top: 96px;   /* a plain #fn- jump (the CV page) lands below the sticky back bar, not under it */
}
.c-footnote__n { flex: none; color: var(--muted); }
.c-footnote.is-flash { animation: c-footnote-flash 1.6s ease-out; }
@keyframes c-footnote-flash { 0%, 30% { background: var(--line); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .c-footnote.is-flash { animation: none; } }

/* =========================================================
   Case-study structure (shared by every project page)
   ========================================================= */
.c-glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0 32px;
  margin: 0;
}
.c-glance__item { padding: 12px 0; border-top: 1px solid var(--line); }
.c-glance__item:has([data-fact-todo]), .c-glance__item:has(dd > span:empty) { display: none; }
.c-glance dt { font-size: 14px; line-height: 20px; color: var(--muted); }
.c-glance dd { margin: 2px 0 0; font-size: 16px; line-height: 1.35; color: var(--text); }
/* Fact values like "a team of 8…" start lowercase so they also read mid-sentence; capitalize them here */
.c-glance dd::first-letter { text-transform: uppercase; }

/* My part in this (MyPart.astro): five questions, one line each */
.c-mypart__title { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.c-mypart__list { display: flex; flex-direction: column; margin: 16px 0 0; }
.c-mypart__row {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.c-mypart dt { font-size: 15px; line-height: 1.45; color: var(--muted); }
.c-mypart dd { margin: 0; font-size: 16px; line-height: 1.45; color: var(--text); }
@media (max-width: 600px) {
  .c-mypart__row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

.c-stats { display: flex; flex-wrap: wrap; gap: 24px 32px; }
.c-stat { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; }
.c-stat__value {
  font-weight: 500; font-size: clamp(30px, 3vw, 40px); line-height: 1.1;
  letter-spacing: -0.025em; color: var(--text);
}
/* The one key number */
.c-stat:first-child { flex: 2 1 300px; }
.c-stat:first-child .c-stat__value { color: var(--accent); font-size: clamp(40px, 5vw, 64px); line-height: 1; }
.c-stat__label { font-size: 15px; line-height: 1.4; }
.c-stats--signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 32px; }
.c-stats--signals .c-stat { padding: 12px 0; border-top: 1px solid var(--line); }
.c-stats--signals .c-stat__label { font-size: 16px; color: var(--text); }
.c-stats__secondary { margin-top: -8px; font-size: 15px; line-height: 22px; }
.c-stats__secondary > span:first-child { color: var(--text); font-weight: 600; }
.c-signals { display: flex; flex-direction: column; gap: 16px; }
.c-signals__title { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }

.c-case { display: flex; flex-direction: column; gap: 14px; max-width: 960px; }
.c-case > p { max-width: 720px; }
.c-case__title { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.c-case > p.c-case__insight { max-width: 34em; font-size: 21px; line-height: 1.4; letter-spacing: -0.005em; color: var(--text); }
.c-case__insight-label,
.c-case__insight .c-kicker { display: block; margin-bottom: 4px; font-size: 15px; letter-spacing: 0; color: var(--muted); }
.c-decisions {
  display: grid;
  /* Two wide columns read lighter than three narrow, tall ones; an odd last item spans the row */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
  margin-top: 12px;
}
.c-decision:last-child:nth-child(odd) { grid-column: 1 / -1; }
.c-decision {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 0 32px;
  border-top: 1px solid var(--line);
  font-size: 16px; line-height: 1.5;
}
.c-decision__n { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.c-decision__title { font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.c-decision__tradeoff { margin-top: auto; padding-top: 8px; color: var(--muted); }
.c-decision__tradeoff strong { color: var(--text); font-weight: 600; }
/* Prototype stills under a decision or in a gallery (Shot.astro). Items with stills take the full row. */
.c-decisions--shots { grid-template-columns: minmax(0, 1fr); }
.c-shots { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.c-shot { flex: 1 1 100%; min-width: 0; max-width: 800px; margin: 0; display: flex; flex-direction: column; gap: 8px; }   /* stills are 1600px: sharp on 2x screens */
.c-shot--phone { flex: 1 1 180px; max-width: 240px; }
.c-shot img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius);
  background: var(--surface);
}
.c-shot--phone img { border-radius: 16px; }
.c-shot figcaption { font-size: 14px; line-height: 20px; color: var(--muted); }
.c-proto-jump { align-self: flex-start; font-weight: 500; font-size: 16px; line-height: 24px; }
#prototype, #team-a11y { scroll-margin-top: 80px; }
.c-case.c-diagnostic { display: flex; }
.c-case.c-diagnostic .c-diagnostic__text { max-width: none; gap: 14px; }
.c-source { margin-left: 4px; font-size: 14px; line-height: 20px; color: var(--muted); }
.c-source[data-fact-todo], .c-source:empty { display: none; }
.c-case__link { align-self: flex-start; font-weight: 500; font-size: 17px; line-height: 24px; }

@media (max-width: 900px) {
  .c-decisions { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .c-stats--signals { grid-template-columns: minmax(0, 1fr); }
}

/* Team turnaround: placeholders + card thumbnail background (motion piece: prototype/turnaround.css) */
.c-placeholder[data-fact-todo] {
  display: inline-block; padding: 2px 8px;
  border: 1px dashed var(--field-line); border-radius: var(--radius);
  color: var(--muted); font-style: italic;
}
.c-project-media--turnaround { display: grid; place-items: center; }

/* Prototype walkthrough stills + PROPOSED tag on design notes */
.c-walk { display: flex; flex-direction: column; gap: 12px; }
.c-walk__video video { display: block; width: 100%; max-width: 960px; border-radius: var(--radius); background: #000; }
.c-walk__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 1100px; }
.c-walk__list--phone { max-width: 760px; }
.c-walk__item figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.c-walk__item img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius);
  background: var(--surface);
}
.c-walk__item figcaption { display: flex; gap: 8px; font-size: 14px; line-height: 20px; color: var(--muted); }
.c-walk__n { flex: none; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .c-walk__list--wide { grid-template-columns: minmax(0, 1fr); }
  .c-walk__list--phone { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .c-walk__list--phone figcaption { font-size: 12px; line-height: 16px; }
  .c-walk__list--phone .c-walk__n { display: none; }
}
.c-proposed { margin-left: 6px; font-size: 13px; line-height: 16px; color: var(--muted); }

/* Quotes ("What collaborators say") */
.s-quotes { display: flex; flex-direction: column; gap: clamp(32px, 4vw, 48px); }
.s-quotes[hidden] { display: none; }
/* One scrollable row; each quote is as tall as its text, and the next one peeks in to show there is more */
.s-quotes__list {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(82%, 400px); align-items: start; gap: 40px;
  margin: 0; padding: 0 0 8px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.s-quotes__list::-webkit-scrollbar { display: none; }
.s-quotes__list:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.s-quotes__item { scroll-snap-align: start; }
.s-quotes__nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: -8px; }
.s-quotes__nav[hidden] { display: none; }
.s-quotes__arrow {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--field-line); background: transparent; color: var(--text);
  transition: border-color 150ms, opacity 150ms;
}
.s-quotes__arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.s-quotes__arrow:hover:not(:disabled) { border-color: var(--text); }
.s-quotes__arrow:disabled { opacity: .4; cursor: default; }
.s-quotes__item figure,
.c-pullquote figure { margin: 0; display: flex; flex-direction: column; gap: 16px; }
.s-quotes__item blockquote,
.c-pullquote blockquote { margin: 0; flex: 1; }
.s-quotes__item blockquote p,
.c-pullquote blockquote p { font-size: 18px; line-height: 1.45; color: var(--text); }
.s-quotes__item blockquote p::before,
.c-pullquote blockquote p::before { content: '“'; }
.s-quotes__item blockquote p::after,
.c-pullquote blockquote p::after { content: '”'; }
.s-quotes__item figcaption,
.c-pullquote figcaption { display: flex; flex-direction: column; }
.s-quotes__name { font-weight: 600; font-size: 15px; line-height: 22px; color: var(--text); }
.s-quotes__meta { font-size: 14px; line-height: 20px; color: var(--muted); }

/* Protected case studies (case-lock.js) */
.c-lock { max-width: 960px; }
.c-lock__card { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 620px; padding: 32px; border-radius: var(--radius); background: var(--surface); }
.c-lock__icon { width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.c-lock__title { font-size: 24px; line-height: 1.25; letter-spacing: -0.015em; }
.c-lock__text { font-size: 16px; line-height: 1.5; }
.c-lock__form { display: grid; grid-template-columns: 1fr; gap: 14px; width: 100%; }
.c-lock__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.c-lock__tag { margin-left: 4px; font-size: 13px; font-weight: 400; color: var(--muted); }
.c-lock__rule { width: 100%; height: 0; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.c-lock__note { margin-top: -4px; font-size: 14px; line-height: 20px; color: var(--muted); }
.c-lock__submit { justify-self: start; }
.c-lock__msg { min-height: 20px; font-size: 14px; line-height: 20px; color: var(--muted); }
.c-lock__msg.is-error { color: var(--error); }
@media (max-width: 480px) { .c-lock__card { padding: 22px; } }

/* Welcome-back note for returning visitors (case-lock.js) */
.c-welcome {
  position: fixed; right: 24px; bottom: calc(var(--footer-h) + 20px); z-index: 30; width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 18px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--field-line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  opacity: 0; transform: translateY(12px); transition: opacity 300ms ease, transform 300ms cubic-bezier(.2, .7, .2, 1);
}
.c-welcome.is-in { opacity: 1; transform: none; }
.c-welcome__title { font-weight: 600; font-size: 18px; line-height: 24px; color: var(--text); }
.c-welcome__text { font-size: 15px; line-height: 22px; color: var(--text); padding-right: 16px; }
.c-welcome__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.c-welcome__close { position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.c-welcome__close:hover { color: var(--text); background: var(--line); }
@media (prefers-reduced-motion: reduce) { .c-welcome { transition: none; } }
@media (max-width: 640px) { .c-welcome { right: 16px; } }

/* Library of agent skills (/library/): a shelf per group, a row per skill */
.c-shelf { display: flex; flex-direction: column; gap: 8px; }
.c-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 0 32px; margin: 16px 0 0; padding: 0; list-style: none; }
.c-skill { display: flex; flex-direction: column; gap: 6px; padding: 14px 0 28px; border-top: 1px solid var(--line); }
.c-skill__name { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.c-skill__what { font-size: 16px; line-height: 1.45; }
.c-skill__btn { align-self: flex-start; margin-top: 8px; padding: 8px 16px; font-size: 15px; }
/* A step's download is a plain link; only the group's lead skill keeps a real button */
.c-btn--ghost.c-skill__btn {
  margin-top: auto; padding: 8px 0 0; border: 0; border-radius: 0;
  color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.c-btn--ghost.c-skill__btn:hover { color: var(--text); }
.c-skill__file { font-family: var(--font-mono); font-size: 12px; line-height: 18px; color: var(--muted); overflow-wrap: anywhere; }
/* The lead skill runs the rest of its group: a full-width row above them, its steps linked */
/* Its steps sit two by two so the four read as a set, not three and a straggler */
.c-skills--steps { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.c-skill--lead { grid-column: 1 / -1; }
.c-skill--lead .c-skill__name { font-size: 23px; }
.c-skill__runs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 16px; line-height: 1.45; color: var(--muted); }
/* Each arrow stays with the link before it, so a wrapped line never starts with one */
.c-skill__steps { display: inline-flex; align-items: center; gap: 8px; }
.c-skill__step { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; white-space: nowrap; }
.c-skill__step:hover { color: var(--text); }
.c-skill__part { font-size: 14px; line-height: 20px; color: var(--muted); }
.c-skill:target { border-top-color: var(--text); }
.c-skills > [id] { scroll-margin-top: 80px; }
.c-steps { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; padding-left: 22px; }
.c-steps li { padding-left: 4px; }

/* Accessibility before/after (case study 05): real component colors, redrawn; ratios computed from the hex values */
.c-a11y { margin: 16px 0 0; }
.c-a11y__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.c-a11y__cell { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius); }
.c-a11y__tag { font-size: 13px; opacity: .8; }
.c-a11y__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.c-a11y__chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; line-height: 18px; }
.c-a11y__chip i { width: 7px; height: 7px; border-radius: 50%; }
.c-a11y__btn { display: inline-flex; align-items: center; padding: 9px 18px; border-radius: 8px; color: #ffffff; font-size: 14px; font-weight: 600; line-height: 20px; }
.c-a11y + .c-a11y { margin-top: 20px; }
.c-a11y__ratio { font-size: 13px; font-weight: 600; }
.c-a11y__cell .is-pass { color: #096433; }
.c-a11y__cell .is-fail { color: #ac1138; }
.c-a11y__cell[style*="#222224"] .is-pass { color: #9fd8b1; }
.c-a11y__cell[style*="#222224"] .is-fail { color: #ff9db0; }
.c-a11y figcaption { margin-top: 10px; font-size: 14px; line-height: 20px; color: var(--muted); }
.c-a11y__alert { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.c-a11y__h { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.c-a11y__alert ul { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.c-a11y__alert li { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.c-a11y__alert b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.c-a11y__alert .is-fail { color: var(--error); }
.c-a11y__alert .is-warn { color: var(--text); }
.c-a11y__alert p { font-size: 14px; color: var(--muted); }
@media (max-width: 640px) { .c-a11y__grid { grid-template-columns: minmax(0, 1fr); } }

/* Case-study pull quote (FACTS.quotes by id) */
.c-pullquote { max-width: 760px; }
.c-pullquote[hidden] { display: none; }
.c-pullquote blockquote p { font-size: 22px; line-height: 1.4; letter-spacing: -0.005em; }

/* Play/pause button on the looping card animations (motionToggle in motion-toggle.js). It sits beside the card link,
   over the image's top-right corner. */
.c-motion-host { position: relative; }
.c-motion-btn {
  position: absolute; z-index: 2; width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border-radius: var(--radius); border: 0; background: rgba(19, 18, 22, .78);
  color: #eceaf1; cursor: pointer;
  transition: background-color var(--transition-fast);
}
.c-motion-btn svg { width: 14px; height: 14px; fill: currentColor; }
.c-motion-btn .c-motion-btn__pause, .c-motion-btn.is-playing .c-motion-btn__play { display: none; }
.c-motion-btn.is-playing .c-motion-btn__pause { display: inline; }
.c-motion-btn:hover { background: rgba(19, 18, 22, .95); }
@media (pointer: coarse) { .c-motion-btn { width: 40px; height: 40px; } .c-motion-btn svg { width: 16px; height: 16px; } }

/* =========================================================
   Grid: 13 columns, split on the golden ratio
   Every page shares one content column: --content-max wide, inside the --content-pad gutter, centred. It has 13 columns
   and a 24px gap, so the golden split falls on a column line: 5 | 8 (and 2 | 3, 3 | 5 inside those). The major line,
   after column 5 (5/13, about 38.2%), is the site's vertical axis: the meta column (photo, labels, facts, contact
   details) sits in columns 1–5, the reading column (paragraphs, forms, quotes) in 6–13, and big headlines start at
   column 1 and may span. Under 900px everything collapses to one column on the same left edge.
   The terminal's `grid` command (or Shift+G) shows it: scripts/grid-overlay.js.
   ========================================================= */
:root {
  --grid-cols: 13;
  --grid-gap: 24px;
  --meta: 1 / span 5;
  --read: 6 / -1;
  --full: 1 / -1;
}
/* Inner pages share the home page's content column and left edge */
.c-topbar__inner { max-width: calc(var(--content-max) + var(--content-pad) * 2); padding: 12px var(--content-pad); }
html[data-mode="focus"] .l-main { max-width: none; padding-left: var(--content-pad); padding-right: var(--content-pad); }

@media (min-width: 900px) {
  /* Widths in columns, measured against the content column: 8 columns is the reading measure */
  .v-view { container-type: inline-size; }
  .v-view { --col: calc((100cqw - 12 * var(--grid-gap)) / 13); --w8: calc(var(--col) * 8 + var(--grid-gap) * 7); --read-x: calc(var(--col) * 5 + var(--grid-gap) * 5); }

  .s-hero__potion, .s-hero__summary, .c-section-header, .v-project__header, .v-project__sub { max-width: var(--w8); }

  /* Home: the one place that breaks 5 | 8. Work is two equal cards a row, split on the centre of column 7, so every
     picture is the same size and every title starts on the same line. The wide card keeps that split: text, then scene. */
  .s-work__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px var(--grid-gap); max-width: none; }
  .s-work__grid > li { grid-column: auto; display: grid; grid-template-rows: subgrid; grid-row: span 2; }
  .c-project-card { display: grid; grid-template-rows: subgrid; grid-row: span 2; gap: 16px; }
  .c-project-card .c-project-media { aspect-ratio: 378 / 220; }
  .s-work__grid > .s-work__wide, .s-work__grid > li:has(> .c-project-card--wide) { grid-column: 1 / -1; display: block; grid-row: auto; }
  .c-project-card--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; column-gap: var(--grid-gap); align-items: end; }
  .c-project-card--wide .c-project-media { grid-column: 2; grid-row: 1; flex: none; align-self: start; }
  .c-project-card--wide .c-project-card__body { grid-column: 1; grid-row: 1; justify-content: flex-end; }

  /* Bands, About and Contact: title or meta in the 5, reading in the 8 */
  .c-library-teaser, .c-diagnostic--band, .s-bio, .s-comms, .c-shelf, .v-project__body {
    display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); column-gap: var(--grid-gap); align-items: start;
  }
  .c-library-teaser__text, .c-diagnostic--band .c-diagnostic__text {
    grid-column: var(--full); display: grid; grid-template-columns: subgrid; column-gap: var(--grid-gap); max-width: none; row-gap: 8px;
  }
  .c-library-teaser__title, .c-diagnostic__title { grid-column: var(--meta); grid-row: span 2; }
  .c-library-teaser__desc, .c-diagnostic--band .c-diagnostic__text > p { grid-column: var(--read); }
  .c-library-teaser > .c-btn, .c-diagnostic--band > .c-btn { grid-column: var(--read); justify-self: start; }
  .s-bio__aside { grid-column: var(--meta); }
  .s-bio__main { grid-column: var(--read); max-width: none; }
  .s-bio__exp .s-bio__event { flex-direction: column; gap: 2px; }   /* the 5 is narrow: dates go under the role */
  .s-comms__intro { grid-column: var(--meta); }
  .c-form { grid-column: var(--read); grid-row: 1; max-width: none; }

  /* Case studies and the Library: section titles and project facts in the 5, everything you read in the 8 */
  .v-project__body { max-width: none; grid-auto-flow: row dense; }
  .v-project__body > * { grid-column: var(--read); }
  .v-project__body > .c-glance { grid-column: var(--meta); grid-row: span 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v-project__body > .c-case, .v-project__body > .c-mypart, .v-project__body > .c-signals, .v-project__body > .c-shelf, .c-case.c-diagnostic .c-diagnostic__text {
    grid-column: var(--full); display: grid; grid-template-columns: subgrid; column-gap: var(--grid-gap); max-width: none;
  }
  .c-case > *, .c-mypart > *, .c-signals > *, .c-case.c-diagnostic .c-diagnostic__text > * { grid-column: var(--read); }
  .c-case > .c-case__title, .c-mypart > .c-mypart__title, .c-signals > .c-signals__title, .c-diagnostic__text > .c-case__title { grid-column: var(--meta); }
  .c-case > p, .c-case > p.c-case__insight { max-width: none; }
  .c-project-media--hero, .c-unity { max-width: none; }
  .c-lock, .v-project__footer { margin-left: var(--read-x); max-width: none; }
  .c-shelf > .c-case__title { grid-column: var(--meta); grid-row: span 2; }
  .c-shelf > .c-shelf__intro, .c-shelf > .c-skills { grid-column: var(--read); }
  /* Two-up lists inside the 8 split it 4 | 4, on column 10 */
  .c-decisions, .c-skills { column-gap: var(--grid-gap); }
}

/* Grid overlay (scripts/grid-overlay.js): the 13 columns and the golden line, drawn over the page without catching clicks */
.c-grid-overlay { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.c-grid-overlay[hidden] { display: none; }
.c-grid-overlay__cols {
  display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); column-gap: var(--grid-gap);
  height: 100%; max-width: var(--content-max); margin: 0 auto; box-sizing: content-box; padding: 0 var(--content-pad);
}
.c-grid-overlay__cols > i { background: color-mix(in srgb, var(--accent) 9%, transparent); border-left: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-right: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.c-grid-overlay__cols > i:nth-child(6) { position: relative; border-left: 2px solid var(--accent); }
.c-grid-overlay__label {
  position: absolute; left: 6px; top: calc(var(--header-h) + 8px); white-space: nowrap;
  padding: 1px 6px; border-radius: var(--radius); background: var(--bg); color: var(--accent);
  font-family: var(--font-mono); font-size: 11px; line-height: 18px;
}
@media (max-width: 899px) {
  .c-grid-overlay__cols { grid-template-columns: minmax(0, 1fr); }
  .c-grid-overlay__cols > i:not(:first-child) { display: none; }
  .c-grid-overlay__cols > i:first-child .c-grid-overlay__label { display: none; }
}

/* Quotes: the last column fades to the page, so a quote running off the edge reads as "more to scroll", not as clipped.
   The fade lifts once the row is scrolled to its end (quotes.js sets data-end). */
@media (min-width: 900px) {
  .s-quotes__list { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--col)), transparent); mask-image: linear-gradient(to right, #000 calc(100% - var(--col)), transparent); }
  .s-quotes__list[data-end] { -webkit-mask-image: none; mask-image: none; }
}

/* About below 900px: one column in reading order (about, how I lead, focus, experience) */
@media (max-width: 899px) {
  .s-bio { display: flex; flex-direction: column; gap: 48px; }
  .s-bio__aside, .s-bio__main { display: contents; }
  .s-bio__intro { order: 1; }
  .s-bio__lead { order: 2; }
  .s-bio__spec { order: 3; }
  .s-bio__exp { order: 4; }
}

/* =========================================================
   Off the clock (/whoami/): the same grid, looser and warmer. Fun & Games two-up, then photos as square tiles.
   ========================================================= */
.v-me { display: flex; flex-direction: column; gap: clamp(64px, 8vw, 112px); }
.s-me { display: flex; flex-direction: column; gap: 32px; }
.s-me__text { display: flex; flex-direction: column; gap: 16px; }
.s-me__text > p:last-child { max-width: 36em; font-size: 18px; line-height: 1.6; }
.s-me__section { display: flex; flex-direction: column; gap: 24px; }

/* Photos: square tiles on the grid, two a row on the same split as Work (through the middle of column 7) */
.c-gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--grid-gap); margin: 0; padding: 0; list-style: none; }
.c-gallery__link { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface); }
.c-gallery__link img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.c-gallery__link:hover img { transform: scale(1.015); }
.c-gallery__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Each card is two rows of a shared subgrid, so names line up across a row even when one card has no glimpse */
.c-side-projects { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px var(--grid-gap); margin: 0; padding: 0; list-style: none; }
.c-side-projects > li, .c-side-project { display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: 16px; }
.c-side-project { color: inherit; text-decoration: none; }
.c-side-project__body { grid-row: 2; }
/* One frame shape for every glimpse; the whole picture shows, never cropped */
.c-side-project__glimpse { overflow: hidden; aspect-ratio: 16 / 10; border-radius: 12px; background: var(--surface); }
.c-side-project__glimpse img, .c-side-project__glimpse video { display: block; width: 100%; height: 100%; object-fit: contain; }
.c-side-project__name { display: flex; align-items: baseline; gap: 12px; font-size: 22px; line-height: 1.25; }
a.c-side-project:hover .c-side-project__name { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.c-side-project__status { padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; line-height: 20px; font-weight: 400; color: var(--muted); }
.c-side-project__line { font-size: 16px; line-height: 1.5; color: var(--text-2); }

@media (min-width: 900px) {
  .s-me { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); column-gap: var(--grid-gap); align-items: start; }
  .s-me__text { grid-column: 1 / span 8; }
  .c-side-projects, .c-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Lightbox */
.c-lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #f2f0f7; }
.c-lightbox::backdrop { background: rgb(8 8 12 / 0.94); }
.c-lightbox[open] { display: grid; place-items: center; }
.c-lightbox__figure { display: grid; place-items: center; margin: 0; padding: 16px 72px; width: 100%; height: 100%; box-sizing: border-box; }
.c-lightbox__img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; user-select: none; -webkit-user-drag: none; }
.c-lightbox__btn {
  position: fixed; display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid rgb(255 255 255 / 0.25); border-radius: 999px; background: rgb(20 20 26 / 0.7); color: #f2f0f7;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.c-lightbox__btn:hover { border-color: #f2f0f7; }
.c-lightbox__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-lightbox__btn[hidden] { display: none; }
.c-lightbox__close { top: 12px; right: 12px; }
.c-lightbox__prev { left: 12px; top: 50%; translate: 0 -50%; }
.c-lightbox__next { right: 12px; top: 50%; translate: 0 -50%; }
@media (max-width: 600px) {
  .c-lightbox__figure { padding: 64px 0; }
  .c-lightbox__prev, .c-lightbox__next { top: auto; bottom: 12px; translate: none; }
}
