/* Reset + base typography + layout primitives. */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-underline-offset: 0.15em;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-snug);
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-cubic);
}

ul, ol { list-style: none; }

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

::selection {
  background: hsl(var(--brand-surf) / 0.25);
  color: hsl(var(--brand-twilight));
}

/* ─── Typography utilities ─── */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: hsl(var(--accent));
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.eyebrow::before {
  content: '';
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  display: inline-block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: hsl(var(--primary));
}

.h-display {
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.h-1 { font-size: var(--text-5xl); font-weight: 800; }
.h-2 { font-size: var(--text-4xl); font-weight: 700; }
.h-3 { font-size: var(--text-3xl); font-weight: 700; }
.h-4 { font-size: var(--text-2xl); font-weight: 600; }
.h-5 { font-size: var(--text-xl); font-weight: 600; }

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: hsl(var(--foreground-muted));
  max-width: 56ch;
}

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

.text-gradient {
  background-image: var(--gradient-text);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.font-mono {
  font-family: var(--font-mono);
  font-feature-settings: 'liga' 0;
}

/* ─── Layout primitives ─── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 2.5vw, 2.5rem);
}

.container-narrow { max-width: var(--container-narrow); }
.container-wide { max-width: var(--container-wide); }

.section {
  padding-block: var(--space-section);
  position: relative;
}

.section--sm { padding-block: var(--space-section-sm); }

.section--surface {
  background-color: hsl(var(--surface-sunken));
}

.stack > * + * { margin-top: var(--stack-gap, 1rem); }
.stack-2 { --stack-gap: 0.5rem; }
.stack-3 { --stack-gap: 0.75rem; }
.stack-4 { --stack-gap: 1rem; }
.stack-6 { --stack-gap: 1.5rem; }
.stack-8 { --stack-gap: 2rem; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cluster-gap, 1rem);
  align-items: var(--cluster-align, center);
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--grid-gap, 1.5rem);
}

@media (max-width: 768px) {
  .grid-12 { grid-template-columns: repeat(6, 1fr); }
}

/* Visually hidden but accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Reveal animation (intersection-observer hook) ─── */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Background atmospherics ─── */
.bg-aurora {
  position: relative;
  isolation: isolate;
}

.bg-aurora::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-aurora);
  z-index: -1;
  pointer-events: none;
}

.bg-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.02 0 0 0 0 0.02 0 0 0 0 0.59 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
