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

html { -webkit-text-size-adjust: 100%; scroll-padding-block-start: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; line-height: var(--lh-tight); font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0; }
ul, ol { margin: 0; padding-inline-start: 1.25rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus, h1:focus, h2:focus { outline: none; }
h1:focus-visible, h2:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: var(--radius-sm); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; inset-block-start: var(--s-2); inset-inline-start: var(--s-2); z-index: 40;
  padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm);
  background: var(--accent-attention); color: var(--on-accent-attention); font-weight: 700;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.shell, main { width: min(100% - 2rem, var(--wide)); margin-inline: auto; }
@media (min-width: 37.5rem) { .shell, main { width: min(100% - 3rem, var(--wide)); } }
main { padding-block: var(--s-5) var(--s-8); }

/* Header: a highlighter bar as the mark, then the name */
.site-header { position: relative; z-index: 10; }
.site-header .shell { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-1) var(--s-4); padding-block: var(--s-3); }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--ink); font-weight: 800; letter-spacing: -0.01em; text-decoration: none; padding-block: var(--s-2); }
.brand__mark { display: grid; gap: 3px; width: 1.5rem; flex: none; }
.brand__mark span { display: block; height: 5px; border-radius: 3px; background: var(--line-strong); }
.brand__mark span:nth-child(1) { width: 70%; }
.brand__mark span:nth-child(2) { background: var(--accent-attention); box-shadow: 0 0 0 2px var(--accent-attention); }
.brand__mark span:nth-child(3) { width: 85%; }
.nav { display: flex; align-items: center; gap: var(--s-1); }
.nav a, .theme-select {
  display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: var(--s-3);
  border-radius: 999px; color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; font-size: 0.9375rem;
}
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--surface-2); }
.theme-select { border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); cursor: pointer; margin-inline-start: var(--s-2); padding-inline: var(--s-3); }
.theme-select:hover { background: var(--surface-2); }

.site-footer { color: var(--muted); font-size: var(--text-sm); }
.site-footer .shell { padding-block: var(--s-6); display: grid; gap: var(--s-1); border-top: 1px solid var(--line); }

.stack { display: grid; gap: var(--s-5); }
.stack--loose { gap: var(--s-7); }
.prose-page { max-width: var(--measure); }
.prose > * + * { margin-block-start: var(--s-3); }
.lead { font-size: var(--text-lg); color: var(--muted); max-width: 34rem; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.loading { color: var(--muted); }

.kicker { color: var(--muted); font-size: var(--text-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.button {
  text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: var(--s-2) var(--s-5);
  border: 2px solid transparent; border-radius: var(--radius-md);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.button--primary { background: var(--accent-attention); color: var(--on-accent-attention); box-shadow: var(--shadow-attention); }
.button--primary:hover { background: var(--accent-attention-hover); }
.button--block { width: 100%; }
.button--secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button--secondary:hover { background: var(--surface-2); }
.button--small { min-height: 2.75rem; padding-inline: var(--s-4); font-size: var(--text-sm); }
.button[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); box-shadow: none; transform: none; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; gap: var(--s-1); padding: 0 var(--s-3); border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: var(--text-sm); font-weight: 600; line-height: 1.9; }
button.chip { border: 1px solid var(--line-strong); font-family: inherit; cursor: pointer; min-height: 2.75rem; background: var(--surface); }
button.chip:hover { background: var(--surface-2); }

.banner { padding: var(--s-4) var(--s-5); border-inline-start: 4px solid var(--accent-attention); background: var(--surface); border-radius: var(--radius); max-width: var(--measure); display: grid; gap: var(--s-3); }
.banner__title { font-size: var(--text-lg); }

.dialog { max-width: min(30rem, calc(100% - 2rem)); padding: var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: var(--scrim); }
.dialog > * + * { margin-block-start: var(--s-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .button, .theme-select, .chip { border: 1px solid ButtonText; }
  .brand__mark span { background: CanvasText; }
}

@media (max-width: 37.49rem) {
  .site-header .shell { flex-wrap: wrap; padding-block: var(--s-1); }
  .nav { flex-wrap: wrap; justify-content: flex-end; }
  .brand { padding-block: var(--s-1); }
  .brand__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nav a, .theme-select { padding-inline: var(--s-2); font-size: 0.875rem; }
  .theme-select { margin-inline-start: 0; }
}
