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

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

@property --orb-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  /* Raw light & dark palette tokens (WCAG 1.4.3 / 1.4.11 verified) */
  --bg-light: #f6f8fc;
  --bg-dark: #07090f;
  --bg-elevated-light: #ffffff;
  --bg-elevated-dark: #101522;
  --bg-glass-light: rgba(255, 255, 255, 0.82);
  --bg-glass-dark: rgba(16, 21, 34, 0.78);
  --bg-code-light: #0d111b;
  --bg-code-dark: #090c14;

  --text-primary-light: #0d1321;
  --text-primary-dark: #f3f6fc;
  --text-muted-light: #445069;
  --text-muted-dark: #9ba8c2;

  --border-subtle-light: #cbd5e6;
  --border-subtle-dark: #253047;
  --border-strong-light: #7c8ba6;
  --border-strong-dark: #4f6085;

  /* Chromatic brand accents */
  --cobalt-light: #005ad4;
  --cobalt-dark: #4da3ff;
  --amber-light: #c2410c;
  --amber-dark: #ff8c42;
  --violet-light: #6d28d9;
  --violet-dark: #c084fc;
  --emerald-light: #047857;
  --emerald-dark: #34d399;
  --rose-light: #be123c;
  --rose-dark: #fb7185;

  --cta-bg-light: #0058d0;
  --cta-bg-dark: #0a84ff;
  --cta-fg-light: #ffffff;
  --cta-fg-dark: #ffffff;

  --scroll-track-light: #e4e9f2;
  --scroll-track-dark: #111624;
  --scroll-thumb-light: #637089;
  --scroll-thumb-dark: #7d8ca8;

  /* Baseline fallback before light-dark() */
  --bg: var(--bg-light);
  --bg-elevated: var(--bg-elevated-light);
  --bg-glass: var(--bg-glass-light);
  --bg-code: var(--bg-code-light);
  --text-primary: var(--text-primary-light);
  --text-muted: var(--text-muted-light);
  --border-subtle: var(--border-subtle-light);
  --border-strong: var(--border-strong-light);
  --cobalt: var(--cobalt-light);
  --amber: var(--amber-light);
  --violet: var(--violet-light);
  --emerald: var(--emerald-light);
  --rose: var(--rose-light);
  --cta-bg: var(--cta-bg-light);
  --cta-fg: var(--cta-fg-light);
  --scrollbar-track: var(--scroll-track-light);
  --scrollbar-thumb: var(--scroll-thumb-light);

  @media (prefers-color-scheme: dark) {
    --bg: var(--bg-dark);
    --bg-elevated: var(--bg-elevated-dark);
    --bg-glass: var(--bg-glass-dark);
    --bg-code: var(--bg-code-dark);
    --text-primary: var(--text-primary-dark);
    --text-muted: var(--text-muted-dark);
    --border-subtle: var(--border-subtle-dark);
    --border-strong: var(--border-strong-dark);
    --cobalt: var(--cobalt-dark);
    --amber: var(--amber-dark);
    --violet: var(--violet-dark);
    --emerald: var(--emerald-dark);
    --rose: var(--rose-dark);
    --cta-bg: var(--cta-bg-dark);
    --cta-fg: var(--cta-fg-dark);
    --scrollbar-track: var(--scroll-track-dark);
    --scrollbar-thumb: var(--scroll-thumb-dark);
  }

  /* Modern light-dark() automatic scheme resolution */
  @supports (color: light-dark(white, black)) {
    --bg: light-dark(var(--bg-light), var(--bg-dark));
    --bg-elevated: light-dark(var(--bg-elevated-light), var(--bg-elevated-dark));
    --bg-glass: light-dark(var(--bg-glass-light), var(--bg-glass-dark));
    --bg-code: light-dark(var(--bg-code-light), var(--bg-code-dark));
    --text-primary: light-dark(var(--text-primary-light), var(--text-primary-dark));
    --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
    --border-subtle: light-dark(var(--border-subtle-light), var(--border-subtle-dark));
    --border-strong: light-dark(var(--border-strong-light), var(--border-strong-dark));
    --cobalt: light-dark(var(--cobalt-light), var(--cobalt-dark));
    --amber: light-dark(var(--amber-light), var(--amber-dark));
    --violet: light-dark(var(--violet-light), var(--violet-dark));
    --emerald: light-dark(var(--emerald-light), var(--emerald-dark));
    --rose: light-dark(var(--rose-light), var(--rose-dark));
    --cta-bg: light-dark(var(--cta-bg-light), var(--cta-bg-dark));
    --cta-fg: light-dark(var(--cta-fg-light), var(--cta-fg-dark));
    --scrollbar-track: light-dark(var(--scroll-track-light), var(--scroll-track-dark));
    --scrollbar-thumb: light-dark(var(--scroll-thumb-light), var(--scroll-thumb-dark));
  }

  /* Safe tint mixing in oklab (avoids Chromium oklch neutral hue bug 565837690) */
  --cobalt-soft: color-mix(in oklab, var(--cobalt) 14%, var(--bg-elevated));
  --amber-soft: color-mix(in oklab, var(--amber) 14%, var(--bg-elevated));
  --violet-soft: color-mix(in oklab, var(--violet) 14%, var(--bg-elevated));
  --emerald-soft: color-mix(in oklab, var(--emerald) 14%, var(--bg-elevated));

  /* Physics-based multi-stop spring easing */
  --spring-easing: linear(
    0, 0.012 0.6%, 0.05 1.2%, 0.198 2.5%, 0.946 6.8%, 1.178 8.8%,
    1.262 10.2%, 1.272 11.2%, 1.214 13%, 0.968 18.2%, 0.902 20.6%,
    0.896 22.4%, 0.952 26.8%, 1.018 31.6%, 1.024 34.4%, 0.996 42%, 1
  );

  color-scheme: light dark;
  interpolate-size: allow-keywords;
  accent-color: var(--cobalt);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  --in-oklab: ;
  --in-oklch: ;

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

@supports (background: linear-gradient(in oklab, white, black)) {
  :root {
    --in-oklab: in oklab;
    --in-oklch: in oklch;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Legacy scrollbar fallback isolated from native scrollbar-color */
@supports not (scrollbar-color: auto) {
  :root::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  :root::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
  }
  :root::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
}

/* Forced Colors (Windows High Contrast) support */
@media (forced-colors: active) {
  :root {
    --border-subtle: CanvasText;
    --border-strong: Highlight;
  }
  .btn-primary,
  .pill-active {
    border: 2px solid ButtonText;
  }
  .bento-card,
  .model-card,
  .doc-card,
  .stat-card {
    border: 1px solid CanvasText;
  }
}

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

html {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  @media (prefers-reduced-motion: reduce) {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-block-size: 100dvh;
  overflow-x: clip;
  position: relative;
}

::selection {
  background-color: color-mix(in oklab, var(--cobalt) 30%, transparent);
  color: var(--text-primary);
}

a {
  color: var(--cobalt);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="tabpanel"]:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 8px;
}

.sr-only,
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

#hero-heading:focus {
  outline: none;
}

.skip-link {
  position: fixed;
  inset-block-start: 0.75rem;
  inset-inline-start: 0.75rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--cta-bg);
  color: var(--cta-fg);
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  translate: 0 -200%;
  transition: translate 0.2s ease-out;
  &:focus {
    translate: 0 0;
  }
}

/* ---------------------------------------------------------------------------
   1. Scroll Progress Indicator (compositor scaleX + scroll() timeline)
   --------------------------------------------------------------------------- */
#scroll-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 4px;
  z-index: 150;
  background: linear-gradient(90deg var(--in-oklch), var(--cobalt), var(--violet), var(--amber), var(--emerald));
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes grow-progress {
      from { transform: scaleX(0); }
      to { transform: scaleX(1); }
    }
    #scroll-progress {
      animation: grow-progress auto linear;
      animation-timeline: scroll(root block);
    }
  }
}

/* ---------------------------------------------------------------------------
   2. Zero-Jank Basalt Volcano, Cooling Lava, Meteorite/Comet & Sunrise/Sunset
   --------------------------------------------------------------------------- */
.volcano-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: clip;
  pointer-events: none;
  contain: strict;
  isolation: isolate;
}

#volcano-canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.twilight-veil {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(
    to top var(--in-oklab),
    rgba(255, 138, 56, 0.34) 0%,
    rgba(217, 70, 143, 0.18) 38%,
    transparent 74%
  );
  transition: opacity 1.8s ease-in-out;
}

.volcano-stage[data-twilight="sunrise"] .twilight-veil,
.volcano-stage[data-twilight="sunset"] .twilight-veil {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   3. Sticky Liquid Glass Header
   --------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  background-color: var(--bg-glass);
  border-block-end: 1px solid var(--border-subtle);
}

.header-inner {
  max-inline-size: 1320px;
  margin-inline: auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  @media (min-width: 1080px) {
    flex-wrap: nowrap;
  }
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-link img {
  inline-size: 34px;
  block-size: 34px;
}

.version-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  border: 1px solid var(--border-strong);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s ease;
  &:hover {
    color: var(--text-primary);
  }
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.icon-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-inline-size: 36px;
  min-block-size: 36px;
  padding: 0.38rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  &:hover {
    border-color: var(--cobalt);
    background: var(--cobalt-soft);
  }
}

/* Customizable UN Flag Language Select (appearance: base-select + graceful native fallback) */
.lang-select {
  min-inline-size: 8.6rem;
  min-block-size: 36px;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  &:hover {
    border-color: var(--cobalt);
    background: var(--cobalt-soft);
  }
  &:focus-visible {
    outline: 3px solid var(--cobalt);
    outline-offset: 3px;
  }
}

@supports (appearance: base-select) {
  .lang-select,
  .lang-select::picker(select) {
    appearance: base-select;
  }

  .lang-select {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
  }

  .lang-select::picker-icon {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .lang-select:open::picker-icon {
    transform: rotate(180deg);
  }

  .lang-select::picker(select) {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    padding: 0.35rem;
    margin-block-start: 0.3rem;
    min-inline-size: max(anchor-size(width), 10.5rem);
    transition:
      display,
      overlay,
      opacity cubic-bezier(0.16, 1, 0.3, 1),
      height cubic-bezier(0.16, 1, 0.3, 1);
    transition-duration: 0.24s;
    transition-behavior: allow-discrete;
    opacity: 0;
    height: 0;
  }

  .lang-select:open::picker(select) {
    opacity: 1;
    height: auto;
  }

  @starting-style {
    .lang-select:open::picker(select) {
      opacity: 0;
      height: 0;
    }
  }

  .lang-select option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
  }

  .lang-select option:hover {
    background: var(--cobalt-soft);
  }

  .lang-select option:checked {
    font-weight: 800;
    background-color: var(--cobalt-soft);
    color: var(--text-primary);
    border-inline-start: 3px solid var(--cobalt);
  }

  .lang-select selectedcontent {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
  }

  .lang-select .flag-emoji {
    display: none;
  }

  .lang-select option svg,
  .lang-select selectedcontent svg {
    flex-shrink: 0;
    inline-size: 1.15rem;
    block-size: 0.85rem;
    border-radius: 2px;
  }

  @media (prefers-reduced-motion: reduce) {
    .lang-select::picker(select),
    .lang-select::picker-icon {
      transition: none !important;
    }
  }
}

/* Theme toggle dual-label visibility driven purely by color-scheme cascade */
.theme-label-light { display: none; }
.theme-label-dark { display: inline; }

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-label-light { display: inline; }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-label-dark { display: none; }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-label-light { display: inline; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-label-dark { display: none; }

/* ---------------------------------------------------------------------------
   4. Layout Containers & Fluid Container-Query Typography
   --------------------------------------------------------------------------- */
.container {
  max-inline-size: 1240px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
  container-type: inline-size;
}

section {
  padding-block: clamp(3rem, 6vw, 5.25rem);
}

/* Deferred below-the-fold sections (never applied to hero) */
.deferred-section {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 680px;
}

.hero {
  padding-block: clamp(2.5rem, 6vw, 4.75rem) clamp(2.5rem, 5vw, 4rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem;
  align-items: center;
  @media (min-width: 960px) {
    grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  }
}

.eyebrow-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-block-end: 1rem;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.78rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.hero-title {
  margin: 0 0 1rem;
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.03em;
  /* Max <= 2.5 * min per WCAG 1.4.4 */
  font-size: clamp(2rem, 5.4vw, 3.8rem);
}

@supports (font-size: 1cqi) {
  .hero-title {
    font-size: clamp(2rem, 4.8cqi, 3.8rem);
  }
}

.gradient-text {
  background: linear-gradient(120deg, var(--cobalt) 0%, var(--violet) 48%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  @media (forced-colors: active) {
    background: none;
    color: CanvasText;
  }
}

.hero-lead {
  margin: 0 0 1.65rem;
  font-size: clamp(1.02rem, 1.8vw, 1.22rem);
  color: var(--text-muted);
  max-inline-size: 62ch;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-end: 1.75rem;
}

.btn {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 46px;
  padding: 0.72rem 1.28rem;
  border-radius: 13px;
  font-size: 0.96rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  /* Fallback before linear() spring */
  transition: transform 0.45s ease-out, background-color 0.15s ease, border-color 0.15s ease;
  transition-timing-function: var(--spring-easing), ease, ease;

  &:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--cobalt);
  }
  &:active {
    transform: scale(0.98);
  }
  @media (prefers-reduced-motion: reduce) {
    transition: background-color 0.15s ease, border-color 0.15s ease;
    &:hover, &:active { transform: none; }
  }
}

.btn-primary {
  background: var(--cta-bg);
  color: var(--cta-fg);
  border-color: var(--cta-bg);
  &:hover {
    background: color-mix(in oklab, var(--cta-bg) 86%, white);
    border-color: var(--cta-bg);
  }
}

.btn-hf {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   5. Animated Neural Bus & Waveform Hero Card
   --------------------------------------------------------------------------- */
.neural-card {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 1.35rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: clip;
}

.neural-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-block-end: 0.9rem;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--emerald);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot::before {
  content: "";
  inline-size: 9px;
  block-size: 9px;
  border-radius: 50%;
  background: var(--emerald);
  border: 1.5px solid currentColor;
}

.neural-svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  border-radius: 14px;
  background: #0a0e18;
  border: 1px solid #253047;
  padding: 0.5rem;
}

@keyframes pulse-dash {
  to { stroke-dashoffset: -120; }
}

@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

.bus-flow {
  stroke-dasharray: 10 8;
}

.wave-bar {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

@media (prefers-reduced-motion: no-preference) {
  body:not([data-motion-paused]) .bus-flow {
    animation: pulse-dash 3.2s linear infinite;
  }
  body:not([data-motion-paused]) .wave-bar {
    animation: wave-bar 1.3s ease-in-out infinite;
  }
  body:not([data-motion-paused]) .wave-bar:nth-child(2n) { animation-delay: 0.18s; }
  body:not([data-motion-paused]) .wave-bar:nth-child(3n) { animation-delay: 0.36s; }
  body:not([data-motion-paused]) .wave-bar:nth-child(4n) { animation-delay: 0.52s; }
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-block-start: 0.95rem;
}

.mini-metric {
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.mini-metric strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mini-metric span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   6. Copyable Code Blocks (Invoker command="--copy" + live region tip)
   --------------------------------------------------------------------------- */
.code-box {
  background: var(--bg-code);
  color: #e6edf7;
  color-scheme: dark;
  accent-color: var(--cobalt);
  border: 1px solid #2b3854;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  position: relative;
}

.copyable {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.copyable pre {
  margin: 0;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  overflow-x: auto;
  flex: 1;
}

.copyable .copy {
  position: relative;
  flex: none;
  order: 1;
  display: inline-flex;
  align-items: center;
}

@media (hover: hover) {
  .copyable {
    display: block;
  }
  .copyable pre {
    padding-inline-end: 4.5rem;
  }
  .copyable .copy {
    position: absolute;
    inset-block-start: 0.65rem;
    inset-inline-end: 0.65rem;
  }
  .copyable .copy-button {
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  .copyable:hover .copy-button,
  .copyable:focus-within .copy-button,
  .copyable .copy-button:focus-visible,
  .copyable .copy-button[data-copied],
  .copyable .copy-button[data-failed] {
    opacity: 1;
  }
}

.copy-button {
  min-inline-size: 32px;
  min-block-size: 30px;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #4e6188;
  background: #182238;
  color: #f1f5f9;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.copy-button .icon-check { display: none; }
.copy-button[data-copied] .icon-copy { display: none; }
.copy-button[data-copied] .icon-check { display: inline; color: #34d399; }

.copy .tip {
  position: absolute;
  inset-block-end: calc(100% + 6px);
  inset-inline-end: 0;
  background: #0a84ff;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.copy-button[data-copied] + .tip,
.copy-button[data-failed] + .tip {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   7. Section Headers & Scroll-Driven Entry Cards
   --------------------------------------------------------------------------- */
.section-head {
  margin-block-end: 2rem;
  max-inline-size: 72ch;
}

.section-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cobalt);
  margin-block-end: 0.4rem;
}

.section-title {
  margin: 0 0 0.6rem;
  font-weight: 820;
  letter-spacing: -0.025em;
  font-size: clamp(1.55rem, 3.4vw, 2.45rem);
}

@supports (font-size: 1cqi) {
  .section-title {
    font-size: clamp(1.55rem, 3.2cqi, 2.45rem);
  }
}

.section-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 1.15rem;
}

.bento-card {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 20px;
  padding: 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  container-type: inline-size;
  transition: transform 0.45s ease-out, border-color 0.2s ease;
  transition-timing-function: var(--spring-easing), ease;

  &:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
  }
  @media (prefers-reduced-motion: reduce) {
    transition: border-color 0.2s ease;
    &:hover { transform: none; }
  }
}

.bento-card[data-tone="cobalt"] { border-block-start: 4px solid var(--cobalt); }
.bento-card[data-tone="amber"] { border-block-start: 4px solid var(--amber); }
.bento-card[data-tone="violet"] { border-block-start: 4px solid var(--violet); }
.bento-card[data-tone="emerald"] { border-block-start: 4px solid var(--emerald); }
.bento-card[data-tone="rose"] { border-block-start: 4px solid var(--rose); }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 42px;
  block-size: 42px;
  border-radius: 12px;
  font-size: 1.25rem;
  background: var(--cobalt-soft);
  border: 1px solid var(--border-subtle);
}

.bento-card[data-tone="amber"] .card-icon { background: var(--amber-soft); }
.bento-card[data-tone="violet"] .card-icon { background: var(--violet-soft); }
.bento-card[data-tone="emerald"] .card-icon { background: var(--emerald-soft); }

.bento-card h3 {
  margin: 0;
  font-size: clamp(1.1rem, 4.2cqi, 1.32rem);
}

.bento-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-block-start: auto;
  padding-block-start: 0.4rem;
}

.chip {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--text-primary);
}

/* Native CSS Scroll-Driven ViewTimeline Entry Reveals */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes card-reveal {
      from {
        opacity: 0.18;
        transform: translateY(28px) scale(0.96);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }
    .reveal-card {
      animation: card-reveal auto linear backwards;
      animation-timeline: view(block);
      animation-range: entry 0% cover 26%;
    }
  }
}

/* ---------------------------------------------------------------------------
   8. Tabbed 84 Compose Profiles Explorer (focusgroup + Anchor Underline)
   --------------------------------------------------------------------------- */
.tabs-shell {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: clamp(1rem, 2.5vw, 1.75rem);
}

.tablist-scroller {
  position: relative;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 2.5rem;
  padding-block-end: 0.55rem;
  border-block-end: 1px solid var(--border-subtle);
  scrollbar-width: none;

  /* Scroll-driven edge fades when overflowing */
  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: scroll(self inline)) {
      --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;
      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-scroller > button {
  flex: none;
  scroll-snap-align: start;
  position: relative;
  min-block-size: 40px;
  padding: 0.48rem 0.95rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;

  &:hover {
    color: var(--text-primary);
    background: var(--cobalt-soft);
  }
}

/* Selected state styled strictly from aria-selected, never changing dimensions */
.tablist-scroller > button[aria-selected="true"] {
  color: var(--cobalt);
  background: var(--cobalt-soft);
  anchor-name: --active-ram-tab;

  @supports not (position-anchor: auto) {
    &::after {
      content: "";
      position: absolute;
      inset: auto 0.4rem -0.55rem;
      border-block-end: 3px solid var(--cobalt);
    }
  }
}

@supports (position-anchor: auto) {
  .tablist-scroller::before {
    content: "";
    position: absolute;
    position-anchor: --active-ram-tab;
    inset-block-start: calc(anchor(bottom) + 0.32rem);
    inset-inline-start: anchor(left);
    inset-inline-end: anchor(right);
    border-block-end: 3px solid var(--cobalt);
    pointer-events: none;

    @media (prefers-reduced-motion: no-preference) {
      transition: inset 0.24s ease-out;
    }
  }
}

/* Panels share no padding/border directly so hidden="until-found" renders 0px */
.tabpanels-stack {
  display: grid;
}

.tabpanels-stack > [role="tabpanel"] {
  grid-area: 1 / 1;
}

.tabpanel-inner {
  padding-block-start: 1.35rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  @media (min-width: 900px) {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.profile-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr));
  gap: 0.65rem;
}

.profile-item {
  padding: 0.75rem 0.9rem;
  border-radius: 13px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
}

.profile-item.is-primary {
  border-color: var(--cobalt);
  background: var(--cobalt-soft);
}

.profile-item strong {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
}

.profile-item span {
  display: block;
  margin-block-start: 0.22rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   9. App Screenshot Showcase (Theme-switched Light/Dark)
   --------------------------------------------------------------------------- */
.showcase-frame {
  border-radius: 20px;
  overflow: clip;
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.28);
  background: var(--bg-elevated);
}

.showcase-frame img {
  inline-size: 100%;
  block-size: auto;
}

.showcase-frame .img-dark-only { display: none; }
.showcase-frame .img-light-only { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .showcase-frame .img-dark-only { display: block; }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .showcase-frame .img-light-only { display: none; }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .showcase-frame .img-dark-only { display: block; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .showcase-frame .img-light-only { display: none; }

/* ---------------------------------------------------------------------------
   10. Benchmarks & Verified HuggingFace Models Grid
   --------------------------------------------------------------------------- */
.bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1.25rem;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
}

.stat-number {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-block-end: 0.35rem;
}

.bar-track {
  block-size: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  overflow: clip;
  margin-block: 0.65rem;
}

.bar-fill {
  block-size: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cobalt), var(--violet));
  transform-origin: 0 50%;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
  gap: 1rem;
}

.model-card {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.model-card h3 {
  margin: 0;
  font-size: 0.98rem;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  word-break: break-word;
}

.model-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
}

.model-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-block-start: 0.35rem;
}

.btn-sm {
  min-block-size: 36px;
  padding: 0.42rem 0.85rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ---------------------------------------------------------------------------
   11. Documentation Hub Grid & Native Animated <details> Accordion
   --------------------------------------------------------------------------- */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 0.9rem;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s ease, transform 0.3s ease-out;
  transition-timing-function: ease, var(--spring-easing);

  &:hover {
    border-color: var(--cobalt);
    transform: translateY(-2px);
  }
  @media (prefers-reduced-motion: reduce) {
    transition: border-color 0.15s ease;
    &:hover { transform: none; }
  }
}

.doc-card strong {
  font-size: 0.96rem;
  color: var(--cobalt);
}

.doc-card span {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-block-end: 1rem;
}

[command="--toggle-all"][aria-expanded="true"] .expand-label,
[command="--toggle-all"][aria-expanded="false"] .collapse-label {
  display: none;
}

.accordion > details {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  margin-block-end: 0.65rem;
  padding-inline: 1.15rem;
}

.accordion > details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.65ch;
  padding-block: 1rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;

  &::-webkit-details-marker {
    display: none;
  }

  &::before {
    content: "";
    inline-size: 1em;
    block-size: 1em;
    flex-shrink: 0;
    background-color: var(--cobalt);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='black'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat center / contain;
    rotate: -90deg;
  }

  &:dir(rtl)::before {
    rotate: 90deg;
  }

  @media (prefers-reduced-motion: no-preference) {
    &::before {
      transition: rotate 0.2s ease-out;
    }
  }
}

.accordion > details[open] > summary::before {
  rotate: 0deg;
}

.accordion > details::details-content {
  interpolate-size: allow-keywords;
  overflow: clip;
  contain: layout;
}

.accordion > details:not([open])::details-content {
  block-size: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .accordion > details::details-content {
    transition: block-size, content-visibility, display;
    transition-duration: 0.28s;
    transition-timing-function: ease-in-out;
    transition-behavior: allow-discrete;
  }
}

.details-body {
  padding-block: 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* ---------------------------------------------------------------------------
   12. Top-Layer Modal <dialog closedby="any"> (@starting-style + allow-discrete)
   --------------------------------------------------------------------------- */
dialog {
  max-inline-size: min(680px, calc(100vw - 2rem));
  inline-size: 100%;
  border-radius: 20px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 1.6rem;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.26s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;

  @media (prefers-reduced-motion: no-preference) {
    transform: scale(0.92);
  }
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(4px);
  transition-property: background-color, display, overlay;
  transition-duration: 0.26s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

:is(dialog[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.92);
    }
  }

  &::backdrop {
    background-color: rgba(5, 8, 16, 0.62);

    @starting-style {
      background-color: rgba(5, 8, 16, 0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog,
  dialog::backdrop {
    transition-duration: 0.1s;
  }
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-block-end: 1rem;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.3rem;
}

/* ---------------------------------------------------------------------------
   13. Footer
   --------------------------------------------------------------------------- */
.site-footer {
  border-block-start: 1px solid var(--border-subtle);
  padding-block: 2.5rem;
  margin-block-start: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 1.15rem;
  flex-wrap: wrap;
}
