/* ==========================================================================
   Kaimei AI — site stylesheet
   Light-first design system with a matched dark theme.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-jp: "Noto Sans JP", var(--font-sans);

  --cyan: #3ec8ff;
  --blue: #6b8cff;
  --violet: #a078ff;
  --magenta: #e86bff;
  --pink: #ff6bb5;
  --grad: linear-gradient(90deg, #3ec8ff 0%, #6b8cff 42%, #c86bff 78%, #ff6bb5 100%);
  /* --grad mirrored so it tiles seamlessly at 200% width; animated by grad-flow */
  --grad-loop: linear-gradient(90deg, #3ec8ff 0%, #6b8cff 21%, #c86bff 39%, #ff6bb5 50%, #c86bff 61%, #6b8cff 79%, #3ec8ff 100%);
  --grad-v: linear-gradient(180deg, #3ec8ff 0%, #6b8cff 42%, #a078ff 70%, #ff6bb5 100%);
  --toward: linear-gradient(90deg, #6b8cff, #3ec8ff);
  --away: linear-gradient(270deg, #e86bff, #ff6bb5);

  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --bg-sunken: #f3f4f8;
  --bg-code: #0d0f16;
  --ink: #0b0c10;
  --ink-2: #3f424d;
  --ink-3: #6f7484;
  --ink-4: #a0a4b3;
  --line: rgba(11, 12, 16, 0.08);
  --line-strong: rgba(11, 12, 16, 0.16);
  --accent: #4f63f2;
  --accent-soft: rgba(107, 140, 255, 0.12);
  --header-bg: rgba(251, 251, 253, 0.72);
  --shadow-sm: 0 1px 2px rgba(11, 12, 16, 0.04), 0 2px 8px rgba(11, 12, 16, 0.04);
  --shadow-md: 0 2px 6px rgba(11, 12, 16, 0.05), 0 16px 40px -12px rgba(11, 12, 16, 0.14);
  --shadow-lg: 0 8px 20px -8px rgba(11, 12, 16, 0.12), 0 40px 80px -32px rgba(60, 70, 140, 0.25);
  --aurora-opacity: 0.55;
  --grain-opacity: 0.35;
  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #090a0f;
  --bg-elev: #111218;
  --bg-sunken: #0d0e14;
  --bg-code: #0b0c12;
  --ink: #f4f5f9;
  --ink-2: #c3c6d3;
  --ink-3: #868b9c;
  --ink-4: #585d6e;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #93a4ff;
  --accent-soft: rgba(107, 140, 255, 0.16);
  --header-bg: rgba(9, 10, 15, 0.7);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 20px -8px rgba(0, 0, 0, 0.5), 0 40px 80px -32px rgba(107, 140, 255, 0.25);
  --aurora-opacity: 0.38;
  --grain-opacity: 0.5;
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
code, kbd, pre { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(107, 140, 255, 0.28); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 40px); }
.container-narrow { max-width: 780px; }
.container-wide { max-width: 1360px; }
.section { padding-block: clamp(72px, 9vw, 128px); position: relative; }
.section-tight { padding-block: clamp(48px, 6vw, 80px); }
.section-sunken { background: var(--bg-sunken); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: clamp(40px, 5vw, 64px); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head .lead { margin-top: 20px; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.split.reverse > :first-child { order: 2; }
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.reverse > :first-child { order: 0; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Typography ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 20px;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--grad); }
.h1, .h2, .h3, .h4 { font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.h1 { font-size: clamp(2.75rem, 7.2vw, 5.75rem); letter-spacing: -0.04em; line-height: 0.98; font-weight: 600; }
.h2 { font-size: clamp(2rem, 4.2vw, 3.4rem); }
.h3 { font-size: clamp(1.35rem, 2vw, 1.75rem); letter-spacing: -0.02em; line-height: 1.2; }
.h4 { font-size: 1.125rem; letter-spacing: -0.01em; line-height: 1.3; }
.lead { font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.muted { color: var(--ink-3); }
.small { font-size: 0.9rem; }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); font-style: normal; font-weight: 500; letter-spacing: -0.03em; line-height: 0.7; /* Newsreader sits low in its line box; a short one keeps the surrounding Inter lines evenly spaced */ }
.grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: 0.06em; /* keep the last glyph's overhang inside the clipped gradient */
}
.jp { font-family: var(--font-jp); font-weight: 500; }
.prose p + p { margin-top: 1em; }
.prose p { color: var(--ink-2); font-size: 1.05rem; }
.prose h2, .prose h3 { margin-top: 2em; margin-bottom: 0.6em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul { list-style: disc; padding-left: 1.25em; color: var(--ink-2); }
.prose li + li { margin-top: 0.4em; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font-size: 15px; font-weight: 500; letter-spacing: -0.005em; white-space: nowrap;
  border: 1px solid transparent; transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.25s, color 0.25s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(107, 140, 255, 0.4), 0 12px 28px -10px rgba(107, 140, 255, 0.55); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-sunken); border-color: var(--ink-4); transform: translateY(-1px); }
.btn-grad { background: var(--grad-loop) 0 0 / 200% 100% border-box; color: var(--ink); animation: grad-flow 10s linear infinite; }
.btn-grad:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -12px rgba(200, 107, 255, 0.6); }
.btn-white { background: #fff; color: #0b0c10; }
.btn-white:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.4); }
.btn-outline-white { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.btn-outline-white:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.6); transform: translateY(-1px); }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn .arrow { transition: transform 0.25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--accent); }
.btn-link svg { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.btn-link:hover svg { transform: translateX(3px); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Pills, chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px 0 8px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-elev);
  font-size: 13px; font-weight: 500; color: var(--ink-2); transition: border-color 0.2s, transform 0.2s var(--ease);
}
.pill:hover { border-color: var(--ink-4); transform: translateY(-1px); }
.pill .dot { width: 18px; height: 18px; border-radius: 999px; background: var(--grad); display: grid; place-items: center; }
.pill .dot::after { content: ""; width: 6px; height: 6px; border-radius: 99px; background: #fff; }
.pill svg { width: 14px; height: 14px; color: var(--ink-3); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-elev); font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2);
}
.chip b { font-weight: 500; color: var(--ink); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.02em; color: var(--ink-2); background: var(--bg-sunken); border: 1px solid var(--line); white-space: nowrap; }
.tag.grad { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
/* "Coming soon": a feature on the roadmap, not yet in the product */
.tag.soon { background: transparent; color: var(--accent); border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); }
.chip .soon { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }

/* ---------- Cards ---------- */
.card {
  position: relative; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card .icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 20px;
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--ink);
}
.card .icon svg { width: 20px; height: 20px; }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--ink-2); font-size: 15.5px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: 68px;
  display: flex; align-items: center;
  background: transparent; transition: background 0.3s, border-color 0.3s, height 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled, .site-header.is-open {
  background: var(--header-bg); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
  height: 60px;
}
/* Animated gradient in place of the bottom border; fades in with the header background */
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: var(--grad-loop) 0 0 / 200% 100%; animation: grad-flow 10s linear infinite;
  opacity: 0; transition: opacity 0.3s;
}
.site-header.is-scrolled::after, .site-header.is-open::after { opacity: 1; }
@keyframes grad-flow { to { background-position: -200% 0; } }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: inline-flex; align-items: center; height: 40px; }
.logo img { height: 28px; width: auto; }
.logo .logo-dark { display: none; }
html[data-theme="dark"] .logo .logo-light { display: none; }
html[data-theme="dark"] .logo .logo-dark { display: block; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-2); transition: color 0.2s, background 0.2s;
}
.nav a:hover { color: var(--ink); background: var(--bg-sunken); }
.nav a.is-current { color: var(--ink); }
/* Platform menu: opens on hover or keyboard focus; the Platform link itself still goes to the overview */
.nav-group { position: relative; }
.nav-group > a svg { width: 14px; height: 14px; margin: 1px -4px 0 4px; color: var(--ink-3); transition: transform 0.25s var(--ease); }
.nav-group:hover > a svg, .nav-group:focus-within > a svg { transform: rotate(180deg); }
.nav-menu {
  position: absolute; left: 50%; top: 100%; z-index: 60; width: 340px; margin-top: 10px; padding: 8px;
  display: grid; gap: 2px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--bg-elev); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translate(-50%, -6px); transition: opacity 0.2s, transform 0.25s var(--ease), visibility 0.2s;
}
.nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; } /* keeps the menu open on the way down */
.nav-group:hover .nav-menu, .nav-group:focus-within .nav-menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.nav .nav-menu a { display: grid; gap: 1px; height: auto; padding: 10px 12px; border-radius: 12px; }
.nav-menu b { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.nav-menu span { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.nav .nav-menu a.is-current { background: var(--accent-soft); }
/* the Solutions menu: eight entries in two columns */
.nav-menu-wide { width: 600px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .nav-menu-wide { left: 0; transform: translate(-30%, -6px); } .nav-group:hover .nav-menu-wide, .nav-group:focus-within .nav-menu-wide { transform: translate(-30%, 0); } }
.header-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: var(--ink-2);
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--bg-sunken); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-moon { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-moon { display: block; }
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 10px; place-items: center; color: var(--ink); }
.menu-btn svg { width: 22px; height: 22px; }
.menu-btn .i-close { display: none; }
.site-header.is-open .menu-btn .i-close { display: block; }
.site-header.is-open .menu-btn .i-menu { display: none; }
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .nav, .header-actions .btn-grad { display: none; }
  .menu-btn { display: grid; }
  .mobile-nav {
    position: fixed; inset: 60px 0 0 0; z-index: 49; padding: 24px clamp(20px, 5vw, 40px) 40px;
    background: var(--bg); border-top: 1px solid var(--line);
    flex-direction: column; gap: 4px; overflow: auto;
    opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity 0.25s, transform 0.25s var(--ease);
  }
  .mobile-nav.is-open { display: flex; opacity: 1; transform: none; pointer-events: auto; }
  .mobile-nav a { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .mobile-nav a.has-sub { border-bottom: 0; padding-bottom: 4px; }
  .mobile-sub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
  .mobile-nav .mobile-sub a { font-size: 1rem; font-weight: 500; letter-spacing: 0; padding: 8px 0; border-bottom: 0; color: var(--ink-2); }
  .mobile-nav .mobile-sub a.is-current { color: var(--accent); }
  .mobile-nav .cta-row { margin-top: 24px; }
  .mobile-nav .cta-row .btn { flex: 1; font-size: 15px; font-weight: 500; letter-spacing: 0; border-bottom: 0; padding: 0 20px; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(140px, 18vw, 200px); padding-bottom: 0; }
.hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
/* Animated lattice (js/site.js initLattice). The CSS grid below is the no-JS fallback. */
.hero-bg .lattice {
  position: absolute; left: 0; top: 0; display: block; opacity: 0; transition: opacity 1.4s var(--ease);
  -webkit-mask-image: radial-gradient(ellipse 82% 76% at 50% 0%, #000 28%, transparent 100%);
  mask-image: radial-gradient(ellipse 82% 76% at 50% 0%, #000 28%, transparent 100%);
}
.hero-bg.is-live .lattice { opacity: 1; }
.hero-bg.has-lattice .grid-lines { display: none; }
.hero-bg .grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 100%);
}
.aurora { position: absolute; border-radius: 50%; filter: blur(70px); opacity: var(--aurora-opacity); will-change: transform; }
.aurora.a1 { width: 56vw; height: 56vw; max-width: 760px; max-height: 760px; left: -12vw; top: -22vw; background: radial-gradient(circle at 40% 40%, var(--cyan), transparent 62%); animation: drift1 26s ease-in-out infinite alternate; }
.aurora.a2 { width: 50vw; height: 50vw; max-width: 700px; max-height: 700px; right: -10vw; top: -18vw; background: radial-gradient(circle at 50% 50%, var(--pink), transparent 62%); animation: drift2 30s ease-in-out infinite alternate; }
.aurora.a3 { width: 40vw; height: 40vw; max-width: 560px; max-height: 560px; left: 35vw; top: -8vw; background: radial-gradient(circle at 50% 50%, var(--violet), transparent 62%); animation: drift3 34s ease-in-out infinite alternate; opacity: calc(var(--aurora-opacity) * 0.8); }
@keyframes drift1 { to { transform: translate(8vw, 6vw) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-6vw, 7vw) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-5vw, 4vw) scale(0.95); } }
.grain {
  position: absolute; inset: 0; opacity: calc(var(--grain-opacity) * 0.22); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
html[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: calc(var(--grain-opacity) * 0.16); }
.hero-inner { text-align: center; max-width: 980px; margin-inline: auto; }
.hero-inner .pill { margin-bottom: 28px; }
.hero-inner .h1 { margin-inline: auto; }
.hero-inner .lead { max-width: 680px; margin: 28px auto 0; }
.hero-inner .cta-row { justify-content: center; margin-top: 36px; }
.hero-note { margin-top: 28px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 18px; }
.hero-note span::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 99px; background: var(--ink-4); margin-right: 10px; vertical-align: 2px; }
.hero-note span:first-child::before { display: none; }
.hero-note code { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; color: var(--ink-2); }

/* Rotating word */
.rotator { display: inline-grid; vertical-align: baseline; text-align: center; }
.rotator > span { grid-area: 1 / 1; line-height: inherit; white-space: nowrap; opacity: 0; transform: translateY(0.35em); filter: blur(6px); transition: opacity 0.45s var(--ease) 0.2s, transform 0.6s var(--ease) 0.2s, filter 0.45s var(--ease) 0.2s; }
.rotator > span.is-active { opacity: 1; transform: none; filter: blur(0); }
.rotator > span.is-exit { opacity: 0; transform: translateY(-0.3em); filter: blur(6px); transition: opacity 0.25s var(--ease), transform 0.35s var(--ease), filter 0.25s var(--ease); }

/* ---------- Hero demo (explanation panel) ---------- */
.hero-demo-wrap { margin-top: clamp(48px, 6vw, 80px); position: relative; }
.demo {
  position: relative; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-lg); overflow: hidden; text-align: left;
}
.demo::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(62, 200, 255, 0.12), transparent 30%, transparent 70%, rgba(255, 107, 181, 0.12));
  opacity: 0.8;
}
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
.demo-dots { display: flex; gap: 6px; }
.demo-dots i { width: 10px; height: 10px; border-radius: 99px; background: var(--line-strong); }
.demo-title { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 10px; }
.demo-title b { color: var(--ink); font-weight: 500; }
.demo-tabs { display: flex; gap: 4px; padding: 10px 14px 0; overflow-x: auto; scrollbar-width: none; }
.demo-tabs::-webkit-scrollbar { display: none; }
.demo-tab {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--ink-3); border: 1px solid transparent; transition: all 0.2s;
}
.demo-tab:hover { color: var(--ink); background: var(--bg-sunken); }
.demo-tab.is-active { color: var(--ink); background: var(--bg-sunken); border-color: var(--line); }
.demo-tab .sw { width: 8px; height: 8px; border-radius: 99px; background: var(--ink-4); }
.demo-tab.is-active .sw { background: var(--grad); }
.demo-body { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 0; }
.demo-inputs { padding: 18px 20px 22px; border-right: 1px solid var(--line); }
.demo-label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.demo-input-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.demo-input {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease);
}
.demo-input small { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.demo-input b { font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-input.is-hot { border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-1px); }
.demo-method { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.demo-method .tag.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.demo-result { padding: 18px 22px 20px; min-width: 0; }
.demo-pred { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.demo-pred .word { font-size: clamp(1.9rem, 3vw, 2.5rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.demo-pred .prob { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); white-space: pre; }
.demo-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.demo-legend { display: flex; gap: 16px; margin: 16px 0 10px; font-size: 12.5px; color: var(--ink-3); }
.demo-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.demo-legend .t i { background: var(--toward); }
.demo-legend .a i { background: var(--away); }
.attr { display: grid; gap: 7px; }
.attr-row { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 72px; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12.5px; cursor: default; }
.attr-name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr-name span { color: var(--ink-3); }
.attr-track { position: relative; height: 14px; }
.attr-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.attr-bar { position: absolute; top: 2px; height: 10px; width: 0; border-radius: 3px; transition: width 0.9s var(--ease), opacity 0.3s; }
.attr-bar.toward { left: 50%; background: var(--toward); border-radius: 0 3px 3px 0; }
.attr-bar.away { right: 50%; background: var(--away); border-radius: 3px 0 0 3px; }
.attr-val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.attr-row:hover .attr-name, .attr-row.is-hot .attr-name { color: var(--accent); }
.attr-row.is-dim .attr-bar { opacity: 0.35; }
.demo-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); background: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
.demo-foot a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.demo-foot a:hover { color: var(--accent); }
.demo-foot a svg { width: 14px; height: 14px; }
.demo-foot code { font-size: 12px; color: var(--ink-3); }
@media (max-width: 760px) {
  .demo-body { grid-template-columns: minmax(0, 1fr); }
  .demo-inputs { border-right: 0; border-bottom: 1px solid var(--line); }
  .demo-input-list { grid-template-columns: repeat(4, 1fr); }
  .attr-row { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) 62px; font-size: 11.5px; gap: 8px; }
  .demo-foot { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) { .demo-input-list { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Framework strip ---------- */
.strip { padding-block: 36px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: clamp(64px, 8vw, 110px); }
.strip-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.strip-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.strip-items { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.strip-items .chip { height: 34px; font-size: 13px; }

/* Homepage: three labelled rows that scroll once initMarquee (js/site.js) doubles each track and adds .is-live.
   Without .is-live (no JS, reduced motion) the chips simply wrap. Chips space with margin, not gap, so the
   doubled track is exactly twice one copy and the -50% loop has no seam. */
.strip-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 14px 36px; }
.strip-grid .strip-label { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.strip-grid .strip-label::before { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--grad); }
.marquee { min-width: 0; }
.marquee-track { display: flex; flex-wrap: wrap; row-gap: 8px; }
.marquee-track .chip { flex: none; height: 34px; margin-right: 10px; font-size: 13px; white-space: nowrap; }
.marquee.is-live { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
.marquee.is-live .marquee-track { flex-wrap: nowrap; width: max-content; animation: marquee 60s linear infinite; }
.marquee.is-live[data-reverse] .marquee-track { animation-direction: reverse; }
.marquee.is-live:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (max-width: 640px) {
  .strip-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .strip-grid .marquee:not(:last-child) { margin-bottom: 12px; }
}

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-elev); }
.step { padding: 28px 26px 30px; border-right: 1px solid var(--line); position: relative; display: flex; flex-direction: column; gap: 14px; transition: background 0.3s; }
.step:last-child { border-right: 0; }
.step:hover { background: var(--bg-sunken); }
.step-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 10px; }
.step-num::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.step h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.015em; }
.step p { color: var(--ink-2); font-size: 15px; flex: 1; }
.step code { display: block; font-size: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-code); color: #d7dbe8; overflow-x: auto; white-space: pre; line-height: 1.55; }
@media (max-width: 980px) {
  .steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { border-right: 0 !important; border-bottom: 1px solid var(--line); }
  .step:last-child { border-bottom: 0; }
}

/* ---------- How it works: scroll-driven stage (js/site.js initHow) ----------
   initHow adds .is-live: the section pins for four screens of scroll and the
   canvas plays one act per step. Without JS, under reduced motion or on very
   short screens it never does, and the steps above stay a static grid. */
.how-stage { display: none; }
.how.is-live { padding-bottom: 0; }
.how.is-live .how-track { height: calc(100vh + 4 * 80vh); }
.how.is-live .how-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; align-items: center; padding-top: 60px; }
.how.is-live .how-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.how.is-live .how-stage {
  grid-column: 2; grid-row: 1; display: flex; flex-direction: column; position: relative; margin: 0;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.how-stage::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(62, 200, 255, 0.08), transparent 30%, transparent 70%, rgba(255, 107, 181, 0.08));
}
.how-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
.how-progress { display: none; gap: 4px; }
.how.is-live .how-grid > * { min-width: 0; }
.how-progress i { width: 18px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--violet)) 0 0 / calc(var(--t, 0) * 100%) 100% no-repeat, var(--line-strong); }
.how-canvas { display: block; width: 100%; height: clamp(300px, calc(100svh - 250px), 500px); }
.how-cap { display: grid; padding: 12px 18px 14px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--ink-3); background: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
.how-cap span { grid-area: 1 / 1; opacity: 0; transform: translateY(4px); transition: opacity 0.4s var(--ease), transform 0.5s var(--ease); }
.how-cap span.is-active { opacity: 1; transform: none; }

/* the steps become a list with a progress rail; only the current one opens */
.how.is-live .steps { display: block; position: relative; padding-left: 30px; border: 0; border-radius: 0; background: none; overflow: visible; }
.how.is-live .step { border: 0; padding: 12px 0 14px; gap: 0; background: none; cursor: pointer; }
.how.is-live .step:hover { background: none; }
.how.is-live .step::before {
  content: ""; position: absolute; left: -30px; top: 16px; width: 10px; height: 10px; border-radius: 99px;
  background: var(--bg-sunken); border: 2px solid var(--line-strong); transition: background 0.3s, border-color 0.3s;
}
.how.is-live .step::after {
  content: ""; position: absolute; left: -26px; top: 30px; bottom: -12px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet)) 0 0 / 100% calc(var(--t, 0) * 100%) no-repeat, var(--line);
}
.how.is-live .step:last-child::after { bottom: 6px; }
.how.is-live .step.is-on::before { background: var(--grad); border-color: transparent; }
.how.is-live .step h3 { font-size: 1.35rem; margin-top: 6px; color: var(--ink-3); transition: color 0.3s; }
.how.is-live .step.is-active h3, .how.is-live .step:hover h3 { color: var(--ink); }
.how.is-live .step p, .how.is-live .step code {
  max-height: 0; margin-top: 0; padding-block: 0; opacity: 0; overflow: hidden;
  transition: max-height 0.6s var(--ease), margin 0.6s var(--ease), padding 0.6s var(--ease), opacity 0.35s var(--ease);
}
.how.is-live .step.is-active p { max-height: 10em; margin-top: 10px; opacity: 1; }
.how.is-live .step.is-active code { max-height: 9em; margin-top: 14px; padding-block: 10px; opacity: 1; }
@media (max-width: 900px) {
  .how.is-live .how-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .how.is-live .how-stage { grid-column: 1; }
  .how.is-live .how-progress { display: flex; flex: none; }
  .how-stage-head .demo-dots { display: none; }
  .how.is-live .how-canvas { height: clamp(220px, 40svh, 380px); }
  .how.is-live .how-cap { display: none; }
  /* one step at a time under the stage; stacking them in one cell keeps the height steady */
  .how.is-live .steps { display: grid; padding-left: 0; }
  .how.is-live .step { grid-area: 1 / 1; padding: 0; opacity: 0; visibility: hidden; transition: opacity 0.35s var(--ease), visibility 0.35s; }
  .how.is-live .step.is-active { opacity: 1; visibility: visible; }
  .how.is-live .step::before, .how.is-live .step::after { display: none; }
  .how.is-live .step h3 { margin-top: 8px; }
  .how.is-live .step p, .how.is-live .step code { max-height: none; opacity: 1; transition: none; }
  .how.is-live .step p { margin-top: 8px; }
  .how.is-live .step code { margin-top: 12px; padding-block: 10px; }
}
@media (max-width: 900px) and (max-height: 720px) { .how.is-live .step code { display: none; } }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.tile { grid-column: span 2; display: flex; flex-direction: column; min-height: 320px; overflow: hidden; padding: 0; }
.tile-wide { grid-column: span 3; }
.tile-full { grid-column: span 6; }
.tile-body { padding: 28px 28px 0; }
.tile-body p { margin-top: 10px; }
.tile-media { margin-top: auto; padding: 24px 28px 0; position: relative; }
.tile-media img { border-radius: 12px 12px 0 0; border: 1px solid var(--line); border-bottom: 0; box-shadow: var(--shadow-md); background: #fff; }
.tile-media.pad { padding-bottom: 28px; }
.tile-media.pad img { border-radius: 12px; border-bottom: 1px solid var(--line); }
.tile-media .fade { position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(to bottom, transparent, var(--bg-elev)); pointer-events: none; }
.tile ul.check { margin-top: 16px; display: grid; gap: 8px; }
.tile ul.check li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--ink-2); }
.tile ul.check li::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 99px; background: var(--grad); -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='8' fill='black'/><path d='M4.5 8.5l2.3 2.3L11.5 6' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='8' fill='black'/><path d='M4.5 8.5l2.3 2.3L11.5 6' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat; }
@media (max-width: 980px) { .tile, .tile-wide { grid-column: span 3; } }
@media (max-width: 640px) { .tile, .tile-wide, .tile-full { grid-column: span 6; } }

/* Mini visuals inside tiles */
.mini-cf { padding: 18px 20px 20px; margin: 24px 28px 28px; border-radius: 14px; background: var(--bg-sunken); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); display: grid; gap: 10px; }
.mini-cf .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mini-cf .row b { font-weight: 500; color: var(--ink); }
.mini-cf .row .from { color: var(--ink-3); text-decoration: line-through; margin-right: 6px; }
.mini-cf .row .frozen { color: var(--ink-3); }
.mini-cf .flip { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line-strong); display: flex; justify-content: space-between; }
.mini-cf .flip .to { background: var(--toward); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 500; }
.mini-versions { margin: 24px 28px 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.mini-versions .v { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-sunken); font-size: 12.5px; }
.mini-versions .v .tag { margin-bottom: 10px; }
.mini-versions .v .line { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; color: var(--ink-2); font-family: var(--font-mono); font-size: 11.5px; }
.mini-versions .v .line b { font-weight: 500; color: var(--ink); }
.mini-versions .v .line .bad { color: #e0479a; }
.mini-versions .v .line .good { color: #1f9d6a; }
.mini-byo { margin: 24px 28px 28px; display: grid; gap: 8px; }
.mini-byo .opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-sunken); font-size: 13.5px; color: var(--ink-2); }
.mini-byo .opt code { font-size: 11.5px; color: var(--ink); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; margin-left: auto; white-space: nowrap; }
.mini-byo .opt .k { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-elev); border: 1px solid var(--line); flex: none; }
.mini-byo .opt .k svg { width: 14px; height: 14px; color: var(--ink-2); }
.method-chips { margin: 20px 28px 28px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Screenshot frame ---------- */
.frame { position: relative; border-radius: 18px; background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; }
.frame-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg-sunken); }
.frame-bar i { width: 10px; height: 10px; border-radius: 99px; background: var(--line-strong); }
.frame-bar .url { margin-left: 12px; flex: 1; max-width: 320px; height: 24px; border-radius: 6px; background: var(--bg-elev); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; padding: 0 10px; white-space: nowrap; overflow: hidden; }
.frame img { width: 100%; }
html[data-theme="dark"] .frame img.screen, html[data-theme="dark"] .tile-media img, html[data-theme="dark"] .figure img { filter: brightness(0.9) contrast(1.02); }
.frame-wrap { position: relative; }
.frame-glow { position: absolute; inset: -20% -10% auto -10%; height: 70%; background: radial-gradient(ellipse at center, rgba(107, 140, 255, 0.28), transparent 60%); filter: blur(40px); z-index: -1; pointer-events: none; }
/* the glow reaches past the frame on purpose; clip it at the section's edges so it never widens the page on narrow screens */
.section:has(.frame-glow) { overflow-x: clip; }

/* ---------- Code ---------- */
.code-panel { border-radius: 18px; background: var(--bg-code); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: var(--shadow-lg); overflow: hidden; color: #d7dbe8; }
.code-tabs { display: flex; align-items: center; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.02); }
.code-tab { height: 38px; padding: 0 14px; border-radius: 10px 10px 0 0; font-family: var(--font-mono); font-size: 12.5px; color: #8b91a5; position: relative; transition: color 0.2s; }
.code-tab:hover { color: #d7dbe8; }
.code-tab.is-active { color: #fff; }
.code-tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--grad); border-radius: 2px; }
.code-tabs .copy { margin-left: auto; margin-bottom: 6px; height: 30px; padding: 0 12px; border-radius: 8px; font-family: var(--font-mono); font-size: 12px; color: #a3a9bd; border: 1px solid rgba(255, 255, 255, 0.1); display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s; }
.code-tabs .copy:hover { color: #fff; border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.04); }
.code-tabs .copy svg { width: 13px; height: 13px; }
.code-pane { display: none; }
.code-pane.is-active { display: block; }
.code-panel pre { margin: 0; padding: 22px 24px 26px; font-size: 13.25px; line-height: 1.65; overflow-x: auto; tab-size: 4; }
.code-panel code { font-family: var(--font-mono); }
.tk-kw { color: #c792ea; }
.tk-fn { color: #82aaff; }
.tk-str { color: #9ce0a6; }
.tk-num { color: #f78c6c; }
.tk-cm { color: #6b7389; font-style: italic; }
.tk-key { color: #ffcb6b; }
.tk-op { color: #89ddff; }
.tk-cls { color: #ffcb6b; }
.code-inline { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; color: var(--ink); }
pre.code-block { margin: 0; padding: 18px 20px; border-radius: 14px; background: var(--bg-code); color: #d7dbe8; font-size: 13px; line-height: 1.65; overflow-x: auto; border: 1px solid rgba(255, 255, 255, 0.08); }

/* ---------- Dev section ---------- */
.dev-links { display: grid; gap: 10px; margin-top: 28px; }
.dev-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-elev); transition: border-color 0.2s, transform 0.25s var(--ease), box-shadow 0.25s; }
.dev-link:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.dev-link .k { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-sunken); border: 1px solid var(--line); flex: none; }
.dev-link .k svg { width: 18px; height: 18px; color: var(--ink); }
.dev-link b { display: block; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.dev-link span { display: block; color: var(--ink-3); font-size: 13.5px; }
.dev-link .ext { margin-left: auto; width: 16px; height: 16px; color: var(--ink-4); flex: none; }

/* ---------- Principles ---------- */
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; border-top: 1px solid var(--line); }
.principles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.principle { padding: 36px 0 8px; }
.principle .num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-bottom: 18px; }
.principle h3 { font-size: 1.3rem; margin-bottom: 12px; }
.principle p { color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 900px) { .principles { grid-template-columns: minmax(0, 1fr); border-top: 0; } .principle { padding-top: 28px; border-top: 1px solid var(--line); } }

/* ---------- Narrative ---------- */
.narrative { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.narrative .statement { font-size: clamp(1.75rem, 3.4vw, 2.75rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; text-wrap: balance; }
.narrative .copy { margin-top: 24px; color: var(--ink-2); font-size: 1.05rem; }
.figure { position: relative; }
.figure img { border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-md); background: #fff; }
.figure figcaption { margin-top: 14px; font-size: 13.5px; color: var(--ink-3); line-height: 1.5; }
@media (max-width: 900px) { .narrative { grid-template-columns: minmax(0, 1fr); } }

/* ---------- CTA band ---------- */
.cta-band { position: relative; overflow: hidden; border-radius: 28px; padding: clamp(56px, 8vw, 104px) clamp(24px, 6vw, 80px); text-align: center; color: #fff; background: #0b0c10; isolation: isolate; }
.cta-band::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 180deg at 50% 50%, #3ec8ff, #6b8cff, #a078ff, #ff6bb5, #3ec8ff); filter: blur(80px); opacity: 0.75; z-index: -1; animation: spin 28s linear infinite; }
.cta-band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 12, 16, 0.25), rgba(11, 12, 16, 0.55)); z-index: -1; }
@keyframes spin { to { transform: rotate(1turn); } }
.cta-band .h2 { color: #fff; }
.cta-band .lead { color: rgba(255, 255, 255, 0.82); max-width: 620px; margin: 20px auto 0; }
.cta-band .cta-row { justify-content: center; margin-top: 36px; }
.cta-band .mark { width: 56px; height: 56px; margin: 0 auto 28px; color: #fff; }

/* ---------- Footer ---------- */
.site-footer { position: relative; border-top: 1px solid transparent; padding: clamp(56px, 6vw, 80px) 0 40px; background: var(--bg); }
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; pointer-events: none; background: var(--grad-loop) 0 0 / 200% 100%; animation: grad-flow 10s linear infinite; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 1100px) { .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .footer-brand { grid-column: span 3; } }
.footer-brand .logo img { height: 30px; }
.footer-brand p { margin-top: 18px; color: var(--ink-3); font-size: 14.5px; max-width: 320px; }
.footer-brand .jp-line { margin-top: 14px; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 10px; }
.footer-brand .jp-line .jp { flex: none; white-space: nowrap; font-size: 15px; background: var(--grad-loop) 0 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: grad-flow 10s linear infinite; }
.footer-col h4 { font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 16px; }
.footer-col ul { display: grid; gap: 10px; }
.footer-col a { color: var(--ink-2); font-size: 14.5px; transition: color 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.footer-col a:hover { color: var(--ink); }
.footer-col a svg { width: 12px; height: 12px; color: var(--ink-4); }
.footer-bottom { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--ink-3); }
.footer-bottom .links { display: flex; gap: 20px; }
.footer-bottom a:hover { color: var(--ink); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .footer-brand { grid-column: span 2; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: minmax(0, 1fr); } .footer-brand { grid-column: span 1; } }

/* ---------- Sub-page hero ---------- */
.page-hero { position: relative; padding-top: clamp(130px, 16vw, 180px); padding-bottom: clamp(40px, 5vw, 64px); }
.page-hero .h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.page-hero .lead { margin-top: 24px; max-width: 680px; }
.page-hero .cta-row { margin-top: 32px; }
.page-hero.center { text-align: center; }
.page-hero.center .lead, .page-hero.center .h1 { margin-inline: auto; }
.page-hero.center .cta-row { justify-content: center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-elev); }
table.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; background: var(--bg-sunken); }
.table tr:last-child td { border-bottom: 0; }
.table td code { font-size: 12.5px; }
.table .yes { color: #1f9d6a; font-weight: 500; }
.table .no { color: var(--ink-3); }
.table .partial { color: #c77d12; font-weight: 500; }
.table .soon { color: var(--accent); font-weight: 500; }
/* Pricing: plan limits, with each limit named in its row's header. */
.table.limits tbody th { text-transform: none; letter-spacing: 0; font-size: 14.5px; font-weight: 500; color: var(--ink); background: transparent; }
.table.limits td { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0; font-size: 1.05rem; font-weight: 500; letter-spacing: -0.01em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus { flex: none; width: 24px; height: 24px; border-radius: 99px; border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--ink-3); transition: transform 0.3s var(--ease), background 0.2s; }
.faq summary .plus svg { width: 12px; height: 12px; }
.faq details[open] summary .plus { transform: rotate(45deg); background: var(--ink); color: var(--bg); border-color: var(--ink); }
.faq .answer { padding: 0 0 24px; color: var(--ink-2); max-width: 720px; font-size: 15.5px; }
.faq .answer a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Pricing ---------- */
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
/* Subgrid lines up each plan's price, button and list with its neighbours however its copy wraps. */
.plan { display: grid; grid-template-rows: subgrid; grid-row: span 5; row-gap: 0; padding: 32px 24px; }
.plan.featured { border-color: transparent; background: linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box, var(--grad) border-box; box-shadow: var(--shadow-md); }
.plan-head { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.plan-head h3 { margin-bottom: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
.plan .price { margin-top: 20px; display: flex; align-items: baseline; gap: 6px; }
.plan .price .amt { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.plan .price .per { color: var(--ink-3); font-size: 14px; }
.plan .desc { margin-top: 12px; color: var(--ink-2); font-size: 15px; min-height: 48px; }
.plan .btn { margin-top: 24px; width: 100%; }
.plan ul { margin-top: 26px; display: grid; align-content: start; gap: 11px; padding-top: 24px; border-top: 1px solid var(--line); }
.plan li { display: flex; gap: 10px; font-size: 14.5px; color: var(--ink-2); align-items: flex-start; }
.plan li svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--accent); }
.plan li b { color: var(--ink); font-weight: 500; }
@media (max-width: 980px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .plans { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-inline: auto; } }

/* ---------- Docs cards ---------- */
.guide { display: flex; flex-direction: column; gap: 14px; padding: 26px; }
.guide .num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; align-items: center; }
.guide h3 { font-size: 1.15rem; margin: 0; }
.guide p { flex: 1; }
.guide .links { display: flex; gap: 14px; flex-wrap: wrap; }
.guide .links a { font-size: 13.5px; font-weight: 500; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.guide .links a svg { width: 13px; height: 13px; }
.guide .feats { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.reasons { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.reason { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-elev); cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; text-align: left; }
.reason b { font-size: 14.5px; font-weight: 600; }
.reason span { font-size: 13px; color: var(--ink-3); }
.reason.is-active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-soft); }
.form { display: grid; gap: 16px; }
.form .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 560px) { .form .row { grid-template-columns: minmax(0, 1fr); } .reasons { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 7px; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 12px 14px; transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-soft); }
.form .hint { font-size: 13px; color: var(--ink-3); }
.contact-aside { display: grid; gap: 14px; }

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 120px 20px 80px; }
.notfound .code { font-family: var(--font-mono); font-size: clamp(5rem, 18vw, 11rem); font-weight: 500; letter-spacing: -0.06em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Login (redirect) ---------- */
.redirect { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.redirect .logo { justify-content: center; margin-bottom: 32px; }
.redirect .logo img { height: 36px; }
.spinner { width: 28px; height: 28px; border-radius: 99px; border: 2px solid var(--line-strong); border-top-color: var(--accent); margin: 24px auto 0; animation: rot 0.9s linear infinite; }
@keyframes rot { to { transform: rotate(1turn); } }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.hero .reveal { transform: translateY(14px); }
.hero .reveal[data-delay="1"] { transition-delay: 0.1s; }
.hero .reveal[data-delay="2"] { transition-delay: 0.2s; }
.hero .reveal[data-delay="3"] { transition-delay: 0.3s; }
.hero .reveal[data-delay="4"] { transition-delay: 0.45s; }

/* ---------- Responsive helpers ---------- */
.pill .pill-short { display: none; }
@media (max-width: 640px) {
  .pill .pill-long { display: none; }
  .pill .pill-short { display: inline; }
  .hide-sm { display: none !important; }
  .demo-head > .demo-meta { display: none; }
  .demo-title { white-space: nowrap; }
}

/* ---------- Kanji card (about) ---------- */
.kanji-card { position: relative; overflow: hidden; padding: clamp(32px, 5vw, 56px); border-radius: 24px; background: var(--bg-elev); border: 1px solid var(--line); text-align: center; box-shadow: var(--shadow-md); }
.kanji-card::before { content: ""; position: absolute; inset: -30%; background: radial-gradient(circle at 30% 20%, rgba(62, 200, 255, 0.18), transparent 50%), radial-gradient(circle at 75% 80%, rgba(255, 107, 181, 0.18), transparent 50%); pointer-events: none; }
.kanji { position: relative; font-family: var(--font-jp); font-weight: 500; font-size: clamp(6rem, 14vw, 10.5rem); line-height: 1; letter-spacing: 0.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kanji-parts { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 28px; }
.kanji-parts div { padding: 16px; border-radius: 14px; background: var(--bg-sunken); border: 1px solid var(--line); }
.kanji-parts .ch { font-family: var(--font-jp); font-size: 1.6rem; font-weight: 500; line-height: 1; }
.kanji-parts .ro { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-top: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
.kanji-parts .me { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.kanji-card .def { position: relative; margin-top: 20px; font-family: var(--font-serif); font-size: 1.35rem; color: var(--ink-2); }

/* ---------- Misc ---------- */
.kicker-list { display: flex; flex-wrap: wrap; gap: 8px; }
.divider { height: 1px; background: var(--line); }
.stat { padding: 24px 0; border-top: 1px solid var(--line); }
.stat .n { font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.stat .l { margin-top: 8px; color: var(--ink-3); font-size: 14px; }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.method { padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-elev); }
.method b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
.method span { font-size: 13.5px; color: var(--ink-2); }
.method .tag { margin-bottom: 10px; }
@media (max-width: 900px) { .method-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 560px) { .method-grid { grid-template-columns: minmax(0, 1fr); } }
.values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .values { grid-template-columns: minmax(0, 1fr); } }
.timeline { display: grid; gap: 0; border-left: 1px solid var(--line-strong); margin-left: 8px; }
.timeline li { position: relative; padding: 0 0 28px 28px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 7px; width: 9px; height: 9px; border-radius: 99px; background: var(--grad); }
.timeline li b { display: block; font-weight: 600; margin-bottom: 4px; }
.timeline li span { color: var(--ink-2); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Grid children must never force a track wider than the viewport (classic grid blowout) */
.grid > *, .split > *, .bento > *, .plans > *, .values > *, .narrative > *, .contact-grid > *, .footer-grid > *, .steps > *, .method-grid > *, .principles > *, .demo-body > *, .kanji-parts > *, .mini-versions > *, .reasons > *, .form .row > * { min-width: 0; }
.frame-bar .url { min-width: 0; }

/* ---------- Inside the model: scroll-driven fly-through (js/flythrough.js) ----------
   Always dark, like a cinema, in both themes. The script adds .is-live (the section pins and a camera
   follows the scroll, one caption per stop) or .is-still (one finished frame above the captions, for
   reduced motion and short screens). Without either, the captions stand alone as a list. */
.fly { position: relative; background: #05060b; color: #f4f5f9; border-block: 1px solid rgba(255, 255, 255, 0.06); }
.fly-canvas, .fly-scrim { display: none; }
.fly-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px 64px; padding-block: clamp(72px, 9vw, 128px); }
.fly-step { min-width: 0; }
.fly-eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(244, 245, 249, 0.55); }
.fly-eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--grad); }
.fly-step h2, .fly-step h3 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; text-wrap: balance; color: #fff; }
.fly-step p { margin-top: 14px; font-size: 1.02rem; line-height: 1.6; color: rgba(244, 245, 249, 0.72); text-wrap: pretty; }
.fly-step code { font-size: 0.86em; color: #d7dbe8; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px; padding: 1px 6px; }
.fly-step .btn-link { margin-top: 18px; color: #aab8ff; }
.fly-step .fly-note { margin-top: 18px; font-size: 12.5px; line-height: 1.5; color: rgba(244, 245, 249, 0.42); }
@media (max-width: 760px) { .fly-steps { grid-template-columns: minmax(0, 1fr); } }

.fly.is-still .fly-canvas { display: block; width: 100%; height: min(72vh, 640px); }

.fly.is-live .fly-track { height: calc(100vh + 7.4 * 62vh); }
.fly.is-live .fly-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.fly.is-live .fly-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
/* --fly-x is the captions' right edge (set by js/flythrough.js), so the text stays on dark at any screen width */
.fly.is-live .fly-scrim { display: block; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(5, 6, 11, 0.95) 0, rgba(5, 6, 11, 0.9) var(--fly-x, 34vw), rgba(5, 6, 11, 0) calc(var(--fly-x, 34vw) + 64px)); }
.fly.is-live .fly-cap { position: absolute; top: 60px; bottom: 0; left: 0; right: 0; display: flex; align-items: center; pointer-events: none; }
.fly.is-live .fly-steps { display: grid; grid-template-columns: minmax(0, 1fr); width: min(400px, 34vw); padding: 0; gap: 0; }
.fly.is-live .fly-step {
  grid-area: 1 / 1; align-self: center; opacity: 0; transform: translateY(14px); filter: blur(4px); visibility: hidden;
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease), filter 0.5s var(--ease), visibility 0.5s;
}
.fly.is-live .fly-step.is-active { opacity: 1; transform: none; filter: none; visibility: visible; pointer-events: auto; }
@media (max-width: 900px) {
  .fly.is-live .fly-scrim { background: linear-gradient(0deg, rgba(5, 6, 11, 0.95) 0%, rgba(5, 6, 11, 0.86) 36%, rgba(5, 6, 11, 0) 54%); }
  .fly.is-live .fly-cap { align-items: flex-end; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .fly.is-live .fly-steps { width: 100%; }
  .fly.is-live .fly-step { align-self: end; }
  .fly.is-live .fly-step h2, .fly.is-live .fly-step h3 { font-size: 1.45rem; }
  .fly.is-live .fly-step p { margin-top: 10px; font-size: 0.95rem; line-height: 1.55; }
  .fly.is-live .fly-step .fly-note { margin-top: 10px; }
}

/* ---------- Walk a real forest: a live, minimal replica of the dashboard's anatomy view (js/anatomy.js) ----------
   The scene colours are the dashboard's (kaimei-dashboard src/anatomy/colors.ts). */
.anat { --anat-scene: #f3f5fa; --anat-pos: #0a84d6; --anat-neg: #e2512f; --anat-split: #6d4fd8; --anat-ok: #0f9d58; }
html[data-theme="dark"] .anat { --anat-scene: #0b0d14; --anat-pos: #3ec8ff; --anat-neg: #ff7a59; --anat-split: #a078ff; --anat-ok: #3ddc84; }
.anat button:focus-visible, .anat-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.anat-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 32px; padding: 20px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(100deg, rgba(62, 200, 255, 0.07), rgba(160, 120, 255, 0.08) 60%, rgba(255, 107, 181, 0.04)); }
.anat-kicker { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.anat-title { margin-top: 6px; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.anat-sub { margin-top: 4px; max-width: 560px; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.anat-stats { display: flex; gap: 28px; margin: 0; }
.anat-stats dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.anat-stats dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.anat-stats dd.ok { color: var(--anat-ok); }

@media (min-width: 1320px) { .anat { margin-inline: -60px; } }
.anat-body { display: grid; grid-template-columns: 252px minmax(0, 1fr) 208px; grid-template-areas: "in stage out"; }
.anat-inputs { grid-area: in; display: grid; gap: 13px; align-content: start; padding: 18px; border-right: 1px solid var(--line); }
.anat-stage { grid-area: stage; display: flex; flex-direction: column; min-height: 600px; background: var(--anat-scene); }
.anat-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.anat-pair.fit { grid-template-columns: auto minmax(0, 1fr); }
.anat-out { grid-area: out; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-left: 1px solid var(--line); }
.anat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.anat-h { font-size: 14px; font-weight: 600; }
.anat-reset { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); transition: color 0.2s; }
.anat-reset:hover { color: var(--ink); }
.anat-reset svg { width: 14px; height: 14px; }
.anat-field { display: grid; gap: 7px; }
.anat-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.anat-label output { color: var(--ink); }
.anat-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.anat-chip { height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-elev); font-size: 12px; color: var(--ink-2); transition: background 0.2s, border-color 0.2s, color 0.2s; }
.anat-chip:hover { border-color: var(--ink-4); color: var(--ink); }
.anat-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.anat-range { --fill: 0%; -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; }
.anat-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, #6b8cff, #3ec8ff) 0 0 / var(--fill) 100% no-repeat, var(--line-strong); }
.anat-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--bg-elev); border: 2px solid #6b8cff; box-shadow: var(--shadow-sm); }
.anat-range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
.anat-range::-moz-range-progress { height: 4px; border-radius: 4px; background: linear-gradient(90deg, #6b8cff, #3ec8ff); }
.anat-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-elev); border: 2px solid #6b8cff; }
.anat-derived { padding-top: 12px; border-top: 1px dashed var(--line-strong); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; color: var(--ink-4); }
.anat-derived span { color: var(--ink-2); }

.anat-view { position: relative; flex: 1; min-height: 0; }
.anat-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.anat-legend { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: calc(100% - 24px); padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg-elev) 82%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); pointer-events: none; }
.anat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.anat-legend .sw { width: 8px; height: 8px; border-radius: 2px; }
.anat-legend .sw.split { background: var(--anat-split); transform: rotate(45deg) scale(0.85); border-radius: 1px; }
.anat-legend .sw.up { background: var(--anat-pos); }
.anat-legend .sw.down { background: var(--anat-neg); }
.anat-legend .sw.path { width: 14px; height: 2px; background: var(--anat-pos); }
.anat-hint { position: absolute; right: 12px; bottom: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); pointer-events: none; }
.anat-hint kbd { padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--bg-elev); font-family: inherit; font-size: 10.5px; color: var(--ink-3); }
.anat-tip { position: absolute; z-index: 2; display: grid; gap: 2px; max-width: 230px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-elev); box-shadow: var(--shadow-md); font-size: 12px; line-height: 1.45; color: var(--ink-2); pointer-events: none; }
.anat-tip[hidden] { display: none; }
.anat-tip b { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--ink); }
.anat-transport { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg-elev); }
.anat-play { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px 0 12px; border-radius: 10px; background: linear-gradient(90deg, #3ec8ff, #6b8cff 60%, #a078ff); color: #fff; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 18px -10px rgba(107, 140, 255, 0.8); transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.anat-play:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px rgba(107, 140, 255, 0.9); }
.anat-play svg { width: 14px; height: 14px; }
.anat-play[aria-pressed="true"] .i-play, .anat-play[aria-pressed="false"] .i-stop { display: none; }
.anat-picker { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.anat-picker b { font-weight: 500; color: var(--ink); }
.anat-picker button, .anat-fit { display: inline-grid; place-items: center; height: 28px; min-width: 28px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); color: var(--ink-2); font-size: 12.5px; transition: background 0.2s, color 0.2s; }
.anat-picker button { padding: 0; }
.anat-picker button:hover, .anat-fit:hover { background: var(--bg-sunken); color: var(--ink); }
.anat-picker svg { width: 14px; height: 14px; }
.anat-fit { margin-left: auto; }

.anat-prob { display: grid; gap: 2px; }
.anat-prob b { font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.anat-prob span { font-size: 13px; color: var(--ink-3); }
.anat-prob em { font-style: normal; font-weight: 600; color: var(--ink); }
.anat-bar { position: relative; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.anat-bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--ink-4); }
.anat-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6b8cff, #3ec8ff); transition: width 0.35s var(--ease); }
.anat-note { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.anat-note b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.anat-votes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
.anat-vote { aspect-ratio: 1; border-radius: 5px; background: var(--line); transition: background 0.25s, transform 0.2s var(--ease); }
.anat-vote:hover { transform: scale(1.12); }
.anat-vote[aria-current="true"] { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 3.5px var(--ink); }

.anat-steps { padding: 18px 24px 22px; border-top: 1px solid var(--line); }
.anat-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-4); }
.anat-steps ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 10px; margin-top: 12px; padding: 0; list-style: none; }
.anat-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; align-content: start; gap: 6px 8px; min-width: 0; padding: 11px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); }
.anat-steps li.forest { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.anat-steps .n { width: 22px; height: 22px; border-radius: 99px; background: var(--accent-soft); font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 22px; text-align: center; color: var(--accent); }
.anat-steps em { grid-row: 1; grid-column: 2; justify-self: end; padding: 1px 6px; border-radius: 5px; background: var(--bg-sunken); font-family: var(--font-mono); font-size: 11px; font-style: normal; color: var(--ink-3); white-space: nowrap; }
.anat-steps em.yes { color: var(--anat-pos); }
.anat-steps em.no { color: var(--anat-split); }
.anat-steps b { grid-column: 1 / -1; margin-top: 2px; font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--ink); }
.anat-steps p { grid-column: 1 / -1; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.anat-foot { margin-top: 14px; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.anat-ok { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--anat-ok) 12%, transparent); font-weight: 500; color: var(--anat-ok); }
.anat-ok svg { width: 12px; height: 12px; }
.anat-after { margin-top: 24px; }

@media (max-width: 1080px) {
  .anat-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "stage stage" "in out"; }
  .anat-stage { min-height: 520px; }
  .anat-inputs { border-top: 1px solid var(--line); }
  .anat-out { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .anat-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "out" "in"; }
  .anat-stage { min-height: 440px; }
  .anat-inputs { border-right: 0; }
  .anat-head { padding: 16px; }
  .anat-stats { gap: 18px; }
  .anat-legend { font-size: 10.5px; gap: 2px 10px; }
  .anat-hint { display: none; }
  .anat-transport { gap: 8px; }
  .anat-votes { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .anat-steps { padding: 16px; }
}

/* ---------- Cookie and privacy choices (initConsent in site.js) ----------
   A corner card on a first visit, a settings dialog behind it and behind the footer's Cookie Settings button,
   and a short confirmation where the card was. */
.consent-card {
  position: fixed; left: 24px; bottom: 24px; z-index: 70; width: min(400px, calc(100vw - 48px));
  padding: 20px 20px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--ink-2); box-shadow: var(--shadow-lg);
  font-size: 14px; line-height: 1.55;
  opacity: 0; transform: translateY(14px); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.consent-card.is-in { opacity: 1; transform: none; }
/* the brand gradient as a hairline along the top edge, like the header's */
.consent-card::before {
  content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 1px; pointer-events: none;
  background: var(--grad-loop) 0 0 / 200% 100%; animation: grad-flow 10s linear infinite;
}
.consent-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: var(--ink); }
.consent-card p { margin-top: 6px; }
.consent-card a, .consent-lede a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.consent-card a:hover, .consent-lede a:hover { text-decoration-color: var(--accent); }
.consent-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.consent-more { margin-right: auto; padding: 8px 2px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.consent-more:hover { color: var(--ink); text-decoration-color: var(--ink-3); }
.consent-link { font-size: inherit; color: inherit; transition: color 0.2s; }
.consent-link:hover { color: var(--ink); }

.consent-toast {
  position: fixed; left: 24px; bottom: 24px; z-index: 70; max-width: min(400px, calc(100vw - 48px));
  padding: 11px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-md);
  font-size: 14px; font-weight: 500; line-height: 1.45; pointer-events: none;
  opacity: 0; transform: translateY(10px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.consent-toast.is-in { opacity: 1; transform: none; }
.consent-toast:empty { display: none; }

html.consent-lock { overflow: hidden; }
.consent-dialog {
  width: min(560px, calc(100vw - 32px)); max-width: none; max-height: min(760px, calc(100vh - 48px));
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--ink-2); box-shadow: var(--shadow-lg); overflow: hidden;
}
@supports (height: 100dvh) { .consent-dialog { max-height: min(760px, calc(100dvh - 48px)); } }
.consent-dialog::backdrop { background: rgba(9, 10, 15, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.consent-dialog[open] { animation: consent-in 0.3s var(--ease); }
@keyframes consent-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.consent-panel { display: flex; flex-direction: column; max-height: inherit; }
.consent-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 20px 4px 24px; }
.consent-head .consent-title { font-size: 20px; letter-spacing: -0.02em; }
.consent-x { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 999px; color: var(--ink-3); transition: background 0.2s, color 0.2s; }
.consent-x:hover { background: var(--bg-sunken); color: var(--ink); }
.consent-x svg { width: 18px; height: 18px; }
.consent-body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 8px; font-size: 14px; line-height: 1.55; }
.consent-lede { margin-bottom: 16px; }
.consent-gpc { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: 13.5px; }
.consent-cat { padding: 16px 0; border-top: 1px solid var(--line); }
.consent-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 24px; }
.consent-cat h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.consent-cat > p { margin-top: 6px; }
.consent-state {
  flex: none; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-sunken);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}
.consent-state.is-none { color: var(--ink-3); background: none; }
.consent-switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.consent-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.consent-switch .track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--ink-3); transition: background 0.25s; }
.consent-switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--ease);
}
.consent-switch input:checked + .track { background: var(--grad); }
.consent-switch input:checked + .track::after { transform: translateX(18px); }
.consent-switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 3px; }
.consent-what { margin-top: 10px; }
.consent-what summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 500; color: var(--accent);
}
.consent-what summary::-webkit-details-marker { display: none; }
.consent-what summary::after {
  content: ""; width: 6px; height: 6px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform 0.2s var(--ease);
}
.consent-what[open] summary::after { margin-top: 3px; transform: rotate(225deg); }
.consent-items { display: grid; gap: 8px; margin-top: 10px; }
.consent-items li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-sunken); }
.consent-item-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.consent-items code { font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.consent-item-head span { font-size: 12px; color: var(--ink-3); }
.consent-items p { margin-top: 4px; font-size: 13px; line-height: 1.5; }
.consent-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  .consent-card, .consent-toast { left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; }
  .consent-actions { flex-wrap: wrap; }
  .consent-actions .btn { flex: 1 1 0; }
  .consent-more { order: 1; flex-basis: 100%; margin: 0; padding: 6px 0 0; text-align: center; }
  .consent-dialog { width: 100%; max-height: calc(100vh - 24px); margin: auto 0 0; border-width: 1px 0 0; border-radius: var(--radius) var(--radius) 0 0; }
  @supports (height: 100dvh) { .consent-dialog { max-height: calc(100dvh - 24px); } }
  .consent-head { padding: 16px 12px 4px 20px; }
  .consent-body { padding: 8px 20px; }
  .consent-foot { padding: 14px 20px 20px; }
  .consent-foot .btn { flex: 1 1 0; }
  .consent-foot .btn-primary { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .consent-card, .consent-toast, .consent-switch .track, .consent-switch .track::after { transition: none; }
  .consent-card::before { animation: none; }
  .consent-dialog[open] { animation: none; }
}
@media print { .consent-card, .consent-toast { display: none; } }
