/* ==========================================================================
   Base elements, typography, shared utilities
   ========================================================================== */

html {
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
  /* `clip` rather than `hidden`: it stops sideways scrolling without
     turning <html> into a scroll container, which would break the
     sticky header. */
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--t-base);
  overflow-x: hidden;
  overflow-x: clip;
  position: relative;
}

/* Faint grain — turns a flat dark theme into a printed, considered surface. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (max-width: 560px) {
  body::after { opacity: 0.03; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.015em;
}

p { color: var(--text-2); }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  font-weight: 600;
}

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

section { padding-block: var(--s-20); }

@media (min-width: 900px) {
  section { padding-block: var(--s-24); }
}

/* ---- Section headers ---- */
.tag {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.4;
  margin-bottom: var(--s-4);
  max-width: none;
}

/* A dot, not a rule. A short horizontal line here reads as a stray dash
   sitting in front of the label. */
.tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.head { max-width: 46ch; margin-bottom: var(--s-10); }
.head h2 { font-size: var(--t-2xl); text-wrap: balance; }

/* :not(.tag) because the eyebrow above the heading is also a <p>, and a
   plain `.head p` would out-specify the .tag rule and restyle it. */
.head p:not(.tag) {
  margin-top: var(--s-4);
  font-size: var(--t-md);
  line-height: 1.65;
  color: var(--muted);
  max-width: 58ch;
}

@media (min-width: 900px) {
  .head { margin-bottom: var(--s-12); }
}

/* ---- Live dot ---- */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}

/* ---- A11y ---- */
.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;
}

.skip-link {
  position: fixed;
  top: -100%;
  left: var(--s-4);
  z-index: 999;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-xs);
  font-weight: 600;
  font-size: var(--t-sm);
  transition: top var(--d-fast) var(--ease-quart);
}
.skip-link:focus { top: var(--s-4); }

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

::selection { background: var(--accent); color: var(--accent-ink); }

/* Custom scrollbar — desktop only, subtle */
@media (min-width: 900px) {
  * { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
}
