:root {
  --ink: #151a1d;
  --muted: #5d696f;
  --line: #cbd2d4;
  --paper: #fbfcfc;
  --cool: #edf1f2;
  --cool-2: #f4f7f7;
  --mono: "SFMono-Regular", "Roboto Mono", "Noto Sans Mono CJK SC", monospace;
  --serif: "Iowan Old Style", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Noto Sans SC", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html { background: #050607; }

body {
  margin: 0;
  color: var(--ink);
  background: #050607;
  font-family: var(--sans);
  line-height: 1.6;
}

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

a:focus-visible {
  outline: 2px solid #0a6582;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: 6px;
  left: 8px;
  transform: translateY(-160%);
  padding: 7px 10px;
  color: #000;
  background: #fff;
  font: 12px var(--mono);
}

.skip-link:focus { transform: none; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  gap: 18px;
  color: #b7c0c3;
  background: #000;
  font: 11px var(--mono);
  white-space: nowrap;
}

.wordmark {
  color: #fff;
  font: 700 14px var(--sans);
  letter-spacing: 0.02em;
  text-decoration: none;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 15px;
}

.primary-nav a {
  color: #aeb8bb;
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  color: #fff;
}

.topbar-status {
  margin-left: auto;
  color: #d8df5d;
  font-size: 10px;
}

.shelf-shell {
  max-width: 980px;
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  padding: 46px 28px 80px;
  background: var(--paper);
}

.shelf-head {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 13px;
  color: #40545c;
  font: 11px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shelf-head h1 {
  margin: 0;
  font: 500 clamp(32px, 4vw, 44px) / 1.12 var(--serif);
  letter-spacing: -0.035em;
}

.shelf-lede {
  max-width: 700px;
  margin: 12px 0 0;
  color: #344248;
  font: 16px / 1.6 var(--serif);
}

.shelf-topic-entry {
  margin: 26px 0 0;
}

.shelf-topic-entry a {
  display: inline-flex;
  gap: 12px;
  align-items: baseline;
  color: #173d4b;
  text-decoration: none;
  font: 650 12px/1.5 var(--sans);
}

.shelf-topic-entry a::after {
  content: "→";
  color: #506168;
}

.shelf-topic-entry span {
  color: #5d6b70;
  font: 10px/1.5 var(--mono);
}

.shelf-topic-entry a:hover span,
.shelf-topic-entry a:focus-visible span {
  color: #2f4249;
}

.shelf-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  border: 1px solid var(--line);
  background: var(--line);
}

.shelf-counts div {
  padding: 12px 14px;
  background: var(--cool-2);
}

.shelf-counts dt {
  margin: 0;
  color: #56666c;
  font: 10px var(--mono);
}

.shelf-counts dd {
  margin: 6px 0 0;
  font: 500 22px / 1 var(--serif);
}

.shelf-list {
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}

.shelf-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 88px;
  gap: 18px;
  align-items: start;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.shelf-item:last-child {
  border-bottom: 1px solid var(--line);
}

.shelf-item.is-ready {
  border-left: 3px solid var(--ink);
  padding-left: 14px;
}

.shelf-no {
  color: #66777c;
  font: 11px var(--mono);
}

.shelf-item h2 {
  margin: 0;
  font: 500 23px / 1.25 var(--serif);
  letter-spacing: -0.02em;
}

.shelf-item h2 a {
  color: #173d4b;
  text-decoration: none;
}

.shelf-item h2 a:hover {
  text-decoration: underline;
}

.shelf-subtitle {
  margin: 7px 0 0;
  color: #3a4a50;
  font: 14px / 1.5 var(--serif);
}

.shelf-meta {
  margin: 10px 0 0;
  color: #56666c;
  font: 11px / 1.55 var(--mono);
}

.shelf-meta span + span::before {
  content: " · ";
  color: #8a969b;
}

.shelf-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin: 10px 0 0;
  color: #263f48;
  font: 10px / 1.5 var(--mono);
}

.shelf-trust small {
  color: #69777c;
  font: 10px / 1.5 var(--mono);
}

.shelf-status {
  justify-self: end;
  margin: 0;
  padding-top: 4px;
  color: #405158;
  font: 10px var(--mono);
  text-align: right;
  letter-spacing: 0.04em;
}

.shelf-item.is-ready .shelf-status {
  color: #153d4b;
}

.shelf-item:not(.is-ready) h2 {
  color: #2c383d;
}

.shelf-empty-link {
  margin-top: 8px;
  color: #6a787e;
  font: 11px / 1.5 var(--mono);
}

.loading {
  padding: 80px 0;
  color: var(--muted);
  font: 12px var(--mono);
  text-align: center;
}

.local-error {
  max-width: 650px;
  padding: 24px;
  border-top: 3px solid var(--ink);
  background: var(--cool);
  font: 14px var(--sans);
}

.noscript-note {
  max-width: 760px;
  margin: 40px auto;
  padding: 28px;
  color: var(--ink);
  background: var(--paper);
}

.site-footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 28px 32px;
  color: #8b989c;
  background: #050607;
  font: 11px / 1.6 var(--mono);
}

.site-footer p {
  max-width: 760px;
  margin: 0;
}

@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 0 12px; }
  .primary-nav { gap: 10px; }
  .topbar-status { display: none; }
  .shelf-shell { padding: 26px 18px 58px; }
  .shelf-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
  }
  .shelf-status {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }
  .shelf-item h2 { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
