/* ============================================
   FREEDOMIA - BASE / DESIGN TOKENS
   Style: freedomia.ch (Violet #7C5CFC + Lime #B8E600)
   Fonts: Montserrat + DM Sans
   Dark/Light mode support
   ============================================ */

/* ============================================
   1. CSS RESET
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 100px;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

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

ul, ol {
  list-style: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* ============================================
   2. DESIGN TOKENS - LIGHT MODE (DEFAULT)
   ============================================ */
:root {
  /* Primary - Violet */
  --color-primary: #7C5CFC;
  --color-primary-light: #9B82FD;
  --color-primary-dark: #6344E0;
  --color-primary-glow: rgba(124, 92, 252, 0.25);
  --color-primary-subtle: rgba(124, 92, 252, 0.08);

  /* Accent - Lime */
  --color-accent: #B8E600;
  --color-accent-dark: #9CC200;
  --color-accent-glow: rgba(184, 230, 0, 0.3);

  /* Semantic */
  --color-success: #1B8F5A;
  --color-danger: #C93B3B;

  /* Text */
  --color-ink: #0A0A0A;
  --color-ink-secondary: #374151;
  --color-ink-muted: #6B7280;

  /* Surfaces */
  --color-surface: #FFFFFF;
  --color-surface-alt: #FAFAFC;
  --color-surface-warm: #FDFBF7;
  --color-surface-elevated: #FFFFFF;

  /* Borders */
  --color-border: #9199A3;
  --color-border-light: #B0B5BF;

  /* Header */
  --color-header-bg: rgba(255, 255, 255, 0.95);
  --color-header-bg-scroll: rgba(255, 255, 255, 0.98);

  /* Footer */
  --color-footer-bg: #050A30;
  --color-footer-text: #FFFFFF;

  /* Dark section */
  --color-dark-bg: #050A30;
  --color-dark-text: #FFFFFF;
  --color-dark-muted: rgba(255, 255, 255, 0.7);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --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 12px 40px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

  /* Typography */
  --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 900;

  --text-xs: clamp(0.75rem, 0.7rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.84rem + 0.2vw, 1rem);
  --text-lg: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-xl: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --text-2xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-3xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --text-4xl: clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem);
  --text-5xl: clamp(2.25rem, 1.75rem + 2vw, 3.5rem);
  --text-6xl: clamp(2.75rem, 2rem + 2.5vw, 4rem);

  /* Spacing (8px grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  --section-py: clamp(4rem, 3rem + 3vw, 6rem);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 100px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 500ms;

  /* Z-index */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-header: 99999;
}

/* ============================================
   3. DARK MODE TOKENS
   ============================================ */
[data-theme="dark"] {
  --color-ink: #F9FAFB;
  --color-ink-secondary: #D1D5DB;
  --color-ink-muted: #6B7280;

  --color-surface: #0B0F1A;
  --color-surface-alt: #111827;
  --color-surface-warm: #131B2E;
  --color-surface-elevated: #1F2937;

  --color-border: #1F2937;
  --color-border-light: #1a2235;

  --color-header-bg: rgba(11, 15, 26, 0.92);
  --color-header-bg-scroll: rgba(11, 15, 26, 0.98);

  --color-primary-subtle: rgba(124, 92, 252, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ============================================
   4. BASE TYPOGRAPHY
   ============================================ */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  color: var(--color-ink);
  background-color: var(--color-surface);
  transition: background-color var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: 1.15;
  color: var(--color-ink);
}

h1 { font-size: var(--text-5xl); font-weight: var(--fw-black); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  color: var(--color-ink-secondary);
  line-height: 1.7;
}

strong { font-weight: var(--fw-semibold); }

::selection {
  background: var(--color-primary);
  color: #FFFFFF;
}

/* ============================================
   5. CONTAINER & LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1600px;
  padding: 0 var(--space-6);
}

@media (min-width: 1200px) {
  .container--wide { padding: 0 48px; }
}
@media (min-width: 1400px) {
  .container--wide { padding: 0 64px; }
}

.section {
  padding: var(--section-py) 0;
  position: relative;
  overflow: hidden;
}

.section--alt {
  background-color: var(--color-surface-alt);
  box-shadow: 0 -1px 0 0 var(--color-surface-alt);
}

.section--warm {
  background-color: var(--color-surface-warm);
  box-shadow: 0 -1px 0 0 var(--color-surface-warm);
}

.section--dark {
  background-color: var(--color-dark-bg);
  color: var(--color-dark-text);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-dark-text);
}

.section--dark p {
  color: var(--color-dark-muted);
}

.section__header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto var(--space-16);
}

.section__overline {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.section--dark .section__overline,
.section__overline--gold {
  color: var(--color-accent);
}

.section__title {
  margin-bottom: var(--space-4);
}

.section__subtitle {
  font-size: var(--text-lg);
  color: var(--color-ink-secondary);
  max-width: 560px;
  margin: 0 auto;
}

.section--dark .section__subtitle {
  color: var(--color-dark-muted);
}

/* ============================================
   6. SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out),
              transform 0.8s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.6s var(--ease-out),
              transform 0.6s var(--ease-out);
}

.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 400ms; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 500ms; }
.reveal-stagger.is-visible > *:nth-child(7) { transition-delay: 600ms; }
.reveal-stagger.is-visible > *:nth-child(8) { transition-delay: 700ms; }
.reveal-stagger.is-visible > *:nth-child(9) { transition-delay: 800ms; }

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Parallax base class */
.parallax {
  will-change: transform;
}

/* ============================================
   7. SKIP LINK / ACCESSIBILITY
   ============================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  z-index: calc(var(--z-header) + 1);
  transition: top var(--duration-base) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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