/* ==========================================================================
   BASE STYLES: Design Tokens, CSS Reset & Typography
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  --navy: #0B2A5B;
  --blue: #1F4FD8;
  --amber: #F59E0B;
  --bg: #ffffff;
  --bg-soft: #F3F5F9;
  --card-bg: #ffffff;
  --text: #4B5563;
  --line: #dbe1ec;
  --heading: #0B2A5B;

  --font-head: Archivo, 'Arial Black', sans-serif;
  --font-body: 'Public Sans', system-ui, sans-serif;

  --gutter: 5vw;
  --max: 1100px;

  color-scheme: light;
}

/* Explicit Light Mode Override */
:root[data-theme="light"] {
  --navy: #0B2A5B;
  --blue: #1F4FD8;
  --amber: #F59E0B;
  --bg: #ffffff;
  --bg-soft: #F3F5F9;
  --card-bg: #ffffff;
  --text: #4B5563;
  --line: #dbe1ec;
  --heading: #0B2A5B;

  color-scheme: light;
}

/* Explicit Dark Mode Override */
:root[data-theme="dark"] {
  --navy: #0B2A5B;
  --blue: #4d7cff;
  --amber: #F59E0B;
  --bg: #0b1322;
  --bg-soft: #101a2e;
  --card-bg: #111e36;
  --text: #c3ccdc;
  --line: #25334f;
  --heading: #e2ebff;

  color-scheme: dark;
}

/* System Dark Mode Preference Fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #0B2A5B;
    --blue: #4d7cff;
    --amber: #F59E0B;
    --bg: #0b1322;
    --bg-soft: #101a2e;
    --card-bg: #111e36;
    --text: #c3ccdc;
    --line: #25334f;
    --heading: #e2ebff;

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Global Reset & Box Sizing
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  font: 400 17px/1.65 var(--font-body);
  color: var(--text);
  background-color: var(--bg);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  color: var(--heading);
  line-height: 1.1;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(28px, 3.6vw, 42px);
}

h3 {
  font-size: 20px;
}

a {
  color: var(--blue);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --------------------------------------------------------------------------
   Accessibility & Focus
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  background: var(--amber);
  color: #1a1200;
  padding: 10px 16px;
  z-index: 50;
  text-decoration: none;
  font-weight: 700;
}

.skip:focus {
  left: 10px;
  top: 10px;
}

/* --------------------------------------------------------------------------
   Theme Switch Animations & Reduced Motion
   -------------------------------------------------------------------------- */
html.theme-transition,
html.theme-transition :not(.theme-toggle__icon),
html.theme-transition :not(.theme-toggle__icon)::before,
html.theme-transition :not(.theme-toggle__icon)::after {
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease !important;
  transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
