/* Canton Cover-Up Series Index
   System fonts only. No images. Mobile-first. */

:root {
  --bg: #f3f0e8;
  --paper: #fffcf6;
  --ink: #1c1917;
  --muted: #57534e;
  --faint: #78716c;
  --line: #ddd6c8;
  --line-strong: #c4bdb0;
  --link: #154e63;
  --link-hover: #0b3342;
  --highlight: #fde68a;
  --missing-bg: #f5efe6;
  --pad: clamp(1rem, 4vw, 2rem);
  --measure: 46rem;
  --sticky-h: 8rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .part.is-target { animation: none; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover { color: var(--link-hover); }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: var(--pad);
  top: -3rem;
  background: var(--paper);
  padding: 0.4rem 0.7rem;
  z-index: 20;
}

.skip:focus { top: 0.5rem; }

.wrap {
  width: min(var(--measure), 100%);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Header */

.masthead {
  padding: 2.25rem 0 1.5rem;
}

.kicker {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

.masthead h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 0.85rem;
}

.meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

/* Sticky toolbar */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: end;
  padding: 0.7rem 0;
}

.search {
  flex: 1 1 14rem;
  min-width: 0;
}

.search label,
.jump label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.search-row,
.jump-row {
  display: flex;
  gap: 0.35rem;
}

input[type="search"],
input[type="number"],
input[type="text"] {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}

input[type="number"] { width: 5.5rem; }

button,
.btn {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.2;
}

button.quiet {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-strong);
}

button.quiet[hidden] { display: none; }

.btn-kofi {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  align-self: end;
  margin-left: auto;
}

.btn-kofi:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn-quiet {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn-quiet:hover,
.btn-quiet:focus-visible {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.search-status {
  margin: 0;
  padding: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* TOC */

.toc {
  padding: 1.75rem 0 0.5rem;
}

.toc h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.toc li {
  border-bottom: 1px solid var(--line);
}

.toc a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.85rem;
  padding: 0.7rem 0;
  text-decoration: none;
  color: inherit;
}

.toc a:hover .toc-name { text-decoration: underline; text-underline-offset: 0.15em; color: var(--link); }

.toc-range {
  grid-row: 1 / span 2;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  padding-top: 0.2rem;
  min-width: 5.6rem;
}

.toc-name {
  font-weight: 650;
  color: var(--link);
}

.toc-dates {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Arcs and parts */

.arc {
  padding: 2rem 0 0.5rem;
  scroll-margin-top: calc(var(--sticky-h) + 0.5rem);
}

.arc[hidden] { display: none; }

.arc-head {
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--ink);
}

.arc-head h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.arc-span {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.arc-summary { margin: 0 0 0.4rem; }

.arc-next {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.part {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.05rem;
  margin: 0 0 0.75rem;
  scroll-margin-top: calc(var(--sticky-h) + 0.5rem);
}

.part[hidden] { display: none; }

.part.is-target {
  outline: 2px solid var(--ink);
  animation: pulse 1.6s ease-out 1;
}

@keyframes pulse {
  from { background: var(--highlight); }
  to { background: var(--paper); }
}

.part-meta {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.part-meta a {
  color: inherit;
  text-decoration: none;
}

.part-meta a:hover { color: var(--link); text-decoration: underline; }

.part h3 {
  margin: 0 0 0.5rem;
  font-size: 1.08rem;
  line-height: 1.3;
  font-weight: 650;
}

.thesis { margin: 0 0 0.5rem; }

.points {
  margin: 0 0 0.65rem;
  padding: 0 0 0 1.15rem;
}

.points li { margin: 0 0 0.25rem; }

.points li:last-child { margin-bottom: 0; }

.orig {
  margin: 0;
  font-size: 0.95rem;
}

.orig a { margin-right: 0.7rem; }

.part.is-missing {
  background: var(--missing-bg);
}

.missing-note {
  margin: 0;
  color: var(--muted);
}

.back-top {
  display: inline-block;
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}

/* Footer */

.site-footer {
  margin-top: 2.5rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--ink);
}

.site-footer p { margin: 0 0 0.6rem; }

.site-footer p:last-child { margin-bottom: 0; }

.site-footer .site-actions {
  margin: 1.1rem 0;
}

/* Print */

@media print {
  .toolbar, .skip, .btn-kofi, .back-top, .site-actions { display: none !important; }
  body { background: #fff; }
  .part { break-inside: avoid; border-color: #ccc; }
  a { color: inherit; }
}

/* Small screens: stack jump + button neatly */
@media (max-width: 540px) {
  .btn-kofi { margin-left: 0; }
  .part { padding: 0.9rem 0.85rem; }
  .site-actions { width: 100%; }
  .site-actions .btn { flex: 1 1 auto; }
}
