/* ==========================================================================
   Dark theme
   Applies when <html> carries .world-dark (set by theme.js before first paint).
   Same markup, layout, type and components as the light theme: this file only
   re-colours the design tokens and swaps the hero's animation component (the
   crisp scrambling word and its akshara field become a matrix of tiny aksharas
   drawn inside the same word frame).
   ========================================================================== */

@layer theme {
  :root.world-dark {
    color-scheme: dark;

    /* Ground and surfaces (daylight -> ground, stone -> raised band, indigo -> ground) */
    --bg-daylight: #0B0B0D;
    --bg-stone: #111114;
    --bg-indigo: #0B0B0D;
    --bg-indigo-elev: #18181C;
    --bg-indigo-hover: #1F1F24;
    --brand-tile: #1F1F24;
    --brand-tile-stage: #1F1F24;

    /* Ink (muted stays above 7:1 on the ground) */
    --ink-light: #F2EFEA;
    --ink-light-muted: #A6A29C;
    --ink-indigo: #F2EFEA;
    --ink-indigo-muted: #A6A29C;

    /* Rules for structure; control borders keep 3:1 */
    --hairline-light: #232328;
    --hairline-indigo: #232328;
    --border-ctrl-light: #66666F;
    --border-ctrl-indigo: #66666F;

    /* One signal colour */
    --accent-light: #F46A35;
    --accent-light-hover: #FF8352;
    --accent-light-tint: rgba(244, 106, 53, 0.12);
    --accent-indigo: #F46A35;
    --accent-indigo-hover: #FF8352;

    --signal-err: #FF7B6B;
    --signal-err-tint: rgba(255, 123, 107, 0.12);
    --signal-faithful: #5FD4A9;
    --signal-faithful-tint: rgba(95, 212, 169, 0.12);
    --signal-flag: #F1B65B;
    --signal-flag-tint: rgba(241, 182, 91, 0.12);
  }
}

@layer base {
  html.world-dark {
    background-color: #0B0B0D;
    scrollbar-color: #36363D #0B0B0D;
  }

  .world-dark body {
    background-color: #0B0B0D;
  }

  .world-dark ::selection {
    background-color: #F46A35;
    color: #0B0B0D;
  }
}

@layer components {
  /* Theme switch shows the sun while dark */
  .world-dark .theme-toggle .icon-moon {
    display: none;
  }

  .world-dark .theme-toggle .icon-sun {
    display: block;
  }

  /* Hero animation component: the matrix replaces the crisp word and its field.
     The word keeps its line box (invisible) so the frame is exactly the light size. */
  .world-dark .glyph-field {
    display: none;
  }

  .world-dark .decode-word {
    visibility: hidden;
  }

  .world-dark .hero-matrix {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 900ms cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-mask-image: radial-gradient(ellipse 72% 96% at 50% 50%, #000 70%, transparent 100%);
    mask-image: radial-gradient(ellipse 72% 96% at 50% 50%, #000 70%, transparent 100%);
  }

  .world-dark .hero-matrix.is-ready {
    opacity: 1;
  }
}
