/* Base — reset, document atmosphere, typography, prose */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

/* Faint paper grain — warmth, not texture-as-statement */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.5 0 0 0 0 0.42 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  flex: 1;
  width: 100%;
  padding-block: var(--space-5) var(--space-7);
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: var(--leading-snug);
  text-wrap: balance;
  letter-spacing: var(--track-tight);
}

h1 { font-size: var(--text-3xl); line-height: var(--leading-tight); font-weight: 520; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

::selection { background: var(--lava); color: var(--paper); }

a {
  color: var(--lava-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-ui) ease;
}

a:hover { color: var(--lava); }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: var(--space-2);
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-3);
  z-index: 10;
}

.skip-link:focus { left: var(--space-2); }

/* Mono labels — the site's utilitarian voice (numbers, dates, facts) */
.label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--ink-soft);
}

.label--accent { color: var(--lava-deep); }

/* Numbered section header, carried over from the first site */
.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-head .label { white-space: nowrap; }

.section-title { font-size: var(--text-2xl); }

.section-more { margin-top: var(--space-4); }

.section-more a {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
}

/* Prose — the reading column */
.prose { max-width: var(--measure); }

.prose > * + * { margin-top: var(--space-3); }

.prose h2 { margin-top: var(--space-5); }
.prose h3 { margin-top: var(--space-4); }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: var(--space-1); }

.prose blockquote {
  border-left: 2px solid var(--lava);
  padding-left: var(--space-3);
  color: var(--ink-soft);
  font-size: var(--text-lg);
}

.prose img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin-block: var(--space-5);
}

.prose strong { font-weight: 640; }

.page-title { margin-bottom: var(--space-4); }

/* Page-load reveal — staggered rise, decorative only.
   Delay is explicit (.reveal-2/-3/-4), not nth-child, so it
   survives template changes. Used on every page's opening blocks. */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    animation: rise var(--dur-reveal) var(--ease-out) forwards;
  }
  .reveal-2 { animation-delay: 60ms; }
  .reveal-3 { animation-delay: 120ms; }
  .reveal-4 { animation-delay: 180ms; }

  @keyframes rise {
    to { opacity: 1; transform: translateY(0); }
  }
}
