/**
 * PMC1101 Public Health - Base Stylesheet
 * Design: "Dispatch" - Emergency Data Intelligence
 * Dark-mode, high-contrast, data-driven aesthetic
 * Inspired by emergency services dashboards and epidemiological data visualization
 */

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

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

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;
  color: inherit;
}

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

ul, ol {
  list-style: none;
}

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

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

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* --- Color System --- */
  /* Base / Background */
  --bg-primary: #0b1120;
  --bg-secondary: #131b2e;
  --bg-elevated: #1a2540;
  --bg-surface: #1e2d47;
  --bg-hover: #243352;
  --bg-overlay: rgba(11, 17, 32, 0.92);

  /* Text */
  --text-primary: #e8edf5;
  --text-secondary: #8899b4;
  --text-tertiary: #5a6d8a;
  --text-inverse: #0b1120;

  /* Accent: Alert Orange (Primary) */
  --accent-primary: #ff6b35;
  --accent-primary-dim: rgba(255, 107, 53, 0.15);
  --accent-primary-glow: rgba(255, 107, 53, 0.4);

  /* Accent: Triage Teal (Secondary / Success) */
  --accent-secondary: #00d4aa;
  --accent-secondary-dim: rgba(0, 212, 170, 0.12);
  --accent-secondary-glow: rgba(0, 212, 170, 0.35);

  /* Accent: Clinical Blue (Info) */
  --accent-info: #3a86ff;
  --accent-info-dim: rgba(58, 134, 255, 0.12);
  --accent-info-glow: rgba(58, 134, 255, 0.35);

  /* Accent: Critical Red (Danger) */
  --accent-danger: #ff2d55;
  --accent-danger-dim: rgba(255, 45, 85, 0.12);
  --accent-danger-glow: rgba(255, 45, 85, 0.35);

  /* Accent: Caution Yellow (Warning) */
  --accent-warning: #ffd60a;
  --accent-warning-dim: rgba(255, 214, 10, 0.12);
  --accent-warning-glow: rgba(255, 214, 10, 0.35);

  /* Borders */
  --border-subtle: #1e2d47;
  --border-default: #2a3f5f;
  --border-strong: #3a5580;
  --border-accent: var(--accent-primary);

  /* --- Typography --- */
  --font-display: "Bebas Neue", "Impact", sans-serif;
  --font-body: "Outfit", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Font sizes - modular scale (1.25 ratio) */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */
  --text-6xl: 3.75rem;    /* 60px */
  --text-7xl: 4.5rem;     /* 72px */

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

  /* Line heights */
  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Letter spacing */
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-wider: 0.1em;
  --tracking-widest: 0.2em;

  /* --- Spacing --- */
  --space-2xs: 0.125rem;  /* 2px */
  --space-xs: 0.25rem;    /* 4px */
  --space-sm: 0.5rem;     /* 8px */
  --space-md: 0.75rem;    /* 12px */
  --space-lg: 1rem;       /* 16px */
  --space-xl: 1.5rem;     /* 24px */
  --space-2xl: 2rem;      /* 32px */
  --space-3xl: 3rem;      /* 48px */
  --space-4xl: 4rem;      /* 64px */
  --space-5xl: 6rem;      /* 96px */

  /* --- Layout --- */
  --max-width: 1280px;
  --max-width-narrow: 900px;
  --max-width-wide: 1440px;
  --sidebar-width: 320px;
  --header-height: 72px;

  /* --- Borders & Radius --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  --border-width: 1px;
  --border-width-thick: 2px;
  --border-width-heavy: 3px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
  --shadow-glow-primary: 0 0 20px var(--accent-primary-glow);
  --shadow-glow-secondary: 0 0 20px var(--accent-secondary-glow);
  --shadow-glow-info: 0 0 20px var(--accent-info-glow);
  --shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.4);

  /* --- Transitions --- */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

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

/* ============================================
   BASE TYPOGRAPHY
   ============================================ */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(58, 134, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 107, 53, 0.04) 0%, transparent 60%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
  color: var(--text-primary);
  text-transform: uppercase;
}

h1 {
  font-size: var(--text-6xl);
  letter-spacing: var(--tracking-wider);
}

h2 {
  font-size: var(--text-4xl);
  letter-spacing: var(--tracking-wide);
}

h3 {
  font-size: var(--text-3xl);
}

h4 {
  font-size: var(--text-2xl);
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
}

strong, b {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: var(--space-2xs) var(--space-xs);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: var(--border-width) solid var(--border-subtle);
}

blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  border-left: var(--border-width-heavy) solid var(--accent-primary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ============================================
   LINKS
   ============================================ */
a {
  color: var(--accent-info);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary);
}

a:focus-visible {
  outline: 2px solid var(--accent-info);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   LISTS
   ============================================ */
.content-list {
  list-style: none;
  padding: 0;
  margin: var(--space-lg) 0;
}

.content-list li {
  position: relative;
  padding-left: var(--space-xl);
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.content-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 1px;
  transform: rotate(45deg);
}

/* Numbered list variant */
.content-list--numbered {
  counter-reset: list-counter;
}

.content-list--numbered li {
  counter-increment: list-counter;
}

.content-list--numbered li::before {
  content: counter(list-counter);
  background: none;
  width: auto;
  height: auto;
  transform: none;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--accent-primary);
  letter-spacing: var(--tracking-wide);
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

.section {
  padding: var(--space-4xl) 0;
}

.section--compact {
  padding: var(--space-2xl) 0;
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid {
  display: grid;
  gap: var(--space-xl);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.grid--auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid--auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-accent { color: var(--accent-primary); }
.text-teal { color: var(--accent-secondary); }
.text-blue { color: var(--accent-info); }
.text-red { color: var(--accent-danger); }
.text-yellow { color: var(--accent-warning); }
.text-muted { color: var(--text-tertiary); }

.font-display { font-family: var(--font-display); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.font-mono { font-family: var(--font-mono); }

.mt-0 { margin-top: 0; }
.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); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-0 { margin-bottom: 0; }
.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); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px var(--accent-primary-glow); }
  50% { box-shadow: 0 0 20px var(--accent-primary-glow); }
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.animate-fade-in { animation: fadeIn var(--transition-base) ease both; }
.animate-fade-in-up { animation: fadeInUp var(--transition-slow) ease both; }
.animate-fade-in-down { animation: fadeInDown var(--transition-slow) ease both; }
.animate-slide-left { animation: slideInLeft var(--transition-slow) ease both; }
.animate-slide-right { animation: slideInRight var(--transition-slow) ease both; }

/* Staggered animation delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --text-6xl: 3rem;
    --text-5xl: 2.5rem;
    --text-4xl: 2rem;
  }

  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --text-6xl: 2.5rem;
    --text-5xl: 2rem;
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --header-height: 60px;
  }

  .container {
    padding: 0 var(--space-lg);
  }

  .grid--4,
  .grid--3,
  .grid--2 {
    grid-template-columns: 1fr;
  }

  .section {
    padding: var(--space-3xl) 0;
  }
}

@media (max-width: 480px) {
  :root {
    --text-6xl: 2rem;
    --text-5xl: 1.75rem;
    --text-4xl: 1.5rem;
  }

  .container {
    padding: 0 var(--space-md);
  }
}
