/* Apologia Library — scholarly-poster layout on The Full Measure design tokens
 * (parchment/crimson/gold, Playfair Display + Lora — see docs/DESIGN_SYSTEM.md).
 */

:root {
  --bg: #fbf8f2;
  --bg-card: #fffdfa;
  --bg-hero: #f2ede1;
  --ink: #121010;
  --ink-soft: #555550;
  --ink-mute: #6b6258;
  --rule: #d9d3c4;
  --rule-dk: #c2b9a4;
  --gold: #8a6c2a;
  --gold-dk: #6e5518;
  --gold-soft: #b09648;
  --accent: #6b1414;
  --accent-soft: #8e2e2e;
  --accent-deep: #561010;

  --c-natural-theology: #55622a;
  --c-worldview:        #3e3570;
  --c-historical-critical: #6b1414;
  --c-science-faith:    #1f5a6a;

  --a-strong: #355a35;
  --a-live:   #8a6b1a;
  --a-under-pressure: #a85a1a;
  --a-fringe: #5a3a5a;

  --serif: "Playfair Display", Georgia, serif;
  --sans:  "Lora", Georgia, serif;

  --shadow-card: 0 2px 14px -8px rgba(40, 20, 8, 0.28), 0 1px 2px rgba(40, 20, 8, 0.03);
  --shadow-card-hover: 0 18px 44px -28px rgba(40, 20, 8, 0.40), 0 1px 2px rgba(40, 20, 8, 0.04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: 0.005em; }
h1 { font-size: 3.4rem; line-height: 1.05; margin: 0 0 0.4rem; font-weight: 500; }
h2 { font-size: 1.9rem; margin: 2.5rem 0 0.8rem; font-weight: 500; color: var(--ink); }
h3 { font-size: 1.3rem; margin: 1.4rem 0 0.4rem; font-weight: 600; color: var(--ink); }
h4 { font-size: 1.05rem; margin: 1rem 0 0.3rem; color: var(--ink-soft); font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }

p { margin: 0.7rem 0; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--gold-soft); }
a:hover { color: var(--accent-soft); border-bottom-style: solid; }

code { background: #e8ddbe; padding: 0.08em 0.35em; border-radius: 2px; font-size: 0.9em; font-family: ui-monospace, "SF Mono", Consolas, monospace; }
blockquote { border-left: 3px solid rgba(107, 20, 20, 0.32); margin: 1rem 0; padding: 0.2rem 1.2rem; color: var(--ink-soft); font-style: italic; font-family: var(--sans); font-size: 1.05rem; }
cite.src { font-style: normal; color: var(--ink-soft); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

section { margin: 2.5rem 0; }

.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.8rem 5rem; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 2rem 1.8rem 5rem; }

/* ─── Site header ──────────────────────────────────────── */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--rule-dk);
  padding: 0.7rem 1.8rem;
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(42, 31, 16, 0.04);
}
.site-header .brand { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); border: none; font-weight: 600; }
.site-header .brand b { color: var(--accent); font-weight: 600; }
.site-header nav a { margin-left: 1.3rem; font-size: 0.78rem; color: var(--ink-soft); border: none; text-transform: uppercase; letter-spacing: 0.18em; font-weight: 500; font-family: var(--serif); }
.site-header nav a:hover { color: var(--accent); }

/* ─── Poster hero ──────────────────────────────────────── */
.poster-hero {
  background: var(--bg-hero);
  border-bottom: 3px double var(--rule-dk);
  margin: -2rem -1.8rem 2rem;
  padding: 3rem 2.5rem 2.5rem;
  position: relative;
}
.poster-hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--cat-color, var(--gold));
}
.poster-hero .meta {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin-bottom: 1.2rem; font-size: 0.82rem;
}
.poster-hero h1 { font-size: 3.2rem; line-height: 1.02; max-width: 900px; }
.poster-hero .subtitle {
  font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--ink-soft);
  margin: 0.6rem 0 0; max-width: 820px; line-height: 1.4;
}

.stats-bar {
  display: flex; gap: 2.5rem; flex-wrap: wrap; margin-top: 1.8rem;
  padding-top: 1.2rem; border-top: 1px solid var(--rule-dk);
}
.stat { display: flex; flex-direction: column; }
.stat .num { font-family: var(--serif); font-size: 1.8rem; color: var(--gold-dk); line-height: 1; }
.stat .lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); margin-top: 0.25rem; }

/* ─── Core question ────────────────────────────────────── */
.core-question {
  font-family: var(--serif); font-style: italic; font-size: 1.6rem; line-height: 1.45;
  text-align: center; margin: 3rem auto; max-width: 780px;
  padding: 1.5rem 2rem; color: var(--ink);
  border-top: 2px solid var(--rule-dk); border-bottom: 2px solid var(--rule-dk);
  position: relative;
}
.core-question::before, .core-question::after {
  position: absolute; font-size: 3rem; color: var(--gold-soft); font-family: serif; line-height: 1;
}
.core-question::before { content: "“"; left: -0.5rem; top: 0.5rem; }
.core-question::after  { content: "”"; right: -0.5rem; bottom: 0; }

/* ─── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.2rem 0.7rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
  color: #fff; border-radius: 2px;
}
.cat-natural-theology { background: var(--c-natural-theology); }
.cat-worldview        { background: var(--c-worldview); }
.cat-historical-critical { background: var(--c-historical-critical); }
.cat-science-faith    { background: var(--c-science-faith); }

.level-beginner::before  { content: "✧ "; color: var(--gold); }
.level-intermediate::before { content: "✦ "; color: var(--gold); }
.level-advanced::before  { content: "❧ "; color: var(--gold); }
.level {
  font-size: 0.75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem; background: rgba(255,255,255,0.5); border: 1px solid var(--rule-dk); border-radius: 2px;
}

.assessment {
  display: inline-block; padding: 0.22rem 0.75rem; border-radius: 12px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: #fff;
}
.a-strong { background: var(--a-strong); }
.a-live   { background: var(--a-live); }
.a-under-pressure { background: var(--a-under-pressure); }
.a-fringe { background: var(--a-fringe); }

/* ─── Two-column grid (wide layout) ────────────────────── */
.cols-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; gap: 1.5rem; } }

/* ─── The argument block ───────────────────────────────── */
.premise-box {
  background: var(--bg-card);
  border: 1px solid var(--rule-dk);
  border-left: 5px solid var(--gold);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  font-family: var(--serif); font-size: 1.2rem; line-height: 1.6;
  box-shadow: var(--shadow-card);
}
.premise-box ol { padding-left: 1.2rem; margin: 0.3rem 0; }
.premise-box li { margin: 0.5rem 0; }
.premise-box li::marker { color: var(--gold); font-weight: 600; }

/* ─── Scholarly Anchors card grid ──────────────────────── */
.anchors-panel {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-hero) 100%);
  border: 1px solid var(--rule-dk); padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-card);
}
.anchors-panel h3 {
  margin: 0 0 0.8rem; font-size: 1.1rem; font-family: var(--sans);
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); font-weight: 600;
}
.anchors-list { list-style: none; padding: 0; margin: 0; columns: 1; }
.anchors-list li {
  padding: 0.45rem 0; border-bottom: 1px dotted var(--rule);
  font-size: 0.92rem; line-height: 1.4;
}
.anchors-list li:last-child { border-bottom: 0; }
.anchors-list .cite { font-family: var(--serif); font-size: 1rem; color: var(--ink); }
.anchors-list a { border: none; }

/* ─── Views at a glance (visual cards, not table) ─────── */
.views-matrix-grid {
  display: grid; gap: 1rem; margin: 1.5rem 0;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.view-card-mini {
  background: var(--bg-card); border: 1px solid var(--rule-dk);
  padding: 1.1rem 1.3rem; position: relative;
  box-shadow: var(--shadow-card);
  transition: transform 140ms, box-shadow 140ms;
}
.view-card-mini:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.view-card-mini::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--view-color, var(--gold));
}
.view-card-mini .number {
  font-family: var(--serif); font-size: 2.2rem; color: var(--gold-soft); line-height: 1; margin-bottom: 0.3rem;
}
.view-card-mini h4 { margin: 0 0 0.4rem; font-family: var(--serif); font-size: 1.25rem; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink); }
.view-card-mini .proponents { font-size: 0.82rem; color: var(--ink-soft); margin: 0.3rem 0; line-height: 1.4; }
.view-card-mini .proponents a { border: none; }
.view-card-mini .jump { display: inline-block; margin-top: 0.6rem; font-size: 0.82rem; color: var(--gold-dk); border: none; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.view-card-mini .jump::after { content: " →"; }

/* ─── Full view section ────────────────────────────────── */
.view {
  background: var(--bg-card);
  border: 1px solid var(--rule-dk);
  padding: 2rem 2.3rem 1.8rem;
  margin: 2rem 0;
  position: relative;
  box-shadow: var(--shadow-card);
}
.view::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--view-color, var(--gold));
}
.view > .view-number {
  position: absolute; top: -0.5rem; left: 2rem; background: var(--bg);
  font-family: var(--serif); font-size: 0.85rem; color: var(--gold-dk); padding: 0 0.6rem;
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600;
}
.view > h2 {
  margin: 0 0 0.3rem; font-size: 2.1rem;
}
.view .view-meta {
  font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 1.2rem;
  display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center;
  padding-bottom: 1rem; border-bottom: 1px solid var(--rule);
}
.view h3 { font-size: 1rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin-top: 1.4rem; font-weight: 600; }
.view h3:first-of-type { margin-top: 0.6rem; }
.view p, .view li { max-width: 72ch; }

.assessment-verdict {
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: var(--serif); font-size: 1.1rem; color: var(--ink);
}
.assessment-verdict strong { color: var(--gold-dk); }

/* ─── Scripture cards ──────────────────────────────────── */
.scripture-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem; margin: 1.2rem 0;
}
.scripture-card {
  background: var(--bg-card); border: 1px solid var(--rule-dk);
  padding: 0.9rem 1.1rem; box-shadow: var(--shadow-card);
}
.scripture-card .ref { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--gold-dk); margin-bottom: 0.2rem; }
.scripture-card .ref a { border: none; color: var(--gold-dk); }
.scripture-card .ref a:hover { color: var(--ink); }
.scripture-card .note { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.4; }

/* ─── Scholars table ───────────────────────────────────── */
.scholars-table, table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; background: var(--bg-card); }
.scholars-table th, .scholars-table td, table th, table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--rule); text-align: left; }
.scholars-table th, table th { background: var(--bg-hero); font-family: var(--serif); font-weight: 600; }

/* ─── Related debates ──────────────────────────────────── */
.related {
  background: var(--bg-hero); padding: 1.4rem 1.8rem; margin: 2.5rem 0;
  border-left: 4px solid var(--gold); box-shadow: var(--shadow-card);
}
.related h3 { margin: 0 0 0.6rem; font-family: var(--sans); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.related ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; }
.related li a {
  display: inline-block; padding: 0.4rem 0.9rem; background: var(--bg-card);
  border: 1px solid var(--rule-dk); font-size: 0.92rem; border-bottom-style: solid;
}
.related li a:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* ─── Pastoral reflection ──────────────────────────────── */
.pastoral {
  border-top: 3px double var(--rule-dk); padding: 2.2rem 0 0; margin-top: 3.5rem;
  font-family: var(--serif); font-size: 1.15rem; color: var(--ink-soft); line-height: 1.75;
  max-width: 720px; margin-left: auto; margin-right: auto; text-align: center;
}
.pastoral::before {
  content: "Pastoral Reflection"; display: block; font-family: var(--sans); font-style: normal;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-mute);
  margin-bottom: 1rem; font-weight: 600;
}

/* ─── Index grid ───────────────────────────────────────── */
.intro-block {
  max-width: 820px; margin: 3rem auto 2.5rem; text-align: center;
}
.intro-block h1 { margin: 0 0 0.4rem; font-size: 3.6rem; }
.intro-block .tagline { font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--ink-soft); margin: 0.3rem 0 0; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 1.4rem 0;
}
.filter-bar button {
  background: var(--bg-card); border: 1px solid var(--rule-dk); color: var(--ink);
  padding: 0.4rem 1rem; font: inherit; font-size: 0.88rem; cursor: pointer; border-radius: 18px;
  transition: all 120ms;
}
.filter-bar button:hover { border-color: var(--accent); color: var(--accent); }
.filter-bar button.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

#search { width: 100%; max-width: 600px; display: block; margin: 0 auto 1rem;
  padding: 0.7rem 1.1rem; border: 1px solid var(--rule-dk); background: var(--bg-card);
  font: inherit; font-size: 1rem; border-radius: 3px; }
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(107,20,20,0.08); }

.poster-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.3rem; margin: 2rem 0;
}
.poster-card {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--rule-dk); padding: 1.3rem 1.4rem;
  transition: transform 120ms, border-color 120ms, box-shadow 120ms;
  display: flex; flex-direction: column; min-height: 240px;
  box-shadow: var(--shadow-card);
}
/* whole card is the tap target — the title link stretches over the card */
.poster-card h3 a::after { content: ""; position: absolute; inset: 0; }
.poster-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.poster-card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow-card-hover); }
.poster-card h3 { margin: 0.5rem 0 0.3rem; font-size: 1.4rem; }
.poster-card h3 a { color: var(--ink); border: none; }
.poster-card h3 a:hover { color: var(--gold-dk); }
.poster-card .subtitle { color: var(--ink-soft); font-size: 0.92rem; flex-grow: 1; margin: 0.3rem 0 0.9rem; line-height: 1.5; }
.poster-card .footer { font-size: 0.8rem; color: var(--ink-mute); display: flex; gap: 0.7rem; align-items: center; border-top: 1px solid var(--rule); padding-top: 0.6rem; }

/* ─── Footer ───────────────────────────────────────────── */
footer.site-footer {
  border-top: 1px solid var(--rule); margin-top: 4rem; padding: 2rem 1.5rem 2.4rem;
  font-size: 0.88rem; color: var(--ink-soft); text-align: center; background: var(--bg-hero);
}
footer.site-footer::before { content: "❦"; display: block; color: var(--gold); font-size: 1.1rem; margin-bottom: 0.9rem; }
footer.site-footer a { color: var(--ink-soft); }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 2.2rem; }
  .poster-hero h1 { font-size: 2.3rem; }
  h2 { font-size: 1.5rem; }
  .core-question { font-size: 1.2rem; padding: 1rem; margin: 2rem auto; }
  .container, .container-wide { padding: 1rem 1rem 3rem; }
  .poster-hero { padding: 2rem 1.2rem 1.8rem; margin: -1rem -1rem 1.5rem; }
  .view { padding: 1.3rem 1.4rem; }
  .view > h2 { font-size: 1.6rem; }
  .stats-bar { gap: 1.5rem; }
  .stat .num { font-size: 1.4rem; }
}
