/* Church History in Plain Language — shared styles */
:root {
  --bg: #faf7f1;
  --bg2: #f1ebdf;
  --card: #ffffff;
  --ink: #1f1a14;
  --ink2: #4a4238;
  --muted: #6e6458;
  --line: #ddd3c2;
  --link: #8a3b12;
  --accent: #6b4f2a;
  --era: #6b4f2a;
  --warn-bg: #fff3c4;
  --warn-ink: #6a4d00;
  --svg-ink: #1f1a14;
  --svg-muted: #6e6458;
  --svg-line: #c9bda8;
  --svg-fill: #efe7d8;
  --svg-sea: #cddfe9;
  --svg-land: #efe7d8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17140f; --bg2: #211d17; --card: #221e18; --ink: #ece4d6; --ink2: #cfc5b4; --muted: #a59a89;
    --line: #3a332a; --link: #f0a77a; --accent: #d9b77e; --warn-bg: #4a3a0a; --warn-ink: #ffe28a;
    --svg-ink: #ece4d6; --svg-muted: #a59a89; --svg-line: #5a5144; --svg-fill: #2b261f; --svg-sea: #1c2a33; --svg-land: #2b261f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17140f; --bg2: #211d17; --card: #221e18; --ink: #ece4d6; --ink2: #cfc5b4; --muted: #a59a89;
  --line: #3a332a; --link: #f0a77a; --accent: #d9b77e; --warn-bg: #4a3a0a; --warn-ink: #ffe28a;
  --svg-ink: #ece4d6; --svg-muted: #a59a89; --svg-line: #5a5144; --svg-fill: #2b261f; --svg-sea: #1c2a33; --svg-land: #2b261f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 5rem; }
html:has(.letters), html:has(.filters) { scroll-padding-top: 8.5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); font-size: 19px; line-height: 1.65; -webkit-text-size-adjust: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--era); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin: .2em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.55rem; margin: 2.2em 0 .6em; padding-top: .3em; }
h3 { font-size: 1.2rem; margin: 1.6em 0 .4em; }
small, .dates { color: var(--muted); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font-family: var(--sans); font-size: 15px; }
.site-header::after { content: ""; display: block; height: 3px; background: var(--era); }
.bar { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .55rem 16px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand em { font-weight: 400; color: var(--muted); }
.brand .cross { color: var(--era); }
nav ul.nav { display: flex; list-style: none; margin: 0; padding: 0; gap: .15rem; align-items: center; }
nav ul.nav > li > a, .dd-btn { display: block; padding: .4rem .6rem; color: var(--ink2); text-decoration: none; border-radius: 6px; background: none; border: 0; font: inherit; cursor: pointer; }
nav ul.nav > li > a:hover, .dd-btn:hover { background: var(--bg2); color: var(--ink); }
.dd { position: relative; }
.dd-menu { display: none; position: absolute; top: 100%; left: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; list-style: none; margin: .3rem 0 0; padding: .4rem; min-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.dd.open .dd-menu { display: block; }
.dd-menu a { display: flex; gap: .5rem; align-items: baseline; padding: .45rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.dd-menu a:hover, .dd-menu a[aria-current] { background: var(--bg2); }
.dd-menu .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--era); flex: none; align-self: center; }
.dd-menu .n { font-weight: 700; color: var(--era); }
.dd-menu small { margin-left: auto; white-space: nowrap; padding-left: .5rem; }
.tools { display: flex; gap: .5rem; align-items: center; margin-left: auto; }
.search { position: relative; }
.search input { font: inherit; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--ink); width: 13rem; }
#results { position: absolute; right: 0; top: 115%; width: min(26rem, 92vw); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: .3rem; }
#results a { display: block; padding: .5rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
#results a:hover, #results a.sel { background: var(--bg2); }
#results .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: .4rem; }
#results .s { display: block; font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#results .none { padding: .6rem; color: var(--muted); }
#theme, .menu-btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 50%; width: 2.2rem; height: 2.2rem; cursor: pointer; }
.menu-btn { display: none; border-radius: 6px; width: auto; padding: 0 .7rem; }

@media (max-width: 1020px) {
  .bar { flex-wrap: wrap; }
  .menu-btn { display: block; margin-left: auto; order: 2; }
  .tools { order: 3; width: 100%; margin: 0; }
  .search { flex: 1; }
  .search input { width: 100%; }
  nav#mainnav { order: 4; width: 100%; display: none; }
  nav#mainnav.open { display: block; }
  nav ul.nav { flex-direction: column; align-items: stretch; }
  .dd-menu { position: static; min-width: 0; box-shadow: none; }
  .dd-menu small { display: none; }
}

/* ---------- layout ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 1rem 16px 3rem; }
.crumbs { font-family: var(--sans); font-size: .85rem; color: var(--muted); margin: .5rem 0 1rem; }
.crumbs a { color: var(--muted); }
article.topic, article.era-page { display: grid; grid-template-columns: minmax(0, 44rem) 15rem; column-gap: 3rem; justify-content: center; }
article.topic > *, article.era-page > * { grid-column: 1; }
.topic-head { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.era-label { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--era); font-weight: 700; margin: 0; }
.dek { font-size: 1.2rem; color: var(--ink2); margin: 0; font-style: italic; }
.tags { margin: .8rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { font-family: var(--sans); font-size: .78rem; padding: .15rem .6rem; border-radius: 20px; background: var(--bg2); color: var(--ink2); text-decoration: none; border: 1px solid var(--line); }
.tag:hover { border-color: var(--era); }
aside.toc { grid-column: 2; grid-row: 1 / span 30; align-self: start; position: sticky; top: 5.5rem; font-family: var(--sans); font-size: .85rem; margin-top: 1rem; max-height: calc(100vh - 7rem); overflow: auto; }
aside.toc summary { font-weight: 700; cursor: pointer; color: var(--ink2); margin-bottom: .4rem; }
aside.toc ol { list-style: none; padding: 0 0 0 .8rem; margin: 0; border-left: 2px solid var(--line); }
aside.toc li { margin: .35rem 0; }
aside.toc a { color: var(--muted); text-decoration: none; }
aside.toc a:hover, aside.toc a.on { color: var(--era); }
@media (max-width: 1020px) {
  article.topic, article.era-page { grid-template-columns: minmax(0, 1fr); }
  aside.toc { grid-column: 1; grid-row: auto; position: static; max-height: none; background: var(--bg2); padding: .6rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
  aside.toc details:not([open]) summary { margin: 0; }
}
.prose p, .prose li { max-width: 70ch; }
.prose p { margin: 0 0 1.05em; }
.prose blockquote { margin: 1.4em 0; padding: .3em 1.2em; border-left: 4px solid var(--era); font-style: italic; color: var(--ink2); }
.prose .callout, .callout { background: var(--bg2); border-left: 4px solid var(--era); border-radius: 0 10px 10px 0; padding: .9rem 1.2rem; margin: 1.5em 0; font-size: .95em; }
.callout h4 { margin: 0 0 .4em; font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--era); }
.callout p:last-child { margin-bottom: 0; }

.nutshell { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--era); border-radius: 10px; padding: .4rem 1.4rem .8rem; margin-bottom: 1.5rem; }
.nutshell h2.nut { font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--era); margin: .7rem 0 .3rem; padding: 0; }
.nutshell ul { margin: 0; padding-left: 1.2rem; }
.nutshell li { margin: .3rem 0; }

a.gl { color: inherit; text-decoration: underline dotted var(--era); text-decoration-thickness: 2px; text-underline-offset: 3px; position: relative; }
a.pl { color: inherit; text-decoration: underline solid color-mix(in srgb, var(--era) 45%, transparent); text-underline-offset: 3px; }
a.gl:hover, a.pl:hover { color: var(--link); }
.tip { position: absolute; z-index: 60; max-width: 22rem; background: var(--ink); color: var(--bg); font-family: var(--sans); font-size: .85rem; line-height: 1.45; padding: .6rem .8rem; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }

.unverified { font-family: var(--sans); font-size: .7rem; font-weight: 700; background: var(--warn-bg); color: var(--warn-ink); padding: .05rem .35rem; border-radius: 4px; vertical-align: .1em; white-space: nowrap; }

.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .8rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; font-size: .92rem; }
.card a { color: var(--ink); text-decoration: none; }
.card a:hover strong { color: var(--link); }
.card p { margin: .3rem 0 0; color: var(--ink2); line-height: 1.45; }
.card .dates { font-family: var(--sans); font-size: .8rem; display: block; }

.historians { background: var(--bg2); border-radius: 12px; padding: .2rem 1.4rem 1rem; margin-top: 2.5rem; }
.historians h2 { margin-top: .9em; }
.historians dl { margin: 0; }
.historians dt { font-weight: 700; font-family: var(--sans); font-size: .9rem; color: var(--era); margin-top: .8rem; }
.historians dd { margin: .2rem 0 0; }
.matters { border-left: 4px solid var(--era); padding-left: 1.2rem; }
.sources { font-size: .92rem; color: var(--ink2); }
.datelist { list-style: none; padding: 0; columns: 2 18rem; column-gap: 2rem; font-size: .95rem; }
.datelist li { break-inside: avoid; padding: .25rem 0; border-bottom: 1px dotted var(--line); }
.datelist b { font-family: var(--sans); color: var(--era); display: inline-block; min-width: 4.8rem; font-size: .85rem; }

.prevnext { max-width: 62rem; margin: 3rem auto 0; display: flex; gap: 1rem; justify-content: space-between; font-family: var(--sans); }
.prevnext a { flex: 1; max-width: 48%; display: block; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--card); border-left: 5px solid var(--era); }
.prevnext a.next { text-align: right; margin-left: auto; border-left: 1px solid var(--line); border-right: 5px solid var(--era); }
.prevnext small { display: block; color: var(--muted); font-size: .8rem; }
.prevnext a:hover { background: var(--bg2); }

/* ---------- figures ---------- */
figure.diagram { margin: 2rem 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; overflow-x: auto; }
figure.diagram svg { display: block; width: 100%; height: auto; min-width: 520px; font-family: var(--sans); }
figure.diagram svg.narrow-ok { min-width: 0; }
figure.diagram figcaption { font-family: var(--sans); font-size: .85rem; color: var(--muted); margin-top: .7rem; line-height: 1.45; }
figure.diagram figcaption b { color: var(--ink); }
.fig-title { font-family: var(--sans); font-weight: 700; font-size: .95rem; margin: 0 0 .6rem; color: var(--ink); }
svg .ink { fill: var(--svg-ink); } svg .muted { fill: var(--svg-muted); }
svg .line { stroke: var(--svg-line); } svg .fill { fill: var(--svg-fill); }
svg .sea { fill: var(--svg-sea); } svg .land { fill: var(--svg-land); stroke: var(--svg-line); }
svg text { fill: var(--svg-ink); }
svg text.muted { fill: var(--svg-muted); }
svg a text { text-decoration: underline; }
.map-toggle { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; font-family: var(--sans); }
.map-toggle button { font: inherit; font-size: .85rem; padding: .3rem .8rem; border-radius: 20px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink); cursor: pointer; }
.map-toggle button[aria-pressed="true"] { background: var(--era); color: #fff; border-color: var(--era); }

table.compare { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .88rem; line-height: 1.45; min-width: 520px; }
table.compare th, table.compare td { border-bottom: 1px solid var(--line); padding: .55rem .6rem; text-align: left; vertical-align: top; }
table.compare thead th { background: var(--bg2); border-bottom: 2px solid var(--era); }
table.compare tbody th { color: var(--era); white-space: nowrap; }

/* ---------- home ---------- */
.hero { text-align: center; max-width: 46rem; margin: 2rem auto 2.5rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.hero p { font-size: 1.2rem; color: var(--ink2); }
.era-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.era-grid a { display: flex; flex-direction: column; height: 100%; padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--era); border-radius: 12px; text-decoration: none; color: var(--ink); transition: transform .15s; }
.era-grid a:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.era-grid .n { font-family: var(--sans); font-weight: 800; color: var(--era); font-size: .85rem; }
.era-grid strong { font-size: 1.2rem; margin: .1rem 0; }
.era-grid small { font-family: var(--sans); }
.era-grid .sum { font-size: .95rem; color: var(--ink2); margin: .5rem 0; flex: 1; }
.era-grid .count { font-family: var(--sans); font-size: .8rem; color: var(--era); }
.howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 2rem 0; }
.howto a { display: block; padding: 1rem 1.2rem; background: var(--bg2); border-radius: 12px; color: var(--ink); text-decoration: none; }
.howto a:hover { outline: 2px solid var(--era); }
.howto strong { display: block; font-size: 1.1rem; }
.howto span { color: var(--ink2); font-size: .95rem; }

/* ---------- era page ---------- */
.chapter-list { list-style: none; padding: 0; counter-reset: c; }
.chapter-list a { display: grid; grid-template-columns: 2.5rem 1fr; gap: .1rem 1rem; padding: 1rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chapter-list a:hover { background: var(--bg2); }
.chapter-list .num { grid-row: span 2; font-family: var(--sans); font-weight: 800; font-size: 1.6rem; color: var(--era); }
.chapter-list strong { font-size: 1.2rem; }
.chapter-list span:last-child { color: var(--ink2); font-size: .95rem; }

/* ---------- index pages ---------- */
article.wide { max-width: 60rem; margin: 0 auto; }
.letters { font-family: var(--sans); display: flex; flex-wrap: wrap; gap: .3rem; position: sticky; top: 4.2rem; background: var(--bg); padding: .5rem 0; z-index: 5; }
.letters a { padding: .2rem .55rem; border-radius: 6px; background: var(--bg2); text-decoration: none; font-weight: 700; }
ul.az { list-style: none; padding: 0; }
ul.az li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
ul.az li:target, dl.gloss dt:target, dl.gloss dt:target + dd { background: var(--warn-bg); }
ul.az p { margin: .2rem 0; }
.uses { font-family: var(--sans); font-size: .85rem; color: var(--muted); }
dl.gloss dt { font-weight: 700; margin-top: 1rem; font-size: 1.1rem; }
dl.gloss dd { margin: .2rem 0 .8rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.theme-toc { font-family: var(--sans); columns: 2 16rem; padding-left: 1.2rem; }
section.theme { margin-top: 2rem; }
.theme-list { list-style: none; padding: 0; display: flex; flex-direction: column; border-left: 3px solid var(--line); margin-left: .4rem; }
.theme-list li { position: relative; padding-left: 1.2rem; }
.theme-list li::before { content: ""; position: absolute; left: -.5rem; top: 1.05rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--era); }
.theme-list a { display: block; padding: .5rem 0; text-decoration: none; color: var(--ink); }
.theme-list small { display: block; font-family: var(--sans); color: var(--era); font-size: .78rem; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; font-family: var(--sans); font-size: .9rem; background: var(--bg2); padding: .8rem 1rem; border-radius: 10px; position: sticky; top: 4.2rem; z-index: 5; }
.filters label { display: flex; flex-direction: column; gap: .2rem; }
.filters select, .filters input { font: inherit; padding: .35rem .5rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
#f-count { color: var(--muted); margin-left: auto; }
.master-tl { list-style: none; padding: 0; margin-top: 1rem; }
.master-tl li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0 1rem; padding: .55rem 0 .55rem .8rem; border-left: 4px solid var(--era); border-bottom: 1px solid var(--line); }
.master-tl .y { font-family: var(--sans); font-weight: 700; color: var(--era); font-size: .9rem; padding-top: .15rem; }
.master-tl a { grid-column: 2; font-family: var(--sans); font-size: .8rem; }
.master-tl li[hidden] { display: none; }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 16px 3rem; text-align: center; font-family: var(--sans); font-size: .85rem; color: var(--muted); }
.site-footer p { max-width: 50rem; margin: .4rem auto; }

@media (max-width: 600px) {
  body { font-size: 18px; }
  .site-header { position: static; }
  html { scroll-padding-top: 1rem; }
  .letters, .filters { top: 0; }
  .prevnext { flex-direction: column; }
  .prevnext a { max-width: none; }
  .master-tl li { grid-template-columns: 1fr; }
  .master-tl a { grid-column: 1; }
  .historians { padding: .2rem 1rem 1rem; }
}

@media print {
  .site-header, .prevnext, aside.toc, .site-footer, .skip, .map-toggle, .filters, .letters { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  article.topic, article.era-page { display: block; }
  a { color: #000; text-decoration: none; }
  figure.diagram { break-inside: avoid; border: 1px solid #999; }
  figure.diagram.wide { margin-right: 0 !important; }
}

/* protestant path */
.path-list { list-style: none; padding: 0; counter-reset: p; border-left: 3px solid var(--line); margin-left: .5rem; }
.path-list li { position: relative; padding: 0 0 1.4rem 1.4rem; }
.path-list li::before { content: ""; position: absolute; left: -.6rem; top: .35rem; width: .9rem; height: .9rem; border-radius: 50%; background: var(--era); }
.path-list .bridge { margin: 0 0 .4rem; color: var(--ink2); font-style: italic; font-size: .95rem; }
.path-list a { display: block; padding: .8rem 1rem; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--era); border-radius: 10px; text-decoration: none; color: var(--ink); }
.path-list a:hover { background: var(--bg2); }
.path-list small { display: block; font-family: var(--sans); color: var(--era); font-size: .78rem; }
.path-list strong { display: block; font-size: 1.15rem; }
.path-list span { color: var(--ink2); font-size: .95rem; }
