/* =========================================================================
   PORTFOLIO V2 — SHARED DESIGN SYSTEM
   Extends the v1 brand (Archivo + Space Grotesk, paper, ink, burnt sienna)
   ========================================================================= */

:root {
  /* Color */
  --ink:        #0E0E0E;
  --ink-soft:   #2A2A2A;
  --ink-mute:   #6B6B6B;
  --ink-faint:  #B8B5AE;
  --paper:      #FAF8F4;
  --paper-soft: #F2EFE9;
  --paper-warm: #EDE8DD;
  --line:       #E4DFD2;
  --line-soft:  #EFEAE0;
  --accent:     #C9501F;
  --accent-deep:#A33E14;
  --accent-soft:#F1D9CC;
  --accent-tint:#FBEFE7;
  --signal-live:#3D8B5E;

  /* Type */
  --display: 'Archivo', system-ui, sans-serif;
  --body:    'Space Grotesk', system-ui, sans-serif;
  --mono:    'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Type scale */
  --t-xs:       12px;
  --t-sm:       13.5px;
  --t-base:     16px;
  --t-md:       18px;
  --t-lg:       22px;
  --t-xl:       clamp(28px, 3vw, 36px);
  --t-2xl:      clamp(40px, 5vw, 64px);
  --t-3xl:      clamp(56px, 8vw, 96px);
  --t-display:  clamp(72px, 11vw, 144px);

  /* Layout */
  --read-w:     640px;
  --media-w:    1080px;
  --full-w:     1400px;
  --gutter:     clamp(20px, 4vw, 40px);

  /* Motion */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast:     180ms;
  --t-medium:   240ms;
  --t-slow:     480ms;
  --t-slower:   720ms;
}

/* =========================================================================
   RESET + BASE
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--paper);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }

/* WCAG 2.4.7 — Focus visible for all interactive elements */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); color: var(--ink); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
p { margin: 0; }
em { font-style: italic; }
::selection { background: var(--accent); color: var(--paper); }

/* =========================================================================
   SCROLL PROGRESS + TOP BAR
   ========================================================================= */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: transparent; z-index: 100; pointer-events: none;
}
.progress-bar {
  height: 100%; width: 0%;
  background: var(--accent);
  transition: width 60ms linear;
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 24px var(--gutter);
  background: rgba(250, 248, 244, 0);
  transition: background var(--t-medium) var(--ease-out), border-color var(--t-medium) var(--ease-out), backdrop-filter var(--t-medium) var(--ease-out), padding var(--t-medium) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.topbar-side { display: flex; align-items: center; }
.topbar-side-right { justify-content: flex-end; }
.topbar.scrolled {
  background: var(--paper);
  border-bottom-color: var(--line);
  padding-top: 14px;
  padding-bottom: 14px;
}
.topbar-name {
  justify-self: center;
  display: inline-flex; align-items: center;
  color: var(--ink);
  text-decoration: none;
  transition: transform var(--t-medium) var(--ease-out);
  transform-origin: center;
}
.topbar-name .sig {
  height: 64px;
  width: auto;
  display: block;
  transition: height var(--t-medium) var(--ease-out);
}
@media (min-width: 700px) { .topbar-name .sig { height: 84px; } }
.topbar.scrolled .topbar-name .sig { height: 38px; }
@media (min-width: 700px) {
  .topbar.scrolled .topbar-name .sig { height: 44px; }
}

/* Burger button */
.topbar-burger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-medium) var(--ease-out), width var(--t-medium) var(--ease-out), height var(--t-medium) var(--ease-out);
}
@media (min-width: 700px) { .topbar-burger { width: 46px; height: 46px; } }
.topbar-burger:hover { background: var(--paper-soft); transform: scale(1.05); }
.topbar-burger:active { transform: scale(0.96); }
.topbar-burger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.topbar-burger svg {
  width: 32px; height: 32px;
  display: block;
  transition: transform var(--t-medium) var(--ease-out), width var(--t-medium) var(--ease-out), height var(--t-medium) var(--ease-out);
}
@media (min-width: 700px) { .topbar-burger svg { width: 38px; height: 38px; } }
.topbar-burger:hover svg { transform: none; }
.topbar.scrolled .topbar-burger { width: 32px; height: 32px; }
.topbar.scrolled .topbar-burger svg { width: 26px; height: 26px; }

/* Burger lines — asymmetric ink lines that "stand to attention" on hover */
.burger-line {
  stroke: #0E0E0E;
  stroke-width: 2.5;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: 0% 50%;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.burger-line-1 { transform: scaleX(1); }
.burger-line-2 { transform: scaleX(0.55); }
.burger-line-3 { transform: scaleX(0.78); }
.topbar-burger:hover .burger-line { transform: scaleX(1); }
.topbar-burger:hover .burger-line-2 { transition-delay: 60ms; }
.topbar-burger:hover .burger-line-3 { transition-delay: 120ms; }
@keyframes burger-draw {
  from { transform: scaleX(0); }
}
.burger-line {
  animation: burger-draw 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.burger-line-1 { animation-delay: 0.5s; }
.burger-line-2 { animation-delay: 0.62s; }
.burger-line-3 { animation-delay: 0.74s; }
.topbar-burger:active .burger-line {
  transition: transform 0.18s var(--ease-out);
  transform: scaleX(0.4);
}

/* =========================================================================
   NAV OVERLAY (the moment)
   ========================================================================= */
.nav-overlay {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--paper);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-out), visibility 0s linear 0.5s;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.55s var(--ease-out), visibility 0s linear 0s;
}
.nav-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--paper-warm) 0%, var(--paper) 60%),
    var(--paper);
  pointer-events: none;
}
.nav-overlay-inner {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) clamp(24px, 5vw, 80px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 5vh, 56px);
}
.nav-overlay-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.nav-overlay-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
  border-radius: 100px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-mute);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.6s 0.1s var(--ease-out), transform 0.6s 0.1s var(--ease-out);
}
.nav-overlay-status .live-chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 80, 31, 0.18);
}
.nav-overlay.is-open .nav-overlay-status { opacity: 1; transform: translateY(0); }
.nav-overlay-close {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  font: inherit;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-medium) var(--ease-out);
  opacity: 0;
  transform: translateY(-12px) rotate(-90deg);
}
.nav-overlay.is-open .nav-overlay-close {
  opacity: 1;
  transform: translateY(0) rotate(0);
  transition: opacity 0.5s 0.1s var(--ease-out), transform 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1), background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.nav-overlay-close:hover { background: var(--paper-soft); border-color: var(--accent); transform: rotate(90deg) scale(1.05); }
.nav-overlay-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.nav-overlay-close svg { width: 28px; height: 28px; display: block; }

.nav-overlay-links {
  display: flex; flex-direction: column; gap: 0;
  flex: 1; justify-content: center;
  padding: 24px 0;
}
.nav-overlay-link {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding: clamp(18px, 3vh, 28px) 0;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s var(--ease-out), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), color var(--t-medium) var(--ease-out);
}
.nav-overlay-link:first-child { border-top: 1px solid var(--line-soft); }
.nav-overlay.is-open .nav-overlay-link { opacity: 1; transform: translateY(0); }
.nav-overlay.is-open .nav-overlay-link:nth-child(1) { transition-delay: 0.18s; }
.nav-overlay.is-open .nav-overlay-link:nth-child(2) { transition-delay: 0.24s; }
.nav-overlay.is-open .nav-overlay-link:nth-child(3) { transition-delay: 0.30s; }
.nav-overlay.is-open .nav-overlay-link:nth-child(4) { transition-delay: 0.36s; }
.nav-overlay-link .num {
  font-family: var(--mono); font-size: 13px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-mute);
  transition: color var(--t-medium) var(--ease-out), transform var(--t-medium) var(--ease-out);
}
.nav-overlay-link .label {
  font-family: var(--display);
  font-size: clamp(40px, 9vw, 96px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  transition: transform var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1), color var(--t-medium) var(--ease-out);
}
.nav-overlay-link .meta {
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  align-self: center;
  display: none;
}
@media (min-width: 760px) { .nav-overlay-link .meta { display: inline-block; } }
.nav-overlay-link:hover .num { color: var(--accent); transform: translateX(-6px); }
.nav-overlay-link:hover .label { color: var(--accent); transform: translateX(12px); }
.nav-overlay-link:hover .meta { color: var(--ink); }

.nav-overlay-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-overlay.is-open .nav-overlay-secondary {
  opacity: 1; transform: translateY(0);
  transition-delay: 0.5s;
}
.nav-overlay-secondary a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 4px;
  text-decoration-color: var(--ink-faint);
  transition: color var(--t-fast) var(--ease-out), text-decoration-color var(--t-fast) var(--ease-out);
}
.nav-overlay-secondary a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.nav-overlay-secondary .dot { color: var(--ink-faint); }

body.nav-open { overflow: hidden; }

/* =========================================================================
   LAYOUT WRAPPERS
   ========================================================================= */
.wrap       { max-width: var(--full-w);  margin: 0 auto; padding: 0 var(--gutter); }
.wrap-media { max-width: var(--media-w); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-read  { max-width: var(--read-w);  margin: 0 auto; padding: 0 var(--gutter); }
section     { padding: clamp(60px, 10vh, 120px) 0; }

/* =========================================================================
   SECTION HEADER
   ========================================================================= */
.sec-head { margin-bottom: 48px; }
.sec-eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 16px;
}
.sec-eyebrow .num { font-family: var(--mono); color: var(--accent); font-weight: 500; }
.sec-eyebrow .line { flex: 0 0 32px; height: 1px; background: var(--ink-faint); }
.sec-title {
  font-family: var(--display);
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
  max-width: 760px;
}
.sec-title em { color: var(--accent); font-style: italic; }

/* =========================================================================
   PROSE
   ========================================================================= */
.prose {
  font-family: var(--body);
  font-size: var(--t-md);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: var(--read-w);
}
.prose p + p { margin-top: 1em; }
.prose em { font-style: italic; color: var(--ink); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose a {
  color: var(--ink);
  border-bottom: 1px solid var(--ink-faint);
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.prose a:hover { color: var(--accent); border-color: var(--accent); }

.pull {
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 24px;
  margin: 32px 0;
  max-width: 38ch;
}
.pull em { color: var(--accent); font-style: italic; }

/* =========================================================================
   FIGURE / MEDIA
   ========================================================================= */
.figure { margin: 32px 0 48px; }
.figure.full-bleed { max-width: var(--full-w); margin-left: calc(50% - 50vw + var(--gutter)); margin-right: calc(50% - 50vw + var(--gutter)); }
.figure.wide { max-width: var(--media-w); }
.figure.narrow { max-width: var(--read-w); }

.figure-image {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background-size: cover;
  background-position: top center;
  box-shadow: 0 18px 48px -28px rgba(14,14,14,0.18);
  transition: transform var(--t-slow) var(--ease-out), box-shadow var(--t-slow) var(--ease-out);
}
.figure a:hover .figure-image { transform: translateY(-3px); box-shadow: 0 28px 64px -28px rgba(14,14,14,0.28); }

.figure-portrait .stage {
  background: var(--paper-warm);
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: clamp(28px, 4vw, 48px);
  display: flex; justify-content: center; align-items: center;
  box-shadow: 0 18px 40px -28px rgba(14,14,14,0.18);
  background-image: radial-gradient(circle, rgba(23,23,23,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}
.figure-portrait img { max-height: 540px; width: auto; border-radius: 12px; }

.figure-caption {
  margin-top: 14px;
  font-family: var(--body); font-size: 13px; color: var(--ink-mute);
  letter-spacing: 0.01em; line-height: 1.5;
  max-width: 60ch;
}

/* =========================================================================
   CASE HERO
   ========================================================================= */
.case-hero {
  padding: clamp(120px, 18vh, 180px) 0 clamp(40px, 6vh, 80px);
}
.case-eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 28px;
}
.case-eyebrow .live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(61, 139, 94, 0.1);
  border: 1px solid rgba(61, 139, 94, 0.25);
  border-radius: 999px;
  color: var(--signal-live);
  font-size: 10.5px;
  letter-spacing: 0.12em;
}
.case-eyebrow .live-chip-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--signal-live);
}
.case-title {
  font-family: var(--display);
  font-size: var(--t-3xl);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 32px;
  max-width: 16ch;
}
.case-title em { color: var(--accent); font-style: italic; }
.case-lede {
  max-width: 60ch;
  font-family: var(--body);
  font-size: var(--t-md);
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 40px;
}
.case-meta {
  display: grid; gap: 24px;
  grid-template-columns: repeat(2, 1fr);
  margin: 40px 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 760px) { .case-meta { grid-template-columns: repeat(4, 1fr); } }
.case-meta dt {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 8px;
}
.case-meta dd {
  margin: 0;
  font-family: var(--body); font-size: var(--t-sm); font-weight: 500;
  color: var(--ink);
}
.case-meta dd a {
  color: var(--accent); border-bottom: 1px solid var(--accent-soft);
  transition: border-color var(--t-fast) var(--ease-out);
}
.case-meta dd a:hover { border-color: var(--accent); }

/* =========================================================================
   LIVE PREVIEW FRAME
   ========================================================================= */
.live-frame {
  margin: 32px 0 48px;
  max-width: var(--media-w);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow:
    0 32px 80px -40px rgba(14,14,14,0.28),
    0 8px 24px -16px rgba(14,14,14,0.12);
  position: relative;
}

.live-frame.full-bleed {
  max-width: var(--full-w);
}

.live-frame-chrome {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--paper-soft);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
}

.live-frame-traffic {
  display: flex; gap: 6px;
  flex: 0 0 auto;
}
.live-frame-traffic span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--paper-warm);
  border: 1px solid var(--line);
}
.live-frame-traffic span:nth-child(1) { background: #E8C5BA; border-color: #C9A89E; }
.live-frame-traffic span:nth-child(2) { background: #E8DBB8; border-color: #C9BC9A; }
.live-frame-traffic span:nth-child(3) { background: #C9DDC2; border-color: #ABBFA4; }

.live-frame-url {
  flex: 1 1 auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 0;
  padding: 6px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  letter-spacing: 0.01em;
  overflow: hidden;
}
.live-frame-url-secure {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--signal-live);
}
.live-frame-url-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-soft);
  font-size: 12px;
}

.live-frame-action {
  flex: 0 0 auto;
  padding: 5px 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10.5px; font-weight: 500;
  color: var(--ink-mute);
  transition: all var(--t-fast) var(--ease-out);
}
.live-frame-action:hover {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

.live-frame-body {
  position: relative;
  background: var(--paper-warm);
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.live-frame-body iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
  background: var(--paper);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.live-frame-body iframe.loaded { opacity: 1; }

/* Skeleton shimmer behind iframe while loading */
.live-frame-body::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg,
    var(--paper-warm) 8%,
    var(--paper-soft) 18%,
    var(--paper-warm) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  z-index: 0;
}
.live-frame-body.loaded::before { display: none; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* Skeleton shouldn't run on img-based frames */
.live-frame-body:has(img)::before { display: none; }
.live-frame-body img { position: relative; z-index: 1; }
.live-frame-body iframe { position: relative; z-index: 1; }
.live-frame-body img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
}

.live-frame-status,
.live-frame-status-dot {
  display: none !important;
}

/* Two side-by-side live frames (e.g. state map + resources) */
.live-frame-pair {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  margin: 32px 0 48px;
}
@media (min-width: 900px) {
  .live-frame-pair { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
.live-frame-pair .live-frame { margin: 0; }
.live-frame-pair .live-frame-body { aspect-ratio: 4 / 5; }

/* Mobile: tighter chrome, drop the action button, taller aspect */
@media (max-width: 700px) {
  .live-frame-chrome {
    padding: 10px 12px;
    gap: 8px;
  }
  .live-frame-traffic { display: none; }
  .live-frame-url { padding: 5px 11px; font-size: 11px; }
  .live-frame-url-text { font-size: 11px; }
  .live-frame-action { display: none; }
  .live-frame-body { aspect-ratio: 9 / 14; }
}

/* =========================================================================
   STICKY TOC
   ========================================================================= */
.toc {
  display: none;
}
@media (min-width: 1100px) {
  .toc {
    display: block;
    position: fixed;
    left: clamp(16px, 2.5vw, 32px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    max-width: 180px;
  }
  .toc-list {
    display: flex; flex-direction: column; gap: 4px;
    list-style: none; margin: 0; padding: 0;
  }
  .toc-list a {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 0;
    font-family: var(--mono); font-size: 11px; font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--ink-mute);
    transition: color var(--t-fast) var(--ease-out);
  }
  .toc-list a::before {
    content: ''; display: inline-block;
    width: 14px; height: 1px; background: var(--ink-faint);
    transition: width var(--t-medium) var(--ease-out), background var(--t-medium) var(--ease-out);
  }
  .toc-list a:hover, .toc-list a.active {
    color: var(--ink);
  }
  .toc-list a.active::before {
    width: 28px; background: var(--accent);
  }
  .toc-list a .num {
    font-size: 10px;
    color: var(--ink-mute);
    transition: color var(--t-fast) var(--ease-out);
  }
  .toc-list a.active .num { color: var(--accent); }
}

/* =========================================================================
   STATS GRID
   ========================================================================= */
.stats {
  display: grid; gap: 1px;
  grid-template-columns: 1fr;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 32px 0;
}
@media (min-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat {
  background: var(--paper);
  padding: 28px 28px 32px;
  position: relative;
  transition: background var(--t-medium) var(--ease-out);
}
.stat:hover { background: var(--paper-soft); }
.stat-num {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1; letter-spacing: -0.04em;
  color: var(--accent);
  margin-bottom: 12px;
}
.stat-label {
  font-family: var(--body); font-size: 13.5px;
  color: var(--ink-soft); line-height: 1.5;
  max-width: 28ch;
}
.stat-num {
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   STANDARDS STRIP
   ========================================================================= */
.standards {
  margin: 48px 0 0;
  padding: 28px 32px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.standards-label {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 14px;
}
.standards-list {
  display: flex; flex-wrap: wrap;
  gap: 8px 18px;
  font-family: var(--body); font-size: 13.5px;
  color: var(--ink-soft);
}
.standards-list span { display: inline-flex; align-items: center; gap: 8px; }
.standards-list .check { color: var(--accent); font-weight: 700; }

/* =========================================================================
   END NAV (next case + back)
   ========================================================================= */
.case-end {
  position: relative;
  padding: clamp(80px, 14vh, 160px) 0 clamp(48px, 8vh, 96px);
  border-top: 1px solid var(--line);
  background-color: var(--paper);
  overflow: hidden;
}
.case-end::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url('https://images.collections.yale.edu/iiif/2/ycba:51d73471-1f20-45f5-8346-4a450afda0c3/full/2400,/0/default.jpg');
  background-size: cover;
  background-position: center 50%;
  background-repeat: no-repeat;
  opacity: 1;
  z-index: 0;
  pointer-events: none;
}
.case-end::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(250, 248, 244, 0.42);
  z-index: 1;
  pointer-events: none;
}
.case-end > .wrap-media { position: relative; z-index: 2; }

.case-end-eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.case-end-eyebrow .num { color: var(--accent); }
.case-end-eyebrow .line { flex: 0 0 32px; height: 1px; background: var(--ink-faint); }

.case-end-grid {
  display: grid;
  gap: 56px;
  grid-template-columns: 1fr;
}
@media (min-width: 880px) { .case-end-grid { grid-template-columns: 1fr 1fr; gap: 80px; align-items: start; } }

/* Bio block */
.bio-block {
  display: grid;
  gap: 24px;
  grid-template-columns: 96px 1fr;
  align-items: start;
}
@media (min-width: 540px) { .bio-block { grid-template-columns: 120px 1fr; gap: 28px; } }
.bio-portrait {
  width: 96px; height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
@media (min-width: 540px) { .bio-portrait { width: 120px; height: 120px; } }
.bio-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bio-text {
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
  margin: 0;
}
.bio-text p { margin: 0 0 14px; }
.bio-text p:last-child { margin-bottom: 0; }
.bio-text strong { color: var(--accent); font-weight: 700; }

/* Contact links */
.contact-links {
  display: flex; flex-direction: column; gap: 12px;
}
.contact-link {
  display: inline-flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--body);
  text-decoration: none;
  transition: background var(--t-medium) var(--ease-out), border-color var(--t-medium) var(--ease-out), transform var(--t-medium) var(--ease-out);
}
.contact-link:hover {
  background: var(--ink);
  border-color: var(--ink);
  transform: translateY(-2px);
}
.contact-link .label {
  font-family: var(--display); font-size: 16px; font-weight: 500;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 12px;
}
.contact-link:hover .label { color: var(--paper); }
.contact-link .label-key {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute);
  min-width: 60px;
}
.contact-link:hover .label-key { color: rgba(250, 248, 244, 0.5); }
.contact-link .arrow {
  display: inline-flex; align-items: center;
  transition: transform var(--t-medium) var(--ease-out);
}
.contact-link .arrow svg { width: 22px; height: 22px; display: block; }
.contact-link:hover .arrow { transform: translate(2px, -2px); }
.contact-link:hover .arrow svg path[fill="#FBF8F1"] { fill: var(--ink); }
.contact-link:hover .arrow svg path[stroke="#0E0E0E"] { stroke: var(--paper); }

/* Next case study row (below the contact section) */
.case-next {
  margin-top: clamp(64px, 9vh, 96px);
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.case-next-label {
  font-family: var(--mono); font-size: 11.5px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-mute);
}
.case-next-link {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--t-medium) var(--ease-out);
}
.case-next-link:hover { color: var(--accent); }
.case-next-link .arrow {
  display: inline-flex;
  transition: transform var(--t-medium) var(--ease-out);
}
.case-next-link:hover .arrow { transform: translateX(8px); }
.case-next-link .arrow svg { width: 32px; height: 32px; display: block; }

/* Tiny credit for the painting */
.case-end-credit {
  position: relative; z-index: 1;
  margin-top: clamp(48px, 6vh, 72px);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-mute);
  font-style: italic;
  font-weight: 300;
  text-align: center;
}
.case-end-credit a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-faint);
}
.case-end-credit a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* =========================================================================
   FOOTER
   ========================================================================= */
footer {
  padding: 32px var(--gutter);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
}

/* =========================================================================
   REVEAL ON SCROLL
   ========================================================================= */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal-on-scroll.in {
  opacity: 1; transform: translateY(0);
}

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