/* Cool Mechatronics — production UI */

:root {
  /* Light fintech palette — inspired by clean white landings (e.g. 0xProcessing) */
  --bg-deep: #eef2f6;
  --bg: #ffffff;
  --bg-elevated: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --logo-ink: rgb(24, 42, 82);
  --accent: #2563eb;
  --accent-soft: #3b82f6;
  --accent-deep: #1d4ed8;
  --accent-dim: rgba(37, 99, 235, 0.1);
  --accent-glow: rgba(37, 99, 235, 0.14);
  --accent-line: linear-gradient(90deg, var(--accent-soft), var(--accent) 52%, rgba(37, 99, 235, 0.18));
  --warn: #d97706;
  --warn-bg: rgba(251, 191, 36, 0.2);
  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font-display: "Outfit", system-ui, -apple-system, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;
  --max: 1140px;
  --prose: 42rem;
  /* Doc volume pages: width = min(percentage of section, site max). Raise/lower % to taste. */
  --doc-column-width-pct: 65%;
  --header-h: 78px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 0 48px rgba(37, 99, 235, 0.06);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --space-xs: 0.35rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

/* Lockup mark image uses explicit width — avoid flex shrink from max-width:100% */
img:not(.logo__mark-img),
video {
  max-width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /* Only soften transitions — avoid nuking all @keyframes (feels “broken” on navigation) */
  * {
    transition-duration: 0.01ms !important;
  }

  main#main {
    animation: none !important;
  }

  .site-header {
    animation: none !important;
  }

  .site-header::after {
    animation: none !important;
    opacity: 0.45;
  }
}

::selection {
  background: rgba(37, 99, 235, 0.18);
  color: var(--text);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-secondary);
  background: var(--bg-deep);
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main {
  flex: 1 0 auto;
  overflow-x: clip;
  animation: page-enter 0.42s var(--ease-out) both;
}

/* Soft hero wash + airy background (white landing) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 55% at 50% -18%, rgba(37, 99, 235, 0.07), transparent 58%),
    radial-gradient(ellipse 52% 42% at 100% 0%, rgba(99, 102, 241, 0.06), transparent 52%),
    radial-gradient(ellipse 48% 38% at 0% 100%, rgba(14, 165, 233, 0.05), transparent 48%),
    linear-gradient(180deg, #ffffff 0%, var(--bg-deep) 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.site-header,
main,
.site-footer,
.site-nav-overlay {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent-soft);
  text-decoration: none;
  transition: color 0.15s var(--ease-out);
}

a:hover {
  color: var(--accent-deep);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 10px 18px;
  background: var(--surface);
  z-index: 1000;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

/* ——— Header: settle-up entrance + scroll elevation ——— */
@keyframes site-header-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes site-header-line-draw {
  from {
    opacity: 0;
    transform: scaleX(0.12);
  }

  to {
    opacity: 0.45;
    transform: scaleX(1);
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(1.15);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  animation: site-header-rise 0.72s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition:
    background 0.45s var(--ease-out),
    box-shadow 0.45s var(--ease-out),
    border-color 0.45s var(--ease-out),
    backdrop-filter 0.45s var(--ease-out);
}

.site-header--scrolled {
  background: rgba(255, 255, 255, 0.97);
  border-bottom-color: rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(22px) saturate(1.35);
  box-shadow:
    0 10px 40px rgba(15, 23, 42, 0.09),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.22), transparent);
  opacity: 0.4;
  transform-origin: 50% 50%;
  transform: scaleX(1);
  animation: site-header-line-draw 0.85s var(--ease-out) 0.2s both;
  transition: opacity 0.45s var(--ease-out);
  pointer-events: none;
}

.site-header--scrolled::after {
  animation: none;
  opacity: 1;
  transform: scaleX(1);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(0.75rem, 3.5vw, 1.65rem);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem 0.75rem;
  flex-shrink: 1;
  min-width: 0;
  margin-left: -2rem;
  margin-right: 0.25rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--logo-ink);
  text-decoration: none;
  transition: opacity 0.2s var(--ease-out);
}

.logo__mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.logo__mark-img {
  display: block;
  width: clamp(40px, 7.5vw, 56px);
  height: auto;
  max-height: clamp(40px, 7.5vw, 56px);
  object-fit: contain;
  object-position: left center;
}

.logo__lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.1rem;
  line-height: 1.15;
  min-width: 0;
}

.logo__name {
  font-size: clamp(0.8rem, 1.65vw, 1.02rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--logo-ink);
  white-space: nowrap;
}

.logo__accent {
  color: var(--logo-ink);
  font-weight: 800;
}

.logo__tag {
  font-size: clamp(0.54rem, 1.15vw, 0.68rem);
  font-weight: 500;
  color: var(--logo-ink);
  letter-spacing: 0.02em;
  line-height: 1.35;
  max-width: min(24rem, 46vw);
}

.logo:hover {
  opacity: 0.9;
}

.logo:hover .logo__accent {
  color: var(--logo-ink);
}

.footer-brand .logo__mark-img {
  width: clamp(48px, 10vw, 64px);
  max-height: clamp(48px, 10vw, 64px);
}

.footer-brand .logo__name {
  font-size: clamp(0.88rem, 1.9vw, 1.08rem);
}

.footer-brand .logo__tag {
  font-size: clamp(0.58rem, 1.2vw, 0.72rem);
  max-width: 18rem;
}

@media (max-width: 640px) {
  :root {
    --header-h: 86px;
  }

  .logo__name {
    white-space: normal;
  }

  .logo__tag {
    max-width: 12.5rem;
    white-space: normal;
  }
}

.logo-mark {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  color: var(--accent);
}

.logo-text span {
  color: var(--accent-soft);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), color 0.2s;
}

.nav-toggle:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: var(--surface-hover);
}

.nav-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-toggle-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}

.nav-toggle-icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s var(--ease-out), opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
  align-items: center;
}

.site-nav .nav-group {
  position: relative;
}

.site-nav .nav-group > .nav-group__toggle::after {
  content: "▾";
  margin-left: 0.35rem;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1;
  opacity: 0.7;
}

.site-nav .nav-submenu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  min-width: 14rem;
  padding: 0.45rem;
  display: grid;
  gap: 0.15rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  z-index: 120;
}

.site-nav .nav-group:hover > .nav-submenu,
.site-nav .nav-group:focus-within > .nav-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.site-nav .nav-submenu a {
  display: block;
  padding: 0.5rem 0.65rem;
  white-space: nowrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-xs);
  transition: color 0.35s var(--ease-out), background 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.site-nav a:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}

.site-nav a[aria-current="page"]:not(.btn) {
  color: var(--accent-deep);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.22);
}

.site-nav .btn-primary[aria-current="page"] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(37, 99, 235, 0.35),
    0 1px 2px rgba(15, 23, 42, 0.12);
}

.nav-cta {
  margin-left: 0.35rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}

.btn:active {
  transform: translateY(1px);
}

/* Primary CTA — crisp blue (fintech / landing style) */
.btn-primary {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.015em;
  border-radius: 8px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 45%, #1d4ed8 100%);
  border: 1px solid #1e40af;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(15, 23, 42, 0.1),
    0 2px 6px rgba(37, 99, 235, 0.2);
}

.btn-primary:visited {
  color: #ffffff;
}

.btn-primary:hover {
  color: #fff;
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 42%, #2563eb 100%);
  border-color: #1d4ed8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(15, 23, 42, 0.1),
    0 4px 12px rgba(37, 99, 235, 0.22);
}

.btn-primary:active {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  border-color: #172554;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 1px rgba(15, 23, 42, 0.12);
}

.btn-primary:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.95);
  outline-offset: 2px;
}

.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn .btn-arrow {
  font-size: 1.1em;
  line-height: 1;
  transition: transform 0.2s var(--ease-out);
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* Mobile overlay */
.site-nav-overlay {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease-out);
}

.site-nav-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ——— Breadcrumb ——— */
.breadcrumb {
  margin-bottom: var(--space-lg);
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.breadcrumb__sep {
  color: rgba(15, 23, 42, 0.22);
  font-weight: 500;
  user-select: none;
  pointer-events: none;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-soft);
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
}

/* ——— Sections ——— */
.section {
  padding: var(--space-xl) clamp(1rem, 4vw, 1.75rem);
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.section-kicker {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-sm);
}

.section-inner > h1,
.problem-page-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.8vw, 2.85rem);
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--text);
  margin: 0 0 var(--space-md);
  max-width: 20ch;
}

.section-inner > h1.long-title,
.problem-page-head h1.long-title {
  max-width: 24ch;
}

.section h2 {
  font-family: var(--font-display);
  margin: 0 0 1rem;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  letter-spacing: -0.025em;
  line-height: 1.22;
  color: var(--text);
}

.section-lead {
  margin: 0 0 var(--space-lg);
  color: var(--muted);
  font-size: 1.125rem;
  max-width: 62ch;
  line-height: 1.7;
}

.section-lead strong {
  color: var(--text-secondary);
}

.section-lead--flush-top {
  margin-top: 0 !important;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 var(--space-sm);
}

.section-deck {
  margin: 0 0 var(--space-lg);
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 52ch;
  line-height: 1.65;
}

.link-next {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-top: var(--space-lg);
  text-decoration: none;
  color: var(--accent-soft);
  transition: color 0.22s var(--ease-out);
}

.link-next::after {
  content: "→";
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), color 0.22s var(--ease-out);
}

.link-next:hover {
  color: var(--accent-deep);
}

.link-next:hover::after {
  transform: translateX(4px);
}

.link-prev::after {
  content: "";
}

.link-prev::before {
  content: "←";
  color: var(--accent-soft);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), color 0.22s var(--ease-out);
}

.link-prev:hover::before {
  transform: translateX(-4px);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: var(--space-lg);
}

.link-row .link-next {
  margin-top: 0;
}

.section-note {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--muted);
  max-width: 62ch;
}

.u-mb-1 {
  margin-bottom: 1rem !important;
}

.ol-process {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.ol-process li {
  margin-bottom: 0.55rem;
}

.ol-process li:last-child {
  margin-bottom: 0;
}

/* ——— Hero (home) ——— */
.hero {
  position: relative;
  padding: var(--space-2xl) clamp(1rem, 4vw, 1.75rem) var(--space-xl);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  right: -8%;
  top: 10%;
  width: min(52vw, 520px);
  height: min(52vw, 520px);
  background: radial-gradient(circle, rgba(37, 99, 235, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: var(--space-xl);
  align-items: start;
  position: relative;
  z-index: 1;
}

@media (max-width: 959px) {
  /* Keep image after CTAs on narrow screens (same reading order as before) */
  .hero-actions {
    order: 4;
  }

  .hero-visual {
    order: 5;
  }
}

@media (min-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr minmax(340px, 44%);
    column-gap: var(--space-2xl);
    row-gap: 0;
  }

  /* Image shares row 3 with body copy so its top aligns with the first line of .hero-sub */
  .hero-program {
    grid-column: 1;
    grid-row: 1;
  }

  .hero-inner > h1 {
    grid-column: 1;
    grid-row: 2;
  }

  .hero-sub {
    grid-column: 1;
    grid-row: 3;
  }

  .hero-visual {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
  }

  .hero-actions {
    grid-column: 1;
    grid-row: 4;
  }
}

.hero-visual {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@media (min-width: 960px) {
  .hero-visual {
    min-height: 0;
  }
}

.hero-visual__img {
  width: 100%;
  max-width: 640px;
  height: auto;
  filter: drop-shadow(0 20px 50px rgba(37, 99, 235, 0.12));
}

.hero h1 {
  font-family: var(--font-display);
  margin: 0 0 var(--space-md);
  font-size: clamp(2.15rem, 5.2vw, 3.25rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--text);
  text-wrap: balance;
}

.hero-sub {
  margin: 0 0 var(--space-lg);
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 48ch;
  line-height: 1.65;
}

.hero-sub strong {
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 0;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 520px;
}

.hero-stat {
  background: var(--bg-elevated);
  padding: 1rem 1.1rem;
  text-align: center;
}

.hero-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-soft);
  line-height: 1.2;
}

.hero-stat span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 520px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}

.hero-inner > .hero-meta {
  grid-column: 1 / -1;
}

.footer-brand .logo {
  display: inline-flex;
  margin-bottom: 0.35rem;
}

.meta-card {
  position: relative;
  background: linear-gradient(145deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-glow);
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.meta-card:hover {
  border-color: rgba(37, 99, 235, 0.25);
  transform: translateY(-2px);
}

.meta-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.25rem;
  right: 1.25rem;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent-line);
  opacity: 0.65;
}

.meta-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.meta-card p {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Scroll-reveal (main.js adds .reveal-item / .reveal-item--visible) */
main .card.reveal-item,
main .meta-card.reveal-item,
main .media-figure.reveal-item,
main .page-grid a.card.reveal-item {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.62s var(--ease-out) var(--reveal-delay, 0ms),
    transform 0.62s var(--ease-out) var(--reveal-delay, 0ms),
    border-color 0.25s var(--ease-out),
    background 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out);
}

main .card.reveal-item.reveal-item--visible,
main .meta-card.reveal-item.reveal-item--visible,
main .media-figure.reveal-item.reveal-item--visible,
main .page-grid a.card.reveal-item.reveal-item--visible {
  opacity: 1;
  transform: translateY(0);
}

.meta-card.reveal-item.reveal-item--visible:hover {
  transform: translateY(-2px);
}

.page-grid a.card.reveal-item.reveal-item--visible:hover {
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  main .card.reveal-item,
  main .meta-card.reveal-item,
  main .media-figure.reveal-item,
  main .page-grid a.card.reveal-item {
    opacity: 1 !important;
    transform: none !important;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.25s !important;
  }
}

/* Explore grid */
.page-grid-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.page-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.page-grid.page-grid--embed {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(100%, 420px);
}

.page-next-embed {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) clamp(1.25rem, 3.5vw, 2rem) var(--space-xl);
  background: var(--bg-elevated);
}

.page-grid a.card {
  position: relative;
  text-decoration: none;
  color: inherit;
  padding: 1.5rem 1.5rem 1.5rem 1.65rem;
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s, transform 0.25s var(--ease-out);
}

.page-grid a.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-line);
  opacity: 0;
  transition: opacity 0.25s;
}

.page-grid a.card:hover {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(37, 99, 235, 0.08);
  transform: translateY(-3px);
}

.page-grid a.card:hover::before {
  opacity: 1;
}

.page-grid a.card .card-index {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 0.5rem;
}

.page-grid a.card h3 {
  font-family: var(--font-display);
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-grid a.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.page-grid a.card .card-arrow {
  display: inline-flex;
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-soft);
  align-items: center;
  gap: 0.35rem;
}

.page-grid a.card .card-arrow::after {
  content: "→";
  transition: transform 0.2s var(--ease-out);
}

.page-grid a.card:hover .card-arrow::after {
  transform: translateX(4px);
}

.grid-2 {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.55rem;
  transition: border-color 0.2s, background 0.2s;
}

.card:hover {
  border-color: rgba(15, 23, 42, 0.12);
  background: var(--surface-hover);
}

.card__title {
  font-family: var(--font-display);
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.list-check {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-check li {
  position: relative;
  padding-left: 1.65rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  line-height: 1.55;
}

.list-check li:last-child {
  margin-bottom: 0;
}

.list-check li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.diagram {
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  padding: 1rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-display);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: rgba(15, 23, 42, 0.03);
}

td {
  color: var(--muted);
  line-height: 1.5;
}

td strong {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.1rem;
}

.tag {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* ——— Technology: GIF showcase ——— */
.tech-gif-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  margin: var(--space-lg) 0 var(--space-xl);
}

@media (max-width: 800px) {
  .tech-gif-grid {
    grid-template-columns: 1fr;
  }
}

.media-figure {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Fixed-height “viewport” so different GIF aspect ratios share the same band */
.media-figure__frame {
  flex: 0 0 auto;
  height: clamp(240px, 36vw, 380px);
  min-height: clamp(240px, 36vw, 380px);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Match GIF / CAD matte (#fff) so bands above/below letterboxed content disappear */
  background: #ffffff;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.media-figure__frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  margin: 0;
  background: #ffffff;
}

.media-caption {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.15rem 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.media-caption strong {
  display: inline;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
}

.media-caption > strong:first-child {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.media-caption__list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.media-caption__list li {
  margin: 0;
}

/* Technology figures: favor native image readability over fixed-height cards */
.tech-figure-grid {
  grid-template-columns: 1fr;
  align-items: start;
}

.tech-figure-grid .tech-figure {
  height: auto;
}

.tech-figure-grid .tech-figure__frame,
.tech-figure-grid .media-figure__frame {
  height: auto;
  min-height: 0;
  padding: 0.75rem;
}

.tech-figure-grid .media-figure__frame img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(210px, 30vw, 340px);
  margin: 0 auto;
  object-fit: contain;
}

@media (max-width: 920px) {
  .tech-figure-grid {
    grid-template-columns: 1fr;
  }
}

/* Figure 3: image-only treatment (remove card parts) */
.tech-figure--prototype {
  display: none;
}

.tech-subhead {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: var(--space-xl) 0 var(--space-sm);
}

.tech-spec-table {
  margin-top: var(--space-md);
}

/* Technology page refresh: less document feel, stronger web hierarchy */
.page-technology .section--tech-hero {
  background:
    radial-gradient(120% 70% at 100% -10%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(90% 70% at -10% 100%, rgba(79, 70, 229, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.92) 100%);
  border-bottom: 1px solid var(--border);
}

.page-technology .section--tech-hero .section-inner {
  max-width: min(1180px, 100%);
}

.page-technology .section--tech-hero .section-lead {
  max-width: 72ch;
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.page-technology .section--tech-hero .grid-2 .card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: linear-gradient(170deg, var(--surface) 0%, var(--bg-elevated) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  transition: border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.page-technology .section--tech-hero .grid-2 .card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.26);
}

.page-technology .section--tech-hero .grid-2 .card__title {
  font-size: 1.03rem;
  color: var(--text);
}

.page-technology .section--tech-hero .list-check {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.page-technology .section--tech-hero .diagram {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, #f8fafc 0%, #ffffff 100%);
}

.page-technology .section--tech-evolution .section-inner {
  max-width: min(1100px, 100%);
}

.page-technology .section--tech-evolution .section-deck {
  max-width: 74ch;
  color: var(--text-secondary);
  line-height: 1.72;
}

.page-technology .tech-figure-grid {
  margin-top: var(--space-lg);
}

.page-technology .tech-figure-grid .media-figure {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  align-items: stretch;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 30px -22px rgba(15, 23, 42, 0.25);
}

.page-technology .tech-figure-grid .media-caption {
  justify-content: center;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.page-technology .tech-subhead {
  font-size: 1.12rem;
  margin-top: var(--space-2xl);
}

.link-row--tech-nav {
  margin-top: var(--space-xl);
  gap: 0.8rem;
}

.link-row--tech-nav .link-next {
  position: relative;
  overflow: hidden;
  margin-top: 0;
  padding: 0.62rem 0.9rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, var(--surface) 0%, var(--bg-elevated) 100%);
  color: var(--text-secondary);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.25;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.22s var(--ease-out),
    background 0.22s var(--ease-out),
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.22s var(--ease-out);
}

.link-row--tech-nav .link-next:not(.link-prev)::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(37, 99, 235, 0.14) 35%, transparent 70%);
  transform: translateX(-130%);
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.link-row--tech-nav .link-next::after {
  color: var(--accent-soft);
}

.link-row--tech-nav .link-next:hover {
  color: var(--text);
  border-color: rgba(37, 99, 235, 0.28);
  background: var(--surface);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -16px rgba(15, 23, 42, 0.35);
}

.link-row--tech-nav .link-next:not(.link-prev):hover::before {
  transform: translateX(130%);
}

.link-row--tech-nav .link-prev::before {
  content: "←";
  position: static;
  inset: auto;
  background: none;
  color: var(--accent-soft);
  transform: none;
  pointer-events: auto;
}

.link-row--tech-nav .link-next:hover::after {
  transform: translateX(6px) scale(1.06);
}

.link-row--tech-nav .link-prev:hover::before {
  transform: translateX(-6px) scale(1.06);
}

.page-technology .tech-flow-wrap {
  display: grid;
  justify-items: center;
  margin-top: calc(var(--space-2xl) + 1.25rem);
}

.page-technology .tech-flow-wrap .section-note {
  text-align: center;
  margin-bottom: 0.65rem;
}

.tech-flow {
  width: 100%;
  max-width: 980px;
  display: grid;
  gap: 0.9rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tech-flow__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  justify-content: center;
}

.tech-flow__row span {
  white-space: nowrap;
}

.tech-flow__arrow {
  position: relative;
  display: inline-block;
  min-width: 2.2ch;
  text-align: center;
  color: var(--accent-soft);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-shadow: 0 0 0 rgba(37, 99, 235, 0);
  animation: flow-arrow-forward 1.65s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.tech-flow__arrow--back {
  animation-name: flow-arrow-back;
  animation-delay: 0.16s;
}

/* Stagger forward flow arrows for a traveling effect */
.tech-flow__row:first-child .tech-flow__arrow:nth-child(2) {
  animation-delay: 0s;
}

.tech-flow__row:first-child .tech-flow__arrow:nth-child(4) {
  animation-delay: 0.14s;
}

.tech-flow__row:first-child .tech-flow__arrow:nth-child(6) {
  animation-delay: 0.28s;
}

.tech-flow__row:first-child .tech-flow__arrow:nth-child(8) {
  animation-delay: 0.42s;
}

.tech-flow__row:first-child .tech-flow__arrow:nth-child(10) {
  animation-delay: 0.56s;
}

.tech-flow__row--feedback .tech-flow__arrow:nth-child(2) {
  animation-delay: 0.2s;
}

.tech-flow__row--feedback .tech-flow__arrow:nth-child(4) {
  animation-delay: 0.36s;
}

@keyframes flow-arrow-forward {
  0% {
    opacity: 0.35;
    transform: translateX(0);
    text-shadow: 0 0 0 rgba(37, 99, 235, 0);
  }

  45% {
    opacity: 1;
    transform: translateX(3px);
    text-shadow: 0 0 12px rgba(37, 99, 235, 0.22);
  }

  100% {
    opacity: 0.35;
    transform: translateX(0);
    text-shadow: 0 0 0 rgba(37, 99, 235, 0);
  }
}

@keyframes flow-arrow-back {
  0% {
    opacity: 0.35;
    transform: translateX(0);
    text-shadow: 0 0 0 rgba(37, 99, 235, 0);
  }

  45% {
    opacity: 1;
    transform: translateX(-3px);
    text-shadow: 0 0 12px rgba(37, 99, 235, 0.22);
  }

  100% {
    opacity: 0.35;
    transform: translateX(0);
    text-shadow: 0 0 0 rgba(37, 99, 235, 0);
  }
}

.page-technology .tech-figure-grid .media-figure__frame {
  border-bottom: none;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius) 0 0 var(--radius);
  height: 100%;
}

.page-technology .tech-figure-grid .media-figure__frame img {
  max-height: clamp(180px, 24vw, 280px);
}

@media (max-width: 920px) {
  .page-technology .tech-figure-grid .media-figure {
    grid-template-columns: 1fr;
  }

  .page-technology .tech-figure-grid .media-figure__frame {
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .page-technology .tech-figure-grid .media-caption {
    border-left: none;
  }
}

.section--tight-bottom {
  padding-top: var(--space-md);
}

.section--tight-bottom .disclaimer {
  margin-top: 0;
}

.disclaimer {
  font-size: 0.88rem;
  color: var(--muted);
  border-left: 3px solid var(--warn);
  padding: 1rem 1.15rem;
  margin: var(--space-lg) 0 0;
  background: var(--warn-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.55;
}

.contact-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.form label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form input::placeholder,
.form textarea::placeholder {
  color: rgba(100, 116, 139, 0.65);
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form textarea {
  min-height: 140px;
  resize: vertical;
}

.form-row {
  margin-bottom: 1.1rem;
}

.form-actions {
  margin-top: 1.35rem;
}

.form-note {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Contact page refinement */
.page-contact .section--contact {
  background:
    radial-gradient(115% 65% at 100% -8%, rgba(37, 99, 235, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.94) 100%);
}

.page-contact .section--contact .section-inner {
  max-width: min(1160px, 100%);
}

.page-contact .section--contact .section-kicker {
  margin-bottom: 0.45rem;
  color: var(--text-secondary);
}

.page-contact .section--contact .section-lead {
  max-width: 72ch;
  color: var(--text-secondary);
  line-height: 1.72;
}

.page-contact .contact-grid {
  margin-top: var(--space-lg);
  gap: var(--space-lg);
}

.page-contact .contact-grid--merged {
  grid-template-columns: 1fr;
  max-width: min(40rem, 100%);
  margin-left: auto;
  margin-right: auto;
}

.page-contact .contact-panel {
  padding: 1.5rem 1.35rem 1.65rem;
}

.page-contact .contact-panel__form-wrap {
  margin-top: 1.65rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.page-contact .contact-panel__form-heading {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-contact .contact-grid > .card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface) 0%, var(--bg-elevated) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 18px 42px -32px rgba(15, 23, 42, 0.2);
}

.page-contact .contact-grid > .card .card__title {
  margin-bottom: 0.8rem;
  font-size: 1.08rem;
}

.page-contact .form {
  padding-top: 1.6rem;
}

.page-contact .contact-panel__form-wrap.form {
  padding-top: 0;
}

.page-contact .form-row {
  margin-bottom: 1rem;
}

.page-contact .form input,
.page-contact .form textarea,
.page-contact .form select {
  background: var(--surface);
}

/* ——— Footer ——— */
.site-footer {
  padding: var(--space-xl) clamp(1rem, 4vw, 1.75rem);
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg-deep) 100%);
}

.footer-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1.2fr repeat(2, 1fr);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand p {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 36ch;
}

.footer-heading {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 var(--space-sm);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-links a:hover {
  color: var(--accent-soft);
}

.footer-bar {
  max-width: var(--max);
  margin: 0 auto;
  padding-top: var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-bar p {
  margin: 0;
}

/* ——— Mobile nav ——— */
@media (max-width: 768px) {
  .site-nav-overlay {
    display: block;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-h);
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm) clamp(1rem, 4vw, 1.75rem) var(--space-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out), visibility 0.28s;
    box-shadow: var(--shadow-md);
    z-index: 101;
  }

  .site-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .site-nav li {
    border-bottom: 1px solid var(--border);
  }

  .site-nav li:last-child {
    border-bottom: none;
  }

  .site-nav .nav-submenu {
    position: static;
    min-width: 0;
    margin: 0 0 0.3rem 0.75rem;
    padding: 0;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .site-nav .nav-submenu a {
    padding: 0.45rem 0;
    font-size: 0.95rem;
  }

  .site-nav a {
    display: block;
    padding: 0.85rem 0;
    font-size: 1rem;
    border-radius: var(--radius-xs);
  }

  .nav-cta {
    margin: var(--space-md) 0 0;
    padding: var(--space-md) 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .nav-cta .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ——— Production utilities & error page ——— */
.link-row--flush,
.link-row--flush.link-row {
  margin-top: 0;
}

.link-row--flush .link-next {
  margin-top: 0;
}

.site-footer--minimal {
  padding: var(--space-lg) clamp(1rem, 4vw, 1.75rem);
}

.footer-bar--minimal {
  border-top: none;
  padding-top: 0;
  max-width: var(--max);
  margin: 0 auto;
}

.form-note--flush {
  margin-top: 0 !important;
}

.form-note--spaced {
  margin-top: 1rem !important;
}

.u-mt-lg {
  margin-top: var(--space-lg) !important;
}

.section--error {
  min-height: min(56vh, 520px);
  display: flex;
  align-items: center;
}

.section--error .section-inner {
  width: 100%;
}

/* ——— Problem page — wider layout, filled hero & bands ——— */
.section-inner--wide {
  max-width: min(1240px, 100%);
}

.section--problem {
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, transparent 42%), var(--bg-deep);
  padding-top: var(--space-lg);
  padding-bottom: var(--space-2xl);
}

.problem-hero {
  display: grid;
  align-items: start;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.problem-hero__main {
  align-self: start;
  min-width: 0;
}

@media (min-width: 960px) {
  .problem-hero {
    grid-template-columns: 1fr minmax(280px, 34%);
    gap: var(--space-2xl);
  }
}

.section--problem .problem-hero__main .problem-page-head {
  margin-bottom: 0;
  padding-bottom: var(--space-md);
  border-bottom: none;
}

.section--problem .problem-hero__main .problem-page-head .breadcrumb {
  margin-bottom: 0.85rem;
}

.section--problem .problem-page-head h1.long-title {
  margin-bottom: 0;
  max-width: none;
  width: 100%;
  font-size: clamp(1.55rem, 2.6vw + 0.65rem, 2.85rem);
  line-height: 1.08;
  letter-spacing: -0.036em;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

.section--problem .problem-hero__main .section-lead--problem {
  margin-top: var(--space-md);
  margin-bottom: 0;
  max-width: none;
  font-size: 1.125rem;
  line-height: 1.74;
  color: var(--muted);
}

.problem-hero__aside {
  align-self: start;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-lg);
  padding: 1.55rem 1.45rem 1.5rem;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(120% 85% at 100% -10%, rgba(59, 130, 246, 0.2) 0%, transparent 55%),
    radial-gradient(100% 70% at -5% 105%, rgba(79, 70, 229, 0.12) 0%, transparent 50%),
    radial-gradient(80% 55% at 50% 130%, rgba(217, 119, 6, 0.07) 0%, transparent 42%),
    linear-gradient(165deg, #f8fafc 0%, #ffffff 42%, #f1f5f9 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 22px 44px -18px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset,
    var(--shadow-glow);
}

.problem-hero__aside::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.4;
  background-image: radial-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 15px 15px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 28%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 28%, black 100%);
  pointer-events: none;
}

.problem-hero__aside > * {
  position: relative;
  z-index: 2;
}

.problem-hero__aside-title {
  margin: 0 0 1.05rem;
  padding-bottom: 0.95rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.32;
  text-transform: none;
  color: var(--text);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.problem-glance {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.problem-glance__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0 0.6rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.problem-glance__item:first-child {
  padding-top: 0;
}

.problem-glance__item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.problem-glance__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.problem-glance__label::before {
  content: "";
  flex: 0 0 auto;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.problem-glance__text {
  font-size: 0.9375rem;
  line-height: 1.52;
  color: var(--muted);
  padding-left: calc(0.42rem + 0.45rem);
}

/* Architecture: main narrative + supporting panel */
.problem-arch {
  display: grid;
  align-items: stretch;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.problem-arch__heading {
  margin-bottom: 0;
}

.section--problem .problem-arch .problem-section-head.problem-arch__heading {
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: var(--space-lg);
}

@media (min-width: 900px) {
  .problem-arch {
    grid-template-columns: 1fr minmax(280px, 34%);
    column-gap: var(--space-2xl);
    row-gap: var(--space-md);
  }

  .problem-arch__heading {
    grid-column: 1 / -1;
  }

  .problem-arch__body {
    grid-column: 1;
    grid-row: 2;
    box-sizing: border-box;
    min-height: 0;
    height: 100%;
    margin-bottom: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .problem-arch__panel {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

.section--problem .problem-section-head {
  font-size: clamp(1.45rem, 2.8vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.section--problem .section-deck--problem {
  font-size: 1.0625rem;
  line-height: 1.68;
  color: var(--muted);
}

.problem-callout--deck {
  margin-bottom: var(--space-md);
  margin-top: 0.25rem;
  padding: var(--space-lg) var(--space-xl);
  text-align: left;
  background: linear-gradient(165deg, var(--bg-elevated) 0%, var(--surface) 45%, #eef2f6 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 14px 36px -20px rgba(15, 23, 42, 0.12);
}

.problem-arch .problem-callout--deck .section-deck--problem {
  margin: 0;
  max-width: none;
  text-align: left;
}

@media (min-width: 900px) {
  .problem-arch .problem-callout--deck .section-deck--problem {
    max-width: 62ch;
    margin-left: 0;
    margin-right: auto;
    width: 100%;
  }
}

.section-deck--problem {
  margin-bottom: 0;
}

.problem-arch__panel-title {
  margin-bottom: 0.75rem;
}

.problem-arch__list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.58;
}

.problem-arch__list li {
  margin-bottom: 0.5rem;
}

.problem-arch__list li:last-child {
  margin-bottom: 0;
}

/* Architecture — editorial layout (no card boxes; structure + type) */
.section--problem .problem-arch .problem-callout--deck {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.section--problem .problem-arch .problem-callout--deck .section-deck--problem {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.72;
}

.section--problem .problem-arch .section-deck--problem strong {
  font-weight: 600;
  color: var(--text);
}

.section--problem .problem-arch .problem-arch__panel.card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  transition: none;
}

.section--problem .problem-arch .problem-arch__panel.card:hover {
  background: transparent;
  border-color: transparent;
}

.section--problem .problem-arch .problem-arch__panel-title {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-secondary);
  line-height: 1.35;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.section--problem .problem-arch .problem-arch__list {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.62;
}

.section--problem .problem-arch .problem-arch__list li {
  position: relative;
  margin: 0 0 0.7rem;
  padding-left: 1.1rem;
}

.section--problem .problem-arch .problem-arch__list li:last-child {
  margin-bottom: 0;
}

.section--problem .problem-arch .problem-arch__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--text);
  opacity: 0.28;
}

@media (min-width: 900px) {
  .section--problem .problem-arch .problem-arch__panel.card {
    padding-left: var(--space-xl);
    border-left: 1px solid var(--border-strong);
  }
}

@media (max-width: 899px) {
  .section--problem .problem-arch .problem-arch__panel.card {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-strong);
  }
}

.problem-pain-head {
  margin-top: var(--space-xl);
}

.section--problem .problem-pain-sub {
  margin: 0 0 var(--space-md);
  font-size: 1.02rem;
  line-height: 1.62;
  color: var(--text-secondary);
  max-width: none;
}

.section--problem .problem-pain-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

@media (min-width: 1100px) {
  .section--problem .problem-pain-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xl);
  }
}

.section--problem .problem-pain-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(15, 23, 42, 0.2);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
  padding: 1.35rem 1.45rem 1.45rem 1.4rem;
  transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}

.section--problem .problem-pain-card:hover {
  border-color: rgba(15, 23, 42, 0.12);
  border-left-color: rgba(15, 23, 42, 0.32);
  background: var(--surface-hover);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.section--problem .problem-pain-card .card__title {
  margin: 0 0 0.65rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  text-transform: none;
  color: var(--text);
  line-height: 1.25;
}

.section--problem .problem-pain-card .card__text {
  flex: 1;
  margin: 0;
  font-size: 0.96875rem;
  line-height: 1.64;
  color: var(--text-secondary);
}

.problem-closer {
  margin-top: var(--space-2xl);
  width: 100%;
  max-width: none;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 20px 48px -28px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.problem-closer::before {
  content: "";
  display: block;
  height: 2px;
  background: var(--logo-ink);
  opacity: 0.9;
}

.problem-closer__grid {
  display: grid;
  gap: 0;
}

@media (min-width: 780px) {
  .problem-closer__grid {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 30%);
  }
}

.problem-closer__body {
  padding: var(--space-xl) var(--space-lg);
}

@media (min-width: 780px) {
  .problem-closer__body {
    padding: var(--space-xl) var(--space-2xl) var(--space-xl) var(--space-xl);
  }
}

.section--problem .problem-closer .section-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.section--problem .problem-closer .section-title {
  margin: 0 0 var(--space-md);
  font-size: clamp(1.32rem, 2.35vw, 1.72rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text);
}

.section--problem .problem-closer__lead.section-lead {
  margin-bottom: 0;
  max-width: 62ch;
  font-size: 1.03125rem;
  line-height: 1.72;
  color: var(--text-secondary);
}

.section--problem .problem-closer__lead.section-lead strong {
  font-weight: 600;
  color: var(--text);
}

.section--problem .problem-closer__lead.section-lead a {
  font-weight: 600;
}

.problem-closer__rail {
  padding: var(--space-xl) var(--space-lg);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(248, 250, 252, 0.92) 100%);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
  align-items: flex-start;
}

@media (min-width: 780px) {
  .problem-closer__rail {
    border-top: none;
    border-left: 1px solid var(--border-strong);
    padding: var(--space-xl);
  }
}

.problem-closer__rail-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.problem-closer__rail-link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  line-height: 1.35;
}

.problem-closer__rail-link:hover {
  color: var(--accent);
}

.problem-closer__rail-note {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.52;
  color: var(--text-secondary);
}

/* ——— Volume 2 technical pages (verbatim proposal body) ——— */
.page-doc {
  --bg-deep: #eaf0f8;
  --bg-elevated: #f4f7fc;
  --surface: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --accent-dim: rgba(37, 99, 235, 0.08);
  --doc-shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.06);
  --doc-shadow-hover: 0 16px 36px rgba(15, 23, 42, 0.1);
  --doc-anim-fast: 220ms;
  --doc-anim-med: 360ms;
  /* Align sidebar top with the prose card top (below breadcrumb + H1) */
  --doc-sidebar-offset: clamp(5.4rem, 8vw, 6.8rem);
}

.page-doc main#main {
  animation: doc-main-enter 0.5s var(--ease-out) both;
}

@keyframes doc-main-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-program {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.45;
}

.hero-sub--volume {
  max-width: 40rem;
}

.hero-sub--volume.hero-sub--stack {
  font-size: 1rem;
  line-height: 1.62;
}

.hero-sub--stack > p {
  margin: 0 0 1em;
}

.hero-sub--stack > p:last-child {
  margin-bottom: 0;
}

.page-doc .section--doc-volume {
  padding-top: var(--space-lg);
  position: relative;
  padding-left: clamp(0.75rem, 3.5vw, 1.65rem);
  padding-right: clamp(0.75rem, 3.5vw, 1.65rem);
}

.page-doc .section--doc-volume::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(62% 42% at 0% 0%, rgba(37, 99, 235, 0.06), transparent 72%),
    radial-gradient(45% 30% at 100% 0%, rgba(30, 64, 175, 0.05), transparent 72%);
  opacity: 0.72;
}

.section-inner--doc {
  width: 100%;
  max-width: var(--max);
}

/* Doc volume: sidebar (section list) + main column — tutorial-style */
.doc-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: 100%;
}

@media (min-width: 900px) {
  .doc-layout {
    display: grid;
    grid-template-columns: minmax(14.5rem, 18.5rem) minmax(0, 1fr);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: start;
  }
}

.doc-layout__main {
  min-width: 0;
  max-width: min(100%, calc(var(--prose) + 12rem));
  animation: doc-pane-enter 0.42s var(--ease-out) both;
}

@keyframes doc-pane-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Volume nav: embedded in the column (no card chrome) */
.doc-sidebar {
  position: relative;
  padding: 0.2rem 0.15rem 0.5rem 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  animation: doc-sidebar-enter 0.42s var(--ease-out) both;
}

@keyframes doc-sidebar-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 900px) {
  .doc-sidebar {
    margin-top: var(--doc-sidebar-offset);
    position: sticky;
    top: calc(var(--header-h) + 0.75rem);
    align-self: start;
  }
}

.doc-sidebar__title {
  margin: 0 0 0.55rem;
  padding: 0 0 0.45rem 0.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.34);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: none;
  color: #334155;
}

.doc-sidebar__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-sidebar__item {
  margin: 0;
  border-radius: var(--radius-sm);
}

.doc-sidebar__item + .doc-sidebar__item {
  margin-top: 0.15rem;
}

.doc-sidebar__item {
  animation: doc-item-enter 0.44s var(--ease-out) both;
}

.doc-sidebar__item:nth-child(1) { animation-delay: 40ms; }
.doc-sidebar__item:nth-child(2) { animation-delay: 80ms; }
.doc-sidebar__item:nth-child(3) { animation-delay: 120ms; }
.doc-sidebar__item:nth-child(4) { animation-delay: 160ms; }
.doc-sidebar__item:nth-child(5) { animation-delay: 200ms; }
.doc-sidebar__item:nth-child(6) { animation-delay: 240ms; }

@keyframes doc-item-enter {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.doc-sidebar__link {
  position: relative;
  display: block;
  padding: 0.45rem 0.5rem 0.45rem 0.35rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  transition: background var(--doc-anim-fast) var(--ease-out), color var(--doc-anim-fast) var(--ease-out);
  border: none;
  border-left: 3px solid transparent;
}

.doc-sidebar__link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}

.doc-sidebar__link--has-children::after {
  content: "+";
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  color: #64748b;
}

.doc-sidebar__link--has-children.doc-sidebar__link--expanded::after {
  content: "−";
  color: #1e3a8a;
}

.doc-sidebar__item--current .doc-sidebar__link {
  background: rgba(37, 99, 235, 0.07);
  color: #1d4ed8;
  font-weight: 600;
  border-left-color: #2563eb;
}

/* Force no underlines in sidebar links across all states */
.doc-sidebar a,
.doc-sidebar a:hover,
.doc-sidebar a:focus,
.doc-sidebar a:active,
.doc-sidebar a:visited {
  text-decoration: none !important;
  text-underline-offset: 0 !important;
}

.doc-sidebar__label {
  line-height: 1.35;
}

.doc-sidebar__sublist {
  list-style: none;
  margin: 0.15rem 0 0.25rem 0;
  padding: 0.06rem 0 0.1rem 0.55rem;
  border-left: 1px solid rgba(148, 163, 184, 0.4);
  animation: doc-sublist-enter 0.35s var(--ease-out) both;
}

.doc-sidebar__subitem .doc-sidebar__sublist {
  border-left-color: rgba(148, 163, 184, 0.22);
}

.doc-sidebar__item--collapsed > .doc-sidebar__sublist {
  display: none;
}

/* Benefit branch nested under EMCP (subitem wraps a .doc-sidebar__sublist) */
.doc-sidebar__subitem.doc-sidebar__subitem--collapsed > .doc-sidebar__sublist {
  display: none;
}

.doc-sidebar__sublist li + li {
  margin-top: 0.05rem;
}

@keyframes doc-sublist-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-sidebar__sublink {
  display: inline-block;
  padding: 0.2rem 0.35rem;
  margin-left: 0.12rem;
  border-radius: 0 5px 5px 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border: none;
  border-left: 2px solid transparent;
  transition: color var(--doc-anim-fast) var(--ease-out), background var(--doc-anim-fast) var(--ease-out);
}

.doc-sidebar__sublink:hover {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.06);
}

.doc-sidebar__sublink--has-children::after {
  content: "+";
  position: static;
  margin-left: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  color: #64748b;
}

.doc-sidebar__sublink--has-children.doc-sidebar__sublink--expanded::after {
  content: "−";
  color: #1e3a8a;
}

.doc-sidebar__sublink--has-children {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding-right: 0.4rem;
}

.doc-sidebar__sublink--active {
  color: #1e40af;
  background: rgba(37, 99, 235, 0.09);
  border-left-color: rgba(37, 99, 235, 0.55);
  font-weight: 600;
  animation: doc-sub-active 0.28s var(--ease-out) both;
}

.doc-sidebar__subsublist {
  list-style: none;
  margin: 0.25rem 0 0.2rem;
  padding: 0 0 0 0.55rem;
  display: none;
}

.doc-sidebar__subitem:not(.doc-sidebar__subitem--collapsed) > .doc-sidebar__subsublist,
.doc-sidebar__sublink--has-children.doc-sidebar__sublink--expanded + .doc-sidebar__subsublist {
  display: block;
}

.doc-sidebar__subsublist li + li {
  margin-top: 0.02rem;
}

.doc-sidebar__subsublink {
  display: inline-block;
  padding: 0.16rem 0.3rem;
  margin-left: 0.08rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.74rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border: none;
  border-left: 2px solid transparent;
  transition: color var(--doc-anim-fast) var(--ease-out), background var(--doc-anim-fast) var(--ease-out);
}

.doc-sidebar__subsublink:hover {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.06);
}

.doc-sidebar__subsublink--active {
  color: #1e40af;
  background: rgba(37, 99, 235, 0.09);
  border-left-color: rgba(37, 99, 235, 0.5);
  font-weight: 600;
  animation: doc-sub-active 0.28s var(--ease-out) both;
}

@keyframes doc-sub-active {
  from {
    transform: translateX(-2px);
  }

  to {
    transform: translateX(0);
  }
}

.doc-sidebar__item--sub-active > .doc-sidebar__link {
  background: rgba(37, 99, 235, 0.05);
  color: #1e3a8a;
  border-left-color: rgba(37, 99, 235, 0.4);
}

.doc-volume-h1 {
  margin: 0 0 var(--space-md);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.doc-prose {
  margin-top: var(--space-md);
  padding: clamp(1rem, 1vw + 0.9rem, 1.4rem);
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  box-shadow: var(--doc-shadow-soft);
  animation: doc-prose-enter 0.54s var(--ease-out) both;
  transition: box-shadow var(--doc-anim-med) var(--ease-out), border-color var(--doc-anim-med) var(--ease-out), transform var(--doc-anim-med) var(--ease-out);
}

.doc-prose:hover {
  box-shadow: var(--doc-shadow-hover);
  border-color: rgba(15, 23, 42, 0.16);
  transform: translateY(-1px);
}

/* Prev / Next below the white prose card (sits on section tint) */
.doc-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: clamp(0.5rem, 2vw, 0.85rem);
  margin-top: clamp(0.85rem, 1.5vw, 1.15rem);
  max-width: min(100%, calc(var(--prose) + 12rem));
}

.doc-pager__btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: min(100%, 11.5rem);
  padding: 0.55rem 0.75rem 0.58rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  color: #1e3a8a;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  transition: background var(--doc-anim-fast) var(--ease-out), border-color var(--doc-anim-fast) var(--ease-out), transform var(--doc-anim-fast) var(--ease-out), color var(--doc-anim-fast) var(--ease-out);
}

/* Underline only on title row; width = text width. Hidden until hover/focus. */
a.doc-pager__btn .doc-pager__title {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

a.doc-pager__btn .doc-pager__title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.14rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  pointer-events: none;
  transform: scaleX(0);
  transition: transform 0.45s var(--ease-out);
}

/* Previous: line draws right → left */
a.doc-pager__btn--prev .doc-pager__title::after {
  transform-origin: right center;
}

/* Next: line draws left → right */
a.doc-pager__btn--next .doc-pager__title::after {
  transform-origin: left center;
}

a.doc-pager__btn--prev:hover .doc-pager__title::after,
a.doc-pager__btn--prev:focus-visible .doc-pager__title::after,
a.doc-pager__btn--next:hover .doc-pager__title::after,
a.doc-pager__btn--next:focus-visible .doc-pager__title::after {
  transform: scaleX(1);
}

a.doc-pager__btn:hover {
  color: #1d4ed8;
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.38);
  transform: translateY(-1px);
}

a.doc-pager__btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

.doc-pager__btn--edge {
  color: #94a3b8;
  background: rgba(248, 250, 252, 0.65);
  border-color: rgba(148, 163, 184, 0.35);
  cursor: default;
  box-shadow: none;
}

.doc-pager__dir {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

a.doc-pager__btn:hover .doc-pager__dir {
  color: #475569;
}

.doc-pager__btn--edge .doc-pager__dir {
  color: #94a3b8;
}

.doc-pager__title {
  font-size: 0.84rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.3;
}

.doc-pager__btn--next {
  text-align: left;
}

@keyframes doc-prose-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-doc main#main,
  .doc-layout__main,
  .doc-sidebar,
  .doc-sidebar__item,
  .doc-prose {
    animation: none !important;
  }

  .doc-sidebar,
  .doc-prose,
  .doc-sidebar__link,
  .doc-toc,
  .doc-sidebar__sublink,
  .doc-sidebar__subsublink {
    transition: none !important;
    transform: none !important;
  }

  .doc-sidebar__sublist,
  .doc-sidebar__sublink--active {
    animation: none !important;
  }

  a.doc-pager__btn,
  a.doc-pager__btn .doc-pager__title::after {
    transition: none !important;
  }

  a.doc-pager__btn:hover {
    transform: none;
  }

  a.doc-pager__btn--prev:hover .doc-pager__title::after,
  a.doc-pager__btn--next:hover .doc-pager__title::after,
  a.doc-pager__btn--prev:focus-visible .doc-pager__title::after,
  a.doc-pager__btn--next:focus-visible .doc-pager__title::after {
    transform: scaleX(1) !important;
  }
}

.doc-prose p {
  margin: 0 0 var(--space-md);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.68;
}

.doc-prose p:last-child {
  margin-bottom: 0;
}

.doc-prose .doc-note-techlink {
  font-size: 0.9rem;
  line-height: 1.5;
}

.doc-prose .doc-note-techlink__em {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.doc-prose .doc-h2 {
  margin: var(--space-xl) 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 12px);
  position: relative;
}

.doc-prose .doc-h2:first-child {
  margin-top: 0;
}

.doc-figure-cap,
.doc-table-title {
  margin: var(--space-md) 0;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.doc-media {
  margin: 0 0 var(--space-lg);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  overflow: hidden;
}

.doc-media img {
  width: 100%;
  height: auto;
  display: block;
}

.doc-media__cap {
  margin: 0;
  padding: 0.6rem 0.85rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  line-height: 1.45;
}

.doc-media--table {
  background: #f8fafc;
}

.doc-media-row {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 var(--space-lg);
}

.doc-media-row .doc-media {
  margin-bottom: 0;
}

.doc-media-row--pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.doc-media-row--pair__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

/* Must qualify with .doc-prose so font-size/line-height win over .doc-prose p */
.doc-prose .doc-media-row--pair__cap {
  margin: 0.45rem 0 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
  max-width: 36ch;
  word-wrap: break-word;
}

/* Captions under single (non-paired) figures: keep centered, allow 1–2 line wrap */
.doc-prose figure.doc-media + .doc-media-row--pair__cap {
  margin-left: auto;
  margin-right: auto;
  max-width: 68ch;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Figure 2 long caption: use full column width (same as card above) so it wraps ~2 lines, not 4 */
.doc-prose .doc-media-row--pair__col:first-child .doc-media-row--pair__cap {
  align-self: stretch;
  max-width: 100%;
  box-sizing: border-box;
}

/* Pair layout: figures span each grid column so images scale down and the row never overflows */
.doc-media-row--pair__col .doc-media--pair {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Pair cards: fit entire image inside the frame — no clipping (avoid overflow:hidden + height-only scale). */
.doc-media--pair {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 260px;
  padding: 0.5rem;
  overflow: visible;
  background: #fff;
}

.doc-media--pair img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}

/* Figure 2 / 3 row only: right column is prototype photo (full card height, no inner padding) */
.doc-media-row--pair--fan-photo .doc-media-row--pair__col:nth-child(2) .doc-media--pair {
  padding: 0;
  overflow: visible;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

.doc-media-row--pair--fan-photo .doc-media-row--pair__col:nth-child(2) .doc-media--pair img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  flex-shrink: 0;
}

.doc-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
  margin: var(--space-md) 0 var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  transition: box-shadow var(--doc-anim-fast) var(--ease-out), border-color var(--doc-anim-fast) var(--ease-out);
}

.doc-toc:hover {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.doc-toc-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: var(--space-xs);
}

.doc-toc a {
  white-space: nowrap;
}
