/* =======================================================
 *  Case Study page — standalone, inherits dark cyber theme
 * ======================================================= */
:root {
  --brand: #FF9000;
  --brand-2: #ff6a00;
  --cyan: #00e5ff;
  --cyan-dim: #0ea5b8;
  --magenta: #ff2bd6;
  --bg-dark: #0a0f1f;
  --bg-deep: #050814;
  --surface: #0f1730;
  --line: rgba(0, 229, 255, 0.18);
  --line-strong: rgba(0, 229, 255, 0.45);
  --glow-cyan: 0 0 12px rgba(0, 229, 255, 0.55), 0 0 30px rgba(0, 229, 255, 0.25);

  /* Motion vocabulary — mirrored from style.css so case-study pages have
   * the same timing system as the home page. Keep these in sync. */
  --tx-instant: 0.08s;
  --tx-fast:    0.15s;
  --tx-base:    0.35s;
  --tx-mid:     0.55s;
  --tx-slow:    0.8s;
  --tx-stage:   1.1s;
  --ez-out:  cubic-bezier(0.2, 0.9, 0.2, 1);
  --ez-in:   cubic-bezier(0.7, 0, 0.84, 0);
  --ez-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ez-soft: cubic-bezier(0.45, 0, 0.55, 1);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg-deep);
  color: #e6f3ff;
  font-family: 'JetBrains Mono', 'Space Mono', monospace;
  font-size: 15px;
  line-height: 1.7;
  scroll-behavior: smooth;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, transparent 80%);
          mask-image: radial-gradient(ellipse at center, #000 25%, transparent 80%);
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}

/* Top nav */
.cs-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  /* backdrop-filter removed — see tech-fx.css for rationale. Bumped
     background opacity to compensate. */
  background: rgba(8, 12, 28, 0.96);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cs-nav__brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-decoration: none;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}
.cs-nav__brand {
  position: relative;
  display: inline-block;
}
.cs-nav__brand::before { content: '← '; color: var(--brand); }
.cs-nav__brand:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 2px;
}
/* Scanning underline — 1px cyan stripe slowly travels left-to-right
   under the link, always-on. Speeds up + brightens on hover. */
.cs-nav__brand::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--cyan) 30%,
    var(--cyan) 70%,
    transparent 100%);
  background-size: 220% 100%;
  background-position: 0 50%;
  animation: cs-nav-brand-scan 4s linear infinite;
  opacity: 0.55;
  pointer-events: none;
}
.cs-nav__brand:hover::after {
  opacity: 1;
  animation-duration: 1.5s;
}
@keyframes cs-nav-brand-scan {
  from { background-position: -110% 50%; }
  to   { background-position:  110% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-nav__brand::after { animation: none; opacity: 0.4; }
}
.cs-nav__breadcrumb {
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.55);
}
.cs-nav__breadcrumb .active { color: var(--cyan); }

/* Layout */
.cs-wrap {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 60px 28px 80px;
}

/* Hero */
.cs-hero { margin-bottom: 56px; position: relative; }

/* =======================================================
 *  Boot-sequence reveal — case-study hero elements fade up
 *  in sequence on load, like a HUD initializing. Plays once
 *  (forwards fill-mode + no iteration), so it never repeats
 *  on subsequent scrolls / interactions.
 * ======================================================= */
.cs-hero__label,
.cs-hero h1,
.cs-hero__tagline,
.cs-meta,
.cs-hero__chips {
  animation: cs-boot-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.cs-hero__label   { animation-delay: 0.15s; }
.cs-hero h1       {
  /* h1 already has the holographic shimmer; chain the boot-rise alongside it */
  animation:
    cs-hero-shimmer 7s ease-in-out infinite,
    cs-boot-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.30s backwards;
}
.cs-hero__tagline { animation-delay: 0.45s; }
.cs-meta          {
  /* .cs-meta already has hue-cycle from iter 15 — chain boot-rise too */
  animation:
    cs-meta-hue-cycle 9s ease-in-out infinite,
    cs-boot-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.60s backwards;
}
.cs-hero__chips   { animation-delay: 0.75s; }

@keyframes cs-boot-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs-hero__label,
  .cs-hero h1,
  .cs-hero__tagline,
  .cs-meta,
  .cs-hero__chips {
    animation: none;
  }
}
/* Hero power-on scan beam — sweeps once on load */
.cs-hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 229, 255, 0.55) 25%,
    rgba(255, 144, 0, 0.7) 50%,
    rgba(0, 229, 255, 0.55) 75%,
    transparent 100%
  );
  box-shadow:
    0 0 14px rgba(0, 229, 255, 0.5),
    0 0 30px rgba(0, 229, 255, 0.18);
  filter: blur(0.5px);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  animation: cs-hero-scan-sweep 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.5s 1 forwards;
}
@keyframes cs-hero-scan-sweep {
  0%   { top: -3px;  opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-hero::after { display: none; }
}
.cs-hero__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: lowercase;
  color: var(--cyan-dim);
  margin-bottom: 10px;
}
.cs-hero h1 {
  font-family: 'Orbitron', 'Space Mono', sans-serif;
  font-size: 42px;
  letter-spacing: 3px;
  line-height: 1.15;
  margin: 0 0 14px;
  /* Holographic shimmer — animated cyan → white → orange sweep
     clipped to the glyph shape. The inner <span> subtitle carries
     its own inline color, so it stays cyan and doesn't shimmer. */
  background-image: linear-gradient(
    90deg,
    var(--cyan) 0%,
    #ffffff 22%,
    var(--brand) 50%,
    #ffffff 78%,
    var(--cyan) 100%
  );
  background-size: 220% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 28px rgba(0, 229, 255, 0.2);
  animation: cs-hero-shimmer 7s ease-in-out infinite;
}
@keyframes cs-hero-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-hero h1 { animation: none; }
}
.cs-hero__tagline {
  font-size: 17px;
  color: rgba(230, 243, 255, 0.85);
  margin-bottom: 24px;
  max-width: 720px;
}
.cs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  padding: 18px 22px;
  background: rgba(10, 16, 36, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 18px;
  /* Iridescent border + outer glow that cycles through the brand
     palette every 9s. Subtle — keeps the panel inside the brand
     family but signals "active." Border-color and box-shadow are
     animated together so the glow always matches the border. */
  animation: cs-meta-hue-cycle 9s ease-in-out infinite;
}
@keyframes cs-meta-hue-cycle {
  0%, 100% {
    border-color: rgba(0, 229, 255, 0.22);
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.14), inset 0 0 6px rgba(0, 229, 255, 0.05);
  }
  33% {
    border-color: rgba(255, 144, 0, 0.28);
    box-shadow: 0 0 14px rgba(255, 144, 0, 0.14), inset 0 0 6px rgba(255, 144, 0, 0.05);
  }
  66% {
    border-color: rgba(255, 43, 214, 0.24);
    box-shadow: 0 0 14px rgba(255, 43, 214, 0.12), inset 0 0 6px rgba(255, 43, 214, 0.04);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs-meta { animation: none; }
}
.cs-meta__item { font-size: 12px; }
.cs-meta__k {
  display: block;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-size: 10px;
  margin-bottom: 4px;
}
.cs-meta__v { color: var(--cyan); font-size: 13px; }
.cs-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cs-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid var(--line);
  color: rgba(230, 243, 255, 0.8);
  padding: 4px 9px;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.cs-chip:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.cs-chip::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 229, 255, 0.45) 50%,
    transparent 100%);
  transform: translateX(-200%);
  pointer-events: none;
  border-radius: inherit;
}
.cs-chip:hover::after {
  animation: cs-chip-sheen 0.85s ease-out forwards;
}
.cs-chip--ai:hover::after {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 144, 0, 0.55) 50%,
    transparent 100%);
}
@keyframes cs-chip-sheen {
  from { transform: translateX(-200%); }
  to   { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  .cs-chip::after { display: none; }
  .cs-chip:hover { transform: none; }
}
.cs-chip--ai {
  background: linear-gradient(135deg, rgba(255, 144, 0, 0.12), rgba(255, 43, 214, 0.1));
  border-color: rgba(255, 144, 0, 0.4);
  color: #ffb352;
}

/* Section */
.cs-section { margin: 56px 0; }
.cs-section__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--cyan-dim);
  text-transform: lowercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cs-section__label::before { content: '//'; color: var(--brand); }
.cs-section h2 {
  font-family: 'Orbitron', monospace;
  font-size: 24px;
  letter-spacing: 2px;
  color: #fff;
  margin: 0 0 24px;
  line-height: 1.3;
  position: relative;
  display: inline-block;
  /* The underline is drawn by ::after via a width transition. Initially 0
     so it's invisible; the .is-revealed class (added by IntersectionObserver
     in /js/case-study.js when the heading scrolls into view) expands it to
     a fixed width. Cubic-bezier curve gives a satisfying ease-out draw. */
}
.cs-section h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--brand), var(--magenta), transparent);
  background-size: 110% 100%;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.5));
  border-radius: 2px;
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.08s;
}
.cs-section h2.is-revealed::after {
  width: 110px;
}
/* Reduced-motion: skip the draw, show the underline statically */
@media (prefers-reduced-motion: reduce) {
  .cs-section h2::after { transition: none; width: 110px; }
}
/* Light theme: shift the gradient palette to darker hues so the line
   stays visible on cream background */
:root[data-theme="light"] .cs-section h2::after {
  background: linear-gradient(90deg, #007a90, #c66a00, #b22299, transparent) !important;
  filter: drop-shadow(0 0 3px rgba(0, 102, 122, 0.4)) !important;
}
.cs-section p, .cs-section li {
  color: rgba(230, 243, 255, 0.88);
  font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 15.5px;
  line-height: 1.75;
}
.cs-section p { margin: 0 0 16px; }
.cs-section strong { color: var(--cyan); font-weight: 500; }
.cs-section ul {
  padding: 0;
  list-style: none;
  margin: 0 0 16px;
}
.cs-section ul li {
  position: relative;
  padding: 5px 0 5px 24px;
}
.cs-section ul li::before {
  content: '▸';
  position: absolute;
  left: 4px;
  top: 5px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
}

/* Code block */
.cs-code {
  background: linear-gradient(180deg, #0b1226, #070a18);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  margin: 20px 0;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
}
.cs-code__chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #0d1430, #0a1024);
  border-bottom: 1px solid var(--line);
}
.cs-code__dots { display: inline-flex; gap: 6px; }
.cs-code__dots i { width: 10px; height: 10px; border-radius: 50%; }
.cs-code__dots i:nth-child(1) { background: #ff5f57; }
.cs-code__dots i:nth-child(2) { background: #febc2e; }
.cs-code__dots i:nth-child(3) { background: #28c840; }
.cs-code__file {
  color: rgba(255, 255, 255, 0.55);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  margin-left: 6px;
}
.cs-code__file .active { color: var(--cyan); border-bottom: 1px solid var(--cyan); padding-bottom: 1px; }

/* Copy-to-clipboard button injected by js/case-study.js. Hex-clipped
   for visual consistency with the .tool-badge.tool-ai treatment.
   Sits at the right edge of the .cs-code__chrome bar (pushed right
   by margin-left:auto since .cs-code__chrome is flex). */
.cs-code__copy {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  background: rgba(0, 229, 255, 0.10);
  color: var(--cyan);
  border: 0;
  padding: 4px 14px;
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 50%,
    calc(100% - 8px) 100%,
    8px 100%,
    0 50%
  );
  cursor: pointer;
  text-shadow: 0 0 5px rgba(0, 229, 255, 0.35);
  transition: background 0.18s, color 0.18s, text-shadow 0.18s;
}
.cs-code__copy:hover {
  background: rgba(0, 229, 255, 0.28);
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}
.cs-code__copy:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.cs-code__copy[data-state="ok"] {
  background: rgba(120, 255, 140, 0.25) !important;
  color: #7cff8c !important;
  text-shadow: 0 0 6px rgba(120, 255, 140, 0.55) !important;
}
.cs-code__copy[data-state="fail"] {
  background: rgba(255, 95, 87, 0.25) !important;
  color: #ff8a8a !important;
  text-shadow: 0 0 6px rgba(255, 95, 87, 0.55) !important;
}
.cs-code pre {
  margin: 0;
  padding: 16px 20px;
  background: transparent;
  border: 0;
  color: #e6f3ff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.cs-code .tk-key { color: #ff79c6; }
.cs-code .tk-str { color: #f1fa8c; }
.cs-code .tk-num { color: var(--brand); }
.cs-code .tk-bool { color: #bd93f9; }
.cs-code .tk-fn { color: var(--cyan); }
.cs-code .tk-cmt { color: rgba(255, 255, 255, 0.35); font-style: italic; }
.cs-code .tk-punct { color: rgba(255, 255, 255, 0.6); }

/* Screenshot placeholder */
.cs-shot {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), rgba(255, 144, 0, 0.05));
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 60px 24px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--cyan-dim);
  text-transform: uppercase;
  margin: 20px 0;
}
.cs-shot::before {
  content: '📷';
  display: block;
  font-size: 28px;
  margin-bottom: 10px;
  filter: grayscale(0.5);
}
.cs-shot img { max-width: 100%; height: auto; border-radius: 4px; }

/* Real screenshot figure (anonymized mock or actual product capture).
   Uses a clean card framing — no dashed border, no placeholder emoji. */
.cs-shot-real {
  margin: 26px 0 8px;
  background: linear-gradient(180deg, #0b1226 0%, #070a18 100%);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 229, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.cs-shot-real img {
  display: block;
  width: 100%;
  height: auto;
}
.cs-shot-real figcaption {
  padding: 12px 18px;
  border-top: 1px solid rgba(0, 229, 255, 0.10);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.8px;
  color: rgba(230, 243, 255, 0.65);
  background: rgba(0, 0, 0, 0.18);
}
.cs-shot-real figcaption .tag {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(255, 144, 0, 0.12);
  border: 1px solid rgba(255, 144, 0, 0.4);
  color: var(--brand);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Outcome metrics */
.cs-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.cs-metric {
  background: linear-gradient(180deg, #0c1430, #0a1024);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  transition: 0.3s;
}
.cs-metric:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 22px rgba(0, 229, 255, 0.15);
  transform: translateY(-2px);
}
.cs-metric__k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}
.cs-metric__v {
  font-family: 'Orbitron', monospace;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

/* Editor-only TODO marker (kept for when the page is being filled in;
   when public-facing, the page should use .cs-pending instead) */
.cs-todo {
  display: inline-block;
  background: rgba(255, 144, 0, 0.15);
  border: 1px dashed var(--brand);
  color: var(--brand);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 4px;
}
/* Public-safe "in progress" inline tag — neutral, intentional */
.cs-pending {
  display: inline-block;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: var(--cyan-dim);
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.6px;
  margin: 0 2px;
  font-style: italic;
}
.cs-pending::before { content: '· '; opacity: 0.6; }

/* Draft banner — sits at the very top of the case-study body */
.cs-draft {
  position: relative;
  margin: 0 0 36px;
  padding: 18px 22px 18px 22px;
  background:
    linear-gradient(90deg, rgba(255, 144, 0, 0.12), rgba(255, 144, 0, 0.04));
  border: 1px solid rgba(255, 144, 0, 0.4);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 8px 24px rgba(255, 144, 0, 0.08);
}
.cs-draft__badge {
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  background: var(--brand);
  color: var(--bg-dark);
  padding: 4px 9px;
  border-radius: 3px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 12px rgba(255, 144, 0, 0.45);
}
.cs-draft__txt {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(230, 243, 255, 0.85);
  margin: 0;
}
.cs-draft__txt strong { color: var(--brand); font-weight: 500; }
.cs-draft__txt a {
  color: var(--cyan);
  border-bottom: 1px dashed var(--cyan);
  text-decoration: none;
  padding-bottom: 1px;
}
.cs-draft__txt a:hover { background: rgba(0, 229, 255, 0.1); }

/* Cleaner screenshot placeholder — reads as intentional, not "missing" */
.cs-shot--coming {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.05), rgba(0, 229, 255, 0.02));
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 8px;
  padding: 50px 24px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--cyan-dim);
  margin: 20px 0;
}
.cs-shot--coming::before {
  content: '◯';
  display: block;
  font-size: 26px;
  color: var(--cyan);
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}
.cs-shot--coming .cs-shot__title {
  display: block;
  color: rgba(230, 243, 255, 0.85);
  font-size: 13px;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.cs-shot--coming .cs-shot__sub {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: none;
}

/* CTA card at bottom */
.cs-cta {
  margin-top: 64px;
  padding: 32px 32px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), rgba(255, 144, 0, 0.06));
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 6px 30px rgba(0, 229, 255, 0.12);
}
.cs-cta h3 {
  font-family: 'Orbitron', monospace;
  font-size: 22px;
  letter-spacing: 2px;
  color: #fff;
  margin: 0 0 10px;
}
.cs-cta p {
  color: rgba(230, 243, 255, 0.85);
  margin: 0 0 18px;
}
.cs-cta__btns {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cs-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: 0.22s;
}
.cs-btn--primary {
  background: linear-gradient(135deg, var(--cyan), var(--brand));
  color: var(--bg-dark);
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(0, 229, 255, 0.25);
}
.cs-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px color-mix(in srgb, var(--cyan) 40%, transparent); }
.cs-btn--ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--cyan);
}
.cs-btn--ghost:hover { background: color-mix(in srgb, var(--cyan) 8%, transparent); border-color: var(--cyan); }

@media (max-width: 768px) {
  .cs-wrap { padding: 32px 18px 60px; }
  .cs-hero h1 { font-size: 28px; letter-spacing: 2px; }
  .cs-section h2 { font-size: 19px; }
  .cs-meta { gap: 14px; padding: 14px 16px; }
}

/* =======================================================
 *  Reading progress bar — fixed at top:0 of viewport, fills
 *  left-to-right as the reader scrolls. Width is driven by
 *  the --read-progress CSS custom property set by
 *  js/case-study.js (0 = empty, 1 = bottom of page).
 *
 *  Sits at z-index 70 — above .viewport-hud (60) so the
 *  brackets don't visually clip the bar's top edge.
 * ======================================================= */
.cs-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 70;
  background: rgba(0, 229, 255, 0.06);
  pointer-events: none;
  overflow: hidden;
}
.cs-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--brand) 60%, var(--magenta) 100%);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
  transform-origin: left;
  transform: scaleX(var(--read-progress, 0));
  transition: transform 0.12s linear;
}
:root[data-theme="light"] .cs-progress {
  background: rgba(10, 30, 60, 0.08);
}
:root[data-theme="light"] .cs-progress::after {
  background: linear-gradient(90deg, #007a90, #c66a00, #b22299);
  box-shadow: 0 0 8px rgba(0, 102, 122, 0.4);
}
@media (prefers-reduced-motion: reduce) {
  .cs-progress::after { transition: none; }
}
@media print {
  .cs-progress { display: none !important; }
}

/* =======================================================
 *  Share row — injected by js/case-study.js just above the
 *  pager. Three hex-clipped buttons + a tiny "// share:" label.
 * ======================================================= */
.cs-share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 48px 0 12px;
  padding: 14px 18px;
  background: rgba(10, 16, 36, 0.45);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.cs-share__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--cyan-dim);
  text-transform: lowercase;
  margin-right: 8px;
}
.cs-share__btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  text-decoration: none;
  background: rgba(0, 229, 255, 0.10);
  color: var(--cyan);
  border: 0;
  padding: 6px 18px;
  clip-path: polygon(
    10px 0,
    calc(100% - 10px) 0,
    100% 50%,
    calc(100% - 10px) 100%,
    10px 100%,
    0 50%
  );
  cursor: pointer;
  text-shadow: 0 0 5px color-mix(in srgb, var(--cyan) 35%, transparent);
  transition: background 0.18s, color 0.18s, text-shadow 0.18s;
}
.cs-share__btn:hover {
  background: color-mix(in srgb, var(--cyan) 28%, transparent);
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}
.cs-share__btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.cs-share__btn--linkedin {
  background: rgba(10, 102, 194, 0.18);
  color: #6ab1ff;
  text-shadow: 0 0 5px rgba(10, 102, 194, 0.4);
}
.cs-share__btn--linkedin:hover {
  background: rgba(10, 102, 194, 0.45);
  color: #fff;
  text-shadow: 0 0 8px rgba(106, 177, 255, 0.7);
}
.cs-share__btn--x {
  background: rgba(255, 43, 214, 0.14);
  color: #ff7ad0;
  text-shadow: 0 0 5px rgba(255, 43, 214, 0.35);
}
.cs-share__btn--x:hover {
  background: rgba(255, 43, 214, 0.4);
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 122, 208, 0.7);
}
.cs-share__btn[data-state="ok"] {
  background: rgba(120, 255, 140, 0.25) !important;
  color: #7cff8c !important;
  text-shadow: 0 0 6px rgba(120, 255, 140, 0.55) !important;
}
.cs-share__btn[data-state="fail"] {
  background: rgba(255, 95, 87, 0.25) !important;
  color: #ff8a8a !important;
  text-shadow: 0 0 6px rgba(255, 95, 87, 0.55) !important;
}

/* =======================================================
 *  Pager — prev/next case study at bottom of <main>
 * ======================================================= */
.cs-pager {
  display: flex;
  gap: 14px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.cs-pager__link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: rgba(10, 16, 36, 0.55);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: #e6f3ff;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s, background 0.18s;
}
.cs-pager__link:hover {
  border-color: var(--line-strong);
  background: rgba(10, 16, 36, 0.85);
  transform: translateY(-2px);
  box-shadow: var(--glow-cyan);
}
.cs-pager__link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.cs-pager__next { text-align: right; }
.cs-pager__dir {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: lowercase;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.35);
}
.cs-pager__title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}
.cs-pager__placeholder {
  flex: 1 1 0;
  visibility: hidden;
}
@media (max-width: 640px) {
  .cs-pager { flex-direction: column; }
  .cs-pager__next { text-align: left; }
}

/* =======================================================
 *  TOC — sticky on-page jump nav for long case studies
 * ======================================================= */
.cs-toc {
  position: sticky;
  top: 56px; /* sits just under the .cs-nav sticky strip */
  z-index: 10;
  /* backdrop-filter removed — sticky element repaints whenever content
     scrolls behind it. Opaque background instead. */
  background: rgba(8, 12, 28, 0.97);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  margin: 0 0 40px;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
}
.cs-toc__label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--cyan-dim);
  text-transform: lowercase;
}
.cs-toc__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.cs-toc__nav a {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: rgba(230, 243, 255, 0.7);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: 0.18s;
}
.cs-toc__nav a:hover {
  color: var(--cyan);
  border-color: var(--line-strong);
  background: rgba(0, 229, 255, 0.06);
}
.cs-toc__nav a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Scroll-margin so anchored sections aren't hidden under the sticky
   .cs-nav + .cs-toc chain (combined ~110px tall on desktop). */
.cs-section[id] { scroll-margin-top: 110px; }

@media (max-width: 640px) {
  .cs-toc { position: static; padding: 10px 12px; }
  .cs-toc__nav a { font-size: 11px; padding: 3px 8px; }
}

/* =======================================================
 *  Top-of-page TL;DR metric grid — sits between hero and
 *  first content section, mirrors .cs-metric at the bottom
 *  for scanners who never make it past the fold.
 * ======================================================= */
.cs-metrics--top {
  /* Re-state the grid here so a future .cs-metrics override doesn't
     change the top-grid behavior, and the label can span all columns. */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 0 0 40px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.04), rgba(10, 16, 36, 0.55));
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cs-metrics--top .cs-metrics__label {
  grid-column: 1 / -1; /* span full row — otherwise it consumes one grid slot
                          and pushes a metric tile onto the next row */
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan-dim);
  text-transform: lowercase;
  margin: 0 0 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* =======================================================
 *  Business-outcomes block — sits right under .cs-metrics--top
 *  to pair engineering scale (top grid) with what *changed*
 *  for the team that uses it (this grid). Hidden by default
 *  via data-status="draft" so unrefined scaffolds don't ship.
 *  Flip to data-status="live" once the BEFORE/AFTER copy is
 *  reviewed and NDA-safe.
 * ======================================================= */
.cs-outcomes--top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0 0 40px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 144, 0, 0.05), rgba(10, 16, 36, 0.55));
  border: 1px solid rgba(255, 144, 0, 0.22);
  border-radius: 8px;
}
.cs-outcomes--top[data-status="draft"] {
  /* Editor-only — block doesn't ship until status flipped to "live". */
  display: none;
}
.cs-outcomes--top .cs-outcomes__label {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255, 184, 80, 0.85);
  text-transform: lowercase;
  margin: 0 0 6px;
  font-family: 'JetBrains Mono', monospace;
}
.cs-outcome-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 14px;
  background: linear-gradient(180deg, #0c1430, #0a1024);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.cs-outcome-row + .cs-outcome-row { margin-top: 0; }
.cs-outcome-row__pair {
  display: grid;
  gap: 4px;
}
.cs-outcome-row__tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 3px 0;
  text-align: right;
  font-weight: 700;
  line-height: 1.2;
}
.cs-outcome-row__tag--before {
  color: rgba(255, 255, 255, 0.4);
}
.cs-outcome-row__tag--after {
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}
.cs-outcome-row__txt {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(230, 243, 255, 0.85);
  margin: 0;
}
.cs-outcome-row__txt--before { color: rgba(230, 243, 255, 0.55); }
@media (max-width: 600px) {
  .cs-outcome-row { grid-template-columns: 64px 1fr; padding: 8px 12px; }
  .cs-outcome-row__tag { font-size: 9.5px; letter-spacing: 1.4px; }
  .cs-outcome-row__txt { font-size: 12.5px; }
}

/* Light-theme variants */
:root[data-theme="light"] .cs-outcomes--top {
  background: linear-gradient(180deg, rgba(198, 106, 0, 0.06), #ffffff) !important;
  border-color: rgba(198, 106, 0, 0.3) !important;
}
:root[data-theme="light"] .cs-outcomes--top .cs-outcomes__label {
  color: #b85c00 !important;
}
:root[data-theme="light"] .cs-outcome-row {
  background: #ffffff !important;
  border-color: rgba(10, 30, 60, 0.12) !important;
}
:root[data-theme="light"] .cs-outcome-row__tag--before { color: rgba(10, 30, 60, 0.45) !important; }
:root[data-theme="light"] .cs-outcome-row__tag--after  { color: #00667a !important; text-shadow: none !important; }
:root[data-theme="light"] .cs-outcome-row__txt { color: #1a1f2e !important; }
:root[data-theme="light"] .cs-outcome-row__txt--before { color: rgba(10, 30, 60, 0.55) !important; }

/* =======================================================
 *  Inline OG-card preview — a self-aware peek at what the
 *  page renders as on LinkedIn / X / Slack shares.
 * ======================================================= */
.cs-og-preview {
  margin: 56px 0 0;
  padding: 24px;
  background: rgba(10, 16, 36, 0.4);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.cs-og-preview__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan-dim);
  text-transform: lowercase;
  margin: 0 0 12px;
}
.cs-og-preview__frame {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.cs-og-preview__caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(230, 243, 255, 0.55);
  margin: 12px 0 0;
  line-height: 1.6;
}

/* =======================================================
 *  Last-touched stamp — populated by js/case-study.js from
 *  GitHub commits API. Sits inline with .cs-meta items.
 * ======================================================= */
.cs-last-touched {
  color: rgba(124, 255, 140, 0.85);
}
.cs-last-touched[data-loading="true"] {
  color: rgba(230, 243, 255, 0.35);
}

/* =======================================================
 *  Print styles — for the rare hiring manager who prints.
 *  Strip all the cyber chrome, ink-friendly contrast.
 * ======================================================= */
@media print {
  html, body {
    background: #fff !important;
    color: #1a1a1a !important;
    font-family: Georgia, 'Times New Roman', serif !important;
    font-size: 11pt;
    line-height: 1.45;
  }
  body::before, .tech-grid, .scanline { display: none !important; }

  .cs-nav, .cs-toc, .cs-pager, .cs-cta, .cs-og-preview {
    display: none !important;
  }

  .cs-wrap {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .cs-hero h1,
  .cs-section h2,
  .cs-section h3 {
    color: #0d2238 !important;
    text-shadow: none !important;
    font-family: Georgia, serif !important;
    page-break-after: avoid;
  }
  .cs-hero h1 { font-size: 24pt; }
  .cs-section h2 { font-size: 14pt; border-bottom: 1px solid #999; padding-bottom: 4pt; }

  .cs-hero__label,
  .cs-section__label { color: #666 !important; font-style: italic; }

  .cs-meta {
    background: #f4f4f4 !important;
    border: 1px solid #ccc !important;
    color: #333 !important;
    padding: 12pt !important;
  }
  .cs-meta__k { color: #666 !important; }
  .cs-meta__v { color: #1a1a1a !important; }

  .cs-metrics, .cs-metrics--top {
    background: #fafafa !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
  .cs-metric__k { color: #666 !important; }
  .cs-metric__v { color: #0d2238 !important; }

  .cs-section { page-break-inside: avoid; }

  pre, code {
    background: #f5f5f5 !important;
    color: #1a1a1a !important;
    border: 1px solid #ddd !important;
    font-family: 'Courier New', monospace !important;
    font-size: 9pt !important;
    page-break-inside: avoid;
  }
  .tk-key, .tk-str, .tk-num, .tk-fn, .tk-punct, .tk-cmt, .tk-bool {
    color: #1a1a1a !important;
  }
  .tk-cmt { color: #888 !important; font-style: italic; }

  a { color: #0d2238 !important; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 8pt; color: #666; }
  a[href^="#"]::after, a[href^="/"]::after { content: ""; }

  img, .cs-shot-real img {
    max-width: 100% !important;
    page-break-inside: avoid;
    border: 1px solid #ddd !important;
  }
  figure { page-break-inside: avoid; }
  figcaption { color: #555 !important; font-size: 9pt; }
  .cs-shot-real .tag {
    background: #ffeb3b !important;
    color: #1a1a1a !important;
    padding: 1pt 4pt;
    border-radius: 2pt;
    font-size: 8pt;
  }

  @page { margin: 0.6in; }
}

/* =======================================================
 *  Viewport HUD — see /css/tech-fx.css for the canonical
 *  definition (same component, duplicated here so case
 *  studies don't have to pull tech-fx.css just for this).
 * ======================================================= */
.viewport-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}
.viewport-hud__corner {
  position: absolute;
  width: 38px;
  height: 38px;
  border: 2px solid var(--cyan);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--cyan) 55%, transparent));
  opacity: 0.62;
  animation: viewport-hud-breathe 5.5s ease-in-out infinite;
}
.viewport-hud__corner--tl { top: 14px;    left: 14px;   border-right: none; border-bottom: none; }
.viewport-hud__corner--tr { top: 14px;    right: 14px;  border-left: none;  border-bottom: none; }
.viewport-hud__corner--bl { bottom: 14px; left: 14px;   border-right: none; border-top: none;    }
.viewport-hud__corner--br { bottom: 14px; right: 14px;  border-left: none;  border-top: none;    }
.viewport-hud__corner::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--cyan);
}
.viewport-hud__corner--tl::after { top: -4px; left: -4px; }
.viewport-hud__corner--tr::after { top: -4px; right: -4px; }
.viewport-hud__corner--bl::after { bottom: -4px; left: -4px; }
.viewport-hud__corner--br::after { bottom: -4px; right: -4px; }
@keyframes viewport-hud-breathe {
  0%, 100% { opacity: 0.5; filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.4)); }
  50%      { opacity: 0.85; filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.7)); }
}
/* (viewport-hud__readout removed; the existing .hud widget on index
   already covers system info. Case studies use the standalone
   motion-toggle below instead.) */

.motion-toggle--standalone {
  position: fixed;
  top: 60px;
  right: 22px;
  z-index: 65;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(0, 229, 255, 0.7);
  background: rgba(8, 12, 28, 0.85);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 3px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.motion-toggle--standalone:hover {
  border-color: var(--line-strong);
  color: var(--cyan);
}
.motion-toggle--standalone:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.motion-toggle--standalone[aria-pressed="true"] {
  border-color: rgba(255, 144, 0, 0.45);
  color: var(--brand);
}
.motion-toggle__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7cff8c;
  box-shadow: 0 0 6px #7cff8c;
}
.motion-toggle[aria-pressed="true"] .motion-toggle__dot {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}
@media (max-width: 640px) {
  .motion-toggle--standalone { display: none; }
}

/* NUCLEAR REDUCED-MOTION — when data-motion="reduced" is set on the
   root (toggled by motion-toggle, persisted to localStorage),
   disable all animations everywhere. Transitions stay alive so
   hover effects still feel responsive. */
:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .viewport-hud__corner { animation: none; }
}
@media (max-width: 640px) {
  .viewport-hud { display: none; }
}
@media print {
  .viewport-hud { display: none !important; }
}

/* =========================================================================
   PALETTE OVERRIDES — match what the index theme picker applies.
   Activated by :root.theme-{matrix,sunset,xeno} on <html> (FOUC-safe).
   ========================================================================= */
:root.theme-matrix {
  --cyan: #00ff7c;
  --cyan-dim: #08b85d;
  --line: rgba(0, 255, 124, 0.22);
  --line-strong: rgba(0, 255, 124, 0.5);
  --glow-cyan: 0 0 12px rgba(0, 255, 124, 0.6), 0 0 30px rgba(0, 255, 124, 0.25);
}
:root.theme-sunset {
  --cyan: #ff2bd6;
  --cyan-dim: #c41fa3;
  --line: rgba(255, 43, 214, 0.22);
  --line-strong: rgba(255, 43, 214, 0.5);
  --glow-cyan: 0 0 12px rgba(255, 43, 214, 0.6), 0 0 30px rgba(255, 43, 214, 0.25);
  --brand: #ffaa00;
}
:root.theme-xeno {
  --cyan: #ff1840;
  --cyan-dim: #b80c2a;
  --line: rgba(255, 24, 64, 0.22);
  --line-strong: rgba(255, 24, 64, 0.55);
  --glow-cyan: 0 0 12px rgba(255, 24, 64, 0.6), 0 0 30px rgba(255, 24, 64, 0.25);
  --brand: #00ff85;
  --magenta: #c050ff;
}
:root.theme-crt {
  --cyan: #33ff33;
  --cyan-dim: #28b428;
  --line: rgba(51, 255, 51, 0.22);
  --line-strong: rgba(51, 255, 51, 0.55);
  --glow-cyan: 0 0 12px rgba(51, 255, 51, 0.6), 0 0 28px rgba(51, 255, 51, 0.25);
  --brand: #ffb400;
  --magenta: #33ff33;
}
:root.theme-arcade {
  --cyan: #ffcc00;
  --cyan-dim: #c79a00;
  --line: rgba(255, 204, 0, 0.28);
  --line-strong: rgba(255, 204, 0, 0.6);
  --glow-cyan: 3px 3px 0 rgba(0, 0, 0, 0.55);
  --brand: #ff3864;
  --magenta: #00a8ff;
}
/* Arcade skin (case studies): cabinet violet bg + static scanlines */
:root.theme-arcade body {
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(0, 168, 255, 0.08), transparent 60%),
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(255, 56, 100, 0.07), transparent 60%),
    #0d0221 !important;
}
:root.theme-arcade body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(0, 0, 0, 0.10) 0,
    rgba(0, 0, 0, 0.10) 1px,
    transparent 1px,
    transparent 4px);
}

/* CRT skin (case studies): scanlines + vignette + sharp corners + phosphor text */
:root.theme-crt body {
  background:
    radial-gradient(ellipse 90% 70% at 50% 50%, rgba(0, 60, 0, 0.35), transparent 80%),
    radial-gradient(circle at 50% 50%, #001500 0%, #000400 90%) !important;
  color: #aaffaa !important;
}
:root.theme-crt body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.28) 2px,
    rgba(0,0,0,0.28) 3px);
  mix-blend-mode: multiply;
  opacity: 0.7;
}
:root.theme-crt .cs-wrap::after {
  /* vignette */
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9996;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.72) 100%);
}
:root.theme-crt .cs-section,
:root.theme-crt .cs-metrics--top,
:root.theme-crt .cs-metric,
:root.theme-crt .cs-toc,
:root.theme-crt .cs-cta,
:root.theme-crt .cs-pager__link,
:root.theme-crt .cs-btn,
:root.theme-crt .cs-chip { border-radius: 0 !important; }
:root.theme-crt .cs-hero h1 {
  text-shadow:
    -1px 0 rgba(255, 80, 80, 0.4),
    1px 0 rgba(80, 200, 255, 0.35),
    0 0 14px rgba(51, 255, 51, 0.7) !important;
}
:root.theme-crt .cs-section h2,
:root.theme-crt .cs-metric__v,
:root.theme-crt .cs-meta__v {
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.55) !important;
}
@media (prefers-reduced-motion: reduce) {
  :root.theme-crt body::after { opacity: 0.4; }
}

/* =========================================================================
   XENO DEEP-SKIN — mirrors the index xeno-skin so the case study reads as
   the same intercepted-transmission UI, not just a recolor.
   ========================================================================= */
:root.theme-xeno {
  background: #02000a;
}
:root.theme-xeno body {
  background:
    radial-gradient(ellipse 80% 50% at 18% 12%, rgba(192, 80, 255, 0.10), transparent 55%),
    radial-gradient(ellipse 60% 40% at 82% 30%, rgba(255, 24, 64, 0.09), transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 85%, rgba(0, 255, 133, 0.06), transparent 60%),
    radial-gradient(circle at 50% 50%, #050108 0%, #02000a 70%) !important;
}
/* Starfield layered pseudo-elements — note: case-study.css has its own
   body::before for the grid lattice; we use body::after only here and rely
   on the existing ::before getting recolored via vars. */
:root.theme-xeno body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 255, 133, 0.5) 1px, transparent 1px);
  background-size: 470px 470px;
  background-position: 80px 110px;
  opacity: 0.25;
  animation: xeno-cs-drift 90s linear infinite;
}
@keyframes xeno-cs-drift {
  to { background-position: 880px 990px; }
}
/* Global scan beam (top → bottom every 14s) on the case-study main */
:root.theme-xeno .cs-wrap {
  position: relative;
  z-index: 1;
}
:root.theme-xeno .cs-wrap::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: -120px;
  height: 120px;
  z-index: 9998;
  pointer-events: none;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(255, 24, 64, 0.06) 40%,
    rgba(255, 24, 64, 0.14) 50%,
    rgba(255, 24, 64, 0.06) 60%,
    transparent 100%);
  box-shadow: 0 0 32px rgba(255, 24, 64, 0.35);
  animation: xeno-cs-scan 14s linear infinite;
}
@keyframes xeno-cs-scan {
  0%   { transform: translateY(0); opacity: 0; }
  6%   { opacity: 1; }
  94%  { opacity: 1; }
  100% { transform: translateY(110vh); opacity: 0; }
}

/* -- Hero: corner-bracket reticles + glitch h1 -- */
:root.theme-xeno .cs-hero {
  position: relative;
}
:root.theme-xeno .cs-hero::before,
:root.theme-xeno .cs-hero::after {
  content: '';
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 24, 64, 0.55);
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255, 24, 64, 0.5));
}
:root.theme-xeno .cs-hero::before {
  top: -8px;
  left: -8px;
  border-right: 0;
  border-bottom: 0;
}
:root.theme-xeno .cs-hero::after {
  bottom: -8px;
  right: -8px;
  border-left: 0;
  border-top: 0;
}
:root.theme-xeno .cs-hero h1 {
  text-shadow:
    -1px 0 rgba(255, 24, 64, 0.6),
    2px 0 rgba(0, 255, 133, 0.45),
    0 0 18px rgba(255, 24, 64, 0.4) !important;
}

/* -- Tech chips + meta: hostile-tech red bordered, corner-cut -- */
:root.theme-xeno .cs-chip {
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
  border-radius: 0 !important;
  border-color: rgba(255, 24, 64, 0.4) !important;
  background: rgba(255, 24, 64, 0.06) !important;
  color: #ffb0bf !important;
}
:root.theme-xeno .cs-meta {
  border-color: rgba(255, 24, 64, 0.25) !important;
}
:root.theme-xeno .cs-meta__k { color: rgba(255, 128, 148, 0.7) !important; }

/* -- Top metrics block: red intrusion-alert frame -- */
:root.theme-xeno .cs-metrics--top {
  background: linear-gradient(180deg, rgba(255, 24, 64, 0.05), rgba(10, 0, 16, 0.55)) !important;
  border-color: rgba(255, 24, 64, 0.35) !important;
}
:root.theme-xeno .cs-metric {
  background: linear-gradient(180deg, #16000a, #0a0008) !important;
  border-color: rgba(255, 24, 64, 0.22) !important;
}
:root.theme-xeno .cs-metric__v {
  color: #ff1840 !important;
  text-shadow: 0 0 12px rgba(255, 24, 64, 0.55) !important;
}

/* -- Section panels: hostile chrome -- */
:root.theme-xeno .cs-section {
  border-color: rgba(255, 24, 64, 0.2);
}
:root.theme-xeno .cs-section h2 {
  color: #fff !important;
  text-shadow:
    -1px 0 rgba(255, 24, 64, 0.6),
    2px 0 rgba(0, 255, 133, 0.35),
    0 0 14px rgba(255, 24, 64, 0.4) !important;
}
:root.theme-xeno .cs-section__label {
  color: #ff8094 !important;
  letter-spacing: 2px;
}

/* -- TOC: red treatment, sticky scope feel -- */
:root.theme-xeno .cs-toc {
  background: rgba(8, 0, 12, 0.85) !important;
  border-color: rgba(255, 24, 64, 0.35) !important;
}
:root.theme-xeno .cs-toc__label { color: #ff8094 !important; }
:root.theme-xeno .cs-toc__nav a {
  color: rgba(255, 176, 191, 0.7);
}
:root.theme-xeno .cs-toc__nav a:hover,
:root.theme-xeno .cs-toc__nav a.is-active {
  color: #ff1840 !important;
  text-shadow: 0 0 6px rgba(255, 24, 64, 0.5);
}

/* -- Buttons: angular clip-path matching the index xeno chevrons -- */
:root.theme-xeno .cs-btn--primary {
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
  border-radius: 0 !important;
  letter-spacing: 2px !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg, #ff1840, #c050ff) !important;
  color: #fff !important;
}
:root.theme-xeno .cs-btn--ghost {
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  border-radius: 0 !important;
  letter-spacing: 1.6px !important;
  border-color: rgba(255, 24, 64, 0.5) !important;
  color: #ff8094 !important;
}

/* -- Status pills (LIVE / DRAFT / PLANNED) — red treatment -- */
:root.theme-xeno .case-status--live {
  background: rgba(0, 255, 133, 0.08) !important;
  border-color: rgba(0, 255, 133, 0.5) !important;
  color: #00ff85 !important;
  text-shadow: 0 0 6px rgba(0, 255, 133, 0.5);
}

/* -- CTA block & pager -- */
:root.theme-xeno .cs-cta {
  border-color: rgba(255, 24, 64, 0.35) !important;
  background: rgba(8, 0, 12, 0.7) !important;
}
:root.theme-xeno .cs-pager__link {
  border-color: rgba(255, 24, 64, 0.25) !important;
  background: rgba(8, 0, 12, 0.4);
}
:root.theme-xeno .cs-pager__link:hover {
  border-color: rgba(255, 24, 64, 0.6) !important;
  box-shadow: 0 0 20px rgba(255, 24, 64, 0.18);
}

/* -- OG preview frame: red border (intercepted card) -- */
:root.theme-xeno .cs-og-preview__frame {
  border-color: rgba(255, 24, 64, 0.5) !important;
  box-shadow: 0 0 24px rgba(255, 24, 64, 0.18);
}

/* -- Outcomes block (BEFORE/AFTER) override: red label, deeper void rows -- */
:root.theme-xeno .cs-outcomes--top {
  background: linear-gradient(180deg, rgba(255, 24, 64, 0.06), rgba(10, 0, 16, 0.55)) !important;
  border-color: rgba(255, 24, 64, 0.35) !important;
}
:root.theme-xeno .cs-outcomes--top .cs-outcomes__label { color: #ff8094 !important; }
:root.theme-xeno .cs-outcome-row {
  background: linear-gradient(180deg, #16000a, #0a0008) !important;
  border-color: rgba(255, 24, 64, 0.25) !important;
}
:root.theme-xeno .cs-outcome-row__tag--after {
  color: #00ff85 !important;
  text-shadow: 0 0 6px rgba(0, 255, 133, 0.5);
}

/* -- Custom cursor: matching scope-reticle (desktop only) -- */
:root.theme-xeno body {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><circle cx='16' cy='16' r='12' fill='none' stroke='%23ff1840' stroke-width='1.5' stroke-opacity='0.85'/><circle cx='16' cy='16' r='1.5' fill='%23ff1840'/><line x1='16' y1='4' x2='16' y2='10' stroke='%23ff1840' stroke-width='1.5'/><line x1='16' y1='22' x2='16' y2='28' stroke='%23ff1840' stroke-width='1.5'/><line x1='4' y1='16' x2='10' y2='16' stroke='%23ff1840' stroke-width='1.5'/><line x1='22' y1='16' x2='28' y2='16' stroke='%23ff1840' stroke-width='1.5'/></svg>") 16 16, crosshair;
}
:root.theme-xeno a,
:root.theme-xeno button,
:root.theme-xeno [role="button"],
:root.theme-xeno summary { cursor: pointer; }
:root.theme-xeno input,
:root.theme-xeno textarea,
:root.theme-xeno select { cursor: text; }
@media (hover: none) {
  :root.theme-xeno body { cursor: auto; }
}

@media (prefers-reduced-motion: reduce) {
  :root.theme-xeno body::after,
  :root.theme-xeno .cs-wrap::before { animation: none !important; }
}
@media (max-width: 768px) {
  :root.theme-xeno body::after { display: none; }
  :root.theme-xeno .cs-wrap::before { display: none; }
  :root.theme-xeno .cs-hero::before,
  :root.theme-xeno .cs-hero::after { width: 32px; height: 32px; }
}

/* ============================================================================
   PAGE DIVE — mirrored from tech-fx.css so case-study pages can play the
   same transition. Style.css provides the motion tokens; this file just
   provides the dive keyframes + animation hookups.
   ============================================================================ */
body.page-dive-out {
  pointer-events: none;
  animation: page-dive-out var(--tx-stage, 1.1s) var(--ez-in, cubic-bezier(0.7, 0, 0.84, 0)) forwards;
  transform-origin: 50% 30%;
  perspective: 1400px;
}
@keyframes page-dive-out {
  0%   { transform: perspective(1400px) translateZ(0) rotateX(0deg); opacity: 1; filter: blur(0); }
  100% { transform: perspective(1400px) translateZ(420px) rotateX(6deg); opacity: 0; filter: blur(6px); }
}

body.page-dive-in {
  animation: page-dive-in var(--tx-stage, 1.1s) var(--ez-out, cubic-bezier(0.2, 0.9, 0.2, 1)) both;
  transform-origin: 50% 70%;
  perspective: 1400px;
}
@keyframes page-dive-in {
  0%   { transform: perspective(1400px) translateZ(-420px) rotateX(-6deg); opacity: 0; filter: blur(6px); }
  100% { transform: perspective(1400px) translateZ(0)      rotateX(0deg);  opacity: 1; filter: blur(0); }
}

.page-dive-flash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--cyan, #00e5ff) 35%, transparent) 0%, transparent 60%),
    rgba(3, 5, 12, 0);
  opacity: 0;
  animation: dive-flash var(--tx-stage, 1.1s) var(--ez-out, cubic-bezier(0.2, 0.9, 0.2, 1)) forwards;
}
@keyframes dive-flash {
  0%   { opacity: 0;   transform: scale(0.6); }
  40%  { opacity: 0.9; }
  100% { opacity: 0;   transform: scale(1.8); }
}

@media (prefers-reduced-motion: reduce) {
  body.page-dive-out, body.page-dive-in { animation: none; }
  .page-dive-flash { display: none; }
}

/* ============================================================================
   3D ON CASE-STUDY PAGES — mirrored from tech-fx.css with case-study-
   specific selectors. Keeps the visual language consistent after a dive:
   spotlight, card tilt, scroll-reveal, heading entries, chip + button 3D.
   ============================================================================ */

/* -- Global cursor spotlight -- */
html.has-spotlight::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  /* Same perf-fix as tech-fx.css — dropped mix-blend-mode + will-change
     because they were the single biggest idle-state fps cost (continuous
     viewport recomposite forced by underlying animations). */
  background: radial-gradient(
    circle 260px at var(--spot-x, 50vw) var(--spot-y, 50vh),
    color-mix(in srgb, var(--cyan) 14%, transparent) 0%,
    transparent 65%
  );
  transition: opacity 0.4s var(--ez-soft);
}
:root[data-theme="light"].has-spotlight::before {
  background: radial-gradient(
    circle 320px at var(--spot-x, 50vw) var(--spot-y, 50vh),
    color-mix(in srgb, var(--brand) 14%, transparent) 0%,
    color-mix(in srgb, var(--brand) 5%, transparent) 28%,
    transparent 70%
  );
}

/* -- Magnetic 3D tilt for case-study cards -- */
.cs-tilt3d {
  transform-style: preserve-3d;
  transform: perspective(900px)
             rotateX(var(--tilt-rx, 0deg))
             rotateY(var(--tilt-ry, 0deg))
             translateZ(var(--tilt-z, 0px));
  transition: transform var(--tx-base) var(--ez-out),
              box-shadow var(--tx-base) var(--ez-out);
  /* will-change moved to :hover — see tech-fx.css comment for rationale */
  position: relative;
}
.cs-tilt3d:hover { will-change: transform; }
.cs-tilt3d::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--tilt-gx, 50%) var(--tilt-gy, 50%),
              color-mix(in srgb, var(--cyan) 22%, transparent) 0%,
              transparent 45%);
  opacity: 0;
  transition: opacity var(--tx-fast) var(--ez-soft);
  mix-blend-mode: screen;
  z-index: 1;
}
.cs-tilt3d:hover::after { opacity: 0.7; }
.cs-tilt3d:hover { transition: transform var(--tx-instant) linear; }
.cs-tilt3d > * { transform-style: preserve-3d; }

/* -- 3D scroll reveal for case-study sections -- */
.cs-reveal3d {
  opacity: 0;
  transform: perspective(1200px) translate3d(0, 40px, -180px) rotateX(-10deg);
  transition: opacity var(--tx-slow) var(--ez-out),
              transform var(--tx-stage) var(--ez-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.cs-reveal3d.cs-reveal3d-in {
  opacity: 1;
  transform: perspective(1200px) translate3d(0, 0, 0) rotateX(0deg);
  will-change: auto;
}
/* A11y focus rescue */
.cs-reveal3d:focus-within,
.cs-reveal3d:has(:focus-visible) {
  opacity: 1;
  transform: none;
}

/* -- 3D heading entry for case-study section headings -- */
.cs-heading3d {
  display: inline-block;
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateY(-30deg) translateZ(-200px) translateX(-40px);
  opacity: 0;
  transition: transform var(--tx-stage) var(--ez-back),
              opacity var(--tx-slow) var(--ez-out);
  will-change: transform, opacity;
}
.cs-heading3d.cs-heading3d-in {
  transform: perspective(1000px) rotateY(0deg) translateZ(0) translateX(0);
  opacity: 1;
  will-change: auto;
}
.cs-heading3d:focus,
.cs-heading3d:focus-visible {
  opacity: 1;
  transform: none;
}

/* -- 3D chip hover -- */
.cs-chip {
  transform-style: preserve-3d;
  transition: transform var(--tx-base) var(--ez-back),
              box-shadow var(--tx-base) var(--ez-out),
              background var(--tx-fast) var(--ez-soft);
  will-change: transform;
}
.cs-chip:hover {
  transform: perspective(600px) translateZ(8px) rotateY(-4deg);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--cyan) 28%, transparent),
              0 2px 6px rgba(0, 0, 0, 0.4);
}

/* -- 3D button hover -- */
.cs-btn {
  transform-style: preserve-3d;
  transition: transform var(--tx-base) var(--ez-back),
              box-shadow var(--tx-base) var(--ez-out);
  will-change: transform;
}
.cs-btn--primary:hover {
  transform: perspective(800px) translateZ(18px) translateY(-3px) rotateX(6deg);
  box-shadow: 0 16px 44px color-mix(in srgb, var(--brand) 42%, transparent),
              0 3px 10px rgba(0, 0, 0, 0.5);
}
.cs-btn--ghost:hover {
  transform: perspective(800px) translateZ(10px) translateY(-2px);
}

/* -- 3D pager (prev/next case-study) lift on hover -- */
.cs-pager__link {
  transform-style: preserve-3d;
  transition: transform var(--tx-base) var(--ez-back),
              box-shadow var(--tx-base) var(--ez-out);
  will-change: transform;
}
.cs-pager__link:hover {
  transform: perspective(900px) translateZ(20px) rotateY(var(--pager-rot, 0deg));
  box-shadow: 0 18px 50px color-mix(in srgb, var(--cyan) 30%, transparent),
              0 4px 12px rgba(0, 0, 0, 0.5);
}
.cs-pager__prev:hover { --pager-rot: 4deg; }
.cs-pager__next:hover { --pager-rot: -4deg; }

@media (prefers-reduced-motion: reduce) {
  html.has-spotlight::before { display: none; }
  .cs-tilt3d { transition: none; transform: none; }
  .cs-reveal3d { opacity: 1; transform: none; }
  .cs-heading3d { opacity: 1; transform: none; }
  .cs-chip:hover, .cs-btn:hover, .cs-pager__link:hover { transform: none; }
}
@media (hover: none) {
  .cs-tilt3d { transform: none !important; }
  .cs-tilt3d::after { display: none; }
}

/* ============================================================================
   READING PROGRESS BAR — fixed top-of-viewport horizontal bar that fills
   as the user scrolls. Hidden at the very top of the page (cleaner look);
   appears with a quick fade once the reader starts moving.
   ============================================================================ */
.cs-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 99995;
  pointer-events: none;
  background: color-mix(in srgb, var(--cyan) 8%, transparent);
  opacity: 0;
  transition: opacity var(--tx-fast) var(--ez-soft);
}
.cs-progress.is-active { opacity: 1; }
.cs-progress__fill {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--cyan) 40%, transparent) 0%,
    var(--cyan) 60%,
    color-mix(in srgb, var(--brand) 80%, transparent) 100%);
  box-shadow:
    0 0 6px color-mix(in srgb, var(--cyan) 70%, transparent),
    0 0 16px color-mix(in srgb, var(--cyan) 35%, transparent);
  /* No transition — JS updates scaleX every RAF tick during scroll, and
     we want the bar to track the wheel precisely without easing lag. */
}

/* ============================================================================
   TOC ANCHOR PULSE — when a TOC link is clicked, the destination section
   briefly pulses with a cyan outline glow so the reader sees exactly
   where they landed. Uses outline + box-shadow rather than transform so
   it doesn't fight any 3D heading entry already animating.
   ============================================================================ */
.is-pulse-target {
  animation: cs-toc-pulse 1.4s var(--ez-out);
}
@keyframes cs-toc-pulse {
  0% {
    outline: 1px solid color-mix(in srgb, var(--cyan) 0%, transparent);
    outline-offset: 0;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--cyan) 0%, transparent);
  }
  15% {
    outline: 1px solid color-mix(in srgb, var(--cyan) 80%, transparent);
    outline-offset: 8px;
    box-shadow:
      0 0 0 8px color-mix(in srgb, var(--cyan) 12%, transparent),
      0 0 32px color-mix(in srgb, var(--cyan) 35%, transparent);
  }
  100% {
    outline: 1px solid color-mix(in srgb, var(--cyan) 0%, transparent);
    outline-offset: 20px;
    box-shadow: 0 0 0 24px color-mix(in srgb, var(--cyan) 0%, transparent);
  }
}
/* Some browsers don't animate `outline` reliably; the box-shadow alone
   carries the pulse on those. */
@media (prefers-reduced-motion: reduce) {
  .cs-progress { display: none; }
  .is-pulse-target { animation: none; }
}

/* Scroll-state perf — see tech-fx.css for the rationale. JS in
   case-study.js toggles html.is-scrolling for the same 150ms-debounced
   window during which expensive paint ops are suppressed. */
html.is-scrolling.has-spotlight::before { opacity: 0; }
html.is-scrolling .cs-tilt3d::after { opacity: 0; }
html.is-scrolling .cs-heading3d { text-shadow: none; }

/* Browser-native render skipping. Each cs-section is 400-1200px tall;
   when far from viewport the browser skips it entirely. Combined with
   contain-intrinsic-size to keep the scrollbar stable. */
.cs-section {
  content-visibility: auto;
  contain-intrinsic-size: 0 800px;
}
/* Self-contained cards — paint scope locked in */
.cs-metric,
.cs-code,
.cs-og-preview,
.cs-cta,
.cs-pager__link,
.cs-shot-real,
.cs-outcome-row {
  contain: content;
}

/* =========================================================================
   ARCADE DEEP PASS (case-study layout — also /now, /uses, /changelog).
   Mirrors the index deep pass: square pixel hardware, VT323 body type,
   Press Start 2P display type, hard shadows. Static only.
   ========================================================================= */
:root.theme-arcade *,
:root.theme-arcade *::before,
:root.theme-arcade *::after {
  border-radius: 0 !important;
}
:root.theme-arcade body { font-family: 'VT323', 'JetBrains Mono', monospace; }
:root.theme-arcade p,
:root.theme-arcade li,
:root.theme-arcade td, :root.theme-arcade th,
:root.theme-arcade dd, :root.theme-arcade dt,
:root.theme-arcade blockquote, :root.theme-arcade figcaption,
:root.theme-arcade .uses-list, :root.theme-arcade .log-summary,
:root.theme-arcade .now-meta {
  font-family: 'VT323', 'JetBrains Mono', monospace !important;
  font-size: 17px;
  line-height: 1.55;
}
:root.theme-arcade code, :root.theme-arcade pre {
  font-family: 'VT323', 'JetBrains Mono', monospace !important;
  font-size: 16px;
}
:root.theme-arcade .cs-hero h1,
:root.theme-arcade h1 {
  font-family: 'Press Start 2P', 'JetBrains Mono', monospace !important;
  font-size: clamp(15px, 2.8vw, 28px) !important;
  letter-spacing: 1px !important;
  line-height: 1.6 !important;
  color: #ffcc00 !important;
  text-shadow: 3px 3px 0 rgba(255, 56, 100, 0.85), 5px 5px 0 rgba(0, 0, 0, 0.5) !important;
}
:root.theme-arcade h2 {
  font-family: 'Press Start 2P', 'JetBrains Mono', monospace !important;
  font-size: clamp(11px, 1.8vw, 17px) !important;
  letter-spacing: 1px !important;
  line-height: 1.8 !important;
}
:root.theme-arcade .cs-hero__label,
:root.theme-arcade .cs-section__label,
:root.theme-arcade .cs-nav__brand,
:root.theme-arcade .cs-nav__breadcrumb,
:root.theme-arcade .cs-btn,
:root.theme-arcade .uses-card__icon,
:root.theme-arcade .uses-card__title,
:root.theme-arcade .log-version,
:root.theme-arcade .log-tag,
:root.theme-arcade .log-date,
:root.theme-arcade .now-status,
:root.theme-arcade .now-stamp,
:root.theme-arcade .cs-toc__nav {
  font-family: 'Press Start 2P', 'JetBrains Mono', monospace !important;
  font-size: 9px !important;
  letter-spacing: 1px !important;
  line-height: 1.9 !important;
}

/* Dialog-box chrome on the card surfaces */
:root.theme-arcade .cs-metric,
:root.theme-arcade .cs-code,
:root.theme-arcade .cs-og-preview,
:root.theme-arcade .cs-cta,
:root.theme-arcade .uses-card,
:root.theme-arcade .cs-toc {
  border: 3px solid rgba(255, 204, 0, 0.45) !important;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45) !important;
}
:root.theme-arcade .cs-btn {
  border: 3px solid currentColor !important;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6) !important;
}
:root.theme-arcade .cs-btn:active {
  transform: translate(3px, 3px) !important;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6) !important;
}
:root.theme-arcade .cs-nav {
  border-bottom: 3px solid rgba(255, 204, 0, 0.4) !important;
  backdrop-filter: none !important;
}
:root.theme-arcade ::selection { background: #ffcc00; color: #0d0221; text-shadow: none; }
:root.theme-arcade :focus-visible {
  outline: 3px solid #ffcc00 !important;
  outline-offset: 2px !important;
}

/* -- Readability polish (arcade): same floors as the index ---------------- */
:root.theme-arcade p,
:root.theme-arcade li,
:root.theme-arcade blockquote {
  font-size: 18px;
  line-height: 1.6;
  color: rgba(238, 240, 255, 0.92);
}
:root.theme-arcade .log-date,
:root.theme-arcade .now-meta,
:root.theme-arcade .cs-hero__tagline {
  color: rgba(230, 235, 255, 0.78) !important;
}
:root.theme-arcade .log-summary { color: rgba(238, 240, 255, 0.9) !important; }
:root.theme-arcade code { font-size: 17px; }
