/* Reset, type, shared parts (masthead, buttons, bands, keys, code, footer). */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
.display {
  font-stretch: 62%;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-stretch: 75%;
  font-weight: 800;
  font-size: var(--text-xl);
  line-height: 1.05;
}

p {
  max-width: 62ch;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.08em 0.32em;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-white);
  color: var(--ink);
  white-space: nowrap;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

a:hover {
  background: var(--yellow);
  color: var(--ink);
}

a:active {
  background: var(--ink);
  color: var(--paper);
}

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

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

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 10;
  padding: var(--s-2) var(--s-4);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  transform: translateY(-300%);
}

.skip:focus {
  transform: none;
}

/* Visually hidden: honeypot field and live regions. */
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Bands ---------- */
.band {
  background: var(--bg);
  color: var(--fg);
  padding-block: var(--section);
}

.band--deep {
  --bg: var(--paper-deep);
}

.band--yellow {
  --bg: var(--yellow);
  --fg-soft: var(--ink);
  --fg-mute: var(--ink-soft);
}

.band--night {
  --bg: var(--night);
  --fg: var(--on-night);
  --fg-soft: var(--on-night);
  --fg-mute: var(--on-night-mute);
  --line: var(--on-night);
  --focus: var(--yellow);
}

.band--night a:hover {
  background: var(--yellow);
  color: var(--ink);
}

.kicker {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  flex: none;
  width: 2.25rem;
  height: var(--rule-heavy);
  background: currentColor;
}

.sec-head {
  margin-bottom: var(--s-7);
}

.sec-head h2 {
  max-width: 20ch;
}

.lede {
  font-size: var(--text-lg);
  line-height: 1.45;
  color: var(--fg-soft);
}

.fine {
  font-size: var(--text-sm);
  color: var(--fg-mute);
}

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: var(--rule) solid var(--ink);
  background: var(--paper);
}

.masthead__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-2) var(--s-1) 0;
  font-stretch: 68%;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.005em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand:hover {
  background: none;
}

.brand__mark {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  transition: transform var(--fast) var(--ease-out);
}

.brand:hover .brand__mark {
  transform: rotate(-8deg);
}

.brand__num {
  padding-inline: 0.12em;
  background: var(--yellow);
}

.nav ul {
  display: flex;
  align-items: center;
  gap: clamp(var(--s-3), 2.4vw, var(--s-6));
}

.nav a:not(.btn) {
  padding: var(--s-2) var(--s-1);
  font-weight: 600;
  text-decoration-color: transparent;
}

.nav a:not(.btn):hover,
.nav a[aria-current="page"] {
  text-decoration-color: currentColor;
}

@media (max-width: 34rem) {
  .nav__wide {
    display: none;
  }

  .btn--small {
    padding-inline: 0.7rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 23rem) {
  .masthead__in {
    gap: var(--s-2);
  }

  .nav ul {
    gap: var(--s-2);
  }

  .btn--small {
    padding-inline: 0.5rem;
  }

  .brand {
    gap: 0.35rem;
    font-size: 1.3rem;
  }

  /* No room for the mark beside the wordmark at this width. */
  .brand__mark {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 3rem;
  padding: 0.7rem 1.35rem;
  border: var(--rule) solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 5px 5px 0 var(--yellow), 5px 5px 0 2px var(--ink);
  font: inherit;
  font-stretch: 82%;
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--fast) var(--ease-out);
}

.btn:hover {
  background: var(--ink);
  color: var(--yellow);
  transform: translate(-2px, -2px);
}

.btn:active {
  background: var(--ink);
  color: var(--yellow);
  box-shadow: none;
  transform: translate(5px, 5px);
}

.btn:focus-visible {
  outline-offset: 9px;
}

.btn[disabled] {
  background: var(--ink-mute);
  border-color: var(--ink-mute);
  color: var(--paper);
  box-shadow: none;
  cursor: progress;
  transform: none;
}

.btn--ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
}

.btn--ghost:hover,
.btn--ghost:active {
  background: var(--yellow);
  color: var(--ink);
}

.btn--small {
  white-space: nowrap;
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  box-shadow: 3px 3px 0 var(--yellow), 3px 3px 0 2px var(--ink);
  font-size: 0.9375rem;
}

.btn--small:active {
  transform: translate(3px, 3px);
}

.btn--small:focus-visible {
  outline-offset: 7px;
}

.btn__arrow {
  width: 1.1em;
  height: 1.1em;
  transition: transform var(--fast) var(--ease-out);
}

.btn:hover .btn__arrow {
  transform: translateX(3px);
}

/* ---------- Keypad key (step numbers) ---------- */
.key {
  display: inline-grid;
  place-content: center;
  justify-items: center;
  flex: none;
  width: 3.75rem;
  height: 3.75rem;
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius-key);
  background: var(--paper-white);
  color: var(--ink);
  box-shadow: 3px 4px 0 var(--ink);
}

.key__n {
  font-stretch: 70%;
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 0.9;
}

.key__l {
  min-height: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.3;
  text-indent: 0.18em;
}

/* ---------- Dot-leader rows (directory listings) ---------- */
.leaders > div {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding-block: var(--s-3);
}

.leaders dt {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  gap: var(--s-3);
  min-width: 0;
}

.leaders dt::after {
  content: "";
  flex: 1 1 1.5rem;
  min-width: 1.25rem;
  border-bottom: 3px dotted currentColor;
  opacity: 0.55;
  transform: translateY(-0.28em);
}

.leaders dd {
  flex: none;
  max-width: 60%;
  text-align: right;
}

/* ---------- Code blocks ---------- */
.code {
  position: relative;
  border: var(--rule) solid var(--ink);
  background: var(--night);
  color: var(--on-night);
  box-shadow: var(--shadow-hard);
}

.code__bar {
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-4);
  border-bottom: 1px solid var(--night-rule);
  color: var(--on-night-mute);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.code pre {
  margin: 0;
  padding: var(--s-4);
  font-size: var(--text-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nb {
  white-space: nowrap;
}

.copy {
  min-width: 4.6rem;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--on-night-mute);
  border-radius: 0;
  background: transparent;
  color: var(--on-night);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--fast) var(--ease-out);
}

.copy:hover {
  border-color: var(--yellow);
  background: var(--yellow);
  color: var(--ink);
}

.copy:active {
  transform: scale(0.94);
}

.copy:focus-visible {
  outline-color: var(--yellow);
  outline-offset: 2px;
}

.copy[data-state="done"] {
  border-color: var(--yellow);
  color: var(--yellow);
  background: transparent;
}

/* ---------- Footer ---------- */
.footer {
  --focus: var(--yellow);
  padding-block: var(--s-7) var(--s-6);
  border-top: var(--rule-heavy) solid var(--yellow);
  background: var(--night);
  color: var(--on-night);
}

.footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5) var(--s-7);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--night-rule);
}

.footer__brand {
  font-stretch: 62%;
  font-weight: 800;
  font-size: clamp(2.5rem, 1.6rem + 4.5vw, 5rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.footer__brand span {
  color: var(--yellow);
}

.footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
}

.footer__nav a {
  display: inline-block;
  padding-block: var(--s-2);
  font-weight: 600;
}

.footer__legal {
  display: grid;
  gap: var(--s-2);
  padding-top: var(--s-5);
  color: var(--on-night-mute);
  font-size: var(--text-sm);
}

.footer__legal p {
  max-width: 78ch;
}

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