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

html {
  scroll-behavior: smooth;

  /* The thumb carries the same amber as every other signal on the page; the
     track is deepened a little so that amber still reads against it. */
  scrollbar-color: var(--signal) rgb(18 22 21 / 8%);
}

*::-webkit-scrollbar {
  width: 0.75rem;
  height: 0.75rem;
}

*::-webkit-scrollbar-track { background: rgb(18 22 21 / 8%); }
*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  background: var(--signal);
  background-clip: padding-box;
}

body {
  min-width: 0;
  margin: 0;

  /* The drafting grid runs the full document; dark passages carry their own
     light-line version of the same 56px cell so the texture never breaks. */
  background:
    linear-gradient(180deg, rgb(255 255 255 / 28%) 0%, rgb(255 255 255 / 0%) 22rem),
    linear-gradient(rgb(18 22 21 / 4%) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgb(18 22 21 / 4%) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(118deg, var(--pearl) 0%, var(--silver) 38%, var(--mist) 66%, #d2d7d5 100%);

  /* The drafting grid is pinned to the viewport, so it never slides beneath
     content that has stopped — the pinned hero and review scenes sit still on a
     still grid, and the lattice stays continuous across every passage. */
  background-attachment: scroll, fixed, fixed, scroll;
  color: var(--graphite);
  font-family: var(--font-main);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  font-weight: 400;
  font-stretch: 100%;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

/* A fixed vignette gives the field a light direction: bright at the top of the
   viewport, quietly darker toward the edges. */
body::before {
  position: fixed;
  z-index: 70;
  inset: 0;
  background: radial-gradient(130% 100% at 50% 10%, transparent 62%, rgb(18 22 21 / 6%) 100%);
  content: "";
  pointer-events: none;
}

/* A fixed micro-grain keeps the broad metal fields from banding into flat washes. */
body::after {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: url("../assets/grain.759ab52a.svg");
  background-size: 168px 168px;
  content: "";
  mix-blend-mode: overlay;
  opacity: 0.07;
  pointer-events: none;
}

::selection {
  background: var(--signal);
  color: var(--graphite);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover { color: var(--signal-text); }

button,
input,
textarea {
  border-radius: 0;
  caret-color: var(--signal-text);
  color: inherit;
  font: inherit;
}

button,
a {
  min-width: 44px;
  min-height: 44px;
}

input:not([type="hidden"]),
textarea {
  min-width: 44px;
  min-height: 44px;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible {
  outline: 3px solid var(--signal-text);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0;
  left: var(--page-pad);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--graphite);
  background: var(--graphite);
  color: var(--on-smoke);
  font-weight: 650;
  text-decoration: none;
  transform: translateY(calc(-100% - var(--space-2)));

  /* Parked above the viewport AND clipped: iOS Safari repositions fixed
     elements while its toolbar collapses, so an element hidden only by a
     transform can peek in at the top edge. Clipped, it cannot paint at all;
     it stays keyboard-focusable, and focus releases the clip. */
  clip-path: inset(50%);
  transition: transform var(--state-fast) var(--ease-physical);
}

.skip-link:hover { color: var(--on-smoke); }
.skip-link:focus-visible {
  clip-path: none;
  transform: translateY(0);
}
#main-content:focus { outline: none; }

:is(section, h1, h2, h3, [id]) { scroll-margin-top: 6rem; }
h1, h2, h3, p, ol, ul, dl { margin-top: 0; }
h1, h2, h3 {
  font-weight: 520;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

p { max-width: min(70ch, 100%); }
svg { width: 1em; height: 1em; flex: none; }

.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;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  *::-webkit-scrollbar-thumb { background: CanvasText; }
  :focus-visible { outline-color: Highlight; }
  .skip-link { border: 1px solid ButtonText; }
  body::before { content: none; }
  body::after { content: none; }
}
