/* ============================================================
   Heretic Logic — Stylesheet
   ============================================================ */

:root {
  /* Colours */
  --bg:           #f5f1ea;
  --bg-card:      #ffffff;
  --text:         #1a1917;
  --text-muted:   #6b6560;
  --accent:       #8b1a1a;
  --accent-hover: #a82020;
  --border:       #ddd8cf;
  --header-bg:    #111110;
  --header-text:  #ede9e1;
  --footer-bg:    #1e1c1a;
  --footer-text:  #a09890;

  /* Typography */
  --font-serif: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing scale — all spacing derives from these four values */
  --sp-xs:  0.5rem;   /*  8px */
  --sp-sm:  1rem;     /* 16px */
  --sp-md:  1.75rem;  /* 28px */
  --sp-lg:  3rem;     /* 48px */

  /* Type scale */
  --text-xs:   0.78rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.05rem;
  --text-lg:   1.3rem;
  --text-xl:   1.75rem;
  --text-2xl:  2rem;

  /* Layout */
  --measure: 68ch;
  --radius:  4px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }

/* ── Base ── */
html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Container ── */
.container {
  width: min(1140px, 100% - 3rem);
  margin-inline: auto;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: var(--sp-sm) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--accent);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.site-brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--header-text);
  text-decoration: none;
}

.site-title:hover { color: #fff; }

.site-tagline {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: #7a746c;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Nav ── */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: #a09890;
  text-decoration: none;
  padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--header-text);
  background: rgba(255,255,255,0.07);
}

.nav-link.active {
  color: #e8c4a0;
  background: rgba(139, 26, 26, 0.35);
}

/* ============================================================
   Main
   ============================================================ */
.site-main {
  flex: 1;
  padding: var(--sp-lg) 0;
}

/* ============================================================
   Homepage Hero
   ============================================================ */
.hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-lg);
  margin-bottom: var(--sp-lg);
  max-width: var(--measure);
}

.hero h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: var(--sp-sm);
}

.hero p {
  font-size: var(--text-md);
  color: var(--text-muted);
  margin-bottom: var(--sp-sm);
}

.hero p:last-child { margin-bottom: 0; }

/* ── Section Grid ── */
.grid-heading {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-md);
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.section-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.section-card-inner {
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.section-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--sp-xs);
}

.section-card-title a {
  color: var(--text);
  text-decoration: none;
}

.section-card-title a:hover { color: var(--accent); }

.section-card-theme {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--sp-sm);
}

.section-card-books {
  list-style: none;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
  flex: 1;
}

.section-card-books li {
  padding: 0.2rem 0 0.2rem var(--sp-sm);
  position: relative;
}

.section-card-books li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--border);
}

.section-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.review-count {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.section-link {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.section-link:hover { color: var(--accent-hover); }

/* ============================================================
   Section (List) Page
   ============================================================ */
.section-header {
  max-width: var(--measure);
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-sm);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

.section-header h1 {
  font-size: var(--text-2xl);
  line-height: 1.2;
  margin-bottom: var(--sp-xs);
}

.section-theme-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-sm);
}

.section-intro {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-top: var(--sp-sm);
}

.section-intro p { margin-bottom: var(--sp-sm); }
.section-intro p:last-child { margin-bottom: 0; }

/* ── Review List (citation style) ── */
.reviews-list {
  max-width: var(--measure);
}

.review-item {
  font-size: var(--text-base);
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}

.review-item:first-child { border-top: 1px solid var(--border); }

.cite-author {
  color: var(--text);
}

.review-item a {
  color: var(--text);
  text-decoration: none;
}

.review-item a:hover { color: var(--accent); }

.empty-section {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-muted);
  font-style: italic;
  padding: var(--sp-lg) 0;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Single Review Page
   ============================================================ */
.review-full {
  max-width: var(--measure);
}

.review-full-header {
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border);
}

.review-full-title {
  font-size: var(--text-2xl);
  line-height: 1.2;
  margin-bottom: var(--sp-sm);
}

.book-info {
  margin-bottom: var(--sp-xs);
}

.book-author-full {
  font-size: var(--text-md);
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: var(--sp-xs);
}

.book-publisher {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.review-byline {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--sp-sm);
}

/* ── Review Body Typography ── */
.review-full-body {
  font-size: var(--text-md);
  line-height: 1.85;
}

.review-full-body p {
  margin-bottom: var(--sp-md);
}

.review-full-body h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
  margin-top: var(--sp-lg);
  margin-bottom: var(--sp-sm);
}

.review-full-body h3 {
  font-size: 1.1rem;
  line-height: 1.3;
  margin-top: var(--sp-md);
  margin-bottom: var(--sp-sm);
}

/* Headings that follow directly after another heading get less top space */
.review-full-body h2 + h3 {
  margin-top: var(--sp-sm);
}

.review-full-body blockquote {
  border-left: 3px solid var(--accent);
  margin: var(--sp-md) 0;
  padding: var(--sp-xs) 0 var(--sp-xs) var(--sp-md);
  color: var(--text-muted);
  font-style: italic;
}

.review-full-body blockquote p {
  margin-bottom: 0;
}

.review-full-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.review-full-body a:hover { color: var(--accent-hover); }

/* ── Review Footer ── */
.review-full-footer {
  margin-top: var(--sp-lg);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.tags { display: flex; gap: var(--sp-xs); flex-wrap: wrap; }

.tag {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.2rem var(--sp-sm);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.tag:hover { border-color: var(--accent); color: var(--accent); }

.back-link {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover { color: var(--accent); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: var(--sp-lg) 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  text-align: center;
  line-height: 2;
}

.footer-copy {
  color: #5a5450;
  margin-top: var(--sp-xs);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 700px) {
  html { font-size: 16px; }

  :root {
    --sp-lg: 2rem;
    --sp-md: 1.25rem;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-sm);
  }

  .site-nav { gap: 0.1rem; }
  .nav-link { font-size: var(--text-xs); padding: 0.25rem var(--sp-xs); }

  .hero h1,
  .review-full-title,
  .section-header h1 { font-size: var(--text-xl); }

  .grid { grid-template-columns: 1fr; }
}