/* ============================================
   CSS Variables - Design Tokens
   ============================================ */
:root {
  /* Colors - Primary (Modern Medical Blue) */
  --color-primary: #0284c7;
  --color-primary-dark: #0369a1;
  --color-primary-light: #38bdf8;
  --color-accent: #06b6d4;

  /* Colors - Status */
  --color-error: #dc2626;
  --color-error-light: rgba(239, 68, 68, 0.1);

  /* Colors - Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Colors - Background & Border */
  --bg-white: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", Inter, system-ui, sans-serif;

  /* Font Sizes */
  --text-2xs: 0.75rem;
  --text-xs: 0.875rem;
  --text-sm: 1rem;
  --text-base: 1.125rem;
  --text-lg: 1.5rem;
  --text-xl: 2rem;
  --text-2xl: 3rem;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px -8px rgba(2, 132, 199, 0.2);

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;

  /* Layout */
  --container-max: 1200px;
  --header-height: 72px;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

p { color: var(--text-secondary); }

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

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

.section-sm { padding: var(--space-12) 0; }
.section-lg { padding: var(--space-24) 0; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.container-narrow {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (min-width: 640px) {
  .container { padding: 0 var(--space-6); }
}

@media (min-width: 768px) {
  :root {
    --text-xl: 2.25rem;
    --text-2xl: 3.5rem;
  }
  .container { padding: 0 var(--space-8); }
}

@media (min-width: 1024px) {
  :root {
    --text-2xl: 4rem;
  }
}

/* ============================================
   Reduced Motion (Accessibility)
   ============================================ */
@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;
  }
}

/* ============================================
   Scroll Reveal
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
  will-change: opacity, transform;
}

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

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }

/* ============================================
   Accessibility - Focus Visible
   ============================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

a:focus-visible,
.btn:focus-visible {
  border-radius: var(--radius-sm);
}
