/* Remarriage Master Research v5 — Editorial scholarly stylesheet */

:root {
  --bg: #FBF8F3;
  --bg-alt: #F4EFE6;
  --ink: #1F1B16;
  --ink-soft: #4A4239;
  --ink-mute: #7A7064;
  --rule: #D8CFBF;
  --rule-soft: #E8E0CF;
  --accent: #6B2C2C;          /* deep oxblood */
  --accent-soft: #8B3D3D;
  --gold: #A88339;            /* ochre */
  --gold-soft: #C9A968;

  --serif-display: "Cormorant Garamond", "EB Garamond", "Noto Serif TC", Georgia, serif;
  --serif-body: "Source Serif 4", "Source Serif Pro", "Lora", "Noto Serif TC", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --tc: "Noto Serif TC", "LXGW WenKai TC", "Source Han Serif TC", "PingFang TC", serif;

  --measure: 720px;
  --measure-wide: 920px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 18px;
  line-height: 1.7;
  font-feature-settings: "kern", "liga", "onum";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold-soft); color: var(--ink); }

/* ── Header / Nav ──────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 248, 243, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule-soft);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-family: var(--serif-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand svg { color: var(--accent); }
.brand .v { color: var(--ink-mute); font-style: italic; font-size: 14px; }
.site-nav {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  margin-left: 24px;
  transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--accent); }

/* ── Layout containers ─────────────────────────── */
.container { max-width: var(--measure); margin: 0 auto; padding: 0 28px; }
.container-wide { max-width: var(--measure-wide); margin: 0 auto; padding: 0 28px; }
.section { padding: 96px 0; border-top: 1px solid var(--rule-soft); }
.section:first-of-type { border-top: 0; }

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 18px;
}

h1, h2, h3, h4 {
  font-family: var(--serif-display);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
}

/* ── Hero ──────────────────────────────────────── */
.hero { padding: 120px 0 80px; }
.hero h1 {
  font-size: clamp(40px, 6.4vw, 68px);
  line-height: 1.05;
  margin: 0 0 28px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.hero h1 .em-dash { color: var(--accent); font-style: italic; }
.hero .meta {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  margin: 0 0 8px;
  text-transform: uppercase;
}
.hero .meta span + span::before {
  content: "·";
  margin: 0 10px;
  color: var(--rule);
}
.hero .author {
  font-family: var(--serif-body);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 16px;
  margin: 0 0 36px;
}
.hero .lede {
  font-size: 21px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 44px;
  max-width: 660px;
  font-family: var(--serif-body);
}
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 14px 22px;
  text-decoration: none;
  border-radius: 2px;
  transition: all 0.18s ease;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-ghost:hover { background: var(--accent); color: var(--bg); }
.btn .arrow { transition: transform 0.18s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ── North Stars ──────────────────────────────── */
.northstars { background: var(--bg-alt); }
.northstars .container-wide { padding-top: 0; padding-bottom: 0; }
.ns-grid { display: grid; grid-template-columns: 1fr; gap: 56px; }
@media (min-width: 880px) { .ns-grid { grid-template-columns: 1fr 1fr; gap: 64px; } }
.ns-card { padding: 0; }
.ns-quote {
  font-family: var(--tc);
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 18px;
  font-weight: 500;
  border-left: 2px solid var(--gold);
  padding-left: 22px;
  letter-spacing: 0.02em;
}
.ns-source {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 16px 24px;
}
.ns-gloss {
  font-family: var(--serif-body);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 0 24px;
  max-width: 460px;
}

/* ── What this covers ─────────────────────────── */
.covers .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  margin-top: 48px;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.stat {
  padding: 28px 26px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat .num {
  font-family: var(--serif-display);
  font-size: 38px;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 500;
}
.stat .label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.covers .feature-list {
  margin-top: 52px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule-soft);
}
.covers .feature-list li {
  padding: 18px 0 18px 30px;
  border-bottom: 1px solid var(--rule-soft);
  position: relative;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.covers .feature-list li::before {
  content: "§";
  font-family: var(--serif-display);
  color: var(--accent);
  position: absolute;
  left: 0;
  top: 18px;
  font-size: 18px;
  font-style: italic;
}

/* ── Pathways ─────────────────────────────────── */
.pathways .pcards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 48px;
}
@media (min-width: 880px) { .pathways .pcards { grid-template-columns: repeat(3, 1fr); } }
.pcard {
  padding: 32px 28px;
  border: 1px solid var(--rule);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.pcard .ptag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
  font-weight: 500;
}
.pcard h3 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 14px;
  color: var(--ink);
}
.pcard p {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 18px;
  line-height: 1.6;
}
.pcard .pgo {
  margin-top: auto;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* ── Long-form prose ──────────────────────────── */
.prose {
  font-family: var(--serif-body);
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--serif-display);
  color: var(--ink);
  letter-spacing: -0.005em;
  margin: 1.6em 0 0.5em;
  line-height: 1.25;
  font-weight: 500;
}
.prose h1 { font-size: 36px; margin-top: 0; }
.prose h2 {
  font-size: 28px;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--rule-soft);
}
.prose h3 { font-size: 22px; color: var(--accent); }
.prose h4 { font-size: 18px; color: var(--ink-soft); font-style: italic; }
.prose p { margin: 1em 0; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }
.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-soft);
  transition: all 0.15s ease;
}
.prose a:hover { color: var(--accent-soft); border-bottom-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 1em 0; }
.prose li { margin: 0.4em 0; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 22px;
  border-left: 2px solid var(--gold);
  color: var(--ink-soft);
  font-style: italic;
}
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 2px;
  color: var(--accent);
}
.prose pre {
  background: var(--bg-alt);
  padding: 18px 20px;
  overflow-x: auto;
  border-left: 2px solid var(--rule);
  font-size: 14px;
  line-height: 1.6;
}
.prose pre code { background: transparent; padding: 0; color: var(--ink); }
.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.4em 0;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
  margin: 1.6em 0;
  font-family: var(--serif-body);
}
.prose th, .prose td {
  border: 1px solid var(--rule);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--bg-alt);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

/* anchors created by markdown-it-anchor */
.prose .header-anchor {
  color: var(--rule);
  text-decoration: none;
  border: 0;
  font-weight: 400;
  margin-left: 8px;
  font-size: 0.7em;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.prose h1:hover .header-anchor,
.prose h2:hover .header-anchor,
.prose h3:hover .header-anchor,
.prose h4:hover .header-anchor { opacity: 1; }

/* Audit treatment — slightly more compact */
.audit-section .prose { font-size: 16px; line-height: 1.65; }
.audit-section .prose h1 { font-size: 32px; }
.audit-section .prose h2 { font-size: 24px; }
.audit-section .prose h3 { font-size: 19px; }
.audit-section .prose table { font-size: 14px; }
.audit-section .prose table th, .audit-section .prose table td { padding: 8px 12px; }

/* The score table — make it prominent */
.audit-section .prose table:first-of-type {
  margin: 1.8em 0;
  font-size: 15px;
}
.audit-section .prose table:first-of-type th {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.audit-section .prose table:first-of-type tr:last-child {
  background: var(--bg-alt);
  font-weight: 600;
}
.audit-section .prose table:first-of-type tr:last-child td {
  border-top: 2px solid var(--accent);
  font-family: var(--sans);
}

/* ── Full Document section ─────────────────────── */
.full-access .access-card {
  border: 1px solid var(--rule);
  background: var(--bg-alt);
  padding: 36px 32px;
  margin-top: 40px;
}
.full-access .access-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
}
.full-access .access-card p {
  margin: 0 0 22px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.full-access .access-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* ── Footer ───────────────────────────────────── */
.site-footer {
  margin-top: 80px;
  padding: 60px 0 80px;
  border-top: 1px solid var(--rule);
  background: var(--bg-alt);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.7;
}
.site-footer .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 22px;
}
.site-footer .meta-row span { letter-spacing: 0.03em; }
.site-footer .disclaimer {
  font-family: var(--serif-body);
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 640px;
  line-height: 1.7;
}

/* Section heading style */
.section-head { margin-bottom: 28px; }
.section-head h2 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.section-head .sublede {
  font-family: var(--serif-body);
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 600px;
  line-height: 1.6;
}

/* ── Full document page specific ──────────────── */
.fulldoc-header {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--rule);
}
.fulldoc-header .back {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 24px;
}
.fulldoc-header .back:hover { color: var(--accent-soft); }
.fulldoc-header h1 {
  font-size: clamp(32px, 4.6vw, 48px);
  margin: 0 0 12px;
  line-height: 1.1;
  font-weight: 500;
}
.fulldoc-header .meta {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  text-transform: uppercase;
}

.fulldoc-body { padding: 60px 0 120px; }

/* mermaid container */
.mermaid {
  background: var(--bg);
  padding: 24px;
  border: 1px solid var(--rule);
  margin: 1.6em 0;
  text-align: center;
  overflow-x: auto;
}

/* Responsive */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .hero { padding: 80px 0 56px; }
  .section { padding: 72px 0; }
  .nav-inner { padding: 12px 20px; }
  .site-nav a { margin-left: 14px; font-size: 12px; }
  .container, .container-wide { padding: 0 22px; }
  .prose table { font-size: 13px; }
  .prose th, .prose td { padding: 8px 10px; }
}

@media (max-width: 520px) {
  .site-nav { display: none; }
  .nav-inner { justify-content: flex-start; }
  .stat .num { font-size: 32px; }
}
