/* ==========================================================================
   Base — reset, type, chrome shared across every page
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--tx);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Paper grain. Sits above the ground, below everything else. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  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='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

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

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: .75rem 1.25rem; z-index: 999;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- Type ---------- */

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: .96;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.mono {
  font-family: var(--f-mono);
  font-size: var(--t-mono);
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.lead { font-size: var(--t-lead); line-height: 1.45; max-width: var(--measure); }
.measure { max-width: var(--measure); }
.mute { color: var(--tx-mute); }

/* ---------- Layout ---------- */

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }
.section { padding-block: var(--sec); }

/* Section header: /02  TITLE  with a ghosted repeat behind it */
.sechead { position: relative; overflow-x: clip; margin-bottom: clamp(2.5rem, 6vw, 5rem); }
.sechead__num { display: block; color: var(--teal); margin-bottom: 1rem; }
.sechead__title {
  font-size: var(--t-h2);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.sechead__title::before { content: "/"; color: var(--teal); }
.sechead__ghost {
  position: absolute;
  left: -.06em; top: 50%;
  translate: 0 -58%;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(4rem, 15vw, 13rem);
  line-height: 1;
  letter-spacing: -.05em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px var(--rule);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.sechead__lede { margin-top: 1.5rem; max-width: var(--measure); position: relative; z-index: 1; }

/* Dark sections */
.dark { background: var(--ink); color: var(--tx-dk); }
.dark .sechead__num { color: var(--green); }
.dark .sechead__title::before { color: var(--green); }
.dark .sechead__ghost { -webkit-text-stroke-color: var(--rule-dk); }
.dark .mute, .foot .mute { color: var(--tx-dk-mute); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .8rem 1.4rem;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: var(--t-mono);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              translate var(--dur) var(--ease);
  will-change: translate;
}
.btn__arw { transition: translate var(--dur) var(--ease); }
.btn:hover .btn__arw { translate: 3px -3px; }

/* green fill + ink text — the only accessible way to use green on paper */
.btn--go { background: var(--green); color: var(--ink); }
.btn--go:hover { background: var(--ink); color: var(--paper); }

.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--green); color: var(--ink); }

.btn--line { border: 1px solid var(--rule); color: var(--ink); }
.btn--line:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.dark .btn--line { border-color: var(--rule-dk); color: var(--paper); }
.dark .btn--line:hover { background: var(--green); color: var(--ink); border-color: var(--green); }

/* ---------- Status pill ---------- */

.status {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem 1rem .5rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
}
.dark .status { border-color: var(--rule-dk); background: var(--ink-2); }

.status__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(73,160,120,.7);
  animation: pulse 2.4s var(--ease) infinite;
  flex: none;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(73,160,120,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(73,160,120,0); }
  100% { box-shadow: 0 0 0 0 rgba(73,160,120,0); }
}

/* ---------- Tags ---------- */

.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  font-family: var(--f-mono);
  font-size: .6875rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: .3rem .6rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--tx-mute);
  white-space: nowrap;
}
.dark .tag { border-color: var(--rule-dk); color: var(--sage); }

/* ---------- Nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--rule); }
.nav__in {
  display: flex; align-items: center; gap: 1.5rem;
  height: 4.5rem;
  max-width: var(--maxw); margin-inline: auto;
  padding-inline: var(--gut);
}
.nav__mark { font-family: var(--f-display); font-weight: 800; letter-spacing: -.04em; font-size: 1.05rem; }
.nav__mark span { color: var(--teal); }
.nav__links { display: flex; gap: 1.75rem; margin-left: auto; }
.nav__link { position: relative; font-family: var(--f-mono); font-size: var(--t-mono); letter-spacing: .1em; text-transform: uppercase; padding-block: .35rem; }
.nav__link sup { font-size: .58em; color: var(--teal); margin-left: .18em; vertical-align: super; }
.nav__link::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; background: var(--green);
  scale: 0 1; transform-origin: left;
  transition: scale .35s var(--ease);
}
.nav__link:hover::after, .nav__link[aria-current="true"]::after { scale: 1 1; }
.nav__cta { margin-left: .5rem; }
.nav__burger { display: none; margin-left: auto; padding: .5rem; }
.nav__burger rect { fill: var(--ink); transition: translate .3s var(--ease), rotate .3s var(--ease), opacity .2s; transform-origin: center; }
.nav[data-open="true"] .nav__burger rect:nth-child(1) { translate: 0 6px; rotate: 45deg; }
.nav[data-open="true"] .nav__burger rect:nth-child(2) { opacity: 0; }
.nav[data-open="true"] .nav__burger rect:nth-child(3) { translate: 0 -6px; rotate: -45deg; }

@media (max-width: 60rem) {
  .nav__burger { display: block; }
  .nav__links {
    position: fixed; inset: 4.5rem 0 auto;
    flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: var(--gut);
    margin: 0;
    display: none;
  }
  .nav[data-open="true"] .nav__links { display: flex; }
  .nav__link { font-size: .8rem; padding-block: .9rem; border-bottom: 1px solid var(--rule-2); }
  .nav__link::after { display: none; }
  .nav__cta { display: none; }
}

/* ---------- Footer ---------- */

.foot { background: var(--ink); color: var(--tx-dk); padding-block: clamp(3rem,7vw,5rem) 2rem; }
.foot__grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .foot__grid { grid-template-columns: 2fr 1fr 1fr; } }
.foot__h { color: var(--green); margin-bottom: 1rem; }
.foot__list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.foot__list a { color: var(--sage); transition: color .3s var(--ease); }
.foot__list a:hover { color: var(--paper); }
.foot__bar {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  margin-top: 3.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--rule-dk);
  color: var(--sage);
}

/* ---------- Reveal ---------- */

[data-reveal] { opacity: 0; translate: 0 24px; }
.is-in[data-reveal], [data-reveal].is-in { opacity: 1; translate: 0 0; transition: opacity .7s var(--ease), translate .7s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; translate: none; }
}
