/* ============================================
   WAVLENTH — GLOBAL STYLES
   Loaded on every page. Page-specific styles
   live in their own file (e.g. index.css).
============================================ */

/* ---------- Fonts ---------- */
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

/* ---------- Design Tokens ---------- */
:root {
  /* Core surface colors */
  --bg: #1a1a1a;
  --card: #252525;
  --card-hover: #2c2c2c;
  --text: #ffffff;
  --muted: #a3a3a3;
  --border: rgba(255, 255, 255, 0.08);

  /* Section accents */
  /* Section accents — single source of truth for every
     page's accent color. Pages should reference these
     tokens directly rather than redefining a local variant. */
  --accent-dashboard: #d4af37;
  --accent-music: #2f80ed;
  --accent-ai: #ff3333;
  --accent-subjects: #f5f5f5; /* Subjects list page — neutral */
  --accent-focus: #c026d3;
  --accent-progress: #00674f;
  --accent-leaderboard: #e11d74;

  /* ── Subject group accent colours ──────────────────────────
     These are the identity colours for each curriculum group.
     Use these on subject/topic pages, not --accent-subjects.
     Do NOT make whole pages these colours — use them for
     headings, active tabs, buttons, progress bars, highlights. */
  --accent-sciences: #e11d74; /* Chemistry, Physics, Biology    */
  --accent-maths: #ff3333; /* Mathematics                    */
  --accent-languages: #c026d3; /* English, German, French, Spanish */
  --accent-business: #2f80ed; /* Business Studies, Economics    */
  --accent-computing: #00674f; /* Computer Science, ICT          */
  --accent-sst: #d4af37; /* Geography, History, Env. Mgmt, Global Perspectives */

  /* Primary accent (landing page uses gold — ties to Dashboard) */
  --accent-primary: var(--accent-dashboard);

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  --space-2xl: 96px;

  /* Responsive page gutter (matches portfolio's --padding) */
  --page-padding: clamp(1rem, 5vw, 2.5rem);

  /* Typography */
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "DM Sans", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  --fs-2xl: clamp(2.5rem, 5vw, 4.5rem);

  /* Radius + shadow */
  --radius: 12px;
  --radius-sm: 6px;
  --radius-full: 999px;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);

  /* Motion */
  --transition: 0.2s ease;
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Light theme override (toggled via theme.js) ---------- */
[data-theme="light"] {
  --bg: #f5f5f3;
  --card: #ffffff;
  --card-hover: #f0f0ee;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ---------- Base grid texture (site-wide, fixed) ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(163, 163, 163, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(163, 163, 163, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background var(--transition),
    color var(--transition);
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
textarea,
select {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* ---------- Typography defaults ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  /* Bebas Neue ships one weight */
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

p {
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ---------- Shared components ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-base);
  padding: 14px 28px;
  border-radius: var(--radius-full);
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.btn-primary {
  background: var(--accent-primary);
  color: #1a1a1a;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition:
    background var(--transition),
    transform var(--transition);
}

input,
textarea,
select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: var(--fs-base);
  transition: border-color var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ---------- Utilities ---------- */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

/* ---------- Accessibility: visible keyboard focus ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* ---------- Custom cursor ---------- */
@media (hover: hover) and (pointer: fine) {
  body:not(.admin-body) * {
    cursor: none;
  }

  .custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--accent-preferred, var(--accent-primary));
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition:
      width var(--transition),
      height var(--transition),
      border-color var(--transition);
    will-change: transform;
  }

  .custom-cursor::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text);
    transform: translate(-50%, -50%);
    transition: background var(--transition);
  }

  .custom-cursor.hover {
    width: 46px;
    height: 46px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
