:root {
  --paper: #f3eee4;
  --paper-2: #fffaf3;
  --ink: #1c1612;
  --muted: #5e564c;
  --line: #e0d4c2;
  --rust: #8c3216;
  --moss: #1e3b32;
  --mark: #f0d48a;
  --shadow: 0 18px 40px rgba(48, 28, 12, 0.06);
  color-scheme: light;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14110e;
    --paper-2: #221c16;
    --ink: #f4ecdf;
    --muted: #cbbba6;
    --line: #3c3228;
    --rust: #f0a07a;
    --moss: #9dccb6;
    --mark: #6d5824;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

.wrap {
  width: min(68rem, calc(100% - 2rem));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-150%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.7rem;
  z-index: 5;
}

.skip:focus { transform: none; }

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

a { color: inherit; }

.mast {
  padding: 1.25rem 0 0.5rem;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at top left, color-mix(in srgb, var(--rust) 12%, transparent), transparent 42%),
    var(--paper);
}

.mast-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
}

.brand {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 16rem;
}

.brand-kicker {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-style: italic;
  color: var(--rust);
  font-size: 1.05rem;
}

.brand-name {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
}

.tally {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tally-num {
  display: block;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.6rem;
  line-height: 1;
}

.tally-of { color: var(--muted); font-size: 0.85rem; }

.search { margin-top: 1rem; position: relative; }

.search label,
.goal label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
}

input[type="search"] {
  flex: 1;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  box-shadow: var(--shadow);
}

input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

button,
.button {
  font: inherit;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1.05rem;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}

.button:hover,
button:hover { background: var(--moss); color: #f7f3ea; }

.goal { margin: 0.8rem auto 0.9rem; }

progress {
  width: 100%;
  height: 0.4rem;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  appearance: none;
  background: var(--line);
  color: var(--moss);
}

progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 99px;
}

progress::-webkit-progress-value,
progress::-moz-progress-bar {
  background: var(--moss);
  border-radius: 99px;
}

main { padding: 1.5rem 0 3rem; }

.hero,
.fact,
.prose {
  max-width: 42rem;
}

.hero h1,
.fact.hero h1,
.prose h1,
.page-head h1 {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-weight: 560;
  font-size: clamp(1.7rem, 4.4vw, 2.85rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin: 0.2rem 0 0.8rem;
  overflow-wrap: break-word;
}

.prefix {
  display: block;
  font-style: italic;
  font-size: 0.48em;
  color: var(--rust);
  letter-spacing: 0;
  margin-bottom: 0.35em;
  font-weight: 500;
}

.crumb,
.quiet,
.source,
.tags,
.detail {
  color: var(--muted);
}

.crumb { margin: 0; font-size: 0.92rem; }
.crumb a,
.tags a,
.foot a,
.text-link { color: var(--moss); }

.detail { font-size: 1.05rem; }

.fact {
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
}

.fact h2 {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  font-weight: 560;
  line-height: 1.28;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.45rem;
  overflow-wrap: break-word;
}

.fact h2 a { text-decoration: none; }
.fact h2 a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; }

.but {
  font-style: italic;
  color: var(--rust);
  font-weight: 500;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; font-size: 0.88rem; }
.tags a { text-decoration: none; }
.tags a:hover { text-decoration: underline; }

.source { font-size: 0.88rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: center; margin: 1rem 0 2rem; }
.text-link { text-underline-offset: 0.18em; }

.also h2,
.board h2,
.prose h2 {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-weight: 560;
  font-size: 1.45rem;
  margin: 2rem 0 0.4rem;
}

.card-defer {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 9.5rem;
}

.board { margin-top: 1rem; }

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr));
  gap: 1.4rem 2rem;
  margin-top: 0.8rem;
}

.shelf-grid h3 {
  margin: 0 0 0.2rem;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 560;
}

.shelf-grid p { margin: 0 0 0.45rem; color: var(--muted); font-size: 0.92rem; }

.shelf-grid ul,
.subs {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shelf-grid li a,
.subs a {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.28rem 0;
  border-bottom: 1px solid transparent;
}

.shelf-grid li a:hover,
.subs a:hover { border-bottom-color: var(--line); }

.count { font-variant-numeric: tabular-nums; color: var(--muted); }

.subs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0 0.2rem;
}

.subs a {
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.9rem;
}

.subs a.is-on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.subs a.is-on .count { color: color-mix(in srgb, var(--paper) 75%, transparent); }

.pager { margin: 1rem 0 2rem; }

.pager a {
  color: var(--moss);
  font-weight: 600;
}

mark {
  background: var(--mark);
  color: inherit;
  padding: 0 0.12em;
  border-radius: 0.15em;
}

#suggest {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0.3rem;
  position: absolute;
  z-index: 4;
  left: 0;
  right: 5.5rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

#suggest li { margin: 0; }

#suggest button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-radius: 0.7rem;
  padding: 0.45rem 0.7rem;
}

#suggest button[aria-selected="true"],
#suggest button:hover { background: color-mix(in srgb, var(--mark) 55%, var(--paper-2)); }

#suggest .suggest-title { display: block; font-weight: 600; }
#suggest .suggest-body {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prose p { font-size: 1.08rem; max-width: 40rem; }
.page-head { max-width: 42rem; }

.foot {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.foot-links { display: flex; gap: 1rem; }

@media (max-width: 640px) {
  .mast-row { align-items: flex-start; }
  .tally { text-align: right; }
  .tally-num { font-size: 1.25rem; }
  #suggest { right: 0; }
  .search-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
