/* ==========================================================================
   Portfolio v11 — Editorial (adcker-inspired)
   Dark cinematic, stacked editorial hero with inline portrait, smooth scroll.
   ========================================================================== */

:root {
  /* Baseline palette. Overridden per active section via body[data-palette-active="..."].
     Semantic tokens: --bg, --ink, --plate, --accent. The ink-soft/ink-dim/rule layers
     are derived from --ink via color-mix so they flip automatically with the palette. */
  --bg: #14100e;
  --ink: #ede7db;
  --ink-soft: color-mix(in srgb, var(--ink), transparent 22%);
  --ink-dim: color-mix(in srgb, var(--ink), transparent 55%);
  --rule: color-mix(in srgb, var(--ink), transparent 88%);
  --plate: #0b0907;
  --plate-inset: rgba(20, 16, 14, 0.55);
  --plate-edge: color-mix(in srgb, var(--ink), transparent 90%);
  --accent: #e8d4b0;
  --accent-glow: color-mix(in srgb, var(--accent), transparent 84%);
  --bg-hover: #1a140f;

  --sans: 'Sohne', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Tiempos Headline', Georgia, serif;
  --mono: 'Sohne Mono', ui-monospace, monospace;

  --page-max: 1600px;
  --pad-x: clamp(24px, 4vw, 64px);
  /* Edge inset used by hero corner text — respects page-max on wide screens. */
  --edge: max(var(--pad-x), calc((100% - var(--page-max)) / 2 + var(--pad-x)));
}

/* ==========================================================================
   Per-section palettes.
   Three dark cases (Dante, VMware, EuVantage) drift warm-to-cool within the
   dark register. Two light cases (CloudOptimal, AI Fabric) lift the whole
   page so light product screens don't shout on a dark page.
   ========================================================================== */
body[data-palette-active="baseline"] {
  --bg: #14100e;
  --ink: #ede7db;
  --ink-soft: rgba(237, 231, 219, 0.82);
  --ink-dim: rgba(237, 231, 219, 0.55);
  --rule: rgba(237, 231, 219, 0.14);
  --plate: #0b0907;
  --plate-inset: rgba(20, 16, 14, 0.55);
  --plate-edge: rgba(237, 231, 219, 0.10);
  --accent: #e8d4b0;
  --accent-glow: rgba(232, 212, 176, 0.16);
  --bg-hover: #1a140f;
}
body[data-palette-active="dante"] {
  --bg: #15131e;
  --ink: #e8e4f0;
  --ink-soft: rgba(232, 228, 240, 0.82);
  --ink-dim: rgba(232, 228, 240, 0.55);
  --rule: rgba(232, 228, 240, 0.14);
  --plate: #0f0e17;
  --plate-inset: rgba(15, 14, 23, 0.6);
  --plate-edge: rgba(232, 228, 240, 0.10);
  --accent: #c4b5fd;
  --accent-glow: rgba(196, 181, 253, 0.16);
  --bg-hover: #1b1826;
}
body[data-palette-active="vmware"] {
  --bg: #0b0d10;
  --ink: #e2e6ec;
  --ink-soft: rgba(226, 230, 236, 0.82);
  --ink-dim: rgba(226, 230, 236, 0.55);
  --rule: rgba(226, 230, 236, 0.14);
  --plate: #07090c;
  --plate-inset: rgba(8, 12, 18, 0.6);
  --plate-edge: rgba(226, 230, 236, 0.10);
  --accent: #8ea4bc;
  --accent-glow: rgba(142, 164, 188, 0.16);
  --bg-hover: #12171d;
}
body[data-palette-active="euvantage"] {
  --bg: #eef1f6;
  --ink: #121a2a;
  --ink-soft: rgba(18, 26, 42, 0.88);
  --ink-dim: rgba(18, 26, 42, 0.62);
  --rule: rgba(18, 26, 42, 0.14);
  --plate: #f6f8fc;
  --plate-inset: rgba(18, 26, 42, 0.05);
  --plate-edge: rgba(18, 26, 42, 0.14);
  --accent: #1d4ed8;
  --accent-glow: rgba(29, 78, 216, 0.14);
  --bg-hover: #e5e8ee;
}
body[data-palette-active="cloudoptimal"] {
  --bg: #eef0f4;
  --ink: #14182a;
  --ink-soft: rgba(20, 24, 42, 0.88);
  --ink-dim: rgba(20, 24, 42, 0.62);
  --rule: rgba(20, 24, 42, 0.14);
  --plate: #f6f7fa;
  --plate-inset: rgba(20, 24, 42, 0.05);
  --plate-edge: rgba(20, 24, 42, 0.14);
  --accent: #2945cf;
  --accent-glow: rgba(41, 69, 207, 0.14);
  --bg-hover: #e5e7ec;
}
body[data-palette-active="aifabric"] {
  --bg: #f2efe9;
  --ink: #15120c;
  --ink-soft: rgba(21, 18, 12, 0.88);
  --ink-dim: rgba(21, 18, 12, 0.62);
  --rule: rgba(21, 18, 12, 0.14);
  --plate: #faf7f1;
  --plate-inset: rgba(24, 20, 14, 0.05);
  --plate-edge: rgba(21, 18, 12, 0.14);
  --accent: #3d52d4;
  --accent-glow: rgba(61, 82, 212, 0.14);
  --bg-hover: #ebe7db;
}
/* Nudgent closer — warm dark per nudgent.com hero illustration.
   Ink is warm cream, accent is the terracotta tone from the robot's cardigan. */
body[data-palette-active="nudgent"] {
  --bg: #0a0806;
  --ink: #ede4d3;
  --ink-soft: rgba(237, 228, 211, 0.82);
  --ink-dim: rgba(237, 228, 211, 0.55);
  --rule: rgba(237, 228, 211, 0.14);
  --plate: #050302;
  --plate-inset: rgba(10, 8, 6, 0.6);
  --plate-edge: rgba(237, 228, 211, 0.10);
  --accent: #d19577;
  --accent-glow: rgba(209, 149, 119, 0.18);
  --bg-hover: #120d0a;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
  transition: background-color 640ms cubic-bezier(.22,.86,.34,1);
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 640ms cubic-bezier(.22,.86,.34,1),
              color 640ms cubic-bezier(.22,.86,.34,1);
}

a { color: inherit; text-decoration: none; }
em, i { font-style: normal; font-weight: 400; }

/* ==========================================================================
   Masthead — fixed top bar
   ========================================================================== */
.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(14px, 1.5vw, 24px) var(--pad-x);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: var(--masthead-opacity, 1);
  transition: color 640ms cubic-bezier(.22,.86,.34,1),
              opacity 320ms cubic-bezier(.22,.86,.34,1);
}
.masthead-logo {
  font-weight: 500;
  color: var(--ink);
  transition: color 640ms cubic-bezier(.22,.86,.34,1);
}
.masthead-nav { display: flex; gap: 28px; }
.masthead-nav a { transition: color 640ms cubic-bezier(.22,.86,.34,1); }
.masthead-nav a:hover { color: var(--ink); }

/* ==========================================================================
   Hero — four-corner editorial grid (heading TL, subhead TR, support BR,
   portrait floating between).
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  padding: clamp(72px, 7vw, 120px) var(--pad-x) clamp(64px, 5vw, 96px);
  overflow: hidden;
}

/* Corner meta labels — small sans, positioned at page edges */
.hero-meta {
  position: absolute;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  z-index: 5;
  pointer-events: none;
}
.hero-meta--tr { top: 96px;  right: var(--pad-x); }
.hero-meta--ml { top: 50%;   left: var(--pad-x); transform: translateY(-50%); }
.hero-meta--br { bottom: 36px; right: var(--pad-x); }

/* Editorial stacked heading */
.editorial {
  position: absolute;
  top: 35%;
  left: var(--edge);
  transform: translateY(-50%);
  z-index: 3;
  max-width: min(960px, 92vw);
  text-align: left;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(34px, 8.5vw, 136px);
  line-height: 1.0;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--ink);
}

/* Per-line depth — scroll-Y parallax baseline, mouse-X fan layered on top
   via .is-parallax rules. Each transform combines both axes in one call
   (transform is atomic; separate rules would clobber each other). */
.editorial .line {
  display: block;
  white-space: nowrap;
  transform: translate3d(0, calc(var(--scroll-y, 0px) * -0.12), 0);
  transition: transform 320ms cubic-bezier(.22,.86,.34,1);
}

/* Top-right subhead — positioning paragraph, right-aligned against the rail. */
.hero-subhead {
  position: absolute;
  top: clamp(72px, 6vw, 96px);
  right: var(--edge);
  z-index: 3;
  max-width: min(380px, 42vw);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  text-align: right;
  text-wrap: pretty;
  transform: translate3d(0, calc(var(--scroll-y, 0px) * -0.22), 0);
  transition: transform 320ms cubic-bezier(.22,.86,.34,1);
}
.hero-subhead em { color: var(--ink); }
.hero.is-parallax .hero-subhead {
  transform: translate3d(calc(var(--heading-shift, 0px) * 0.75), calc(var(--scroll-y, 0px) * -0.22), 0);
}

/* Bottom-right supporting line — tiny mono label, editorial marginalia.
   Moves slowest on scroll so the bottom-right anchor holds longest. */
.hero-support {
  position: absolute;
  bottom: clamp(48px, 6vw, 96px);
  right: var(--edge);
  z-index: 3;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: right;
  white-space: nowrap;
  transform: translate3d(0, calc(var(--scroll-y, 0px) * -0.06), 0);
  transition: transform 320ms cubic-bezier(.22,.86,.34,1);
}
.hero.is-parallax .hero-support {
  transform: translate3d(calc(var(--heading-shift, 0px) * 1.15), calc(var(--scroll-y, 0px) * -0.06), 0);
}

/* Bottom-left lede — mirrors .hero-support on the opposite corner.
   Anchors the editorial grid's fourth corner below the stacked heading. */
.hero-lede {
  position: absolute;
  bottom: clamp(48px, 6vw, 96px);
  left: var(--edge);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: left;
  white-space: nowrap;
  transform: translate3d(0, calc(var(--scroll-y, 0px) * -0.06), 0);
  transition: transform 320ms cubic-bezier(.22,.86,.34,1);
}
.hero-lede-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7fd48a;
  box-shadow: 0 0 0 3px rgba(127, 212, 138, 0.18);
  animation: hero-lede-pulse 2.4s ease-in-out infinite;
}
@keyframes hero-lede-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(127, 212, 138, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(127, 212, 138, 0.05); }
}
.hero.is-parallax .hero-lede {
  transform: translate3d(calc(var(--heading-shift, 0px) * 0.5), calc(var(--scroll-y, 0px) * -0.06), 0);
}

/* A — differential parallax: line 1 trails, last line leads on mouse X. */
.hero.is-parallax .editorial .line[data-line="1"] { transform: translate3d(calc(var(--heading-shift, 0px) * 0.4),  calc(var(--scroll-y, 0px) * -0.12), 0); }
.hero.is-parallax .editorial .line[data-line="2"] { transform: translate3d(calc(var(--heading-shift, 0px) * 0.7),  calc(var(--scroll-y, 0px) * -0.12), 0); }
.hero.is-parallax .editorial .line[data-line="3"] { transform: translate3d(calc(var(--heading-shift, 0px) * 1.0),  calc(var(--scroll-y, 0px) * -0.12), 0); }
.hero.is-parallax .editorial .line[data-line="4"] { transform: translate3d(calc(var(--heading-shift, 0px) * 1.3),  calc(var(--scroll-y, 0px) * -0.12), 0); }


/* ==========================================================================
   X-factor: film grain overlay
   ========================================================================== */
.hero-grain {
  position: absolute; inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
  animation: grainShift 620ms steps(6) infinite;
}
@keyframes grainShift {
  0%   { transform: translate3d(0, 0, 0); }
  16%  { transform: translate3d(-3%, 2%, 0); }
  33%  { transform: translate3d(2%, -3%, 0); }
  50%  { transform: translate3d(-2%, -2%, 0); }
  66%  { transform: translate3d(3%, 3%, 0); }
  83%  { transform: translate3d(-4%, 1%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ==========================================================================
   X-factor: chromatic aberration
   JS drives --ab-strength (0..1) and --ab-offset (px).
   A huge ghost portrait sits BEHIND the heading wall — on scroll, red/blue
   copies drift apart, creating a cinematic aberration behind the text.
   ========================================================================== */
.hero-aberration {
  position: absolute; inset: 0;
  z-index: 4;                        /* in front of heading (z:3) */
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Subtle scroll-linked drift — 12% of scroll distance for a "heavy" hero feel.
     Reads --scroll-y inherited from the parent .hero section. */
  translate: 0 calc(var(--scroll-y, 0px) * 0.12);
  will-change: translate;
}
.hero-portrait {
  position: absolute;
  /* Right-leaning anchor — portrait as a framed token rather than a backdrop. */
  top: 54%; left: 60%;
  width: clamp(260px, 36vw, 540px);
  height: clamp(260px, 36vw, 540px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  /* Warm studio plate behind the cutout — amber light pooling from upper-left,
     deepening to warm ink at the bottom. Layered under the portrait PNG. */
  background:
    url('../images/ivan-cutout-tight.png') center 22% / cover no-repeat,
    radial-gradient(ellipse 90% 100% at 45% 10%,
      #2a1d13 0%,
      #1a1009 55%,
      #080402 100%);
  translate: calc(-50% + var(--px-shift, 0px)) calc(-50% + var(--py-shift, 0px));
  transform: rotate(-4deg);
  opacity: var(--ab-strength, 0);
  transition: opacity 80ms linear;
  /* Inset vignette only \u2014 no drop shadow. */
  box-shadow:
    inset 0 0 0 1px rgba(236, 230, 220, 0.10),
    inset 0 0 60px 8px rgba(20, 16, 14, 0.45);
}

/* Subtle warm glow behind the circular portrait — wider than the token
   so the halo reads as light bleeding through the paper around the figure. */
.hero-glow {
  position: absolute;
  top: 54%; left: 60%;
  width: clamp(420px, 56vw, 860px);
  height: clamp(420px, 56vw, 860px);
  translate: -50% -50%;
  background: radial-gradient(circle,
    rgba(236, 220, 190, 0.14) 0%,
    rgba(236, 220, 190, 0.07) 28%,
    rgba(236, 220, 190, 0.025) 52%,
    transparent 72%);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: var(--ab-strength, 0);
}

/* ==========================================================================
   Case sections — Swiss 12-column grid.
   Every element aligns to the same columns. Alternation comes from which
   columns the cover and context claim, not from ad-hoc ratios. Gutters are
   consistent. Head spans full width. Body uses subgrid so cover and context
   inherit the section's column lines.
   ========================================================================== */
.case {
  position: relative;
  isolation: isolate;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(56px, min(18vh, 12vw), 220px) var(--pad-x);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(32px, 5vw, 128px);
  row-gap: clamp(32px, 8vh, 96px);
}

/* Hover a case link → the whole page bg flips. One effect, no overlays.
   Body already has a 640ms bg transition, so this animates for free. */
body:has(.case-link:hover) {
  --bg: var(--bg-hover);
}

.case-head {
  grid-column: 1 / -1;
}

.case-link {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  column-gap: inherit;
  align-items: center;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.case-cover {
  grid-column: var(--cover-cols, 1 / span 7);
  margin: 0;
  aspect-ratio: 1 / 1;
  transform: translate3d(0, calc(var(--case-scroll, 0) * -40px), 0);
  will-change: transform;
  transition: box-shadow 420ms ease,
              background-color 640ms cubic-bezier(.22,.86,.34,1),
              opacity 860ms cubic-bezier(.22,.86,.34,1);
}
.case-context {
  grid-column: var(--ctx-cols, 8 / span 5);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(28px, 4vh, 56px);
  align-content: center;
}


.case-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-bottom: 18px;
  /* Accent bookend: 44px × 2px accent segment on the left, 1px hairline for the rest.
     Palette-scoped via var(--accent) and var(--rule).
     Width stretches from 44px at section edges to ~56px when the case is centered in
     viewport — uses (1 - case-scroll²) so the peak is at |case-scroll| = 0 and returns
     to 44px at the edges. */
  background-image:
    linear-gradient(to right,
      var(--accent) calc(44px + 12px * (1 - var(--case-scroll, 0) * var(--case-scroll, 0))),
      transparent calc(44px + 12px * (1 - var(--case-scroll, 0) * var(--case-scroll, 0)))),
    linear-gradient(var(--rule), var(--rule));
  background-size: 100% 2px, 100% 1px;
  background-position: left bottom, left bottom;
  background-repeat: no-repeat;
}
.case-num {
  color: var(--ink);
  font-weight: 500;
  font-feature-settings: 'tnum' 1;
  /* Ambient drift as the case enters/leaves frame. Uses --case-scroll,
     already written by the case-parallax IIFE in Landing v11. */
  translate: 0 calc(var(--case-scroll, 0) * -4px);
  will-change: translate;
}
.case-byline {
  text-align: right;
  /* Counter-drift to .case-num — separates slightly as the case passes by. */
  translate: 0 calc(var(--case-scroll, 0) * 3px);
  will-change: translate;
}

.case-title {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(28px, 4.4vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--ink);
  max-width: 22ch;
}
.case-title em,
.closer-title em {
  font-style: normal;
  color: var(--accent);
  transition: color 640ms cubic-bezier(.22,.86,.34,1);
}

/* Stacked-line titles. Two motion layers:
   - `translate` carries the reveal (14px → 0) with a per-line stagger delay.
   - `transform` carries the live mouse-X fan, driven every frame via --case-shift,
     so we leave transform transition-free to avoid fighting the JS.
   Case titles soft-wrap (they live in a 5-col subgrid cell); closer + hero nowrap. */
.case-title .line,
.closer-title .line {
  display: block;
  opacity: 0;
  translate: 0 14px;
  transition: opacity 620ms cubic-bezier(.22,.86,.34,1),
              translate 620ms cubic-bezier(.22,.86,.34,1);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.closer-title .line { white-space: nowrap; }
.case-title.is-visible .line,
.closer-title.is-visible .line {
  opacity: 1;
  translate: 0 0;
}
.case-title .line:nth-child(1) { transform: translate3d(calc(var(--case-shift, 0px) * 0.6), 0, 0); }
.case-title .line:nth-child(2) { transform: translate3d(calc(var(--case-shift, 0px) * 0.9), 0, 0); }
.case-title .line:nth-child(3) { transform: translate3d(calc(var(--case-shift, 0px) * 1.2), 0, 0); }

.case-media {
  position: relative;
  overflow: hidden;
  background: var(--plate);
  border-radius: 24px;
  opacity: 0;
  transition: opacity 860ms cubic-bezier(.22,.86,.34,1),
              box-shadow 420ms ease,
              background-color 640ms cubic-bezier(.22,.86,.34,1);
  box-shadow: inset 0 0 0 1px var(--plate-edge);
}
.case-media.is-visible {
  opacity: 1;
}
.case-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Transparent-PNG covers — the source image is a dashboard cutout on alpha.
   The container provides the surface color; swap var(--plate) for any tone
   to retreat the card (page bg for seamless, accent tint for framed). */
.case-cover--nobg {
  background: var(--plate);
  border-radius: 24px;
  overflow: hidden;
}
.case-cover--nobg img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

/* Hover a transparent-PNG cover → the whole page washes with the section's
   accent tint. Body already has a 640ms bg transition, so this animates for
   free. Tune the mix percentage for a louder/softer wash. */


.case-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.case-outcome {
  font-family: var(--sans);
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 52ch;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 560ms cubic-bezier(.22,.86,.34,1),
              transform 560ms cubic-bezier(.22,.86,.34,1);
}
.case-outcome.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.case-outcome em {
  font-style: normal;
  color: var(--accent);
  transition: color 640ms cubic-bezier(.22,.86,.34,1);
}

/* ==========================================================================
   Closer — Nudgent
   Stacked sequence: kicker, title, deck, citations table, rising specimen.
   The specimen is the click-through to the live product.
   ========================================================================== */
.closer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(72px, min(22vh, 14vw), 280px) var(--pad-x) clamp(56px, min(16vh, 10vw), 200px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(40px, 8vh, 96px);
  border-top: 1px solid var(--rule);
}
.closer-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.closer-title {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(30px, 6vw, 96px);
  line-height: 1.0;
  letter-spacing: -0.015em;
  color: var(--ink);
  max-width: 22ch;
}
.closer-deck {
  font-family: var(--sans);
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 64ch;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 620ms cubic-bezier(.22,.86,.34,1),
              transform 620ms cubic-bezier(.22,.86,.34,1);
  transition-delay: 80ms;
}
.closer-deck.is-visible { opacity: 1; transform: translateY(0); }

.closer-citations {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 720ms cubic-bezier(.22,.86,.34,1),
              transform 720ms cubic-bezier(.22,.86,.34,1);
  transition-delay: 160ms;
}
.closer-citations.is-visible { opacity: 1; transform: translateY(0); }
.citation {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  padding: 22px clamp(20px, 2.5vw, 32px);
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  min-width: 0;
}
.citation:nth-child(2n) { border-right: none; }
.citation .year {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 4px;
}
.citation .body { display: flex; flex-direction: column; gap: 4px; }
.citation .principle {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.citation .author {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.citation .mechanism {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-top: 4px;
  max-width: 56ch;
}

/* Rising specimen — full-container snapshot of nudgent.com on a 3D stand.
   Initial state lies back below; on is-visible rises to a faint forward tilt.
   --closer-scroll provides slow scroll-linked drift via translate (separate
   from transform). --stand-rx / --stand-ry are written by JS on hover and
   consumed by .closer-snap's transform. */
.closer-stand {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-top: clamp(32px, 6vh, 80px);
  border-radius: clamp(16px, 1.5vw, 24px);
  perspective: 2200px;
  perspective-origin: 50% 100%;
  cursor: pointer;
  opacity: 0;
  transform: translateY(120px) scale(0.96);
  translate: 0 calc(var(--closer-scroll, 0) * -32px);
  transition: opacity 1100ms cubic-bezier(.22,.86,.34,1),
              transform 1100ms cubic-bezier(.22,.86,.34,1);
  will-change: translate, transform;
}
.closer-stand.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.closer-snap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: #f5f1e8;
  box-shadow:
    0 60px 120px -20px rgba(0, 0, 0, 0.55),
    0 30px 60px -15px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(237, 228, 211, 0.10);
  transform-origin: 50% 100%;
  transform:
    rotateX(calc(2deg + var(--stand-ry, 0) * -2.4deg))
    rotateY(calc(var(--stand-rx, 0) * 3deg));
  transition: transform 360ms cubic-bezier(.22,.86,.34,1),
              box-shadow 360ms ease;
}
.closer-stand:hover .closer-snap {
  box-shadow:
    0 80px 140px -20px rgba(0, 0, 0, 0.6),
    0 40px 80px -15px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px var(--accent-glow);
}
.closer-snap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
}
.closer-stand-cue {
  position: absolute;
  bottom: 24px;
  right: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(10, 8, 6, 0.78);
  padding: 10px 14px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 280ms ease, transform 280ms ease;
  pointer-events: none;
  z-index: 2;
}
.closer-stand:hover .closer-stand-cue {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
/* Tablet — structural stacking only. All dimensional values scale smoothly via
   clamp() on the base rules. */
@media (max-width: 900px) {
  .hero-meta--ml { display: none; }

  /* Cases — stack to single column. minmax(0, 1fr) prevents the track
     from being dragged wider than the viewport by descendant min-content
     (case bylines, mechanism phrases, etc.). */
  .case { grid-template-columns: minmax(0, 1fr); }
  .case-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .case-byline { text-align: left; translate: 0; }
  .case-num { translate: 0; }
  .case-link {
    grid-template-columns: minmax(0, 1fr);
    row-gap: clamp(32px, 5vh, 56px);
  }
  .case-cover,
  .case-context {
    grid-column: 1;
    min-width: 0;
  }
  .case-cover { grid-row: 1; }
  .case-context { grid-row: 2; }

  /* Closer — single-column citations. Stand keeps its base 16:10 ratio
     so the Nudgent screenshot never gets cropped on the sides. */
  .closer-citations { grid-template-columns: minmax(0, 1fr); }
  .citation { border-right: none; }
  .closer-title .line { white-space: normal; }

  /* Body prose breaks unbreakable tokens rather than overflowing the
     viewport, so deck and citation paragraphs never get clipped. */
  .closer-deck,
  .citation .principle,
  .citation .mechanism,
  .case-context p,
  .case-byline,
  .case-outcome,
  .hero-subhead {
    overflow-wrap: break-word;
  }
}

/* Phone — structural reflow of hero and masthead only. Dimensional values are
   handled by clamp() on the base rules. */
@media (max-width: 640px) {
  /* Masthead: logo + single Write link (hide in-page nav anchors).
     Subtle blurred backdrop so text scrolling underneath doesn't collide
     with the fixed-position masthead labels on long pages (case studies). */
  .masthead {
    background: color-mix(in oklab, var(--bg) 78%, transparent);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
  }
  .masthead-nav { gap: 0; }
  .masthead-nav a:not([href^="mailto:"]) { display: none; }
  .masthead-nav a[href^="mailto:"] { padding: 6px 0; }

  /* Hero becomes a flex column so text elements enter normal flow.
     Decorative absolutes fall out of position via explicit overrides below. */
  .hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: auto;
  }

  .editorial {
    position: static;
    transform: none;
    max-width: none;
  }
  .editorial .line { white-space: normal; }

  .hero-subhead {
    position: static;
    max-width: none;
    margin-top: 32px;
    text-align: left;
  }

  /* Order: headline → subhead → Available → Based in Barcelona → portrait sign-off */
  .hero-lede {
    position: static;
    order: 2;
    margin-top: 40px;
    text-align: left;
    transform: none;
  }
  .hero-support {
    position: static;
    order: 3;
    margin-top: 10px;
    text-align: left;
    white-space: normal;
    transform: none;
  }

  /* Portrait enters flow as a sign-off token below the text, pinned right.
     Size scales linearly via clamp so it tracks with viewport. */
  .hero-aberration {
    position: static;
    order: 4;
    align-self: flex-end;
    display: block;
    width: clamp(200px, 68vw, 300px);
    height: clamp(200px, 68vw, 300px);
    margin: clamp(48px, 8vw, 72px) 0 0;
    overflow: visible;
    z-index: auto;
    translate: none;
  }
  .hero-portrait {
    top: 0; left: 0;
    width: 100%; height: 100%;
    translate: var(--px-shift, 0px) var(--py-shift, 0px);
  }
  .hero-glow {
    top: 50%; left: 50%;
    width: 150%; height: 150%;
    translate: -50% -50%;
  }

  /* Case covers stay square on phones for consistency. Closer stand keeps
     its base 16:10 ratio so the full Nudgent hero is visible, never cropped. */
  .case-cover { aspect-ratio: 1 / 1; }
}

/* ============================================================
   Case cover — cursor-zone image scrub (opt-in via [data-scrub])
   Stacks multiple <img> elements and cross-fades based on cursor
   Y-position within the card. Composes with --case-scroll parallax.
   ============================================================ */
.case-cover[data-scrub] {
  transform:
    perspective(1200px)
    translate3d(0, calc(var(--case-scroll, 0) * -40px), 0)
    rotateX(var(--scrub-rx, 0deg))
    rotateY(var(--scrub-ry, 0deg));
  transition: box-shadow 420ms ease,
              background-color 640ms cubic-bezier(.22,.86,.34,1),
              opacity 860ms cubic-bezier(.22,.86,.34,1),
              transform 520ms cubic-bezier(.2,.7,.2,1);
}
.case-cover[data-scrub].is-scrubbing {
  transition: box-shadow 420ms ease,
              background-color 640ms cubic-bezier(.22,.86,.34,1),
              opacity 860ms cubic-bezier(.22,.86,.34,1),
              transform 140ms cubic-bezier(.2,.7,.2,1);
}
.case-cover[data-scrub] img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 420ms cubic-bezier(.2,.7,.2,1);
}
.case-cover[data-scrub] img.is-active {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .case-title .line,
  .closer-title .line,
  .case-media,
  .case-cover,
  .case-outcome,
  .closer-deck,
  .closer-citations,
  .closer-stand { opacity: 1; transform: none; translate: 0; }
  .closer-snap { transform: none; }
  /* Scrub: show only the idle image, hide overlays */
  .case-cover[data-scrub] img { opacity: 0; transform: none; }
  .case-cover[data-scrub] img.is-active,
  .case-cover[data-scrub] img[data-zone="0"] { opacity: 1; }
}
