/* ==========================================================================
   PEDRO DINIZ .DESIGN — Swiss grid / dark / CRT-UX
   --------------------------------------------------------------------------
   1. Tokens          5. Header + nav      9. Project cards + filter
   2. Reset/base      6. Buttons (CRT)    10. Project page
   3. Grid system     7. Hero             11. Footer
   4. Typography      8. Sections         12. Lightbox, utilities, motion
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
:root {
  /* Colour — dark neutral + one phosphor accent */
  --c-bg:        #0a0b0a;
  --c-surface:   #111311;
  --c-surface-2: #181b18;
  --c-line:      #262a26;
  --c-line-2:    #3a3f3a;
  --c-ink:       #e9e7e0;
  --c-muted:     #8b918a;
  --c-accent:    #a67c00;          /* CRT amber */
  --c-accent-dim:#533e00;
  --c-on-accent: #140c00;
  --glow:        0 0 6px rgba(166,124,0,.55), 0 0 18px rgba(166,124,0,.18);

  /* Type — Michroma (titles/headings, single 400 weight) + Inconsolata (body/UI) */
  --f-display: "Michroma", "Eurostile", "Arial Black", sans-serif;
  --f-body:    "Inconsolata", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Fluid type scale (min @ 360px → max @ 1440px).
     Michroma is very wide, so heading steps are tighter than a grotesk would need. */
  --t-xs:   clamp(0.80rem, 0.78rem + 0.10vw, 0.86rem);
  --t-sm:   clamp(0.90rem, 0.87rem + 0.14vw, 1rem);
  --t-base: clamp(1.05rem, 1rem    + 0.23vw, 1.2rem);
  --t-md:   clamp(1.05rem, 0.98rem + 0.32vw, 1.3rem);
  --t-lg:   clamp(1.25rem, 1.05rem + 0.90vw, 1.95rem);
  --t-xl:   clamp(1.5rem,  1.12rem + 1.60vw, 2.6rem);
  --t-xxl:  clamp(1.8rem,  0.95rem + 4.20vw, 5.4rem);

  /* Grid + spacing — one 8px base, one container padding everywhere */
  --cols: 12;
  --gutter: clamp(16px, 1.2rem + 0.6vw, 32px);
  --pad-x:  clamp(16px, 4vw, 64px);          /* container side padding */
  --pad-y:  clamp(64px, 5rem + 4vw, 160px);  /* section vertical padding */
  --max:    1440px;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px;

  --header-h: 64px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* 2. RESET / BASE ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--c-accent); color: var(--c-on-accent); }

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  box-shadow: var(--glow);
}

/* CRT scanline + vignette overlay (global, non-interactive) */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.35) 100%);
  mix-blend-mode: overlay;
}

/* Custom scrollbar — minimal black & white, square like the rest of the UI.
   WebKit/Blink (Chrome, Edge, Safari) get the full treatment incl. hover;
   Firefox gets the standard thin black/white version. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #000; border-left: 1px solid var(--c-line); }
::-webkit-scrollbar-thumb {
  background: #e9e7e0;
  border: 3px solid #000;                 /* inset so the bar reads as a thin 4px line */
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: #fff; border-width: 2px; }
::-webkit-scrollbar-thumb:active { background: #fff; border-width: 1px; }
::-webkit-scrollbar-corner { background: #000; }
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-width: thin; scrollbar-color: #e9e7e0 #000; }
}

/* Optional page background: thin 1px grey square grid (used on portfolio.html) */
body.bg-grid {
  --grid-size: 32px;                       /* desktop */
  --grid-line: #0f0f0f;
  background-color: var(--c-bg);
  background-image:
    linear-gradient(to right,  var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: center top;
}
@media (max-width: 767.98px) { body.bg-grid { --grid-size: 21px; } }  /* same 2:3 step-down as before (48→32) */

.skip-link {
  position: absolute; left: var(--pad-x); top: -100px; z-index: 200;
  font-family: var(--f-body); font-size: var(--t-sm);
  background: var(--c-accent); color: var(--c-on-accent); padding: var(--s1) var(--s2);
}
.skip-link:focus { top: var(--s2); }

/* 3. GRID SYSTEM ----------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--s5);
}
/* Mobile first: every child spans full width */
.grid > * { grid-column: 1 / -1; }

@media (min-width: 768px) {
  /* span lives on the END line so .start-N can set the start independently */
  .span-3  { grid-column: auto / span 3; }
  .span-4  { grid-column: auto / span 4; }
  .span-5  { grid-column: auto / span 5; }
  .span-6  { grid-column: auto / span 6; }
  .span-7  { grid-column: auto / span 7; }
  .span-8  { grid-column: auto / span 8; }
  .span-12 { grid-column: 1 / -1; }
  .start-5 { grid-column-start: 5; }
  .start-6 { grid-column-start: 6; }
}

/* 4. TYPOGRAPHY ------------------------------------------------------------ */
.label, .mono {
  font-family: var(--f-body);
  font-size: var(--t-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-muted);
}
/* All titles + headings use Michroma. It ships one weight (400): never fake-bold it. */
h1, h2, h3, h4,
.h-display, .h-1, .h-2, .h-3,
.brand__text, .card__title, .pillar__title, .footer__name {
  font-family: var(--f-display);
  font-weight: 400;
}
.h-display {
  font-size: var(--t-xxl);
  line-height: 1.05;
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.h-1 { font-size: var(--t-xl); line-height: 1.1;  letter-spacing: -.005em; }
.h-2 { font-size: var(--t-lg); line-height: 1.25; }
.h-3 { font-size: var(--t-md); line-height: 1.35; }
/* Headings that are really UI labels stay in the body face */
h4.label { font-family: var(--f-body); }
.lede { font-size: var(--t-md); line-height: 1.45; max-width: 52ch; }
.prose { max-width: 64ch; color: var(--c-ink); }
.prose p + p { margin-top: 1em; }
.muted { color: var(--c-muted); }
.accent { color: var(--c-accent); }

/* 5. HEADER + NAV ---------------------------------------------------------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  background: rgba(10,11,10,.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.site-header .container {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 28px; height: 28px; }
.brand__text {
  font-size: var(--t-xs);
  letter-spacing: .04em; line-height: 1.1;
}
.brand__text span { color: var(--c-muted); }

.nav__list { display: flex; gap: 4px; }
.nav__link {
  display: inline-flex; align-items: center;
  font-family: var(--f-body); font-size: var(--t-sm);
  letter-spacing: .06em; text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid transparent;
  color: var(--c-muted);
  transition: color .15s, border-color .15s, background .15s;
}
.nav__link::before { content: "["; opacity: 0; margin-right: 4px; transition: opacity .15s; }
.nav__link::after  { content: "]"; opacity: 0; margin-left: 4px;  transition: opacity .15s; }
.nav__link:hover { color: var(--c-accent); text-shadow: var(--glow); }
.nav__link:hover::before, .nav__link:hover::after { opacity: 1; }
.nav__link[aria-current="page"] {
  color: var(--c-on-accent); background: var(--c-accent); box-shadow: var(--glow);
}
.nav__link[aria-current="page"]::before,
.nav__link[aria-current="page"]::after { opacity: 1; }

.nav-toggle {
  display: none;
  font-family: var(--f-body); font-size: var(--t-sm); letter-spacing: .08em;
  padding: 8px 12px; border: 1px solid var(--c-line-2);
}
.nav-toggle .cursor { animation: blink 1s steps(1) infinite; }

@media (max-width: 767.98px) {
  .nav-toggle { display: inline-flex; gap: 2px; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: var(--c-bg); border-bottom: 1px solid var(--c-line);
    padding: var(--s2) var(--pad-x) var(--s4);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s .2s;
  }
  .nav.is-open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__link { width: 100%; padding: var(--s2) 0; border-bottom: 1px solid var(--c-line); font-size: var(--t-base); }
  .nav__link[aria-current="page"] { padding-inline: var(--s2); }
}

/* 6. BUTTONS (CRT) --------------------------------------------------------- */
.btn {
  --b: var(--c-accent);
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-body); font-size: var(--t-sm); font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 20px;
  color: var(--b);
  border: 1px solid var(--b);
  background: transparent;
  text-shadow: 0 0 6px rgba(166,124,0,.45);
  box-shadow: inset 0 0 0 0 var(--b);
  transition: color .12s, background .12s, box-shadow .12s;
}
.btn::before { content: ">"; }
.btn::after  { content: "_"; animation: blink 1s steps(1) infinite; }
.btn:hover, .btn:focus-visible {
  color: var(--c-on-accent); background: var(--b); text-shadow: none; box-shadow: var(--glow);
}
.btn:active { transform: translateY(1px); }
.btn--ghost { --b: var(--c-ink); text-shadow: none; }
.btn--ghost:hover { color: var(--c-bg); }

/* Filter chips share the CRT language */
.chip {
  font-family: var(--f-body); font-size: var(--t-xs);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 10px 14px;
  border: 1px solid var(--c-line-2);
  color: var(--c-muted);
  transition: color .12s, border-color .12s, background .12s;
}
.chip:hover { color: var(--c-accent); border-color: var(--c-accent); text-shadow: var(--glow); }
.chip[aria-pressed="true"] {
  color: var(--c-on-accent); background: var(--c-accent);
  border-color: var(--c-accent); box-shadow: var(--glow); text-shadow: none;
}

@keyframes blink { 50% { opacity: 0; } }

/* 7. HERO ------------------------------------------------------------------ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;          /* intro centred in the image viewport */
  padding: calc(var(--header-h) + var(--s4)) 0 var(--s4);
  background: #000 url("../assets/phd27-sit-texture-studio-dark-mobile-01.webp") center / cover no-repeat;
  border-bottom: 1px solid var(--c-line);
  isolation: isolate;
}
@media (min-width: 768px) {
  .hero { background-image: url("../assets/phd27-sit-texture-studio-dark-01.webp"); }
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at center, rgba(10,11,10,.55) 0%, rgba(10,11,10,.25) 55%, transparent 80%),
    linear-gradient(180deg, rgba(10,11,10,.2) 0%, rgba(10,11,10,.35) 70%, var(--c-bg) 100%);
}
.hero__inner {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(24px, 5vh, 56px);
  text-align: center;
}
.hero__lottie {
  width: clamp(120px, 14vw, 183px);
  aspect-ratio: 300 / 482;                     /* matches the Lottie composition */
  max-height: 42svh;
  display: grid; place-items: center;
}
.hero__lottie svg { width: 100% !important; height: 100% !important; }
.hero__lottie-fallback { width: 100%; height: auto; }
.hero__lottie.is-ready .hero__lottie-fallback { display: none; }
.hero__title {
  font-size: clamp(1.5rem, 1.1rem + 1.9vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* 8. SECTIONS -------------------------------------------------------------- */
.section { padding-block: var(--pad-y); border-bottom: 1px solid var(--c-line); }
.section__head {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0,1fr));
  column-gap: var(--gutter); row-gap: var(--s2);
  padding-bottom: var(--s4); margin-bottom: var(--s5);
  border-bottom: 1px solid var(--c-line);
}
.section__head > * { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .section__head .label { grid-column: 1 / span 3; padding-top: .6em; }
  /* Offset the heading only when a label sits in the left columns */
  .section__head .label ~ .h-2,
  .section__head .label ~ .h-1 { grid-column: 4 / -1; }
}

/* Intro (Howdy) — image and copy sit side by side, vertically centred on each other */
.intro { align-items: center; row-gap: var(--s5); }          /* phone: room for the bubble's up-tail */
.intro__media { display: flex; justify-content: center; }
.intro__body { text-align: center; }
.intro__body .lede { margin-inline: auto; }
@media (min-width: 768px) {
  /* circle + gap + bubble travel as one block, centred on the page */
  .intro { display: flex; justify-content: center; align-items: center; column-gap: clamp(48px, 4vw + 16px, 80px); }
  .intro__media { flex: 0 0 clamp(154px, 17.5vw, 252px); }   /* 30% smaller than before (220–360px) */
  .intro__body { flex: 0 1 600px; text-align: left; }
  .intro__body .lede { margin-inline: 0; }
}
.intro__portrait {
  aspect-ratio: 1 / 1; width: 100%; max-width: 252px;
  object-fit: contain;                      /* transparent PNG-style art: no frame */
}
.intro__body .h-1 { margin-bottom: var(--s3); }

/* Speech bubble (from the original site): black box, 1px light outline, square corners,
   triangular tail pointing at the portrait — up on phones, left once they sit side by side.
   The tail is two stacked triangles: a light one (outline) and a black one 1px smaller (fill). */
.bubble {
  --bubble-line: #e9e7e0;
  --tail: 20px;
  position: relative;
  background: #000;
  border: 1px solid var(--bubble-line);
  padding: var(--s4) clamp(var(--s3), 3vw, var(--s5));
}
.bubble::before,
.bubble::after {
  content: ""; position: absolute; width: 0; height: 0;
  border-style: solid; border-color: transparent;
}
.bubble::before {                                   /* outline triangle, pointing up */
  top: calc(var(--tail) * -1); left: 50%; transform: translateX(-50%);
  border-width: 0 var(--tail) var(--tail);
  border-bottom-color: var(--bubble-line);
}
.bubble::after {                                    /* fill triangle, covers the box border under the tail */
  top: calc((var(--tail) - 1.4px) * -1); left: 50%; transform: translateX(-50%);
  border-width: 0 calc(var(--tail) - 1.4px) calc(var(--tail) - 1.4px);
  border-bottom-color: #000;
}
@media (min-width: 768px) {
  .bubble::before {                                 /* pointing left, vertically centred */
    top: 50%; left: calc(var(--tail) * -1); transform: translateY(-50%);
    border-width: var(--tail) var(--tail) var(--tail) 0;
    border-color: transparent var(--bubble-line) transparent transparent;
  }
  .bubble::after {
    top: 50%; left: calc((var(--tail) - 1.4px) * -1); transform: translateY(-50%);
    border-width: calc(var(--tail) - 1.4px) calc(var(--tail) - 1.4px) calc(var(--tail) - 1.4px) 0;
    border-color: transparent #000 transparent transparent;
  }
}

/* Typed text: JS stacks a hidden full-length "ghost" under the live text so the bubble
   is sized from the start and nothing jumps while typing. */
.typed { display: grid; }
.typed__ghost, .typed__live { grid-area: 1 / 1; }
.typed__ghost { visibility: hidden; }
.typed__caret {
  display: inline; margin-left: .15em;              /* inline (not inline-block) so it never wraps away from the last word */
  color: var(--c-accent); font-weight: 700;
  animation: blink 1s steps(1) infinite;
}
.typed.is-typing .typed__caret { animation: none; }   /* solid while "typing", blinks once done */

/* Lifecycle pipeline ([data-pipe], home) — the section is ~3 screens tall and its stage pins
   under the fixed header while scroll drives an amber rail from Concept to Deliverable;
   each third of the scroll swaps the stage title, list and circular image. */
.lifecycle { height: 200vh; padding-block: 0; position: relative; }   /* ~1 screen of scroll while pinned (a third per stage) */
.lifecycle__stage {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h)); height: calc(100svh - var(--header-h));
  display: grid; grid-template-rows: auto 1fr auto; padding-block: var(--s5) var(--s4);
}
.lifecycle__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gutter); align-items: center; min-height: 0; }
.lifecycle__copy { display: grid; }                          /* panels share one cell; the column sizes to the tallest */
.lifecycle__panel {
  grid-area: 1 / 1; align-self: center; pointer-events: none;
  opacity: 0; transform: translateY(24px); transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.lifecycle__panel.is-on { opacity: 1; transform: none; pointer-events: auto; }
.lifecycle__title {
  font-size: clamp(2.25rem, 5.6vw, 4.5rem); line-height: 1.05;
  color: var(--c-accent); text-shadow: var(--glow); margin-bottom: clamp(16px, 2.4vw, 28px);
}
.lifecycle__list li { font-size: clamp(1.15rem, 1.6vw, 1.375rem); line-height: 1.7; padding-left: 1.4em; text-indent: -1.4em; }
.lifecycle__list li::before { content: "> "; color: var(--c-accent); }
/* circular image, centred in its column and level with the copy; thin outer orbit ring */
.lifecycle__media {
  position: relative; justify-self: center; aspect-ratio: 1;
  width: min(100%, 52vh, 520px); border-radius: 50%; overflow: hidden;
  border: 1px solid var(--c-line-2); box-shadow: 0 0 0 10px var(--c-bg), 0 0 0 11px var(--c-line);
}
.lifecycle__media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.12); transition: opacity .7s var(--ease), transform 1.2s var(--ease);
}
.lifecycle__media img.is-on { opacity: 1; transform: scale(1); }
.lifecycle__rail { margin-top: var(--s4); }
.lifecycle__ends { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: var(--t-xs); letter-spacing: .14em; text-transform: uppercase; color: var(--c-muted); }
.lifecycle__track { position: relative; height: 1px; background: var(--c-line-2); }
.lifecycle__fill { position: absolute; left: 0; top: 0; height: 1px; width: 0; background: var(--c-accent); box-shadow: var(--glow); }
.lifecycle__fill::after { content: ""; position: absolute; right: -5px; top: -5px; width: 11px; height: 11px; border-radius: 50%; background: var(--c-accent); box-shadow: var(--glow); }
.lifecycle__nodes { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }
.lifecycle__nodes span { transition: color .3s; }
.lifecycle__nodes span:nth-child(2) { text-align: center; }
.lifecycle__nodes span:nth-child(3) { text-align: right; }
.lifecycle__nodes span.is-on { color: var(--c-ink); }
@media (max-width: 767.98px) {   /* phones: circle on top, copy centred under it */
  /* "safe center": when space is short the content starts below the heading instead of spilling up over it */
  .lifecycle__stage { padding-block: var(--s4) var(--s3); }
  .lifecycle__body { grid-template-columns: 1fr; align-content: safe center; justify-items: center; gap: 20px; padding-top: 24px; }
  .lifecycle__media { order: -1; width: min(64vw, 28svh); box-shadow: 0 0 0 8px var(--c-bg), 0 0 0 9px var(--c-line); }
  .lifecycle__title { font-size: clamp(1.9rem, 9vw, 2.5rem); margin-bottom: 12px; }
  .lifecycle__list li { font-size: 1.05rem; line-height: 1.55; }
  .lifecycle__copy { justify-items: center; text-align: center; }
  .lifecycle__list li { padding-left: 0; text-indent: 0; }
}
/* Very short screens (phones in landscape): too little height to pin — show all three stages as a normal section */
@media (max-height: 620px) {
  .lifecycle { height: auto; padding-block: var(--pad-y); }
  .lifecycle__stage { position: static; height: auto; }
  .lifecycle__body { padding-top: 0; margin-top: var(--s3); }
  .lifecycle__copy { gap: var(--s4); }
  .lifecycle__panel { grid-area: auto; opacity: 1; transform: none; pointer-events: auto; }
  .lifecycle__media img { opacity: 0; }
  .lifecycle__media img:first-child { opacity: 1; transform: none; }
  .lifecycle__rail { display: none; }
}
/* No JS: a normal section listing all three stages */
html:not(.js) .lifecycle { height: auto; padding-block: var(--pad-y); }
html:not(.js) .lifecycle__stage { position: static; height: auto; }
html:not(.js) .lifecycle__copy { gap: var(--s4); }
html:not(.js) .lifecycle__panel { grid-area: auto; opacity: 1; transform: none; }
html:not(.js) .lifecycle__rail { display: none; }

/* 9. PROJECT CARDS + FILTER ------------------------------------------------ */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s5) var(--gutter);
}
@media (min-width: 768px)  { .cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, minmax(0,1fr)); } }

.card { display: flex; flex-direction: column; gap: var(--s2); }
.card[hidden] { display: none; }
.card__link { display: contents; }
.card__media {
  position: relative; overflow: hidden;
  aspect-ratio: 40 / 28.4;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
}
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s var(--ease), filter .3s;
}
.card__media::after {           /* CRT sweep on hover */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(166,124,0,.08) 0 1px, transparent 1px 3px);
  opacity: 0; transition: opacity .2s;
}
.card__meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.card__title { font-size: var(--t-md); line-height: 1.35; }
.card__title::after { content: " →"; font-family: var(--f-body); color: var(--c-accent); opacity: 0; transition: opacity .15s; }
.card__index { font-family: var(--f-body); font-size: var(--t-xs); color: var(--c-muted); }
.card:hover .card__media img, .card__link:focus-visible .card__media img { transform: scale(1.03); }
.card:hover .card__media::after { opacity: 1; }
.card:hover .card__media { border-color: var(--c-accent); box-shadow: var(--glow); }
.card:hover .card__title::after { opacity: 1; }
.card:hover .card__title { color: var(--c-accent); }

.filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: var(--s5);
}
.filter__status { margin-left: auto; }
@media (max-width: 767.98px) { .filter__status { margin-left: 0; width: 100%; } }

.section__foot { margin-top: var(--s6); display: flex; justify-content: flex-start; }

/* 10. PROJECT PAGE --------------------------------------------------------- */
.project-hero {
  position: relative;
  padding: calc(var(--header-h) + var(--pad-y)) 0 var(--s6);
  border-bottom: 1px solid var(--c-line);
  isolation: isolate;
}
/* Texture: each project page sets its own tile inline, e.g.
   <section class="project-hero" style="background-image: url('assets/phd27-pri-hero-bg-01.jpg')">
   (inline so the assets/ path resolves from the page, not from css/).
   Tiled at native size like the original site, fading into the page at the bottom. */
/* Each project sets its own hero background inline (image, and for tiles: repeat/size)
   plus --hero-veil, the page-colour layer over it (0 = image at full strength, .95 = 5%).
   Default: one photo covering the hero, lightly veiled. */
.project-hero {
  --hero-veil: .3;
  background-color: var(--c-bg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}
.project-hero--tile { background-repeat: repeat; background-position: left top; background-size: auto; }
.project-hero--grid {                       /* LogoFolio: same 1px square grid as the Portfolio page */
  --hero-veil: 0;
  background-image:
    linear-gradient(to right,  #0f0f0f 1px, transparent 1px),
    linear-gradient(to bottom, #0f0f0f 1px, transparent 1px);
  background-size: 32px 32px; background-repeat: repeat; background-position: center top;
}
@media (max-width: 767.98px) { .project-hero--grid { background-size: 21px 21px; } }
.project-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, transparent 70%, var(--c-bg) 100%),     /* fades into the page at the bottom */
    linear-gradient(rgba(10,11,10,var(--hero-veil)), rgba(10,11,10,var(--hero-veil)));
}
/* Hero = three blocks in source order: head (categories + title), media (cover), body (text + link).
   Stacked (< 1100px): that order top to bottom.
   Wide (≥ 1100px): head + body share the left 5 columns, cover spans both rows on the right 7. */
.project-hero__grid { row-gap: var(--s4); }
.project-hero__head,
.project-hero__body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); }
.project-hero__head { gap: var(--s2); }
.project-hero__body .lede { max-width: 60ch; }
/* Long single-word titles in wide Michroma (e.g. PRINT4PLAYERS) can't wrap:
   the title scales to its column (≈12 em per 13 chars) so it never runs under the image. */
.project-hero__head { container-type: inline-size; }
.project-hero__head .h-1 { font-size: min(var(--t-xl), 8cqw); }
@media (min-width: 1100px) {
  .project-hero__grid { row-gap: var(--s3); align-items: start; grid-template-rows: auto 1fr; } /* keep text tight under the title even when the cover is taller */
  .project-hero__head  { grid-column: 1 / span 5; grid-row: 1; }
  .project-hero__body  { grid-column: 1 / span 5; grid-row: 2; }
  .project-hero__media { grid-column: 6 / -1;     grid-row: 1 / span 2; }
}

/* Inline external hyperlink (project intro): amber text, dashed underline, ↗ — same as the About timeline links */
.text-link {
  font-size: var(--t-base); color: var(--c-accent);
  border-bottom: 1px dashed var(--c-accent-dim);
  transition: border-color .12s, text-shadow .12s;
}
.text-link::after { content: " ↗"; }
.text-link:hover, .text-link:focus-visible { border-bottom-color: var(--c-accent); text-shadow: var(--glow); }
.project-hero__cover {
  width: 100%; border: 1px solid var(--c-line-2);
  aspect-ratio: 800 / 568; object-fit: cover;
}

.player {
  padding-block: var(--s6);
  border-top: 1px solid var(--c-line);
}
.player:first-of-type { border-top: 0; }
.player__head { align-items: start; row-gap: var(--s4); }
.player__name { grid-column: 1 / -1; margin: 0; }          /* name runs across the top */
/* Warm paper: off-white + the eggshell texture from the original About page —
   softer than pure white against the dark page, still true to logo/product colours */
:root { --paper: #e4e1d8 url("../assets/phd27-sit-texture-eggshell-paper-01.webp") center / 300px; }

/* Light "paper" section: re-maps the colour tokens locally so every component inside
   (names, hairlines, logo strokes, buttons) flips to dark-on-paper automatically */
.section--paper {
  background: var(--paper);
  color: #0a0b0a;
  --c-ink: #0a0b0a;
  --c-muted: #5d5a52;
  --c-line: rgba(10, 11, 10, .12);
  --c-line-2: rgba(10, 11, 10, .22);
  border-bottom: 0;
}
.section--paper .btn { --b: #0a0b0a; text-shadow: none; }
.section--paper .btn:hover,
.section--paper .btn:focus-visible { color: #e4e1d8; box-shadow: none; }
.player__logo {                                            /* warm-paper circle that holds the logo */
  display: block; overflow: hidden;
  width: 100%; max-width: 280px; aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--c-line-2);                       /* thin hairline, same weight as the site's rules */
  transition: border-color .2s, box-shadow .2s;
}
/* Each logo PNG has its own empty margin, so every <img> carries a measured fit:
   --s scales the artwork until its outer corners meet the circle edge,
   --tx/--ty re-centre artwork that sits off-centre in its file. */
.player__logo img {
  --logo-fill: .86;                                        /* breathing room: artwork reaches ~86% of the radius */
  width: 100%; height: 100%; object-fit: contain;
  transform: scale(calc(var(--s, 1) * var(--logo-fill))) translate(var(--tx, 0), var(--ty, 0));
}
.player:hover .player__logo { border-color: var(--c-accent); box-shadow: var(--glow); }
/* Tablet + desktop: logo circle = exactly one product tile, centred on the image row.
   Tile width derived from the 12-col grid: gallery spans 8 cols, split into 3 tiles. */
.player { container-type: inline-size; }
@media (min-width: 768px) {
  .player__head { align-items: center; }
  .player__logo {
    width: calc(((100cqw - 11 * var(--gutter)) * 2 / 3 + 5 * var(--gutter)) / 3);
    max-width: none;
  }
}
/* Mobile: name and circle centred on the page */
@media (max-width: 767.98px) {
  .player__logo { max-width: 200px; }
  .player__name { text-align: center; }
  .player__head > .span-4 { display: flex; justify-content: center; }
}
.gallery {
  display: grid; gap: var(--gutter);
  grid-template-columns: repeat(2, minmax(0,1fr));
}
@media (min-width: 768px) { .gallery { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1100px) { .gallery--4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }

.gallery__item {
  display: block; position: relative; padding: 0;
  aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--paper); border: 1px solid var(--c-line-2); /* product shots on warm paper, hairline edge */
  cursor: zoom-in;
}
.gallery__item img { width: 100%; height: 100%; object-fit: contain; padding: 6%; transition: transform .4s var(--ease); }
.gallery__item:hover { border-color: var(--c-accent); box-shadow: var(--glow); }
.gallery__item:hover img { transform: scale(1.04); }

/* 10b. PROJECT CONTENT BLOCKS ---------------------------------------------- */
/* Every other project page reuses the Print4Players shell: same hero, then a
   paper section of <article class="block"> rows — title on top, then any mix of
   copy, full-width figures, galleries, videos and sliders. */
.project-hero__meta { font-family: var(--f-body); font-size: var(--t-sm); color: var(--c-muted); line-height: 1.6; }
.project-hero__body > p:not(.lede):not(.project-hero__meta) { font-size: var(--t-sm); color: var(--c-muted); }

.block {
  display: grid; gap: var(--s4);
  padding-block: var(--s6);
  border-top: 1px solid var(--c-line);
}
.block:first-of-type { border-top: 0; }
.block__title { margin: 0; }
.block__head { display: grid; gap: var(--s1); }           /* heading + intro read as one unit; the block gap follows */
.block__subtitle { margin: 0; }                            /* h3 inside a block: --t-md, below the --t-lg section title */
.block__head:has(> .figure) { gap: var(--s2); }            /* a little more air between a subtitle and media */
.block__intro { margin: 0; max-width: 72ch; line-height: 1.6; color: var(--c-muted); }          /* heading + intro read as one unit; the block gap follows */
.block__sub { margin: 0 0 var(--s1); font-size: var(--t-base); }
.block__copy { display: grid; gap: var(--s2); max-width: 72ch; }
.block__copy p { line-height: 1.6; }

/* Full-width figure (banners, schematics, wordmarks) on warm paper */
.figure { margin: 0; background: var(--paper); border: 1px solid var(--c-line-2); }
.figure img, .figure video { width: 100%; height: auto; display: block; }
.figure img { max-height: 75vh; object-fit: contain; }   /* tall artwork never outgrows the screen */
.figure--pad { padding: clamp(16px, 4%, 48px); }
.figure--pad img { margin-inline: auto; }
.figure--narrow img { max-width: 420px; }     /* small marks shouldn't blow up to container width */
.figure--video { background: #000; }
.figure--video video { max-height: 80vh; margin-inline: auto; }

/* Two-up: copy + media side by side from 768px */
.split { display: grid; gap: var(--s4); align-items: center; }
@media (min-width: 768px) { .split { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.split--top { align-items: start; }
/* Equal-height split: the copy sets the row height, the image fills it (cropped, never distorted) */
.split--stretch { align-items: stretch; }
@media (min-width: 768px) {
  .figure--fill { position: relative; min-height: 320px; }
  .figure--fill img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; } /* whole shirt visible, letterboxed on paper */
}
.figure--white { background-color: #FFFFFF; padding: var(--box-pad); }
@media (min-width: 768px) {   /* filled white figures: inset the absolutely-placed image by the same padding */
  .figure--white.figure--fill img { inset: var(--box-pad); width: calc(100% - 2 * var(--box-pad)); height: calc(100% - 2 * var(--box-pad)); }
}

/* 3/8 + 5/8 split (Creative Enablement): copy left, image box right, tops aligned.
   Flex-basis percentages net of the gap so the columns stay exactly 37.5% / 62.5%. */
.split-38 { display: flex; flex-direction: column; gap: var(--s4); }
@media (min-width: 768px) {
  .split-38 { flex-direction: row; align-items: flex-start; }
  .split-38 > .block__copy { flex: 0 0 calc(37.5% - var(--s4) * .375); }
  .split-38 > .figure      { flex: 0 0 calc(62.5% - var(--s4) * .625); }
  .split-38 > .figure--pad { padding-top: var(--box-pad); }   /* box top lines up with the first line of text; artwork keeps the standard inner padding */
}

/* Flat images (Digital Softpress): no stroke, outline or glow on hover */
.project-flat :is(.gallery__item, .justified__item, .figure, .gallery__item img, .justified__item img, .figure img):hover,
.project-flat :is(.gallery__item, .justified__item, .figure):hover img {
  outline: none; border: none; box-shadow: none;
}
/* Section titles (Research and Development, Execution Flow, …) step up to --t-lg so they
   sit clearly above in-section headings like the timeline steps and Quick Specs (--t-md / --t-base) */
.project-flat .block__title { font-size: var(--t-lg); line-height: 1.25; }

/* Borderless at rest too, so removing the border on hover never shifts the layout by a pixel */
.project-flat :is(.gallery__item, .figure) { border: none; }

/* Justified gallery: one seamless container, no gaps, uniform row height.
   Each item grows in proportion to its image's aspect ratio (--ar), so rows fill with
   little spare space; images are contained (never cropped) and centred if they fall short. */
.justified-group, .justified:not(.justified-group .justified) {
  background: #FFFFFF; border: 1px solid var(--c-line-2); overflow: hidden;   /* white, so white-backed product shots read as one surface */
  padding: var(--box-pad);                    /* breathing room between the artwork and the box edge */
}
:root { --box-pad: 10px; }                    /* one inner padding for every white image box on the site */
.justified { --row: clamp(200px, 22vw, 320px); display: flex; gap: 0; }
.justified__item {
  flex: var(--ar, 1) 1 0; min-width: 0; height: var(--row);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-in; transition: box-shadow .2s;
}
.justified__item img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: transform .4s var(--ease); }
.justified__item:hover { box-shadow: inset 0 0 0 1px var(--c-accent); }
.justified__item:hover img { transform: scale(1.03); }
.justified__item--dark { background: #0a0b0a; }                       /* white artwork needs a dark cell */
/* Fit-to-width row: height follows the width instead of a fixed --row, so the images
   fill the container edge to edge at their own aspect ratio — no gaps, no cropping */
.justified--fit .justified__item { height: auto; aspect-ratio: var(--ar); }
.justified--fit .justified__item img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.justified > .slider { flex: .45 1 0; min-width: 0; height: var(--row); border: 0; }  /* a slideshow can sit in a row like any tall image */
.justified--tall { --row: clamp(320px, 40vw, 560px); }                 /* rows of portrait art (leggings, newsletters) */
.justified--short { --row: clamp(120px, 12vw, 180px); }                /* dense rows of marks (logo walls) */
@media (max-width: 767.98px) {   /* phones: two per line, still gapless and uncropped */
  .justified { flex-wrap: wrap; --row: 170px; }
  .justified--tall { --row: 300px; }
  .justified--short { --row: 130px; }
  .justified__item, .justified > .turn, .justified > .slider { flex: 1 1 50%; }   /* viewers wrap like images */
}
/* Print4Players on the flat blueprint: the merch row is a justified gallery whose
   height equals the logo circle (one 8-col/3 tile), so circle and row line up. */
.project-flat .player { border-top-color: var(--c-line); }
.project-flat .player:hover .player__logo { border-color: var(--c-line-2); box-shadow: none; }   /* no hover glow */
@media (min-width: 768px) {
  /* row = logo-circle height minus the box padding (and 1px borders), so the padded box still lines up with the circle */
  .player .justified { --row: calc(((100cqw - 11 * var(--gutter)) * 2 / 3 + 5 * var(--gutter)) / 3 - 2 * var(--box-pad) - 1px); }
}
.player .justified { background: #FFFFFF; border: 1px solid var(--c-line-2); padding: var(--box-pad); }
@media (max-width: 767.98px) { .project-flat .player__name { text-align: center; } }

/* Turn viewer ([data-turn]) — one garment, several angles; drag to "turn" it.
   No chrome: just a quiet rotate glyph, the view name and tiny dots, which
   firm up on hover/focus to say "this moves". */
.turn {
  position: relative; background: #FFFFFF;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  outline: none;
}
.justified > .turn { flex: .44 1 0; min-width: 0; height: var(--row); }   /* sits in a justified row like a tall image */
@media (max-width: 767.98px) { .justified > .turn { flex: 1 1 50%; } }      /* phones: viewer + flat print share a line */
/* Viewer + wide detail rows (Bombsheller): on phones the viewer and the detail each take a full line,
   the detail at its own shape, so the close-up doesn't shrink to a sliver */
@media (max-width: 767.98px) {
  .justified--detail > .turn { flex-basis: 100%; }
  .justified--detail > .justified__item { flex-basis: 100%; height: auto; aspect-ratio: var(--ar); }
  .justified--detail > .justified__item img { width: 100%; height: 100%; max-width: none; max-height: none; }
}
.turn.is-dragging { cursor: grabbing; }
.turn__stage { position: absolute; inset: 0 0 34px; }
.turn__view {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .22s var(--ease), visibility 0s .22s;
}
.turn__view.is-active { opacity: 1; visibility: visible; transition: opacity .22s var(--ease); }
.turn__view img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.turn__hint {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--f-body); font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase;
  color: #8b918a; opacity: .7; transition: opacity .2s, color .2s;
}
.turn:hover .turn__hint, .turn:focus-visible .turn__hint, .turn.is-dragging .turn__hint { opacity: 1; color: #0a0b0a; }
.turn__icon { width: 16px; height: 16px; flex: none; }
.turn:hover .turn__icon { animation: turn-sway 1.6s var(--ease) infinite; }   /* gentle left-right sway = "I rotate" */
@keyframes turn-sway { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-18deg); } 65% { transform: rotate(14deg); } }
.turn__label { min-width: 3.6em; text-align: center; }
.turn__dots { display: flex; gap: 2px; }
.turn__dot {
  width: 14px; height: 14px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;                       /* 14px hit area, 5px dot */
}
.turn__dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; border: 1px solid currentColor; }
.turn__dot[aria-pressed="true"]::before { background: currentColor; }
.turn:focus-visible { box-shadow: inset 0 0 0 1px var(--c-accent); }   /* keyboard users still see focus */

/* Flat projects keep sliders framed but drop the hover glow */
.project-flat .slider:hover, .project-flat .slider:focus-within { border-color: var(--c-line-2); box-shadow: none; }
.project-flat .slider { background: #FFFFFF; }
.project-flat .slider__slide img { object-fit: contain; }   /* same no-crop rule as the justified rows */
.split__media--tall { max-width: 360px; justify-self: center; width: 100%; }

/* Gallery modifiers */
.gallery--1 { grid-template-columns: minmax(0, 1fr) !important; }
@media (min-width: 768px) { .gallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) and (max-width: 1099.98px) { .gallery--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px)  { .gallery--5 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .gallery--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.gallery--multiply .gallery__item img { mix-blend-mode: multiply; }      /* white-backed PNGs melt into the paper */
.gallery__item--dark { background: #0a0b0a; }                           /* white artwork needs a dark tile */
.gallery--photo .gallery__item img { object-fit: cover; padding: 0; }   /* photographs fill the tile */
.gallery--wide .gallery__item { aspect-ratio: 3 / 2; }
.gallery--tall .gallery__item,
.gallery--tall .slider { aspect-ratio: 1 / 2; }
.gallery--natural .gallery__item { aspect-ratio: auto; }               /* keeps each image's own shape */
.gallery--natural .gallery__item img { height: auto; }

/* Slider (vanilla, [data-slider]) — crossfading stack with CRT chips */
.slider {
  position: relative; display: grid; grid-template-rows: 1fr auto;
  background: var(--paper); border: 1px solid var(--c-line-2); overflow: hidden;
}
.slider__track { position: relative; min-height: 0; }
.slider__slide {
  position: absolute; inset: 0; display: block;
  opacity: 0; visibility: hidden; transition: opacity .6s var(--ease), visibility 0s .6s;
  cursor: zoom-in;
}
.slider__slide.is-active { opacity: 1; visibility: visible; transition: opacity .6s var(--ease); }
.slider__slide img { width: 100%; height: 100%; object-fit: cover; }
.slider__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px; border-top: 1px solid var(--c-line-2); background: var(--c-bg);
  --c-ink: #e9e7e0; --c-line-2: #3a3f3a; color: var(--c-ink);   /* bar stays dark like the lightbox */
}
.slider__nav { display: flex; gap: 6px; }
.slider__nav .chip { padding: 6px 10px; }
.slider:hover, .slider:focus-within { border-color: var(--c-accent); box-shadow: var(--glow); }

/* Flipbook ([data-flipbook]) — a printed catalog you can leaf through (New Order).
   Desktop: closed cover -> CSS 3D two-page spreads -> back cover. Each spread file is
   twice a page wide; faces crop its left/right half. Phones: same book, swipe or tap.
   Frame + dark bar + chips reuse the slider's vocabulary; no hover glow, no focus stroke. */
.flipbook {
  --page-ar: calc(3485 / 2126);                       /* page height / width */
  --turn: 900ms; --turn-ease: cubic-bezier(.645, .045, .355, 1);
  margin-top: var(--s4);
  border: 1px solid var(--c-line-2); background: var(--paper);
  container-type: inline-size; outline: none;
}
.flipbook__stage { display: grid; place-items: center; padding: var(--s5) var(--s3); overflow: hidden; }
.flipbook__book {
  --pw: min(calc((100cqw - 2 * var(--s3)) / 2), calc((100vh - 280px) / var(--page-ar)), 520px);
  position: relative;
  width: calc(var(--pw) * 2); height: calc(var(--pw) * var(--page-ar));
  transition: transform var(--turn) var(--turn-ease);
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.flipbook__book[data-state="closed"] { transform: translateX(-25%); }   /* centre the lone cover */
.flipbook__book[data-state="end"]    { transform: translateX(25%); }    /* centre the back cover */
/* The book stays flat so z-index orders the leaves; each leaf carries its own perspective */
.flipbook__sheet {
  position: absolute; top: 0; left: 50%; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transform: perspective(2600px) rotateY(0deg);
  transition: transform var(--turn) var(--turn-ease);
}
.flipbook__sheet.is-flipped { transform: perspective(2600px) rotateY(-180deg); }
.flipbook__face {
  position: absolute; inset: 0; overflow: hidden; background: #d9d6cd;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 4px 14px rgba(10, 11, 10, .12);
}
.flipbook__face--back { transform: rotateY(180deg); }
.flipbook__face img {
  position: absolute; top: 0; left: 0; width: 200%; height: 100%; max-width: none;
  object-fit: cover; pointer-events: none;
}
.flipbook .crop-r    { left: -100%; }
.flipbook .crop-full { width: 100%; }
/* Spine shading, and a darkening sweep while a leaf stands upright mid-turn */
.flipbook__face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,.30), rgba(0,0,0,.06) 6%, transparent 14%);
}
.flipbook__face--back::after { background: linear-gradient(to left, rgba(0,0,0,.30), rgba(0,0,0,.06) 6%, transparent 14%); }
.flipbook__face--cover::after { background: linear-gradient(to right, rgba(0,0,0,.18), transparent 4%); }
.flipbook__face--cover.flipbook__face--back::after { background: linear-gradient(to left, rgba(0,0,0,.18), transparent 4%); }
.flipbook__face::before { content: ""; position: absolute; inset: 0; z-index: 1; background: #000; opacity: 0; pointer-events: none; }
.flipbook__sheet.is-turning .flipbook__face::before { animation: flip-shade var(--turn) var(--turn-ease); }
@keyframes flip-shade { 50% { opacity: .35; } }
/* Controls: arrows turn amber on hover/focus — no glow, no outline, no stroke change */
.flipbook .chip:hover, .flipbook .chip:focus-visible { color: var(--c-accent); border-color: var(--c-line-2); text-shadow: none; }
.flipbook .chip:focus, .flipbook .chip:focus-visible { outline: none; box-shadow: none; }
.flipbook .chip:disabled { opacity: .35; cursor: default; color: var(--c-ink); }
.flipbook:focus-visible [data-fb-label] { color: var(--c-accent); }   /* keyboard focus without a stroke */
@media (max-width: 767.98px) {   /* phones: same two-page book, sized to the width; swipe or tap to turn */
  .flipbook__stage { padding: var(--s4) var(--s2); }
  .flipbook__book { --pw: calc((100cqw - 2 * var(--s2)) / 2); touch-action: pan-y; }
}
@media (prefers-reduced-motion: reduce) { .flipbook { --turn: 1ms; } }

/* Specs list (Digital Softpress) */
.specs, .flow { list-style: none; margin: 0; padding: 0; }
.specs { display: grid; gap: var(--s1); }
.specs li { padding-left: 1.5em; text-indent: -1.5em; line-height: 1.5; }
.specs li::before { content: "> "; }

/* Execution flow — vertical: square CRT icon markers joined by a hairline rule.
   The rule under each marker draws downward once its step is revealed. */
.flow { --icon: 56px; max-width: 860px; }
.flow__step {
  position: relative;
  display: grid; grid-template-columns: var(--icon) minmax(0, 1fr);
  column-gap: var(--s3);
  padding-bottom: var(--s5);
}
.flow__step:last-child { padding-bottom: 0; }
.flow__step::before {                                   /* connector to the next marker */
  content: ""; position: absolute;
  left: calc(var(--icon) / 2 - .5px); top: calc(var(--icon) + 8px); bottom: 8px;
  width: 1px; background: #0a0b0a;                       /* 1px hairline, same ink as the icon outlines */
  transform-origin: top;
}
.flow__step:last-child::before { display: none; }
.js .flow__step.reveal::before { transform: scaleY(0); transition: transform .9s var(--ease) .35s; }
.js .flow__step.reveal.is-in::before { transform: scaleY(1); }
.flow__icon {
  width: var(--icon); height: var(--icon);
  display: grid; place-items: center;                   /* icon dead-centre in the circle */
  background: #fff; color: #0a0b0a;                     /* solid white disc, dark line icon */
  border: 1px solid #0a0b0a; border-radius: 50%;
  position: relative; z-index: 1;
  transition: color .2s, box-shadow .2s, border-color .2s;
}
.flow__icon svg { width: 24px; height: 24px; }
.flow__step:hover .flow__icon { color: var(--c-accent); border-color: var(--c-accent); box-shadow: var(--glow); }
.flow__body { padding-top: 4px; }                         /* title sits optically centred on the marker */
.flow__title { margin: 0; }
.flow__sub { margin-top: 4px; font-family: var(--f-display); font-size: var(--t-sm); color: var(--c-muted); }
.flow__text { margin-top: var(--s2); line-height: 1.6; max-width: 62ch; }
/* Flow + gallery. Mobile: photos break out below as a horizontal row of three.
   ≥768px: photos become a column beside the flow; the flow sets the row height and
   the three tiles split it equally (images are absolutely placed so they add no height). */
.flow-layout { display: grid; gap: var(--s4); }
.flow-layout .gallery--stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 768px) {
  .flow-layout { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: stretch; column-gap: var(--s5); }
  .flow-layout .flow { max-width: none; }
  .flow-layout .gallery--stack { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .flow-layout .gallery--stack .gallery__item { aspect-ratio: auto; min-height: 120px; }
  .flow-layout .gallery--stack .gallery__item img { position: absolute; inset: 0; }
}
@media (max-width: 767.98px) { .flow { --icon: 44px; } .flow__step { column-gap: var(--s2); } .flow__icon svg { width: 20px; height: 20px; } }
.caption { font-size: var(--t-sm); color: var(--c-muted); max-width: 72ch; }

/* 11. FOOTER --------------------------------------------------------------- */
.site-footer {
  position: relative;
  padding-block: var(--s6) var(--s4);
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
}
.site-footer .grid { row-gap: var(--s4); }
.footer__logo { width: 48px; margin-bottom: var(--s2); }
.footer__name { font-size: var(--t-sm); letter-spacing: .06em; margin-bottom: var(--s1); }
.footer__heading { margin-bottom: var(--s2); }
.footer__links li + li { margin-top: 6px; }
.footer__links a { font-family: var(--f-body); font-size: var(--t-sm); color: var(--c-muted); }
.footer__links a:hover { color: var(--c-accent); text-shadow: var(--glow); }
.footer__social { display: flex; gap: 8px; margin-top: var(--s3); }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--c-line-2); color: var(--c-ink);
  transition: color .12s, border-color .12s, background .12s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--c-on-accent); background: var(--c-accent); border-color: var(--c-accent); box-shadow: var(--glow); }
.footer__bottom {
  margin-top: var(--s5); padding-top: var(--s3);
  border-top: 1px solid var(--c-line);
  display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap;
}

/* 12. LIGHTBOX, UTILITIES, MOTION ----------------------------------------- */
.lightbox {
  width: min(92vw, 1100px); max-height: 92vh;
  padding: 0; border: 1px solid var(--c-accent);
  background: var(--c-bg); color: var(--c-ink);
  box-shadow: var(--glow);
}
.lightbox::backdrop { background: rgba(0,0,0,.85); }
.lightbox img { width: 100%; max-height: calc(92vh - 56px); object-fit: contain; background: var(--paper); }
.lightbox__bar {
  display: flex; justify-content: space-between; align-items: center;
  height: 56px; padding-inline: var(--s2);
  border-top: 1px solid var(--c-line);
}
.lightbox__nav { display: flex; gap: 8px; }
.lightbox__nav .chip { padding: 8px 12px; }

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

/* Reveal-on-scroll (progressive: content is visible without JS) */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}


/* ==========================================================================
   13. ABOUT PAGE
   ========================================================================== */

/* ID-card hero — centred in the viewport like the home intro */
.about-hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--header-h) + var(--s5)) 0 var(--s6);
  background: #000 url("../assets/phd27-sit-texture-dither-01.webp") center / cover no-repeat;
  border-bottom: 1px solid var(--c-line);
  isolation: isolate;
}
.about-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at center, rgba(10,11,10,.25) 0%, rgba(10,11,10,.7) 75%),
    linear-gradient(180deg, transparent 70%, var(--c-bg) 100%);
}
.about-hero__inner {
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s5); text-align: center;
}
.about-hero__title { letter-spacing: .02em; }
.about-hero__tagline { max-width: 56ch; margin-inline: auto; }

.id-card {
  position: relative;
  width: min(100%, 440px);
  display: flex; flex-direction: column; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s4) var(--s4);
  background: rgba(17,19,17,.78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--c-line-2);
  box-shadow: 0 30px 60px rgba(0,0,0,.45);
  transition: border-color .2s, box-shadow .2s;
}
.id-card:hover { border-color: var(--c-accent); box-shadow: 0 30px 60px rgba(0,0,0,.45), var(--glow); }
.id-card__hole { width: 64px; }
.id-card__photo {
  width: 168px; aspect-ratio: 1; object-fit: cover;
  border: 1px solid var(--c-line-2);
}
.id-card__name { font-size: var(--t-lg); line-height: 1.2; }
.id-card__creds p { font-size: var(--t-base); line-height: 1.5; color: var(--c-ink); }
.id-card__social { display: flex; gap: 8px; }

/* Skillsets — CRT "windows" on the 12-col grid */
.skills { position: relative; isolation: isolate; }
.skills::before {                          /* eggshell paper texture from the original page, ghosted */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: url("../assets/phd27-sit-texture-eggshell-paper-01.webp") center / 600px repeat;
  opacity: .04; pointer-events: none;
}
.skills__grid { row-gap: var(--gutter); }
.window {
  display: flex; flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-line-2);
  transition: border-color .2s, box-shadow .2s;
}
.window:hover { border-color: var(--c-accent); box-shadow: var(--glow); }
.window__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: 12px var(--s3);
  border-bottom: 1px solid var(--c-line-2);
  background: var(--c-surface-2);
}
.window__title { font-size: var(--t-sm); letter-spacing: .06em; }
.window:hover .window__title { color: var(--c-accent); text-shadow: var(--glow); }
.window__body { padding: var(--s3); flex: 1; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: var(--t-sm); letter-spacing: .04em;
  padding: 8px 12px;
  border: 1px solid var(--c-line-2);
  transition: color .12s, border-color .12s, background .12s;
}
.tag:hover { color: var(--c-on-accent); background: var(--c-accent); border-color: var(--c-accent); }

.skill-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; color: var(--c-ink); }
.skill-icon svg { width: 100%; height: 100%; }
.skill-icon svg:not([fill="none"]) { fill: currentColor; }   /* original icons ship hard-coded black */

.langs li + li { border-top: 1px solid var(--c-line); }
.lang { display: flex; align-items: center; gap: var(--s2); padding: 14px 0; }
.lang:first-child { padding-top: 0; }
.lang:last-child { padding-bottom: 0; }
.lang__name { font-size: var(--t-sm); flex: 1; }
.lang__level { color: var(--c-muted); font-size: var(--t-sm); }
.lang:hover .skill-icon, .lang:hover .lang__name { color: var(--c-accent); }

/* Layout: Expertise full width; Languages + Coding share a row (equal height, similar content);
   Software full width. Windows stack on phones. */
.software {
  display: grid; gap: 1px;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* 10 tools → 2×5 on phones … */
  background: var(--c-line);                 /* 1px hairline grid between tiles */
  border: 1px solid var(--c-line);
}
@media (min-width: 520px)  { .software { grid-template-columns: repeat(5, minmax(0, 1fr)); } }  /* … 5×2 on tablets … */
@media (min-width: 1100px) { .software { grid-template-columns: repeat(10, minmax(0, 1fr)); } } /* … one row of 10 on desktop */
@media (max-width: 767.98px) { .skills__grid > .window { grid-column: 1 / -1; } }             /* phones: one window per row */
.software__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: var(--s3) var(--s1);
  background: var(--c-surface);
  text-align: center;
  transition: background .12s;
}
.software__name { font-family: var(--f-body); font-size: var(--t-xs); letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.software__item:hover { background: var(--c-surface-2); }
.software__item:hover .skill-icon,
.software__item:hover .software__name { color: var(--c-accent); }
.software__item:hover .skill-icon { filter: drop-shadow(0 0 6px rgba(166,124,0,.55)); }

/* ==========================================================================
   14. TIMELINE  (vanilla port of the original vertical timeline widget)
   --------------------------------------------------------------------------
   Desktop: marker column = 3 of 12 grid columns, spine runs through its centre.
   A node becomes .is-active while it crosses the middle 30% of the viewport:
   marker grows 46 → 142px and reveals the logo, title brightens, details expand.
   Mobile (<768px): single column, small markers on a left spine, details always
   open so the page scrolls without content jumping.
   ========================================================================== */
.timeline {
  --tl-aside: calc((100% - 11 * var(--gutter)) / 12 * 3 + 2 * var(--gutter));  /* = span-3 */
  --tl-dot: 46px;
  --tl-dot-active: 142px;
  --tl-ease: cubic-bezier(.4, 0, .2, 1);
  position: relative;
}
.timeline__list { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; }
.timeline__spine {
  position: absolute; top: 0; bottom: 0; z-index: 0;
  left: calc(var(--tl-aside) / 2);
  width: 1px; transform: translateX(-50%);
  background: var(--c-line-2);
}
.timeline__progress {                     /* amber fill that tracks scroll position */
  position: absolute; inset: 0;
  background: var(--c-accent);
  box-shadow: var(--glow);
  transform-origin: top; transform: scaleY(0);
}
.timeline__node {
  display: grid;
  grid-template-columns: var(--tl-aside) 1fr;
  column-gap: var(--gutter);
  align-items: start;                       /* markers pin to the top of each entry */
}
.timeline__main { padding-top: 8px; }       /* optically centre the title's first line on the 46px dot */
.timeline__node + .timeline__node { margin-top: clamp(64px, 7vw, 112px); }
.timeline__aside { display: flex; justify-content: center; }

.timeline__marker {
  position: relative; overflow: hidden; flex: none;
  width: var(--tl-dot); height: var(--tl-dot);
  border-radius: 50%;
  background: var(--c-surface-2);
  border: 2px solid var(--c-line-2);
  transition: width .6s var(--tl-ease), height .6s var(--tl-ease),
              background-color .6s var(--tl-ease), border-color .3s, box-shadow .3s;
}
.timeline__marker img {
  position: absolute; inset: 12%;
  width: 76%; height: 76%; object-fit: contain;
  opacity: 0; transition: opacity .3s;
}
.timeline__title {
  font-size: clamp(1rem, .9rem + .45vw, 1.25rem);
  line-height: 1.5;
  text-transform: uppercase;
  opacity: .5;
  transition: opacity .6s, color .3s;
}
.timeline__body {
  display: grid; grid-template-rows: 0fr;     /* animates to auto height without max-height hacks */
  opacity: 0;
  transition: grid-template-rows .6s var(--tl-ease), opacity .6s;
}
.timeline__inner { overflow: hidden; min-height: 0; }
.timeline__inner > :first-child { margin-top: 10px; }
.timeline__inner > * + * { margin-top: 12px; }
.timeline__subtitle { font-family: var(--f-display); font-size: var(--t-sm); color: var(--c-accent); }
.timeline__link {
  font-size: var(--t-sm); color: var(--c-accent);
  border-bottom: 1px dashed var(--c-accent-dim);
  transition: border-color .12s, text-shadow .12s;
}
.timeline__link::after { content: " ↗"; }
.timeline__link:hover { border-bottom-color: var(--c-accent); text-shadow: var(--glow); }
.timeline__points { max-width: 72ch; }
.timeline__points li {
  position: relative; padding-left: 20px;
  font-size: clamp(.95rem, .92rem + .14vw, 1.06rem); line-height: 1.45;
}
.timeline__points li + li { margin-top: 10px; }
.timeline__points li::before { content: ">"; position: absolute; left: 0; color: var(--c-accent); }
.timeline__points strong { font-weight: 700; color: var(--c-ink); }
.timeline__quote {
  margin: var(--s3) 0 0; padding: var(--s2) var(--s3);
  border-left: 2px solid var(--c-accent);
  background: var(--c-surface);
  color: var(--c-muted); font-style: italic;
}

/* Active state */
.timeline__node.is-active .timeline__marker {
  width: var(--tl-dot-active); height: var(--tl-dot-active);
  background: #fff;                         /* white disc so the dark logo artwork reads */
  border-color: var(--c-accent);
  box-shadow: var(--glow);
}
.timeline__node.is-active .timeline__marker img { opacity: 1; transition-delay: .2s; }
.timeline__node.is-active .timeline__title { opacity: 1; }
.timeline__node.is-active .timeline__body { grid-template-rows: 1fr; opacity: 1; }

/* Hover affordance on inactive nodes */
.timeline__node:not(.is-active) { cursor: pointer; }
.timeline__node:not(.is-active):hover .timeline__marker { border-color: var(--c-accent); box-shadow: var(--glow); }
.timeline__node:not(.is-active):hover .timeline__title { opacity: .9; color: var(--c-accent); }

/* Without JS everything is simply open */
html:not(.js) .timeline__body { grid-template-rows: 1fr; opacity: 1; }
html:not(.js) .timeline__title { opacity: 1; }

@media (max-width: 767.98px) {
  .timeline { --tl-aside: var(--tl-dot); }
  .timeline__node { column-gap: var(--s2); }
  .timeline__node + .timeline__node { margin-top: var(--s5); }
  .timeline__marker,
  .timeline__node.is-active .timeline__marker { width: var(--tl-dot); height: var(--tl-dot); background: var(--c-ink); }
  .timeline__marker img { opacity: 1; }
  .timeline__main { padding-top: 0; }
  .timeline__title { line-height: 1.4; padding-top: 10px; }  /* optically centre first line on the dot */
  .timeline__body,
  .timeline__node.is-active .timeline__body { grid-template-rows: 1fr; opacity: 1; }
  .timeline__node:not(.is-active) { cursor: default; }
}
