/* ===========================================================
   main.css — reset, tokens, base typography, utilities, preloader
   =========================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
img, video { max-width: 100%; display: block; }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--accent-current, var(--color-text));
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Design tokens ---------- */
:root {
  /* base palette */
  --color-bg: #0B0D10;
  --color-bg-raised: #14171B;
  --color-text: #F5F3EE;
  --color-muted: #8A8F98;
  --color-hairline: rgba(245, 243, 238, 0.10);
  --color-hairline-strong: rgba(245, 243, 238, 0.18);

  /* path accents */
  --accent-embedded: #E8934A;
  --accent-embedded-dim: #E8934A33;
  --accent-ai: #7B8CFF;
  --accent-ai-dim: #7B8CFF33;
  --accent-current: var(--color-text);

  /* type */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* scale */
  --fs-hero: clamp(2rem, 4.5vw + 1rem, 4rem);
  --fs-h1: clamp(1.75rem, 2.5vw + 1rem, 2.75rem);
  --fs-h2: clamp(1.15rem, 1vw + 0.9rem, 1.4rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;

  /* layout */
  --page-max: 960px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --space-7: 96px;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 180ms;
  --dur-med: 420ms;
  --dur-slow: 900ms;
  --dur-video-fade: 180ms; /* keep in sync with FADE_MS in videoManager.js */
}

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

/* ---------- Hidden-attribute enforcement ----------
   .landing / .resume set their own `display` value, which has
   equal specificity to the browser's default [hidden] rule —
   without this, setting el.hidden = true in JS stops the
   element from being visible but does NOT remove it from
   layout, leaving a phantom block of empty space behind. */
.landing[hidden],
.resume[hidden] {
  display: none !important;
}


body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}

p { margin: 0; }

/* ---------- Utilities ---------- */
.u-mono { font-family: var(--font-mono); }
.u-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: var(--color-bg);
  transition: opacity var(--dur-med) var(--ease-standard), visibility var(--dur-med) var(--ease-standard);
}
.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-trace-line {
  stroke: var(--color-hairline-strong);
  stroke-width: 1.5;
}
.preloader-trace-pulse {
  fill: var(--color-text);
  offset-path: path('M20,0 L20,120');
  animation: trace-travel 1.4s var(--ease-standard) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .preloader-trace-pulse { animation: none; opacity: 0; }
}
.preloader-label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.2em;
  color: var(--color-muted);
}