/* ===== The4Ps.com — Clean & Simple Stylesheet ===== */

* { box-sizing: border-box; }

:root {
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #C8102E;       /* deep red, matches logo center */
  --accent-dark: #8f0b21;
  --bg: #ffffff;
  --bg-soft: #faf8f3;      /* warm off-white */
  --border: #e4e4e4;
  --link: #2E74B5;
  --link-hover: #1d4f80;
  --max-width: 1100px;
  --font-body: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 18px;
}

/* ---------- Top nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand img {
  width: 48px;
  height: 48px;
  display: block;
}

.brand-text {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  line-height: 1;
}

.brand-sub {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 3px;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--font-ui);
  font-size: 15px;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Chapter dropdown */
.dropdown {
  position: relative;
}

.dropdown-btn {
  background: none;
  border: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dropdown-btn:hover { color: var(--accent); }

.dropdown-btn::after {
  content: "▾";
  font-size: 12px;
  color: var(--muted);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 340px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
  padding: 8px 0;
  max-height: 70vh;
  overflow-y: auto;
  display: none;
}

.dropdown.open .dropdown-menu { display: block; }

.dropdown-menu a {
  display: block;
  padding: 8px 18px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-bottom: none;
  line-height: 1.4;
}

.dropdown-menu a:hover {
  background: var(--bg-soft);
  color: var(--accent);
  border: none;
}

.dropdown-menu .ch-num {
  display: inline-block;
  min-width: 52px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ---------- Main content ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* Page headers (consistent on chapter pages) */
.page-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.series-title {
  font-family: var(--font-ui);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  margin: 0 0 10px 0;
  font-weight: 700;
}

.page-title {
  font-family: var(--font-body);
  font-size: 40px;
  line-height: 1.2;
  margin: 0 0 8px 0;
  color: var(--text);
  font-weight: 700;
}

.page-chapter-label {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* Hero on Home */
.hero {
  text-align: center;
  padding: 40px 0 32px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 44px;
  margin: 0 0 16px 0;
  line-height: 1.15;
}

.hero .tagline {
  font-size: 19px;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

/* Chapter tile grid */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.chapter-tile {
  display: block;
  padding: 22px 22px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.chapter-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
}

.chapter-tile .num {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}

.chapter-tile .title {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 8px;
  color: var(--text);
}

/* Prose content */
.content p { margin: 0 0 1.1em 0; }
.content h2 {
  font-size: 26px;
  margin: 40px 0 14px 0;
  font-family: var(--font-body);
  font-weight: 700;
}
.content h3 {
  font-size: 20px;
  margin: 28px 0 10px 0;
  font-family: var(--font-body);
  font-weight: 700;
}
.content ul, .content ol { padding-left: 1.4em; }
.content li { margin-bottom: 0.4em; }
.content blockquote {
  border-left: 4px solid var(--accent);
  margin: 24px 0;
  padding: 8px 0 8px 20px;
  color: var(--muted);
  font-style: italic;
}
.content a { color: var(--link); }
.content a:hover { color: var(--link-hover); }

.placeholder-note {
  background: #fff8e1;
  border: 1px solid #f0d27c;
  border-radius: 6px;
  padding: 14px 18px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: #6b5600;
  margin: 24px 0;
}

/* Chapter prev/next nav */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
}

.chapter-nav a {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-soft);
}

.chapter-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chapter-nav .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chapter-nav .prev { text-align: left; }
.chapter-nav .next { text-align: right; }
.chapter-nav .empty { visibility: hidden; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 24px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}

/* Chapter figures (images inside chapter content) */
.chapter-figure {
  margin: 18px 0 22px 0;
}
.chapter-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}
.chapter-figure figcaption {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}
.chapter-figure.figure-right {
  float: right;
  width: 300px;
  max-width: 40%;
  margin: 6px 0 12px 24px;
}
.chapter-figure.figure-right figcaption { text-align: left; }
.chapter-figure.figure-left {
  float: left;
  width: 300px;
  max-width: 40%;
  margin: 6px 24px 12px 0;
}
.chapter-figure.figure-left figcaption { text-align: left; }
.chapter-figure.figure-center {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.content h2 { clear: both; }
.content h2.no-clear { clear: none; }

/* Inline (sources) link that follows a paragraph */
a.inline-sources,
.inline-sources {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
  margin-left: 4px;
  white-space: nowrap;
}
a.inline-sources:hover,
.inline-sources:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

/* AI content disclaimer box */
.ai-disclaimer {
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 14px 18px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin: 32px 0 8px 0;
}
.ai-disclaimer strong { color: var(--text); }

/* Sources subpages */
.sources-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.sources-header .eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 0 0 8px 0;
}
.sources-header .eyebrow a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
.sources-header .eyebrow a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.sources-header h1 {
  font-family: var(--font-body);
  font-size: 32px;
  margin: 0 0 6px 0;
  line-height: 1.2;
}
.sources-header .section-label {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.sources-intro {
  font-size: 17px;
  color: var(--text);
  margin: 0 0 28px 0;
}
.sources-subhead {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 10px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.sources-list {
  list-style: decimal;
  padding: 0 0 0 28px;
  margin: 0;
}
.sources-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
}
.sources-list li:last-child { border-bottom: none; }
.sources-list a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  word-break: break-word;
}
.sources-list a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}
.sources-back {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 14px;
}
.sources-back a {
  color: var(--link);
  text-decoration: none;
}
.sources-back a:hover { color: var(--link-hover); }

/* Responsive */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .nav-wrap { flex-wrap: wrap; padding: 12px 16px; }
  .nav-links { gap: 16px; font-size: 14px; }
  .brand-text { font-size: 17px; }
  .brand img { width: 40px; height: 40px; }
  .hero h1 { font-size: 32px; }
  .page-title { font-size: 30px; }
  main { padding: 32px 18px 64px; }
  .dropdown-menu { min-width: 280px; right: -8px; }
  .chapter-nav { flex-direction: column; }
  .chapter-figure.figure-right,
  .chapter-figure.figure-left {
    float: none;
    width: auto;
    max-width: 100%;
    margin: 14px 0 18px 0;
  }
  .chapter-figure.figure-right figcaption,
  .chapter-figure.figure-left figcaption { text-align: center; }
  .sources-header h1 { font-size: 26px; }
}
