/* Colours taken from the church sign (maroon on white siding) and the tree-and-book logo.
   Headings in a classic Caslon serif to match the logo lettering; body in a plain sans for reading. */
:root {
  --paper: #ffffff;
  --panel: #f7f3f2;
  --ink: #221d1c;
  --muted: #5f5754;
  --rule: #e4dcd9;
  --maroon: #7a2e33;
  --maroon-deep: #5c1f24;
  --on-maroon: #f8efee;
  --link: #8a3239;
  --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 40rem;
  --wide: 66rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1817;
    --panel: #242020;
    --ink: #ede7e4;
    --muted: #aaa09c;
    --rule: #3a3331;
    --maroon: #6a272c;
    --maroon-deep: #4a1a1e;
    --on-maroon: #f3e7e6;
    --link: #e2a7a9;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.65;
}
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* Header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header .inner {
  max-width: var(--wide); margin: 0 auto; padding: .9rem 16px;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem 2rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; }
.brand img { width: 2.6rem; height: auto; }
@media (prefers-color-scheme: dark) { .brand img { filter: brightness(2.1) saturate(.6); } }
.brand-name { font-family: var(--serif); font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; line-height: 1.2; }
.brand-name small { display: block; font-family: var(--sans); font-size: .8rem; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: 1rem; padding: .3rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--maroon); }
@media (prefers-color-scheme: dark) { .site-nav a[aria-current="page"] { border-bottom-color: var(--link); } }

/* Page photo */
.page-photo { margin: 0; height: clamp(220px, 36vw, 460px); overflow: hidden; background: var(--panel); }
.page-photo img { width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%); }

/* Layout */
main { padding: 2.75rem 16px 4.5rem; }
.prose { max-width: var(--measure); margin: 0 auto; }
.wide { max-width: var(--wide); margin: 0 auto; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 2.7rem); margin: 0 0 1.25rem; }
h2 { font-size: 1.55rem; margin: 2.75rem 0 .75rem; }
h3 { font-size: 1.2rem; margin: 2rem 0 .5rem; }
p { margin: 0 0 1.1rem; }
.lede { font-size: 1.2rem; color: var(--muted); }
.summary { font-size: 1.12rem; background: var(--panel); padding: 1.1rem 1.3rem; border-radius: 4px; margin: 1.25rem 0 1.75rem; }

/* Scripture */
blockquote {
  margin: 1.1rem 0 1.4rem; padding: .1rem 0 .1rem 1.1rem;
  border-left: 2px solid var(--rule);
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.7;
}
blockquote cite { display: block; margin-top: .3rem; font-family: var(--sans); font-style: normal; font-size: .9rem; color: var(--muted); }
.key-verse { border-left-color: var(--maroon); font-size: 1.25rem; font-style: italic; margin: 1.5rem 0 2rem; }
@media (prefers-color-scheme: dark) { .key-verse { border-left-color: var(--link); } }

/* Schedule list (home + ministries) */
.schedule { margin: 1rem 0 2rem; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.schedule li { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: .25rem 1rem; padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.schedule .day { color: var(--muted); }
.schedule .time { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 520px) {
  .schedule li { grid-template-columns: 1fr auto; }
  .schedule .day { grid-column: 1 / -1; font-size: .9rem; }
}
.visit { background: var(--panel); padding: 1.25rem 1.4rem; border-radius: 4px; }
.visit h2 { margin-top: 0; font-size: 1.3rem; }
.visit p:last-child { margin-bottom: 0; }

/* On-this-page links (Gospel) */
.toc { margin: 0 0 2.25rem; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: 1rem; }
.toc a { color: var(--muted); }

/* Ministries */
.ministry { padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.ministry:first-of-type { border-top: 0; padding-top: .25rem; }
.ministry h2 { margin: 0 0 .15rem; font-size: 1.35rem; }
.ministry .when { color: var(--muted); font-size: 1rem; margin: 0 0 .5rem; }
.ministry p:last-child { margin-bottom: 0; }

/* 1689 Confession */
.docs { max-width: var(--wide); margin: 3.5rem auto 0; padding-top: 2rem; border-top: 1px solid var(--rule); }
.doc-tabs { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; margin-bottom: 2.25rem; border-bottom: 1px solid var(--rule); }
.doc-tabs a { padding: .5rem 0 .6rem; margin-bottom: -1px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; font-size: 1.05rem; }
.doc-tabs a:hover { color: var(--ink); }
.doc-tabs a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--maroon); }
@media (prefers-color-scheme: dark) { .doc-tabs a[aria-current="true"] { border-bottom-color: var(--link); } }
.js-tabs .doc-panel:not(.active) { display: none; }
.doc-panel { scroll-margin-top: 1rem; }
.creed { max-width: var(--measure); margin-top: 3rem; }
.js-tabs .creed { margin-top: 0; }
.creed h2 { margin: 0 0 .2rem; }
.creed-note { color: var(--muted); font-size: .95rem; margin-bottom: 1.5rem; }
.creed-text p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.8; }
.lbcf { max-width: var(--wide); }
.lbcf-head { max-width: var(--measure); }
.lbcf-head h2 { margin-top: 0; }
.lbcf-head > p { color: var(--muted); font-size: 1rem; }
.lbcf-tools { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 1.25rem; }
.lbcf-tools > div { flex: 1 1 15rem; min-width: 0; }
.lbcf-tools label { display: block; font-size: .95rem; color: var(--muted); margin-bottom: .35rem; }
.lbcf-tools .search { max-width: none; }
.lbcf-count { min-height: 1.5em; margin: .75rem 0 0; font-size: .95rem; color: var(--muted); }
.lbcf-layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 3rem; margin-top: 1.5rem; align-items: start; }
.lbcf-toc { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; font-size: .92rem; line-height: 1.35; padding-right: .5rem; }
.lbcf-toc ol { list-style: none; margin: 0; padding: 0; }
.lbcf-toc li { margin: 0; }
.lbcf-toc a { display: grid; grid-template-columns: 1.8rem 1fr; padding: .3rem 0; color: var(--ink); text-decoration: none; }
.lbcf-toc a:hover { color: var(--link); }
.lbcf-toc .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.lbcf-jump { display: none; }
.lbcf-text { max-width: var(--measure); }
.lbcf-chapter { padding-bottom: 1rem; scroll-margin-top: 1rem; }
.lbcf-chapter h3 { font-size: 1.45rem; margin: 2.25rem 0 1rem; }
.lbcf-chapter:first-child h3 { margin-top: 0; }
.lbcf-chapter h3 .num { display: block; font-family: var(--sans); font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
.lbcf-para { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); column-gap: .5rem; margin-bottom: 1.1rem; scroll-margin-top: 1rem; }
.lbcf-para .pnum { color: var(--muted); font-size: .9rem; text-decoration: none; padding-top: .2rem; font-variant-numeric: tabular-nums; }
.lbcf-para .pnum:hover { color: var(--link); }
.lbcf-para .ptext { margin: 0; }
.lbcf-para:target .ptext { background: var(--panel); box-shadow: 0 0 0 .4rem var(--panel); }
.lbcf mark { background: #f3dcc0; color: inherit; padding: 0 .05em; }
@media (prefers-color-scheme: dark) { .lbcf mark { background: #6b4a2a; } }
.proofs { grid-column: 2; margin-top: .4rem; font-size: .95rem; }
.proofs > summary { cursor: pointer; color: var(--link); width: fit-content; }
.proofs ul { list-style: none; margin: .5rem 0 .25rem; padding: 0 0 0 .9rem; border-left: 2px solid var(--rule); }
.proofs li { margin: .25rem 0; }
.proofs li summary { cursor: pointer; width: fit-content; }
.proofs li p { margin: .3rem 0 .6rem; font-family: var(--serif); font-size: .98rem; line-height: 1.65; }
.proofs sup { color: var(--muted); font-family: var(--sans); font-size: .7em; }
@media (max-width: 860px) {
  .lbcf-layout { grid-template-columns: minmax(0, 1fr); }
  .lbcf-toc { display: none; }
  .lbcf-jump { display: block; }
}
@media (max-width: 520px) {
  .lbcf-para { grid-template-columns: minmax(0, 1fr); }
  .lbcf-para .pnum { padding: 0; }
  .proofs { grid-column: 1; }
}

/* Calendar */
.calendar-head { max-width: var(--measure); margin: 3rem auto 1rem; }
.calendar-head h2 { margin: 0 0 .15rem; }
.calendar-head p { color: var(--muted); margin: 0; font-size: 1rem; }
.calendar { background: #fff; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.calendar iframe { display: block; width: 100%; height: 42rem; border: 0; }
.cal-note { margin-top: .9rem; font-size: 1rem; }
@media (max-width: 640px) { .calendar iframe { height: 34rem; } }

/* Sermons */
.sermon-tools { margin-top: 1.5rem; }
.sermon-tools label { display: block; font-size: .95rem; color: var(--muted); margin-bottom: .35rem; }
.search { width: 100%; max-width: 24rem; padding: .6rem .8rem; font: inherit; font-size: 1rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
.sermon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 2rem 1.5rem; margin-top: 2rem; }
.sermon { min-width: 0; }
.sermon button { all: unset; cursor: pointer; display: block; width: 100%; position: relative; aspect-ratio: 16/9; background: #000; border-radius: 4px; overflow: hidden; }
.sermon button img { width: 100%; height: 100%; object-fit: cover; }
.sermon button:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.sermon .play {
  position: absolute; left: .75rem; bottom: .75rem; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: rgba(92, 31, 36, .9); display: grid; place-items: center;
}
.sermon .play::after { content: ""; border-style: solid; border-width: .5rem 0 .5rem .8rem; border-color: transparent transparent transparent #fff; margin-left: .2rem; }
.sermon iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; border-radius: 4px; }
.sermon h3 { margin: .7rem 0 .2rem; font-family: var(--sans); font-weight: 600; font-size: 1.02rem; line-height: 1.35; }
.sermon .date { color: var(--muted); font-size: .9rem; }
.more { margin: 2.5rem auto 0; display: block; padding: .6rem 1.3rem; font: inherit; font-size: 1rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); cursor: pointer; }
.more:hover { border-color: var(--muted); }

/* Footer */
.site-footer { background: var(--maroon); color: var(--on-maroon); font-size: 1rem; }
.site-footer a { color: inherit; }
.site-footer .inner { max-width: var(--wide); margin: 0 auto; padding: 2.75rem 16px 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.75rem; }
.site-footer h2 { font-size: 1.05rem; margin: 0 0 .5rem; color: #fff; }
.site-footer p { margin: 0 0 .3rem; }
.site-footer .foot-brand img { width: 3rem; margin-bottom: .75rem; }
.site-footer .welcome { max-width: var(--wide); margin: 0 auto; padding: 1rem 16px 2rem; border-top: 1px solid rgba(255,255,255,.18); font-family: var(--serif); font-style: italic; opacity: .9; }

@media (max-width: 640px) {
  main { padding-top: 2rem; }
  .site-header .inner { padding-block: .75rem; }
  .site-nav ul { gap: .1rem 1.1rem; }
  .site-nav a { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
html { scroll-behavior: smooth; }
