/* ============================================================
   CSS Custom Properties (Theme Variables) — Cyberpunk
   ============================================================ */

:root,
[data-theme="dark"] {
  /* ---- Base Colors ---- */
  --color-bg-primary: #080510;
  --color-bg-secondary: #0d0a1a;
  --color-bg-card: #120d24;
  --color-bg-card-hover: #1a1233;
  --color-bg-elevated: #1f1540;
  --color-bg-overlay: rgba(8, 5, 16, 0.85);

  /* ---- Text Colors ---- */
  --color-text-primary: #f0eaff;
  --color-text-secondary: #9d8fc0;
  --color-text-muted: #6b5b8a;
  --color-text-inverse: #080510;

  /* ---- Accent Colors ---- */
  --color-accent-cyan: #00fff0;
  --color-accent-cyan-dim: rgba(0, 255, 240, 0.12);
  --color-accent-pink: #ff00aa;
  --color-accent-pink-dim: rgba(255, 0, 170, 0.12);
  --color-accent-neon-green: #bfff00;
  --color-accent-purple: #a855f7;

  /* ---- Gradients ---- */
  --gradient-hero: linear-gradient(135deg, #080510 0%, #120d24 50%, #0d0a1a 100%);
  --gradient-accent: linear-gradient(135deg, #00fff0, #ff00aa);
  --gradient-accent-hover: linear-gradient(135deg, #22ffee, #ff33bb);
  --gradient-card: linear-gradient(145deg, rgba(18, 13, 36, 0.95), rgba(31, 21, 64, 0.95));
  --gradient-glow: linear-gradient(135deg, rgba(0, 255, 240, 0.3), rgba(255, 0, 170, 0.3));

  /* ---- Border ---- */
  --color-border: rgba(0, 255, 240, 0.12);
  --color-border-hover: rgba(0, 255, 240, 0.35);
  --color-border-card: rgba(255, 0, 170, 0.1);

  /* ---- Shadows ---- */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(0, 255, 240, 0.2), 0 0 50px rgba(0, 255, 240, 0.1);
  --shadow-glow-pink: 0 0 25px rgba(255, 0, 170, 0.2), 0 0 50px rgba(255, 0, 170, 0.1);

  /* ---- Neon Glow Effects ---- */
  --neon-glow-cyan: 0 0 10px #00fff0, 0 0 20px rgba(0, 255, 240, 0.5), 0 0 40px rgba(0, 255, 240, 0.2);
  --neon-glow-pink: 0 0 10px #ff00aa, 0 0 20px rgba(255, 0, 170, 0.5), 0 0 40px rgba(255, 0, 170, 0.2);
  --glitch-color-1: #ff00aa;
  --glitch-color-2: #00fff0;

  /* ---- Grid Pattern ---- */
  --grid-color: rgba(0, 255, 240, 0.05);
  --grid-size: 40px;

  /* ---- Typography ---- */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 2rem;      /* 32px */
  --font-size-4xl: 2.5rem;    /* 40px */
  --font-size-5xl: 3.5rem;    /* 56px */
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* ---- Spacing ---- */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* ---- Border Radius ---- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* ---- Transitions ---- */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-spring: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ---- Z-Index ---- */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-navbar: 1000;
  --z-overlay: 1500;
  --z-modal: 2000;

  /* ---- Navbar ---- */
  --navbar-height: 70px;
  --navbar-bg: rgba(8, 5, 16, 0.9);
  --navbar-border: rgba(0, 255, 240, 0.1);
  --navbar-blur: 20px;
}

/* ============================================================
   Light Theme Overrides
   ============================================================ */
[data-theme="light"] {
  --color-bg-primary: #f0ecf5;
  --color-bg-secondary: #e4dff0;
  --color-bg-card: #ffffff;
  --color-bg-card-hover: #faf8fc;
  --color-bg-elevated: #ffffff;
  --color-bg-overlay: rgba(240, 236, 245, 0.9);

  --color-text-primary: #1a0a2e;
  --color-text-secondary: #5a4a7a;
  --color-text-muted: #7a6b9a;
  --color-text-inverse: #f8fafc;

  --color-accent-cyan: #0891b2;
  --color-accent-cyan-dim: rgba(8, 145, 178, 0.08);
  --color-accent-pink: #d946ef;
  --color-accent-pink-dim: rgba(217, 70, 239, 0.08);
  --color-accent-neon-green: #65a30d;
  --color-accent-purple: #7c3aed;

  --gradient-hero: linear-gradient(135deg, #f0ecf5 0%, #e4dff0 100%);
  --gradient-accent: linear-gradient(135deg, #0891b2, #d946ef);
  --gradient-accent-hover: linear-gradient(135deg, #0ea5c4, #e555f0);
  --gradient-card: linear-gradient(145deg, #ffffff, #faf8fc);
  --gradient-glow: linear-gradient(135deg, rgba(8, 145, 178, 0.2), rgba(217, 70, 239, 0.2));

  --color-border: rgba(8, 145, 178, 0.12);
  --color-border-hover: rgba(8, 145, 178, 0.3);
  --color-border-card: rgba(217, 70, 239, 0.08);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 25px rgba(8, 145, 178, 0.15), 0 0 50px rgba(8, 145, 178, 0.05);
  --shadow-glow-pink: 0 0 25px rgba(217, 70, 239, 0.15), 0 0 50px rgba(217, 70, 239, 0.05);

  --neon-glow-cyan: 0 0 8px #0891b2, 0 0 16px rgba(8, 145, 178, 0.4);
  --neon-glow-pink: 0 0 8px #d946ef, 0 0 16px rgba(217, 70, 239, 0.4);
  --glitch-color-1: #d946ef;
  --glitch-color-2: #0891b2;

  --grid-color: rgba(8, 145, 178, 0.04);
  --grid-size: 40px;

  --navbar-bg: rgba(240, 236, 245, 0.9);
  --navbar-border: rgba(8, 145, 178, 0.08);
}

/* ============================================================
   Pure CSS Fallback: 当 JS 未设置 data-theme 时，
   通过 prefers-color-scheme media query 直接选择颜色。
   兼容 IE11 等旧浏览器（忽略此块）以及 JS 禁用场景。
   ============================================================ */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg-primary: #f0ecf5;
    --color-bg-secondary: #e4dff0;
    --color-bg-card: #ffffff;
    --color-bg-card-hover: #faf8fc;
    --color-bg-elevated: #ffffff;
    --color-bg-overlay: rgba(240, 236, 245, 0.9);

    --color-text-primary: #1a0a2e;
    --color-text-secondary: #5a4a7a;
    --color-text-muted: #7a6b9a;
    --color-text-inverse: #f8fafc;

    --color-accent-cyan: #0891b2;
    --color-accent-cyan-dim: rgba(8, 145, 178, 0.08);
    --color-accent-pink: #d946ef;
    --color-accent-pink-dim: rgba(217, 70, 239, 0.08);
    --color-accent-neon-green: #65a30d;
    --color-accent-purple: #7c3aed;

    --gradient-hero: linear-gradient(135deg, #f0ecf5 0%, #e4dff0 100%);
    --gradient-accent: linear-gradient(135deg, #0891b2, #d946ef);
    --gradient-accent-hover: linear-gradient(135deg, #0ea5c4, #e555f0);
    --gradient-card: linear-gradient(145deg, #ffffff, #faf8fc);
    --gradient-glow: linear-gradient(135deg, rgba(8, 145, 178, 0.2), rgba(217, 70, 239, 0.2));

    --color-border: rgba(8, 145, 178, 0.12);
    --color-border-hover: rgba(8, 145, 178, 0.3);
    --color-border-card: rgba(217, 70, 239, 0.08);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 25px rgba(8, 145, 178, 0.15), 0 0 50px rgba(8, 145, 178, 0.05);
    --shadow-glow-pink: 0 0 25px rgba(217, 70, 239, 0.15), 0 0 50px rgba(217, 70, 239, 0.05);

    --neon-glow-cyan: 0 0 8px #0891b2, 0 0 16px rgba(8, 145, 178, 0.4);
    --neon-glow-pink: 0 0 8px #d946ef, 0 0 16px rgba(217, 70, 239, 0.4);
    --glitch-color-1: #d946ef;
    --glitch-color-2: #0891b2;

    --grid-color: rgba(8, 145, 178, 0.04);
    --grid-size: 40px;

    --navbar-bg: rgba(240, 236, 245, 0.9);
    --navbar-border: rgba(8, 145, 178, 0.08);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    /* 与 [data-theme="dark"] 定义相同，避免重复列出，
       利用 :root 已在顶部定义 dark 值，此处留空即可，
       CSS 会自然继承 :root 中的定义。 */
  }
}
