/* Aeoleaf · Design Tokens (North Star · Phase 1a)
 *
 * Loaded AFTER public/css/main.css so these declarations win via cascade.
 * We deliberately keep the legacy variable names used across main.css /
 * blog.css / works.css / editorial.css (--bg, --text, --accent, --surface,
 * --border, --text-muted, --secondary, --accent-secondary, --accent-tertiary,
 * --gradient-primary, --gradient-surface, --shadow-*) so the whole site
 * re-skins without a file-by-file rewrite.
 *
 * New tokens (prefixed to avoid collisions): --bg-elev-*, --accent-alt-*,
 * --focus-ring, --radius-card, --radius-pill, --ring-*, --motion-*.
 */

/* ===== Dark (default) ===== */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces — near-black → elevated panels. Matches Linear/Vercel dark base. */
  --bg:           #0A0A0B;
  --bg-elev-1:    #101012;
  --bg-elev-2:    #17171A;
  --surface:      #111113;
  --border:       #222227;
  --border-strong:#2E2E34;

  /* Text */
  --text:         #F5F5F7;
  --text-muted:   #A1A1AA;
  --text-subtle:  #71717A;
  --secondary:    #A1A1AA;

  /* Primary interaction — violet */
  --accent:           #7C5CFF;
  --accent-hover:     #9479FF;
  --accent-pressed:   #6443FF;
  --accent-soft:      rgba(124, 92, 255, 0.14);
  --accent-ring:      rgba(124, 92, 255, 0.45);

  /* Secondary accents — used to tint Bento cells */
  --accent-secondary: #49E3D0;  /* mint   */
  --accent-tertiary:  #FFB84D;  /* amber  */
  --accent-alt-rose:  #FF6B9D;  /* rose   */
  --accent-alt-sky:   #4DA8FF;  /* sky    */
  --accent-alt-lime:  #B8F26C;  /* lime   */

  /* Feedback */
  --success: #45D483;
  --warning: #FFB84D;
  --danger:  #FF5D73;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #7C5CFF 0%, #49E3D0 100%);
  --gradient-surface: linear-gradient(180deg, rgba(17,17,19,0) 0%, rgba(17,17,19,1) 100%);
  --gradient-aurora:  radial-gradient(60% 80% at 10% 0%, rgba(124,92,255,0.22) 0%, transparent 60%),
                      radial-gradient(60% 80% at 90% 20%, rgba(73,227,208,0.14) 0%, transparent 60%),
                      radial-gradient(60% 80% at 50% 100%, rgba(255,107,157,0.10) 0%, transparent 60%);

  /* Shadows — darker / tighter than light mode */
  --shadow-sm: 0 1px 0 rgba(255,255,255,0.04) inset,
               0 1px 2px rgba(0,0,0,0.45);
  --shadow-md: 0 1px 0 rgba(255,255,255,0.04) inset,
               0 6px 20px rgba(0,0,0,0.45);
  --shadow-lg: 0 1px 0 rgba(255,255,255,0.05) inset,
               0 20px 50px rgba(0,0,0,0.55);
  --shadow-xl: 0 40px 80px rgba(0,0,0,0.65);

  /* Focus ring (a11y) */
  --focus-ring: 0 0 0 3px var(--accent-ring);

  /* Typography */
  --font-sans:    'Inter', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', 'Noto Serif SC', Georgia, 'Songti SC', serif;
  --font-serif:   var(--font-display);
  --font-journal: 'Instrument Serif', 'Noto Serif SC', Georgia, 'Songti SC', serif;
  --font-mono:    'JetBrains Mono', 'Noto Sans Mono', 'Consolas', monospace;

  /* Radii */
  --radius:       10px;
  --radius-lg:    16px;
  --radius-card:  20px;
  --radius-pill:  999px;

  /* Motion */
  --ease-out:       cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-in:        cubic-bezier(0.5, 0, 1, 0.5);
  --ease-emphasis:  cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 420ms;
  --transition: var(--dur-2) var(--ease-out);

  /* Card re-points to new tokens used in main.css */
  --card-radius: var(--radius-card);
  --card-shadow: var(--shadow-md);
  --card-shadow-hover: var(--shadow-lg);
}

/* ===== Light ===== */
[data-theme="light"] {
  color-scheme: light;

  --bg:            #FAFAFA;
  --bg-elev-1:     #FFFFFF;
  --bg-elev-2:     #F4F4F5;
  --surface:       #FFFFFF;
  --border:        #E4E4E7;
  --border-strong: #D4D4D8;

  --text:          #09090B;
  --text-muted:    #52525B;
  --text-subtle:   #71717A;
  --secondary:     #52525B;

  --accent:           #6D4BFF;
  --accent-hover:     #5A38F0;
  --accent-pressed:   #4A27DA;
  --accent-soft:      rgba(109, 75, 255, 0.10);
  --accent-ring:      rgba(109, 75, 255, 0.35);

  --accent-secondary: #0BB89F;
  --accent-tertiary:  #E6962A;
  --accent-alt-rose:  #E64E83;
  --accent-alt-sky:   #2E8BE6;
  --accent-alt-lime:  #7FC92B;

  --success: #15A15A;
  --warning: #D08715;
  --danger:  #E03A55;

  --gradient-primary: linear-gradient(135deg, #6D4BFF 0%, #0BB89F 100%);
  --gradient-surface: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
  --gradient-aurora:  radial-gradient(60% 80% at 10% 0%, rgba(109,75,255,0.10) 0%, transparent 60%),
                      radial-gradient(60% 80% at 90% 20%, rgba(11,184,159,0.08) 0%, transparent 60%),
                      radial-gradient(60% 80% at 50% 100%, rgba(230,78,131,0.06) 0%, transparent 60%);

  --shadow-sm: 0 1px 2px rgba(15, 15, 20, 0.06);
  --shadow-md: 0 6px 16px rgba(15, 15, 20, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 15, 20, 0.12);
  --shadow-xl: 0 40px 80px rgba(15, 15, 20, 0.16);
}

/* ==========================================================================
 *  Re-skin legacy hardcoded backgrounds in main.css
 *  (these bypass the variable system and would otherwise look broken under
 *   the new palette). Each rule below patches exactly one hardcoded surface.
 * ========================================================================== */

body {
  background: var(--bg);
  color: var(--text);
}

/* Global ambient gradient — subtle, one layer, never on /admin. */
body:not(.admin-body):not(.admin-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--gradient-aurora);
  opacity: 0.9;
}

/* Fixed top nav glass */
.site-header,
[data-theme="dark"] .site-header,
[data-theme="light"] .site-header {
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.site-header.scrolled,
[data-theme="dark"] .site-header.scrolled,
[data-theme="light"] .site-header.scrolled {
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px -10px rgba(0,0,0,0.35);
}

/* Link default color */
a { color: var(--text); }
a:hover { color: var(--accent); }

/* Selection */
::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ==========================================================================
 *  Legacy gradient-text overrides
 *  main.css still ships the old "autumnal" baked-in gradients clipped onto
 *  text (hero accent word, homepage stat numbers). These rules win the
 *  cascade because tokens.css is loaded AFTER main.css and the selectors
 *  match 1:1. Do not remove unless the corresponding rules in main.css are
 *  also deleted.
 * ========================================================================== */

/* Hero accent word — now a single North Star violet wash.
   Italic kept: it anchors the brand break in the wordmark. */
.hero-title__accent,
[data-theme="dark"] .hero-title__accent,
[data-theme="light"] .hero-title__accent {
  background: linear-gradient(120deg,
    var(--accent) 0%,
    color-mix(in oklab, var(--accent) 70%, var(--accent-secondary)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-style: italic;
}

/* Homepage stat numbers — use the canonical primary gradient so dark & light
   both inherit from tokens instead of the baked-in dusty pink. */
.hp-stats__number,
[data-theme="dark"] .hp-stats__number,
[data-theme="light"] .hp-stats__number {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Respect reduced-motion everywhere */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
 *  Footer — flat Linear style, replaces editorial wave + gradient
 * ========================================================================== */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: var(--space-16);
  padding: var(--space-10) var(--space-4) var(--space-8);
}

.footer-wave { display: none; }

.footer-brand {
  font-family: var(--font-sans);
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}

.footer-brand__mark { display: none; }

.footer-tagline {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.82rem !important;
  color: var(--text-muted);
  line-height: 1.6 !important;
}

.footer-heading {
  font-size: 0.7rem !important;
  letter-spacing: 0.12em !important;
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

.footer-section a:hover { color: var(--text); }

.footer-bottom {
  border-top-color: var(--border);
  font-size: 0.75rem;
}

/* Back-to-top button */
#back-to-top {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

#back-to-top:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
