/* Base / reset / layout primitives */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); font-size: var(--fs-body); line-height: 1.65; color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--blue-deep); text-underline-offset: .2em; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 400; letter-spacing: .02em; text-wrap: balance; }
h1 { font-size: var(--fs-h1); line-height: .98; letter-spacing: 0; }
h2 { font-size: var(--fs-h2); line-height: 1.02; }
h3 { font-size: var(--fs-h3); line-height: 1.08; }
/* Straight red divider between h2/h3 and body text */
h2::after, h3::after { content: ""; display: block; width: 100%; height: 2px; margin: .6em 0 1em; background: var(--red); }
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--blue); color: #fff; }
html { scrollbar-color: var(--blue) var(--ink-900); }
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-track { background: var(--ink-900); }
  ::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 6px; border: 2px solid var(--ink-900); }
}

.wrap { width: min(100% - var(--gutter) * 2, var(--wrap)); margin-inline: auto; }
.section { padding-block: var(--sp-section); position: relative; }
.section--dark { background: var(--ink-950); color: var(--on-dark); }
.section--dark h2, .section--dark h3 { color: var(--white); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 200; background: var(--white); color: var(--ink); padding: .75rem 1.25rem; border-radius: var(--r-s); font-weight: 700; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 1rem; }

.section-head { max-width: 46rem; margin-bottom: var(--sp-5); }
.section-head p { max-width: 62ch; }
.section-head p:last-child { margin-bottom: 0; }
.section-head .btn { margin-top: var(--sp-2); }
.section--dark .section-head p, .night .section-head p { color: var(--on-dark); }

/* Atmosphere: grain + dot grid for dark surfaces */
.grain::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  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 baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"); }
.dots::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgb(255 255 255 / .07) 1px, transparent 1.2px); background-size: 26px 26px;
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent); }

/* Scroll reveal (JS adds .js to <html>) */
.js .reveal { opacity: 0; transform: translateY(1.25rem); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
