/* Corrupt Church -- site styles.
   Register: serious, sober, editorial. One display/body serif, system sans
   for UI labels, one accent (oxblood). The one "signature" ornament is the
   pull quote (blockquote) with an accent rule -- don't add a second.
   Every text/background pairing below is checked by scripts/check-contrast.js;
   rerun it after changing any color token. */

@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* Color tokens -- light surfaces */
  --paper: #faf7f2;
  --paper-tint: #f1ebe2;
  --text: #1f1d22;
  --muted: #5b5660;
  --rule: #ddd4c8;
  --accent: #7a1f2b;        /* oxblood: links, button, labels */
  --accent-hover: #5c1720;
  --placeholder-bg: #fff3c4;
  --placeholder-text: #4a3b00;

  /* Dark surfaces (hero, footer) */
  --ink: #17161a;
  --ink-text: #f3ede4;
  --ink-muted: #bfb6ab;
  --ink-accent: #e8a3aa;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --measure: 42rem;
  --wide: 72rem;
  --gutter: 1rem;
  --space: 1.5rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.1875rem; /* 19px */
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

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

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 700; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.wrap--narrow { max-width: calc(var(--measure) + 2 * var(--gutter)); }

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--ink); color: var(--ink-text);
  padding: 0.5rem 1rem; font-family: var(--sans); z-index: 10;
}
.skip-link:focus { top: 0.5rem; color: var(--ink-text); }

/* ---- Header -------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.wordmark {
  font-family: var(--serif); font-weight: 700; font-size: 1.35rem;
  color: var(--text); text-decoration: none; letter-spacing: -0.01em; margin: 0;
}
a.wordmark:hover { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.nav a {
  font-family: var(--sans); font-size: 0.95rem; color: var(--text);
  text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); border-bottom-color: currentColor; }

/* ---- Dark-surface contract --------------------------------------------
   Any section with .on-dark inverts through these rules -- don't write
   per-section overrides for text, links, or buttons. */
.on-dark { background: var(--ink); color: var(--ink-text); }
.on-dark a { color: var(--ink-accent); }
.on-dark a:hover { color: var(--ink-text); }
.on-dark .eyebrow, .on-dark .meta { color: var(--ink-muted); }
.on-dark .wordmark { color: var(--ink-text); }
.on-dark :focus-visible { outline-color: var(--ink-accent); }
.on-dark .button { background: var(--ink-text); color: var(--ink); }
.on-dark .button:hover { background: #ffffff; color: var(--ink); }

/* ---- Shared UI ----------------------------------------------------- */
.eyebrow {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.75rem;
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }

.meta { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); margin: 0; }
.dek { font-size: 1.25rem; color: var(--muted); line-height: 1.45; margin: 0 0 1rem; }
.lead { font-size: 1.25rem; }
.badge {
  font-family: var(--sans); font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; background: var(--placeholder-bg); color: var(--placeholder-text);
  padding: 0.1rem 0.4rem; border-radius: 3px;
}

.button {
  display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 1rem;
  background: var(--accent); color: #ffffff; text-decoration: none;
  padding: 0.85rem 1.5rem; border-radius: 4px;
}
.button:hover { background: var(--accent-hover); color: #ffffff; }

/* Owner-supplied-content flags. Must be impossible to miss; check-content
   lists any that remain. */
.placeholder {
  background: var(--placeholder-bg); color: var(--placeholder-text);
  border-left: 4px solid #b38f00; padding: 0.75rem 1rem; font-family: var(--sans); font-size: 0.95rem;
}

/* ---- Hero ---------------------------------------------------------- */
.hero__inner { padding-top: clamp(3.5rem, 10vw, 7rem); padding-bottom: clamp(3.5rem, 10vw, 7rem); }
.hero__headline {
  font-size: clamp(2.1rem, 6vw, 3.75rem); line-height: 1.1; max-width: 18ch;
  letter-spacing: -0.015em; margin-bottom: 1.25rem;
}
.hero__subhead { font-size: clamp(1.15rem, 2.4vw, 1.4rem); color: var(--ink-muted); max-width: 36rem; margin: 0 0 2rem; line-height: 1.5; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin: 0; }
.hero__secondary { font-family: var(--sans); font-size: 1rem; }

/* ---- Sections & cards -------------------------------------------- */
.section { padding: 3rem 0; }
.section--tint { background: var(--paper-tint); }
.section__title {
  font-family: var(--sans); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 1.25rem;
}
.section__more { font-family: var(--sans); margin: 1.5rem 0 0; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 1.25rem 1.25rem 1.1rem; display: flex; flex-direction: column;
}
.section--tint .card { background: #fffdf9; }
.card__topic { font-family: var(--sans); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 0.5rem; }
.card__topic a { text-decoration: none; }
.card__title { font-size: 1.25rem; margin: 0 0 0.5rem; }
.card__title a { color: var(--text); text-decoration: none; }
.card__title a:hover { color: var(--accent); text-decoration: underline; }
.card__dek { font-size: 1rem; color: var(--muted); margin: 0 0 0.75rem; line-height: 1.5; flex: 1; }

.featured .card { padding: clamp(1.25rem, 4vw, 2.25rem); border-top: 4px solid var(--accent); }
.featured .card__title { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
.featured .card__dek { font-size: 1.15rem; }

.topic-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.topic-tile a {
  display: flex; flex-direction: column; gap: 0.35rem; height: 100%;
  padding: 1.1rem 1.2rem; border: 1px solid var(--rule); border-radius: 4px;
  text-decoration: none; color: var(--text); background: var(--paper);
}
.topic-tile a:hover { border-color: var(--accent); }
.topic-tile__name { font-weight: 700; font-size: 1.15rem; color: var(--accent); }
.topic-tile__desc { font-size: 0.975rem; color: var(--muted); line-height: 1.45; flex: 1; }
.topic-tile__count { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }

.empty { color: var(--muted); font-style: italic; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-family: var(--sans); margin: 2rem 0 0; }

/* ---- Pages & articles -------------------------------------------- */
.page, .article { padding-top: 2.5rem; padding-bottom: 3rem; }
.page__header { padding-top: 2.5rem; margin-bottom: 2rem; }
.page .page__header { padding-top: 0; }
.article__header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.article__footer { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }

.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { font-size: 1.55rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.8em; }
.prose li + li { margin-top: 0.35em; }
.prose img { display: block; margin: 2rem auto; border-radius: 3px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* The signature ornament: pull quote with an accent rule. */
.prose blockquote {
  margin: 2rem 0; padding: 0.25rem 0 0.25rem 1.5rem;
  border-left: 3px solid var(--accent);
  font-size: 1.3rem; line-height: 1.5; font-style: italic; color: var(--text);
}
.prose blockquote p { margin: 0; }

.prose table { border-collapse: collapse; width: 100%; font-size: 1rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 0.5rem 0.75rem; text-align: left; }

/* Footnotes (markdown-it-footnote) -- the "Sources" list at the end. */
.prose .footnotes-sep { border: 0; border-top: 1px solid var(--rule); margin-top: 3rem; }
.prose .footnotes { font-size: 0.95rem; color: var(--muted); }
.prose .footnotes::before { content: "Sources"; display: block; font-family: var(--sans); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.5rem; }
.prose .footnote-ref a, .prose .footnote-backref { text-decoration: none; }

/* ---- Footer ------------------------------------------------------- */
.site-footer { margin-top: 0; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem 3rem; padding-top: 2.5rem; padding-bottom: 2.5rem; }
.site-footer__tagline { font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); margin: 0.25rem 0 0.75rem; }
.site-footer__byline { font-size: 0.95rem; color: var(--ink-muted); margin: 0; }
.footer-nav { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, auto); gap: 0.4rem 2rem; font-family: var(--sans); font-size: 0.95rem; }

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