@import "design-system.css";

/* Apple HIG: SF Pro, system fonts */
:root {
  /* Variables moved to design-system.css */
}

html[data-theme="dark"] {
  /* Variables moved to design-system.css */
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    /* Variables moved to design-system.css */
  }
}

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

html {
  /* Match Safari-like anchor / programmatic smooth scroll; reduced-motion users override below. */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--site-header-stack) + var(--space-2));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Fixed background layers + animated transforms must not widen document or drift on x-scroll */
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

@supports (overflow: clip) {
  html {
    overflow-x: clip;
  }
}

/* Optimized Hero Animation: Aurora & Mesh */
.hero-bg-animation {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* Transparent: a flat --bg here sat on top of the body gradient and read as a separate “slab” */
  background: transparent;
  transform: translate3d(0, 0, 0); /* Create stacking context for performance */
  backface-visibility: hidden;
}

/* Individual aurora blobs - optimized for performance */
.hero-aurora,
.hero-aurora-2 {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.5;
  will-change: auto;
  animation: none;
}

.hero-aurora {
  top: -10%;
  left: -10%;
  width: min(70vw, 600px);
  height: min(70vw, 600px);
  background: radial-gradient(circle, var(--accent-strong), transparent 70%);
}

.hero-aurora-2 {
  bottom: -10%;
  right: -10%;
  width: min(80vw, 700px);
  height: min(80vw, 700px);
  background: radial-gradient(circle, #6dd5ed, transparent 70%);
}

.hero-mesh {
  position: absolute;
  inset: 0;
  /* No repeating dot/grid patterns: only soft fantasy bloom. */
  background-image:
    radial-gradient(circle at 18% 28%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%),
    radial-gradient(circle at 82% 22%, rgba(16, 185, 129, 0.18), transparent 64%),
    radial-gradient(circle at 52% 78%, rgba(34, 211, 238, 0.14), transparent 66%);
  filter: blur(34px) saturate(1.15);
  mask-image: radial-gradient(circle at center, black 46%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle at center, black 46%, transparent 100%);
  opacity: 0.22;
  will-change: auto;
  animation: none;
}

@keyframes aurora-move {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(5%, 5%, 0) scale(1.1); }
}

@keyframes mesh-drift {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-20px, 10px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
  /* Only apply system-dark styles when the user hasn't forced Light. */
  html:not([data-theme="light"]) .hero-aurora,
  html:not([data-theme="light"]) .hero-aurora-2 {
    opacity: 0.25;
  }
  html:not([data-theme="light"]) .hero-mesh {
    opacity: 0.2;
  }
}

html[data-theme="dark"] .hero-aurora,
html[data-theme="dark"] .hero-aurora-2 {
  opacity: 0.25;
}
html[data-theme="dark"] .hero-mesh {
  opacity: 0.2;
}

/* Disable old heavy animations on html/body */
html::before,
html::after,
body::before,
body::after {
  display: none !important;
  animation: none !important;
  background: none !important;
}


@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"])::before {
    opacity: 0.048;
  }

  html:not([data-theme="light"])::after {
    opacity: 0.15;
  }
}

@keyframes globalSiteMesh {
  0% {
    transform: translateY(0);
  }

  100% {
    /* Vertical only; horizontal translate widens overflow and makes bg feel like it slides on x-scroll */
    transform: translateY(-26px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html,
  body {
    scroll-behavior: auto;
  }

  html::before,
  html::after,
  body::before,
  body::after,
  #main::before,
  #main::after {
    animation: none;
  }
}

/* Home: slightly richer global wash (product-craft “studio light”) */
@media (prefers-reduced-motion: no-preference) {
  html:has(body.page--home)::before {
    opacity: 0.09;
  }

  html:has(body.page--home)::after {
    opacity: 0.24;
    animation-duration: 100s;
  }

  html[data-theme="dark"]:has(body.page--home)::before {
    opacity: 0.06;
  }

  html[data-theme="dark"]:has(body.page--home)::after {
    opacity: 0.18;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:has(body.page--home)::before,
  html:has(body.page--home)::after {
    animation: none;
  }
}

@media (prefers-color-scheme: dark) and (prefers-reduced-motion: no-preference) {
  html:not([data-theme="light"]):has(body.page--home)::before {
    opacity: 0.06;
  }

  html:not([data-theme="light"]):has(body.page--home)::after {
    opacity: 0.18;
  }
}

body {
  margin: 0;
  /* See `html`: duplicate smooth scroll for Chromium scroll-root quirks */
  scroll-behavior: smooth;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  font-family: var(--font-sans);
  color: var(--text);
  /* One continuous canvas across all sections (scroll attachment: avoids Chrome scroll jank from fixed background paints) */
  background:
    radial-gradient(ellipse 140% 92% at 12% 0%, color-mix(in srgb, var(--accent) 20%, rgba(147, 197, 253, 0.46)), transparent 54%),
    radial-gradient(ellipse 120% 96% at 92% 10%, rgba(196, 181, 253, 0.26), transparent 52%),
    radial-gradient(ellipse 110% 92% at 50% 100%, rgba(167, 243, 208, 0.14), transparent 56%),
    linear-gradient(184deg, #f8fafc 0%, #f2f6fb 34%, #edf2f8 66%, #e8eef5 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 220ms var(--ease), color 180ms var(--ease);
}

@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

html[data-theme="dark"] body {
  /* Dark: blue + black gradient, crisp and professional. */
  background:
    linear-gradient(190deg, #000000 0%, #010a20 54%, #000000 100%),
    linear-gradient(138deg, rgba(59, 130, 246, 0.14) 0%, rgba(37, 99, 235, 0.085) 34%, transparent 66%),
    linear-gradient(312deg, rgba(30, 64, 175, 0.11) 0%, rgba(30, 64, 175, 0.055) 36%, transparent 68%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body {
    background:
      linear-gradient(190deg, #000000 0%, #010a20 54%, #000000 100%),
      linear-gradient(138deg, rgba(59, 130, 246, 0.14) 0%, rgba(37, 99, 235, 0.085) 34%, transparent 66%),
      linear-gradient(312deg, rgba(30, 64, 175, 0.11) 0%, rgba(30, 64, 175, 0.055) 36%, transparent 68%);
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  backface-visibility: hidden;
  /* Light: soft mesh + accent bloom (matches hero ambient) */
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.38), transparent 18rem),
    radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--accent) 12%, rgba(255, 255, 255, 0.2)), transparent 17rem),
    radial-gradient(circle at 48% 78%, rgba(224, 242, 254, 0.32), transparent 15rem);
  opacity: 0.78;
  z-index: -2;
  animation: liquidShift 72s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  backface-visibility: hidden;
  background:
    radial-gradient(ellipse 34% 32% at 24% 58%, rgba(16, 185, 129, 0.14), transparent 58%),
    radial-gradient(ellipse 38% 36% at 76% 38%, rgba(6, 182, 212, 0.12), transparent 56%),
    radial-gradient(ellipse 28% 30% at 52% 22%, rgba(52, 211, 153, 0.1), transparent 55%),
    radial-gradient(ellipse 52% 46% at 20% 30%, color-mix(in srgb, var(--accent) 14%, rgba(147, 197, 253, 0.42)), transparent 58%),
    radial-gradient(ellipse 46% 50% at 82% 26%, color-mix(in srgb, var(--accent) 11%, rgba(196, 181, 253, 0.38)), transparent 56%),
    radial-gradient(ellipse 38% 42% at 48% 72%, color-mix(in srgb, var(--accent) 9%, rgba(253, 186, 116, 0.2)), transparent 54%),
    radial-gradient(ellipse 40% 38% at 68% 58%, color-mix(in srgb, var(--accent) 8%, rgba(167, 243, 208, 0.18)), transparent 52%),
    radial-gradient(circle at 70% 30%, rgba(241, 245, 249, 0.45), transparent 20rem),
    radial-gradient(circle at 30% 70%, rgba(226, 232, 240, 0.32), transparent 18rem);
  filter: blur(52px) saturate(1.18);
  opacity: 0.52;
  z-index: -3;
  transform-origin: 48% 52%;
  animation: liquidOilFloatB 52s ease-in-out infinite alternate;
}

html[data-theme="dark"] body::before {
  /* Remove hazy shade layers in dark mode (keep background crisp/flat). */
  background: none;
  opacity: 0;
}

html[data-theme="dark"] body::after {
  background: none;
  opacity: 0;
  filter: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body::before {
    background: none;
    opacity: 0;
  }

  html:not([data-theme="light"]) body::after {
    background: none;
    opacity: 0;
    filter: none;
  }
}

#main {
  position: relative;
  z-index: 0;
  background: transparent;
}

/* Liquid oil / floating bubble field (blurred ellipses, slow drift) */
#main::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  backface-visibility: hidden;
  background:
    radial-gradient(ellipse 40% 38% at 28% 62%, rgba(16, 185, 129, 0.18), transparent 54%),
    radial-gradient(ellipse 36% 34% at 74% 28%, rgba(6, 182, 212, 0.15), transparent 52%),
    radial-gradient(ellipse 32% 36% at 46% 18%, rgba(52, 211, 153, 0.12), transparent 50%),
    radial-gradient(ellipse 48% 44% at 16% 36%, color-mix(in srgb, var(--accent) 18%, rgba(147, 197, 253, 0.5)), transparent 56%),
    radial-gradient(ellipse 42% 48% at 88% 22%, color-mix(in srgb, var(--accent) 14%, rgba(196, 181, 253, 0.42)), transparent 54%),
    radial-gradient(ellipse 36% 40% at 54% 80%, color-mix(in srgb, var(--accent) 11%, rgba(253, 186, 116, 0.24)), transparent 52%),
    radial-gradient(ellipse 44% 40% at 34% 68%, color-mix(in srgb, var(--accent) 10%, rgba(167, 243, 208, 0.22)), transparent 50%),
    radial-gradient(ellipse 32% 36% at 72% 46%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 48%);
  filter: blur(46px) saturate(1.12);
  /* Slightly softer so the wash merges with body gradient instead of “floating” on top */
  opacity: 0.42;
  transform-origin: 42% 48%;
  /* Slower drift = fewer composite updates (Chrome stays smoother) */
  animation: liquidOilFloatA 56s ease-in-out infinite;
}

html[data-theme="dark"] #main::before {
  /* Dark mode: no extra blurred overlays (keep it crisp/clear, no “shades”). */
  background: none;
  opacity: 0;
  filter: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) #main::before {
    background: none;
    opacity: 0;
    filter: none;
  }
}

/* Brighter venom / bioluminescent bubbles (smaller, faster drift) */
#main::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  backface-visibility: hidden;
  background:
    radial-gradient(circle min(28vw, 16rem) at 18% 72%, rgba(52, 211, 153, 0.22), transparent 68%),
    radial-gradient(circle min(24vw, 13rem) at 86% 44%, rgba(34, 211, 238, 0.18), transparent 65%),
    radial-gradient(circle min(20vw, 11rem) at 52% 12%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(circle min(22vw, 12rem) at 68% 82%, rgba(6, 182, 212, 0.12), transparent 60%);
  filter: blur(26px) saturate(1.22);
  /* Normal blend: cheaper + fewer banding seams vs multiply in Chrome */
  mix-blend-mode: normal;
  opacity: 0.2;
  transform-origin: 50% 50%;
  animation: liquidVenomBubbles 38s ease-in-out infinite;
}

html[data-theme="dark"] #main::after {
  /* Disable the extra dark overlay layer to keep the gradient clean. */
  mix-blend-mode: normal;
  opacity: 0;
  background: none;
  filter: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) #main::after {
    mix-blend-mode: normal;
    opacity: 0;
    background: none;
    filter: none;
  }
}

@keyframes liquidVenomBubbles {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  33% {
    transform: translateY(-1.4%) scale(1.035);
  }

  66% {
    transform: translateY(1.65%) scale(0.975);
  }
}

@keyframes liquidOilFloatA {
  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }

  22% {
    transform: translateY(-1.35%) scale(1.028) rotate(0.55deg);
  }

  48% {
    transform: translateY(1.55%) scale(0.985) rotate(-0.45deg);
  }

  72% {
    transform: translateY(0.95%) scale(1.012) rotate(0.28deg);
  }
}

@keyframes liquidOilFloatB {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
  }

  25% {
    transform: translateY(2%) scale(1.035) rotate(-0.9deg);
  }

  50% {
    transform: translateY(-1.6%) scale(0.985) rotate(0.65deg);
  }

  75% {
    transform: translateY(-2.4%) scale(1.025) rotate(-0.35deg);
  }

  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -6rem;
  z-index: 100;
  padding: 12px var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #ffffff;
  font-size: var(--text-body);
  font-weight: 600;
  transition: top 180ms var(--ease);
}

.skip-link:focus {
  top: var(--space-2);
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.page-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(72px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.2;
  animation: orbDrift 88s ease-in-out infinite alternate;
}

.orb-one {
  top: 4rem;
  left: max(1rem, calc(50% - 40rem));
  width: 14rem;
  height: 14rem;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.orb-two {
  top: 8rem;
  right: max(1rem, calc(50% - 36rem));
  width: 16rem;
  height: 16rem;
  background: rgba(255, 255, 255, 0.34);
}

.wrap {
  width: min(calc(100% - (var(--shell-gutter) * 2)), var(--wrap));
  margin: 0 auto;
}

.section-space {
  position: relative;
  padding-top: var(--section-gap);
  background: transparent;
}

/* Uniform section-to-section spacing (same rhythm after hero as elsewhere) */
.home-hero + .section-space {
  margin-top: 0;
  padding-top: var(--section-gap);
  background: transparent;
}

.home-hero::after {
  display: none;
}

/* Global transition veil so sections blend as one continuous canvas */
.section-space::before {
  display: none;
}

.section-space > .wrap {
  position: relative;
  z-index: 1;
}

.section-journey .wrap {
  position: relative;
  padding: clamp(1.35rem, 2vw, 1.8rem);
  border: 1px solid color-mix(in srgb, var(--line) 92%, rgba(255, 255, 255, 0.22));
  border-radius: clamp(1.6rem, 2vw, 2rem);
  /* More air: lets the global field read through so the band doesn’t feel like a second canvas */
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--surface-strong) 82%, transparent),
      color-mix(in srgb, var(--surface) 78%, transparent)
    );
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.section-journey .wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(176, 204, 255, 0.16), transparent 18rem),
    radial-gradient(circle at 82% 82%, rgba(255, 228, 166, 0.08), transparent 15rem);
  pointer-events: none;
}

html[data-theme="dark"] .section-journey .wrap {
  border-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(18, 22, 31, 0.78), rgba(14, 18, 26, 0.62));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .section-journey .wrap::before {
  background:
    radial-gradient(circle at 18% 18%, rgba(63, 110, 214, 0.14), transparent 18rem),
    radial-gradient(circle at 80% 80%, rgba(96, 108, 150, 0.1), transparent 16rem);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .section-journey .wrap {
    border-color: rgba(255, 255, 255, 0.08);
    background:
      linear-gradient(180deg, rgba(18, 22, 31, 0.78), rgba(14, 18, 26, 0.62));
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  }

  html:not([data-theme="light"]) .section-journey .wrap::before {
    background:
      radial-gradient(circle at 18% 18%, rgba(63, 110, 214, 0.14), transparent 18rem),
      radial-gradient(circle at 80% 80%, rgba(96, 108, 150, 0.1), transparent 16rem);
  }
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: 0.7rem 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: background 220ms var(--ease), border-color 220ms var(--ease), box-shadow 220ms var(--ease), padding 220ms var(--ease);
}

.site-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: calc(var(--control-height) + 0.1rem);
  padding: 0.2rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition:
    min-height 220ms var(--ease),
    padding 220ms var(--ease),
    color 180ms var(--ease);
}

.site-header.scrolled {
  padding: 0.3rem 0;
  border-bottom-color: color-mix(in srgb, var(--line) 60%, transparent);
  /* Apple OS-style glass: high blur + saturation boost + translucency */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] .site-header.scrolled {
  background: rgba(28, 28, 30, 0.72);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .site-header.scrolled {
    background: rgba(28, 28, 30, 0.72);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
  min-width: 44px;
  gap: 0;
  padding: 8px;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-logo {
  position: relative;
  display: block;
  width: clamp(4.7rem, 6.5vw, 5.5rem);
  height: clamp(1.65rem, 2vw, 1.95rem);
  flex: none;
}

.brand-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-dark {
  opacity: 0;
}

html[data-theme="dark"] .brand-logo-light {
  opacity: 0;
}

html[data-theme="dark"] .brand-logo-dark {
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .brand-logo-light {
    opacity: 0;
  }

  html:not([data-theme="light"]) .brand-logo-dark {
    opacity: 1;
  }
}

.brand-label {
  display: none;
}

.nav-panel {
  display: flex;
  align-items: center;
  /* Uniform 16px (2×8pt) between nav links and appearance control; matches HIG bar spacing */
  gap: var(--space-2);
}

.header-cta,
.mobile-resume-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height);
  min-width: 44px;
  padding: 0 var(--button-padding-x);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 24px rgba(15, 23, 42, 0.08);
  color: var(--text);
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.header-cta:hover,
.header-cta:focus-visible,
.mobile-resume-fab:hover,
.mobile-resume-fab:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.header-cta svg,
.mobile-resume-fab svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
  background: transparent;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  min-width: 44px;
  padding: 0 var(--space-2);
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--text-subhead);
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: transparent;
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}

.theme-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 24px rgba(15, 23, 42, 0.1);
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.theme-toggle:hover,
.menu-toggle:hover,
.theme-toggle:focus-visible,
.menu-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.site-header .theme-toggle {
  border-color: transparent;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.site-header .theme-toggle:hover,
.site-header .theme-toggle:focus-visible {
  border-color: transparent;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.theme-toggle-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.3125rem;
  height: 1.3125rem;
  flex-shrink: 0;
}

.theme-icon-svg {
  display: none;
  width: 100%;
  height: 100%;
}

html[data-theme-preference="light"] .theme-icon-svg--light,
html[data-theme-preference="dark"] .theme-icon-svg--dark,
html[data-theme-preference="auto"] .theme-icon-svg--auto {
  display: block;
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.theme-fab {
  display: none;
  /* replaced by bottom tab bar More sheet on mobile */
}

.mobile-brand-fab {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  left: 1rem;
  z-index: 55;
  display: none;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 24px rgba(15, 23, 42, 0.1);
  opacity: 1;
  transform: translateY(0);
  transition: transform 320ms var(--ease), opacity 280ms var(--ease);
}

.mobile-brand-fab .brand-logo {
  width: clamp(4.5rem, 18vw, 5.3rem);
  height: clamp(1.55rem, 5.4vw, 1.9rem);
}

.mobile-top-actions {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: 1rem;
  z-index: 55;
  display: none;
  align-items: center;
  gap: 0.65rem;
  opacity: 1;
  transform: translateY(0);
  transition: transform 320ms var(--ease), opacity 280ms var(--ease);
}

.mobile-top-actions .theme-fab {
  display: inline-flex;
  width: var(--control-height);
  height: var(--control-height);
}

.mobile-top-actions .mobile-resume-fab {
  min-height: var(--control-height);
  padding-inline: 1rem 1.02rem;
}

html.mobile-top-chrome-hidden .mobile-brand-fab,
html.mobile-top-chrome-hidden .mobile-top-actions {
  transform: translateY(calc(-100% - 0.8rem));
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  html.mobile-top-chrome-hidden .mobile-brand-fab,
  html.mobile-top-chrome-hidden .mobile-top-actions {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

.menu-toggle {
  display: none;
}

.menu-toggle span {
  display: block;
  width: 1rem;
  height: 2px;
  margin: 0.2rem auto;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms var(--ease);
}

.menu-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.eyebrow,
.preview-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--accent-soft));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  color: var(--accent);
  font-size: var(--text-footnote);
  /* HIG footnote: 13px, more legible than caption */
  font-weight: 600;
  letter-spacing: -0.01em;
}

.meta-pill,
.roadmap-year {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-footnote);
  /* HIG footnote: 13px */
  font-weight: 600;
  letter-spacing: -0.01em;
}

.home-hero {
  position: relative;
  /* No isolation: avoids a second-layer seam vs scrolling content */
  isolation: auto;
  overflow-x: clip;
  overflow-y: visible;
  padding-top: var(--hero-inset-compact);
  padding-bottom: var(--space-5);
  background: transparent;
}

/* Ambient mesh + orbs: product / systems / AI-adjacent motion, theme-aware */
.home-hero__ambient {
  position: absolute;
  inset: -10% -8% -120vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* Removed mask to improve performance and remove visual seam */
  /* mask-image: linear-gradient(180deg, black 0%, rgba(0, 0, 0, 0.9) 65%, rgba(0, 0, 0, 0.55) 85%, rgba(0, 0, 0, 0.22) 95%, transparent 100%); */
  /* -webkit-mask-image: linear-gradient(180deg, black 0%, rgba(0, 0, 0, 0.9) 65%, rgba(0, 0, 0, 0.55) 85%, rgba(0, 0, 0, 0.22) 95%, transparent 100%); */
}

/* Keep ONLY pulse ring + dots in hero ambient */
.home-hero__ambient > :not(.home-hero__pulse-ring):not(.home-hero__mote) {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  .home-hero__ambient {
    opacity: 0;
    animation: homeHeroAmbientFadeIn 0.88s cubic-bezier(0.22, 1, 0.36, 1) 0.02s forwards;
  }
}

@keyframes homeHeroAmbientFadeIn {
  to {
    opacity: 1;
  }
}

/* Slow conic wash: visible in light + dark; reduced in dark for contrast */
.home-hero__aurora {
  position: absolute;
  inset: -40%;
  z-index: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  background: conic-gradient(from 32deg at 50% 50%,
      transparent 0deg,
      color-mix(in srgb, var(--accent) 20%, transparent) 52deg,
      transparent 100deg,
      color-mix(in srgb, var(--accent) 14%, transparent) 158deg,
      transparent 218deg,
      color-mix(in srgb, var(--accent) 16%, transparent) 288deg,
      transparent 360deg);
  filter: blur(52px);
  opacity: 0.13;
  animation: heroAuroraSoftDrift 85s ease-in-out infinite alternate;
}

html[data-theme="dark"] .home-hero__aurora {
  opacity: 0.11;
  filter: blur(60px);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__aurora {
    opacity: 0.11;
    filter: blur(60px);
  }
}

/* Second, counter-rotating wash: depth without a flat poster look */
.home-hero__aurora--lag {
  position: absolute;
  inset: -36%;
  z-index: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  background: conic-gradient(from 210deg at 48% 52%,
      transparent 0deg,
      color-mix(in srgb, var(--accent) 12%, transparent) 80deg,
      transparent 160deg,
      color-mix(in srgb, var(--accent) 10%, transparent) 240deg,
      transparent 320deg);
  filter: blur(58px);
  opacity: 0.1;
  animation: heroAuroraSoftDrift 72s ease-in-out infinite alternate-reverse;
}

html[data-theme="dark"] .home-hero__aurora--lag {
  opacity: 0.085;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__aurora--lag {
    opacity: 0.085;
  }
}

/* Slow "studio sweep": light across the canvas */
.home-hero__ribbon {
  position: absolute;
  inset: -25% -45% 5% -45%;
  z-index: 0;
  height: 42%;
  background: linear-gradient(
    108deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 14%, transparent) 44%,
    color-mix(in srgb, #ffffff 22%, transparent) 50%,
    color-mix(in srgb, var(--accent) 10%, transparent) 56%,
    transparent 65%
  );
  transform: rotate(-9deg);
  filter: blur(28px);
  opacity: 0.28;
  mix-blend-mode: soft-light;
  pointer-events: none;
  animation: heroRibbonDrift 24s ease-in-out infinite alternate;
}

html[data-theme="dark"] .home-hero__ribbon {
  mix-blend-mode: screen;
  opacity: 0.22;
  background: linear-gradient(
    108deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 18%, transparent) 44%,
    color-mix(in srgb, var(--accent) 8%, transparent) 56%,
    transparent 65%
  );
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__ribbon {
    mix-blend-mode: screen;
    opacity: 0.22;
  }
}

/* Discovery pulse: soft radar halo; transform+opacity only in keyframes; thin ring = cheaper Chrome paints */
.home-hero__pulse-ring {
  position: absolute;
  left: 50%;
  top: 30%;
  z-index: 0;
  width: min(118vw, 54rem);
  height: min(118vw, 54rem);
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  /* Avoid animated inset blur on a huge circle (major Chrome jank source) */
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
  opacity: 0;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translate3d(-50%, -50%, 0);
  animation: heroPulseRing 14s ease-in-out infinite;
}

html[data-theme="light"] .home-hero__pulse-ring {
  border-color: rgba(59, 130, 246, 0.42);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
  animation-name: heroPulseRingLight;
}

html[data-theme="dark"] .home-hero__pulse-ring {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .home-hero__pulse-ring {
    border-color: rgba(59, 130, 246, 0.42);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
    animation-name: heroPulseRingLight;
  }
}

@keyframes heroRibbonDrift {
  0% {
    transform: rotate(-9deg) translate(-2%, 0) scale(1);
    opacity: 0.22;
  }

  100% {
    transform: rotate(-7deg) translate(2.5%, 1%) scale(1.04);
    opacity: 0.32;
  }
}

/* Opening pulse in first ~2.5s of each cycle, then long rest (professional hook + calm repeat) */
@keyframes heroPulseRing {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.88);
  }

  10% {
    opacity: 0.36;
    transform: translate3d(-50%, -50%, 0) scale(1);
  }

  24% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(1.05);
  }

  100% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.88);
  }
}

@keyframes heroPulseRingLight {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.88);
  }

  10% {
    opacity: 0.5;
    transform: translate3d(-50%, -50%, 0) scale(1);
  }

  24% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(1.06);
  }

  100% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.88);
  }
}

/* Firefly motes: warm bioluminescence, lazy wander, irregular blink */
.home-hero__mote {
  position: absolute;
  z-index: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f6f2a8;
  box-shadow:
    0 0 2px rgba(255, 255, 240, 0.95),
    0 0 10px rgba(220, 230, 100, 0.65),
    0 0 22px rgba(180, 200, 70, 0.35);
  opacity: 0;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  animation: fireflyDrift 18s cubic-bezier(0.45, 0.05, 0.35, 1) infinite;
}

html[data-theme="light"] .home-hero__mote {
  background: #c4b82a;
  box-shadow:
    0 0 2px rgba(255, 252, 210, 0.95),
    0 0 8px rgba(230, 215, 90, 0.55),
    0 0 18px rgba(190, 175, 60, 0.28);
}

html[data-theme="dark"] .home-hero__mote {
  background: #faf6c8;
  box-shadow:
    0 0 3px rgba(255, 255, 230, 1),
    0 0 12px rgba(235, 240, 120, 0.75),
    0 0 28px rgba(200, 210, 80, 0.4),
    0 0 44px rgba(160, 180, 60, 0.18);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .home-hero__mote {
    background: #c4b82a;
    box-shadow:
      0 0 2px rgba(255, 252, 210, 0.95),
      0 0 8px rgba(230, 215, 90, 0.55),
      0 0 18px rgba(190, 175, 60, 0.28);
  }
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__mote {
    background: #faf6c8;
    box-shadow:
      0 0 3px rgba(255, 255, 230, 1),
      0 0 12px rgba(235, 240, 120, 0.75),
      0 0 28px rgba(200, 210, 80, 0.4),
      0 0 44px rgba(160, 180, 60, 0.18);
  }
}

.home-hero__mote--1 {
  top: 22%;
  left: 16%;
  animation-delay: 0s;
}

.home-hero__mote--2 {
  top: 38%;
  right: 14%;
  animation-delay: -3.4s;
  animation-duration: 21s;
}

.home-hero__mote--3 {
  bottom: 28%;
  left: 38%;
  animation-delay: -7.2s;
  animation-duration: 16s;
}

.home-hero__mote--4 {
  top: 52%;
  left: 8%;
  animation-delay: -1.8s;
  animation-duration: 19.5s;
}

@keyframes fireflyDrift {
  0%,
  100% {
    opacity: 0.14;
    transform: translate3d(0, 0, 0) scale(0.86);
  }

  9% {
    opacity: 0.72;
    transform: translate3d(5px, -10px, 0) scale(1.02);
  }

  20% {
    opacity: 0.18;
    transform: translate3d(12px, -3px, 0) scale(0.9);
  }

  34% {
    opacity: 0.9;
    transform: translate3d(3px, 14px, 0) scale(1.08);
  }

  48% {
    opacity: 0.22;
    transform: translate3d(-8px, 18px, 0) scale(0.94);
  }

  61% {
    opacity: 0.58;
    transform: translate3d(-14px, 8px, 0) scale(1);
  }

  74% {
    opacity: 0.12;
    transform: translate3d(-10px, -6px, 0) scale(0.88);
  }

  88% {
    opacity: 0.82;
    transform: translate3d(8px, -12px, 0) scale(1.04);
  }
}

/* Full-viewport fireflies: first child of #main */
.site-motes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  isolation: isolate;
  /* Paint-only: full layout containment + fixed overlay hurt Chrome scroll compositing */
  contain: paint;
  transform: translate3d(0, 0, 0);
}

.site-mote {
  position: absolute;
  z-index: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f6f2a8;
  box-shadow:
    0 0 2px rgba(255, 255, 240, 0.95),
    0 0 12px rgba(220, 230, 100, 0.6),
    0 0 26px rgba(180, 200, 70, 0.32);
  opacity: 0;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  /* Match .home-hero__mote cadence (lazy drift; avoid shorter site-only durations) */
  animation: fireflyDrift 18s cubic-bezier(0.45, 0.05, 0.35, 1) infinite;
}

html[data-theme="light"] .site-mote {
  background: #c4b82a;
  box-shadow:
    0 0 2px rgba(255, 252, 210, 0.95),
    0 0 9px rgba(230, 215, 90, 0.52),
    0 0 20px rgba(190, 175, 60, 0.26);
}

html[data-theme="dark"] .site-mote {
  background: #faf6c8;
  box-shadow:
    0 0 3px rgba(255, 255, 230, 1),
    0 0 14px rgba(235, 240, 120, 0.7),
    0 0 32px rgba(200, 210, 80, 0.38),
    0 0 50px rgba(160, 180, 60, 0.16);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .site-mote {
    background: #c4b82a;
    box-shadow:
      0 0 2px rgba(255, 252, 210, 0.95),
      0 0 9px rgba(230, 215, 90, 0.52),
      0 0 20px rgba(190, 175, 60, 0.26);
  }
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .site-mote {
    background: #faf6c8;
    box-shadow:
      0 0 3px rgba(255, 255, 230, 1),
      0 0 14px rgba(235, 240, 120, 0.7),
      0 0 32px rgba(200, 210, 80, 0.38),
      0 0 50px rgba(160, 180, 60, 0.16);
  }
}

.site-mote--1 {
  top: 16%;
  left: 11%;
  animation-delay: 0s;
}

.site-mote--2 {
  top: 38%;
  right: 12%;
  animation-delay: -4.1s;
  animation-duration: 21s;
}

.site-mote--3 {
  top: 62%;
  left: 20%;
  animation-delay: -8.6s;
  animation-duration: 16s;
}

.site-mote--4 {
  top: 28%;
  right: 18%;
  animation-delay: -2s;
  animation-duration: 19.5s;
}

.site-mote--5 {
  bottom: 22%;
  right: 26%;
  animation-delay: -5.3s;
  animation-duration: 18s;
}

.site-mote--6 {
  top: 48%;
  left: 6%;
  animation-delay: -9.8s;
  animation-duration: 19.5s;
}

/* Background tab: pause looping hero animations (compositor work + battery) */
@media (prefers-reduced-motion: no-preference) {
  html.doc-hidden .site-mote,
  html.doc-hidden .home-hero__mote,
  html.doc-hidden .home-hero__pulse-ring {
    animation-play-state: paused;
  }
}

/* Static wash only (moving diagonal sweep removed; was distracting across hero) */
.home-hero__shimmer {
  position: absolute;
  inset: -35% -30%;
  z-index: 0;
  opacity: 0.06;
  background: linear-gradient(
    118deg,
    transparent 0%,
    transparent 40%,
    color-mix(in srgb, var(--accent) 28%, transparent) 50%,
    transparent 60%,
    transparent 100%
  );
  background-size: 220% 220%;
  background-position: 50% 50%;
  animation: none;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

html[data-theme="dark"] .home-hero__shimmer {
  opacity: 0.05;
  mix-blend-mode: screen;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__shimmer {
    opacity: 0.05;
    mix-blend-mode: screen;
  }
}

/* Accent sparks (magical depth, theme-safe opacity) */
.home-hero__spark {
  position: absolute;
  z-index: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 85%, #ffffff);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
  opacity: 0;
  pointer-events: none;
  animation: heroSparkTwinkle 6.5s ease-in-out infinite;
}

html[data-theme="dark"] .home-hero__spark {
  background: color-mix(in srgb, var(--accent) 70%, #93c5fd);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
}

.home-hero__spark--1 {
  top: 20%;
  left: 14%;
  animation-delay: 0s;
}

.home-hero__spark--2 {
  top: 48%;
  right: 18%;
  animation-delay: 1.4s;
}

.home-hero__spark--3 {
  bottom: 26%;
  left: 42%;
  animation-delay: 2.9s;
}

@keyframes heroSparkTwinkle {
  0%,
  88%,
  100% {
    opacity: 0;
    transform: scale(0.5);
  }

  9% {
    opacity: 0.5;
    transform: scale(1.02);
  }

  42% {
    opacity: 0.9;
    transform: scale(1.15);
  }
}

.home-hero__mesh {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 120% 100% at 50% 38%, black 0%, rgba(0, 0, 0, 0.45) 55%, transparent 82%);
  animation: heroMeshSlide 42s linear infinite;
}

html[data-theme="dark"] .home-hero__mesh {
  opacity: 0.14;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__mesh {
    opacity: 0.14;
  }
}

.home-hero__mesh--slow {
  opacity: 0.12;
  background-size: 56px 56px;
  animation-duration: 78s;
  animation-direction: reverse;
  mask-image: radial-gradient(ellipse 100% 92% at 52% 36%, black 0%, rgba(0, 0, 0, 0.4) 50%, transparent 80%);
}

html[data-theme="dark"] .home-hero__mesh--slow {
  opacity: 0.09;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__mesh--slow {
    opacity: 0.09;
  }
}

.home-hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  mix-blend-mode: normal;
  opacity: 0.28;
  animation: heroOrbFloat 22s ease-in-out infinite;
}

html[data-theme="dark"] .home-hero__orb {
  mix-blend-mode: screen;
  opacity: 0.38;
}

.home-hero__orb--a {
  width: min(42vw, 28rem);
  height: min(42vw, 28rem);
  top: -5%;
  left: -8%;
  background: color-mix(in srgb, var(--accent) 32%, rgba(147, 197, 253, 0.5));
  animation-delay: 0s;
}

.home-hero__orb--b {
  width: min(36vw, 22rem);
  height: min(36vw, 22rem);
  bottom: 5%;
  right: -6%;
  background: color-mix(in srgb, var(--accent) 28%, rgba(196, 181, 253, 0.45));
  animation-delay: -7s;
  animation-duration: 28s;
}

.home-hero__orb--c {
  width: min(28vw, 16rem);
  height: min(28vw, 16rem);
  top: 38%;
  left: 42%;
  background: color-mix(in srgb, var(--accent) 22%, rgba(167, 243, 208, 0.4));
  animation-delay: -14s;
  animation-duration: 19s;
}

html[data-theme="dark"] .home-hero__orb--a {
  background: color-mix(in srgb, var(--accent) 45%, rgba(59, 130, 246, 0.35));
}

html[data-theme="dark"] .home-hero__orb--b {
  background: color-mix(in srgb, var(--accent) 40%, rgba(139, 92, 246, 0.3));
}

html[data-theme="dark"] .home-hero__orb--c {
  background: color-mix(in srgb, var(--accent) 35%, rgba(34, 211, 238, 0.25));
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero__orb {
    mix-blend-mode: screen;
    opacity: 0.38;
  }

  html:not([data-theme="light"]) .home-hero__orb--a {
    background: color-mix(in srgb, var(--accent) 45%, rgba(59, 130, 246, 0.35));
  }

  html:not([data-theme="light"]) .home-hero__orb--b {
    background: color-mix(in srgb, var(--accent) 40%, rgba(139, 92, 246, 0.3));
  }

  html:not([data-theme="light"]) .home-hero__orb--c {
    background: color-mix(in srgb, var(--accent) 35%, rgba(34, 211, 238, 0.25));
  }
}

@keyframes heroMeshSlide {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    transform: translate(-24px, -18px) rotate(0.5deg);
  }
}

/* Chromium-friendly: animate transform without rotation on filtered layers (avoids full blur re-raster each frame). */
@keyframes heroAuroraSoftDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  33% {
    transform: translate3d(1.2%, -1.8%, 0) scale(1.025);
  }

  66% {
    transform: translate3d(-1.4%, 1.1%, 0) scale(0.992);
  }
}

@keyframes heroOrbFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(2.5%, -3%) scale(1.04);
  }

  66% {
    transform: translate(-2%, 2.5%) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero__ambient,
  .home-hero__aurora,
  .home-hero__aurora--lag,
  .home-hero__ribbon,
  .home-hero__pulse-ring,
  .home-hero__mote,
  .site-mote,
  .home-hero__shimmer,
  .home-hero__spark,
  .home-hero__mesh,
  .home-hero__mesh--slow,
  .home-hero__orb {
    animation: none;
  }

  .home-hero__ambient {
    opacity: 1;
  }

  .home-hero__ribbon {
    opacity: 0.22;
    transform: rotate(-9deg);
  }

  .home-hero__pulse-ring {
    opacity: 0;
  }

  .home-hero__mote {
    opacity: 0.52;
    transform: translate3d(0, 0, 0);
  }

  .site-mote {
    opacity: 0.46;
    transform: translate3d(0, 0, 0);
  }

  .home-hero__spark {
    opacity: 0.35;
    transform: none;
  }

  .home-hero__orb--b,
  .home-hero__orb--c {
    animation: none;
  }

  .hero-copy--home::before,
  .hero-copy--home .hero-headline::after {
    animation: none;
  }

  .hero-copy--home .hero-badge {
    animation: none;
  }

  .button-primary,
  .button-gradient {
    animation: none !important;
  }

  .hero-title-highlight {
    animation: none !important;
  }
}

.home-hero .wrap.home-hero__wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: start;
}

/* Disable expensive global moving backgrounds for smoother Chrome scrolling */
body::before,
body::after,
#main::before,
#main::after {
  display: none !important;
  animation: none !important;
}

/* Keep hero text static: only pulse + dots animate */
/* .home-hero .hero-title-highlight {
  animation: none !important;
} */

/* Hidden on desktop; shown on tablet/phone to anchor top of hero (HIG safe area + brand) */
.home-hero-compact-brand {
  display: none;
  position: relative;
  z-index: 2;
}

.home-hero-compact-brand-link {
  display: block;
  line-height: 0;
  border-radius: var(--radius-md);
}

.home-hero-compact-brand-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.home-hero-compact-logo-wrap {
  position: relative;
  display: block;
  width: clamp(4.75rem, 14vw, 5.75rem);
  height: clamp(1.6rem, 4.5vw, 2rem);
  margin: 0 auto;
}

.home-hero-compact-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-hero-compact-logo--light {
  opacity: 1;
}

.home-hero-compact-logo--dark {
  opacity: 0;
}

html[data-theme="dark"] .home-hero-compact-logo--light {
  opacity: 0;
}

html[data-theme="dark"] .home-hero-compact-logo--dark {
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .home-hero-compact-logo--light {
    opacity: 0;
  }

  html:not([data-theme="light"]) .home-hero-compact-logo--dark {
    opacity: 1;
  }
}

.page-hero {
  position: relative;
  isolation: auto;
  overflow-x: clip;
  overflow-y: visible;
  padding-top: var(--hero-inset-compact);
  background: transparent;
}

.page-hero::after {
  display: none;
}

.page-hero--sub .wrap {
  position: relative;
  z-index: 1;
}

/* Subpage hero intros: same “living” depth as home (kept subtle) */
.page-hero--sub .page-intro {
  position: relative;
  z-index: 1;
}

.page-hero--sub .page-intro::before {
  content: "";
  position: absolute;
  inset: -12% -14% -8%;
  z-index: -1;
  pointer-events: none;
  border-radius: var(--radius-xl);
  background: radial-gradient(ellipse 78% 68% at 50% 30%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 82%);
  opacity: 0.2;
}

html[data-theme="dark"] .page-hero--sub .page-intro::before {
  opacity: 0.18;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .page-hero--sub .page-intro::before {
    opacity: 0.18;
  }
}

.hero-grid,
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: var(--space-8);
  align-items: center;
}

.hero-copy,
.page-intro {
  max-width: 46rem;
}

/* Hero copy stacks as a column so badge + headline share one alignment */
.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-copy .eyebrow,
.page-intro .eyebrow {
  margin-bottom: var(--space-3);
  /* HIG: 24px gap between badge and title */
}

/* Location pill: icon + label, same width rhythm as headline block */
.eyebrow-location {
  gap: 8px;
}

.eyebrow-location .eyebrow-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--accent-strong);
}

.eyebrow-location .eyebrow-icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.eyebrow-location--text .eyebrow-icon {
  color: var(--accent-strong);
}

/* Home hero: keyword chips (same language as Recent work cards) */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: var(--space-3) 0 var(--space-2);
  max-width: 36rem;
}

.hero-badge {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: var(--text-caption2);
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 3px;
  color: color-mix(in srgb, var(--muted) 88%, var(--text));
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
  border: 1px solid var(--line);
}

.hero-copy--home .hero-badge {
  animation: heroBadgeGlow 5.5s ease-in-out infinite;
}

.hero-copy--home .hero-badge:nth-child(1) {
  animation-delay: 0s;
}

.hero-copy--home .hero-badge:nth-child(2) {
  animation-delay: 0.55s;
}

.hero-copy--home .hero-badge:nth-child(3) {
  animation-delay: 1.1s;
}

.hero-copy--home .hero-badge:nth-child(4) {
  animation-delay: 1.65s;
}

@keyframes heroBadgeGlow {
  0%,
  100% {
    border-color: var(--line);
    box-shadow: 0 0 0 transparent;
  }

  50% {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
    box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 14%, transparent);
  }
}

/* Home: centered hero composition (professional measure ~38-40rem) */
.hero-copy--home {
  position: relative;
  z-index: 1;
  align-items: center;
  text-align: center;
  max-width: min(44rem, 100%);
  width: 100%;
}

/* Very soft static wash: avoids a "second sun" vs global body/html layers */
.hero-copy--home::before {
  content: "";
  position: absolute;
  inset: -10% -14% -6%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 68% 58% at 50% 36%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 72%);
  opacity: 0.26;
}

/* Home minimal hero: SF Pro / HIG stack only, low copy count */
.hero-copy--home.hero-copy--minimal {
  max-width: min(36rem, 100%);
}

.hero-headline--minimal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.6vw, 16px);
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-family: var(--font-display);
  text-align: center;
}

.hero-title-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.hero-greeting {
  font-family: var(--font-display);
  font-size: var(--text-subhead);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--muted);
}

.hero-role-row {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  text-align: center;
}

.hero-role-row .hero-role-minimal {
  margin: 0;
  text-align: center;
}

.hero-location-badge {
  align-self: center;
  margin: 0;
  min-height: 2rem;
  padding: 4px 11px;
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 999px;
}

.hero-location-badge.eyebrow-location {
  justify-content: center;
}

.hero-title-highlight {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.125rem, 4.2vw + 1rem, 3.35rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
  text-wrap: balance;
  /* Left → right shimmer (90deg); wider span so motion reads clearly */
  background-image: linear-gradient(
    90deg,
    var(--text) 0%,
    var(--text) 28%,
    var(--accent-strong) 52%,
    var(--accent) 100%
  );
  background-size: 240% 100%;
  /* Default: accent band centered on the line (animation starts from middle) */
  background-position: 50% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text);
  will-change: background-position;
}

/* Full-line title: same gradient, size tuned to stay one line on typical phones+ */
.hero-headline--minimal .hero-title-line .hero-title-highlight {
  display: inline-block;
  max-width: 100%;
  font-size: clamp(1.7rem, 3.4vw + 0.9rem, 2.85rem);
  line-height: 1.08;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

@media (min-width: 480px) {
  .hero-headline--minimal .hero-title-line .hero-title-highlight {
    white-space: nowrap;
    text-wrap: unset;
  }
}

.hero-role-minimal {
  font-family: var(--font-display);
  font-size: var(--text-callout);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: color-mix(in srgb, var(--muted) 22%, var(--text));
}

.hero-lede--minimal {
  margin: var(--space-3) 0 0;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  font-family: var(--font-sans);
  font-size: var(--text-subhead);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-wrap: balance;
}

/* Same vertical gap as description → CTA (space-4 = 32px / 4×8pt) */
.hero-copy--home .hero-cta-row {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.hero-copy--home.hero-copy--minimal .stat-stack {
  margin-top: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-title-highlight {
    animation: heroTitleHighlightFlow 9.5s ease-in-out infinite;
  }
}

/* Stronger left-right sweep so the highlight reads clearly like before. */
@keyframes heroTitleHighlightFlow {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@media (prefers-contrast: more) {
  .hero-title-highlight {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--text);
  }
}

@media (forced-colors: active) {
  .hero-title-highlight {
    background: none;
    -webkit-text-fill-color: CanvasText;
    color: CanvasText;
  }
}

.hero-copy--home .hero-line-role {
  font-weight: 600;
  letter-spacing: -0.024em;
}

.hero-copy--home .hero-line-verse {
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-copy--home .eyebrow-location {
  justify-content: center;
}

.hero-copy--home .hero-badges {
  justify-content: center;
}

.hero-copy--home .hero-headline {
  position: relative;
  align-items: center;
  text-align: center;
  max-width: 44rem;
}

.hero-copy--home .hero-headline.hero-headline--minimal {
  align-items: center;
  max-width: min(42rem, 100%);
  text-align: center;
}

/* Halo behind headline block (name + role + slogan) */
.hero-copy--home .hero-headline::after {
  content: "";
  position: absolute;
  inset: -5% -6% -14%;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(ellipse 75% 68% at 50% 40%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 78%);
  opacity: 0.22;
}

.hero-copy--home .hero-line-verse::after {
  margin-left: auto;
  margin-right: auto;
}

.hero-copy--home .button-row {
  justify-content: center;
}

.hero-copy--home .stat-stack {
  justify-items: stretch;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-copy h1,
.page-intro h1,
.section-heading h2,
.cta-band h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
}

.hero-copy h1:not(.hero-headline),
.page-intro h1 {
  font-size: clamp(3rem, 1.5vw + 2.6rem, 4rem);
  line-height: 1.05;
}

.home-hero .hero-copy h1:not(.hero-headline) {
  font-size: clamp(3rem, 1.6vw + 2.6rem, 4rem);
  line-height: 1.05;
}

/* Hero: Apple-style stack (secondary lead → dominant title → scoped tagline) */
.hero-copy h1.hero-headline,
.home-hero .hero-copy h1.hero-headline {
  font-size: unset;
  line-height: unset;
  font-weight: unset;
  letter-spacing: unset;
  color: unset;
}

.hero-headline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(10px, 1.2vw, 14px);
  max-width: 42rem;
}

.hero-line {
  display: block;
  margin: 0;
  font-family: var(--font-display);
}

.hero-line-lead {
  font-size: clamp(1.0625rem, 0.75vw + 0.82rem, 1.3125rem);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.02em;
  line-height: 1.28;
}

/* Editorial slogan, artistic but restrained */
.hero-line-verse {
  font-size: clamp(1.05rem, 0.9vw + 0.78rem, 1.25rem);
  font-weight: 500;
  font-style: italic;
  color: color-mix(in srgb, var(--muted) 92%, var(--text));
  letter-spacing: 0.01em;
  line-height: 1.45;
  max-width: 34rem;
  text-wrap: balance;
}

.hero-line-verse::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 2px;
  margin-top: 0.75em;
  border-radius: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, transparent), transparent);
  opacity: 0.55;
}

.hero-name {
  font-weight: 700;
  letter-spacing: -0.038em;
}

.hero-line-focus {
  font-size: clamp(2.125rem, 2.5vw + 1rem, 3.5rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.035em;
  line-height: 1.05;
  max-width: min(36rem, 100%);
  text-wrap: balance;
}

/* Single-word brand accent on focal line (subtle gradient; solid fallback) */
.hero-focus-accent {
  display: inline;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  background-image: linear-gradient(
    115deg,
    var(--accent-strong) 0%,
    var(--accent) 42%,
    color-mix(in srgb, var(--accent) 72%, var(--text)) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-strong);
}

@media (prefers-contrast: more) {
  .hero-focus-accent {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--accent-strong);
  }
}

@media (forced-colors: active) {
  .hero-focus-accent {
    background: none;
    -webkit-text-fill-color: CanvasText;
    color: LinkText;
  }
}

.hero-line-role {
  font-size: clamp(1.0625rem, 0.65vw + 0.92rem, 1.25rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
  max-width: 36rem;
  text-wrap: balance;
}

.hero-lead {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.47;
  color: var(--muted);
  margin-top: var(--space-4);
  max-width: 32rem;
}

.home-hero .hero-lead {
  font-size: var(--text-body);
  line-height: 1.47;
}

.section-heading h2 {
  font-size: clamp(var(--text-title2), 4vw, var(--text-large-title));
  line-height: 1.02;
}

.cta-band h2 {
  font-size: clamp(var(--text-title2), 4vw, var(--text-title1));
  line-height: 1.04;
}

.hero-copy p,
.page-intro p,
.section-heading p,
.surface-card p,
.experience-card p,
.story-card p,
.resume-card p,
.writing-card p,
.cta-band p,
.body-copy {
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.47;
}

.hero-copy p,
.page-intro p {
  max-width: 42rem;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.47;
}

.hero-copy p+p,
.page-intro p+p {
  margin-top: var(--space-3);
}

.button-row,
.cta-actions,
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.button-row {
  margin-top: var(--space-6);
}

/* Desktop: fixed header clearance + tighter hero bottom / section join */
@media (min-width: 1025px) {
  .home-hero {
    padding-top: var(--hero-inset-desktop);
    padding-bottom: var(--space-2);
  }

  .page-hero {
    padding-top: var(--hero-inset-desktop);
  }

  .home-hero .wrap.home-hero__wrap {
    gap: 0;
  }

  .hero-line-focus {
    font-size: clamp(2.25rem, 2.2vw + 1.2rem, 3.25rem);
  }

  .hero-copy--home .hero-cta-row {
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .hero-copy--home.hero-copy--minimal .stat-stack {
    margin-top: 0;
  }

  .hero-copy .eyebrow {
    margin-bottom: var(--space-2);
  }

  .hero-copy .button-row {
    margin-top: var(--space-3);
  }

  /* Keep home minimal: lede→CTA and CTA→stats both use space-4 */
  .hero-copy--home .button-row.hero-cta-row {
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .hero-copy .stat-stack,
  .page-intro--with-stats .stat-stack {
    margin-top: var(--space-3);
    gap: var(--space-2);
  }

  .hero-copy .stat-stack .stat-card,
  .page-intro--with-stats .stat-stack .stat-card {
    min-height: 5rem;
    padding: 12px 14px;
    align-content: center;
  }

  .hero-copy .stat-stack .stat-card strong,
  .page-intro--with-stats .stat-stack .stat-card strong {
    font-size: var(--text-title2);
    color: var(--accent-strong);
  }

  .hero-copy .stat-stack .stat-card span,
  .page-intro--with-stats .stat-stack .stat-card span {
    font-size: var(--text-caption1);
    line-height: 1.25;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  min-width: 44px;
  /* HIG min touch target */
  padding: 0 var(--button-padding-x);
  border: 1px solid color-mix(in srgb, var(--line) 92%, rgba(255, 255, 255, 0.28));
  border-radius: 999px;
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 12px 28px rgba(15, 23, 42, 0.08);
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease), color 180ms var(--ease), filter 180ms var(--ease);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

.button:focus-visible,
.header-cta:focus-visible,
.mobile-resume-fab:focus-visible,
.nav-links a:focus-visible,
.theme-toggle:focus-visible,
.menu-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button-primary {
  color: #111111;
  border-color: color-mix(in srgb, var(--accent) 26%, rgba(255, 255, 255, 0.34));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 30%, rgba(255, 255, 255, 0.18)), color-mix(in srgb, var(--accent-strong) 22%, rgba(255, 255, 255, 0.08)));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 14px 30px color-mix(in srgb, var(--accent) 16%, transparent);
}

.button-primary:hover,
.button-primary:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 18px 34px color-mix(in srgb, var(--accent) 18%, transparent);
}

.button-secondary {
  color: var(--text);
  border-color: color-mix(in srgb, var(--line-strong) 92%, rgba(255, 255, 255, 0.3));
  background: color-mix(in srgb, var(--surface-strong) 66%, transparent);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: color-mix(in srgb, var(--surface-strong) 76%, var(--accent-soft));
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line-strong));
}

.button-gradient {
  color: #111111;
  border-color: color-mix(in srgb, var(--accent) 32%, rgba(255, 255, 255, 0.42));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 36%, rgba(255, 255, 255, 0.16)), color-mix(in srgb, var(--accent-strong) 26%, rgba(255, 255, 255, 0.06)));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 16px 32px color-mix(in srgb, var(--accent) 18%, transparent);
}

.button-gradient:hover,
.button-gradient:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 20px 36px color-mix(in srgb, var(--accent) 20%, transparent);
}

html[data-theme="dark"] .button-primary,
html[data-theme="dark"] .button-gradient {
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {

  html:not([data-theme="light"]) .button-primary,
  html:not([data-theme="light"]) .button-gradient {
    color: #ffffff;
  }
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: var(--space-5);
  color: var(--accent);
  font-weight: 600;
}

.text-link span {
  transition: transform 180ms var(--ease);
}

.text-link:hover span {
  transform: translateX(3px);
}

.hero-visual:not(.hero-visual--story),
.surface-card,
.experience-card,
.story-card,
.resume-card,
.writing-card,
.cta-band,
.roadmap-step {
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: var(--shadow-sm);
}

.hero-visual:not(.hero-visual--story) {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 0; /* Removing padding to let image fill */
  overflow: hidden;
  align-self: center;
  border-radius: var(--surface-radius-xl);
}

.hero-visual:not(.hero-visual--story) .hero-portrait {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--surface-radius-xl);
}

/* My Story: circular portrait, right-aligned; glass ring matches stat-card (iOS-style) */
.page-hero--story .split-grid,
.page-hero--story .split-grid--story-hero {
  align-items: center;
}

.page-hero--story .hero-visual--story {
  justify-self: end;
}

.page-intro--story .story-hero-lead {
  max-width: 28rem;
  margin-top: 0;
  font-size: var(--text-callout);
  line-height: 1.45;
  color: var(--muted);
}

.hero-visual--story {
  position: relative;
  display: block;
  /* Circle: ~184 to 320px (8pt-friendly), scales with viewport */
  width: clamp(11.5rem, 32vw, 20rem);
  max-width: 100%;
  margin: 0;
  align-self: center;
  aspect-ratio: 1;
  min-height: 0;
  padding: 3px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 4px 0 rgba(0, 0, 0, 0.02),
    0 12px 40px rgba(0, 0, 0, 0.1);
}

.hero-visual--story .story-portrait {
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 50%;
  z-index: 1;
}

/* ── My Story: visual chapters (magazine layout + placeholders) ── */
.story-magical {
  position: relative;
}

.story-magical__intro {
  text-align: center;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.story-magical__scroll-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.story-magical__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(var(--text-title2), 2.8vw, var(--text-large-title));
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
}

.story-chapters {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: min(72rem, 100%);
  margin: 0 auto;
  padding: 0 var(--shell-gutter);
}

.story-chapter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: clamp(1.25rem, 4vw, 2.75rem);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 2.75rem) 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
}

.story-chapter:last-of-type {
  border-bottom: none;
}

.story-chapter--flip .story-chapter__visual {
  order: -1;
}

.story-chapter__copy {
  min-width: 0;
}

.story-chapter__index {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-caption1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--accent) 75%, var(--muted));
}

.story-chapter__heading {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text);
}

.story-chapter__hint {
  margin: 0;
  font-size: var(--text-subhead);
  line-height: 1.35;
  color: var(--muted);
}

.story-chapter__visual {
  margin: 0;
  min-width: 0;
}

.story-photo-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: clamp(10rem, 28vw, 14rem);
  aspect-ratio: 4 / 3;
  padding: var(--space-4);
  text-align: center;
  border-radius: var(--surface-radius-xl);
  border: 1px dashed color-mix(in srgb, var(--line) 70%, var(--accent) 30%);
  background:
    radial-gradient(120% 80% at 20% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%),
    color-mix(in srgb, var(--surface-strong) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.story-photo-slot__glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%);
  opacity: 0.45;
  pointer-events: none;
}

.story-photo-slot__label {
  position: relative;
  z-index: 1;
  font-size: var(--text-callout);
  font-weight: 600;
  color: var(--text);
}

.story-photo-slot__hint {
  position: relative;
  z-index: 1;
  font-size: var(--text-caption1);
  color: var(--muted);
}

/* When you add a real image, use class story-photo-slot__img on the img */
.story-photo-slot__img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.story-photo-slot:has(.story-photo-slot__img) {
  padding: 0;
  border-style: solid;
  border-color: var(--line);
}

.story-photo-slot:has(.story-photo-slot__img) .story-photo-slot__glow,
.story-photo-slot:has(.story-photo-slot__img) .story-photo-slot__label,
.story-photo-slot:has(.story-photo-slot__img) .story-photo-slot__hint,
.story-photo-slot:has(.story-photo-slot__img) .story-chapter__link {
  display: none;
}

/* Story chapters: carousel / gallery (data-gallery + optional placeholders) */
.story-gallery.story-photo-slot {
  --story-slide-count: 1;
  --story-index: 0;
  display: block;
  padding: 0;
  border-style: solid;
  border-color: var(--line);
}

.story-gallery.story-photo-slot:not(:has(.story-gallery__img)) {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--line) 70%, var(--accent) 30%);
}

.story-gallery__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: clamp(10rem, 28vw, 14rem);
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(120% 80% at 20% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%),
    color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.story-gallery__track {
  display: flex;
  height: 100%;
  width: calc(100% * var(--story-slide-count, 1));
  transform: translateX(calc(-100% * var(--story-index, 0) / var(--story-slide-count, 1)));
  transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .story-gallery__track {
    transition: none;
  }
}

.story-gallery__slide {
  position: relative;
  flex: 0 0 calc(100% / var(--story-slide-count, 1));
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
}

.story-gallery .story-photo-slot__img,
.story-gallery__img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.story-gallery__slide--placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4);
  text-align: center;
}

.story-gallery__slide--ph-1 {
  background:
    radial-gradient(ellipse 90% 70% at 30% 20%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface-strong) 80%, transparent);
}

.story-gallery__slide--ph-2 {
  background:
    radial-gradient(ellipse 80% 60% at 75% 80%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 58%),
    color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

.story-gallery__slide--ph-3 {
  background:
    radial-gradient(ellipse 100% 50% at 50% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 55%),
    color-mix(in srgb, var(--surface-strong) 82%, transparent);
}

.story-gallery__placeholder-kicker {
  margin: 0;
  font-size: var(--text-caption1);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 80%, var(--muted));
}

.story-gallery__placeholder-label {
  margin: 0;
  max-width: 14rem;
  font-size: var(--text-caption1);
  font-weight: 600;
  line-height: 1.4;
  color: var(--muted);
}

.story-gallery__btn {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.story-gallery__btn:hover {
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
}

.story-gallery__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.story-gallery__btn:disabled {
  opacity: 0.32;
  pointer-events: none;
}

.story-gallery__btn--prev {
  left: 10px;
}

.story-gallery__btn--next {
  right: 10px;
}

.story-gallery__btn-icon {
  display: block;
  width: 22px;
  height: 22px;
}

.story-gallery__dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: min(100% - 7rem, 20rem);
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 45%, transparent);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.story-gallery__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 50%, transparent);
  cursor: pointer;
  transition: width 0.25s ease, background 0.2s ease, border-radius 0.25s ease;
}

.story-gallery__dot[aria-current="true"] {
  width: 22px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 92%, var(--text));
}

.story-gallery__dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .story-gallery__dot {
    transition: none;
  }
}

.story-gallery[data-story-slides="1"] .story-gallery__btn,
.story-gallery[data-story-slides="1"] .story-gallery__dots {
  display: none;
}

html[data-theme="dark"] .story-gallery.story-photo-slot:not(:has(.story-gallery__img)) {
  border-color: color-mix(in srgb, var(--line) 55%, var(--accent) 25%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .story-gallery.story-photo-slot:not(:has(.story-gallery__img)) {
    border-color: color-mix(in srgb, var(--line) 55%, var(--accent) 25%);
  }
}

.story-chapter__link.text-link {
  position: relative;
  z-index: 1;
  margin-top: var(--space-1);
}

.story-chapter__link--inline {
  margin-top: var(--space-3);
}

html[data-theme="dark"] .story-photo-slot {
  border-color: color-mix(in srgb, var(--line) 55%, var(--accent) 25%);
  background:
    radial-gradient(120% 80% at 20% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .story-photo-slot {
    border-color: color-mix(in srgb, var(--line) 55%, var(--accent) 25%);
    background:
      radial-gradient(120% 80% at 20% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
      color-mix(in srgb, var(--surface-strong) 78%, transparent);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .story-photo-slot__glow {
    animation: storySlotGlow 14s ease-in-out infinite alternate;
  }
}

@keyframes storySlotGlow {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.38;
  }

  100% {
    transform: translate3d(2%, -1%, 0) scale(1.04);
    opacity: 0.52;
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-photo-slot__glow {
    animation: none;
  }
}

html[data-theme="dark"] .hero-visual--story {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 55%,
    rgba(255, 255, 255, 0.02) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .hero-visual--story {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.04) 55%,
      rgba(255, 255, 255, 0.02) 100%
    );
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 -1px 0 rgba(0, 0, 0, 0.2),
      0 4px 0 rgba(0, 0, 0, 0.08),
      0 12px 40px rgba(0, 0, 0, 0.35);
  }
}

.hero-visual--decorative::before {
  display: none;
}

/* Resume: decorative panel balances split layout (desktop) */
.hero-visual--decorative {
  position: relative;
  min-height: min(20rem, 48vh);
  aspect-ratio: 3 / 4;
  max-height: min(36rem, 72vh);
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  background:
    radial-gradient(ellipse 80% 60% at 30% 25%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 65%),
    radial-gradient(ellipse 70% 55% at 75% 70%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--surface-strong) 88%, transparent), color-mix(in srgb, var(--surface) 94%, transparent));
  animation: heroOrbFloat 26s ease-in-out infinite;
}

.hero-visual__glow {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 68%);
  filter: blur(20px);
  opacity: 0.75;
  animation: heroOrbFloat 18s ease-in-out infinite reverse;
}

@media (max-width: 1024px) {
  .hero-visual--decorative {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-visual--decorative,
  .hero-visual__glow {
    animation: none;
  }
}

/* Story portrait: overrides above; other heroes keep full-bleed crop */
.page-hero .hero-visual:not(.hero-visual--story) .hero-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
}

.hero-visual:not(.hero-visual--story)::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 22%);
  pointer-events: none;
}

.stat-stack {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--card-gap);
  width: 100%;
}

.hero-copy .stat-stack,
.page-intro--with-stats .stat-stack {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: var(--space-3);
  gap: var(--space-2);
  perspective: 800px;
  width: 100%;
}

.page-intro--with-stats .button-row + .stat-stack {
  margin-top: var(--space-4);
}

.stat-card {
  min-height: 7.2rem;
  padding: calc(var(--card-padding) - 0.1rem);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 255, 255, 0.22) 50%,
      rgba(255, 255, 255, 0.12) 100%);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  display: grid;
  align-content: start;
  gap: 0.35rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 4px 0 rgba(0, 0, 0, 0.02),
    0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateZ(0);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    0 6px 0 rgba(0, 0, 0, 0.02),
    0 12px 32px rgba(0, 0, 0, 0.08);
}

.stat-card strong {
  font-family: var(--font-display);
  font-size: var(--text-title1);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent-strong);
}

.stat-card span {
  color: var(--muted);
  font-size: var(--text-footnote);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card .stat-card-desc-multiline {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

html[data-theme="dark"] .stat-card {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.04) 50%,
      rgba(255, 255, 255, 0.02) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .stat-card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 6px 0 rgba(0, 0, 0, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .stat-card {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.04) 50%,
        rgba(255, 255, 255, 0.02) 100%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 -1px 0 rgba(0, 0, 0, 0.2),
      0 4px 0 rgba(0, 0, 0, 0.08),
      0 8px 24px rgba(0, 0, 0, 0.24);
  }

  html:not([data-theme="light"]) .stat-card:hover {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      inset 0 -1px 0 rgba(0, 0, 0, 0.22),
      0 6px 0 rgba(0, 0, 0, 0.08),
      0 12px 32px rgba(0, 0, 0, 0.3);
  }
}

.hero-portrait,
.hero-illustration {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: var(--radius-xl);
}

.hero-portrait {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: top center;
}

.hero-illustration {
  height: auto;
}

.hero-illustration {
  object-fit: contain;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 78%, transparent), color-mix(in srgb, var(--surface) 88%, transparent));
}

.section-heading {
  position: relative;
  z-index: 0;
  max-width: 42rem;
  margin-bottom: var(--section-block-gap);
}

.section-heading p {
  margin: var(--space-2) 0 0;
}

@keyframes buttonPrimaryAura {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.34),
      0 14px 30px color-mix(in srgb, var(--accent) 16%, transparent),
      0 0 0 0 transparent;
  }

  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.34),
      0 16px 34px color-mix(in srgb, var(--accent) 22%, transparent),
      0 0 28px color-mix(in srgb, var(--accent) 14%, transparent);
  }
}

@keyframes buttonGradientAura {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.38),
      0 16px 32px color-mix(in srgb, var(--accent) 18%, transparent),
      0 0 0 0 transparent;
  }

  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.38),
      0 18px 38px color-mix(in srgb, var(--accent) 24%, transparent),
      0 0 32px color-mix(in srgb, var(--accent) 15%, transparent);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button-primary:not(:hover):not(:focus-visible):not(:active) {
    animation: buttonPrimaryAura 5.5s ease-in-out infinite;
  }

  .button-gradient:not(:hover):not(:focus-visible):not(:active) {
    animation: buttonGradientAura 5.5s ease-in-out infinite;
  }
}

.design-grid,
.story-grid,
.resume-grid,
.writing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--card-gap);
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--card-gap);
  align-items: stretch;
}

.experience-grid--case {
  gap: var(--space-3);
}

.resume-list {
  display: grid;
  gap: var(--card-gap);
}

.surface-card,
.experience-card,
.story-card,
.resume-card,
.writing-card,
.roadmap-step {
  padding: var(--card-padding);
}

/* Work card uniform layout */
.experience-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  flex: none;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.experience-card.case-card:hover .card-cover img,
.experience-card.case-card:focus-within .card-cover img {
  transform: scale(1.07);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 var(--space-2);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-caption2);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  border: 1px solid var(--line);
}

/* Case cards: compact keyword chips (HIG caption scale) */
.experience-card.case-card .card-badges {
  gap: 5px;
  margin: 0 0 10px;
}

.experience-card.case-card .card-badge {
  padding: 3px 7px;
  font-size: var(--text-caption2);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 3px;
  color: color-mix(in srgb, var(--muted) 88%, var(--text));
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
}

.experience-card .card-body > h3 {
  margin: 0 0 var(--space-1);
}

.experience-card .card-desc {
  margin: 0;
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: var(--text-subhead);
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.experience-card.case-card .card-desc {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Case study cards: editorial minimal + growth-style motion */
.experience-card.case-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--surface-radius-xl);
  background: color-mix(in srgb, var(--surface-strong) 76%, transparent);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    var(--shadow-sm);
}

.experience-card.case-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms var(--ease);
  background:
    radial-gradient(120% 80% at 10% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(100% 70% at 100% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 50%);
}

.experience-card.case-card:hover::before,
.experience-card.case-card:focus-within::before {
  opacity: 1;
}

.case-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  text-decoration: none;
  color: inherit;
  border-radius: inherit;
  outline: none;
}

.case-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.experience-card.case-card .card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(185deg, transparent 30%, rgba(0, 0, 0, 0.22) 70%, rgba(0, 0, 0, 0.55) 100%);
  opacity: 0;
  transition: opacity 400ms var(--ease);
  pointer-events: none;
}

.experience-card.case-card:hover .card-cover::after,
.experience-card.case-card:focus-within .card-cover::after {
  opacity: 1;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-top: auto;
  padding-top: var(--space-3);
  font-size: var(--text-subhead);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.card-cta-icon {
  display: inline-block;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.experience-card.case-card:hover .card-cta-icon,
.experience-card.case-card:focus-within .card-cta-icon {
  transform: translateX(5px);
}

.experience-card.case-card .card-body > h3 {
  margin: 0 0 var(--space-1);
  font-size: clamp(1.2rem, 1.1vw + 0.95rem, var(--text-title2));
  letter-spacing: -0.034em;
  line-height: 1.08;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--card-padding);
}

.surface-card h3,
.experience-card h3,
.story-card h3,
.resume-card h3,
.writing-card h3,
.roadmap-step h3 {
  margin: var(--space-3) 0 var(--space-1);
  font-family: var(--font-display);
  font-size: var(--text-title3);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.resume-card ul {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
}

.experience-meta,
.resume-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.experience-meta>span:last-child,
.resume-meta>.body-copy {
  color: var(--muted);
  font-size: var(--text-body);
}

.surface-card,
.story-card,
.resume-card,
.writing-card,
.roadmap-card,
.social-link {
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.surface-card:hover,
.story-card:hover,
.resume-card:hover,
.writing-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.experience-card {
  transition:
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 380ms var(--ease),
    box-shadow 380ms var(--ease),
    background 380ms var(--ease);
}

.experience-card.case-card:hover,
.experience-card.case-card:focus-within {
  transform: translateY(-10px);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line-strong));
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.1),
    0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
}

html[data-theme="dark"] .experience-card.case-card:hover,
html[data-theme="dark"] .experience-card.case-card:focus-within {
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .experience-card.case-card:hover,
  html:not([data-theme="light"]) .experience-card.case-card:focus-within {
    box-shadow:
      0 28px 64px rgba(0, 0, 0, 0.5),
      0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
  }
}

.center-cta {
  display: flex;
  justify-content: center;
  margin-top: var(--space-5);
}

.roadmap-flow {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.roadmap-flow::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--line-strong) 90%, rgba(125, 125, 140, 0.6)) 10%, color-mix(in srgb, var(--line-strong) 80%, rgba(125, 125, 140, 0.6)) 90%, transparent);
  opacity: 0.78;
}

.roadmap-node[data-roadmap-target="engineering"] {
  --roadmap-accent: #a26cf1;
  --roadmap-soft: rgba(162, 108, 241, 0.1);
}

.roadmap-node[data-roadmap-target="baloot"] {
  --roadmap-accent: #53ba8a;
  --roadmap-soft: rgba(83, 186, 138, 0.1);
}

.roadmap-node[data-roadmap-target="torob"] {
  --roadmap-accent: #5aa8f0;
  --roadmap-soft: rgba(90, 168, 240, 0.1);
}

.roadmap-node[data-roadmap-target="thi"] {
  --roadmap-accent: #f29c67;
  --roadmap-soft: rgba(242, 156, 103, 0.1);
}

.roadmap-node[data-roadmap-target="torob-b2b"] {
  --roadmap-accent: #5aa8f0;
  --roadmap-soft: rgba(90, 168, 240, 0.1);
}

.roadmap-node[data-roadmap-target="consulting"] {
  --roadmap-accent: #7a86de;
  --roadmap-soft: rgba(122, 134, 222, 0.1);
}

.roadmap-node[data-roadmap-target="bastoy"] {
  --roadmap-accent: #dcb955;
  --roadmap-soft: rgba(220, 185, 85, 0.1);
}

.roadmap-node {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1.35rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  appearance: none;
  text-align: left;
  cursor: pointer;
  transition: none;
}

.roadmap-node:focus-visible {
  outline: none;
}

.roadmap-spacer {
  min-height: 1px;
}

.roadmap-node-right .roadmap-card {
  grid-column: 3;
  justify-self: start;
}

.roadmap-node-left .roadmap-card {
  grid-column: 1;
  justify-self: end;
}

.roadmap-node-right .roadmap-spacer {
  grid-column: 1;
}

.roadmap-node-left .roadmap-spacer {
  grid-column: 3;
}

.roadmap-marker {
  position: relative;
  z-index: 2;
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.8rem;
  min-height: 2.6rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--roadmap-accent, var(--accent)) 28%, rgba(255, 255, 255, 0.34));
  background: color-mix(in srgb, var(--surface-strong) 94%, var(--roadmap-soft, transparent));
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 20px rgba(15, 23, 42, 0.05);
  color: var(--roadmap-accent, var(--accent));
  font-size: var(--text-footnote);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.roadmap-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  width: min(100%, 26rem);
  padding: 1.1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--line) 94%, rgba(255, 255, 255, 0.22));
  border-radius: 1.6rem;
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 12px 28px rgba(15, 23, 42, 0.06);
}

.roadmap-illustration,
.roadmap-icon {
  width: 3.2rem;
  height: 3.2rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
}

.roadmap-illustration {
  object-fit: contain;
  border-radius: 10px;
}

.roadmap-copy {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.roadmap-range {
  font-size: var(--text-footnote);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--roadmap-accent, var(--accent));
}

.roadmap-node-left .roadmap-card::before,
.roadmap-node-right .roadmap-card::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 1.2rem;
  height: 1px;
  background: color-mix(in srgb, var(--accent) 44%, var(--line-strong));
}

.roadmap-node-left .roadmap-card::before {
  right: -1.2rem;
}

.roadmap-node-right .roadmap-card::before {
  left: -1.2rem;
}

.roadmap-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-strong) 96%, var(--roadmap-soft, transparent));
  border: 1px solid color-mix(in srgb, var(--roadmap-accent, var(--accent)) 18%, var(--line));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-size: 1.35rem;
  line-height: 1;
}


.roadmap-copy strong {
  font-family: var(--font-display);
  font-size: var(--text-callout);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.roadmap-copy>span:not(.roadmap-range) {
  color: var(--muted);
  font-size: var(--text-footnote);
  line-height: 1.48;
}

.roadmap-description {
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.5;
}

.roadmap-node:hover .roadmap-card,
.roadmap-node:focus-visible .roadmap-card,
.roadmap-node.is-active .roadmap-card {
  border-color: color-mix(in srgb, var(--roadmap-accent, var(--accent)) 22%, var(--line-strong));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 16px 32px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.roadmap-node:hover .roadmap-marker,
.roadmap-node:focus-visible .roadmap-marker,
.roadmap-node.is-active .roadmap-marker {
  border-color: color-mix(in srgb, var(--roadmap-accent, var(--accent)) 36%, rgba(255, 255, 255, 0.38));
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--roadmap-soft, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 22px rgba(15, 23, 42, 0.05);
}

.roadmap-node:hover .roadmap-icon,
.roadmap-node:focus-visible .roadmap-icon,
.roadmap-node.is-active .roadmap-icon {
  border-color: color-mix(in srgb, var(--roadmap-accent, var(--accent)) 26%, var(--line));
  background: color-mix(in srgb, var(--surface-strong) 94%, var(--roadmap-soft, transparent));
}

.recommendation-marquee {
  overflow: hidden;
  margin-top: var(--section-block-gap);
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.recommendation-track {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: max-content;
  animation: marquee 78s linear infinite;
}

.recommendation-marquee:hover .recommendation-track {
  animation-play-state: paused;
}

.recommendation-svg {
  flex: none;
  width: clamp(18rem, 28vw, 34rem);
  max-height: 24rem;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--line) 86%, rgba(255, 255, 255, 0.28));
  border-radius: 1.6rem;
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 14px 30px rgba(15, 23, 42, 0.08);
  object-fit: contain;
  filter: saturate(0.98) contrast(1.01);
}

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-6);
}

.cta-band p {
  max-width: 40rem;
  margin: var(--space-4) 0 0;
}

.social-links {
  align-items: center;
}


.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: var(--control-height);
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--line) 88%, rgba(255, 255, 255, 0.28));
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  backdrop-filter: blur(20px) saturate(1.18);
  -webkit-backdrop-filter: blur(20px) saturate(1.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 24px rgba(15, 23, 42, 0.08);
  color: var(--muted);
}

.social-link:hover,
.social-link:focus-visible {
  transform: translateY(-2px);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line-strong));
}

.social-link svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

/* ═══ BOTTOM TAB BAR (mobile & tablet) ═══ */
.bottom-tab-bar {
  display: none;
  /* shown only on ≤1024px */
}

/* Legacy mobile-dock hidden everywhere */
.mobile-dock {
  display: none;
}

/* Footer: full-bleed band + directory layout (Apple-style hierarchy) */
.site-footer {
  margin-top: var(--space-8);
  padding-top: 0;
  /* ~Apple.com: modest bottom rhythm + safe area (not a deep “well”) */
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  /* Heavier page bg in the mix so the band doesn’t read as a disconnected panel */
  background: color-mix(in srgb, var(--surface-strong) 38%, var(--bg) 62%);
  border-top: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
}

html[data-theme="dark"] .site-footer {
  background: color-mix(in srgb, var(--surface-strong) 42%, var(--bg) 58%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .site-footer {
    background: color-mix(in srgb, var(--surface-strong) 42%, var(--bg) 58%);
  }
}

/* Dock pages: tab + safe area are in `body` `--bottom-tab-stack`; footer only needs rhythm */
@media (max-width: 1024px) {
  .site-footer.site-footer--dock {
    padding-bottom: var(--space-4);
  }
}

/* ═══ MORE SHEET (mobile popover from bottom tab More button) ═══ */
.more-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease);
}

.more-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.more-sheet {
  position: fixed;
  left: 50%;
  /*
   * HIG: comfortable margin above tab bar (not flush). Tab stack + 32px (4×8pt); was 12px and felt cramped.
   * Desktop fallback when --bottom-tab-stack is 0: max(24px, 0) + space-4 still clears bottom comfortably.
   */
  bottom: calc(max(24px, var(--bottom-tab-stack, 0px)) + var(--space-4));
  transform: translate3d(-50%, 10px, 0);
  z-index: 49;
  width: min(calc(100% - 32px), 26rem);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
  backdrop-filter: blur(32px) saturate(1.4);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
  display: grid;
  gap: var(--space-2);
}

.more-sheet.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(-50%, 0, 0);
}

.more-sheet-label {
  font-size: var(--text-caption1);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 4px;
}

.more-sheet-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  color: var(--text);
  font-size: var(--text-body);
  font-weight: 500;
  transition: background 160ms var(--ease), color 160ms var(--ease);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.more-sheet-item:hover,
.more-sheet-item:focus-visible {
  background: color-mix(in srgb, var(--surface-strong) 80%, var(--accent-soft));
  color: var(--accent);
  outline: none;
}

.more-sheet-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent);
  border: 1px solid var(--line);
  font-size: 1rem;
  flex: none;
}

.more-sheet-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

.more-sheet-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
}

.more-sheet-theme-label {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.more-sheet-theme-label .more-sheet-item-icon {
  font-size: 0.95rem;
}

.more-sheet-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 24px rgba(15, 23, 42, 0.1);
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease);
}

.more-sheet-theme-toggle:hover,
.more-sheet-theme-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  outline: none;
}

.footer-pro {
  padding-top: var(--space-7);
}

.footer-directory {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-7) var(--space-8);
  padding-bottom: var(--space-5);
}

.footer-col {
  min-width: 0;
}

.footer-col-label {
  margin: 0 0 var(--space-3);
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.footer-col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-col-list a {
  display: inline-block;
  font-size: var(--text-footnote);
  font-weight: 400;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  max-width: 100%;
}

.footer-col-list a.footer-connect-link {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  max-width: 100%;
}

.footer-connect-icon {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  color: inherit;
}

.footer-connect-icon path {
  fill: currentColor;
}

.footer-col-list a:hover,
.footer-col-list a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.footer-brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.footer-brand-logo-link {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -6px 0 0 -6px;
  padding: 6px;
  border-radius: var(--radius-md);
  line-height: 0;
  transition: opacity 160ms var(--ease), background 160ms var(--ease);
}

.footer-brand-logo-link:hover,
.footer-brand-logo-link:focus-visible {
  opacity: 0.92;
  background: color-mix(in srgb, var(--surface-strong) 65%, transparent);
  outline: none;
}

.footer-brand-mark {
  position: relative;
  display: block;
  width: 2rem;
  height: 2rem;
}

.footer-brand-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer-brand-logo--dark {
  opacity: 0;
}

html[data-theme="dark"] .footer-brand-logo--light {
  opacity: 0;
}

html[data-theme="dark"] .footer-brand-logo--dark {
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .footer-brand-logo--light {
    opacity: 0;
  }

  html:not([data-theme="light"]) .footer-brand-logo--dark {
    opacity: 1;
  }
}

.footer-brand-copy {
  min-width: 0;
  flex: 1;
}

.footer-brand-copy .footer-col-label {
  margin-top: 0;
}

.footer-about {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-about-line {
  margin: 0;
  font-size: var(--text-footnote);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.footer-about-meta {
  margin: 0;
  font-size: var(--text-caption1);
  line-height: 1.45;
  font-weight: 400;
  color: var(--muted);
}

.footer-base {
  padding-bottom: var(--space-1);
}

.footer-divider {
  height: 1px;
  margin: 0;
  border: none;
  background: var(--line);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-8);
  padding-top: var(--space-4);
}

.footer-copyright,
.footer-craft-note {
  margin: 0;
  max-width: 36rem;
  font-size: var(--text-caption2);
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--muted) 82%, transparent);
}

.footer-copyright {
  flex: 1 1 12rem;
}

.footer-craft-note {
  flex: 1 1 14rem;
  text-align: right;
}

@media (max-width: 720px) {
  .footer-directory {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer-col--about {
    grid-column: auto;
  }

  .footer-craft-note {
    text-align: left;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 560ms var(--ease), transform 560ms var(--ease);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@keyframes liquidShift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.62;
  }

  50% {
    transform: translate3d(0, -0.6%, 0) scale(1.018);
    opacity: 0.72;
  }

  100% {
    transform: translate3d(0, 0.8%, 0) scale(1.014);
    opacity: 0.64;
  }
}

@keyframes orbDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(6px, -7px, 0) scale(1.02);
  }

  100% {
    transform: translate3d(-6px, 6px, 0) scale(1.015);
  }
}

@keyframes marquee {
  0% {
    transform: translateX(calc(-50% - 1rem));
  }

  100% {
    transform: translateX(0);
  }
}

@media (max-width: 1080px) {

  .hero-grid,
  .split-grid,
  .design-grid,
  .story-grid,
  .resume-grid,
  .writing-grid {
    grid-template-columns: 1fr 1fr;
  }

  .experience-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-copy .stat-stack,
  .page-intro--with-stats .stat-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading h2 {
    font-size: clamp(var(--text-title2), 3.5vw, var(--text-large-title));
  }
}

/* Tablet: HIG design system (iPad ≤1024px) */
@media (max-width: 1024px) {
  :root {
    --shell-gutter: clamp(16px, 4vw, 24px);
    --section-gap: clamp(48px, 6vw, 64px);
    --card-gap: 16px;
    --card-padding: 16px;
    --control-height: 48px;
    /* HIG: 48pt for iPad touch targets */
    --button-padding-x: 16px;
    --surface-radius: 12px;
    --surface-radius-xl: 16px;
    /* Tab row (~49pt) + bar safe-area padding; one stack, no duplicate footer padding */
    --bottom-tab-stack: max(52px, calc(48px + max(10px, env(safe-area-inset-bottom, 0px))));
  }

  /* Reserve space above fixed bottom tab bar (all pages that include .bottom-tab-bar) */
  body:has(.bottom-tab-bar) {
    padding-bottom: var(--bottom-tab-stack);
  }

  /* Hide the desktop header on mobile/tablet; bottom tab bar takes over nav */
  .site-header {
    display: none;
  }

  /* Hide old floating fab chrome, replaced by bottom tab bar */
  .mobile-brand-fab,
  .mobile-top-actions,
  .theme-fab {
    display: none !important;
  }

  /* Page top: subpages keep full inset; home uses centered logo band + no double top padding */
  .page-hero {
    padding-top: var(--hero-inset-compact);
  }

  .home-hero {
    padding-top: 0;
    padding-bottom: var(--space-4);
  }

  .home-hero-compact-brand {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--space-2));
    margin-bottom: var(--space-5);
  }

  /* ── Grid resets ── */
  .hero-grid,
  .split-grid,
  .design-grid,
  .story-grid,
  .resume-grid,
  .writing-grid {
    grid-template-columns: 1fr;
  }

  .experience-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* My Story: circular portrait stacks below copy; centered */
  .page-hero--story .hero-visual--story {
    justify-self: center;
    width: clamp(11.5rem, min(72vw, 88%), 18rem);
  }

  .hero-visual--story .story-portrait {
    object-position: 50% 22%;
  }

  .story-chapter,
  .story-chapter--flip {
    grid-template-columns: 1fr;
  }

  .story-chapter--flip .story-chapter__visual {
    order: 0;
  }

  .hero-visual:not(.hero-visual--story) {
    align-self: stretch;
  }

    /* ── Stack CTA; footer directory stacks as single column ── */
    .cta-band {
    flex-direction: column;
    align-items: flex-start;
  }

    .footer-directory {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-6) var(--space-5);
    }

    .footer-col--about {
      grid-column: 1 / -1;
    }

    .footer-col-list a {
      padding: 10px 0;
  }

  .button-row,
    .cta-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .button {
    width: 100%;
      min-height: 48px;
      font-size: var(--text-body);
    }

    /* ════════════════════════════════════
     BOTTOM TAB BAR
     Apple HIG Tab Bar: 49pt height + safe area
     4 tabs: Home (logo) | My Story | Resume | More
     ════════════════════════════════════ */
    .bottom-tab-bar {
    position: fixed;
    left: 50%;
      bottom: 0;
      z-index: 50;
      display: flex;
      align-items: stretch;
      width: 100%;
      max-width: 100%;
      /* Safe area + breathing room above home indicator (HIG) */
      padding: 0 var(--space-2) max(10px, env(safe-area-inset-bottom, 0px));
      padding-top: 0;
      border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
      backdrop-filter: blur(28px) saturate(1.4);
      -webkit-backdrop-filter: blur(28px) saturate(1.4);
      box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
      transform: translate3d(-50%, 0, 0);
      transition:
        transform 380ms cubic-bezier(0.32, 0.72, 0, 1),
        opacity 320ms cubic-bezier(0.32, 0.72, 0, 1);
    }

    html.tab-bar-hidden .bottom-tab-bar {
      transform: translate3d(-50%, calc(100% + 2px), 0);
    opacity: 0;
      pointer-events: none;
    }

    @media (prefers-reduced-motion: reduce) {
      html.tab-bar-hidden .bottom-tab-bar {
        transform: translate3d(-50%, 0, 0);
        opacity: 1;
        pointer-events: auto;
      }
    }

    .bottom-tab-item {
      flex: 1;
      display: flex;
      flex-direction: column;
    align-items: center;
    justify-content: center;
      gap: 3px;
      min-width: 44px;
      min-height: max(49px, 44px);
      /* HIG: ~49pt tab row; 44pt minimum touch target */
      padding: 8px 6px 6px;
      border: none;
      background: transparent;
    color: var(--muted);
      font-size: var(--text-caption2);
      /* 11px HIG caption2 for tab labels */
      font-weight: 500;
    letter-spacing: -0.01em;
      text-decoration: none;
      cursor: pointer;
      transition: color 160ms var(--ease);
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    .bottom-tab-item[aria-current="page"],
    .bottom-tab-item.active {
    color: var(--accent);
  }

    .bottom-tab-item:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: -2px;
      border-radius: var(--radius-md);
    }

    /* Tab icon wrapper */
    .bottom-tab-icon {
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      flex: none;
      transition: background 160ms var(--ease);
    }

    .bottom-tab-item[aria-current="page"] .bottom-tab-icon,
    .bottom-tab-item.active .bottom-tab-icon {
      background: color-mix(in srgb, var(--accent) 12%, transparent);
    }

    /* Moji logo in first tab */
    .bottom-tab-logo {
      height: 18px;
      width: auto;
      display: block;
      opacity: 0.6;
      transition: opacity 160ms var(--ease);
    }

    .bottom-tab-item[aria-current="page"] .bottom-tab-logo,
    .bottom-tab-item.active .bottom-tab-logo {
      opacity: 1;
    }

    /* Tab icon SVGs */
    .bottom-tab-icon svg {
      width: 22px;
      height: 22px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.6;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    /* Brand logo visibility per theme */
    .bottom-tab-logo-light {
      display: block;
    }

    .bottom-tab-logo-dark {
      display: none;
    }

    html[data-theme="dark"] .bottom-tab-logo-light {
      display: none;
    }

    html[data-theme="dark"] .bottom-tab-logo-dark {
      display: block;
      opacity: 0.6;
    }

    html[data-theme="dark"] .bottom-tab-item[aria-current="page"] .bottom-tab-logo-dark,
    html[data-theme="dark"] .bottom-tab-item.active .bottom-tab-logo-dark {
      opacity: 1;
    }

    /* ── Roadmap ── */
  .roadmap-flow::before {
    left: 50%;
    transform: translateX(-50%);
  }

  .roadmap-node {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 1rem;
  }

  .roadmap-card {
    width: min(100%, 25.5rem);
  }

  .hero-visual:not(.hero-visual--story),
  .surface-card,
  .experience-card,
  .story-card,
  .resume-card,
  .writing-card,
  .cta-band,
  .roadmap-step {
    border-radius: var(--surface-radius);
  }

  .hero-visual:not(.hero-visual--story) .hero-portrait,
  .hero-illustration {
      border-radius: var(--radius-xl);
    }

    /* Section heading stays large */
    .section-heading h2 {
      font-size: clamp(var(--text-title1), 5vw, var(--text-large-title));
    }

    /* Badge/eyebrow spacing from parent headings */
    .section-heading .eyebrow {
      margin-bottom: var(--space-3);
    }
  }

  /* Mobile: HIG design system (iPhone ≤640px) */
@media (max-width: 640px) {
  :root {
      --shell-gutter: 16px;
      --section-gap: clamp(40px, 8vw, 48px);
      --card-gap: 12px;
      --card-padding: 16px;
      --control-height: 44px;
      /* HIG: 44pt min touch target for iOS */
      --button-padding-x: 16px;
      --surface-radius: 12px;
      --surface-radius-xl: 16px;
    }

    /* Phone: subpages get extra top inset; home uses compact logo row only */
    .page-hero {
      padding-top: var(--hero-inset-phone);
    }

    .home-hero {
      padding-top: 0;
    }

    .home-hero-compact-brand {
      padding-top: calc(env(safe-area-inset-top, 0px) + var(--space-2));
      margin-bottom: var(--space-5);
    }

    /* Hero headline, HIG LargeTitle-ish for impact */
  .hero-copy h1,
  .page-intro h1 {
      font-size: clamp(2rem, 7vw, 2.75rem);
      line-height: 1.06;
    }

    .home-hero .hero-copy h1 {
      font-size: clamp(2rem, 6.5vw, 2.75rem);
      line-height: 1.06;
    }

    .home-hero .hero-lead {
      font-size: var(--text-body);
    }

    /* Section headings, HIG Title1 at most on small screens */
  .section-heading h2,
  .cta-band h2 {
      font-size: clamp(var(--text-title2), 6vw, var(--text-title1));
      line-height: 1.05;
  }

  .hero-copy p,
  .page-intro p {
      font-size: var(--text-body);
  }

  .hero-copy .stat-stack,
    .page-intro--with-stats .stat-stack,
  .stat-stack {
    grid-template-columns: 1fr 1fr;
  }

    .page-hero--story .hero-visual--story {
      width: clamp(11rem, min(78vw, 92%), 16.5rem);
    }

    .hero-visual--story .story-portrait {
      object-position: 50% 24%;
    }

  .hero-visual:not(.hero-visual--story) .hero-portrait,
  .hero-illustration {
    max-height: none;
      border-radius: var(--radius-lg);
  }

    /* Stat cards, compact on phone */
  .stat-card {
      min-height: 5.8rem;
      padding: 14px;
    }

    .experience-grid {
      grid-template-columns: 1fr;
    }

    .card-cover {
      aspect-ratio: auto;
      height: 9rem;
      min-height: 0;
      max-height: none;
    }

    .stat-card strong {
      font-size: var(--text-title2);
      color: var(--accent-strong);
    }

    .stat-card span {
      font-size: var(--text-caption1);
    }

    /* Case summary “My responsibilities”: same KPI label + body value as Project snapshot (not generic stat-card span) */
    .case-page .case-what-stat-card .case-what-stat-kicker {
      font-size: var(--text-caption1);
      font-weight: 600;
      letter-spacing: 0.06em;
      color: var(--muted);
    }

    .case-page .case-what-stat-card .case-what-stat-body,
    .case-page .case-what-stat-card .stat-card-desc-multiline.case-what-stat-body,
    .case-page .case-what-stat-card .case-what-stat-line,
    .case-page .case-what-stat-card .case-what-stat-feature-desc {
      font-size: var(--text-body);
      font-weight: 500;
      line-height: 1.45;
      letter-spacing: -0.01em;
      color: var(--text);
    }

    .case-page .case-what-stat-card .case-what-chip {
      font-size: var(--text-caption2);
      font-weight: 600;
      letter-spacing: 0.03em;
      color: var(--accent-strong);
    }

  .roadmap-flow::before {
    left: 2.35rem;
    transform: none;
  }

  .roadmap-node {
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 0.85rem;
  }

  .roadmap-node-left .roadmap-card,
  .roadmap-node-right .roadmap-card {
    grid-column: 2;
    justify-self: stretch;
    width: 100%;
  }

  .roadmap-node-left .roadmap-spacer,
  .roadmap-node-right .roadmap-spacer {
    display: none;
  }

  .roadmap-marker {
    grid-column: 1;
    min-width: 4rem;
    min-height: 2.55rem;
    padding-inline: 0.65rem;
  }

  .roadmap-node-left .roadmap-card::before,
  .roadmap-node-right .roadmap-card::before {
    left: -0.85rem;
    right: auto;
    width: 0.85rem;
  }

  .roadmap-card {
      padding: 0.9rem;
      border-radius: 1.3rem;
      gap: 0.7rem;
  }

  .roadmap-icon {
      width: 2.5rem;
      height: 2.5rem;
    font-size: 1.2rem;
  }

  .roadmap-illustration,
  .roadmap-icon {
      width: 2.5rem;
      height: 2.5rem;
      font-size: 1.4rem;
  }

  .roadmap-copy strong {
      font-size: var(--text-callout);
      /* 16px */
  }

    .roadmap-copy>span:not(.roadmap-range) {
      font-size: var(--text-footnote);
      /* 13px HIG footnote */
    line-height: 1.45;
  }

  .roadmap-description {
      font-size: var(--text-footnote);
    line-height: 1.45;
  }

  .recommendation-svg {
      width: 17rem;
      padding: 0.65rem;
    }

    /* Bottom tab bar on phone is full-width */
    .bottom-tab-bar {
      max-width: 100%;
    }

    /* Experience grid: 1 col on phone */
    .experience-grid {
      grid-template-columns: 1fr;
    }

    /* Card text sizes scaled to HIG body */
    .experience-card h3,
    .story-card h3,
    .resume-card h3,
    .writing-card h3 {
      font-size: var(--text-title3);
      /* 20px */
    }

    /* Badge spacing standardization */
    .hero-copy .eyebrow,
    .page-intro .eyebrow,
    .section-heading .eyebrow {
      margin-bottom: var(--space-3);
    }

}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0ms !important;
    transition-delay: 0ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}


/* ===== Case study template ===== */
body.case-page {
  --case-toc-rail-h: 5.75rem;
  /* Article column: section rhythm (8pt), inside frosted panel */
  --case-article-section-gap: clamp(var(--space-4), 3.2vw, var(--space-6));
  --case-article-pad-x: clamp(var(--space-3), 2.8vw, var(--space-5));
  --case-article-pad-y: clamp(var(--space-4), 3vw, var(--space-6));
}

@media (min-width: 1025px) {
  body.case-page {
    --case-toc-rail-h: 6.5rem;
  }
}

.case-page .case-wrap {
  width: min(1200px, calc(100% - 2 * var(--shell-gutter)));
  margin: 0 auto;
}

.case-page .case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(var(--space-3), 3vw, var(--space-5));
  align-items: start;
}

/* HIG-inspired article: clean, minimal, content-first */
.case-page .case-main {
  display: grid;
  gap: var(--space-5);
  align-content: start;
  max-width: 680px;
  margin: 0 auto;
  padding: 0;
  border: none;
  background: transparent;
}

/* TOC: aside before main in DOM; shell provides the desktop 2-col grid (#main uses display:contents) */
@media (min-width: 1025px) {
  body.case-page .case-page-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    column-gap: clamp(var(--space-3), 3vw, var(--space-5));
    row-gap: 0;
    align-items: start;
    width: min(1200px, calc(100% - 2 * var(--shell-gutter)));
    margin-left: auto;
    margin-right: auto;
    padding-left: max(var(--shell-gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--shell-gutter), env(safe-area-inset-right, 0px));
    box-sizing: border-box;
  }

  body.case-page .case-page-shell > #main {
    display: contents;
  }

  body.case-page #main > .site-motes {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  body.case-page #main > .page-hero.page-hero--sub {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-bottom: 80px;
  }

  body.case-page #main > .section-space:not(.case-summary-cta-end) {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
  }

  body.case-page .case-page-shell > aside.case-toc[data-case-toc] {
    grid-column: 2;
    grid-row: 3;
    /* Short box at top of tall grid cell: whole rail + TOC list sticks together while scrolling the case body */
    align-self: start;
    justify-self: stretch;
    position: sticky;
    top: calc(var(--site-header-stack) + var(--space-2));
    z-index: 2;
    width: 100%;
    max-width: 260px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--space-2);
    align-items: stretch;
    max-height: calc(100vh - var(--site-header-stack) - var(--space-4));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.case-page #main > .section-space.case-summary-cta-end {
    grid-column: 1 / -1;
    grid-row: 4;
  }
}

/* Hero → article glass: remove top padding, hero has bottom padding instead */
.case-page #main > .section-space:has(#case-read-region) {
  padding-top: 0;
  padding-bottom: var(--space-5);
}

@media (max-width: 1024px) {
  body.case-page .case-page-shell {
    display: block;
  }

  body.case-page #main {
    display: block;
    width: auto;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Sections:  no boxes, just clean spacing with subtle dividers */minimal 
.case-page .case-section {
  padding: 0;
  padding-bottom: var(--space-4);
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  gap: var(--space-3);
}

.case-page .case-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.case-page .case-section h2 {
  margin: 0;
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-title2);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

/* Board-only sections: same minimal approach */
.case-page .case-section--board-only {
  padding: 0;
  padding-bottom: var(--space-4);
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 30%, transparent);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  gap: var(--space-4);
}

.case-page .case-section--board-only:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

html[data-theme="dark"] .case-page .case-section,
html[data-theme="dark"] .case-page .case-section--board-only {
  border-color: color-mix(in srgb, var(--line) 40%, transparent);
  background: transparent;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .case-page .case-section,
  html:not([data-theme="light"]) .case-page .case-section--board-only {
    border-color: color-mix(in srgb, var(--line) 40%, transparent);
    background: transparent;
  }
}

.case-page .case-what-board__heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title2);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.case-page .case-what-board__footnote {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
  font-size: var(--text-footnote);
  font-style: italic;
  line-height: 1.5;
  color: var(--muted);
}

.case-page .case-what-board .case-kpi-grid,
.case-page .case-what-board .case-impact-grid,
.case-page .case-what-board .case-goals-grid,
.case-page .case-what-board .case-final-grid {
  gap: var(--space-3);
}

/* HIG: Cleaner stat cards with subtle depth */
.case-page .stat-card {
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  background: var(--surface-strong);
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.02);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.case-page .stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] .case-page .stat-card {
  border-color: color-mix(in srgb, var(--line) 50%, transparent);
  background: color-mix(in srgb, var(--surface-strong) 95%, transparent);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 1px 3px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .case-page .stat-card {
    border-color: color-mix(in srgb, var(--line) 50%, transparent);
    background: color-mix(in srgb, var(--surface-strong) 95%, transparent);
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.2),
      0 1px 3px rgba(0, 0, 0, 0.15);
  }
}

.case-page .case-what-board__prose {
  margin: 0;
}

.case-page .case-what-board__prose > .case-what-chips {
  margin-bottom: var(--space-2);
}

.case-page .case-what-board__prose p {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--text);
  max-width: 65ch;
}

.case-page .case-what-board__prose--tight p {
  font-size: var(--text-subhead);
  line-height: 1.45;
}

.case-page .case-what-board__prose p + p {
  margin-top: var(--space-3);
}

.case-page .case-what-board__links {
  margin: 0;
  margin-top: var(--space-3);
  font-size: var(--text-caption1);
}

.case-page .case-what-board .case-final-intro {
  margin: 0 0 var(--space-3);
  font-size: var(--text-caption1);
  line-height: 1.4;
  color: var(--muted);
}

.case-page .case-what-board .case-final-intro--compact {
  margin-bottom: var(--space-2);
}

.case-page .case-board-spot {
  display: flex;
  justify-content: center;
  margin: 0 0 var(--space-3);
  color: var(--accent-strong);
}

.case-page .case-board-spot__svg {
  width: clamp(4rem, 16vw, 6.5rem);
  height: auto;
  opacity: 0.9;
  overflow: visible;
}

.case-page .case-goal__index {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: var(--text-title3);
  font-weight: 700;
  line-height: 1;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
}

.case-page .case-goal__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.case-page .case-goal__title {
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.25;
}

.case-page .case-goal__lede {
  margin: 0;
  font-size: var(--text-caption1);
  line-height: 1.4;
  color: var(--text);
}

.case-page .case-impact__hint {
  font-size: var(--text-caption2);
  font-weight: 500;
  color: var(--muted);
}

.case-page .case-kpi-grid,
.case-page .case-goals-grid,
.case-page .case-shot-grid,
.case-page .case-impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.case-page .case-kpi,
.case-page .case-goal,
.case-page .case-shot,
.case-page .case-impact {
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: 0;
  background: transparent;
}

/* Minimal separation: thin dividers instead of nested cards */
.case-page .case-kpi-grid > .case-kpi,
.case-page .case-goals-grid > .case-goal,
.case-page .case-shot-grid > .case-shot,
.case-page .case-impact-grid > .case-impact {
  border-top: none;
}

@media (min-width: 681px) {
  .case-page .case-kpi-grid > .case-kpi:nth-child(-n+2),
  .case-page .case-goals-grid > .case-goal:nth-child(-n+2),
  .case-page .case-shot-grid > .case-shot:nth-child(-n+2),
  .case-page .case-impact-grid > .case-impact:nth-child(-n+2) {
    border-top: none;
  }
}

@media (max-width: 680px) {
  .case-page .case-kpi-grid > .case-kpi:first-child,
  .case-page .case-goals-grid > .case-goal:first-child,
  .case-page .case-shot-grid > .case-shot:first-child,
  .case-page .case-impact-grid > .case-impact:first-child {
    border-top: none;
  }
}

/* Snapshot KPIs: label (caption) → value (body), 8pt gap */
.case-page .case-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.case-page .case-kpi strong {
  display: block;
  margin: 0;
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.case-page .case-kpi__stack span,
.case-page .case-kpi:not(.case-kpi--illu) > span {
  display: block;
  margin: 0;
  font-size: var(--text-subhead);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}

.case-page .case-kpi__stack a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-strong) 40%, transparent);
  text-underline-offset: 0.12em;
}

.case-page .case-kpi__stack a:hover {
  text-decoration-color: var(--accent-strong);
}

.case-page .case-kpi--illu {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-2);
}

.case-page .case-kpi__illu {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.case-page .case-kpi__illu .case-illu-svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  overflow: visible;
}

/* Keep glyphs fully visible inside rounded icon tiles (stroke extends past viewBox) */
.case-page .case-impact__illu .case-illu-svg {
  overflow: visible;
}

.case-page .case-kpi__stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

.case-page .case-goal {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-2);
}

.case-page .case-goal strong {
  flex: none;
  min-width: 1.5rem;
  font-size: var(--text-title3);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.35;
}

.case-page .case-goal span {
  flex: 1;
  min-width: 0;
  font-size: var(--text-subhead);
  line-height: 1.45;
  color: var(--text);
}

.case-page .case-goal span.case-goal__title {
  color: var(--accent);
}

.case-page .case-section h2 + .case-kpi-grid,
.case-page .case-section h2 + .case-goals-grid,
.case-page .case-section h2 + .case-impact-grid {
  margin-top: var(--space-3);
}

.case-page .case-shot {
  min-height: 120px;
  display: grid;
  align-content: center;
}

.case-page .case-shot strong {
  display: block;
  margin-bottom: var(--space-1);
}

.case-page .case-impact {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.case-page .case-impact strong {
  display: block;
  margin: 0;
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.case-page .case-impact span {
  font-size: var(--text-subhead);
  line-height: 1.4;
  color: var(--text);
}

/* Impact: stacked list rows inside board (label + value, not a 2×2 tile grid) */
.case-page .case-impact-grid--compact {
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.case-page .case-impact-grid--compact .case-impact {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.case-page .case-impact-grid--compact .case-impact__illu {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  color: var(--accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.case-page .case-impact-grid--compact .case-impact__illu .case-illu-svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.case-page .case-impact-grid--compact .case-impact > strong {
  flex: 0 0 5rem;
  min-width: 4.25rem;
  margin: 0;
  padding-top: 0.2rem;
  line-height: 1.25;
}

.case-page .case-impact-grid--compact .case-impact__text {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Values use <strong> for numbers — not label styling */
.case-page .case-impact-grid--compact .case-impact__text strong {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  line-height: inherit;
}

@media (max-width: 520px) {
  .case-page .case-impact-grid--compact .case-impact {
    flex-wrap: wrap;
  }

  .case-page .case-impact-grid--compact .case-impact__text {
    flex: 1 1 100%;
  }
}

.case-page .case-final-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}

/* Single column for landscape images */
.case-page .case-final-grid--single {
  grid-template-columns: 1fr;
  max-width: 900px;
  margin-inline: auto;
}

.case-page .case-final-shot {
  margin: 0;
  width: 100%;
  min-width: 0;
  border-radius: 0;
  overflow: visible;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.case-page .case-final-shot-inner {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  line-height: 0;
  box-shadow: none;
}

.case-page .case-final-shot-inner img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  border-radius: 0;
  box-shadow: none;
}

[data-theme="dark"] .case-page .case-final-shot-inner {
  background: transparent;
  box-shadow: none;
}

.case-page .case-final-caption {
  margin: 0;
  margin-top: var(--space-3);
  padding: 0;
  width: 100%;
  text-align: center;
  font-size: var(--text-caption1);
  color: var(--muted);
  line-height: 1.35;
}

.case-page .case-section p + p {
  margin-top: var(--space-3);
}

.case-page .case-toc {
  position: sticky;
  top: calc(var(--site-header-stack) + var(--space-2));
  /* Make top/bottom padding match left/right for symmetrical spacing */
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  /* iOS glass card style - matches homepage stat cards */
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.12) 100%);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 4px 0 rgba(0, 0, 0, 0.02),
    0 8px 24px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  /* increase breathing room between TOC list and metrics */
  gap: var(--space-3);
  box-sizing: border-box;
  /* Force GPU acceleration to prevent white flash with backdrop-filter */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Prevent paint/layout thrashing */
  will-change: transform;
  isolation: isolate;
}

@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .case-page .case-toc {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  }
}

html[data-theme="dark"] .case-page .case-toc {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(255, 255, 255, 0.02) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.24);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .case-page .case-toc {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.04) 50%,
      rgba(255, 255, 255, 0.02) 100%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 -1px 0 rgba(0, 0, 0, 0.2),
      0 4px 0 rgba(0, 0, 0, 0.08),
      0 8px 24px rgba(0, 0, 0, 0.24);
  }
}

/* Desktop: hide rail, show nav directly */
@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .case-page .case-toc__rail {
    display: none;
  }
}

.case-page .case-toc__rail {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: var(--space-1);
  width: 100%;
  box-sizing: border-box;
}

/* Rail metrics hidden by default (shown via mobile media query) */
.case-page .case-toc__rail-metrics {
  display: none;
}

.case-page .case-toc__rail-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
}

/* Mobile/tablet: section title for the sticky reading chrome (hidden on wide desktop sidebar) */
.case-page .case-toc__rail-heading {
  display: none;
  margin: 0;
  padding: 0;
}

.case-page .case-read-progress {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
  margin: 0;
}

@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .case-page .case-toc__rail-top {
    display: none !important;
  }

  .case-page .case-toc__rail-metrics {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .case-page .case-toc__rail-metrics .case-read-estimate {
    max-width: none;
    text-align: start;
    display: block;
    white-space: normal;
    font-size: var(--text-footnote);
    line-height: 1.35;
  }

  .case-page .case-toc__rail-metrics .case-read-estimate__suffix {
    width: auto;
  }
}

.case-page .case-read-progress__track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 60%, transparent);
}

.case-page .case-read-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 150ms var(--ease);
  will-change: width;
  animation: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  .case-page .case-read-progress__fill {
    animation: none !important;
  }
}

.case-page .case-read-progress__sheen {
  display: none;
  animation: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  .case-page .case-read-progress__sheen {
    animation: none !important;
  }
}

@keyframes caseReadProgressShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@keyframes caseReadSheen {
  0% {
    transform: translateX(-130%);
  }

  55%,
  100% {
    transform: translateX(260%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-page .case-read-progress__fill,
  .case-page .case-read-progress__sheen {
    animation: none !important;
    transition: none !important;
  }
}

.case-page .case-read-estimate {
  margin: 0;
  font-size: var(--text-caption1);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
}

.case-page .case-read-estimate__mins {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

/* Top metrics section for desktop (progress + read time) - above TOC */
.case-page .case-toc__metrics {
  display: flex;
  /* Desktop: stack progress full-width and place estimate under it */
  flex-direction: column;
  align-items: stretch; /* make children fill container width */
  gap: var(--space-1); /* small gap between progress and estimate */
  padding-bottom: var(--space-3); /* gap below metrics to TOC list */
  /* No horizontal padding - progress bar aligns with TOC list edges */
  border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  order: -1; /* Force metrics to appear first in flex container */
}

.case-page .case-toc__metrics .case-read-progress {
  width: 100%;
  min-width: 0;
  flex: none;
  margin: 0; /* avoid extra spacing */
}

.case-page .case-toc__metrics .case-read-estimate {
  margin: 0; /* gap handled by parent */
  white-space: nowrap;
  align-self: stretch; /* fill width */
  text-align: left; /* left-align estimate text */
  font-size: var(--text-footnote);
  color: var(--muted);
}

/* Mobile/tablet: hide desktop metrics, show rail metrics */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .case-page .case-toc__metrics {
    display: none;
  }

  .case-page .case-toc__rail-metrics {
    display: flex;
    flex-direction: row;
    align-items: center; /* vertically center progress bar with text */
    gap: var(--space-2);
    width: 100%;
    box-sizing: border-box;
    padding: 0;
  }

  .case-page .case-toc__rail-metrics .case-read-progress {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    align-self: center; /* ensure progress bar centers with text */
  }

  .case-page .case-toc__rail-metrics .case-read-estimate {
    margin: 0;
    flex: 0 0 auto;
    align-self: center; /* vertically center text */
    white-space: nowrap;
    font-size: var(--text-footnote);
    color: var(--muted);
  }
}

/* Desktop: hide rail-metrics (rail is hidden so this is belt-and-suspenders) */
@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .case-page .case-toc__rail-metrics {
    display: none;
  }
}

.case-page .case-toc__trigger {
  display: none;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-2);
  margin-left: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-caption1);
  font-weight: 600;
  cursor: pointer;
  flex: 0 1 auto;
  justify-content: space-between;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.case-page .case-toc__rail > .case-toc__trigger {
  align-self: stretch;
  max-width: none;
  width: 100%;
  min-width: 0;
}

.case-page .case-toc__trigger:hover,
.case-page .case-toc__trigger:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface-strong));
}

.case-page .case-toc__trigger-current {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent);
}

.case-page .case-toc__trigger-chevron {
  flex: none;
  opacity: 0.75;
  transition: transform 200ms var(--ease);
}

.case-page .case-toc--open .case-toc__trigger-chevron {
  transform: rotate(180deg);
}

.case-page .case-toc__nav {
  display: block;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.case-page .case-toc__backdrop {
  display: none;
}

.case-page .case-toc-title {
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  margin-bottom: var(--space-2);
}

.case-page .case-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.case-page .case-toc-list a {
  display: flex;
  align-items: center;
  min-height: 0;
  padding: 10px var(--space-2);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-subhead);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.35;
  transition: background 150ms var(--ease), color 150ms var(--ease);
  box-sizing: border-box;
}

.case-page .case-toc-list a:hover,
.case-page .case-toc-list a:focus-visible {
  background: color-mix(in srgb, var(--accent-soft) 50%, transparent);
  color: var(--accent);
}

.case-page .case-toc-list a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  /*
   * Mobile case summary: reading rail height for hero offset (fixed chrome; 8pt rhythm).
   * Tune if rail layout changes.
   */
  body.case-page {
    --case-toc-mobile-rail-h: clamp(6.25rem, 20vw, 8rem);
    position: relative;
  }

  /* Hero → frosted article: one clear step (not oversized vs desktop) */
  .case-page #main > .section-space:has(#case-read-region) {
    padding-top: var(--space-4);
  }

  /* Fixed TOC rail + safe area + rhythm before hero title (not flush to chrome) */
  .case-page #main > .site-motes + .page-hero.page-hero--sub {
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--case-toc-mobile-rail-h) + var(--space-4));
    padding-bottom: var(--space-5);
  }

  .case-page #main > .site-motes + .page-hero.page-hero--sub .page-intro {
    margin-top: var(--space-3);
  }

  /* Rail lives above the hero; do not add a second full rail-height inset here (was doubling the gap) */
  .case-page .case-layout:has(#case-read-region) {
    padding-top: 0;
  }

  .case-page:has([data-case-toc]) {
    scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--case-toc-mobile-rail-h) + var(--space-3));
  }

  /* Same hide/show as bottom tab bar (html.tab-bar-hidden from main.js scroll) */
  /* z-index MUST be > .bottom-tab-bar (50): children’s z-index only stack inside the parent; 49 kept the sheet under the tab bar */
  .case-page .case-toc {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 55;
    margin: 0;
    padding-top: max(var(--space-2), env(safe-area-inset-top, 0px));
    padding-bottom: var(--space-1);
    padding-left: max(var(--shell-gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--shell-gutter), env(safe-area-inset-right, 0px));
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--line);
    background: transparent;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    gap: var(--space-1);
    justify-content: flex-start;
    align-items: flex-start;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* Keep fixed-sheet behavior stable on iOS/WebKit */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    isolation: isolate;
    /* No transform here: transform on this ancestor would break position:fixed on #case-toc-nav */
    /* CRITICAL: Remove transform so child nav can be fixed to VIEWPORT bottom */
    transform: none !important;
    -webkit-transform: none !important;
    will-change: auto;
    transition: opacity 320ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .case-page .case-toc::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }

  /* Keep TOC rail always visible on mobile/tablet (do not hide with tab-bar scroll chrome). */

  .case-page .case-toc__rail {
    gap: var(--space-1);
  }

  .case-page .case-toc__rail-heading {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(1rem, 2.4vw, 1.12rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
    margin: 0;
  }

  .case-page .case-toc__rail-metrics {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  html[data-theme="dark"] .case-page .case-toc {
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  }

  html[data-theme="dark"] .case-page .case-toc::before {
    background: rgba(28, 28, 30, 0.72);
  }

  @media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .case-page .case-toc::before {
      background: rgba(28, 28, 30, 0.72);
    }
  }

  .case-page .case-toc__trigger {
    display: flex;
  }

  .case-page .case-toc__nav {
    position: fixed;
    /* Keep a stable anchor to avoid sheet jumping while chrome hides/shows */
    bottom: 0 !important;
    left: 0;
    right: 0;
    top: auto !important;
    /* Force above all app chrome & stacking contexts on mobile/tablet */
    z-index: 9999;
    contain: paint layout;
    will-change: transform;
    max-height: none;
    height: auto;
    margin: 0;
    max-width: none;
    padding: 0;
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border: none;
    background: var(--bg-alt);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    overscroll-behavior: contain;
    transform: translate3d(0, 105%, 0);
    visibility: hidden;
    transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0ms linear 320ms;
  }

  .case-page .case-toc--open .case-toc__nav {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    transition: transform 380ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0ms linear 0ms;
  }

  /* iOS grabber handle */
  .case-page .case-toc__nav::before {
    content: "";
    display: block;
    width: 36px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 2.5px;
    background: rgba(60, 60, 67, 0.3);
  }

  html[data-theme="dark"] .case-page .case-toc__nav::before {
    background: rgba(235, 235, 245, 0.3);
  }

  /* iOS picker title */
  .case-page .case-toc__nav .case-toc-title {
    display: block;
    text-align: center;
    font-size: var(--text-headline);
    font-weight: 600;
    letter-spacing: -0.02em;
    text-transform: none;
    color: var(--text);
    padding: var(--space-2) var(--space-3);
    margin: 0;
    border-bottom: 1px solid var(--line);
  }

  /* iOS carousel picker container */
  .case-page .case-toc__nav .case-toc-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    height: 220px;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 88px 0;
    margin: 0;
    /* iOS highlight effect - gradient mask */
    mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      rgba(0,0,0,0.4) 25%,
      black 38%,
      black 62%,
      rgba(0,0,0,0.4) 75%,
      transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      rgba(0,0,0,0.4) 25%,
      black 38%,
      black 62%,
      rgba(0,0,0,0.4) 75%,
      transparent 100%
    );
  }

  /* iOS picker selection highlight */
  .case-page .case-toc__nav .case-toc-list::before {
    content: "";
    position: absolute;
    top: 50%;
    left: var(--space-2);
    right: var(--space-2);
    height: 44px;
    transform: translateY(-50%);
    background: color-mix(in srgb, var(--line) 40%, transparent);
    border-radius: var(--radius-md);
    pointer-events: none;
    z-index: 0;
  }

  .case-page .case-toc__nav .case-toc-list li {
    flex-shrink: 0;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    position: relative;
    z-index: 1;
  }

  /* HIG: iOS picker item styling */
  .case-page .case-toc__nav .case-toc-list a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 0 var(--space-3);
    margin: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: var(--text-title3);
    font-weight: 400;
    letter-spacing: -0.02em;
    text-align: center;
    text-decoration: none;
    transition: transform 150ms var(--ease), opacity 150ms var(--ease);
  }

  .case-page .case-toc__nav .case-toc-list a:hover,
  .case-page .case-toc__nav .case-toc-list a:focus-visible {
    background: transparent;
  }

  .case-page .case-toc__nav .case-toc-list a.is-active {
    font-weight: 600;
    color: var(--accent);
    background: transparent;
  }

  .case-page .case-toc__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms var(--ease);
  }

  html[data-theme="dark"] .case-page .case-toc__backdrop {
    background: rgba(0, 0, 0, 0.6);
  }

  html[data-theme="dark"] .case-page .case-toc__nav {
    background: #2c2c2e;
  }

  html[data-theme="dark"] .case-page .case-toc__nav .case-toc-list::before {
    background: rgba(99, 99, 102, 0.36);
  }

  @media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .case-page .case-toc__nav {
      background: #2c2c2e;
    }
    html:not([data-theme="light"]) .case-page .case-toc__nav .case-toc-list::before {
      background: rgba(99, 99, 102, 0.36);
    }
  }

  .case-page .case-toc--open .case-toc__backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Keep the reading rail above the dimmed backdrop when the sheet is open */
  .case-page .case-toc.case-toc--open .case-toc__rail {
    position: relative;
    z-index: 2;
  }
}

@media ((max-width: 1024px) and (prefers-reduced-motion: reduce)), ((hover: none) and (pointer: coarse) and (prefers-reduced-motion: reduce)) {
  .case-page .case-toc__nav {
    transition-duration: 0.01ms;
  }
}

@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .case-page .case-toc__rail-heading {
    display: none !important;
  }

  .case-page .case-toc__trigger {
    display: none !important;
  }

  .case-page .case-toc__backdrop {
    display: none !important;
  }

  .case-page .case-toc__nav {
    position: static;
    transform: none;
    visibility: visible;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }

  .case-page .case-toc__nav::before {
    display: none;
  }
}

html.case-toc-sheet-open,
html.case-toc-sheet-open body {
  overflow: hidden;
}

/* While TOC sheet is open, it must take priority over bottom tab bar */
html.case-toc-sheet-open .bottom-tab-bar {
  transform: translate3d(-50%, calc(100% + 2px), 0);
  opacity: 0;
  pointer-events: none;
}

/* Runtime mode lock: always bottom-sheet on mobile/tablet touch mode */
.case-page .case-toc.case-toc--mobile-mode .case-toc__nav {
  position: fixed !important;
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  transform: translate3d(0, 105%, 0);
  visibility: hidden;
}

.case-page .case-toc.case-toc--mobile-mode.case-toc--open .case-toc__nav {
  transform: translate3d(0, 0, 0);
  visibility: visible;
}

.case-page .case-toc.case-toc--desktop-mode .case-toc__nav {
  position: static;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  transform: none;
  visibility: visible;
}

@media (max-width: 680px) {
  .case-page .case-kpi-grid,
  .case-page .case-goals-grid,
  .case-page .case-shot-grid,
  .case-page .case-impact-grid,
  .case-page .case-final-grid,
  .case-page .case-toc-list {
    grid-template-columns: 1fr;
  }
}

/* Baloot summary: hero lead, platform pills (Figma-style chips), primary CTA, contribution list */
.case-page .case-lead {
  font-size: clamp(1.02rem, 1.1vw + 0.85rem, 1.2rem);
  line-height: 1.45;
  max-width: 44rem;
  /* Primary body color (not --muted): better contrast on hero wash for WCAG readability */
  color: var(--text);
}

.case-page .page-hero--sub .case-lead strong {
  color: var(--text);
  font-weight: 700;
}

.case-page .case-platform-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.case-page .case-platform-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.case-page .case-summary-hero-cta {
  margin-top: var(--space-5);
}

@media (max-width: 1024px) {
  .case-page .case-summary-hero-cta {
    margin-top: var(--space-4);
  }
}

/* Case summary boards: minimal — no outer frame; spacing + typography separate content */
.case-page .case-what-board {
  margin-top: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  gap: var(--space-3);
}

html[data-theme="dark"] .case-page .case-what-board {
  border: none;
  background: transparent;
  box-shadow: none;
}

/* Responsibility / snapshot tiles: flat, no glass cards (stat-card is global glass elsewhere) */
.case-page .case-what-board .case-what-stat-card.stat-card {
  border: none;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  padding: var(--space-1) var(--space-2);
  min-height: 0;
  transform: none;
  transition: none;
}

.case-page .case-what-board .case-what-stat-card.stat-card:hover {
  transform: none;
  box-shadow: none;
}

html[data-theme="dark"] .case-page .case-what-board .case-what-stat-card.stat-card,
html[data-theme="dark"] .case-page .case-what-board .case-what-stat-card.stat-card:hover {
  border: none;
  background: transparent;
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .case-page .case-what-board .case-what-stat-card.stat-card,
  html:not([data-theme="light"]) .case-page .case-what-board .case-what-stat-card.stat-card:hover {
    border: none;
    background: transparent;
    box-shadow: none;
  }
}

.case-page .case-what-stat-stack > .case-what-stat-card {
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

@media (min-width: 601px) {
  .case-page .case-what-stat-stack > .case-what-stat-card:nth-child(-n+2) {
    border-top: none;
  }
}

@media (max-width: 600px) {
  .case-page .case-what-stat-stack > .case-what-stat-card:first-child {
    border-top: none;
  }
}

.case-page .case-what-board .case-what-stat-stack {
  margin-top: 0;
}

.case-page .case-what-stat-body-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.case-page .case-what-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.case-page .case-what-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: var(--text-caption2);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 50%, transparent);
  border: none;
}

.case-page .case-what-chip--accent {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: none;
  font-variant-numeric: tabular-nums;
}

/* Match .case-kpi__stack span — primary line in each tile */
.case-page .case-what-stat-line {
  margin: 0;
  font-size: var(--text-subhead);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}

.case-page .case-what-stat-stack {
  margin-top: 0;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  perspective: none;
  align-items: start;
  grid-auto-rows: minmax(4.75rem, auto);
}

.case-page .case-what-stat-card {
  display: flex;
  flex-direction: column;
  min-height: 4.5rem;
  height: 100%;
  align-self: stretch;
}

.case-page .case-what-stat-card__inner {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

/* Responsibility tiles reuse .case-kpi__illu + .case-illu-svg (same as Project snapshot) */

.case-page .case-what-stat-card__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  flex: 1;
}

/* Match .case-kpi strong — same board as Project snapshot */
.case-page .case-what-stat-kicker {
  font-size: var(--text-caption1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

/* Key metric: same grid width as other cards; metric block stacks in the text column */
.case-page .case-what-stat-card--feature .case-what-stat-card__text {
  gap: var(--space-1);
}

.case-page .case-what-stat-card--feature .case-what-feature-metric-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: calc(var(--space-5) + var(--space-2));
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
  border: none;
  box-shadow: none;
}

html[data-theme="dark"] .case-page .case-what-stat-card--feature .case-what-feature-metric-block {
  background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
  border: none;
  box-shadow: none;
}

.case-page .case-what-stat-card--feature .case-what-feature-metric-block .case-what-stat-feature-metric {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.case-page .case-what-stat-card--feature .case-what-feature-metric-block .case-what-stat-feature-metric .case-what-accent {
  font-size: inherit;
  font-family: inherit;
  font-weight: 700;
  color: var(--accent-strong);
}

/* After desktop metric rule — larger hero number on narrow viewports */
@media (max-width: 640px) {
  .case-page .case-what-stat-card--feature .case-what-feature-metric-block .case-what-stat-feature-metric,
  .case-page .case-what-stat-card--feature .case-what-feature-metric-block .case-what-stat-feature-metric .case-what-accent {
    font-size: clamp(1.2rem, 5.5vw, 1.65rem);
    font-family: var(--font-display);
    letter-spacing: -0.03em;
  }
}

.case-page .case-what-stat-card--feature .case-what-stat-feature-desc {
  margin: 0;
  font-size: var(--text-subhead);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
  max-width: none;
}

.case-page .case-what-stat-card .case-what-stat-body {
  display: block;
  font-size: var(--text-subhead);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Beat global .stat-card strong (hero-sized blue numbers) — metrics stay caption-sized */
.case-page .case-what-stat-card strong.case-what-accent {
  color: var(--accent-strong);
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: var(--text-caption1);
  line-height: inherit;
  letter-spacing: normal;
}

@media (max-width: 680px) {
  .case-page .case-what-board {
    padding: 0;
  }
}

/* Two columns until narrow phones; keeps “two per row” on more viewports */
@media (max-width: 600px) {
  .case-page .case-what-stat-stack {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(4.25rem, auto);
  }

  .case-page .case-what-stat-card {
    min-height: 4.25rem;
  }
}

.case-page .case-what-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.case-page .case-what-list li {
  position: relative;
  padding-left: 1.25rem;
  line-height: 1.45;
}

.case-page .case-what-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.case-page .case-summary-cta-end {
  padding-top: var(--space-6);
  padding-bottom: var(--space-7);
}

.case-page .case-summary-cta-end .button-row {
  justify-content: center;
  margin-top: 0;
}

/* Baloot full case: PDF in a framed card; page scrolls for chrome + footer. Native PDF viewers
   keep scroll inside the iframe; browsers do not bubble wheel events to the parent, so a
   viewport-height embed is used instead of an extremely tall iframe. */
.page--baloot-pdf #main {
  /* HIG: clear fixed header + breathing room (8pt rhythm) */
  padding-top: calc(var(--site-header-stack) + var(--space-4));
  padding-bottom: var(--space-8);
}

.baloot-pdf-shell {
  width: 100%;
}

.baloot-pdf-toolbar {
  padding: var(--space-6) 0 var(--space-4);
  border-bottom: 1px solid var(--line);
}

.baloot-pdf-toolbar .button {
  min-height: var(--control-height);
  padding-inline: var(--button-padding-x);
}

.baloot-pdf-intro-wrap {
  padding: var(--space-5) 0 var(--space-4);
}

.page--baloot-pdf .baloot-pdf-what.case-section {
  margin: 0;
}

.baloot-pdf-frame-outer {
  padding: 0 0 var(--space-8);
}

.baloot-pdf-frame {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
  box-shadow: var(--shadow-sm);
  padding: var(--space-3);
  overflow: hidden;
}

.baloot-pdf-iframe {
  display: block;
  width: 100%;
  border: 0;
  background: var(--bg-alt);
  /* One main viewport for the PDF; scroll inside the viewer, then scroll the page for footer. */
  min-height: min(560px, 76vh);
  height: clamp(560px, calc(100dvh - var(--site-header-stack) - 14rem), 980px);
}

@media (max-width: 1024px) {
  .page--baloot-pdf #main {
    padding-top: calc(var(--hero-inset-compact) + var(--space-2));
    padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  }

  .baloot-pdf-toolbar {
    padding: var(--space-5) 0 var(--space-4);
  }

  .baloot-pdf-toolbar .button {
    width: 100%;
    justify-content: center;
  }

  .baloot-pdf-intro-wrap {
    padding: var(--space-4) 0 var(--space-3);
  }

  .baloot-pdf-frame-outer {
    padding: 0 0 var(--space-8);
  }

  .baloot-pdf-frame {
    padding: var(--space-2);
  }

  .baloot-pdf-iframe {
    min-height: min(520px, 70vh);
    height: clamp(520px, calc(100dvh - var(--site-header-stack) - 12rem), 900px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .baloot-pdf-iframe {
    min-height: min(520px, 72vh);
    height: clamp(520px, calc(100dvh - var(--site-header-stack) - 14rem), 940px);
  }
}

/* 
   HIG Article Enhancements: Typography & Spacing
 */   

/* Better paragraph spacing for readability */
.case-page .case-section p,
.case-page .case-what-board__prose p {
  font-size: clamp(1rem, 1.5vw, 1.0625rem);
  line-height: 1.65;
  letter-spacing: -0.011em;
  max-width: 65ch;
}

.case-page .case-section p + p,
.case-page .case-what-board__prose p + p {
  margin-top: 1.25rem;
}

/* Clean lists */
.case-page .case-what-list li {
  font-size: clamp(1rem, 1.5vw, 1.0625rem);
  line-height: 1.6;
  letter-spacing: -0.011em;
}

/* Cleaner KPI grid spacing */
.case-page .case-kpi-grid,
.case-page .case-goals-grid,
.case-page .case-impact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

/* Remove decorative spot illustrations - keep it minimal */
.case-page .case-board-spot {
  display: none;
}

/* Final screens grid - cleaner */
.case-page .case-final-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.case-page .case-final-shot {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

html[data-theme="dark"] .case-page .case-final-shot {
  border: none;
  background: transparent;
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .case-page .case-final-shot {
    border: none;
    background: transparent;
    box-shadow: none;
  }
}

/* Mobile: full width content, better spacing */
@media (max-width: 768px) {
  .case-page .case-main {
    gap: clamp(2rem, 8vw, 3rem);
  }
  
  .case-page .case-section,
  .case-page .case-section--board-only {
    padding-bottom: var(--space-4);
  }
  
  .case-page .case-kpi-grid,
  .case-page .case-goals-grid,
  .case-page .case-impact-grid,
  .case-page .case-final-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}


/* Shams final shots: consistent rounded corners/background */
.case-page.case-page--shams #final-screens .case-final-shot-inner {
  border-radius: 16px;
  overflow: hidden;
  background: #f6f7fb;
  box-shadow: none;
}

.case-page.case-page--shams #final-screens .case-final-shot-inner img {
  border-radius: 16px;
  box-shadow: none;
}


/* Shams AR demo: landscape player + consistent styling */
.case-page.case-page--shams .case-ar-demo {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
}

.case-page.case-page--shams .case-ar-demo__media {
  position: relative;
  width: 100%;
  aspect-ratio: 550 / 260;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.case-page.case-page--shams .case-ar-demo__media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

.case-page.case-page--shams .case-ar-demo__media video::-webkit-media-controls-panel {
  border-radius: 0 0 20px 20px;
}
/* === CUSTOM: Align end CTAs and unify icon button styles === */
/* Align buttons at the end of case pages to the left (same as hero) */
.section-space .case-summary-cta-end .button-row,
.case-cta-case .button-row,
.case-wrap .button-row.case-summary-hero-cta,
.section-space .case-summary-cta-end .button-row.reveal,
.case-cta-case .button-row.reveal {
  justify-content: flex-start !important;
}

/* Ensure buttons show icons consistently and center icons vertically */
.case-summary-cta-end .button-row .button,
.case-cta-case .button-row .button,
.page-intro .button-row .button,
.case-wrap .button-row .button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px;
}

/* Make sure SVG icons inside buttons have consistent spacing */
.case-summary-cta-end .button-row .button svg,
.case-cta-case .button-row .button svg,
.page-intro .button-row .button svg,
.button svg {
  margin-right: 6px;
  vertical-align: -2px;
}

/* Small spacing between buttons */
.case-summary-cta-end .button-row .button,
.case-cta-case .button-row .button {
  margin-right: 12px;
}

/* Responsive: stack on very small screens */
@media (max-width: 480px) {
  .case-summary-cta-end .button-row,
  .case-cta-case .button-row {
    flex-direction: column;
    align-items: stretch;
  }
  .case-summary-cta-end .button-row .button,
  .case-cta-case .button-row .button {
    width: 100%;
    margin-right: 0;
  }
}
/* === FORCE: Left-align end-of-case CTA rows to match hero buttons === */
body .case-summary-cta-end .button-row,
body .section-space.case-summary-cta-end .button-row,
body .case-cta-case .button-row,
body .case-wrap .case-summary-cta-end .button-row {
  justify-content: flex-start !important;
  align-items: center !important;
}

/* Mobile: keep stacked but left-aligned */
@media (max-width: 640px) {
  body .case-summary-cta-end .button-row,
  body .case-cta-case .button-row {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  body .case-summary-cta-end .button-row .button {
    width: 100%;
  }
}
/* === TWEAK: Make recent work cards taller so cover images are fully visible === */
.experience-grid.experience-grid--case .experience-card .card-cover {
  aspect-ratio: 16/9;
  min-height: 18rem; /* ensures card cover is visually taller on desktop */
  overflow: hidden;
}

/* Show the full cover image before hover, then keep the subtle zoom on hover */
.experience-grid.experience-grid--case .experience-card .card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill container without gaps */
  object-position: center;
  transition: transform 420ms cubic-bezier(.2,.9,.2,1);
}

/* Preserve zoom on hover but keep image centered */
.experience-card.case-card:hover .card-cover img,
.experience-card.case-card:focus-within .card-cover img {
  transform: scale(1.06);
}

@media (max-width: 780px) {
  .experience-grid.experience-grid--case .experience-card .card-cover {
    min-height: 14rem;
  }
}

/* === Next Project Card === */
.next-project-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-tinted);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  max-width: 800px;
}

.next-project-card:hover {
  background: var(--surface-overlay);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.next-project-card__media {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--surface);
}

.next-project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.next-project-card:hover .next-project-card__media img {
  transform: scale(1.03);
}

.next-project-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-2) 0;
}

@media (max-width: 780px) {
  .next-project-card {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-3);
  }
  
  .next-project-card__media {
    aspect-ratio: 16 / 9;
  }
  
  .next-project-card__content {
    padding: 0;
  }
}

@media (max-width: 640px) {
  .next-project-card {
    padding: var(--space-3);
  }
}

/* === Figma Prototype Embed Section === */
.case-prototype-embed {
  width: 100%;
  margin: var(--space-5) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-tinted);
  box-shadow: var(--shadow-soft);
}

.case-prototype-embed iframe {
  display: block;
  width: 100%;
  min-height: 500px;
  border: none;
  border-radius: var(--radius-lg);
}

@media (max-width: 780px) {
  .case-prototype-embed iframe {
    min-height: 350px;
  }
}

/* ===== GALLERY CAROUSEL ===== */
/* Flat on case pages: no outer glass panel; thumbs + viewport + caption use spacing tokens only */
.gallery-carousel {
  position: relative;
  width: 100%;
  margin: var(--space-4) 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
}

.gallery-carousel__layout {
  display: block;
  width: 100%;
  padding: 0;
}

/* Stage → thumbnail strip → caption (standard gallery stack) */
.gallery-carousel__viewport {
  position: relative;
  width: 100%;
  overflow: visible;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  /* Compact rhythm (matches tablet feel on large screens) */
  gap: var(--space-1);
  align-items: stretch;
}

/* Portrait: 24px between main image (stage) and the strip + caption below */
.gallery-carousel--portrait .gallery-carousel__viewport {
  gap: 0;
}

.gallery-carousel--portrait .gallery-carousel__thumbs {
  margin-top: var(--space-3);
}

.gallery-carousel--portrait .gallery-carousel__caption-row {
  margin-top: var(--space-1);
}

/* Image area only — arrows + counter anchor here */
.gallery-carousel__stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: transparent;
  flex: 0 0 auto;
}

.gallery-carousel__track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-carousel__slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-2) var(--space-1) var(--space-2);
  min-height: 0;
  height: clamp(320px, 48vw, 520px);
  max-height: 560px;
  box-sizing: border-box;
}

/* Landscape: shorter stage + zero bottom padding → less letterboxing under wide screenshots */
.gallery-carousel--landscape .gallery-carousel__slide {
  padding: var(--space-1) var(--space-2) 0 var(--space-2);
  height: clamp(260px, 38vw, 420px);
  max-height: 440px;
}

/* Landscape carousel - show full image */
.gallery-carousel--landscape .gallery-carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  border-radius: var(--radius-md);
  display: block;
}

/* Portrait carousel - show full image */
.gallery-carousel--portrait .gallery-carousel__slide img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
  margin: 0 auto;
}

/* Prev / next / zoom: identical frosted glass chrome (UA button styles reset) */
.gallery-carousel__nav,
.gallery-carousel__zoom {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  font: inherit;
  line-height: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  min-height: 44px;
  max-height: 44px;
  box-sizing: border-box;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px) saturate(1.8);
  -webkit-backdrop-filter: blur(12px) saturate(1.8);
  color: #fff;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  opacity: 0.9;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.gallery-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.gallery-carousel__nav:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: translateY(-50%) scale(1.05);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  opacity: 1;
}

.gallery-carousel__nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gallery-carousel__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gallery-carousel__nav--prev {
  left: var(--space-2);
}

.gallery-carousel__nav--next {
  right: var(--space-2);
}

.gallery-carousel__nav svg,
.gallery-carousel__zoom svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

/* Horizontal thumbnail strip below main image (mobile + desktop) */
.gallery-carousel__thumbs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.gallery-carousel__thumbs::-webkit-scrollbar {
  height: 4px;
}

.gallery-carousel__thumbs::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 999px;
}

.gallery-carousel__thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 32px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 0.2s ease, border-color 0.2s ease;
  scroll-snap-align: start;
  background: color-mix(in srgb, var(--line) 35%, transparent);
}

.gallery-carousel__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-carousel__thumb:hover {
  opacity: 0.85;
}

.gallery-carousel__thumb.is-active {
  border-color: var(--accent);
  opacity: 1;
}

.gallery-carousel__thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Portrait source: taller strip cells */
.gallery-carousel--portrait .gallery-carousel__thumb {
  width: 30px;
  height: 42px;
}

/* Caption + slide index: one row, same metrics so text aligns */
.gallery-carousel__caption-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-3);
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: var(--space-1) 0 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  box-sizing: border-box;
}

.gallery-carousel__caption {
  position: static;
  min-width: 0;
  text-align: start;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Match caption line metrics so label and index share one visual line */
.gallery-carousel__counter {
  position: static;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  align-self: center;
}

/* Fullscreen: top-right — pixel-matched to .gallery-carousel__nav hover/focus */
.gallery-carousel__zoom {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 10;
  transform: none;
}

.gallery-carousel__zoom:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.05);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  opacity: 1;
}

.gallery-carousel__zoom:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 780px) {
  .gallery-carousel__viewport {
    gap: var(--space-1);
  }

  .gallery-carousel__slide {
    height: min(56vh, 380px);
    min-height: 260px;
    padding: var(--space-2) var(--space-1) var(--space-1) var(--space-1);
    box-sizing: border-box;
  }

  .gallery-carousel__thumb {
    width: 38px;
    height: 28px;
  }

  .gallery-carousel--portrait .gallery-carousel__thumb {
    width: 26px;
    height: 36px;
  }
  
  .gallery-carousel__nav,
  .gallery-carousel__zoom {
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    min-height: 36px;
    max-height: 36px;
  }

  .gallery-carousel__nav svg,
  .gallery-carousel__zoom svg {
    width: 16px;
    height: 16px;
  }

  .gallery-carousel__caption-row {
    column-gap: var(--space-2);
    padding-top: var(--space-1);
  }

  .gallery-carousel__caption,
  .gallery-carousel__counter {
    font-size: 0.75rem;
    line-height: 1.35;
  }
}

/* ===== LIGHTBOX ===== */
.lightbox-trigger {
  cursor: zoom-in;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.lightbox-overlay.is-active img {
  transform: scale(1);
}

/* Zoomed state */
.lightbox-overlay img.is-zoomed {
  max-width: none;
  max-height: none;
  cursor: grab;
}

.lightbox-overlay img.is-zoomed.is-dragging {
  cursor: grabbing;
}

/* Top controls bar */
.lightbox-controls {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  gap: var(--space-2);
  z-index: 10;
}

.lightbox-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-btn svg {
  width: 22px;
  height: 22px;
}

/* Navigation arrows in lightbox */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.05);
}

.lightbox-nav--prev {
  left: var(--space-4);
}

.lightbox-nav--next {
  right: var(--space-4);
}

.lightbox-nav svg {
  width: 26px;
  height: 26px;
}

/* Bottom info bar */
.lightbox-bottom {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.lightbox-caption {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  text-align: center;
  max-width: 80vw;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox-overlay:hover .lightbox-caption,
.lightbox-overlay:focus-within .lightbox-caption,
.lightbox-overlay.is-caption-visible .lightbox-caption {
  opacity: 1;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* Zoom level indicator */
.lightbox-zoom-level {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox-overlay.is-zooming .lightbox-zoom-level {
  opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .lightbox-nav {
    width: 44px;
    height: 44px;
  }
  
  .lightbox-nav--prev {
    left: var(--space-2);
  }
  
  .lightbox-nav--next {
    right: var(--space-2);
  }
  
  .lightbox-controls {
    top: var(--space-2);
    right: var(--space-2);
  }
}

/* ===== COMING SOON BADGE ===== */
.coming-soon-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  color: var(--text);
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  animation: comingSoonPulse 2.2s ease-in-out infinite;
  z-index: 2;
}

@keyframes comingSoonPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
  }
}

html[data-theme="dark"] .coming-soon-badge {
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.26);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .coming-soon-badge {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
    color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  }
}

/* Location badge styling */
.card-badge--location {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 600;
  padding: 0.35em 0.75em;
}

html[data-theme="dark"] .card-badge--location {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .card-badge--location {
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  }
}

/* ===== PROJECTS FILTER & SORT (glass chips, HIG) ===== */
.projects-controls {
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.projects-controls__row--top {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-3);
}

/* Shared frosted glass — capsule radius (HIG / site controls) */
.projects-glass {
  background: color-mix(in srgb, var(--surface-strong) 68%, transparent);
  backdrop-filter: blur(22px) saturate(1.22);
  -webkit-backdrop-filter: blur(22px) saturate(1.22);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: var(--radius-pill);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 20px rgba(15, 23, 42, 0.06);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

html[data-theme="dark"] .projects-glass {
  background: color-mix(in srgb, var(--surface-strong) 52%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 28px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .projects-glass {
    background: color-mix(in srgb, var(--surface-strong) 52%, transparent);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

.projects-search {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  flex: 1;
  min-width: min(420px, 100%);
  color: var(--text-secondary);
}

.projects-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.projects-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.8;
}

.projects-search input {
  border: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  min-width: 0;
  font-size: 0.9375rem;
  outline: none;
}

.projects-search input::placeholder {
  color: var(--text-tertiary);
}

.projects-controls__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.projects-sort {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.65rem 0 0.85rem;
}

.projects-sort:focus-within {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.sort-select-compact {
  min-height: 44px;
  padding: 0.35rem 1.85rem 0.35rem 0.15rem;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.2rem center;
}

html[data-theme="dark"] .sort-select-compact {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Categories: one row; scroll horizontally when it does not fit */
.projects-domain-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  padding: 6px 0 6px;
  margin: 0;
  padding-left: var(--space-1);
  padding-right: var(--space-1);
  text-align: center;
  vertical-align: middle;
}

@media (prefers-reduced-motion: no-preference) {
  .projects-domain-scroll {
    scroll-behavior: smooth;
  }
}

.projects-domain-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  min-height: 44px;
  width: max-content;
  max-width: none;
  padding-bottom: 0;
}

.projects-chip {
  flex: 0 0 auto;
  min-height: 36px;
  min-width: 44px;
  padding: 0.4rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  transition: background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.projects-chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--line-strong) 85%, transparent);
}

.projects-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.projects-chip--active,
.projects-chip[aria-pressed="true"] {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .projects-chip--active,
html[data-theme="dark"] .projects-chip[aria-pressed="true"] {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .projects-controls {
    gap: var(--space-2);
  }

  .projects-controls__row--top {
    flex-direction: column;
    align-items: stretch;
  }

  .projects-search {
    min-width: 100%;
  }

  .projects-controls__actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .projects-sort {
    flex: 1;
    min-width: 0;
  }

  .sort-select-compact {
    width: 100%;
    min-width: 0;
  }

  .projects-facets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facet--sort {
    display: none;
  }

  .sort-select {
    width: 100%;
  }
}


/* ===== GLOBAL SEARCH ===== */
.search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.search-toggle svg {
  width: 18px;
  height: 18px;
}

.site-header .search-toggle {
  border-color: transparent;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.site-header .search-toggle:hover,
.site-header .search-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: transparent;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.search-modal.is-active {
  display: flex;
}

.search-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-modal__content {
  position: relative;
  width: 90%;
  max-width: 640px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: var(--radius-xl);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24), 0 8px 24px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
}

.search-modal__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--surface-strong) 85%, transparent);
}

.search-modal__header::before {
  content: '';
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
  opacity: 0.6;
  flex-shrink: 0;
}

.search-modal__input {
  flex: 1;
  padding: var(--space-2) 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 500;
  outline: none;
}

.search-modal__input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.search-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-modal__close svg {
  width: 16px;
  height: 16px;
}

.search-modal__close:hover {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--text);
}

.search-modal__results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-3);
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.search-result:hover {
  background: var(--surface);
  border-color: var(--border);
}

.search-result__title {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}

.search-result__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result__category {
  display: inline-flex;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-vivid));
  color: white;
  font-size: 0.7rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

.search-empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-secondary);
}

.search-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-3);
  opacity: 0.3;
}

.search-hint {
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.search-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  background: var(--surface-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: inherit;
  margin: 0 0.25rem;
}

@media (max-width: 640px) {
  .search-modal {
    padding-top: 8vh;
  }
  
  .search-modal__content {
    width: 95%;
    border-radius: var(--radius-lg);
  }
  
  .search-modal__input {
    font-size: 1rem;
  }
}


/* Compact continue exploring */
.continue-exploring-mini__title { margin: 0 0 var(--space-3); font-size: 1.05rem; }
.continue-exploring-mini__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.continue-exploring-mini__card { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; color: var(--text); background: var(--surface); }
.continue-exploring-mini__card img { width: 56px; height: 36px; object-fit: cover; border-radius: var(--radius-sm); }
@media (max-width: 780px) { .continue-exploring-mini__grid { grid-template-columns: 1fr; } }
