/* ============================================================
   BASE — Reset, typography, utilities
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg);
  overflow-x: hidden;
}

/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-hero); font-weight: 700; }
h2 { font-size: var(--text-5xl);  font-weight: 700; }
h3 { font-size: var(--text-3xl);  font-weight: 600; }
h4 { font-size: var(--text-2xl);  font-weight: 600; }
h5 { font-size: var(--text-xl);   font-weight: 600; }
h6 { font-size: var(--text-lg);   font-weight: 600; }

/* ── Body text ── */
p {
  max-width: 65ch;
  margin-bottom: var(--space-4);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
a:hover { color: var(--accent-dark); }

strong { font-weight: 600; color: var(--text); }
small { font-size: var(--text-sm); }

/* ── Code ── */
code, pre {
  font-family: var(--font-code);
  font-size: var(--text-sm);
}

code {
  background: var(--accent-glow);
  color: var(--accent-dark);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--bg-dark);
  color: #e2e8f0;
  padding: var(--space-6);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: 1.5;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* ── Lists ── */
ul, ol { padding-left: var(--space-6); margin-bottom: var(--space-4); }
li { margin-bottom: var(--space-2); }

/* ── Images ── */
img, video, canvas {
  max-width: 100%;
  display: block;
}

/* ── Sections ── */
section {
  padding: var(--space-24) var(--gutter);
}

.section-alt {
  background: var(--bg-alt);
}

/* ── Container ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container-lg {
  max-width: var(--max-w-lg);
}
.container-sm {
  max-width: var(--max-w-sm);
}

/* ── Delta Glyph ── */
.delta {
  font-family: var(--font-delta);
  font-style: italic;
  color: var(--accent);
}

/* ── Section divider with delta ── */
.divider-delta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-16) auto;
  max-width: 200px;
}
.divider-delta::before,
.divider-delta::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider-delta .delta {
  font-size: var(--text-xl);
}

/* ── Section headings ── */
.section-label {
  font-family: var(--font-code);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--text-body);
  max-width: 600px;
}

/* ── Scroll Reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-lg) var(--ease-out),
              transform var(--duration-lg) var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Staggered Reveal ── */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 400ms; }

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ── Selection ── */
::selection {
  background: var(--accent-glow);
  color: var(--text);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Neural Network Background ── */
#neural-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
}

/* Ensure all content sits above neural canvas (nav handled in nav.css) */
.announce-bar, section, footer {
  position: relative;
  z-index: 1;
}
