/* ==========================================================================
   Base: reset, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 8px);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paints the phone status-bar strip so nothing scrolls into view above the nav */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--bg);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-weight: 500;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-sm);
}

.skip:focus {
  top: calc(env(safe-area-inset-top, 0px) + 8px);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(clamp(16px, 4vw, 32px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 4vw, 32px), env(safe-area-inset-right, 0px));
}

/* ---- Section scaffold: label gutter + content column ---- */

.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--line);
}

.section__inner {
  display: grid;
  gap: 1.75rem 3rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 880px) {
  .section__inner {
    grid-template-columns: 11.5rem minmax(0, 1fr);
  }

  .section__head {
    position: sticky;
    top: calc(var(--nav-h) + 2rem);
    align-self: start;
  }
}

.section__path {
  margin-bottom: 0.4rem;
  color: var(--dim);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
}

.section__path span {
  color: var(--accent);
}

.section__title {
  font-size: var(--fs-md);
  letter-spacing: -0.005em;
}

.section__body {
  min-width: 0;
}

.section__lead {
  max-width: 62ch;
  color: var(--muted);
}

.section__lead + .section__lead {
  margin-top: 1rem;
}

.section__lead + :not(.section__lead) {
  margin-top: 2rem;
}

.note-line {
  color: var(--dim);
  font-size: var(--fs-xs);
}

.link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 0.25em;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}

.link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
