/**
 * NORA Website - Base Styles
 * Reset, tokens, typography, and global styles
 */

/* ========================================
   CSS Reset (Modern)
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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;
}

/* ========================================
   Design Tokens
   ======================================== */
:root {
  /* Backgrounds - Deep cosmic depth */
  --bg-void: #050A15;
  --bg-cosmos: #0B1325;
  --bg-nebula: #101A32;
  --bg-card: #14213A;
  --bg-elevated: #1a2744;

  /* Gold spectrum - Sacred light */
  --gold-bright: #FFD966;
  --gold-primary: #F2C94C;
  --gold-deep: #D9AD32;
  --gold-glow: rgba(242, 201, 76, 0.3);
  --gold-subtle: rgba(242, 201, 76, 0.1);

  /* Text hierarchy */
  --text-radiant: #FFFFFF;
  --text-luminous: #F8FAFC;
  --text-soft: #C7D2FE;
  --text-muted: #8CA0D7;
  --text-faint: #5b7094;

  /* Accents - Celestial spectrum */
  --accent-aurora: #60A5FA;
  --accent-sage: #22C55E;
  --accent-ember: #EF4444;
  --accent-amethyst: #A78BFA;
  --accent-rose: #F472B6;

  /* Borders */
  --border-subtle: rgba(148, 163, 184, 0.15);
  --border-medium: rgba(148, 163, 184, 0.25);
  --border-gold: rgba(242, 201, 76, 0.2);

  /* Font families */
  --font-display: 'Kanit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Typography scale (fluid) */
  --text-hero: clamp(2.5rem, 8vw, 4rem);
  --text-display: clamp(2rem, 5vw, 3rem);
  --text-headline: clamp(1.5rem, 4vw, 2rem);
  --text-title: clamp(1.25rem, 3vw, 1.5rem);
  --text-body: 1rem;
  --text-caption: 0.875rem;
  --text-meta: 0.75rem;

  /* Font weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Spacing scale (8px base) */
  --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 */

  /* Section spacing */
  --section-padding: clamp(4rem, 10vh, 8rem);
  --container-padding: clamp(1rem, 5vw, 2rem);
  --container-max: 1200px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px var(--gold-glow);

  /* Motion */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Z-index scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* ========================================
   Global Styles
   ======================================== */
html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-luminous);
  background-color: var(--bg-cosmos);
  background-image: radial-gradient(
    ellipse at top center,
    var(--bg-nebula) 0%,
    var(--bg-cosmos) 50%,
    var(--bg-void) 100%
  );
  background-attachment: fixed;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-radiant);
}

h1, .text-hero {
  font-size: var(--text-hero);
}

h2, .text-display {
  font-size: var(--text-display);
}

h3, .text-headline {
  font-size: var(--text-headline);
}

h4, .text-title {
  font-size: var(--text-title);
}

.text-body {
  font-size: var(--text-body);
}

.text-caption {
  font-size: var(--text-caption);
}

.text-meta {
  font-size: var(--text-meta);
  color: var(--text-muted);
}

/* Text colors */
.text-radiant { color: var(--text-radiant); }
.text-luminous { color: var(--text-luminous); }
.text-soft { color: var(--text-soft); }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold-primary); }

/* Gradient text */
.text-gradient {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold-primary) 50%, var(--accent-amethyst) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   Layout Utilities
   ======================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.section {
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
}

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Grid utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ========================================
   Accessibility
   ======================================== */

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--gold-primary);
  color: var(--bg-void);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-sm);
  z-index: var(--z-toast);
  transition: top var(--duration-fast) var(--ease-default);
}

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

/* Focus styles - Enhanced with glow */
:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(242, 201, 76, 0.15);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced focus for buttons */
.btn:focus-visible {
  outline-color: var(--text-radiant);
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.1),
    0 0 20px rgba(242, 201, 76, 0.3);
}

/* Focus for interactive cards */
.card:focus-visible,
.mode-card:focus-visible,
.faq-question:focus-visible {
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   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;
  }
}

/* ========================================
   Selection
   ======================================== */
::selection {
  background: var(--gold-primary);
  color: var(--bg-void);
}

::-moz-selection {
  background: var(--gold-primary);
  color: var(--bg-void);
}
