:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.5vw, 3.25rem);

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

  --radius-sm: 0.375rem;
  --radius-md: 0.6rem;
  --radius-lg: 0.95rem;
  --radius-xl: 1.4rem;
  --radius-full: 9999px;

  --transition-interactive: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Instrument Serif', 'Georgia', serif;
  --font-body: 'Satoshi', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --content-default: 1180px;
  --content-wide: 1320px;
}

/* ---------- DARK (default for this tool — clinical/lab feel) ---------- */
:root,
[data-theme='dark'] {
  --color-bg: #07090d;
  --color-bg-deep: #04060a;
  --color-surface: #0d1117;
  --color-surface-2: #11161e;
  --color-surface-3: #161c26;
  --color-surface-offset: #1a2230;
  --color-divider: #1f2733;
  --color-border: #2a3343;
  --color-border-strong: #3a4458;

  --color-text: #e6ecf2;
  --color-text-muted: #8a96a8;
  --color-text-faint: #5a6577;

  /* neural palette — fMRI-inspired */
  --accent-cyan: #00e5ff;
  --accent-cyan-deep: #0aa9bd;
  --accent-magenta: #ff3d8a;
  --accent-magenta-deep: #c1235f;
  --accent-amber: #ffb648;
  --accent-violet: #9b6cff;
  --accent-green: #4ade80;

  --color-primary: var(--accent-cyan);
  --color-primary-hover: #66f0ff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
  --glow-cyan: 0 0 24px rgba(0, 229, 255, 0.35);
  --glow-magenta: 0 0 24px rgba(255, 61, 138, 0.35);
}

/* light mode (subtle alt for daytime use) */
[data-theme='light'] {
  --color-bg: #f4f6fa;
  --color-bg-deep: #ecf0f6;
  --color-surface: #ffffff;
  --color-surface-2: #f8fafd;
  --color-surface-3: #f1f4f9;
  --color-surface-offset: #e8ecf3;
  --color-divider: #e1e6ee;
  --color-border: #d4dae5;
  --color-border-strong: #b9c1cf;
  --color-text: #0d1117;
  --color-text-muted: #56627a;
  --color-text-faint: #8d97aa;
  --accent-cyan: #0099b8;
  --accent-cyan-deep: #006d83;
  --accent-magenta: #c41e6a;
  --accent-magenta-deep: #951450;
  --accent-amber: #c87600;
  --accent-violet: #6433d8;
  --accent-green: #1f9d57;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.14);
  --glow-cyan: 0 0 18px rgba(0, 153, 184, 0.18);
  --glow-magenta: 0 0 18px rgba(196, 30, 106, 0.18);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  line-height: 1.55;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(0, 229, 255, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(255, 61, 138, 0.05), transparent 60%),
    var(--color-bg);
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p {
  text-wrap: pretty;
}

::selection {
  background: rgba(0, 229, 255, 0.3);
  color: var(--color-text);
}

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

a,
button,
[role='button'],
input,
textarea,
select {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

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

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

.hidden {
  display: none !important;
}

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

.micro {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
