/* ============================================================
   Photonfiction — POC 03: Accessible Studio
   Light theme, native cursor, native scroll, mobile-first.
   Derived from poc02 with the VR/cursor layers removed.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f4f5f7;
  --fg: #0d0d0d;
  --muted: #4a4b52;            /* ~7.6:1 on white (AAA) */
  --accent: #3A4F87;
  --accent-2: #E2623D;
  --line: rgba(0, 0, 0, 0.1);
  --maxw: 1320px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --accent-p: var(--accent);   /* per-project accent, overridden by body[data-project] */
}
body[data-project="windturbine"] { --accent-p: #3A4F87; }
body[data-project="hoisting"]    { --accent-p: #E2623D; }
body[data-project="elevator"]    { --accent-p: #22315C; }
body[data-project="superstack"]  { --accent-p: #2B2B2E; }

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Native scroll. Smooth anchors only for people who haven't asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
html { scroll-padding-top: 5rem; } /* fixed nav offset for anchor jumps */

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; }
img { max-width: 100%; height: auto; }

/* ---------- Accessibility utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 0.6rem; left: 0.6rem;
  z-index: 10001;
  background: var(--fg);
  color: var(--bg);
  padding: 0.7rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transform: translateY(-300%);
}
.skip-link:focus { transform: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}


/* ---------- Background canvases ---------- */
.webgl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}
.fluid-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

main, .nav, .footer { position: relative; z-index: 2; }

/* ---------- Nav (solid white strip + drop shadow) ---------- */
.nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.2rem, 4vw, 3.5rem);
  z-index: 100;
  background: #ffffff;
  box-shadow: 0 2px 18px rgba(13, 13, 13, 0.08);
}
.nav__brand { position: relative; display: inline-flex; align-items: center; }
.nav__brand-logo { height: 24px; width: auto; display: block; }
/* invisible hotspot over the logo ring — ÷0 singularity easter egg (home only) */
.nav__brand-zero { position: absolute; left: 0; top: 0; bottom: 0; width: 16%; cursor: pointer; }
.nav__links { display: flex; gap: 2rem; align-items: center; }
.nav__links a {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  position: relative;
  padding: 0.6rem 0; /* ≥44px hit area with line-height */
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0.35rem;
  width: 0; height: 1px;
  background: currentColor;
  transition: width 0.4s var(--ease);
}
.nav__links a:hover::after,
.nav__links a:focus-visible::after { width: 100%; }
.nav__links a[aria-current="page"]::after { width: 100%; }
.nav__cta {
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.5rem 1.2rem !important;
}
.nav__cta::after { display: none; }

/* Hamburger (mobile) */
.nav__menu {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border-radius: 8px;
}
.nav__menu span {
  width: 24px; height: 2px;
  background: var(--fg);
  display: block;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav.is-open .nav__menu span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav.is-open .nav__menu span:last-child  { transform: translateY(-3.5px) rotate(-45deg); }

/* Mobile menu dropdown (disclosure under the strip) */
.nav__mobile {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #ffffff;
  box-shadow: 0 14px 24px rgba(13, 13, 13, 0.1);
  display: none;
  flex-direction: column;
  padding: 0.4rem 0 0.8rem;
}
.nav.is-open .nav__mobile { display: flex; }
.nav__mobile a {
  padding: 0.9rem clamp(1.2rem, 4vw, 3.5rem); /* ≥48px rows */
  font-size: 1.05rem;
  border-top: 1px solid var(--bg-soft);
}
.nav__mobile a:hover { background: var(--bg-soft); }

/* ---------- Shared ---------- */
.section-tag {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.section-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 5rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
section { padding: clamp(4rem, 12vh, 10rem) clamp(1.2rem, 4vw, 3.5rem); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.9rem 1.6rem;
  font-size: 0.95rem;
  min-height: 44px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  font-family: inherit;
  transition: background 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn--primary:hover { background: var(--accent-p); border-color: var(--accent-p); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--maxw);
  margin: 0 auto;
  position: relative;
}
.hero__eyebrow {
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  color: var(--accent-2);
  margin-bottom: 2rem;
}
.hero__title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 11vw, 10rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin-bottom: 2.5rem;
}
/* padding + negative margin lets descenders (g, y) escape the reveal clip */
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.hero__title em { color: var(--accent-2); }
.hero__lead {
  max-width: 38ch;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  color: var(--muted);
  margin-bottom: 2.5rem;
}

/* Scroll-to-discover indicator */
.scroll-discover {
  position: absolute;
  bottom: 2.5rem;
  left: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.scroll-indicator { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.scroll-indicator .arrow {
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
}
.scroll-indicator .arrow.top { transform: rotate(45deg); opacity: 0.4; }
.scroll-indicator .arrow.bottom { transform: rotate(45deg); }
.scroll-indicator .line {
  position: relative;
  width: 1px; height: 34px;
  background: var(--line);
  overflow: hidden;
}
.scroll-indicator .line .dot {
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 10px;
  background: var(--accent-2);
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-indicator .line .dot { animation: dotDrop 1.8s var(--ease) infinite; }
}
@keyframes dotDrop {
  0% { transform: translateY(-12px); }
  100% { transform: translateY(34px); }
}
.scroll-discover__text {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Manifesto ---------- */
.manifesto { max-width: var(--maxw); margin: 0 auto; }
.manifesto__text {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 400;
  font-size: clamp(1.5rem, 4.2vw, 3.4rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.manifesto__text .word { display: inline-block; }
.manifesto__text .word.is-dim { color: rgba(0, 0, 0, 0.3); transition: color 0.3s var(--ease); }

/* ---------- Capabilities ---------- */
.caps { max-width: var(--maxw); margin: 0 auto; }
.caps__head { margin-bottom: 4rem; }
.caps__list { list-style: none; border-top: 1px solid var(--line); }
.cap {
  display: grid;
  grid-template-columns: 80px 1fr 1.2fr;
  gap: 2rem;
  align-items: start;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.5s var(--ease);
}
.cap:hover { padding-left: 1.5rem; }
.cap__num { font-family: "Space Grotesk", sans-serif; color: var(--accent-2); font-size: 0.9rem; }
.cap__title { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: clamp(1.4rem, 2.6vw, 2.2rem); letter-spacing: -0.02em; }
.cap__desc { color: var(--muted); font-size: 1.05rem; max-width: 48ch; }

/* ---------- Work (cards are real links) ---------- */
.work { max-width: var(--maxw); margin: 0 auto; }
.work__head { margin-bottom: 4rem; }
.work__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
}
a.project { display: block; border-radius: 14px; }
a.project:focus-visible { outline-offset: 6px; }
.project__media {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  display: block;
  transition: transform 0.6s var(--ease);
}
.project:hover .project__media,
.project:focus-visible .project__media { transform: scale(0.98); }
.project__media::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 120% at 30% 20%, rgba(0,0,0,0.18), transparent 60%);
  mix-blend-mode: overlay;
}
/* animated vector art inside the card (same PF_ART draws as case pages) */
.project__art { position: absolute; inset: 0; width: 100%; height: 100%; }
.project__media--1 { background: linear-gradient(135deg, #3A4F87, #C7D0E6); }
.project__media--2 { background: linear-gradient(135deg, #E2623D, #F5D3C6); }
.project__media--3 { background: linear-gradient(135deg, #22315C, #B9C1D9); }
.project__media--4 { background: linear-gradient(135deg, #2B2B2E, #D6D6DA); }
.project__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 1.2rem;
}
.project__meta h3 { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: 1.4rem; letter-spacing: -0.01em; }
.project__meta span { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

/* Featured project — full-width cinematic card */
.project--featured { grid-column: 1 / -1; }
.project--featured .project__media { aspect-ratio: 21 / 9; }
.project--featured .project__meta h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
@media (max-width: 700px) {
  .project--featured .project__media { aspect-ratio: 4 / 3; }
}

/* ---------- Clients marquee ---------- */
.clients { text-align: center; padding-block: clamp(4rem, 8vh, 7rem); }
.clients__label {
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 3rem;
}
.marquee { overflow: hidden; width: 100%; -webkit-mask-image: linear-gradient(90deg, transparent, #fff 12%, #fff 88%, transparent); mask-image: linear-gradient(90deg, transparent, #fff 12%, #fff 88%, transparent); }
.marquee__track {
  display: flex;
  gap: 2.5rem;
  white-space: nowrap;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  letter-spacing: -0.01em;
  will-change: transform;
}
.marquee__track span:nth-child(even) { color: var(--accent-2); }

/* ---------- Contact ---------- */
.contact { max-width: var(--maxw); margin: 0 auto; text-align: center; }
.contact__title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(2.4rem, 8vw, 7rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 1rem 0 3rem;
}
.contact__title em { color: var(--accent-2); }
.contact__email {
  display: inline-block;
  font-size: clamp(1.1rem, 2.4vw, 1.8rem);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
  transition: border-color 0.4s var(--ease);
}
.contact__email:hover { border-color: var(--accent-2); }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2.5rem clamp(1.2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--bg);
}
.footer__social { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer__social a { padding: 0.4rem 0; }
.footer__social a:hover { color: var(--fg); }

/* ---------- Scroll progress bar ---------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--accent-2);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 9500;
  pointer-events: none;
}

/* ---------- Singularity easter egg (home) ---------- */
.singularity-flash {
  position: fixed;
  inset: 0;
  z-index: 9997;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, #3A4F87 0%, #E2623D 35%, transparent 72%);
  mix-blend-mode: multiply;
}

/* ---------- Reveal initial states (JS present only) ---------- */
html.js [data-reveal] { opacity: 0; transform: translateY(30px); }
html.js .cap { opacity: 0; transform: translateY(40px); }
html.js .project { opacity: 0; transform: translateY(50px); }
[data-reveal-line] { display: inline-block; }

/* ============================================================
   Case-study pages
   ============================================================ */
.case { padding-top: 5.5rem; }
.case section { padding-block: clamp(3rem, 8vh, 6rem); }

.case__crumb {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem clamp(1.2rem, 4vw, 3.5rem) 0;
}
.case__crumb a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}
.case__crumb a:hover { color: var(--fg); }

.case__hero { max-width: var(--maxw); margin: 0 auto; }
.case__hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.case__eyebrow {
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--accent-p);
  margin-bottom: 1.2rem;
}
.case__title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(2.4rem, 6.5vw, 5.5rem);
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin-bottom: 1.4rem;
}
.case__tagline {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  color: var(--muted);
  max-width: 34ch;
  margin-bottom: 1.8rem;
}
.case__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2.2rem; }
.case__tags li {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.35rem 0.9rem;
  color: var(--muted);
}
.case__meta {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(1.5rem, 4vw, 3rem);
  justify-content: start;
}
.case__meta dt {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.case__meta dd { font-size: 0.95rem; }

.case__art-wrap {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}
.case__art { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Film section — the project video, right after the case hero */
.case__film { max-width: var(--maxw); margin: 0 auto; }
.case__film .case__video { max-width: 980px; margin: 0 auto; }

/* Experience-it with a single card */
.case__cta--single { grid-template-columns: 1fr; max-width: 640px; }

/* Stat band */
.case__stat {
  max-width: var(--maxw);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.case__stat-num {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent-p);
  display: block;
}
.case__stat-label {
  display: block;
  margin-top: 0.6rem;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--muted);
}

/* Story */
.case__story { max-width: var(--maxw); margin: 0 auto; }
.case__lede {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
  max-width: 44ch;
  margin-bottom: 2rem;
}
.case__body, .case__process {
  max-width: 65ch;
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  line-height: 1.85;
  color: var(--muted);
}
.case__process {
  margin-top: 1.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

/* Breakdown grid */
.case__breakdown-wrap { max-width: var(--maxw); margin: 0 auto; }
.case__breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 2.5rem;
}
.case__breakdown-item {
  background: #ffffff;
  padding: clamp(1.8rem, 3vw, 3rem) clamp(1.4rem, 2.5vw, 2.4rem);
}
.case__breakdown-item h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-p);
  margin-bottom: 1.1rem;
}
.case__breakdown-item p { color: var(--muted); line-height: 1.75; font-size: 0.98rem; }

/* Experience-it CTA block */
.case__cta-wrap { max-width: var(--maxw); margin: 0 auto; }
.case__cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  margin-top: 2.5rem;
}
.case__cta-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1.8rem, 3vw, 3rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
}
.case__cta-card h3 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}
.case__cta-card p { color: var(--muted); font-size: 0.98rem; }
.case__cta-note { font-size: 0.85rem !important; }

/* Video poster (coming soon; video-ready) */
.case__video { width: 100%; }
.case__video-frame {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.case__video-frame video,
.case__video-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border: 0;
}
.case__play {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.92);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.case__play[disabled] { opacity: 0.7; cursor: not-allowed; }
.case__video figcaption {
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Prev / next project nav */
.case__pager-wrap { max-width: var(--maxw); margin: 0 auto; }
.case__pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  margin-top: 1.5rem;
}
.case__pager a {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.6rem 1.8rem;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.case__pager a:hover { border-color: var(--accent-p); background: var(--bg-soft); }
.case__pager a:last-child { text-align: right; }
.case__pager .dir {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.case__pager .name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  letter-spacing: -0.01em;
}

/* ============================================================
   3D experience page
   ============================================================ */
.xp-body { overflow: hidden; height: 100dvh; }
.xp-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  /* interaction surface — pointer events ON */
}
.xp-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem clamp(1.2rem, 4vw, 3.5rem);
  background: #ffffff;
  box-shadow: 0 2px 18px rgba(13, 13, 13, 0.08);
}
.xp-exit {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--fg);
  border-radius: 100px;
  padding: 0.6rem 1.3rem;
  min-height: 44px;
  font-size: 0.95rem;
  background: var(--fg);
  color: var(--bg);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.xp-exit:hover { background: var(--accent-p); border-color: var(--accent-p); color: #fff; }
.xp-caption {
  position: fixed;
  left: clamp(1.2rem, 4vw, 3.5rem);
  bottom: clamp(1.2rem, 4vw, 2.5rem);
  z-index: 100;
  max-width: min(420px, calc(100vw - 2.4rem));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.3rem 1.5rem;
}
.xp-caption h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.xp-caption p { color: var(--muted); font-size: 0.9rem; }
.xp-caption .xp-hint {
  margin-top: 0.7rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Fallback / chooser (no WebGL, bad ?p, or no JS) */
.xp-fallback {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem 3rem;
  background: var(--bg);
  overflow: auto;
}
.xp-fallback.is-visible, .no-webgl .xp-fallback { display: flex; }
.xp-fallback__inner { max-width: 560px; text-align: center; }
.xp-fallback__inner h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 1rem;
}
.xp-fallback__inner > p { color: var(--muted); margin-bottom: 2rem; }
.xp-fallback__links { display: grid; gap: 0.8rem; }
.xp-fallback__links a {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.4rem;
  font-family: "Space Grotesk", sans-serif;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.xp-fallback__links a:hover { border-color: var(--accent); background: var(--bg-soft); }
.no-webgl .xp-canvas, .no-webgl .xp-caption { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .case__hero-grid { grid-template-columns: 1fr; }
  .case__art-wrap { order: -1; max-width: 560px; }
  .case__breakdown { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__menu { display: flex; }
  /* the blob fills small viewports — soften it so hero text stays readable */
  .webgl { opacity: 0.55; }
  .cap { grid-template-columns: 50px 1fr; }
  .cap__desc { grid-column: 1 / -1; }
  .work__grid { grid-template-columns: 1fr; }
  .case__cta { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .case__breakdown { grid-template-columns: 1fr; }
  .case__meta { grid-template-columns: 1fr 1fr; }
  .case__pager { grid-template-columns: 1fr; }
  .case__pager a:last-child { text-align: left; }
  .footer { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  section { padding-inline: 1rem; }
  .case__crumb { padding-inline: 1rem; }
  .hero__title { font-size: clamp(2.4rem, 13vw, 3.4rem); }
  .project__meta { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .xp-caption { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .marquee__track { transform: none !important; }
}

/* ---------- Fallback: no WebGL (home) ---------- */
body.no-webgl { background: radial-gradient(circle at 30% 18%, #C7D0E6, #ffffff 60%); }
body.no-webgl .webgl { display: none; }
