/* ==========================================================================
   WONDER WARRIORS FOR SUPER KIDS — DESIGN SYSTEM TOKENS (v2026)
   Aesthetic: Apple-Grade Futuristic Superhero (Liquid Glass + Tactile UI)
   Performance: Pure CSS variables, GPU-only motion, zero external overhead
   ========================================================================== */

:root {
  /* 1. Color Primitives — Locked to Exact Wonder Warriors Brand Hexes (Phase 1) */
  --ww-white:          #ffffff;
  --ww-alabaster:      #f6f8fc;
  --ww-pearl:          #edf1f8;
  --ww-silver:         #d5dce8;
  --ww-slate-400:      #6c7a91;
  --ww-slate-600:      #3b4659;
  --ww-obsidian-800:   #121b2e;
  --ww-obsidian-900:   #0a101f;
  --ww-obsidian-950:   #020915;  /* Locked Wonder Warriors Obsidian Hero BG */

  /* High-Voltage Superhero Accents (Locked Wonder Warriors Brand Hexes) */
  --ww-cyan-400:       #56d8ff;  /* Locked Wonder Warriors Hero Cyan */
  --ww-cyan-500:       #0057e1;  /* <-- BRAND ACCENT 1 (Locked Wonder Warriors Blue) */
  --ww-cyan-600:       #003a96;  /* Locked Wonder Warriors Blue Hover */

  --ww-crimson-400:    #ff3b57;
  --ww-crimson-500:    #bb062e;  /* <-- BRAND ACCENT 2 (Locked Wonder Warriors Crimson) */
  --ww-crimson-600:    #8b0000;  /* Locked Wonder Warriors Crimson Dark */

  --ww-gold-400:       #ffd147;
  --ww-gold-500:       #ffc342;  /* <-- BRAND ACCENT 3 (Locked Wonder Warriors Gold) */
  --ww-gold-600:       #d98b00;

  --ww-plasma-500:     #7b61ff;

  /* 2. Semantic Tokens — Light Mode Default ("Luminous Studio") */
  --bg-page:           var(--ww-alabaster);
  --bg-surface:        var(--ww-white);
  --bg-surface-soft:   var(--ww-pearl);
  --bg-accent-subtle:  rgba(86, 216, 255, 0.14);

  --text-primary:      var(--ww-obsidian-900);
  --text-secondary:    var(--ww-slate-600);
  --text-muted:        var(--ww-slate-400);
  --text-on-hero:      var(--ww-white);
  --text-on-bright:    var(--ww-obsidian-950);

  --border-hairline:   rgba(10, 16, 31, 0.09);
  --border-strong:     rgba(10, 16, 31, 0.18);

  --focus-ring-color:  var(--ww-cyan-400);
  --focus-ring:        0 0 0 3px var(--bg-page), 0 0 0 6px var(--focus-ring-color);

  /* 3. Apple Liquid Glass System */
  --glass-blur:        18px;
  --glass-saturate:    185%;
  --glass-bg:          rgba(255, 255, 255, 0.64);
  --glass-bg-elevated: rgba(255, 255, 255, 0.78);
  --glass-bg-fallback: rgba(255, 255, 255, 0.94);

  --glass-border:      rgba(255, 255, 255, 0.72);
  --glass-border-edge: rgba(10, 16, 31, 0.08);
  --glass-specular:    inset 0 1px 0 0 rgba(255, 255, 255, 0.92),
                       inset 0 -1px 0 0 rgba(10, 16, 31, 0.04);
  --glass-shadow:      0 12px 32px -8px rgba(10, 16, 31, 0.12),
                       0 2px 6px -1px rgba(10, 16, 31, 0.06);

  --grad-hero-aura:    radial-gradient(
                         circle at 20% 20%,
                         rgba(86, 216, 255, 0.24) 0%,
                         rgba(123, 97, 255, 0.14) 42%,
                         rgba(187, 6, 46, 0.1) 72%,
                         transparent 100%
                       );
  --grad-specular-rim: linear-gradient(
                         135deg,
                         rgba(255, 255, 255, 0.85) 0%,
                         rgba(86, 216, 255, 0.35) 50%,
                         rgba(255, 255, 255, 0.2) 100%
                       );

  /* 4. Light Skeuomorphism — Tactile Controls & Plush 3D Badges */
  --btn-primary-bg:    linear-gradient(180deg, #df1641 0%, var(--ww-crimson-500) 55%, var(--ww-crimson-600) 100%);
  --btn-primary-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.42),
    inset 0 -2px 3px rgba(70, 5, 16, 0.36),
    0 8px 20px -4px rgba(187, 6, 46, 0.48),
    0 2px 4px rgba(10, 16, 31, 0.18);
  --btn-primary-shadow-hover:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 3px rgba(70, 5, 16, 0.3),
    0 12px 26px -4px rgba(187, 6, 46, 0.58),
    0 4px 8px rgba(10, 16, 31, 0.22);
  --btn-primary-shadow-active:
    inset 0 2px 5px rgba(70, 5, 16, 0.48),
    0 2px 6px rgba(187, 6, 46, 0.34);

  --btn-tactile-bg:    linear-gradient(180deg, #ffffff 0%, #f1f5fb 100%);
  --btn-tactile-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 1),
    inset 0 -1.5px 2px rgba(10, 16, 31, 0.07),
    0 6px 16px -4px rgba(10, 16, 31, 0.12),
    0 1px 3px rgba(10, 16, 31, 0.08);
  --btn-tactile-shadow-active:
    inset 0 2px 4px rgba(10, 16, 31, 0.14),
    0 1px 2px rgba(10, 16, 31, 0.08);

  --plush-cyan-bg:     radial-gradient(circle at 30% 25%, #a8f4ff 0%, var(--ww-cyan-400) 52%, var(--ww-cyan-500) 100%);
  --plush-gold-bg:     radial-gradient(circle at 30% 25%, #fff2b2 0%, var(--ww-gold-500) 58%, var(--ww-gold-600) 100%);
  --plush-crimson-bg:  radial-gradient(circle at 30% 25%, #ff7a92 0%, var(--ww-crimson-500) 58%, var(--ww-crimson-600) 100%);
  --plush-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.55),
    inset 0 -4px 8px rgba(10, 16, 31, 0.24),
    0 10px 20px -6px rgba(10, 16, 31, 0.28);

  /* 5. Fluid Expressive Apple Typography (San Francisco System Stack) */
  --font-display:      -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
  --font-sans:         -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono:         'SF Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;

  --text-xs:           clamp(0.75rem,  0.72rem + 0.15vw, 0.85rem);
  --text-sm:           clamp(0.875rem, 0.84rem + 0.18vw, 0.975rem);
  --text-base:         clamp(1rem,     0.96rem + 0.22vw, 1.125rem);
  --text-lg:           clamp(1.15rem,  1.08rem + 0.35vw, 1.375rem);
  --text-xl:           clamp(1.4rem,   1.22rem + 0.85vw, 1.95rem);
  --text-2xl:          clamp(1.85rem,  1.45rem + 1.9vw,  3rem);
  --text-3xl:          clamp(2.35rem,  1.7rem  + 3.1vw,  4.25rem);
  --text-hero:         clamp(2.85rem,  1.85rem + 4.8vw,  5.5rem);

  --leading-tight:     1.02;
  --leading-snug:      1.18;
  --leading-body:      1.62;
  --tracking-hero:     -0.025em;
  --tracking-display:  -0.015em;
  --tracking-caps:     0.09em;

  /* 6. Spatial Grid, Radii, Ergonomics & Motion */
  --space-1:           0.25rem;
  --space-2:           0.5rem;
  --space-3:           0.75rem;
  --space-4:           1rem;
  --space-5:           1.5rem;
  --space-6:           2rem;
  --space-7:           3rem;
  --space-8:           clamp(3.5rem, 2.5rem + 4.5vw, 6.25rem);

  --container-max:     1240px;
  --container-narrow:  780px;
  --gutter:            clamp(1rem, 0.5rem + 2.5vw, 2.5rem);

  --radius-sm:         12px;
  --radius-md:         20px;
  --radius-lg:         28px;
  --radius-xl:         36px;
  --radius-pill:       9999px;
  --tap-min:           44px;

  --ease-apple:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:       cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:          160ms;
  --dur-base:          280ms;
  --dur-slow:          520ms;

  --z-base:            1;
  --z-scribble:        5;
  --z-card-lift:       10;
  --z-nav:             100;
  --z-modal:           200;
}

/* Command-Center Dark Band ("Obsidian Superhero HQ") */
[data-theme="command"],
.theme-command {
  --bg-page:           var(--ww-obsidian-950);
  --bg-surface:        var(--ww-obsidian-900);
  --bg-surface-soft:   var(--ww-obsidian-800);
  --bg-accent-subtle:  rgba(86, 216, 255, 0.14);

  --text-primary:      #f8fbff;
  --text-secondary:    #c5d4ea;
  --text-muted:        #8ba0c0;

  --border-hairline:   rgba(255, 255, 255, 0.14);
  --border-strong:     rgba(255, 255, 255, 0.26);

  --glass-bg:          rgba(10, 22, 46, 0.62);
  --glass-bg-elevated: rgba(16, 32, 64, 0.78);
  --glass-bg-fallback: rgba(10, 22, 46, 0.94);
  --glass-border:      rgba(255, 255, 255, 0.2);
  --glass-border-edge: rgba(86, 216, 255, 0.22);
  --glass-specular:    inset 0 1px 0 0 rgba(255, 255, 255, 0.32),
                       inset 0 -1px 0 0 rgba(0, 0, 0, 0.38);
  --glass-shadow:      0 18px 42px -10px rgba(0, 0, 0, 0.58),
                       0 0 26px -6px rgba(86, 216, 255, 0.16);

  --btn-tactile-bg:    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.07) 100%);
  --btn-tactile-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1.5px 2px rgba(0, 0, 0, 0.45),
    0 8px 20px -6px rgba(0, 0, 0, 0.52);
  --btn-tactile-shadow-active:
    inset 0 2px 5px rgba(0, 0, 0, 0.55),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

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

.container {
  width: min(100% - (var(--gutter) * 2), var(--container-max));
  margin-inline: auto;
}

/* Liquid Glass Panel */
.glass-panel {
  background: var(--glass-bg-fallback);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-specular), var(--glass-shadow);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .glass-panel {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

/* Tactile Launch Buttons */
.btn-tactile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0.78rem 1.65rem;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  color: var(--text-primary);
  background: var(--btn-tactile-bg);
  box-shadow: var(--btn-tactile-shadow);
  transition: transform var(--dur-fast) var(--ease-apple),
              box-shadow var(--dur-fast) var(--ease-apple);
  will-change: transform;
}

.btn-tactile:hover { transform: translateY(-2px); }
.btn-tactile:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: var(--btn-tactile-shadow-active);
}
.btn-tactile:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--btn-tactile-shadow);
}

.btn-tactile--hero {
  color: var(--text-on-hero);
  border-color: rgba(255, 195, 66, 0.72);
  background: var(--btn-primary-bg);
  box-shadow: var(--btn-primary-shadow);
}
.btn-tactile--hero:hover {
  color: var(--text-on-hero);
  box-shadow: var(--btn-primary-shadow-hover);
}
.btn-tactile--hero:active { box-shadow: var(--btn-primary-shadow-active); }

/* Plush 3D Badges */
.badge-plush {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--plush-cyan-bg);
  color: var(--text-on-bright);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: var(--plush-shadow);
  transition: transform var(--dur-base) var(--ease-spring);
}
.badge-plush--gold    { background: var(--plush-gold-bg); color: var(--ww-obsidian-950); }
.badge-plush--crimson { background: var(--plush-crimson-bg); color: var(--text-on-hero); }
.badge-plush:hover    { transform: translateY(-3px) rotate(-3deg) scale(1.05); }

/* Expressive Display Headline */
.display-hero {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-hero);
  font-weight: 700;
  text-wrap: balance;
  margin: 0;
}

.display-section {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-display);
  font-weight: 700;
  text-wrap: balance;
  margin: 0;
}

/* Inline SVG Scribble Layering */
.scribble-wrap { position: relative; display: inline-block; isolation: isolate; }
.scribble {
  position: absolute;
  pointer-events: none;
  z-index: var(--z-scribble);
  overflow: visible;
  color: var(--ww-gold-400);
}
.scribble--cyan    { color: var(--ww-cyan-400); }
.scribble--crimson { color: var(--ww-crimson-400); }
.scribble--gold    { color: var(--ww-gold-400); }
.scribble--underline {
  left: -2%;
  bottom: -0.18em;
  width: 104%;
  height: 0.34em;
  z-index: -1;
}
.scribble--burst  { top: -0.45em; right: -0.55em; transform: rotate(12deg); }
.scribble--bolt   { top: -0.35em; left: -0.55em;  transform: rotate(-14deg); }
.scribble--star   { top: -0.4em;  right: -0.45em; transform: rotate(8deg); }
.scribble--shield { top: -0.3em;  right: -0.6em;  transform: rotate(10deg); }
.scribble--arrow  { bottom: -0.5em; left: -1.1em; transform: rotate(-6deg); }

.scribble-wrap:hover .scribble:not(.scribble--underline) {
  transform: scale(1.1) rotate(0deg);
  transition: transform var(--dur-base) var(--ease-spring);
}

/* Accessibility & Performance Safeguards */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0.01ms; --dur-base: 0.01ms; --dur-slow: 0.01ms; }
  .btn-tactile:hover, .btn-tactile:active, .badge-plush:hover, .scribble-wrap:hover .scribble {
    transform: none;
    transition: none;
  }
}

@media (prefers-contrast: more) {
  :root, [data-theme="command"], .theme-command {
    --glass-bg: var(--glass-bg-fallback);
    --border-hairline: var(--border-strong);
  }
}
