:root {
  --paper: #EDE3CC;
  --paper-deep: #E3D6B6;
  --ink: #1E2B38;
  --ink-soft: #3F4C58;
  --oxblood: #7A2E22;
  --olive: #3E4F3E;
  --gold: #A9873F;
  --rule: #C6B78D;
  --rule-soft: #D7CBA6;

  --bg: var(--paper);
  --bg-raised: #F4ECD8;
  --text: var(--ink);
  --text-muted: var(--ink-soft);
  --border: var(--rule);
  --accent: var(--oxblood);
  --accent-ink: var(--paper);

  --documented-bg: rgba(62, 79, 62, 0.14);
  --documented-fg: var(--olive);
  --plausible-bg: rgba(169, 135, 63, 0.16);
  --plausible-fg: #7A5E20;
  --debunked-bg: rgba(122, 46, 34, 0.12);
  --debunked-fg: var(--oxblood);
  --unverified-bg: rgba(63, 76, 88, 0.12);
  --unverified-fg: var(--ink-soft);

  --fellman-bg: #dce6f0;
  --fellman-fg: #2c4a73;
  --maiale-bg: #f3e3df;
  --maiale-fg: var(--oxblood);

  --max: 960px;
  --prose: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1A1610;
    --paper-deep: #241E16;
    --ink: #EEE8DE;
    --ink-soft: #B8AFA0;
    --oxblood: #D98A72;
    --olive: #8FBF8F;
    --gold: #D4B46A;
    --rule: #3A352C;
    --rule-soft: #2A261F;

    --bg: var(--paper);
    --bg-raised: #221C14;
    --text: var(--ink);
    --text-muted: var(--ink-soft);
    --border: var(--rule);
    --accent: var(--oxblood);
    --accent-ink: #1A1610;

    --documented-bg: #163821;
    --documented-fg: #7fd897;
    --plausible-bg: #3a2f0c;
    --plausible-fg: #e8c65a;
    --debunked-bg: #3b1a17;
    --debunked-fg: #ef8a7d;
    --unverified-bg: #2d2a24;
    --unverified-fg: #b8b0a1;

    --fellman-bg: #1a2633;
    --fellman-fg: #8fb4e0;
    --maiale-bg: #33201a;
    --maiale-fg: #e8a793;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Public Sans", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Bodoni Moda", Georgia, serif;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--text); }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 10;
  padding: 0.4rem 0.7rem;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
}

.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 20px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.nav-full {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  justify-content: flex-end;
}
.nav-full a,
.nav-toggle nav a {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
}
.nav-full a:hover,
.nav-toggle nav a:hover { color: var(--accent); }

.nav-toggle { display: none; }
.nav-toggle summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  list-style: none;
}
.nav-toggle summary::-webkit-details-marker { display: none; }
.nav-toggle nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 0 0.2rem;
}

@media (max-width: 820px) {
  .nav-full { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
}

main {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
  min-height: 60vh;
}

.hero {
  max-width: 40rem;
  margin-bottom: 3rem;
}
.hero h1 {
  font-size: clamp(36px, 6vw, 52px);
  line-height: 1.05;
  letter-spacing: 0.2px;
  margin-bottom: 0.85rem;
}
.hero .lede {
  font-size: 1.1rem;
  color: var(--text-muted);
}
.hero-ctas {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.cta {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.cta:hover { color: var(--accent-ink); filter: brightness(1.08); }
.cta.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.cta.secondary:hover { color: var(--text); }
.cta-note {
  flex-basis: 100%;
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
}
.card {
  display: block;
  padding: 1.25rem 1.4rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.card:hover { border-color: var(--accent); color: var(--text); }
.card h2 {
  font-size: 1.15rem;
  margin: 0.15rem 0 0.4rem;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.page { max-width: var(--max); }
.page h1 {
  font-size: clamp(28px, 4vw, 36px);
  margin-bottom: 0.5rem;
}
.page .lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 40rem;
}
.prose {
  max-width: var(--prose);
  margin-top: 1.75rem;
}
.prose h2 {
  font-size: 1.35rem;
  margin-top: 2.2rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.prose h3 {
  font-size: 1.08rem;
  margin-top: 1.6rem;
}
.prose p { margin: 0.85rem 0; color: var(--text-muted); }
.prose p strong, .prose li strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4rem; color: var(--text-muted); }
.prose li { margin: 0.35rem 0; }
.prose pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
}
.prose blockquote {
  margin: 1rem 0;
  padding: 0.4rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.investigation .badge-live,
.mayflower .badge-resolved,
.family .badge,
.line-badge {
  display: inline-block;
  margin-bottom: 0.6rem;
  margin-right: 0.4rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.investigation .badge-live {
  background: var(--debunked-bg);
  color: var(--debunked-fg);
}
.mayflower .badge-resolved {
  background: var(--documented-bg);
  color: var(--documented-fg);
}
.family .badge {
  background: var(--unverified-bg);
  color: var(--unverified-fg);
}
.line-badge.fellman { background: var(--fellman-bg); color: var(--fellman-fg); }
.line-badge.maiale { background: var(--maiale-bg); color: var(--maiale-fg); }

.tree-link {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  max-width: var(--prose);
}
.tree-link .hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tag {
  display: inline;
  padding: 0.05rem 0.35rem;
}
.tag-documented { background: var(--documented-bg); color: var(--documented-fg); }
.tag-plausible { background: var(--plausible-bg); color: var(--plausible-fg); }
.tag-debunked { background: var(--debunked-bg); color: var(--debunked-fg); }
.tag-unverified { background: var(--unverified-bg); color: var(--unverified-fg); }

.band {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}
.band.deep { background: var(--paper-deep); }
.band h2 {
  font-size: clamp(24px, 3.6vw, 32px);
  margin-bottom: 20px;
  max-width: 32rem;
}
.band h3 {
  font-size: 19px;
  margin: 30px 0 10px;
}
.band .prose { margin-top: 0; }
.band .prose h2 { border-top: 0; padding-top: 0; margin-top: 0; }

.not-found {
  max-width: 36rem;
}
.not-found h1 { margin-bottom: 0.75rem; }
.not-found p { color: var(--text-muted); }
.not-found ul { padding-left: 1.2rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 4rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.site-footer .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.site-footer p { max-width: 64ch; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

body.is-landing main {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  min-height: calc(100vh - 11.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.landing { max-width: 64rem; }
.landing-kicker {
  margin: 0 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.landing-title {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin-bottom: 1.5rem;
}
.line-landing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.line-box {
  display: flex;
  flex-direction: column;
  min-height: 24rem;
  padding: 2rem 2.1rem 1.7rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.line-box:hover {
  border-color: var(--accent);
  background: var(--paper-deep);
  color: var(--text);
}
.line-box:hover .line-go { color: var(--accent); }
.line-landing-compact {
  margin-top: 2.75rem;
}
.line-landing-compact .line-box {
  min-height: 13.5rem;
  padding: 1.5rem 1.6rem 1.35rem;
}
.line-landing-compact .line-box h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin: 0.85rem 0 auto;
}
.line-place {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.line-box h2 {
  font-size: clamp(2.8rem, 8vw, 4.4rem);
  line-height: 0.95;
  margin: 1.6rem 0 auto;
  letter-spacing: -0.03em;
}
.line-blurb {
  margin: 1.5rem 0 1.15rem;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 28ch;
}
.line-go {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}
#maiale { scroll-margin-top: 1.25rem; }

@media (max-width: 720px) {
  .line-landing { grid-template-columns: 1fr; }
  .line-box { min-height: 16.5rem; }
  .line-blurb { max-width: none; }
}

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