/* === Base CSS: Variables, Reset, Typography, Utilities === */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* === LAYER 1: COLOR === */
  /* Raw primitives */
  --raw-primary: #b30000;
  --raw-primary-rgb: 179, 0, 0;
  --raw-primary-light: #fde8e8;
  --raw-primary-muted: #ff6666;
  --raw-primary-dark: #8a0000;
  --raw-secondary: #002d7a;
  --raw-secondary-light: #e6eeff;
  --raw-secondary-dark: #002d7a;
  --raw-accent: #002d7a;
  --raw-neutral-50: #fafafa;
  --raw-neutral-100: #f5f5f5;
  --raw-neutral-200: #e5e5e5;
  --raw-neutral-300: #d4d4d4;
  --raw-neutral-400: #a3a3a3;
  --raw-neutral-500: #737373;
  --raw-neutral-600: #525252;
  --raw-neutral-700: #404040;
  --raw-neutral-800: #262626;
  --raw-neutral-900: #171717;
  --raw-neutral-950: #0a0a0a;

  /* Semantic aliases */
  --color-primary: var(--raw-primary);
  --color-primary-light: var(--raw-primary-light);
  --color-primary-muted: var(--raw-primary-muted);
  --color-primary-dark: var(--raw-primary-dark);
  --color-secondary: var(--raw-secondary);
  --color-secondary-light: var(--raw-secondary-light);
  --color-secondary-dark: var(--raw-secondary-dark);
  --color-accent: var(--raw-accent);

  --color-bg: #ffffff;
  --color-bg-secondary: #f7f7f7;
  --color-bg-surface: #ffffff;
  --color-bg-elevated: #ffffff;
  --color-bg-dark: #002d7a; /* navy blue - audit confirmed, no hardcoded dark greys remain */
  --color-bg-overlay: rgba(0,0,0,0.6);
  --color-bg-rgb: 255,255,255;

  --color-text: #002d7a;
  --color-text-secondary: #404040;
  --color-text-muted: #737373;
  --color-text-on-dark: #ffffff;
  --color-text-on-light: #002d7a;
  --color-text-on-primary: #ffffff;
  --color-text-link: var(--color-primary);
  --color-text-link-hover: var(--color-primary-dark);

  --color-border: #e5e5e5;
  --color-border-strong: #d4d4d4;
  --color-focus-ring: var(--color-primary);

  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #2563eb;

  --color-neutral-50: var(--raw-neutral-50);
  --color-neutral-100: var(--raw-neutral-100);
  --color-neutral-200: var(--raw-neutral-200);
  --color-neutral-300: var(--raw-neutral-300);
  --color-neutral-400: var(--raw-neutral-400);
  --color-neutral-500: var(--raw-neutral-500);
  --color-neutral-600: var(--raw-neutral-600);
  --color-neutral-700: var(--raw-neutral-700);
  --color-neutral-800: var(--raw-neutral-800);
  --color-neutral-900: var(--raw-neutral-900);
  --color-neutral-950: var(--raw-neutral-950);

  /* === LAYER 2: TYPOGRAPHY === */
  --font-heading: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;
  --font-size-6xl: 3.75rem;
  --font-size-7xl: 4.5rem;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  --line-height-none: 1;
  --line-height-tight: 1.15;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  --letter-spacing-tighter: -0.05em;
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;
  --letter-spacing-widest: 0.1em;

  /* === LAYER 3: SPACING === */
  --space-0: 0;
  --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;

  /* === LAYER 4: LAYOUT === */
  --container-max-width: 1200px;
  --container-padding: var(--space-6);
  --navbar-height: 72px;
  --header-height: 72px;
  --grid-gutter: var(--space-6);
  --sidebar-width: 280px;

  --z-base: 1;
  --z-sticky: 50;
  --z-backdrop: 80;
  --z-drawer: 90;
  --z-dropdown: 100;
  --z-modal-backdrop: 190;
  --z-modal: 200;
  --z-toast: 300;

  /* === LAYER 5: SHAPE === */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.06);
  --shadow-focus-ring: 0 0 0 3px color-mix(in srgb, var(--color-focus-ring) 40%, transparent);

  --border-width: 1px;
  --border-color: var(--color-border);

  /* === LAYER 6: MOTION === */
  --duration-instant: 75ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-moderate: 350ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;

  --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-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.19, 1, 0.22, 1);

  /* === LAYER 7: COMPONENT TOKENS === */
  /* Buttons */
  --btn-padding-y: var(--space-3);
  --btn-padding-x: var(--space-6);
  --btn-radius: var(--radius-md);
  --btn-font-size: var(--font-size-base);
  --btn-font-weight: var(--font-weight-semibold);
  --btn-sm-padding-y: var(--space-2);
  --btn-sm-padding-x: var(--space-4);
  --btn-lg-padding-y: var(--space-4);
  --btn-lg-padding-x: var(--space-8);

  /* Cards */
  --card-padding: var(--space-6);
  --card-radius: var(--radius-lg);
  --card-shadow: var(--shadow-sm);
  --card-shadow-hover: var(--shadow-lg);
  --card-bg: var(--color-bg-surface);
  --card-border: var(--border-width) solid var(--color-border);

  /* Badges */
  --badge-padding-y: var(--space-1);
  --badge-padding-x: var(--space-3);
  --badge-radius: var(--radius-full);
  --badge-font-size: var(--font-size-xs);
  --badge-font-weight: var(--font-weight-semibold);

  /* Inputs */
  --input-height: 2.75rem;
  --input-padding-x: var(--space-4);
  --input-radius: var(--radius-md);
  --input-border: var(--border-width) solid var(--color-border);
  --input-bg: var(--color-bg);
  --input-focus-ring: var(--shadow-focus-ring);

  /* Sections */
  --section-padding-y: var(--space-20);
  --section-padding-x: var(--space-6);

  /* Nav */
  --nav-link-padding: var(--space-2) var(--space-4);
  --nav-link-font-size: var(--font-size-sm);

  /* Section Dividers */
  --divider-height: 60px;
  --divider-color: var(--color-bg);
  --divider-accent-color: var(--color-bg-secondary);

  /* Accent Elements */
  --accent-line-width: 50px;
  --accent-line-height: 3px;
  --accent-line-color: var(--color-primary);
  --accent-line-radius: var(--radius-full);

  /* Image Presentation */
  --img-radius: var(--radius-lg);
  --img-radius-avatar: var(--radius-full);

  /* Decorative Blobs */
  --blob-opacity: 0.07;
  --blob-size: 400px;
  --blob-color-1: var(--color-primary);
  --blob-color-2: var(--color-secondary);
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  padding-top: var(--header-height);
}

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

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--color-text-link-hover);
}

ul, ol {
  list-style: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

/* === CUSTOM SCROLLBAR === */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--color-neutral-100); }
::-webkit-scrollbar-thumb { background: var(--color-neutral-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-neutral-700); }

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-bg-secondary); }
.bg-dark { background-color: var(--color-bg-dark); }
.bg-surface { background-color: var(--color-bg-surface); }

.font-bold { font-weight: var(--font-weight-bold); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-medium { font-weight: var(--font-weight-medium); }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }

.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-auto { margin-top: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.overflow-hidden { overflow: hidden; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
