/* FloatingBall — Obsidian Liquid Glass & Instrument Design System
 * Built with modern-web-guidance: color-scheme + light-dark(), @container scroll-state
 * auto-hiding header, @starting-style top-layer transitions, pure-CSS modal scroll
 * containment, scroll-snap drawer, WAI-ARIA scroll-faded tabs, content-visibility: auto,
 * and container-query responsive parity tables.
 */

@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --drawer-backdrop {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  color-scheme: light dark;

  /* Light (Cool Alabaster Frost) & Dark (Obsidian Liquid Glass) palettes */
  --bg-light: #F4F7FB;
  --bg-dark: #0A0D12;
  --surface-light: #E8EEF6;
  --surface-dark: #121721;
  --card-light: #FFFFFF;
  --card-dark: #11161F;
  --card-glass-light: rgba(255, 255, 255, 0.78);
  --card-glass-dark: rgba(20, 26, 36, 0.78);
  --ink-light: #101622;
  --ink-dark: #EEF3FA;
  --muted-light: #515D71;
  --muted-dark: #97A4B8;
  --border-light: rgba(16, 22, 34, 0.10);
  --border-dark: rgba(238, 243, 250, 0.11);
  --border-strong-light: rgba(16, 22, 34, 0.19);
  --border-strong-dark: rgba(238, 243, 250, 0.22);

  /* Instrument accents echoing FloatingBall's 4 Orb Face Studio themes */
  --cyan-light: #0B63A8;
  --cyan-dark: #5AC8FA;
  --cyan-ink-light: #FFFFFF;
  --cyan-ink-dark: #06131D;
  --cyan-soft-light: rgba(11, 99, 168, 0.10);
  --cyan-soft-dark: rgba(90, 200, 250, 0.14);

  --emerald-light: #0F7657;
  --emerald-dark: #34D399;
  --emerald-soft-light: rgba(15, 118, 87, 0.10);
  --emerald-soft-dark: rgba(52, 211, 153, 0.14);

  --amber-light: #B45309;
  --amber-dark: #FBBF24;
  --amber-soft-light: rgba(180, 83, 9, 0.11);
  --amber-soft-dark: rgba(251, 191, 36, 0.14);

  --rose-light: #BE123C;
  --rose-dark: #FB7185;
  --rose-soft-light: rgba(190, 18, 60, 0.10);
  --rose-soft-dark: rgba(251, 113, 133, 0.14);

  --nav-bg-light: rgba(244, 247, 251, 0.80);
  --nav-bg-dark: rgba(10, 13, 18, 0.80);
  --code-bg-light: #EBF0F7;
  --code-bg-dark: #090C11;

  --shadow-sm-light: 0 2px 10px rgba(16, 22, 34, 0.05);
  --shadow-sm-dark: 0 2px 14px rgba(0, 0, 0, 0.42);
  --shadow-md-light: 0 18px 44px rgba(16, 22, 34, 0.10);
  --shadow-md-dark: 0 24px 56px rgba(0, 0, 0, 0.58);

  /* Fallbacks for browsers without light-dark() */
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --card: var(--card-light);
  --card-glass: var(--card-glass-light);
  --ink: var(--ink-light);
  --muted: var(--muted-light);
  --border: var(--border-light);
  --border-strong: var(--border-strong-light);
  --accent: var(--cyan-light);
  --accent-ink: var(--cyan-ink-light);
  --accent-soft: var(--cyan-soft-light);
  --emerald: var(--emerald-light);
  --emerald-soft: var(--emerald-soft-light);
  --amber: var(--amber-light);
  --amber-soft: var(--amber-soft-light);
  --rose: var(--rose-light);
  --rose-soft: var(--rose-soft-light);
  --nav-bg: var(--nav-bg-light);
  --code-bg: var(--code-bg-light);
  --shadow-sm: var(--shadow-sm-light);
  --shadow-md: var(--shadow-md-light);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --target-size: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  @media (pointer: coarse) {
    --target-size: 44px;
  }

  @media (prefers-color-scheme: dark) {
    --bg: var(--bg-dark);
    --surface: var(--surface-dark);
    --card: var(--card-dark);
    --card-glass: var(--card-glass-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --border: var(--border-dark);
    --border-strong: var(--border-strong-dark);
    --accent: var(--cyan-dark);
    --accent-ink: var(--cyan-ink-dark);
    --accent-soft: var(--cyan-soft-dark);
    --emerald: var(--emerald-dark);
    --emerald-soft: var(--emerald-soft-dark);
    --amber: var(--amber-dark);
    --amber-soft: var(--amber-soft-dark);
    --rose: var(--rose-dark);
    --rose-soft: var(--rose-soft-dark);
    --nav-bg: var(--nav-bg-dark);
    --code-bg: var(--code-bg-dark);
    --shadow-sm: var(--shadow-sm-dark);
    --shadow-md: var(--shadow-md-dark);
  }

  @supports (color: light-dark(white, black)) {
    --bg: light-dark(var(--bg-light), var(--bg-dark));
    --surface: light-dark(var(--surface-light), var(--surface-dark));
    --card: light-dark(var(--card-light), var(--card-dark));
    --card-glass: light-dark(var(--card-glass-light), var(--card-glass-dark));
    --ink: light-dark(var(--ink-light), var(--ink-dark));
    --muted: light-dark(var(--muted-light), var(--muted-dark));
    --border: light-dark(var(--border-light), var(--border-dark));
    --border-strong: light-dark(var(--border-strong-light), var(--border-strong-dark));
    --accent: light-dark(var(--cyan-light), var(--cyan-dark));
    --accent-ink: light-dark(var(--cyan-ink-light), var(--cyan-ink-dark));
    --accent-soft: light-dark(var(--cyan-soft-light), var(--cyan-soft-dark));
    --emerald: light-dark(var(--emerald-light), var(--emerald-dark));
    --emerald-soft: light-dark(var(--emerald-soft-light), var(--emerald-soft-dark));
    --amber: light-dark(var(--amber-light), var(--amber-dark));
    --amber-soft: light-dark(var(--amber-soft-light), var(--amber-soft-dark));
    --rose: light-dark(var(--rose-light), var(--rose-dark));
    --rose-soft: light-dark(var(--rose-soft-light), var(--rose-soft-dark));
    --nav-bg: light-dark(var(--nav-bg-light), var(--nav-bg-dark));
    --code-bg: light-dark(var(--code-bg-light), var(--code-bg-dark));
  }

  /* Reflect <meta name="color-scheme"> override back into CSS cascade */
  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
    --shadow-sm: var(--shadow-sm-dark);
    --shadow-md: var(--shadow-md-dark);
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
    --shadow-sm: var(--shadow-sm-light);
    --shadow-md: var(--shadow-md-light);
  }

  accent-color: var(--accent);
}

@supports not (color: light-dark(white, black)) {
  :root:has(> head > meta[name="color-scheme"][content="dark"]) {
    --bg: var(--bg-dark);
    --surface: var(--surface-dark);
    --card: var(--card-dark);
    --card-glass: var(--card-glass-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --border: var(--border-dark);
    --border-strong: var(--border-strong-dark);
    --accent: var(--cyan-dark);
    --accent-ink: var(--cyan-ink-dark);
    --accent-soft: var(--cyan-soft-dark);
    --emerald: var(--emerald-dark);
    --emerald-soft: var(--emerald-soft-dark);
    --amber: var(--amber-dark);
    --amber-soft: var(--amber-soft-dark);
    --rose: var(--rose-dark);
    --rose-soft: var(--rose-soft-dark);
    --nav-bg: var(--nav-bg-dark);
    --code-bg: var(--code-bg-dark);
  }
  :root:has(> head > meta[name="color-scheme"][content="light"]) {
    --bg: var(--bg-light);
    --surface: var(--surface-light);
    --card: var(--card-light);
    --card-glass: var(--card-glass-light);
    --ink: var(--ink-light);
    --muted: var(--muted-light);
    --border: var(--border-light);
    --border-strong: var(--border-strong-light);
    --accent: var(--cyan-light);
    --accent-ink: var(--cyan-ink-light);
    --accent-soft: var(--cyan-soft-light);
    --emerald: var(--emerald-light);
    --emerald-soft: var(--emerald-soft-light);
    --amber: var(--amber-light);
    --amber-soft: var(--amber-soft-light);
    --rose: var(--rose-light);
    --rose-soft: var(--rose-soft-light);
    --nav-bg: var(--nav-bg-light);
    --code-bg: var(--code-bg-light);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  container-type: scroll-state;
  scroll-behavior: smooth;
  @media (prefers-reduced-motion: reduce) {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video {
  max-inline-size: 100%;
  block-size: auto;
}

section[id] {
  scroll-margin-top: calc(74px + env(safe-area-inset-top, 0px));
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

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

.wrap {
  width: min(1160px, 100% - 40px);
  margin-inline: auto;
}

@media (max-width: 480px) {
  .wrap { width: min(1160px, 100% - 28px); }
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-wrap: break-word;
}

/* ==================== Compact Auto-Hiding Sticky Header ==================== */
header.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  transition: transform 0.22s ease;
}

@container scroll-state((scrolled: bottom) and (scrollable: top)) {
  header.nav {
    transform: translateY(-100%);
  }
}
header.nav:focus-within {
  transform: none;
}
header.nav.is-hidden:not(:focus-within) {
  transform: translateY(-100%);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 6px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 17.5px;
  letter-spacing: -0.025em;
  flex-shrink: 0;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; display: block; border-radius: 50%; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-size);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max(36px, var(--target-size));
  min-height: max(36px, var(--target-size));
  width: max(36px, var(--target-size));
  height: max(36px, var(--target-size));
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface); }
.icon-btn svg { width: 17px; height: 17px; }
.menu-toggle { display: none; }

/* CSS-driven 2-state theme toggle icons */
.theme-toggle .theme-opt-light { display: none; }
.theme-toggle .theme-opt-dark { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .theme-opt-light { display: inline-flex; }
  .theme-toggle .theme-opt-dark { display: none; }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .theme-opt-light { display: inline-flex; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .theme-opt-dark { display: none; }
:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-toggle .theme-opt-light { display: none; }
:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-toggle .theme-opt-dark { display: inline-flex; }

.lang-select {
  background-color: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: max(36px, var(--target-size));
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.lang-select:hover { border-color: var(--border-strong); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  min-height: max(36px, var(--target-size));
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  white-space: nowrap;
}
.nav-cta:hover { text-decoration: none; filter: brightness(1.06); }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .menu-toggle { display: inline-flex; }
  .icon-btn { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }
  .lang-select, .nav-cta { min-height: 44px; }
}
@media (max-width: 560px) {
  .nav-cta { display: none; }
}

/* ==================== Mobile Scroll-Snap Drawer (<dialog>) ==================== */
dialog.nav-drawer {
  --drawer-width: min(20rem, 84vw, calc(100vw - 24px));
  --drawer-width: min(20rem, 84dvw, calc(100dvw - 24px));
  --drawer-backdrop: 0;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
dialog.nav-drawer:modal { overscroll-behavior: contain; }
dialog.nav-drawer::backdrop {
  background: #06080d;
  opacity: calc(var(--drawer-backdrop) * 0.62);
  overflow: hidden;
  overscroll-behavior: contain;
}

.nav-drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: 100% var(--drawer-width);
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.nav-drawer-scroller::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .nav-drawer-scroller { scroll-behavior: smooth; }
}
.nav-drawer-scroller::before {
  content: "";
  scroll-snap-align: start;
  scroll-initial-target: nearest;
}

.nav-drawer-sheet {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  height: 100vh;
  height: 100svh;
  background: var(--card);
  color: var(--ink);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 44px rgba(0, 0, 0, 0.32);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-align: end;
  scrollbar-width: none;
  padding:
    max(14px, env(safe-area-inset-top, 0px))
    max(18px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    18px;
}
.nav-drawer-sheet::-webkit-scrollbar { display: none; }
.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.nav-drawer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-drawer-links a {
  display: flex;
  align-items: center;
  min-block-size: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 550;
}
.nav-drawer-links a:hover { text-decoration: none; background: var(--surface); }
.nav-drawer-foot {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.nav-drawer-foot .btn { width: 100%; min-block-size: 46px; }

@supports (animation-timeline: scroll()) {
  dialog.nav-drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }
  .nav-drawer-scroller { scroll-timeline: --drawer-fade x; }
  @keyframes fade-drawer-backdrop {
    0% { --drawer-backdrop: 0; }
    100% { --drawer-backdrop: 1; }
  }
}

/* ==================== Hero ==================== */
.hero {
  position: relative;
  padding: clamp(48px, 7vw, 84px) 0 42px;
  text-align: center;
  overflow-x: clip;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -60px 50% auto;
  transform: translateX(-50%);
  width: min(1040px, 98vw);
  height: 540px;
  background:
    radial-gradient(ellipse at 35% 28%, var(--accent-soft) 0%, transparent 56%),
    radial-gradient(ellipse at 68% 34%, var(--emerald-soft) 0%, transparent 58%);
  pointer-events: none;
  z-index: -1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card-glass);
  border: 1px solid var(--border);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  margin-bottom: 20px;
}
.hero-badge-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
}

.hero h1 {
  margin: 0 auto 18px;
  max-width: 900px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.3rem + 3.4vw, 3.65rem);
  font-weight: 760;
  line-height: 1.09;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

.hero p.lead {
  max-width: 720px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: clamp(1rem, 0.94rem + 0.35vw, 1.15rem);
  line-height: 1.65;
  text-wrap: pretty;
}

.cta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(-1px);
  }
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.platform-pills {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--muted);
}

/* Interactive Hero Stage */
.hero-stage-shell {
  margin-top: 34px;
}

.hero-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.hero-mode-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.hero-mode-btn:hover { color: var(--ink); }
.hero-mode-btn.is-active {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.hero-stage {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #0d1117;
  box-shadow: var(--shadow-md);
}

.media-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
}
.media-trigger img {
  width: 100%;
  display: block;
}

.zoom-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: #f3f7fc;
  background: rgba(10, 14, 22, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}
.zoom-hint svg { width: 14px; height: 14px; }

.hero-stage-caption {
  margin: 12px auto 0;
  max-width: 820px;
  font-size: 13.5px;
  color: var(--muted);
}

/* Metrics Strip */
.metrics-strip {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 860px) {
  .metrics-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .metrics-strip { grid-template-columns: 1fr; }
}

.metric-card {
  text-align: left;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.metric-val {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.05rem);
  font-weight: 760;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.metric-val.cyan { color: var(--accent); }
.metric-val.emerald { color: var(--emerald); }
.metric-val.amber { color: var(--amber); }
.metric-val.rose { color: var(--rose); }
.metric-label { margin-top: 6px; font-weight: 650; font-size: 14.5px; }
.metric-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* ==================== Section Bands ==================== */
.band {
  padding: clamp(56px, 7vw, 92px) 0;
  border-top: 1px solid var(--border);
}
.band-deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

.section-head {
  max-width: 840px;
  margin-bottom: 34px;
}
.kicker {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}
.section-head h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.45rem);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* ==================== Origin Story & Edge Capsule Showcase ==================== */
.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.story-grid.story-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1024px) {
  .story-grid.story-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .story-grid { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .story-grid.story-grid-4 { grid-template-columns: 1fr; }
}

.story-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.story-card-accent {
  border-color: color-mix(in srgb, var(--emerald) 38%, var(--border));
  background: linear-gradient(160deg, var(--emerald-soft) 0%, var(--card) 52%);
}
.story-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  margin-bottom: 14px;
}
.story-step.emerald {
  color: var(--emerald);
  background: var(--emerald-soft);
}
.story-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.story-card p { margin: 0; color: var(--muted); font-size: 14.5px; }

.capsule-showcase {
  margin-top: 26px;
  padding: 26px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  gap: 24px;
  align-items: center;
}
@media (max-width: 860px) {
  .capsule-showcase { grid-template-columns: 1fr; }
}
.capsule-copy h3 {
  margin: 10px 0 10px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.capsule-copy p { margin: 0; color: var(--muted); font-size: 15px; }
.capsule-loops {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
@media (max-width: 560px) {
  .capsule-loops { grid-template-columns: 1fr; }
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag.emerald { background: var(--emerald-soft); color: var(--emerald); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.rose { background: var(--rose-soft); color: var(--rose); }

/* ==================== Accessible Scroll-Faded Tabs ==================== */
.tabs-shell {
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tablist-wrap {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 12px;
}

.tablist {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 2.5rem;
  --fade-size: 2.5rem;
  --fade-dir: right;
  --fade-start-pos: 0;
  --fade-end-pos: 100%;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
  transition: --fade-start 0.2s, --fade-end 0.2s;
}
.tablist::-webkit-scrollbar { display: none; }
.tablist.more-start { --fade-start: var(--fade-size); }
.tablist.more-end { --fade-end: var(--fade-size); }

@supports (animation-timeline: scroll(self inline)) {
  .tablist {
    transition: none;
    animation: reveal-fade-start linear both, hide-fade-end linear both;
    animation-timeline: scroll(self inline);
    animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
  }
  @keyframes reveal-fade-start {
    to { --fade-start: var(--fade-size); }
  }
  @keyframes hide-fade-end {
    from { --fade-end: var(--fade-size); }
  }
}

.tablist [role="tab"] {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 15px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s ease;
}
.tablist [role="tab"]:hover { color: var(--ink); }
.tablist [role="tab"][aria-selected="true"] { color: var(--accent); }
.tablist [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 10px 0;
  border-block-end: 3px solid var(--accent);
  border-radius: 3px 3px 0 0;
}

/* Tab panels share one grid cell so hidden="until-found" never leaves gaps */
.tabpanels {
  display: grid;
}
.tabpanels > [role="tabpanel"] {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
}
.tabpanels > [role="tabpanel"][hidden] {
  z-index: 0;
  pointer-events: none;
}
.panel-inner {
  padding: clamp(20px, 3vw, 32px);
}

.feature-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.38fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 960px) {
  .feature-layout { grid-template-columns: 1fr; }
}

.feature-copy h3 {
  margin: 12px 0 12px;
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.65rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
}
.feature-copy p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 11px;
}
.check-list li {
  position: relative;
  padding-left: 24px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}

.feature-media-grid {
  display: grid;
  gap: 16px;
}
.feature-media-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
@media (max-width: 640px) {
  .feature-media-grid.two-col { grid-template-columns: 1fr; }
}

/* Video & Screenshot Cards */
.media-card,
.shot-card {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d1117;
  box-shadow: var(--shadow-sm);
}

.video-frame {
  position: relative;
  background: #0b0e14;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.demo-video {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* WCAG 2.2.2 visible Pause/Play control for every looping motion clip */
.video-ctrl {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: max(30px, var(--target-size));
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(10, 14, 22, 0.78);
  color: #f3f7fc;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background-color 0.16s ease, border-color 0.16s ease;
}
.video-ctrl:hover {
  background: rgba(15, 23, 36, 0.94);
  border-color: var(--cyan-dark);
}

.media-card figcaption,
.shot-card figcaption {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  background: var(--card);
  border-top: 1px solid var(--border);
}

/* ==================== 4-Gesture & Architecture Cards ==================== */
.cards-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 960px) {
  .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .cards-4 { grid-template-columns: 1fr; }
}

.info-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.info-card h3 {
  margin: 12px 0 8px;
  font-size: 17px;
  font-weight: 700;
}
.info-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; }

/* ==================== Fork & Feed to Your AI Agent ==================== */
.fork-reasons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 860px) {
  .fork-reasons { grid-template-columns: 1fr; }
}

.prompt-deck {
  margin-top: 24px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.prompt-deck-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}
.prompt-deck-head h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 920px) {
  .prompt-grid { grid-template-columns: 1fr; }
}
.prompt-card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.prompt-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  font-family: var(--font-sans);
}

/* ==================== Responsive Container-Query Parity Table ==================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  container-type: inline-size;
}

.parity-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.parity-table caption {
  text-align: left;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.parity-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}
.parity-table thead th {
  text-align: left;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}
.parity-table tbody th,
.parity-table tbody td {
  padding: 14px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}
.parity-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  text-align: left;
  font-weight: 650;
  background: var(--card);
  min-width: 170px;
}
.parity-table tbody td:last-child {
  min-width: 185px;
}
.parity-table tbody tr:last-child th,
.parity-table tbody tr:last-child td { border-bottom: 0; }

@container (width < 640px) {
  .parity-table,
  .parity-table thead,
  .parity-table tbody,
  .parity-table tr,
  .parity-table th,
  .parity-table td { display: block; }
  .parity-table thead { display: none; }
  .parity-table tbody tr {
    border-bottom: 2px solid var(--border);
    padding: 0 0 8px;
  }
  .parity-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--surface);
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
  }
  .parity-table tbody td {
    border-bottom: 0;
    padding: 8px 16px;
  }
  .parity-table td:nth-child(2)::before { content: var(--col-2) ": "; font-weight: 700; color: var(--accent); }
  .parity-table td:nth-child(3)::before { content: var(--col-3) ": "; font-weight: 700; color: var(--emerald); }
  .parity-table td:nth-child(4)::before { content: var(--col-4) ": "; font-weight: 700; color: var(--amber); }
}

/* ==================== Install Hub ==================== */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 760px) {
  .dl-grid { grid-template-columns: 1fr; }
}

.dl-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dl-card h4 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 16.5px;
}
.dl-meta {
  font-size: 12px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.dl-card p { margin: 0; font-size: 14px; color: var(--muted); }

.cmd-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
}
.cmd-box code {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.cmd-box code::-webkit-scrollbar { display: none; }

.copy-btn {
  flex-shrink: 0;
  min-height: max(30px, var(--target-size));
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.dl-footnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 24px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ==================== Footer ==================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom, 0px));
  font-size: 13.5px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ==================== Top-Layer Animated Modal Lightbox (<dialog>) ==================== */
dialog.lightbox {
  width: min(1240px, 94vw);
  max-height: 92vh;
  max-height: 92dvh;
  padding: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.24s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;

  @media (prefers-reduced-motion: no-preference) {
    transform: scale(0.95);
  }
  @media (prefers-reduced-motion: reduce) {
    transition-duration: 0.1s;
  }
}

dialog.lightbox:modal {
  overscroll-behavior: contain;
}

dialog.lightbox::backdrop {
  background-color: rgba(5, 8, 14, 0);
  overflow: hidden;
  overscroll-behavior: contain;
  transition-property: background-color, display, overlay;
  transition-duration: 0.24s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

dialog.lightbox[open]:where(:not([data-closing])) {
  opacity: 1;
  @starting-style { opacity: 0; }
  @media (prefers-reduced-motion: no-preference) {
    transform: scale(1);
    @starting-style { transform: scale(0.95); }
  }
  &::backdrop {
    background-color: rgba(5, 8, 14, 0.78);
    backdrop-filter: blur(8px);
    @starting-style { background-color: rgba(5, 8, 14, 0); }
  }
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.lightbox-caption { margin: 0; font-size: 14px; font-weight: 550; }
.lightbox-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-body {
  padding: 14px;
  background: #0a0d12;
  display: flex;
  justify-content: center;
}
.lightbox-body img {
  max-height: 78vh;
  max-height: 78dvh;
  width: auto;
  border-radius: 10px;
}

/* ==================== Gentle Scroll Reveal (Opt-In Motion Only) ==================== */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal-up linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
    @keyframes reveal-up {
      from { opacity: 0.2; transform: translateY(16px); }
      to { opacity: 1; transform: translateY(0); }
    }
  }
}
