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

/* ─── TOKENS ─────────────────────────────────────── */
:root {
  --fg:     #1a1a1a;   /* primary   — near-black */
  --fg2:    #4a4a4a;   /* secondary — dark gray */
  --fg3:    #7a7a7a;   /* tertiary  — medium gray */
  --fg4:    #b0b0b0;   /* subtle    — muted */
  --border: #d8d8d8;
  --border-faint: #eeeeee;
  --bg:     #fff;
  --bg2:    #f6f6f6;
  --mono:   'Manrope', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --sans:   -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --fg:     #e8e8e8;   /* primary   — near-white */
  --fg2:    #b0b0b0;   /* secondary — light gray */
  --fg3:    #848484;   /* tertiary  — medium gray */
  --fg4:    #686868;   /* subtle    — muted but visible */
  --border: #2e2e2e;
  --border-faint: #272727;
  --bg:     #0e0e0e;
  --bg2:    #161616;
}

/* ─── BASE ───────────────────────────────────────── */
html, body {
  height: 100%;
}

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--fg);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 11px;
  transition: background var(--transition), color var(--transition);
}

/* ─── SIDEBAR ────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  height: 100vh;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 22px;
  overflow: hidden;
  transition: border-color var(--transition);
}

.sidebar-top {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-name-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0000FF;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.sidebar-title {
  font-size: 9.5px;
  font-weight: 400;
  color: var(--fg3);
  line-height: 1.45;
  margin-bottom: 20px;
  letter-spacing: 0;
}

.sidebar-bio {
  font-size: 9px;
  font-weight: 400;
  color: var(--fg3);
  line-height: 1.6;
  letter-spacing: 0;
}

.sidebar-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  transition: border-color var(--transition);
  flex-shrink: 0;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-links a {
  font-size: 11px;
  font-weight: 400;
  color: var(--fg3);
  text-decoration: none;
  letter-spacing: 0;
  transition: color 0.15s;
}

.sidebar-links a:hover {
  color: var(--fg);
}

.sidebar-bottom .theme-toggle {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ─── MOBILE LOGO DOT ────────────────────────────── */
.mobile-logo-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #0000FF;
  flex-shrink: 0;
}

/* ─── MOBILE HEADER (hidden on desktop) ──────────── */
.mobile-header {
  display: none;
}

/* ─── MOBILE OVERLAY (hidden on desktop) ─────────── */
.mobile-overlay {
  display: none;
}

/* ─── MOBILE NAV PILL (hidden on desktop) ────────── */
.mobile-nav-pill {
  display: none;
}

/* ─── THEME TOGGLE ───────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.toggle-lbl {
  font-size: 8.5px;
  font-weight: 400;
  color: var(--fg3);
  letter-spacing: 0.04em;
  width: 24px;
}

.toggle-track {
  width: 26px;
  height: 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg2);
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] .toggle-track {
  background: #2a2a2a;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg3);
  transition: transform 0.2s, background 0.2s;
}

[data-theme="dark"] .toggle-thumb {
  transform: translateX(12px);
  background: var(--fg2);
}

/* ─── MAIN ───────────────────────────────────────── */
.main {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.main::-webkit-scrollbar { width: 3px; }
.main::-webkit-scrollbar-thumb { background: var(--border); }

/* ─── NAV INDEX ──────────────────────────────────── */
.nav-index {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 30px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.35s ease, background 0.1s, border-color var(--transition);
}

/* Inactive rows dim when a section is open — always, since one is always active */
.nav-item:not(.active) {
  opacity: 0.48;
}

.nav-item:last-child {
  border-bottom: none;
}

.nav-item:hover {
  background: var(--bg2);
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.nav-num {
  font-size: 9px;
  font-weight: 400;
  color: var(--fg4);
  letter-spacing: 0;
}

.nav-item.active .nav-label {
  font-weight: 500;
  color: var(--fg);
}

.nav-item.active .nav-num {
  color: var(--fg4);
  font-weight: 400;
}

/* ─── SECTIONS ───────────────────────────────────── */
.project-section {
  display: none;
  padding: 36px 30px;
  flex: 1;
}

.project-section.visible {
  display: block;
  /* animation handled by .is-entering on entrance, not on every show */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── SECTION TRANSITIONS ─────────────────────────── */

/* Exit: current section fades out and lifts slightly */
@keyframes sectionExit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-7px); }
}

.project-section.is-exiting {
  display: block;
  animation: sectionExit 0.2s ease forwards;
  pointer-events: none;
}

/* Enter: staggered reveal keyframe */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Group 1: intro paragraph + sub-nav breadcrumb (0ms) */
.project-section.is-entering > .project-description,
.project-section.is-entering > .sub-nav {
  animation: revealUp 0.44s ease both;
}

/* ── Group 2: project title + "Project Details" heading (130ms) */
.project-section.is-entering .meta-col-title {
  animation: revealUp 0.42s ease 0.13s both;
}

/* ── Group 3: sub-points + metadata rows (250ms) */
.project-section.is-entering .meta-tag {
  animation: revealUp 0.42s ease 0.25s both;
}

/* ── Group 4: body description + credit (370ms) */
.project-section.is-entering .project-description.mt,
.project-section.is-entering .credit-line {
  animation: revealUp 0.42s ease 0.37s both;
}

/* ── Group 5: image grid (490ms, slightly longer for weight) */
.project-section.is-entering .gallery-grid {
  animation: revealUp 0.52s ease 0.49s both;
}

/* Suppress sub-project's own fadeIn when parent section is entering */
.project-section.is-entering .sub-project {
  animation: none;
}

/* ─── NEXT PROJECT NUDGE ────────────────────────── */
.next-project-nudge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 52px 0 44px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.next-project-nudge.nudge-visible {
  opacity: 1;
  transform: translateY(0);
}
.next-project-nudge:hover .npn-label {
  color: var(--fg);
}
.next-project-nudge:hover .npn-arrow {
  animation: nudgeSlide 0.9s ease-in-out infinite;
}
.npn-num {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--fg4);
  letter-spacing: 0.04em;
}
.npn-sep {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--fg4);
}
.npn-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--fg3);
  letter-spacing: -0.01em;
  transition: color 0.25s;
}
.npn-arrow {
  color: var(--fg3);
  display: flex;
  align-items: center;
  margin-left: 2px;
  animation: nudgeIdle 2.4s ease-in-out infinite;
}
@keyframes nudgeIdle {
  0%, 100% { transform: translateX(0);   opacity: 0.55; }
  50%       { transform: translateX(4px); opacity: 0.9; }
}
@keyframes nudgeSlide {
  0%, 100% { transform: translateX(0);   opacity: 0.8; }
  50%       { transform: translateX(6px); opacity: 1; }
}

/* ─── SCROLL REVEAL ─────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
[data-reveal].in-view {
  opacity: 1;
  transform: translateY(0);
}
/* Freeze reveal transitions during entrance animations — let keyframes run cleanly */
.project-section.is-entering [data-reveal],
.sub-project.is-entering-sub [data-reveal] {
  transition: none;
}

/* ─── TYPOGRAPHY ─────────────────────────────────── */
.credit-line {
  font-size: 9.5px;
  font-weight: 400;
  color: var(--fg4);
  margin-top: 8px;
  margin-bottom: 28px;
}

/* Top intro paragraph */
.project-description {
  font-size: 10px;
  font-weight: 400;
  color: var(--fg4);
  line-height: 1.6;
  max-width: 480px;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

/* Body paragraph */
.project-description.mt {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--fg2);
  line-height: 1.62;
  max-width: 460px;
  margin-top: 20px;
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

/* ─── META GRID ──────────────────────────────────── */
.project-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 40px;
  border-top: 1px solid var(--border-faint);
  padding-top: 24px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

/* Right column label — "Project Details" */
.meta-col-title {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg2);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

/* Left column — main project title */
.project-meta > div:first-child .meta-col-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.meta-tag {
  font-size: 9px;
  font-weight: 400;
  color: var(--fg3);
  line-height: 1.7;
  display: block;
  letter-spacing: -0.01em;
}

/* ─── SUB NAV ────────────────────────────────────── */
.sub-nav {
  border-top: 1px solid var(--border-faint);
  padding-top: 12px;
  margin-top: 28px;
  transition: border-color var(--transition);
}

.sub-nav-items {
  display: flex;
  flex-wrap: wrap;
}

.sub-nav-item {
  font-size: 9.5px;
  font-weight: 400;
  color: var(--fg3);
  cursor: pointer;
  padding: 3px 0;
  letter-spacing: 0;
  transition: color 0.15s;
}

.sub-nav-item:not(:last-child)::after {
  content: ' / ';
  color: var(--fg4);
  margin: 0 4px;
}

.sub-nav-item:hover {
  color: var(--fg2);
}

.sub-nav-item.active {
  color: var(--fg);
  font-weight: 500;
}

/* ─── SUB PROJECTS ───────────────────────────────── */
.sub-project {
  display: none;
  margin-top: 28px;
}

.sub-project.visible {
  display: block;
  /* animation controlled by JS via .is-entering-sub */
}

.sub-project.is-entering-sub {
  animation: fadeIn 0.3s ease;
}

/* ─── IMAGE PLACEHOLDER ──────────────────────────── */
.image-placeholder {
  width: 100%;
  height: 200px;
  background: var(--bg2);
  border-radius: 2px;
  margin-top: 28px;
  transition: background var(--transition);
}

/* ─── PROJECT IMAGE & VIDEO ──────────────────────── */
.project-image {
  width: 100%;
  border-radius: 2px;
  margin-top: 28px;
  display: block;
}

.project-video {
  width: 100%;
  border-radius: 2px;
  margin-top: 16px;
  display: block;
}

/* ─── GALLERY GRID ──────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 28px -30px 0;
}

.gallery-item.gi-wide {
  grid-column: 1 / -1;
}

/* Square frames for paired items (non gi-wide) */
.gallery-item:not(.gi-wide) .gallery-item-inner {
  aspect-ratio: 1 / 1;
}
.gallery-item:not(.gi-wide) .gallery-item-inner img,
.gallery-item:not(.gi-wide) .gallery-item-inner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 3-column grid — natural image height */
.gallery-grid.col-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.gallery-grid.col-3 .gallery-item .gallery-item-inner {
  aspect-ratio: unset;
}
.gallery-grid.col-3 .gallery-item .gallery-item-inner img,
.gallery-grid.col-3 .gallery-item .gallery-item-inner video {
  width: 100%;
  height: auto;
  object-fit: unset;
}

/* Dark centered container — video at natural size, centered on dark bg */
.gallery-item.gi-wide.gi-dark .gallery-item-inner {
  background: #1A1A1A;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}
.gallery-item.gi-wide.gi-dark .gallery-item-inner video {
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: unset;
}

/* Connected pair — two items side by side, no gap between them */
.gallery-pair {
  grid-column: 1 / -1;
  display: flex;
}
.gallery-pair .gallery-item-inner {
  flex: 1;
}
.gallery-pair .gallery-item-inner img,
.gallery-pair .gallery-item-inner video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-pair .gallery-item-inner:first-child {
  border-radius: 2px 0 0 2px;
}
.gallery-pair .gallery-item-inner:last-child {
  border-radius: 0 2px 2px 0;
}

/* ─── VIDEO CAROUSEL ───────────────────────────── */
.video-carousel {
  position: relative;
  margin: 12px 0 0;
}
.video-carousel-track {
  position: relative;
  background: #1A1A1A;
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.video-carousel-track video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s;
}
.video-carousel-track video.active {
  opacity: 1;
}

/* Arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s, background 0.3s;
}
.video-carousel:hover .carousel-arrow,
.image-carousel:hover .carousel-arrow {
  opacity: 1;
}

/* ─── IMAGE CAROUSEL ─────────────────────────────── */
.image-carousel {
  position: relative;
  margin: 12px 0 0;
}
.image-carousel-track {
  position: relative;
  background: var(--bg2);
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.image-carousel-track img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s;
}
.image-carousel-track img.active {
  opacity: 1;
}
.carousel-arrow:hover {
  background: var(--bg2);
}
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }

/* Dots — default (standalone) */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.3s;
}
.carousel-dot.active {
  background: var(--fg);
}

/* ─── IMAGE CAROUSEL inside gallery-item ─────────── */
/* Fill the cell exactly like a regular image */
.gallery-item {
  position: relative;
}
.gallery-item .image-carousel {
  position: absolute;
  inset: 0;
  margin: 0;
  border-radius: 2px;
  overflow: hidden;
}
.gallery-item .image-carousel-track {
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
  border-radius: 0;
}
/* ─── CAROUSEL BAR — Apple glassmorphism ─────────── */
.carousel-bar {
  position: absolute;
  bottom: 13px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  z-index: 3;
}

/* Glass base — shared, explicit height so all three are identical */
.carousel-bar .carousel-dots,
.carousel-bar-btn {
  height: 22px;
  box-sizing: border-box;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 100px;
  display: flex;
  align-items: center;
}

/* Dots pill */
.carousel-bar .carousel-dots {
  gap: 5px;
  padding: 0 12px;
  margin: 0;
  justify-content: center;
}
.carousel-bar .carousel-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
  flex-shrink: 0;
}
.carousel-bar .carousel-dot.active {
  background: rgba(255,255,255,0.75);
  transform: scale(1.2);
}

/* Arrow buttons — perfect circle */
.carousel-bar-btn {
  width: 22px;
  padding: 0;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.62);
  transition: background 0.2s;
  /* Reset inherited carousel-arrow absolute positioning */
  position: static;
  top: auto; left: auto; right: auto;
  transform: none;
  opacity: 1;
}
.carousel-bar-btn:hover {
  background: rgba(255,255,255,0.16);
}
.carousel-bar-btn svg {
  display: block;
  flex-shrink: 0;
}

.gallery-item-inner {
  background: var(--bg2);
  border-radius: 2px;
  overflow: hidden;
  transition: background var(--transition);
}

.gallery-item-inner img,
.gallery-item-inner video {
  display: block;
  width: 100%;
  height: auto;
}

/* Theme-aware images: swap light/dark versions */
.img-light { display: block; }
.img-dark  { display: none; }
[data-theme="dark"] .img-light { display: none; }
[data-theme="dark"] .img-dark  { display: block; }

/* Video player with play button */
.video-player {
  position: relative;
  cursor: pointer;
}
.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.3s;
  z-index: 2;
}
.video-player.playing .play-btn {
  opacity: 0;
  pointer-events: none;
}
.video-player.playing:hover .play-btn {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════ */
/* ─── RESPONSIVE ─────────────────────────────────── */
/* ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* html is the scroll container on mobile */
  html {
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  /* ─── Mobile Header ──────────────────────────── */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition), border-color var(--transition);
  }

  .mobile-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--fg);
    letter-spacing: 0.01em;
    font-family: var(--mono);
  }

  .mobile-menu-btn {
    font-size: 9px;
    font-weight: 400;
    color: var(--fg2);
    cursor: pointer;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    background: none;
    border: none;
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    /* Spring-back on release */
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
  }

  /* Snap-in on press (JS adds this class) */
  .mobile-menu-btn.is-pressed {
    transform: scale(0.80);
    transition: transform 0.08s cubic-bezier(0.4, 0, 1, 1);
  }

  /* ─── Sidebar becomes overlay on mobile ──────── */
  .sidebar {
    display: none;
  }

  .mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 200;
    flex-direction: column;
    background: var(--bg);
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: background var(--transition);
  }

  /* Overlay open */
  @keyframes overlayIn {
    from { opacity: 0; transform: scale(0.97) translateY(-8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
  }
  /* Overlay close */
  @keyframes overlayOut {
    from { opacity: 1; transform: scale(1)    translateY(0);    }
    to   { opacity: 0; transform: scale(0.97) translateY(-8px); }
  }

  .mobile-overlay.open {
    display: flex;
    animation: overlayIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .mobile-overlay.is-closing {
    display: flex;           /* keep visible during exit */
    animation: overlayOut 0.18s cubic-bezier(0.4, 0, 1, 1) both;
  }

  .mobile-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
  }

  .mobile-overlay-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--fg);
    letter-spacing: 0.01em;
    font-family: var(--mono);
  }

  .mobile-close-btn {
    font-size: 9px;
    font-weight: 400;
    color: var(--fg2);
    cursor: pointer;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    background: none;
    border: none;
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    /* Spring-back on release */
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  /* Snap-in on press (JS adds this class) */
  .mobile-close-btn.is-pressed {
    transform: scale(0.80) rotate(12deg);
    transition: transform 0.08s cubic-bezier(0.4, 0, 1, 1);
    color: var(--fg);
  }

  .mobile-overlay .sidebar-title {
    font-size: 13px;
    font-weight: 400;
    color: var(--fg3);
    line-height: 1.6;
    margin-bottom: 18px;
    letter-spacing: 0.01em;
    flex-shrink: 0;
  }

  .mobile-overlay .sidebar-bio {
    font-size: 13px;
    font-weight: 400;
    color: var(--fg3);
    line-height: 1.75;
    letter-spacing: 0.01em;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .mobile-overlay .sidebar-bottom {
    margin-top: auto;
    flex-shrink: 0;
    padding-top: 24px;
  }

  .mobile-overlay .sidebar-links {
    gap: 12px;
  }

  .mobile-overlay .sidebar-links a {
    font-size: 13.5px;
    padding: 4px 0;
    min-height: 36px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
  }

  .mobile-overlay .theme-toggle {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    min-height: 44px;
    gap: 8px;
  }

  /* Scale up the toggle track + thumb for mobile */
  .mobile-overlay .toggle-lbl {
    font-size: 11px;
    width: 30px;
  }

  .mobile-overlay .toggle-track {
    width: 34px;
    height: 19px;
    border-radius: 10px;
  }

  .mobile-overlay .toggle-thumb {
    width: 11px;
    height: 11px;
    top: 3px;
    left: 3px;
  }

  [data-theme="dark"] .mobile-overlay .toggle-thumb {
    transform: translateX(15px);
  }

  /* ─── Main area ──────────────────────────────── */
  .main {
    height: auto;
    min-height: 0;
    overflow: visible;
    flex: none;
    display: block;
    width: 100%;
  }

  /* ─── Nav — hidden on mobile, replaced by pill ── */
  .nav-index {
    display: none;
  }

  /* ─── Floating bottom pill — Apple iOS frosted glass ── */
  .mobile-nav-pill {
    display: flex;
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    align-items: center;
    height: 46px;
    padding: 0 5px;
    border-radius: 100px;

    /* iOS frosted: milky-white surface, moderate blur */
    background: rgba(248, 248, 250, 0.82);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0,0,0,0.04);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
  }

  /* iOS dark: deep charcoal frosted surface */
  [data-theme="dark"] .mobile-nav-pill {
    background: rgba(28, 28, 30, 0.82);
    border: 0.5px solid rgba(255, 255, 255, 0.11);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.30), 0 0 0 0.5px rgba(255,255,255,0.04);
  }

  .mnp-item {
    width: 50px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 100px;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: rgba(40, 40, 40, 0.42);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  [data-theme="dark"] .mnp-item {
    color: rgba(220, 220, 230, 0.38);
  }

  .mnp-item.active {
    color: #0000FF;
  }

  [data-theme="dark"] .mnp-item.active {
    color: #5577ff;
  }

  /* Active dot */
  .mnp-item.active::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #0000FF;
  }

  [data-theme="dark"] .mnp-item.active::after {
    background: #5577ff;
  }

  /* ─── Sections ─────────────────────────────── */
  .project-section {
    padding: 24px 20px 100px; /* extra bottom for floating pill */
  }

  .project-description {
    max-width: 100%;
    font-size: 11.5px;
    line-height: 1.8;
    margin-bottom: 20px;
  }

  .project-description.mt {
    font-size: 11.5px;
    line-height: 1.8;
    margin-top: 16px;
  }

  /* ─── Meta Grid ────────────────────────────── */
  .project-meta {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 20px;
  }

  .meta-col-title {
    font-size: 11px;
    margin-bottom: 8px;
  }

  .project-meta > div:first-child .meta-col-title {
    font-size: 15px;
  }

  .meta-tag {
    font-size: 10px;
    line-height: 1.85;
  }

  .credit-line {
    font-size: 10.5px;
  }

  /* ─── Sub Nav — horizontal scroll ──────────── */
  .sub-nav {
    margin-top: 20px;
    padding-top: 0;
    border-top: 1px solid var(--border-faint);
    overflow: visible;
  }

  .sub-nav-items {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding: 12px 0;
    scrollbar-width: none;
  }

  .sub-nav-items::-webkit-scrollbar {
    display: none;
  }

  .sub-nav-item {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 11px;
    padding: 6px 0;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  /* ─── Sub Projects ─────────────────────────── */
  .sub-project {
    margin-top: 20px;
  }

  /* ─── Image Placeholder ────────────────────── */
  .image-placeholder {
    height: 180px;
    margin-top: 20px;
  }

  .project-image {
    margin-top: 20px;
  }

  /* ─── Gallery Grid — single column ───────── */
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 20px 0 0;
    max-width: none;
  }
  .gallery-pair {
    flex-direction: column;
    gap: 8px;
  }
  .gallery-pair .gallery-item-inner:first-child,
  .gallery-pair .gallery-item-inner:last-child {
    border-radius: 2px;
  }

  /* ─── Swipes carousel: explicit height on mobile ── */
  /* Without a sibling in the same grid row, the carousel item
     has no intrinsic height (content is absolute). Force 1:1. */
  .gallery-item:has(.image-carousel) {
    aspect-ratio: 1 / 1;
  }

  /* ─── Col-3 grid → single column on mobile ──────── */
  .gallery-grid.col-3 {
    grid-template-columns: 1fr;
  }
  .gallery-grid.col-3 .gallery-item .gallery-item-inner {
    aspect-ratio: 1 / 1;
  }
  .gallery-grid.col-3 .gallery-item .gallery-item-inner img,
  .gallery-grid.col-3 .gallery-item .gallery-item-inner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* ─── Mobile-only hidden items ──────────────────── */
  .mobile-hidden {
    display: none;
  }

  /* ─── Promo: 2-up grid, natural image proportions ── */
  #promo .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  #promo .gallery-grid .gallery-item-inner {
    aspect-ratio: unset;
  }
  #promo .gallery-grid .gallery-item-inner img {
    width: 100%;
    height: auto;
    object-fit: unset;
  }

  /* ─── Next-project nudge — hidden on mobile ─────── */
  /* Projects are accessible via the floating pill */
  .next-project-nudge {
    display: none;
  }

  /* ─── No animations on mobile — plain show/hide ── */
  .project-section.is-entering > .project-description,
  .project-section.is-entering > .sub-nav,
  .project-section.is-entering .meta-col-title,
  .project-section.is-entering .meta-tag,
  .project-section.is-entering .project-description.mt,
  .project-section.is-entering .credit-line,
  .project-section.is-entering .gallery-grid,
  .project-section.is-exiting {
    animation: none;
    opacity: 1;
    transform: none;
  }

  /* Scroll reveal — always visible on mobile */
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Next-project nudge — static on mobile */
  .next-project-nudge {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .npn-arrow {
    animation: none;
  }
}

@media (max-width: 380px) {
  .mobile-header {
    padding: 12px 16px;
  }

  .nav-item {
    padding: 12px 16px;
    min-height: 44px;
  }

  .project-section {
    padding: 20px 16px 96px;
  }

  .mobile-overlay {
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .mobile-name,
  .mobile-overlay-name {
    font-size: 12px;
  }

  .project-description {
    font-size: 11px;
  }

  .project-description.mt {
    font-size: 11px;
  }

  .meta-tag {
    font-size: 9.5px;
  }
}

/* cursor: default everywhere — no customisation */

/* ─── PARALLAX IMAGES (desktop only) ─────────────────────────────────────── */

@media (hover: hover) and (pointer: fine) {

  /* Container clips the overflowing image */
  [data-parallax] .gallery-item-inner {
    overflow: hidden;
  }

  /* Image is 14% taller than its container → room for ±7% travel */
  [data-parallax] .gallery-item-inner img {
    height: 114%;
    width: 100%;
    object-fit: cover;
    object-position: center;
    will-change: transform;
    /* JS drives the translateY — no CSS transition so it follows Lenis exactly */
  }
}
