:root {
  --accent: #4d004d;
  --accent-light: #6e156e;
  --accent-tint: #f8f4f9;
  --bg: #f1f1f5;
  --card-bg: #ffffff;
  --surface: #fafafa;
  --img-bg: #f7f5f9;
  --text: #1c1c1e;
  --muted: #55555f;
  --border: #dcdce3;
  --max-site: 1040px;
  --max-prose: 760px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
}

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

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

/* Header & Nav */
.site-header {
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
.header-inner {
  max-width: var(--max-site);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  text-decoration: none;
}
.site-brand img {
  width: 26px;
  height: 26px;
  border-radius: 4px;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.15rem;
  font-size: 0.93rem;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.site-nav a:hover, .site-nav a.active {
  color: var(--accent);
  text-decoration: underline;
}

/* Intro Banner (clean, no excessive empty height) */
.hero-strip {
  background: var(--accent-tint);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: var(--max-site);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
}
.hero-inner h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.hero-sub {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

/* Main Landing Container */
.container {
  max-width: var(--max-site);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

.section-heading {
  margin: 0 0 1.25rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.3rem 1rem;
}
.section-heading span.note {
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* Lead Card (Chapter 1 — horizontal on desktop, zero cropping) */
.lead-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
  margin-bottom: 1.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lead-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(77, 0, 77, 0.09);
}
.lead-media {
  background: var(--img-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border-right: 1px solid var(--border);
}
.lead-media img {
  width: 100%;
  height: auto;
  max-height: 310px;
  object-fit: contain;
  display: block;
}
.lead-body {
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lead-badge {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.45rem;
}
.lead-title {
  margin: 0 0 0.6rem;
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}
.lead-card:hover .lead-title { color: var(--accent); }
.lead-excerpt {
  margin: 0 0 0.9rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--muted);
}

@media (max-width: 780px) {
  .lead-card { grid-template-columns: 1fr; }
  .lead-media { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* 2-Column Balanced Grid (Chapters 2–7, 100% uncropped images) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}
@media (max-width: 740px) {
  .card-grid { grid-template-columns: 1fr; }
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(77, 0, 77, 0.09);
}
.card-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--img-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.card-body {
  padding: 1.1rem 1.25rem 1.2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-title {
  margin: 0 0 0.45rem;
  font-size: 1.16rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
}
.card:hover .card-title { color: var(--accent); }
.card-excerpt {
  margin: 0 0 0.8rem;
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--muted);
}
.card-meta {
  margin-top: auto;
  font-size: 0.82rem;
  color: #74747e;
}

/* Article / Page Layout */
.article-wrap {
  max-width: var(--max-prose);
  margin: 1.5rem auto 2.5rem;
  padding: 2rem 2.25rem 2.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
@media (max-width: 640px) {
  .article-wrap {
    margin: 0.75rem auto 1.5rem;
    padding: 1.25rem 1.15rem 1.75rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}
.article-header {
  margin-bottom: 1.4rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.article-kicker {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.article-header h1 {
  margin: 0 0 0.45rem;
  font-size: 1.95rem;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--text);
}
.article-meta {
  font-size: 0.88rem;
  color: var(--muted);
}
.article-hero {
  margin: 0 0 1.5rem;
  padding: 0.65rem;
  background: var(--img-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}
.article-hero img {
  max-height: 460px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: inline-block;
}

/* Prose */
.prose {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}
.prose p { margin: 0 0 1.05rem; }
.prose h2 {
  margin: 1.85rem 0 0.65rem;
  font-size: 1.36rem;
  line-height: 1.3;
  color: var(--accent);
}
.prose h3 {
  margin: 1.45rem 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--text);
}
.prose h4 {
  margin: 1.2rem 0 0.45rem;
  font-size: 1.04rem;
}
.prose ul, .prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.55rem;
}
.prose li { margin-bottom: 0.4rem; }
.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.65rem 1.15rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-tint);
  color: #2c2c30;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.65rem 0;
}
.prose figure {
  margin: 1.4rem 0;
  text-align: center;
}
.prose figure img {
  border-radius: 4px;
  border: 1px solid var(--border);
}
.prose figcaption {
  margin-top: 0.4rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.prose pre, .prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}
.prose code {
  background: var(--surface);
  padding: 0.12rem 0.32rem;
  border-radius: 3px;
}
.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.9rem 1.1rem;
  border-radius: 5px;
  overflow-x: auto;
}

/* Prev / Next Navigation */
.pager {
  margin-top: 2.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.94rem;
}
.pager a {
  text-decoration: none;
  font-weight: 600;
}
.pager a:hover { text-decoration: underline; }
.pager .next { margin-left: auto; text-align: right; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.86rem;
  color: var(--muted);
}
.footer-inner {
  max-width: var(--max-site);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
