/* base.css — Foundation resets, tokens, and global styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  hanging-punctuation: first last;
}

:root {
  /* Type Scale */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.15vw, 0.75rem);
  --text-sm:   clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.85rem + 0.15vw, 0.9375rem);
  --text-lg:   clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-xl:   clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --text-2xl:  clamp(1.5rem, 1.2rem + 0.8vw, 2rem);

  /* 4px Spacing System */
  --space-0:  0;
  --space-px: 1px;
  --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;

  /* Font Families */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark theme (default and only theme) */
:root, [data-theme="dark"] {
  --color-bg:              #0d0f11;
  --color-surface:         #13161a;
  --color-surface-2:       #1a1d22;
  --color-surface-3:       #21252b;
  --color-surface-hover:   #272b33;
  --color-border:          #2a2e36;
  --color-border-subtle:   #1f232a;
  --color-divider:         #1c2027;

  /* Text */
  --color-text:            #e1e3e6;
  --color-text-secondary:  #8b919a;
  --color-text-tertiary:   #5c6370;
  --color-text-inverse:    #0d0f11;

  /* Primary — Teal accent */
  --color-primary:         #3b9da5;
  --color-primary-hover:   #4fb3bb;
  --color-primary-active:  #2d8089;
  --color-primary-muted:   rgba(59, 157, 165, 0.15);
  --color-primary-subtle:  rgba(59, 157, 165, 0.08);

  /* Semantic */
  --color-success:         #4caf7d;
  --color-success-muted:   rgba(76, 175, 125, 0.15);
  --color-warning:         #e5a842;
  --color-warning-muted:   rgba(229, 168, 66, 0.15);
  --color-error:           #d45757;
  --color-error-muted:     rgba(212, 87, 87, 0.15);

  /* Data Viz Palette */
  --viz-1: #3b9da5;
  --viz-2: #5b7ec9;
  --viz-3: #9b6bc9;
  --viz-4: #e5a842;
  --viz-5: #4caf7d;
  --viz-6: #d45757;
  --viz-gray: #3a3e46;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

@media (max-width: 2000px) and (max-height: 1300px) {
  :root {
    --text-xs: 0.6875rem;
    --text-sm: 0.75rem;
    --text-base: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.25rem;
    --space-2: 0.375rem;
    --space-3: 0.625rem;
    --space-4: 0.875rem;
    --space-5: 1rem;
    --space-6: 1.25rem;
  }
}

@media (max-width: 1700px) and (max-height: 1150px) {
  :root {
    --text-xs: 0.625rem;
    --text-sm: 0.6875rem;
    --text-base: 0.8125rem;
    --text-lg: 0.9375rem;
    --text-xl: 1.125rem;
    --space-2: 0.3125rem;
    --space-3: 0.5rem;
    --space-4: 0.75rem;
    --space-5: 0.875rem;
    --space-6: 1rem;
  }
}

body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  line-height: 1.5;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
  font-variant-numeric: tabular-nums lining-nums;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; }

::selection {
  background: var(--color-primary-muted);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

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