/* Christian San Jose — personal site. Plain CSS, no framework, no build step.
   Motion follows Emil Kowalski's rules (github.com/emilkowalski/skills): one entrance per visit, transform/opacity only,
   strong custom curves, hover gated to real pointers, press feedback on everything pressable, gentler under reduced motion. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* dark pages */
  --bg: #29292f;
  --surface: rgb(241 244 246 / 0.03);
  --chrome: rgb(29 29 31 / 0.8);
  --text: #e6e6e6;
  --text-strong: #fff;
  --text-muted: #a6a6b1;
  --text-subtle: #9494a3;
  --text-faint: #9c9ca4;
  --accent: #acaccc;
  --accent-hover: #c9c9e6;

  /* light case study pages */
  --paper: #e6e6e6;
  --ink: #29292f;
  --ink-body: #616179;
  --ink-subtle: #5f5f71;
  --rule: #aeaebb;

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --press: 160ms var(--ease-out);
  --hover: 150ms ease;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; vertical-align: middle; }
img { border-radius: 20px; -webkit-user-drag: none; }
a { color: inherit; font-weight: 600; text-decoration: none; }
strong { font-weight: 600; }
p { margin: 20px 0; color: var(--text-muted); }
h1, h2, h3, h4 { font-weight: 400; text-wrap: balance; }
button { font: inherit; color: inherit; }
a, button { touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; }
::selection { background: rgb(172 172 204 / 0.4); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.light :focus-visible { outline-color: var(--ink); }
.muted { color: var(--text-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i-ne { display: inline-block; flex-shrink: 0; width: 0.85em; height: 0.85em; margin-left: 0.2em; vertical-align: -0.04em; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: calc(24px + var(--safe-top)) 0 auto; z-index: 100;
  display: flex; justify-content: center; padding: 0 max(40px, var(--safe-left)) 0 max(40px, var(--safe-right));
  pointer-events: none;
}
.nav-bar {
  position: relative; display: flex; align-items: stretch; padding: 8px;
  border-radius: 100px; pointer-events: auto;
  background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 0 0 1px rgb(234 238 241 / 0.04), 0 4px 30px rgb(0 0 0 / 0.08);
}
.nav-menu { display: flex; }
.nav-link {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 128px; min-height: 48px; padding: 12px 0; border-radius: 100px;
  color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.5; letter-spacing: 0.005em;
  transition: background-color var(--hover), transform var(--press);
}
/* "page" on the page itself, "true" for its section (the Case Studies link on a case study) */
.nav-link[aria-current] { background: rgb(255 255 255 / 0.06); }
.nav-link:active { transform: scale(0.97); }
/* the same material as the current pill, a step brighter on hover and while open */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 12px; margin-left: auto;
  border: 0; border-radius: 100px; background: rgb(255 255 255 / 0.06); cursor: pointer;
  transition: background-color var(--hover), transform var(--press);
}
.nav[data-open] .nav-toggle { background: rgb(255 255 255 / 0.12); }
.nav-toggle:active { transform: scale(0.95); }
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle path { transition: transform 200ms var(--ease-out), opacity 150ms ease; transform-origin: 12px 12px; }
/* move each line to the middle first, then turn it, so both cross at the centre */
.nav[data-open] .nav-toggle .bar-top { transform: rotate(45deg) translateY(5px); }
.nav[data-open] .nav-toggle .bar-mid { opacity: 0; }
.nav[data-open] .nav-toggle .bar-bot { transform: rotate(-45deg) translateY(-5px); }

/* ---------- Page layout ---------- */
.page {
  display: grid; row-gap: 150px; width: 100%;
  padding: 200px max(40px, var(--safe-right)) 40px max(40px, var(--safe-left));
}
.page.case-study-page { padding-top: 140px; }
.stack { display: grid; row-gap: 24px; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; max-width: 1200px; margin: 0 auto; }
.column { display: grid; gap: 24px; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.avatar { flex-shrink: 0; width: 140px; height: 140px; border: 6px solid #32323f; border-radius: 50%; object-fit: cover; }
.heading-super {
  max-width: 900px; margin: 24px 0 10px;
  color: var(--text); font-size: 44px; font-weight: 400; line-height: 1.05; letter-spacing: -0.04em;
}
.hero-text {
  max-width: 52ch; margin: 20px 0;
  color: var(--text); font-size: 21px; line-height: 1.45; letter-spacing: -0.015em; text-wrap: pretty;
}
.hero-text strong { color: var(--accent); }
.hero-sub { margin: 20px 0 72px; color: var(--text-subtle); font-size: 21px; letter-spacing: -0.015em; }
.hero-sub a { color: #b4b4c2; transition: color var(--hover); }
.case-study-page .hero-text { margin-bottom: 40px; }

/* ---------- Modules (cards) ---------- */
.module {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  width: 100%; padding: 40px; border-radius: 24px;
  background: var(--surface); color: var(--text-strong); text-align: center;
}
.module-inner { width: 90%; margin-block: auto; display: flex; flex-direction: column; align-items: center; }
.description {
  max-width: 32ch; margin: 8px 0;
  color: var(--text-strong); font-size: 19px; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em; text-wrap: balance;
}
.description.wide { max-width: 55ch; }
.description.quote { max-width: 40ch; }
.date { max-width: 34ch; margin: 16px 0 0; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.45; text-wrap: balance; }
.site-link { color: var(--accent); white-space: nowrap; transition: color var(--hover); }
.label {
  margin: 0 0 10px; color: var(--text-muted);
  font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: 0.08em; text-transform: uppercase;
}
figure.module { margin: 0; justify-content: center; }
figure.module > blockquote { width: 90%; }

/* ---------- Image sliders ---------- */
.slider { position: relative; width: 100%; border-radius: 16px; touch-action: pan-y; }
.slider.top { margin-bottom: 40px; }
.slider.bottom { margin-top: 40px; }
.slides { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 16px; isolation: isolate; }
.slide { position: absolute; inset: 0; visibility: hidden; }
.slide.is-active, .slide.is-moving { visibility: visible; }
.slide.is-active { z-index: 1; }
.slide.is-moving { z-index: 2; }
.slide img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 16px;
  background: var(--slide-bg, transparent);
}
.slider-prev, .slider-next {
  position: absolute; top: 0; bottom: 0; z-index: 3; width: 50%;
  border: 0; padding: 0; background: none;
}
.slider-prev { left: 0; cursor: w-resize; }
.slider-next { right: 0; cursor: e-resize; }
.slider-prev:focus-visible, .slider-next:focus-visible { outline-offset: -4px; border-radius: 16px; }
.slider.is-dragging .slider-prev, .slider.is-dragging .slider-next { cursor: grabbing; }
.dots {
  position: absolute; left: 0; right: 0; bottom: 6px; z-index: 4;
  display: flex; justify-content: center; align-items: center; pointer-events: none;
}
/* each dot is a 24px target around a 6px mark */
.dot {
  position: relative; width: 16px; height: 24px; padding: 0; border: 0; background: none;
  cursor: pointer; pointer-events: auto;
}
.dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgb(255 255 255 / 0.45); box-shadow: 0 0 0 0.5px rgb(0 0 0 / 0.08);
  transition: background-color var(--hover), transform var(--press);
}
.dot[aria-current="true"]::before { background: #fff; }
.dot:active::before { transform: scale(0.8); }
.dot:focus-visible { outline: none; }
.dot:focus-visible::before { box-shadow: 0 0 0 2px var(--accent); }

/* Copy.ai: image runs to the module's edges */
.module-image-bottom { align-self: stretch; margin: 40px -40px -40px; border-radius: 16px 16px 0 0; overflow: hidden; }
.module-image-bottom img { display: block; width: 100%; height: auto; border-radius: 0; }

/* ---------- Fun facts row ---------- */
.facts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; width: 100%; max-width: 1200px; margin: 0 auto; }
.video-module { min-height: 500px; }
.video-module video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.45; border-radius: 0; }
.facts { padding: 0; overflow: visible; }
.facts .slider { height: 100%; min-height: 500px; border-radius: 24px; overflow: hidden; }
.facts .slides { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 24px; }
.facts .slide img { object-fit: cover; opacity: 0.7; border-radius: 0; }
.fact {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; margin: 0;
  padding: 16px 16px 34px; border-radius: 20px;
  background: rgb(45 45 51 / 0.8); -webkit-backdrop-filter: blur(8px) saturate(140%); backdrop-filter: blur(8px) saturate(140%);
  color: #fff; font-size: 13px; line-height: 1.6; text-align: left; text-wrap: pretty;
}
.fact a { color: #fff; }
.badge { position: absolute; top: -30px; right: -30px; z-index: 10; width: 80px; border-radius: 0; pointer-events: none; }

/* ---------- Chat ---------- */
.chat { align-items: flex-start; text-align: left; }
.chat .eyebrow { margin: 4px 0 16px; color: var(--text-faint); font-size: 21px; font-weight: 500; line-height: 1.2; letter-spacing: -0.015em; }
.chat-links { margin: 0 0 75px; font-size: 19px; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em; }
.underline-link {
  color: var(--text-strong); padding-bottom: 2px;
  border-bottom: 1px solid rgb(155 155 163 / 0.35); transition: border-color var(--hover);
}
.icon-tile {
  display: flex; align-items: center; justify-content: center;
  width: 80px; height: 80px; border-radius: 31.25%;
  background: var(--bg); color: var(--text-strong); font-size: 40px;
  transition: background-color var(--hover), transform var(--press);
}
.icon-tile:active { transform: scale(0.95); }
.icon-tile svg { width: 1em; height: 1em; }

/* ---------- Footer ---------- */
.site-footer {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 64px 24px;
  padding: 40px max(40px, calc((100% - 1200px) / 2)); border-radius: 24px; background: var(--surface);
  color: var(--text-faint); font-size: 14px;
}
.site-footer .about { grid-column: span 9; max-width: 28em; margin: 0; color: var(--text); font-size: 19px; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em; text-wrap: balance; }
.site-footer .links { grid-column: span 3; display: grid; gap: 8px; justify-items: start; }
.site-footer .links a { color: var(--text-strong); transition: color var(--hover); }
.site-footer .copyright { grid-column: span 10; margin: 0; }

/* ---------- Case study list ---------- */
.case-thumb { display: block; width: 100%; margin-bottom: 40px; border-radius: 20px; transition: opacity var(--hover), transform var(--press); }
.case-thumb:active { transform: scale(0.985); }
.case-thumb.bottom { margin: 40px 0 0; }
.case-thumb.soon { opacity: 0.55; }
.case-thumb.soon:active { transform: none; }
.case-thumb img { display: block; width: 100%; height: auto; }

/* ---------- Case study pages (light) ---------- */
body.light { background: var(--paper); color: var(--ink); }
.project-page { display: flex; flex-direction: column; justify-content: space-between; min-height: 100svh; }
.project-content { display: flex; flex-direction: column; align-items: center; padding: 140px 60px 120px; }
.project-eyebrow { margin: 0 0 10px; color: var(--ink-subtle); font-size: 23px; font-weight: 300; line-height: 1.1; }
.project-title { max-width: 22ch; margin: 8px 0 40px; color: var(--ink); text-align: center; font-size: 60px; font-weight: 300; line-height: 1.1; letter-spacing: -0.035em; }
.back { margin-bottom: 40px; color: var(--ink-subtle); font-size: 18px; font-weight: 400; line-height: 1; transition: color var(--hover); }
.project-hero { width: 100%; height: auto; max-height: 770px; object-fit: cover; border-radius: 24px; margin: 0; }
.prose { width: 100%; max-width: 900px; margin-top: 5vw; }
/* text keeps a readable measure; figures and embeds keep the full width */
.prose > :not(figure) { max-width: 680px; margin-left: auto; margin-right: auto; } /* ~70 characters of body text; px so headings share the edge */
.prose h2, .prose h3, .prose h4 { color: var(--ink); }
.prose h2 { margin-top: 48px; margin-bottom: 20px; font-size: 40px; line-height: 1.15; letter-spacing: -0.03em; }
.prose h3 { margin-top: 40px; margin-bottom: 10px; font-size: 24px; font-weight: 500; line-height: 1.35; letter-spacing: -0.015em; }
.prose h4 { margin-top: 24px; margin-bottom: 0; font-size: 18px; font-weight: 500; line-height: 1.4; }
.prose p, .prose ul, .prose ol, .prose blockquote { color: var(--ink-body); text-wrap: pretty; }
.prose ul, .prose ol { margin-top: 0; margin-bottom: 20px; padding-left: 1.5em; }
.prose li + li { margin-top: 4px; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: rgb(41 41 47 / 0.3); text-underline-offset: 3px; transition: text-decoration-color var(--hover); }
.prose blockquote { margin-top: 0; margin-bottom: 40px; padding: 10px 20px; border-left: 3px solid var(--rule); font-size: 16px; line-height: 1.6; }
.prose blockquote strong { color: var(--ink); }
.prose figure { clear: both; margin: 32px auto; text-align: center; }
.prose figure img, .prose figure video { display: block; width: 100%; height: auto; border-radius: 20px; }
.prose figcaption { margin-top: 10px; color: var(--ink-subtle); text-align: center; font-size: 14px; }
.prose figure.float-left { float: left; clear: none; margin: 8px 24px 16px 0; }
.prose figure.float-right { float: right; clear: none; margin: 8px 0 16px 24px; }
.prose .embed { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.prose .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 20px; }
.prose::after { content: ""; display: table; clear: both; }
.project-footer {
  display: flex; justify-content: space-between; margin: 16px; padding: 40px 50px;
  border-radius: 24px; background: var(--ink); color: var(--paper);
}
.project-footer .group { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; }
.project-footer .group > * { margin: 0 14px; color: var(--paper); font-size: 16px; font-weight: 400; line-height: 1.3; opacity: 0.6; transition: opacity var(--hover); }
.project-footer .group > strong { font-weight: 600; }
.project-footer a[aria-current="page"] { opacity: 1; }

/* ---------- PIN page (rendered by middleware.js) ---------- */
.pin-page { display: grid; place-items: center; min-height: 100svh; padding: 120px 24px 40px; }
.pin-card { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 400px; text-align: center; }
.pin-message { margin: 16px 0 28px; color: var(--text-muted); font-size: 17px; line-height: 1.5; text-wrap: balance; }
.pin-message.is-error { color: #ffb4b4; }
.pin-form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.pin-input, .pin-button { height: 52px; border-radius: 9999px; font: inherit; font-size: 16px; }
.pin-input {
  padding: 0 20px; border: 1px solid rgb(255 255 255 / 0.08); background: rgb(255 255 255 / 0.05); color: var(--text);
  text-align: center; letter-spacing: 0.25em; transition: background-color var(--hover), border-color var(--hover);
}
.pin-input::placeholder { color: var(--text-subtle); letter-spacing: 0.05em; }
.pin-input:focus { background: rgb(255 255 255 / 0.1); border-color: rgb(255 255 255 / 0.25); outline: none; }
.pin-input[aria-invalid="true"] { border-color: rgb(255 180 180 / 0.5); }
.pin-button { border: 0; background: var(--text); color: var(--bg); font-weight: 600; cursor: pointer; transition: background-color var(--hover), transform var(--press); }
.pin-button:active { transform: scale(0.97); }
.pin-help { margin-top: 28px; color: var(--text-subtle); font-size: 14px; }
.pin-help a { color: var(--accent); }

/* ---------- 404 ---------- */
.not-found { display: grid; place-items: center; min-height: 100svh; padding: 120px 24px 40px; text-align: center; }
.not-found p { margin: 8px 0 24px; }
.not-found a { color: var(--accent); }

/* ---------- Hover: only for real pointers (touch would leave it stuck after a tap) ---------- */
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { background: rgb(255 255 255 / 0.06); }
  .nav-toggle:hover { background: rgb(255 255 255 / 0.1); }
  .nav-menu .nav-link:hover .i-ne { color: var(--text); }
  .hero-sub a:hover { color: #fff; }
  .site-link:hover { color: var(--accent-hover); }
  .underline-link:hover { border-color: #fff; }
  .icon-tile:hover { background: #222227; }
  .site-footer .links a:hover { color: #b6b6d8; }
  .case-thumb:not(.soon):hover { opacity: 0.85; }
  .dot:hover::before { background: rgb(255 255 255 / 0.75); }
  .dot[aria-current="true"]:hover::before { background: #fff; }
  .back:hover { color: var(--ink); }
  .prose a:hover { text-decoration-color: currentColor; }
  .project-footer a:hover { opacity: 1; }
  .pin-input:hover { background: rgb(255 255 255 / 0.08); }
  .pin-button:hover { background: #fff; }
}

/* ---------- Entrance: once per visit (html.intro is set in <head>), the hero only ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(var(--rise, 10px)); } }
@keyframes fade-in { from { opacity: 0; } }
.intro [data-enter] {
  animation: enter 600ms var(--ease-out) both;
  animation-delay: var(--delay, 0ms);
}

/* Page to page: a short crossfade, so dark ↔ light pages don't flash */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: ease; }

/* ---------- Tablet ---------- */
@media (max-width: 991px) {
  .nav { inset: calc(12px + var(--safe-top)) 0 auto; padding: 0 max(12px, var(--safe-right)) 0 max(12px, var(--safe-left)); }
  /* the home bar spans the width: CSJ on the left, the toggle on the right, both inset 8px like everywhere else.
     The two-link bars stay compact and centred, as on desktop. */
  [data-nav] .nav-bar { flex: 1; }
  [data-nav] .nav-toggle { display: flex; }
  /* the menu: one solid panel that grows from the toggle. 48px links + 8px padding = 32px corners, the bar's own */
  [data-nav] .nav-menu {
    position: absolute; top: calc(100% + 8px); right: 0; width: 240px;
    flex-direction: column; gap: 4px; padding: 8px; border-radius: 32px;
    background: #1f1f24; box-shadow: inset 0 0 0 1px rgb(234 238 241 / 0.04), 0 12px 40px rgb(0 0 0 / 0.35);
    opacity: 0; visibility: hidden; transform: translateY(-4px) scale(0.97); transform-origin: top right;
    transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out), visibility 0s linear 150ms;
  }
  [data-nav] .nav-menu .nav-link { width: 100%; justify-content: space-between; padding: 12px 16px; }
  [data-nav] .nav-menu .i-ne { width: 14px; height: 14px; color: var(--text-muted); transition: color var(--hover); }
  .nav[data-open] .nav-menu {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s;
  }
  .heading-super { font-size: 64px; }
  .hero-text { font-size: 20px; line-height: 1.42; }
  .module { padding: 36px; }
  .module-inner { width: 100%; }
  .module-image-bottom { margin: 36px -36px -36px; border-radius: 0 0 24px 24px; }
  .slider.top { margin-bottom: 30px; }
  .page { row-gap: 100px; padding: 100px max(24px, var(--safe-right)) 0 max(24px, var(--safe-left)); }
  .stack { row-gap: 20px; }
  .facts-row { grid-template-columns: 1fr 1fr; }
  .video-module { min-height: 0; justify-content: flex-start; }
  .video-module video { position: static; flex: 1; min-height: 250px; margin-bottom: 20px; opacity: 1; border-radius: 16px; }
  .badge { display: none; }
  .site-footer { margin: 0 calc(-1 * max(24px, var(--safe-left))); padding: 40px max(24px, var(--safe-left)); border-radius: 0; }
  .site-footer .about { grid-column: span 6; }
  .site-footer .links { grid-column: span 6; }
  .project-title { font-size: 50px; }
  .project-content { padding: 140px 40px 100px; }
  .project-footer { padding: 40px 30px; }
}

/* ---------- Phone landscape / small tablet ---------- */
@media (max-width: 767px) {
  .heading-super { font-size: 48px; letter-spacing: -0.035em; margin-bottom: 24px; }
  .module { border-radius: 20px; }
  .module-image-bottom { margin-top: 24px; border-radius: 0 0 20px 20px; }
  .columns, .facts-row { grid-template-columns: 1fr; }
  .site-footer { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
  .site-footer .about { text-align: center; }
  .site-footer .links { justify-items: center; }
  .project-title { font-size: 40px; }
  .project-content { padding: 140px 30px 80px; }
  .prose figure.float-left, .prose figure.float-right { float: none; margin: 32px auto; }
  .project-footer { flex-direction: column; padding: 30px; }
  .project-footer .group { flex-direction: column; margin: 7px 0; }
  .project-footer .group > * { margin: 7px 0; }
}

/* ---------- Phone ---------- */
@media (max-width: 479px) {
  .heading-super { font-size: 32px; letter-spacing: -0.03em; margin-bottom: 12px; }
  .hero { margin-bottom: 20px; }
  .hero-text, .hero-sub { font-size: 17px; line-height: 1.55; letter-spacing: -0.005em; }
  .description { font-size: 18px; }
  .module { padding: 24px; }
  .module-image-bottom { margin: 24px -24px -24px; }
  .page { row-gap: 72px; padding: 100px max(12px, var(--safe-right)) 0 max(12px, var(--safe-left)); }
  .site-footer { margin: 0 calc(-1 * max(12px, var(--safe-left))); padding: 72px 36px; }
  /* two-link bars split the width evenly; a single link (the 404) stays a compact pill */
  .nav-bar:has(> .nav-link + .nav-link) { flex: 1; }
  .nav-bar:has(> .nav-link + .nav-link) > .nav-link { flex: 1; width: auto; }
  .icon-tile { width: 64px; height: 64px; font-size: 24px; }
  .project-eyebrow { font-size: 14px; font-weight: 400; }
  .project-title { font-size: 35px; }
  .project-content { padding: 140px 20px 60px; }
  .project-hero { min-height: 300px; }
  .back { font-size: 15px; }
  .prose h2 { font-size: 30px; }
  .project-footer { padding: 30px 20px; }
}

/* ---------- Reduced motion: fades instead of movement, nothing that plays on its own ---------- */
@media (prefers-reduced-motion: reduce) {
  .intro [data-enter] { animation: fade-in 300ms ease both; animation-delay: 0ms; }
  [data-nav] .nav-menu, .nav[data-open] .nav-menu { transform: none; }
  .nav-toggle path { transition: opacity 150ms ease; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 150ms; }
}

/* ---------- Reduced transparency / more contrast: solid surfaces ---------- */
@media (prefers-reduced-transparency: reduce) {
  .nav-bar { background: #1d1d1f; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .fact { background: #2d2d33; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .nav-bar { background: #1d1d1f; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3); }
  .module, .site-footer { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); }
  .muted, p { color: var(--text); }
}
@media (prefers-contrast: more) and (max-width: 991px) {
  [data-nav] .nav-menu { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3), 0 12px 40px rgb(0 0 0 / 0.35); }
}
