/* ================================================================
   BASE — CSS reset, custom properties, global typography
   ================================================================ */

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

/* ── Custom properties ──────────────────────────────────────── */
:root {
  /* Colors */
  --bg:             #0a0a0a;
  --surface:        rgba(255, 255, 255, 0.03);
  --surface-hover:  rgba(255, 255, 255, 0.06);
  --border:         rgba(255, 255, 255, 0.07);
  --border-hover:   rgba(255, 255, 255, 0.14);

  --text:           #f0f0f0;
  --text-muted:     #666;
  --text-faint:     #333;

  --accent:         #a78bfa;
  --accent-glow:    rgba(167, 139, 250, 0.15);

  /* Typography */
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

  /* Spacing scale (4px base) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  24px;
  --sp-6:  32px;
  --sp-7:  48px;
  --sp-8:  64px;
  --sp-9:  96px;
  --sp-10: 128px;

  /* Radii */
  --r-sm: 6px;
  --r:    12px;
  --r-lg: 20px;

  /* Transitions */
  --ease:      0.2s ease;
  --ease-slow: 0.4s ease;
}

/* ── Base elements ──────────────────────────────────────────── */
html {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

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

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

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

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

/* ── Selection ──────────────────────────────────────────────── */
::selection {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── Focus ──────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Fade-in animation (driven by IntersectionObserver) ──────── */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: var(--delay, 0ms);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
