/* ==========================================================================

   "Any sufficiently advanced CSS is indistinguishable from magic."
   — Arthur C. Clarke (probably, if he'd seen @property)

   The Web Can Do THAT?! — styles.css
   52+ features. No Tailwind. No Sass. No PostCSS. No build step.
   Just CSS doing things your framework told you were impossible.

   Dear future developer reading this:
   Yes, the scroll animations are pure CSS. No, there's no JavaScript.
   Yes, the popovers are native HTML. No, we didn't use a library.
   Yes, those gradients are animating. No, it's not a GIF.

   Still skeptical? Ctrl+F for "animation-timeline: view()" and weep tears of joy.

   Lines of CSS: ~4,000
   !important declarations: 0 (we're professionals)
   Specificity wars: 0 (thank you, @layer)
   Preprocessors harmed in the making: 0

   Built by Champlin Enterprises — champlinenterprises.com

   ========================================================================== */

/* --------------------------------------------------------------------------
   @property Registrations
   Custom properties with type checking, initial values, and inheritance.
   -------------------------------------------------------------------------- */

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

@property --morph-radius {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 30%;
}

@property --text-gradient-pos {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

@property --spring-bounce {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

/* --------------------------------------------------------------------------
   Layer Order Declaration
   -------------------------------------------------------------------------- */

@layer reset, base, components, animations, utilities;

/* ==========================================================================
   RESET
   ========================================================================== */

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    scroll-behavior: smooth;
    color-scheme: dark;
  }

  body {
    min-height: 100dvh;
    overflow-x: hidden;
  }
}

/* ==========================================================================
   BASE — Design Tokens & Foundation
   ========================================================================== */

@layer base {
  :root {
    /* Colors — OKLCH */
    --bg-deep: oklch(0.08 0.02 270);
    --bg-surface: oklch(0.12 0.03 270);
    --bg-elevated: oklch(0.16 0.04 280);

    --text-primary: oklch(0.95 0.01 270);
    --text-secondary: oklch(0.7 0.02 270);

    --accent-violet: oklch(0.65 0.28 290);
    --accent-cyan: oklch(0.75 0.18 195);
    --accent-magenta: oklch(0.65 0.28 340);
    --accent-lime: oklch(0.8 0.25 140);
    --accent-orange: oklch(0.75 0.2 55);
    --accent-blue: oklch(0.7 0.2 250);

    /* Derived via color-mix() */
    --surface-hover: color-mix(in oklch, var(--bg-elevated) 80%, var(--accent-violet) 20%);
    --border-subtle: color-mix(in oklch, var(--bg-elevated) 50%, transparent 50%);
    --border-glow: color-mix(in oklch, var(--accent-cyan) 60%, transparent 40%);

    /* Typography */
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    /* Spacing — fluid clamp scales */
    --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --space-sm: clamp(0.5rem, 1vw, 1rem);
    --space-md: clamp(1rem, 2vw, 2rem);
    --space-lg: clamp(1.5rem, 4vw, 3rem);
    --space-xl: clamp(2rem, 6vw, 5rem);

    /* Misc */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }

  body {
    font-family: var(--font-display);
    color: var(--text-primary);
    background: var(--bg-deep);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);

    &:hover {
      color: var(--accent-violet);
    }
  }

  img, video, svg {
    display: block;
    max-width: 100%;
    height: auto;
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.85em;
  }

  ::selection {
    background: color-mix(in oklch, var(--accent-violet) 40%, transparent);
    color: var(--text-primary);
  }

  :focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
  }
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

@layer components {

  /* -----------------------------------------------------------------------
     Scroll Progress Bar
     ----------------------------------------------------------------------- */

  .scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan), var(--accent-magenta));
    transform-origin: left center;
    scale: 0 1;
    z-index: 9999;
    animation: scroll-progress-fill auto linear forwards;
    animation-timeline: scroll(root);
  }

  @keyframes scroll-progress-fill {
    to {
      scale: 1 1;
    }
  }

  /* -----------------------------------------------------------------------
     Hero
     ----------------------------------------------------------------------- */

  .hero {
    position: relative;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    overflow: hidden;
    container-name: hero;
    container-type: inline-size;

    &::before {
      content: "";
      position: absolute;
      inset: -50%;
      z-index: 0;
      background:
        radial-gradient(ellipse 80% 60% at 20% 30%, oklch(0.35 0.2 290 / 0.5), transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 20%, oklch(0.3 0.18 195 / 0.4), transparent 55%),
        radial-gradient(ellipse 70% 50% at 60% 80%, oklch(0.3 0.22 340 / 0.35), transparent 50%),
        radial-gradient(ellipse 50% 70% at 30% 70%, oklch(0.35 0.2 250 / 0.3), transparent 55%);
      animation: mesh-shift 20s ease-in-out infinite alternate;
    }

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 1;
      opacity: 0.03;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
      background-size: 256px 256px;
      pointer-events: none;
    }
  }

  .hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--space-md);
    max-width: 900px;
  }

  .hero h1 {
    font-size: clamp(2.5rem, 8vw, 7rem);
    font-weight: 800;
    line-height: 1.05;
    text-wrap: balance;
    letter-spacing: -0.03em;
    background: linear-gradient(
      var(--gradient-angle),
      var(--accent-violet),
      var(--accent-cyan),
      var(--accent-magenta),
      var(--accent-lime)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-spin 8s linear infinite;
  }

  .hero p {
    font-size: clamp(1rem, 2vw, 1.35rem);
    color: var(--text-secondary);
    text-wrap: pretty;
    margin-top: var(--space-sm);
    max-width: 55ch;
    margin-inline: auto;
  }

  .hero .badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 999px;
    background: color-mix(in oklch, var(--bg-elevated) 70%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    transition: opacity 0.4s ease, translate 0.4s ease;

    @starting-style {
      opacity: 0;
      translate: 0 10px;
    }
  }

  .badge .pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-lime);
    animation: pulse 2s ease-in-out infinite;
  }

  .scroll-hint {
    position: absolute;
    bottom: var(--space-lg);
    left: 50%;
    translate: -50% 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: bounce-down 2s ease-in-out infinite;
  }

  .scroll-hint svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-cyan);
  }

  @container hero (max-width: 600px) {
    .hero h1 {
      font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .hero p {
      font-size: 1rem;
    }
  }

  /* -----------------------------------------------------------------------
     Sections
     ----------------------------------------------------------------------- */

  .section {
    padding: var(--space-xl) var(--space-md);
    position: relative;
    container-type: inline-size;
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
  }

  .section-inner {
    max-width: 1100px;
    margin-inline: auto;
  }

  .section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-xs);
  }

  .section-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    text-wrap: balance;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-sm);
  }

  .section-desc {
    color: var(--text-secondary);
    text-wrap: pretty;
    max-width: 55ch;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    margin-bottom: var(--space-lg);
  }

  /* -----------------------------------------------------------------------
     Navigation — Sticky TOC
     ----------------------------------------------------------------------- */

  .toc {
    position: fixed;
    left: var(--space-md);
    top: 50%;
    translate: 0 -50%;
    width: 220px;
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: color-mix(in oklch, var(--bg-surface) 80%, transparent);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) 0;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;

    /* Thin custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in oklch, var(--accent-cyan) 30%, transparent) transparent;
  }

  .toc-link {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 6px var(--space-sm) 6px var(--space-md);
    color: var(--text-secondary);
    border-left: 2px solid transparent;
    transition: color var(--transition-fast), border-left-color var(--transition-fast), background var(--transition-fast);
    text-decoration: none;

    &:hover {
      color: var(--text-primary);
      background: color-mix(in oklch, var(--bg-elevated) 50%, transparent);
    }

    &.active {
      color: var(--accent-cyan);
      border-left-color: var(--accent-cyan);
      background: color-mix(in oklch, var(--accent-cyan) 12%, transparent);
      font-weight: 600;
      text-shadow: 0 0 12px oklch(0.75 0.18 195 / 0.4);
    }
  }

  .toc-toggle {
    display: none;
    position: fixed;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 101;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: color-mix(in oklch, var(--bg-surface) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);

    &:hover {
      background: var(--surface-hover);
    }
  }

  @media (max-width: 1200px) {
    .toc-toggle {
      display: flex;
    }

    .toc {
      left: 0;
      top: 0;
      translate: 0 0;
      width: 260px;
      height: 100dvh;
      max-height: 100dvh;
      border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
      transform: translateX(-100%);
      opacity: 0;
      pointer-events: none;
    }

    .toc.open {
      transform: translateX(0);
      opacity: 1;
      pointer-events: auto;
    }
  }

  /* -----------------------------------------------------------------------
     Cards
     ----------------------------------------------------------------------- */

  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: var(--space-md);
  }

  .card {
    position: relative;
    background: color-mix(in oklch, var(--bg-elevated) 60%, transparent);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    overflow: hidden;
    transition: border-color var(--transition-smooth), translate var(--transition-smooth), box-shadow var(--transition-smooth);

    &:hover {
      border-color: var(--border-glow);
      translate: 0 -4px;
      box-shadow: 0 20px 60px -15px color-mix(in oklch, var(--accent-violet) 15%, transparent);
    }
  }

  .card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan), var(--accent-magenta));
    opacity: 0;
    transition: opacity var(--transition-smooth);

    .card:hover & {
      opacity: 1;
    }
  }

  .card-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    line-height: 1;
  }

  .card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.01em;
  }

  .card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .card code {
    display: inline-block;
    background: color-mix(in oklch, var(--bg-deep) 80%, var(--accent-cyan) 20%);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--accent-cyan);
    margin-top: var(--space-xs);
  }

  .card .browser-support {
    display: flex;
    gap: 4px;
    margin-top: var(--space-sm);
  }

  .card .browser-support span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-lime);
  }

  .card .browser-support span.partial {
    background: var(--accent-orange);
  }

  .card .browser-support span.none {
    background: color-mix(in oklch, var(--text-secondary) 40%, transparent);
  }

  /* -----------------------------------------------------------------------
     Ticker (Marquee)
     ----------------------------------------------------------------------- */

  .ticker {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
    padding: var(--space-sm) 0;
  }

  .ticker-track {
    display: flex;
    gap: var(--space-sm);
    width: max-content;
    animation: ticker-scroll 30s linear infinite;

    .ticker:hover & {
      animation-play-state: paused;
    }
  }

  .ticker-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);

    &:hover {
      border-color: var(--border-glow);
      color: var(--text-primary);
      box-shadow: 0 0 20px color-mix(in oklch, var(--accent-cyan) 15%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     Code Blocks
     ----------------------------------------------------------------------- */

  .code-block {
    position: relative;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    padding-top: calc(var(--space-md) + 16px);
    overflow-x: auto;

    &::before {
      content: "";
      position: absolute;
      top: 12px;
      left: 14px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: oklch(0.6 0.25 25);
      box-shadow:
        20px 0 0 oklch(0.75 0.2 85),
        40px 0 0 oklch(0.65 0.2 145);
    }
  }

  .code-block code {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre;
    tab-size: 2;
  }

  .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--accent-cyan);
    background: transparent;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);

    &:hover {
      background: color-mix(in oklch, var(--accent-cyan) 15%, transparent);
    }

    &.copied {
      border-color: var(--accent-lime);
      color: var(--accent-lime);
      background: color-mix(in oklch, var(--accent-lime) 10%, transparent);
    }
  }

  /* Code token colors */
  .token-prop { color: var(--accent-cyan); }
  .token-val { color: var(--accent-lime); }
  .token-str { color: var(--accent-orange); }
  .token-comment { color: var(--text-secondary); font-style: italic; opacity: 0.7; }
  .token-keyword { color: var(--accent-violet); }
  .token-fn { color: var(--accent-blue); }

  /* -----------------------------------------------------------------------
     Popover
     ----------------------------------------------------------------------- */

  [popover] {
    /* Center in viewport */
    inset: 0;
    margin: auto;
    width: fit-content;
    height: fit-content;

    background: color-mix(in oklch, var(--bg-elevated) 85%, transparent);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    max-width: min(400px, 90vw);
    box-shadow: 0 25px 80px -20px oklch(0 0 0 / 0.6);

    /* Explicit open state values */
    opacity: 1;
    scale: 1;
    translate: 0 0;

    transition:
      opacity 0.3s ease,
      scale 0.3s cubic-bezier(0.22, 1, 0.36, 1),
      translate 0.3s ease,
      display 0.3s ease allow-discrete,
      overlay 0.3s ease allow-discrete;
  }

  /* Entry animation — where the popover starts FROM */
  [popover]:popover-open {
    opacity: 1;
    scale: 1;
    translate: 0 0;

    @starting-style {
      opacity: 0;
      scale: 0.92;
      translate: 0 12px;
    }
  }

  /* Exit animation — where the popover goes TO when closing */
  [popover]:not(:popover-open) {
    opacity: 0;
    scale: 0.92;
    translate: 0 12px;
  }

  [popover]::backdrop {
    background: oklch(0 0 0 / 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition:
      background 0.3s ease,
      backdrop-filter 0.3s ease,
      display 0.3s ease allow-discrete,
      overlay 0.3s ease allow-discrete;
  }

  [popover]:popover-open::backdrop {
    background: oklch(0 0 0 / 0.5);
    backdrop-filter: blur(4px);

    @starting-style {
      background: oklch(0 0 0 / 0);
      backdrop-filter: blur(0);
    }
  }

  [popover]:not(:popover-open)::backdrop {
    background: oklch(0 0 0 / 0);
    backdrop-filter: blur(0);
  }

  .pop-trigger {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-violet);
    background: color-mix(in oklch, var(--accent-violet) 12%, transparent);
    color: var(--accent-violet);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: scale var(--transition-fast), background var(--transition-fast);

    &:hover {
      scale: 1.05;
      background: color-mix(in oklch, var(--accent-violet) 20%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     :has() Demo
     ----------------------------------------------------------------------- */

  .has-demo {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }

  .has-demo-card {
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;

    &:has(input:checked) {
      border-color: var(--accent-lime);
      background: color-mix(in oklch, var(--accent-lime) 5%, var(--bg-surface));
      box-shadow: 0 0 30px color-mix(in oklch, var(--accent-lime) 10%, transparent);
    }

    &:has(input:focus-visible) {
      outline: 2px solid var(--accent-cyan);
      outline-offset: 2px;
    }
  }

  .has-demo-card label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-weight: 500;
  }

  .has-demo-card input[type="checkbox"] {
    accent-color: var(--accent-lime);
    width: 20px;
    height: 20px;
    cursor: pointer;
  }

  .has-demo-status {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    transition: color 0.3s ease;
  }

  .has-demo:has(.has-demo-card input:checked) .has-demo-status {
    color: var(--accent-lime);

    &::before {
      content: "\2713  ";
    }
  }

  /* -----------------------------------------------------------------------
     Morph Blobs
     ----------------------------------------------------------------------- */

  .morph-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
  }

  .morph-blob {
    width: clamp(200px, 30vw, 350px);
    aspect-ratio: 1;
    background: conic-gradient(
      from var(--gradient-angle),
      var(--accent-violet),
      var(--accent-cyan),
      var(--accent-magenta),
      var(--accent-lime),
      var(--accent-violet)
    );
    border-radius: var(--morph-radius) calc(100% - var(--morph-radius)) var(--morph-radius) calc(100% - var(--morph-radius));
    animation:
      gradient-spin 6s linear infinite,
      morph 8s ease-in-out infinite;
    transition: filter 0.4s ease;

    &:hover {
      filter: blur(30px) brightness(1.3);
    }
  }

  /* -----------------------------------------------------------------------
     3D Tilt Card
     ----------------------------------------------------------------------- */

  .tilt-scene {
    perspective: 800px;
    display: flex;
    justify-content: center;
    padding: var(--space-lg);
  }

  .tilt-card {
    position: relative;
    width: min(380px, 100%);
    padding: var(--space-lg);
    background: color-mix(in oklch, var(--bg-elevated) 70%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transform-style: preserve-3d;
    cursor: grab;
    transition: transform 0.1s ease-out;
    overflow: hidden;

    &:active {
      cursor: grabbing;
    }
  }

  .tilt-reflection {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
      circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      oklch(1 0 0 / 0.08),
      transparent 60%
    );
    pointer-events: none;
    z-index: 1;
  }

  .tilt-content {
    position: relative;
    transform: translateZ(40px);
    z-index: 2;
  }

  /* -----------------------------------------------------------------------
     Audio Visualizer
     ----------------------------------------------------------------------- */

  .audio-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 120px;
    padding: var(--space-sm);
  }

  .audio-bar {
    width: 4px;
    min-height: 4px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(to top, var(--accent-violet), var(--accent-cyan));
    transition: height 0.15s ease;
  }

  .audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-magenta));
    color: white;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: scale var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);

    &:hover {
      scale: 1.05;
      box-shadow: 0 10px 40px color-mix(in oklch, var(--accent-violet) 30%, transparent);
    }

    &.playing {
      background: linear-gradient(135deg, var(--accent-lime), var(--accent-cyan));
    }
  }

  /* -----------------------------------------------------------------------
     Color Palette
     ----------------------------------------------------------------------- */

  .palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-sm);
  }

  .swatch {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: scale var(--transition-smooth), rotate var(--transition-smooth);
    position: relative;

    &:hover {
      scale: 1.08;
      rotate: 3deg;
    }

    &:active {
      scale: 0.95;
    }
  }

  .swatch-1 { background: oklch(0.65 0.3 290); }
  .swatch-2 { background: oklch(0.75 0.2 195); }
  .swatch-3 { background: oklch(0.65 0.3 340); }
  .swatch-4 { background: oklch(0.8 0.27 140); }
  .swatch-5 { background: oklch(0.75 0.22 55); }
  .swatch-6 { background: oklch(0.7 0.25 250); }

  /* -----------------------------------------------------------------------
     View Transitions Demo
     ----------------------------------------------------------------------- */

  .vt-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm);
  }

  .vt-card {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    background: var(--vt-color, var(--bg-elevated));
    border: 1px solid color-mix(in oklch, var(--vt-color, var(--border-subtle)) 40%, transparent);
    overflow: hidden;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    text-shadow: 0 2px 8px oklch(0 0 0 / 0.4);
    transition: scale var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);

    &:hover {
      scale: 1.05;
      border-color: var(--border-glow);
      box-shadow: 0 10px 40px oklch(0.3 0.15 270 / 0.3);
    }
  }

  .vt-detail {
    padding: var(--space-lg);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);

    &[hidden] {
      display: none;
    }
  }

  ::view-transition-old(vt-card) {
    animation-duration: 0.35s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  ::view-transition-new(vt-card) {
    animation-duration: 0.35s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* -----------------------------------------------------------------------
     Anchor Positioning Demo
     ----------------------------------------------------------------------- */

  .anchor-btn {
    anchor-name: --anchor-btn;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-cyan);
    background: color-mix(in oklch, var(--accent-cyan) 10%, transparent);
    color: var(--accent-cyan);
    font-family: var(--font-display);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition-fast);

    &:hover {
      background: color-mix(in oklch, var(--accent-cyan) 20%, transparent);
    }
  }

  .anchor-tooltip {
    position: fixed;
    position-anchor: --anchor-btn;
    inset-area: top;
    margin-bottom: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    box-shadow: 0 10px 40px oklch(0 0 0 / 0.4);
    z-index: 50;

    @supports not (position-anchor: --anchor-btn) {
      position: absolute;
      bottom: 100%;
      left: 50%;
      translate: -50% -8px;
    }
  }

  .anchor-tooltip.bottom {
    inset-area: bottom;
    margin-top: 8px;
    margin-bottom: 0;
  }

  .anchor-tooltip.left {
    inset-area: left;
    margin-right: 8px;
    margin-bottom: 0;
  }

  .anchor-tooltip.right {
    inset-area: right;
    margin-left: 8px;
    margin-bottom: 0;
  }

  /* -----------------------------------------------------------------------
     light-dark() Demo
     ----------------------------------------------------------------------- */

  .ld-demo {
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: background 0.4s ease, color 0.4s ease;
  }

  .ld-demo[data-theme="light"] {
    color-scheme: light;
    background: light-dark(oklch(0.97 0.01 270), var(--bg-surface));
    color: light-dark(oklch(0.15 0.02 270), var(--text-primary));
    border: 1px solid light-dark(oklch(0.85 0.02 270), var(--border-subtle));
  }

  .ld-demo[data-theme="dark"] {
    color-scheme: dark;
    background: light-dark(oklch(0.97 0.01 270), var(--bg-surface));
    color: light-dark(oklch(0.15 0.02 270), var(--text-primary));
    border: 1px solid light-dark(oklch(0.85 0.02 270), var(--border-subtle));
  }

  .ld-demo .ld-card {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    background: light-dark(oklch(0.93 0.01 270), var(--bg-elevated));
    border: 1px solid light-dark(oklch(0.8 0.02 270), var(--border-subtle));
    color: light-dark(oklch(0.2 0.02 270), var(--text-secondary));
    font-size: 0.9rem;
  }

  .theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-mono);
  }

  .theme-toggle input {
    appearance: none;
    width: 48px;
    height: 26px;
    border-radius: 999px;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    position: relative;
    transition: background 0.3s ease;

    &::after {
      content: "";
      position: absolute;
      top: 2px;
      left: 2px;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: var(--accent-cyan);
      transition: translate 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    }

    &:checked {
      background: var(--accent-violet);

      &::after {
        translate: 22px 0;
      }
    }
  }

  /* -----------------------------------------------------------------------
     linear() Easing / Spring Demo
     ----------------------------------------------------------------------- */

  .spring-demo {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-md);
  }

  .spring-lane {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .spring-lane-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  .spring-track {
    width: 60px;
    height: 220px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    position: relative;
    border: 1px solid var(--border-subtle);
  }

  .ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    translate: -50% 0;
  }

  .ball-ease {
    background: var(--accent-orange);
    animation: bounce-ball 1s ease infinite alternate;
  }

  .ball-spring {
    background: var(--accent-cyan);
    animation: bounce-ball 1s linear(
      0, 0.004, 0.016, 0.035, 0.063, 0.098, 0.141, 0.191, 0.25,
      0.316, 0.391, 0.473, 0.562, 0.66, 0.765, 0.878, 1,
      1.089, 1.148, 1.178, 1.183, 1.166, 1.131, 1.082, 1.025,
      0.965, 0.908, 0.858, 0.819, 0.794, 0.784, 0.789, 0.808,
      0.84, 0.88, 0.925, 0.97, 1.01, 1.042, 1.064, 1.073,
      1.07, 1.056, 1.034, 1.007, 0.979, 0.954, 0.935, 0.924,
      0.92, 0.926, 0.939, 0.957, 0.979, 1
    ) infinite alternate;
  }

  /* -----------------------------------------------------------------------
     @scope Demo
     ----------------------------------------------------------------------- */

  @scope (.scope-outer) to (.scope-inner) {
    p {
      color: var(--accent-cyan);
      border-left: 3px solid var(--accent-cyan);
      padding-left: var(--space-sm);
    }

    .scope-styled {
      background: color-mix(in oklch, var(--accent-cyan) 10%, transparent);
      padding: var(--space-sm);
      border-radius: var(--radius-md);
    }
  }

  .scope-outer {
    background: var(--bg-surface);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
  }

  .scope-inner {
    background: var(--bg-elevated);
    border: 1px solid var(--accent-magenta);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-sm);

    & p {
      color: var(--accent-magenta);
      border-left: 3px solid var(--accent-magenta);
      padding-left: var(--space-sm);
    }
  }

  /* -----------------------------------------------------------------------
     Exclusive Accordion
     ----------------------------------------------------------------------- */

  .accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
  }

  .accordion details {
    background: color-mix(in oklch, var(--bg-elevated) 60%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;

    &[open] {
      border-color: var(--accent-lime);
      box-shadow: 0 0 25px color-mix(in oklch, var(--accent-lime) 10%, transparent);
    }
  }

  .accordion summary {
    padding: var(--space-sm) var(--space-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color var(--transition-fast);

    &:hover {
      color: var(--accent-lime);
    }

    &::after {
      content: "+";
      font-family: var(--font-mono);
      font-size: 1.2rem;
      font-weight: 300;
      color: var(--text-secondary);
      transition: transform 0.3s ease, color 0.3s ease;
    }

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

  .accordion details[open] summary::after {
    content: "\2212";
    color: var(--accent-lime);
  }

  .accordion details > div {
    padding: 0 var(--space-md) var(--space-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
  }

  /* -----------------------------------------------------------------------
     Dialog
     ----------------------------------------------------------------------- */

  dialog {
    background: color-mix(in oklch, var(--bg-elevated) 90%, transparent);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    color: var(--text-primary);
    font-family: var(--font-display);
    max-width: min(480px, 90vw);
    box-shadow: 0 30px 90px -20px oklch(0 0 0 / 0.7);

    /* Explicit open state */
    opacity: 1;
    scale: 1;
    translate: 0 0;

    transition:
      opacity 0.3s ease,
      scale 0.3s cubic-bezier(0.22, 1, 0.36, 1),
      translate 0.3s ease,
      display 0.3s ease allow-discrete,
      overlay 0.3s ease allow-discrete;
  }

  dialog[open] {
    opacity: 1;
    scale: 1;
    translate: 0 0;

    @starting-style {
      opacity: 0;
      scale: 0.92;
      translate: 0 20px;
    }
  }

  dialog:not([open]) {
    opacity: 0;
    scale: 0.92;
    translate: 0 20px;
  }

  dialog::backdrop {
    background: oklch(0 0 0 / 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition:
      background 0.3s ease,
      backdrop-filter 0.3s ease,
      display 0.3s ease allow-discrete,
      overlay 0.3s ease allow-discrete;
  }

  dialog[open]::backdrop {
    background: oklch(0 0 0 / 0.6);
    backdrop-filter: blur(6px);

    @starting-style {
      background: oklch(0 0 0 / 0);
      backdrop-filter: blur(0);
    }
  }

  dialog:not([open])::backdrop {
    background: oklch(0 0 0 / 0);
    backdrop-filter: blur(0);
  }

  dialog h2 {
    font-size: 1.3rem;
    margin-bottom: var(--space-sm);
  }

  dialog p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
  }

  dialog .dialog-close {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 500;
    transition: background var(--transition-fast), border-color var(--transition-fast);

    &:hover {
      background: var(--surface-hover);
      border-color: var(--border-glow);
    }
  }

  /* -----------------------------------------------------------------------
     field-sizing Demo
     ----------------------------------------------------------------------- */

  .fs-input,
  .fs-textarea {
    field-sizing: content;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    min-width: 200px;
    max-width: 100%;
    transition: border-color var(--transition-fast);

    &:focus {
      border-color: var(--accent-cyan);
      outline: none;
    }

    &::placeholder {
      color: var(--text-secondary);
    }
  }

  .fs-textarea {
    min-height: 40px;
    resize: none;
  }

  .fs-fixed {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    width: 200px;
    transition: border-color var(--transition-fast);

    &:focus {
      border-color: var(--accent-orange);
      outline: none;
    }

    &::placeholder {
      color: var(--text-secondary);
    }
  }

  .fs-comparison {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .fs-comparison > div {
    flex: 1;
    min-width: 200px;
  }

  .fs-comparison label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  /* -----------------------------------------------------------------------
     offset-path Demo
     ----------------------------------------------------------------------- */

  .orbit-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .orbit-center {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-violet);
    box-shadow: 0 0 30px color-mix(in oklch, var(--accent-violet) 40%, transparent);
    z-index: 2;
  }

  .orbit-ring {
    position: absolute;
    inset: 10px;
    border: 1px dashed color-mix(in oklch, var(--text-secondary) 25%, transparent);
    border-radius: 50%;
    pointer-events: none;
  }

  .orbit-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-cyan);
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    offset-path: path("M 150 0 A 150 150 0 1 1 -150 0 A 150 150 0 1 1 150 0");
    offset-distance: 0%;
    animation: orbit 4s linear infinite;
  }

  .orbit-dot-2 {
    animation-delay: -2s;
  }

  .orbit-dot:nth-child(3) {
    background: var(--accent-magenta);
    box-shadow: 0 0 12px var(--accent-magenta);
    animation-delay: -1.33s;
  }

  .orbit-dot:nth-child(4) {
    background: var(--accent-lime);
    box-shadow: 0 0 12px var(--accent-lime);
    animation-delay: -2.66s;
  }

  /* -----------------------------------------------------------------------
     clip-path Demo
     ----------------------------------------------------------------------- */

  .clip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-sm);
  }

  .clip-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: clip-path 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
    background: var(--clip-color, var(--accent-violet));
    clip-path: circle(30% at 50% 50%);
    min-height: 150px;

    &:hover {
      clip-path: circle(100% at 50% 50%);
    }

    & span {
      text-shadow: 0 1px 3px oklch(0 0 0 / 0.4);
    }
  }

  .clip-polygon {
    background: var(--clip-color, var(--accent-cyan));
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);

    &:hover {
      clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
    }
  }

  .clip-inset {
    background: var(--clip-color, var(--accent-magenta));
    clip-path: inset(40%);

    &:hover {
      clip-path: inset(0%);
    }
  }

  .clip-ellipse {
    background: var(--clip-color, var(--accent-lime));
    clip-path: ellipse(20% 30% at 50% 50%);

    &:hover {
      clip-path: ellipse(50% 50% at 50% 50%);
    }
  }

  /* -----------------------------------------------------------------------
     Relative Color Syntax Demo
     ----------------------------------------------------------------------- */

  .rcs-palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
  }

  .rcs-base {
    --rcs-base: oklch(0.65 0.28 290);
  }

  .rcs-swatch {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--bg-deep);
    font-weight: 600;
    transition: scale var(--transition-fast);

    &:hover {
      scale: 1.05;
    }
  }

  .rcs-original {
    background: var(--rcs-base);
  }

  .rcs-lighter {
    background: oklch(from var(--rcs-base) calc(l * 1.3) c h);
  }

  .rcs-darker {
    background: oklch(from var(--rcs-base) calc(l * 0.7) c h);
  }

  .rcs-desat {
    background: oklch(from var(--rcs-base) l calc(c * 0.4) h);
  }

  .rcs-shift-hue {
    background: oklch(from var(--rcs-base) l c calc(h + 60));
  }

  .rcs-complement {
    background: oklch(from var(--rcs-base) l c calc(h + 180));
  }

  /* -----------------------------------------------------------------------
     interpolate-size Demo
     ----------------------------------------------------------------------- */

  .is-container {
    interpolate-size: allow-keywords;
  }

  .is-content {
    height: 0;
    overflow: hidden;
    transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding-inline: var(--space-md);
    border: 1px solid var(--border-subtle);

    &.open {
      height: auto;
      padding-block: var(--space-md);
    }
  }

  .is-no {
    & .is-content-no {
      height: 0;
      overflow: hidden;
      transition: height 0.5s ease;
      background: var(--bg-surface);
      border-radius: var(--radius-md);
      padding-inline: var(--space-md);
      border: 1px solid var(--border-subtle);

      &.open {
        height: 150px;
        padding-block: var(--space-md);
      }
    }
  }

  .is-toggle {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-lime);
    background: color-mix(in oklch, var(--accent-lime) 10%, transparent);
    color: var(--accent-lime);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    margin-bottom: var(--space-sm);
    transition: background var(--transition-fast);

    &:hover {
      background: color-mix(in oklch, var(--accent-lime) 20%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     Individual Transforms Demo
     ----------------------------------------------------------------------- */

  .it-demo {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: var(--space-lg);
  }

  .it-lane {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .it-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  .it-box {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
  }

  .it-translate {
    background: var(--accent-cyan);
    animation: it-move 2s ease infinite;
  }

  .it-rotate {
    background: var(--accent-violet);
    animation: it-spin 3s linear infinite;
  }

  .it-scale {
    background: var(--accent-magenta);
    animation: it-pulse 1.5s ease infinite;
  }

  /* -----------------------------------------------------------------------
     accent-color Demo
     ----------------------------------------------------------------------- */

  .ac-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    align-items: start;
  }

  .ac-form label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    cursor: pointer;
  }

  .ac-form input[type="checkbox"],
  .ac-form input[type="radio"] {
    accent-color: var(--ac-color, var(--accent-violet));
    width: 18px;
    height: 18px;
    cursor: pointer;
  }

  .ac-form input[type="range"] {
    accent-color: var(--ac-color, var(--accent-violet));
    width: 100%;
    cursor: pointer;
  }

  .ac-form progress {
    accent-color: var(--ac-color, var(--accent-violet));
    color-scheme: light dark;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    border: none;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-deep);
  }

  .ac-form progress::-webkit-progress-bar {
    background: var(--bg-deep);
    border-radius: 6px;
  }

  .ac-form progress::-webkit-progress-value {
    background: var(--ac-color, var(--accent-violet));
    border-radius: 6px;
    transition: background 0.3s ease;
  }

  .ac-form progress::-moz-progress-bar {
    background: var(--ac-color, var(--accent-violet));
    border-radius: 6px;
  }

  .ac-picker {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  .ac-picker input[type="color"] {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0;
    cursor: pointer;
    background: transparent;

    &::-webkit-color-swatch-wrapper {
      padding: 2px;
    }

    &::-webkit-color-swatch {
      border: none;
      border-radius: 4px;
    }
  }

  /* -----------------------------------------------------------------------
     aspect-ratio Demo
     ----------------------------------------------------------------------- */

  .ar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-sm);
  }

  .ar-item {
    aspect-ratio: var(--ar, 16 / 9);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: aspect-ratio 0.5s ease, background 0.3s ease;

    &:hover {
      background: var(--surface-hover);
    }
  }

  .ar-controls {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
  }

  .ar-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);

    &:hover,
    &.active {
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      background: color-mix(in oklch, var(--accent-cyan) 8%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     Logical Properties Demo
     ----------------------------------------------------------------------- */

  .lp-container {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .lp-card {
    flex: 1;
    min-width: 250px;
    margin-inline: var(--space-sm);
    padding-block: var(--space-md);
    padding-inline: var(--space-md);
    border-inline-start: 4px solid var(--accent-cyan);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    inset-inline: auto;
  }

  .lp-card h3 {
    margin-block-end: var(--space-xs);
  }

  .lp-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
  }

  .lp-toggle {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-cyan);
    background: color-mix(in oklch, var(--accent-cyan) 10%, transparent);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    margin-bottom: var(--space-sm);
    transition: background var(--transition-fast);

    &:hover {
      background: color-mix(in oklch, var(--accent-cyan) 20%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     overscroll-behavior Demo
     ----------------------------------------------------------------------- */

  .os-demo-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .os-container {
    flex: 1;
    min-width: 250px;
    height: 200px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg-surface);
    border: 1px solid var(--accent-lime);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .os-no-contain {
    flex: 1;
    min-width: 250px;
    height: 200px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  /* -----------------------------------------------------------------------
     Canvas + OffscreenCanvas Demo
     ----------------------------------------------------------------------- */

  .canvas-container {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
  }

  #particleCanvas {
    width: 100%;
    height: 300px;
    display: block;
    background: var(--bg-deep);
  }

  .fps-counter {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in oklch, var(--bg-deep) 80%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--accent-lime);
    border: 1px solid color-mix(in oklch, var(--accent-lime) 30%, transparent);
  }

  /* -----------------------------------------------------------------------
     Object.groupBy Demo
     ----------------------------------------------------------------------- */

  .gb-result {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
  }

  .gb-group {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
  }

  .gb-group-header {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-violet);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
  }

  .gb-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 4px 0;
  }

  /* -----------------------------------------------------------------------
     Set Methods Demo
     ----------------------------------------------------------------------- */

  .set-demo {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    align-items: center;
  }

  .set-venn {
    position: relative;
    width: 300px;
    height: 200px;
  }

  .set-circle {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 2px solid;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    top: 10px;
  }

  .set-circle-a {
    left: 0;
    border-color: var(--accent-cyan);
    background: color-mix(in oklch, var(--accent-cyan) 10%, transparent);
    color: var(--accent-cyan);
  }

  .set-circle-b {
    right: 0;
    border-color: var(--accent-magenta);
    background: color-mix(in oklch, var(--accent-magenta) 10%, transparent);
    color: var(--accent-magenta);
  }

  .set-result {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 100%;
    max-width: 400px;
  }

  .set-result strong {
    color: var(--accent-cyan);
  }

  /* -----------------------------------------------------------------------
     Promise.withResolvers Demo
     ----------------------------------------------------------------------- */

  .pwr-demo {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    align-items: center;
  }

  .pwr-bar {
    width: 100%;
    max-width: 400px;
    height: 12px;
    border-radius: 999px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
  }

  .pwr-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
    width: 0%;
    transition: width 0.3s ease;
  }

  .pwr-timer {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
    letter-spacing: 0.05em;
  }

  .pwr-btn {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-violet);
    background: color-mix(in oklch, var(--accent-violet) 10%, transparent);
    color: var(--accent-violet);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), scale var(--transition-fast);

    &:hover {
      background: color-mix(in oklch, var(--accent-violet) 20%, transparent);
      scale: 1.03;
    }
  }

  /* -----------------------------------------------------------------------
     Custom Elements Demo
     ----------------------------------------------------------------------- */

  feature-card {
    display: block;
    background: color-mix(in oklch, var(--bg-elevated) 60%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: border-color var(--transition-smooth), translate var(--transition-smooth);

    &:hover {
      border-color: var(--border-glow);
      translate: 0 -2px;
    }
  }

  feature-card [slot="title"] {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
  }

  feature-card [slot="description"] {
    color: var(--text-secondary);
    font-size: 0.9rem;
  }

  /* -----------------------------------------------------------------------
     RegExp v Demo
     ----------------------------------------------------------------------- */

  .regex-input {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    width: 100%;
    max-width: 400px;
    transition: border-color var(--transition-fast);

    &:focus {
      border-color: var(--accent-violet);
      outline: none;
    }
  }

  .regex-matches {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-height: 60px;
  }

  .regex-matches .match {
    display: inline-block;
    background: color-mix(in oklch, var(--accent-violet) 20%, transparent);
    color: var(--accent-violet);
    padding: 2px 6px;
    border-radius: 4px;
    margin: 2px;
  }

  /* -----------------------------------------------------------------------
     Speculation Rules Demo
     ----------------------------------------------------------------------- */

  .spec-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-cyan);
    background: color-mix(in oklch, var(--accent-cyan) 8%, transparent);
    color: var(--accent-cyan);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);

    &:hover {
      background: color-mix(in oklch, var(--accent-cyan) 15%, transparent);
      box-shadow: 0 0 25px color-mix(in oklch, var(--accent-cyan) 15%, transparent);
    }
  }

  .spec-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: color-mix(in oklch, var(--accent-lime) 15%, transparent);
    color: var(--accent-lime);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: pulse 2s ease-in-out infinite;
  }

  /* -----------------------------------------------------------------------
     Feature Grid (Final Section)
     ----------------------------------------------------------------------- */

  .feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: var(--space-sm);
  }

  .feature-mini-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color var(--transition-fast), translate var(--transition-fast);

    &:hover {
      border-color: var(--border-glow);
      translate: 0 -2px;
    }
  }

  .feature-mini-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
  }

  .feature-mini-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  .feature-mini-card .browser-support {
    display: flex;
    gap: 3px;
    margin-top: 2px;
  }

  .feature-mini-card .browser-support span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-lime);
  }

  .feature-mini-card .browser-support span.partial {
    background: var(--accent-orange);
  }

  .feature-mini-card .browser-support span.none {
    background: color-mix(in oklch, var(--text-secondary) 40%, transparent);
  }

  .feature-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
  }

  .tag-css {
    background: color-mix(in oklch, var(--accent-cyan) 15%, transparent);
    color: var(--accent-cyan);
  }

  .tag-js {
    background: color-mix(in oklch, var(--accent-lime) 15%, transparent);
    color: var(--accent-lime);
  }

  .tag-html {
    background: color-mix(in oklch, var(--accent-orange) 15%, transparent);
    color: var(--accent-orange);
  }

  .tag-api {
    background: color-mix(in oklch, var(--accent-violet) 15%, transparent);
    color: var(--accent-violet);
  }

  /* -----------------------------------------------------------------------
     TOC Header
     ----------------------------------------------------------------------- */

  .toc-header {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-violet);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: var(--space-xs) var(--space-md) var(--space-sm);
  }

  /* -----------------------------------------------------------------------
     Feature Search Bar
     ----------------------------------------------------------------------- */

  .feature-search {
    position: sticky;
    top: 0;
    z-index: 90;
    padding: var(--space-sm) var(--space-md);
    background: color-mix(in oklch, var(--bg-deep) 85%, transparent);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    display: flex;
    justify-content: center;
  }

  .feature-search input[type="search"] {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 10px 24px;
    min-width: min(400px, 80vw);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);

    &:focus {
      border-color: var(--accent-cyan);
      outline: none;
      box-shadow: 0 0 20px color-mix(in oklch, var(--accent-cyan) 12%, transparent);
    }

    &::placeholder {
      color: var(--text-secondary);
    }
  }

  /* -----------------------------------------------------------------------
     Demo Wrappers — glassmorphism card for every demo section
     ----------------------------------------------------------------------- */

  .scroll-anim-demo,
  .morph-demo,
  .oklch-demo,
  .cq-demo,
  .popover-demo,
  .anchor-demo,
  .scope-demo,
  .orbit-demo,
  .rcs-demo,
  .is-demo,
  .ac-demo,
  .ar-demo,
  .lp-demo,
  .os-demo,
  .nesting-demo,
  .layer-demo,
  .ss-demo,
  .cm-demo,
  .tw-demo,
  .canvas-demo,
  .gb-demo,
  .wc-demo,
  .regex-demo,
  .cv-demo,
  .snap-demo,
  .dvh-demo,
  .bf-demo,
  .spec-demo,
  .search-demo,
  .fs-demo,
  .vt-demo,
  .subgrid-demo,
  .math-demo,
  .paint-demo,
  .io-demo,
  .egg-demo,
  .trail-demo {
    background: color-mix(in oklch, var(--bg-elevated) 40%, transparent);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
  }

  .scroll-anim-note {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .morph-demo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-lg);
  }

  .oklch-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-sm);
  }

  .cq-card {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: color-mix(in oklch, var(--bg-elevated) 60%, transparent);
    border-radius: var(--radius-md);
  }

  .cq-icon {
    font-size: 2rem;
    line-height: 1;
  }

  .cq-body h3 {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
  }

  .cq-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
  }

  @container (min-width: 400px) {
    .cq-card {
      grid-template-columns: auto 1fr;
      text-align: left;
    }
  }

  .fs-pair {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);

    & label {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }
  }

  .ss-box {
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--accent-violet);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition:
      opacity 0.5s ease,
      scale 0.5s cubic-bezier(0.22, 1, 0.36, 1),
      display 0.5s allow-discrete;

    @starting-style {
      opacity: 0;
      scale: 0.9;
    }

    &[hidden] {
      opacity: 0;
      scale: 0.9;
      display: none;
    }
  }

  .cm-pair {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
  }

  .cm-swatch {
    flex: 1;
    min-width: 80px;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bg-deep);
    transition: scale var(--transition-fast);

    &:hover {
      scale: 1.05;
    }
  }

  .tw-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);

    & h3 {
      font-size: 1.1rem;
      font-weight: 600;
      margin-bottom: var(--space-xs);
      max-width: 25ch;
    }

    & code {
      display: inline-block;
      background: color-mix(in oklch, var(--bg-deep) 80%, var(--accent-cyan) 20%);
      padding: 2px 8px;
      border-radius: var(--radius-sm);
      font-size: 0.75rem;
      color: var(--accent-cyan);
    }
  }

  .rcs-swatches {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
  }

  .rcs-base-btn {
    padding: 8px 18px;
    border-radius: var(--radius-md);
    border: 2px solid currentColor;
    background: var(--base);
    color: var(--bg-deep);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: scale var(--transition-fast), box-shadow var(--transition-fast);

    &:hover {
      scale: 1.05;
    }
  }

  .rcs-derived {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--bg-deep);
    transition: scale var(--transition-fast);

    &:hover {
      scale: 1.05;
    }
  }

  .ac-picker-wrap {
    margin-bottom: var(--space-md);

    & label {
      display: flex;
      align-items: center;
      gap: var(--space-sm);
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--text-secondary);
      cursor: pointer;
    }
  }

  .lp-accent {
    width: 4px;
    border-radius: 2px;
    background: var(--accent-cyan);
    min-height: 100%;
  }

  .lp-body {
    flex: 1;
  }

  .set-inputs {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    width: 100%;
  }

  .set-box {
    flex: 1;
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);

    & h3 {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--accent-cyan);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      margin-bottom: var(--space-xs);
    }

    & .set-items {
      font-size: 0.9rem;
      color: var(--text-secondary);
    }
  }

  .set-controls {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
    justify-content: center;
  }

  .set-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);

    &:hover,
    &.active {
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      background: color-mix(in oklch, var(--accent-cyan) 8%, transparent);
    }
  }

  .wc-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
  }

  .regex-controls {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
  }

  .regex-flag {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-lime);
    font-weight: 600;
  }

  .regex-test-string {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
  }

  .cv-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);

    &:last-child {
      border-bottom: none;
    }
  }

  .cv-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
  }

  .cv-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-cyan);
  }

  .snap-gallery {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: var(--space-sm);
    padding-bottom: var(--space-sm);
    scrollbar-width: thin;
    scrollbar-color: color-mix(in oklch, var(--accent-cyan) 30%, transparent) transparent;
  }

  .snap-item {
    flex: 0 0 min(300px, 80%);
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bg-deep);
    scroll-snap-align: center;
  }

  .dvh-visual {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
    height: 200px;
    margin-bottom: var(--space-md);
  }

  .dvh-bar {
    flex: 1;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bg-deep);
  }

  .dvh-lvh {
    background: var(--accent-violet);
    height: 100%;
  }

  .dvh-dvh {
    background: var(--accent-cyan);
    height: 85%;
  }

  .dvh-svh {
    background: var(--accent-magenta);
    height: 70%;
  }

  .bf-bg {
    position: relative;
    min-height: 250px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background:
      linear-gradient(135deg, var(--accent-violet), var(--accent-cyan), var(--accent-magenta));
    display: flex;
    gap: var(--space-md);
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    flex-wrap: wrap;
  }

  .bf-card {
    background: oklch(0.15 0.02 280 / 0.4);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid oklch(1 0 0 / 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    color: white;
    min-width: 200px;
    transition: translate var(--transition-fast);

    &:hover {
      translate: 0 -4px;
    }

    & h3 {
      font-size: 1rem;
      margin-bottom: var(--space-xs);
    }

    & p {
      font-size: 0.85rem;
      opacity: 0.85;
    }
  }

  .audio-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-top: var(--space-xs);
  }

  /* -----------------------------------------------------------------------
     Footer
     ----------------------------------------------------------------------- */

  .footer {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.9rem;

    & p {
      margin-bottom: var(--space-xs);
    }
  }

  .footer-features {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    justify-content: center;
    margin-top: var(--space-md);
  }

  .footer-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: border-color var(--transition-fast), color var(--transition-fast);

    &:hover {
      border-color: var(--border-glow);
      color: var(--text-primary);
    }
  }



  /* -----------------------------------------------------------------------
     Subgrid Demo
     ----------------------------------------------------------------------- */

  .subgrid-parent {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    grid-template-rows: repeat(3, auto);
    gap: var(--space-sm);
  }

  .subgrid-card {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    gap: var(--space-xs);
    transition: border-color var(--transition-fast);

    &:hover {
      border-color: var(--border-glow);
    }
  }

  .subgrid-card h3 {
    font-size: 1rem;
    font-weight: 600;
  }

  .subgrid-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
  }

  .subgrid-footer {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-lime);
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border-subtle);
    align-self: end;
  }

  /* -----------------------------------------------------------------------
     CSS Math (round/mod) Demo
     ----------------------------------------------------------------------- */

  .math-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
  }

  .math-cell {
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--bg-deep);
    font-weight: 600;
    min-width: 120px;
    transition: width 0.5s ease;
  }

  /* -----------------------------------------------------------------------
     Mesh Gradients Demo
     ----------------------------------------------------------------------- */

  .mesh-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-sm);
  }

  .mesh-swatch {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: oklch(0.95 0 0);
    text-shadow: 0 2px 8px oklch(0 0 0 / 0.5);
    transition: scale var(--transition-fast);

    &:hover {
      scale: 1.03;
    }
  }

  .mesh-1 {
    background:
      radial-gradient(ellipse 80% 60% at 20% 30%, oklch(0.5 0.3 290 / 0.8), transparent 60%),
      radial-gradient(ellipse 60% 80% at 80% 70%, oklch(0.6 0.25 195 / 0.7), transparent 55%),
      radial-gradient(ellipse 70% 50% at 50% 50%, oklch(0.4 0.2 140 / 0.6), transparent 50%),
      oklch(0.12 0.02 270);
  }

  .mesh-2 {
    background:
      radial-gradient(ellipse 70% 70% at 30% 20%, oklch(0.45 0.25 340 / 0.8), transparent 55%),
      radial-gradient(ellipse 60% 60% at 70% 80%, oklch(0.55 0.2 270 / 0.7), transparent 50%),
      radial-gradient(ellipse 80% 50% at 50% 50%, oklch(0.35 0.15 55 / 0.5), transparent 60%),
      oklch(0.1 0.03 300);
  }

  .mesh-3 {
    background:
      radial-gradient(ellipse 75% 65% at 25% 75%, oklch(0.6 0.25 55 / 0.8), transparent 55%),
      radial-gradient(ellipse 65% 75% at 75% 25%, oklch(0.5 0.3 340 / 0.7), transparent 50%),
      radial-gradient(ellipse 50% 80% at 50% 50%, oklch(0.55 0.2 25 / 0.6), transparent 60%),
      oklch(0.08 0.02 30);
  }

  /* -----------------------------------------------------------------------
     Paint API Demo
     ----------------------------------------------------------------------- */

  .paint-box {
    min-height: 200px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: var(--space-lg);
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    background:
      repeating-linear-gradient(
        0deg,
        transparent,
        transparent 19px,
        color-mix(in oklch, var(--accent-cyan) 8%, transparent) 19px,
        color-mix(in oklch, var(--accent-cyan) 8%, transparent) 20px
      ),
      repeating-linear-gradient(
        90deg,
        transparent,
        transparent 19px,
        color-mix(in oklch, var(--accent-violet) 8%, transparent) 19px,
        color-mix(in oklch, var(--accent-violet) 8%, transparent) 20px
      ),
      var(--bg-surface);
  }

  .paint-box.paint-active {
    background-image: paint(dotgrid);
  }

  .paint-fallback {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-orange);
    text-align: center;
    padding: var(--space-sm);
  }

  .paint-box p {
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    max-width: 40ch;
  }

  /* -----------------------------------------------------------------------
     Intersection Observer Demo
     ----------------------------------------------------------------------- */

  .io-target {
    width: 100%;
    height: 120px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--bg-deep);
    transition: opacity 0.3s ease, scale 0.3s ease;
  }

  .io-status {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: color 0.3s ease;
  }

  .io-target.visible {
    box-shadow: 0 0 30px color-mix(in oklch, var(--accent-cyan) 30%, transparent);
  }

  .io-log {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-top: var(--space-sm);
    max-height: 100px;
    overflow-y: auto;
  }

  /* -----------------------------------------------------------------------
     Clipboard API Demo
     ----------------------------------------------------------------------- */

  .clip-api-demo {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .clip-input {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    width: 100%;
    max-width: 400px;
    transition: border-color var(--transition-fast);

    &:focus {
      border-color: var(--accent-cyan);
      outline: none;
    }
  }

  .clip-buttons {
    display: flex;
    gap: var(--space-sm);
  }

  .clip-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
  }

  .clip-status.success {
    color: var(--accent-lime);
  }

  /* -----------------------------------------------------------------------
     Magnetic Buttons Demo
     ----------------------------------------------------------------------- */

  .magnet-demo {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: var(--space-xl) var(--space-md);
    min-height: 200px;
  }

  .magnet-btn {
    padding: 16px 36px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--accent-violet);
    background: color-mix(in oklch, var(--accent-violet) 10%, transparent);
    color: var(--accent-violet);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: translate 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, scale 0.2s ease;
    will-change: translate;

    &:hover {
      box-shadow: 0 0 30px color-mix(in oklch, var(--accent-violet) 25%, transparent);
      scale: 1.05;
    }
  }

  .magnet-cyan {
    border-color: var(--accent-cyan);
    background: color-mix(in oklch, var(--accent-cyan) 10%, transparent);
    color: var(--accent-cyan);

    &:hover {
      box-shadow: 0 0 30px color-mix(in oklch, var(--accent-cyan) 25%, transparent);
    }
  }

  .magnet-magenta {
    border-color: var(--accent-magenta);
    background: color-mix(in oklch, var(--accent-magenta) 10%, transparent);
    color: var(--accent-magenta);

    &:hover {
      box-shadow: 0 0 30px color-mix(in oklch, var(--accent-magenta) 25%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     Particle Trail Demo
     ----------------------------------------------------------------------- */

  .trail-area {
    position: relative;
    width: 100%;
    height: 300px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    background: var(--bg-surface);
    cursor: crosshair;
  }

  .trail-area canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .trail-hint {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    pointer-events: none;
  }

  /* -----------------------------------------------------------------------
     Sound on Scroll Demo
     ----------------------------------------------------------------------- */

  .sound-demo {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .sound-toggle.active {
    border-color: var(--accent-lime);
    color: var(--accent-lime);
    background: color-mix(in oklch, var(--accent-lime) 12%, transparent);
  }

  .sound-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  /* -----------------------------------------------------------------------
     Easter Egg Demo
     ----------------------------------------------------------------------- */

  .egg-keyboard {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: var(--space-sm);
  }

  .egg-keyboard kbd {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, scale 0.15s ease;
  }

  .egg-keyboard kbd.pressed {
    border-color: var(--accent-lime);
    color: var(--accent-lime);
    background: color-mix(in oklch, var(--accent-lime) 15%, transparent);
    scale: 1.15;
  }

  .egg-hint {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
  }

  /* Easter egg confetti overlay */
  .confetti-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99999;
  }

  .confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall 3s ease-out forwards;
  }

  @keyframes confetti-fall {
    0% {
      translate: 0 0;
      rotate: 0deg;
      opacity: 1;
    }
    100% {
      translate: var(--confetti-dx, 0) 100vh;
      rotate: 720deg;
      opacity: 0;
    }
  }

  /* -----------------------------------------------------------------------
     Page-Wide Theme Toggle (floating)
     ----------------------------------------------------------------------- */

  .page-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: color-mix(in oklch, var(--bg-elevated) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background var(--transition-fast), border-color var(--transition-fast), scale 0.2s ease, box-shadow 0.3s ease;

    &:hover {
      border-color: var(--accent-cyan);
      background: color-mix(in oklch, var(--accent-cyan) 12%, var(--bg-elevated));
      scale: 1.1;
      box-shadow: 0 0 20px color-mix(in oklch, var(--accent-cyan) 20%, transparent);
    }
  }

  /* -----------------------------------------------------------------------
     Rainbow Mode (Konami Easter Egg)
     ----------------------------------------------------------------------- */

  @keyframes rainbow-hue {
    to { filter: hue-rotate(360deg); }
  }

  .rainbow-mode {
    animation: rainbow-hue 2s linear infinite;
  }

  /* -----------------------------------------------------------------------
     Light Mode Overrides
     ----------------------------------------------------------------------- */

  :root.light-mode {
    --bg-deep: oklch(0.97 0.01 270);
    --bg-surface: oklch(0.94 0.01 270);
    --bg-elevated: oklch(0.91 0.02 270);
    --text-primary: oklch(0.15 0.02 270);
    --text-secondary: oklch(0.4 0.02 270);
    --border-subtle: oklch(0.82 0.02 270);
  }

  .light-mode .cursor-glow {
    background: radial-gradient(
      circle,
      color-mix(in oklch, var(--accent-violet) 4%, transparent),
      transparent 70%
    );
  }

  .light-mode .section-inner {
    background: color-mix(in oklch, var(--bg-surface) 90%, white);
  }

  .light-mode .code-block {
    background: oklch(0.96 0.005 270);
    border-color: oklch(0.88 0.02 270);
  }

  .bf-card-2 { translate: 0 20px; }
  .clip-ellipse { background: var(--accent-lime); clip-path: ellipse(0% 0%); }
  .clip-ellipse:hover { clip-path: ellipse(50% 50%); }
  .cq-container { container-type: inline-size; }
  .fancy-toggle { position: relative; display: inline-flex; align-items: center; gap: var(--space-sm); cursor: pointer; font-size: 0.85rem; font-family: var(--font-mono); }
  .fancy-toggle input { appearance: none; width: 48px; height: 26px; border-radius: 999px; background: var(--bg-deep); border: 1px solid var(--border-subtle); cursor: pointer; position: relative; transition: background 0.3s ease; }
  .fancy-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-cyan); transition: translate 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
  .fancy-toggle input:checked { background: var(--accent-violet); }
  .fancy-toggle input:checked::after { translate: 22px 0; }
  .ld-toggle { accent-color: var(--accent-violet); }
  .has-card { display: flex; align-items: center; gap: var(--space-sm); border: 1px solid var(--border-subtle); background: var(--bg-surface); border-radius: var(--radius-lg); padding: var(--space-md); cursor: pointer; transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease; }
  .has-card:has(input:checked) { border-color: var(--accent-violet); background: color-mix(in oklch, var(--accent-violet) 8%, var(--bg-surface)); box-shadow: 0 0 30px color-mix(in oklch, var(--accent-violet) 10%, transparent); }
  .has-check { accent-color: var(--accent-violet); width: 20px; height: 20px; cursor: pointer; }
  .has-label { font-weight: 500; }
  .has-status { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-secondary); padding: var(--space-sm); border-radius: var(--radius-sm); background: var(--bg-surface); transition: color 0.3s ease; }
  .has-demo:has(.has-card input:checked) .has-status { color: var(--accent-cyan); }
  .os-box { flex: 1; min-width: 250px; height: 200px; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-md); font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
  .os-box h3 { color: var(--text-primary); margin-bottom: var(--space-xs); }
  .pop-panel { text-align: left; }
  .pop-panel h3 { margin-bottom: var(--space-xs); }
  .pop-panel p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }
  .pop-warning { border-color: var(--accent-orange); }
  .pop-warning h3 { color: var(--accent-orange); }
  .pwr-bar-track { width: 100%; max-width: 400px; height: 12px; border-radius: 999px; background: var(--bg-surface); border: 1px solid var(--border-subtle); overflow: hidden; }
  .pwr-bar-track .pwr-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan)); width: 0%; transition: width 0.3s ease; }
  .pwr-status { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-secondary); }
  .spring-play-btn { margin-top: var(--space-sm); }
  .vt-back { padding: 8px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary); cursor: pointer; font-family: var(--font-display); font-size: 0.85rem; margin-bottom: var(--space-sm); transition: background var(--transition-fast), border-color var(--transition-fast); }
  .vt-back:hover { background: var(--surface-hover); border-color: var(--border-glow); }
  .vt-detail-content { padding: var(--space-lg); border-radius: var(--radius-md); min-height: 120px; display: grid; place-items: center; font-size: 1.2rem; font-weight: 600; }

} /* end @layer components */


/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@layer animations {

  /* --- Reveal Animations --- */

  @keyframes reveal-up {
    from {
      opacity: 0;
      translate: 0 60px;
      filter: blur(4px);
    }
    to {
      opacity: 1;
      translate: 0 0;
      filter: blur(0);
    }
  }

  @keyframes reveal-left {
    from {
      opacity: 0;
      translate: -60px 0;
      filter: blur(4px);
    }
    to {
      opacity: 1;
      translate: 0 0;
      filter: blur(0);
    }
  }

  @keyframes reveal-right {
    from {
      opacity: 0;
      translate: 60px 0;
      filter: blur(4px);
    }
    to {
      opacity: 1;
      translate: 0 0;
      filter: blur(0);
    }
  }

  @keyframes reveal-scale {
    from {
      opacity: 0;
      scale: 0.7;
      filter: blur(4px);
    }
    to {
      opacity: 1;
      scale: 1;
      filter: blur(0);
    }
  }

  /* --- Gradient & Motion --- */

  @keyframes gradient-spin {
    to {
      --gradient-angle: 360deg;
    }
  }

  @keyframes text-shimmer {
    to {
      background-position: 200% center;
    }
  }

  @keyframes mesh-shift {
    0% {
      translate: 0 0;
      rotate: 0deg;
    }
    33% {
      translate: 5% -3%;
      rotate: 1deg;
    }
    66% {
      translate: -3% 5%;
      rotate: -1deg;
    }
    100% {
      translate: 2% 2%;
      rotate: 0.5deg;
    }
  }

  @keyframes pulse {
    0%, 100% {
      opacity: 1;
      scale: 1;
    }
    50% {
      opacity: 0.5;
      scale: 1.5;
    }
  }

  @keyframes morph {
    0%   { --morph-radius: 30%; }
    25%  { --morph-radius: 55%; }
    50%  { --morph-radius: 70%; }
    75%  { --morph-radius: 40%; }
    100% { --morph-radius: 30%; }
  }

  @keyframes ticker-scroll {
    from {
      translate: 0 0;
    }
    to {
      translate: -50% 0;
    }
  }

  @keyframes float {
    0%, 100% {
      translate: 0 0;
    }
    50% {
      translate: 0 -12px;
    }
  }

  @keyframes bounce-down {
    0%, 100% {
      translate: -50% 0;
    }
    50% {
      translate: -50% 10px;
    }
  }

  @keyframes orbit {
    to {
      offset-distance: 100%;
    }
  }

  @keyframes bounce-ball {
    from {
      top: 0;
    }
    to {
      top: calc(100% - 40px);
    }
  }

  /* --- Individual Transform Demos --- */

  @keyframes it-move {
    0%, 100% {
      translate: 0 0;
    }
    50% {
      translate: 0 -40px;
    }
  }

  @keyframes it-spin {
    to {
      rotate: 360deg;
    }
  }

  @keyframes it-pulse {
    0%, 100% {
      scale: 1;
    }
    50% {
      scale: 1.4;
    }
  }

  /* --- Scroll-Driven Reveal Classes --- */

  .reveal {
    animation: reveal-up auto ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }

  .reveal-left {
    animation: reveal-left auto ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }

  .reveal-right {
    animation: reveal-right auto ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }

  .reveal-scale {
    animation: reveal-scale auto ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}


/* ==========================================================================
   UTILITIES
   ========================================================================== */

@layer utilities {

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

  .skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    translate: -50% 0;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: var(--accent-violet, #8b5cf6);
    color: #fff;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.2s ease;

    &:focus {
      top: 0;
    }
  }

  .text-gradient {
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(
      circle,
      color-mix(in oklch, var(--accent-violet) 8%, transparent),
      transparent 70%
    );
    pointer-events: none;
    translate: -50% -50%;
    z-index: 9998;
    transition: opacity 0.3s ease;
  }
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 640px) {
  .morph-demo {
    padding: var(--space-sm);
  }

  .morph-blob {
    width: 180px;
  }

  .card-grid,
  .feature-grid,
  .clip-grid,
  .palette,
  .rcs-palette,
  .ar-grid,
  .gb-result {
    grid-template-columns: 1fr;
  }

  .spring-demo,
  .it-demo {
    flex-direction: column;
  }

  .os-pair {
    flex-direction: column;
  }

  .set-inputs {
    flex-direction: column;
  }

  .tw-pair {
    grid-template-columns: 1fr;
  }

  .cm-pair {
    gap: var(--space-xs);
  }

  .snap-item {
    flex: 0 0 min(260px, 85%);
  }
}

/* ==========================================================================
   ACCESSIBILITY — Reduced Motion
   ========================================================================== */

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

  .scroll-progress {
    animation: none;
    scale: 1 1;
  }

  .ticker-track {
    animation: none;
  }

  .morph-blob {
    animation: none;
  }

  .orbit-dot {
    animation: none;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    animation: none;
    opacity: 1;
    translate: 0;
    scale: 1;
    filter: none;
  }
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
  body {
    background: white;
    color: black;
  }

  .scroll-progress,
  .toc,
  .toc-toggle,
  .cursor-glow,
  .scroll-hint,
  .audio-bars,
  .audio-btn,
  .morph-blob,
  .orbit-container,
  .canvas-container,
  .ticker {
    display: none !important;
  }

  .hero {
    min-height: auto;
    padding: 2rem;

    &::before,
    &::after {
      display: none;
    }
  }

  .hero h1 {
    background: none;
    -webkit-text-fill-color: black;
    color: black;
  }

  .card,
  .code-block,
  dialog,
  [popover] {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: white;
    border: 1px solid #ccc;
    color: black;
  }

  .section {
    content-visibility: visible;
    break-inside: avoid;
  }
}
