/* base.css — universal reset + design tokens */

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

:root {
  /* Fluid type scale */
  --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.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(2.75rem, 0.4rem + 7.5vw, 8rem);

  /* 4px spacing system */
  --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;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;

  --content-narrow: 720px;
  --content-default: 1080px;
  --content-wide: 1280px;
  --content-x: clamp(1.25rem, 4vw, 3rem);

  --transition-interactive: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-body: 'Inter Tight', 'Inter', system-ui, sans-serif;
}

/* DARK (default) — Barlow Obsidian palette */
:root,
[data-theme='dark'] {
  --color-bg: #08080c;
  --color-bg-deep: #050507;
  --color-surface: #0e0e14;
  --color-surface-2: #14141c;
  --color-surface-3: #1c1c26;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-divider: rgba(255, 255, 255, 0.06);

  --color-text: #f4f4f7;
  --color-text-muted: #a3a2ad;
  --color-text-faint: #6b6a76;
  --color-text-inverse: #0a0a10;

  /* Electric primary — cyan/violet duotone */
  --color-primary: #7c5cff;
  --color-primary-hover: #9580ff;
  --color-primary-active: #6248e6;
  --color-primary-highlight: rgba(124, 92, 255, 0.16);

  --color-accent: #00e1ff;
  --color-accent-warm: #ffb86a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 60px rgba(124, 92, 255, 0.35), 0 0 120px rgba(0, 225, 255, 0.18);

  /* Hero canvas opacity */
  --canvas-opacity: 1;
}

/* LIGHT — calm porcelain with the same accents */
[data-theme='light'] {
  --color-bg: #f6f5f1;
  --color-bg-deep: #ecebe5;
  --color-surface: #ffffff;
  --color-surface-2: #f1f0ea;
  --color-surface-3: #e6e4dc;
  --color-border: rgba(15, 12, 30, 0.1);
  --color-border-strong: rgba(15, 12, 30, 0.22);
  --color-divider: rgba(15, 12, 30, 0.06);

  --color-text: #14121f;
  --color-text-muted: #54515f;
  --color-text-faint: #8e8b95;
  --color-text-inverse: #f6f5f1;

  --color-primary: #5b3df0;
  --color-primary-hover: #4a2bdf;
  --color-primary-active: #3a1fc8;
  --color-primary-highlight: rgba(91, 61, 240, 0.12);

  --color-accent: #0085a3;
  --color-accent-warm: #c66400;

  --shadow-sm: 0 1px 2px rgba(20, 18, 31, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 18, 31, 0.08);
  --shadow-lg: 0 24px 60px rgba(20, 18, 31, 0.12);
  --shadow-glow: 0 0 50px rgba(91, 61, 240, 0.18), 0 0 100px rgba(0, 133, 163, 0.1);

  --canvas-opacity: 0.5;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  position: relative;
}

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

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.02em;
}

p,
li {
  text-wrap: pretty;
  max-width: 68ch;
}

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

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

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

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

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  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;
    scroll-behavior: auto !important;
  }
}

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

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  z-index: 1000;
  font-size: var(--text-sm);
  font-weight: 500;
}
.skip-link:focus {
  top: 1rem;
}
