/* Reset + base layout. */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (max-width: 760px) { html { scroll-padding-top: 0; } }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 70px 70px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

h1 { font-size: clamp(2rem, 4vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-style: wavy; }

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

button, input, select, textarea { font: inherit; color: inherit; }

ul, ol { margin: 0 0 12px; padding-left: 22px; }
li { margin-bottom: 4px; }

code, kbd, pre, samp { font-family: var(--font-mono); }

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

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  padding: 10px 16px;
  font-weight: 800;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: min(100% - 32px, var(--maxw));
  margin-inline: auto;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 24px 0 56px;
}

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); }

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.hidden { display: none !important; }
[hidden] { display: none !important; }

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.12em;
  flex: 0 0 auto;
}

details.miss-item > summary {
  cursor: pointer;
  font-size: 0.88rem;
  min-height: 44px;
  padding: 6px 0;
}
.review-summary {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}
details.miss-item[open] > summary {
  margin-bottom: 8px;
}

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

/* Programmatically focused headings are for announcement, not a visible input ring. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
.q-stem[tabindex="-1"]:focus {
  outline: none;
}
