/* ==========================================================================
   BASE — Reset, typography, custom properties (Modest UI 2026)
   ========================================================================== */

:root {
  /* Light mode default */
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --primary: #1E3A8A;
  --accent: #3B82F6;

  /* Brand gradient identity */
  --brand-gradient: linear-gradient(135deg, #F59E0B, #EC4899, #8B5CF6, #3B82F6);
  --brand-orange: #F59E0B;
  --brand-pink: #EC4899;
  --brand-purple: #8B5CF6;
  --brand-blue: #3B82F6;

  /* Compatibility aliases */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-primary: var(--primary);
  --color-accent: var(--accent);
  --color-text-primary: var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-border: var(--border);
  --color-primary-rgb: 30, 58, 138;

  --color-white: #FFFFFF;
  --color-gray-50: #F8F7F4;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #111827;

  --surface-0: var(--bg);
  --surface-1: var(--surface);
  --surface-2: #F3F4F6;
  --surface-3: var(--border);
  --surface-4: #D1D5DB;
  --surface-border: var(--border);
  --surface-border-hover: #D1D5DB;
  --text-heading: var(--text-primary);
  --text-body: var(--text-secondary);
  --text-muted: var(--text-secondary);
  --text-bright: var(--text-primary);

  --gradient-primary: var(--brand-gradient);
  --gradient-hero: transparent;
  --gradient-cta: var(--brand-gradient);
  --gradient-card: none;
  --gradient-accent: linear-gradient(135deg, #8B5CF6, #3B82F6);
  --gradient-warm: linear-gradient(135deg, #F59E0B, #EC4899);
  --gradient-mesh: none;

  --color-success: #10B981;
  --color-error: #DC2626;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Inter', system-ui, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;
  --text-4xl: 2.25rem;
  --text-5xl: 2.5rem;

  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing */
  --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;

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);

  --transition-fast: 0.25s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0F19;
    --surface: #111827;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --border: #1F2937;
    --primary: #3B82F6;
    --accent: #8B5CF6;

    --color-primary-rgb: 59, 130, 246;

    --color-white: #F9FAFB;
    --color-gray-50: #0B0F19;
    --color-gray-100: #111827;
    --color-gray-200: #1F2937;
    --color-gray-300: #374151;
    --color-gray-400: #6B7280;
    --color-gray-500: #9CA3AF;
    --color-gray-600: #D1D5DB;
    --color-gray-700: #E5E7EB;
    --color-gray-800: #F3F4F6;
    --color-gray-900: #F9FAFB;

    --surface-2: #0F172A;
    --surface-3: #1F2937;
    --surface-4: #273244;
    --surface-border-hover: #2B3547;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

h1 { font-size: clamp(2rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.75rem); }
h3 { font-size: clamp(1.125rem, 2vw, 1.25rem); }
h4 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: var(--weight-semibold);
}

/* ---- Utility classes ---- */
.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;
}

.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
