/* ==========================================================================
   FILE: css/token.css
   12 Palette Colors + 6 Type Sizes + 8pt Spacing + Semantic Tokens
   ========================================================================== */
:root {
  /* 1. Surfaces (4 colors) */
  --p-slate-50:    #F8FAFC; /* 01. Light Canvas & Dark Headline */
  --p-white:       #FFFFFF; /* 02. Light Surface / Elevated Card */
  --p-navy-950:    #090D16; /* 03. Dark Canvas */
  --p-navy-900:    #131B2E; /* 04. Dark Surface / Elevated Card */

  /* 2. Neutrals (4 colors) */
  --p-slate-900:   #0F172A; /* 05. Primary Dark Ink */
  --p-slate-600:   #475569; /* 06. Light Subtext */
  --p-slate-400:   #94A3B8; /* 07. Dark Subtext */
  --p-slate-200:   #E2E8F0; /* 08. Hairline Border */

  /* 3. Brand & Accents (4 colors) */
  --p-blue-600:    #2563EB; /* 09. Brand Blue (Light Mode) */
  --p-blue-400:    #60A5FA; /* 10. Brand Sky Blue (Dark Mode) */
  --p-orange-500:  #F97316; /* 11. Primary Orange */
  --p-coral-500:   #FF3B5C; /* 12. Point Coral */

  /* 4. Typography (2 Fonts + Strict 6-step scale) */
  --font-head: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;

  --fs-hero-impact: 5rem;     /* 80px */
  --fs-hero:        3rem;     /* 48px */
  --fs-title:       2rem;     /* 32px */
  --fs-sub:         1.25rem;  /* 20px */
  --fs-body:        1rem;     /* 16px */
  --fs-micro:       0.875rem; /* 14px */

  /* 5. 8pt Spacing System (--sN = N x 8px) */
  --s1:  8px;
  --s2:  16px;
  --s3:  24px;
  --s4:  32px;
  --s5:  40px;
  --s6:  48px;
  --s7:  56px;
  --s8:  64px;
  --s9:  72px;
  --s11: 88px;
  --s12: 96px;
  --s14: 112px;

  /* 6. Motion */
  --ez-out:   cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;

  /* 7. SEMANTIC TOKENS (Light Mode Default) */
  color-scheme: light;

  /* Backgrounds & Surfaces */
  --bg-canvas:        var(--p-slate-50);
  --bg-surface:       var(--p-white);
  --bg-subtle:        color-mix(in srgb, var(--p-slate-200) 65%, var(--p-slate-50));
  --bg-inverse:       var(--p-navy-950);
  --bg-tint-primary:  color-mix(in srgb, var(--accent-primary) 12%, transparent);

  /* Fixed Dark Feature Surfaces (Podcast / Primary Course / Showcase Cards) */
  --bg-feature-dark:  var(--p-navy-950);
  --bg-feature-mid:   var(--p-navy-900);
  --bg-feature-glow:  var(--p-blue-600);
  --text-on-feature:  var(--p-white);
  --text-on-feature-muted: var(--p-slate-400);
  --text-on-accent:   var(--p-white);

  /* Typography / Ink Roles */
  --text-primary:     var(--p-slate-900);
  --text-secondary:   var(--p-slate-600);
  --text-inverse:     var(--p-slate-50);

  /* Borders & Dividers */
  --border-subtle:    var(--p-slate-200);
  --border-strong:    var(--p-slate-400);

  /* Interactive & Accent Roles */
  --accent-primary:   var(--p-blue-600);
  --accent-secondary: var(--p-orange-500);
  --accent-highlight: var(--p-coral-500);

  /* Semantic Spacing & Layout Aliases */
  --space-section-y:  var(--s12);
  --space-card-pad:   var(--s3);
  --space-stack-gap:  var(--s2);
  --header-h:         49px;

  /* Short Aliases (Synchronized with Semantic Tokens) */
  --bg:  var(--bg-canvas);
  --sf:  var(--bg-surface);
  --so:  var(--bg-tint-primary);
  --ink: var(--text-primary);
  --mu:  var(--text-secondary);
  --ln:  var(--border-subtle);
  --bl:  var(--accent-primary);
  --co:  var(--accent-secondary);
  --cr:  var(--accent-highlight);
}

/* 1. Desktop Only (761px+): Dark Mode Allowed */
@media (min-width: 761px) {
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;

      --bg-canvas:        var(--p-navy-950);
      --bg-surface:       var(--p-navy-900);
      --bg-subtle:        color-mix(in srgb, var(--p-slate-400) 14%, var(--p-navy-900));
      --bg-inverse:       var(--p-slate-50);

      --text-primary:     var(--p-slate-50);
      --text-secondary:   var(--p-slate-400);
      --text-inverse:     var(--p-slate-900);

      --border-subtle:    color-mix(in srgb, var(--p-slate-400) 20%, transparent);
      --border-strong:    var(--p-slate-600);

      --accent-primary:   var(--p-blue-400);
      --bg-tint-primary:  color-mix(in srgb, var(--p-blue-400) 16%, transparent);

      --bg:  var(--bg-canvas);
      --sf:  var(--bg-surface);
      --so:  var(--bg-tint-primary);
      --ink: var(--text-primary);
      --mu:  var(--text-secondary);
      --ln:  var(--border-subtle);
      --bl:  var(--accent-primary);
    }
  }

  :root[data-theme="dark"] {
    color-scheme: dark;

    --bg-canvas:        var(--p-navy-950);
    --bg-surface:       var(--p-navy-900);
    --bg-subtle:        color-mix(in srgb, var(--p-slate-400) 14%, var(--p-navy-900));
    --bg-inverse:       var(--p-slate-50);

    --text-primary:     var(--p-slate-50);
    --text-secondary:   var(--p-slate-400);
    --text-inverse:     var(--p-slate-900);

    --border-subtle:    color-mix(in srgb, var(--p-slate-400) 20%, transparent);
    --border-strong:    var(--p-slate-600);

    --accent-primary:   var(--p-blue-400);
    --bg-tint-primary:  color-mix(in srgb, var(--p-blue-400) 16%, transparent);

    --bg:  var(--bg-canvas);
    --sf:  var(--bg-surface);
    --so:  var(--bg-tint-primary);
    --ink: var(--text-primary);
    --mu:  var(--text-secondary);
    --ln:  var(--border-subtle);
    --bl:  var(--accent-primary);
  }
}

/* 2. Immersive Dark Page (.join-page): Always Dark via Official Palette Tokens */
.join-page {
  color-scheme: dark;

  --bg-canvas:        var(--p-navy-950);
  --bg-surface:       var(--p-navy-900);
  --bg-subtle:        color-mix(in srgb, var(--p-slate-400) 14%, var(--p-navy-900));
  --bg-inverse:       var(--p-slate-50);

  --text-primary:     var(--p-slate-50);
  --text-secondary:   var(--p-slate-400);
  --text-inverse:     var(--p-slate-900);

  --border-subtle:    color-mix(in srgb, var(--p-slate-400) 20%, transparent);
  --border-strong:    var(--p-slate-600);

  --accent-primary:   var(--p-blue-400);
  --bg-tint-primary:  color-mix(in srgb, var(--p-blue-400) 16%, transparent);

  --bg:  var(--bg-canvas);
  --sf:  var(--bg-surface);
  --so:  var(--bg-tint-primary);
  --ink: var(--text-primary);
  --mu:  var(--text-secondary);
  --ln:  var(--border-subtle);
  --bl:  var(--accent-primary);
}

/* 3. Mobile (760px and below) */
@media (max-width: 760px) {
  :root {
    --header-h:        0px;
    --space-section-y: var(--s8);
    --space-card-pad:  var(--s2);
  }
}