/* ============================================================================
   THE LIVING DEAD — Custom CSS Overrides
   Layout, color, and structural overrides only.
   ALL FONT DECLARATIONS live in styles.css (canonical font system).
   ============================================================================ */

/* Hide Quarto default title block and author metadata */
.quarto-title-block,
.quarto-title-meta,
.quarto-title-authors,
.quarto-title,
#title-block-header {
  display: none !important;
}

:root {
  --fire: #e85a2c;
  --fire-soft: #ff6b35;
}

/* ============================================================================
   FOOTER — Single line. Quiet. Final.
   No hover effects. No animations. No embellishments.
   ============================================================================ */

footer.footer {
  background: #1a1918 !important;
  border-top: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

footer.footer .nav-footer {
  background: #1a1918 !important;
  display: block !important;
  text-align: center !important;
  padding: 0 !important;
}

/* Hide empty left/right columns, give center full width */
.nav-footer-left,
.nav-footer-right {
  display: none !important;
}

.nav-footer-center {
  width: 100% !important;
  max-width: 100% !important;
  text-align: center !important;
}

/* The single-line memoir footer — inside Quarto's footer wrapper */
.nav-footer-center footer.memoir-footer {
  text-align: center;
  padding: 0.75rem 1rem;
  margin: 0 !important;
  max-width: none !important;
  opacity: 0.7;
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.9rem !important;
}

/* Tighten hr separator between download button and prev/next nav */
.chapter-download + hr,
.chapter-body + hr,
hr + .chapter-progress-nav,
hr + nav.chapter-progress-nav {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.nav-footer-center footer.memoir-footer p {
  margin: 0;
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.9rem !important;
  color: #b5aea6 !important;
  text-align: center !important;
}

/* ============================================================================
   MEMOIR HOMEPAGE STYLES — Timeline, Intro, Footer (Layout Only)
   ============================================================================ */

/* Landing page closing line — under trunk stem */
.memoir-closing-line {
  text-align: center;
  margin: 6rem auto 4rem;
  font-size: 1.3rem;
  letter-spacing: 0.25em;
  color: #e85a2c;
  font-weight: 400;
  max-width: 760px;
}

/* Memoir Title Page — Book title, not a hero */
.memoir-title-page {
  text-align: left;
  padding: 5rem 2rem 4rem;
  max-width: 900px;
  margin: 0 auto;
}

.memoir-title-main {
  font-size: clamp(3rem, 6vw, 4.5rem) !important;
  font-weight: 300 !important;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  line-height: 1.3;
  /* Subtle vertical gradient — off-white through gray, warmed by ember at base */
  background: linear-gradient(180deg, #F2F2F2 0%, #D6D6D6 60%, #c4705a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #f0ece6 !important; /* fallback for browsers without background-clip */
}

.memoir-title-sub {
  font-size: 1.1rem !important;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: #9a948d !important;
  margin: 1.25rem 0 0;
  font-style: italic;
  opacity: 0.78;
}

/* Memoir Intro — Opening statement */
.memoir-intro {
  max-width: 700px;
  margin: 4rem auto 3rem;
  padding: 0 2rem;
  text-align: center;
  line-height: 2.2;
  color: #b5aea6;
}

.memoir-intro p {
  color: #b5aea6 !important;
  text-align: center !important;
}

/* Memoir Timeline — Chapter listing */
.memoir-timeline {
  max-width: 700px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}

.memoir-timeline h3 {
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.memoir-timeline p {
  font-style: italic;
  color: #9a948d !important;
  font-size: 1.1rem !important;
  margin-bottom: 0.5rem;
}

.memoir-timeline a {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e85a2c;
  text-decoration: none;
  transition: color 0.3s ease;
}

.memoir-timeline a:hover {
  color: #ff6b35;
}

.memoir-timeline hr {
  border: none;
  border-top: 1px solid #2d2b2a;
  margin: 2rem 0;
}

/* Memoir Footer — Closing statement */
.memoir-footer {
  max-width: 700px;
  margin: 2rem auto 4rem;
  padding: 0 2rem;
  text-align: center;
  line-height: 2.2;
  color: #9a948d;
}

.memoir-footer p {
  color: #9a948d !important;
  text-align: center !important;
}

/* ============================================================================
   MEMOIR TREE — Spatial branching timeline (NON-NEGOTIABLE)
   The timeline must NEVER be flat. Chapters branch from a central life axis.
   Any linear list representation is a regression.
   ============================================================================ */

.memoir-tree {
  position: relative;
  max-width: 900px;
  margin: 4rem auto;
  padding: 0 2rem;
}

/* Central trunk — the life axis */
.memoir-tree::before {
  background: linear-gradient(
    180deg,
    rgba(232, 90, 44, 0.85) 0%,
    #2d2b2a 25%,
    #2d2b2a 75%,
    rgba(232, 90, 44, 0.85) 100%
  );
}


/* Root / Origin Node — The tree begins here, not mid-air */
.memoir-root-node {
  text-align: center;
  position: relative;
  z-index: 2;
  margin-bottom: 3rem;
  padding-top: 1rem;
}

.root-dot {
  width: 16px;
  height: 16px;
  background: #e85a2c;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 12px rgba(232, 90, 44, 0.4);
  position: relative;
  z-index: 3;
}

.root-text {
  font-style: italic;
  color: #b5aea6 !important;
  font-size: 1.2rem !important;
  max-width: 400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  background: #0a0908;
  position: relative;
  z-index: 2;
}

/* Branches — alternating left/right */
.memoir-branch {
  width: 45%;
  margin: 3rem 0;
  padding: 2rem;
  position: relative;
  background: #1a1918;
  border: 1px solid #2d2b2a;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.memoir-branch:hover {
  border-color: #e85a2c;
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* Left branches — right-aligned text */
.memoir-branch.left {
  margin-right: auto;
  text-align: right;
}

/* Right branches — left-aligned text */
.memoir-branch.right {
  margin-left: auto;
  text-align: left;
}

/* Branch connector lines */
.memoir-branch::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 5%;
  height: 2px;
  background: #2d2b2a;
}

.memoir-branch.left::after {
  right: -5%;
}

.memoir-branch.right::after {
  left: -5%;
}

/* Branch node dots on the trunk */
.memoir-branch::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #e85a2c;
  border-radius: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.memoir-branch.left::before {
  right: calc(-5% - 5px);
}

.memoir-branch.right::before {
  left: calc(-5% - 5px);
}

.memoir-branch h3 {
  color: #ffffff;
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
}

.memoir-branch p {
  color: #9a948d !important;
  font-style: italic;
  font-size: 1rem !important;
  margin-bottom: 1rem;
}

.memoir-branch a {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e85a2c;
  text-decoration: none;
  transition: color 0.3s ease;
}

.memoir-branch a:hover {
  color: #ff6b35;
}

/* Responsive: stack on mobile but maintain branching feel */
@media (max-width: 768px) {
  .memoir-tree::before {
    left: 20px;
  }

  .memoir-branch {
    width: calc(100% - 50px);
    margin-left: 50px !important;
    margin-right: 0 !important;
    text-align: left !important;
  }

  .memoir-branch.left,
  .memoir-branch.right {
    margin-left: 50px !important;
    text-align: left !important;
  }

  .memoir-branch::after {
    left: -30px !important;
    right: auto !important;
    width: 30px;
  }

  .memoir-branch::before {
    left: -35px !important;
    right: auto !important;
  }
}

/* ============================================================================
   CHAPTER PAGE LAYOUT — Literary memoir, not a blog post.
   Quiet, immersive reading. Printed memoir adapted for screen.
   ============================================================================ */

/* Chapter page hr separators — tighter than Bootstrap defaults */
.chapter-body ~ hr,
.chapter-download ~ hr {
  margin: 0.75rem auto;
  max-width: 760px;
}

/* Readable column — constrain all chapter elements to ~760px centered */
.chapter-header,
.chapter-body,
.chapter-progress-bar,
.chapter-progress-nav,
.chapter-return,
.chapter-download {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Chapter header — label + title, no bold, size and space only */
.chapter-header {
  margin-top: 1rem;
  margin-bottom: 2.5rem;
  text-align: left;
}

/* Reduce gap above progress row — tighten the chapter opening */
.chapter-progress-row {
  margin-top: 0.5rem;
}

.chapter-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a948d !important;
  margin-bottom: 0.5rem;
}

.chapter-title {
  font-size: 2.8rem;
  line-height: 1.2;
  color: #ffffff !important;
  margin: 0;
  font-weight: 400 !important;
}

/* Lead paragraph — slightly larger, more air */
.chapter-body > p:first-of-type {
  font-size: 1.15em;
  line-height: 1.95;
}

/* Body text rhythm — book-like paragraph spacing, left-aligned */
.chapter-body p {
  line-height: 1.85;
  margin-bottom: 1.6rem;
  text-align: left !important;
}

/* Section headings inside chapters — quieter than homepage */
.chapter-body h2 {
  font-size: 2.2rem;
  margin-top: 3.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0;
  border-bottom: none !important;
}

/* Writings list — calm, secondary */
.chapter-body .writings-list {
  list-style: none;
  padding-left: 0;
  margin-top: 1rem;
}

.chapter-body .writings-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #2d2b2a;
  font-size: 0.95rem;
  line-height: 1.7;
}

.chapter-body .writings-list li:last-child {
  border-bottom: none;
}

/* Return-to-timeline link — quiet */
.chapter-return {
  margin-top: 0.5rem;
  margin-bottom: 0;
  padding-bottom: 0;
  font-size: 0.85rem;
  color: #9a948d !important;
}

.chapter-return a {
  color: #9a948d !important;
  text-decoration: none;
  transition: color 0.3s ease;
}

.chapter-return a:hover {
  color: #e85a2c !important;
}

/* ============================================================================
   CHAPTER PROGRESS BAR — Visual position indicator (reduced weight)
   ============================================================================ */

.chapter-progress-bar {
  display: flex;
  gap: 0.4rem;
  margin: 1rem 0 0.5rem;
}

.chapter-progress-bar span {
  flex: 1;
  height: 3px;
  background-color: #2d2b2a;
}

.chapter-progress-bar span.active {
  background-color: #e85a2c;
}

/* ============================================================================
   CHAPTER PROGRESS NAVIGATION — Prev/Next at bottom of chapter
   ============================================================================ */

.chapter-progress-nav {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: #7a756f;
  margin: 0.75rem 0 0.5rem;
  line-height: 1.8;
}

.chapter-progress-nav a {
  color: #9a948d;
  text-decoration: none;
  transition: color 0.3s ease;
}

.chapter-progress-nav a:hover {
  color: #e85a2c;
}

/* ============================================================================
   CHAPTER PROGRESS ROW — Navigation-aware table-of-contents indicator
   Quiet, minimal, state-driven: past · current · future
   Used in chapters 2-5 as <nav class="chapter-nav"> with .progress-node divs
   ============================================================================ */

/* Legacy row format (chapter 1 original) */
.chapter-progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  gap: 0;
  max-width: 760px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.chapter-progress-row::-webkit-scrollbar {
  display: none;
}

/* In-chapter progress nav — overrides theme.scss .chapter-nav (column layout) */
nav.chapter-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  max-width: 760px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: none !important;
}

/* Separator dashes between nodes */
.progress-sep {
  color: #2d2b2a;
  margin: 0 0.5rem;
  font-size: 0.65rem;
  user-select: none;
}

/* Base node — all chapter labels */
.progress-node {
  text-decoration: none;
  transition: color 0.25s ease;
  padding: 0.15rem 0.6rem;
}

.node-label {
  font-family: 'Poppins', sans-serif !important;
}

/* Past chapters — readable but muted */
.progress-node.past {
  color: #7a756f;
  opacity: 0.8;
}

/* Current chapter — visually emphasized */
.progress-node.current {
  color: #b5aea6;
  font-weight: 500;
}

/* Future chapters — de-emphasized */
.progress-node.future {
  color: #4d4946;
  opacity: 0.7;
}

/* Hover state — subtle ember lift for all clickable nodes */
.progress-node:hover {
  color: #e85a2c;
  opacity: 1;
}

/* ============================================================================
   CHAPTER INVOCATION — Subtitle below chapter title
   ============================================================================ */

.chapter-invocation {
  font-size: 1rem !important;
  font-weight: 300;
  font-style: italic;
  color: #9a948d !important;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
  line-height: 1.7;
}

/* ============================================================================
   CHAPTER DOWNLOAD — PDF download section at bottom of chapter
   ============================================================================ */

.chapter-download {
  max-width: 760px;
  margin: 1.5rem auto 0.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.download-link {
  display: inline-block;
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e85a2c;
  text-decoration: none;
  padding: 0.75rem 2rem;
  border: 1px solid #2d2b2a;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.download-link:hover {
  border-color: #e85a2c;
  background: rgba(232, 90, 44, 0.1);
  color: #ff6b35;
}

/* ============================================================================
   MEMOIR ENTER — Homepage "Enter the Memoir" link
   ============================================================================ */

.memoir-enter {
  text-align: center;
  margin: 3rem auto 6rem;
  padding: 0 2rem;
}

.enter-memoir-link {
  display: inline-block;
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e85a2c;
  text-decoration: none;
  padding: 1rem 2.5rem;
  border: 1px solid #2d2b2a;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.enter-memoir-link:hover {
  border-color: #e85a2c;
  background: rgba(232, 90, 44, 0.1);
  color: #ff6b35;
}

/* ============================================================================
   MEMOIR OVERVIEW PAGE — Chapter listing with entry points
   ============================================================================ */

.memoir-overview-header {
  text-align: center;
  padding: 6rem 2rem 2rem;
  max-width: 700px;
  margin: 0 auto;
}

h1.memoir-overview-title {
  font-family: 'Poppins', sans-serif !important;
  font-size: 2.4rem !important;
  font-weight: 300 !important;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  line-height: 1.3;
  background: linear-gradient(180deg, #F2F2F2 0%, #D6D6D6 60%, #c4705a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #f0ece6 !important;
}

.memoir-overview-sub {
  font-size: 1rem !important;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: #7a756f !important;
  margin: 0;
  font-style: italic;
}

.memoir-chapter-list {
  max-width: 700px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}

.memoir-chapter-entry {
  padding: 2rem 0;
  border-bottom: 1px solid #2d2b2a;
}

.memoir-chapter-entry:last-child {
  border-bottom: none;
}

.memoir-chapter-entry h3 {
  margin-bottom: 0.5rem;
}

.memoir-chapter-entry h3 a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.memoir-chapter-entry h3 a:hover {
  color: #e85a2c;
}

.chapter-tagline {
  font-style: italic;
  color: #9a948d !important;
  font-size: 1rem !important;
  margin-bottom: 0.75rem;
}

.enter-chapter-link {
  display: inline-block;
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e85a2c;
  text-decoration: none;
  transition: color 0.3s ease;
}

.enter-chapter-link:hover {
  color: #ff6b35;
}

/* ============================================================================
   CHAPTER PROGRESS NAV — Structured prev/next at bottom of chapters
   ============================================================================ */

nav.chapter-progress-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

nav.chapter-progress-nav .nav-item {
  flex: 1;
}

nav.chapter-progress-nav .nav-item.prev {
  text-align: left;
}

nav.chapter-progress-nav .nav-item.next {
  text-align: right;
}

/* When only next exists (Chapter 1), push it right */
nav.chapter-progress-nav .nav-item.next:first-child {
  margin-left: auto;
}

nav.chapter-progress-nav .nav-item a {
  display: block;
  text-decoration: none;
  min-height: auto;
  line-height: 1.6;
}

nav.chapter-progress-nav .nav-item .label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a756f;
  margin-bottom: 0.25rem;
}

nav.chapter-progress-nav .nav-item .title {
  display: block;
  font-size: 0.9rem;
  color: #9a948d;
  transition: color 0.3s ease;
}

nav.chapter-progress-nav .nav-item a:hover .title {
  color: #e85a2c;
}

/* ============================================================================
   WIDER CONTAINER FOR ARCHIVE GRID
   ============================================================================ */

.writings-grid {
  max-width: 1100px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ============================================================================
   CRITICAL: Force readable text colors throughout the site
   ============================================================================ */

body {
  color: #e8e4de !important;
}

p {
  color: #e8e4de !important;
}

.chapter-content p,
.memoir-container p,
.about-content p,
.contact-section p,
.contact-intro p {
  color: #e8e4de !important;
}

/* Headings should be bright white */
h1, h2, h3, h4, h5, h6 {
  color: #ffffff !important;
}

/* Chapter headings ember color */
.chapter-heading {
  color: #e85a2c !important;
}

.chapter-heading span {
  color: #b5aea6 !important;
}

/* Hero text */
.hero-title {
  color: #ffffff !important;
}

.hero-subtitle {
  color: #c9c4bc !important;
}

/* Page header subtitle */
.page-header p {
  color: #c9c4bc !important;
}

/* Footer text — colophon uses its own color rules */
footer.footer {
  color: #b5aea6 !important;
}

/* Smooth page transitions */
.page-content {
  animation: pageReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageReveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Enhanced focus states for accessibility */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid #e85a2c;
  outline-offset: 3px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0908;
}

::-webkit-scrollbar-thumb {
  background: #3d3a38;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #e85a2c;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #3d3a38 #0a0908;
}

/* Image loading placeholder */
img {
  background: linear-gradient(135deg, #1a1918 0%, #2d2b2a 100%);
}

/* ============================================================================
   ABOUT PAGE — Restructured Sections
   ============================================================================ */

/* Section 1 — Identity Block */
.about-identity {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  text-align: center;
}

.about-identity .about-image {
  margin-bottom: 2rem;
}

.about-identity .about-image img {
  max-width: 300px;
  width: 100%;
  height: auto;
  aspect-ratio: 4/5;
  object-fit: cover;
  border: 1px solid #2d2b2a;
  display: block;
  margin: 0 auto;
}

.about-identity h2 {
  font-size: 2.5rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  text-align: center;
  color: #ffffff !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.about-role {
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b5aea6 !important;
  margin-bottom: 0;
  font-style: normal;
  text-align: center;
}

/* Section 2 — Philosophical Bridge */
.about-philosophy {
  max-width: 680px;
  margin: 2.5rem auto 0;
  padding: 0 2rem;
  line-height: 1.9;
  position: relative;
}

.about-philosophy::before {
  content: "";
  display: block;
  width: 60px;
  height: 1px;
  background: #2d2b2a;
  margin: 0 auto 2.5rem;
}

.about-philosophy p {
  margin-bottom: 1.5rem;
  color: #e8e4de !important;
  font-size: 1.15rem;
}

/* Section 3 — Archive Meaning */
.about-archive-meaning {
  max-width: 760px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.about-archive-meaning p {
  font-weight: 500;
  color: #e8e4de !important;
  line-height: 1.85;
  font-size: 1.15rem;
}

/* Author's Editorial Philosophy */
.about-editorial {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 2rem;
  text-align: center;
}

.about-editorial h2 {
  font-size: 2rem;
  font-weight: 400;
  color: #ffffff !important;
  margin-bottom: 0;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.about-editorial-divider {
  width: 60%;
  max-width: 450px;
  height: 1px;
  background: #2d2b2a;
  margin: 1.5rem auto;
}

.about-editorial p {
  text-align: left;
  line-height: 1.8;
  color: #e8e4de !important;
  font-size: 1.15rem;
  max-width: 680px;
  margin: 0 auto;
}

/* Family section paragraph width adjustment */
.family-section > .memoir-container > p {
  max-width: 720px !important;
}

/* ============================================================================
   WRITINGS MEGA-MENU — Full-width panel replacing the standard dropdown
   Only the Writings menu gets this treatment. Memoir stays as-is.
   ============================================================================ */

/* Hide original Writings dropdown on desktop when mega-menu is present */
@media (min-width: 769px) {
  .nav-item.has-mega-writings > .dropdown-menu {
    display: none !important;
  }
}

/* The mega-menu panel */
.mega-writings {
  position: fixed;
  left: 0;
  right: 0;
  background: #1a1918;
  border-top: 1px solid #2d2b2a;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 999;
}

/* Show on hover — CSS-driven for the nav-item */
.nav-item.has-mega-writings:hover .mega-writings {
  opacity: 1;
  visibility: visible;
}

/* Hover bridge: invisible zone so mouse can travel from nav-link to panel */
.nav-item.has-mega-writings::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

/* Inner grid: 3 columns */
.mega-writings-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 2rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2.5rem;
}

/* Category section within a column */
.mega-category-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a948d;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #2d2b2a;
}

.mega-category-title a {
  color: #9a948d;
  text-decoration: none;
  transition: color 0.3s ease;
}

.mega-category-title a:hover {
  color: #e85a2c;
}

/* Piece list */
.mega-piece-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-piece-list li {
  margin-bottom: 0.1rem;
}

.mega-piece-link {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: #f0ece6;
  padding: 0.4rem 0;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.3s ease;
}

.mega-piece-link:hover {
  color: #e85a2c;
}

/* Coming soon placeholder */
.mega-piece-coming {
  font-size: 0.8rem;
  font-weight: 300;
  font-style: italic;
  color: #6b6560;
  padding: 0.4rem 0;
  margin: 0;
}

/* Overflow limit: show max 3 items per category. Change n+4 to n+6 for 5. */
.mega-piece-list li:nth-child(n+4) {
  display: none;
}

/* "View all" link for categories exceeding the cap */
.mega-piece-more {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #e85a2c;
  padding: 0.5rem 0 0.1rem;
  text-decoration: none;
  transition: color 0.3s ease;
}

.mega-piece-more:hover {
  color: #ff6b35;
}

/* Mobile: hide mega-menu entirely, keep original Quarto dropdown */
@media (max-width: 768px) {
  .mega-writings {
    display: none !important;
  }

  /* Restore original dropdown on mobile */
  .nav-item.has-mega-writings > .dropdown-menu {
    display: none;
  }

  .nav-item.has-mega-writings:hover > .dropdown-menu,
  .nav-item.has-mega-writings.show > .dropdown-menu {
    display: block !important;
  }
}

/* ============================================================================
   MOBILE RESPONSIVE — Progressive breakpoints for phones and tablets
   ============================================================================ */

/* --- Tablets and small laptops (769px – 1024px) --- */
@media (max-width: 1024px) {
  .about-hero {
    gap: 2rem;
  }

  .about-identity .about-image img {
    max-width: 280px;
  }

  .memoir-branch h3 {
    font-size: 1.5rem;
  }
}

/* --- Small tablets and large phones (481px – 768px) --- */
@media (max-width: 768px) {
  /* Font scaling */
  h1 { font-size: 2.2rem !important; }
  h2 { font-size: 1.8rem !important; }

  .chapter-title { font-size: 2.2rem; }
  .chapter-body h2 { font-size: 1.7rem; }

  /* Title page */
  .memoir-title-page { padding: 4rem 1.5rem 3rem; }
  .memoir-title-main { font-size: 2.4rem !important; letter-spacing: 0.25em; }

  /* Tighter body text for narrow screens */
  body { font-size: 1.1rem !important; }

  .chapter-body p {
    line-height: 1.7;
    margin-bottom: 1.3rem;
  }

  .chapter-body > p:first-of-type {
    font-size: 1.08em;
  }

  /* Blockquote scaling */
  blockquote {
    font-size: 1.05rem !important;
  }

  /* Constrain readable columns to full width with padding */
  .chapter-header,
  .chapter-body,
  .chapter-progress-bar,
  .chapter-progress-nav,
  .chapter-return,
  .chapter-progress-row,
  nav.chapter-nav,
  .chapter-download {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  /* Chapter nav row — tighter on tablets */
  nav.chapter-nav {
    font-size: 0.65rem;
    gap: 0.15rem;
  }

  /* Memoir overview page */
  .memoir-overview-header {
    padding: 4rem 1.5rem 1.5rem;
  }

  h1.memoir-overview-title {
    font-size: 1.9rem !important;
    letter-spacing: 0.22em;
  }

  .memoir-chapter-list {
    padding: 0 1.5rem;
  }

  /* Chapter progress nav — stack on mobile */
  nav.chapter-progress-nav {
    flex-direction: column;
    gap: 1rem;
  }

  nav.chapter-progress-nav .nav-item.prev,
  nav.chapter-progress-nav .nav-item.next {
    text-align: left;
  }

  nav.chapter-progress-nav .nav-item.next:first-child {
    margin-left: 0;
  }

  /* About hero stacks vertically */
  .about-hero {
    flex-direction: column;
    padding: 2rem 1.5rem;
  }

  .about-image img {
    max-width: 280px;
  }

  /* About page restructured sections */
  .about-identity {
    padding: 0 1.5rem 2rem;
  }

  .about-identity .about-image img {
    max-width: 250px;
  }

  .about-identity h2 {
    font-size: 2rem;
  }

  .about-philosophy {
    max-width: 100%;
    padding: 0 1.5rem;
  }

  .about-archive-meaning {
    max-width: 100%;
    padding: 0 1.5rem;
  }

  .about-editorial {
    padding: 3rem 1.5rem;
  }

  .about-editorial p {
    max-width: 100%;
  }

  /* Family section */
  .family-pyramid-bottom {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  /* Progress row wraps gracefully */
  .chapter-progress-row {
    font-size: 0.65rem;
    gap: 0.15rem;
  }

  .progress-sep {
    margin: 0 0.3rem;
  }

  /* Footer */
  .nav-footer-center footer.memoir-footer {
    font-size: 0.8rem !important;
    padding: 1.2rem 0.75rem 1rem;
  }
}

/* --- Phones (max-width: 480px) --- */
@media (max-width: 480px) {
  h1 { font-size: 1.8rem !important; }
  h2 { font-size: 1.5rem !important; }

  body { font-size: 1rem !important; }

  /* Title page */
  .memoir-title-page { padding: 3rem 1.25rem 2rem; }
  .memoir-title-main { font-size: 1.8rem !important; letter-spacing: 0.18em; }
  .memoir-title-sub { font-size: 0.9rem !important; }

  .chapter-title { font-size: 1.8rem; }
  .chapter-label { font-size: 0.7rem; }

  .chapter-header {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
  }

  .chapter-body p {
    line-height: 1.65;
    margin-bottom: 1.2rem;
  }

  .memoir-intro {
    margin: 2.5rem auto 2rem;
    padding: 0 1.25rem;
    line-height: 1.9;
  }

  /* Progress row — tighter on small phones */
  .chapter-progress-row,
  nav.chapter-nav {
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    padding: 0 1rem;
  }

  .progress-sep {
    margin: 0 0.2rem;
  }

  /* Memoir overview */
  .memoir-overview-header {
    padding: 3rem 1.25rem 1rem;
  }

  h1.memoir-overview-title {
    font-size: 1.5rem !important;
    letter-spacing: 0.18em;
  }

  .memoir-overview-sub {
    font-size: 0.85rem !important;
  }

  .memoir-chapter-list {
    padding: 0 1.25rem;
  }

  /* Enter memoir link */
  .memoir-enter {
    margin: 2.5rem auto 4rem;
  }

  .enter-memoir-link {
    font-size: 0.8rem;
    padding: 0.75rem 2rem;
  }

  /* Family section */
  .family-initials {
    width: 120px;
    height: 120px;
    font-size: 1.5rem;
  }

  .family-photo {
    width: 120px;
    height: 120px;
  }

  .family-photo.family-photo-rect {
    width: 140px;
    height: 210px;
  }

  .family-member h3 {
    font-size: 0.95rem;
  }

  /* About page */
  .about-image img {
    max-width: 220px;
  }

  /* About page restructured sections */
  .about-identity .about-image img {
    max-width: 200px;
  }

  .about-identity h2 {
    font-size: 1.8rem;
  }

  .about-role {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
  }

  .about-editorial {
    padding: 2.5rem 1.25rem;
  }

  .about-editorial h2 {
    font-size: 1.6rem;
  }

  .about-philosophy p,
  .about-archive-meaning p,
  .about-editorial p {
    font-size: 1rem;
  }

  .page-header h1 {
    font-size: 2rem !important;
  }

  /* Footer */
  .nav-footer-center footer.memoir-footer {
    font-size: 0.75rem !important;
  }
}

/* ============================================================================
   TOUCH TARGETS — Minimum 44px for all interactive elements
   ============================================================================ */

.progress-node {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.chapter-progress-nav a,
.chapter-return a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}

/* Navbar links — ensure touch-friendly on mobile */
@media (max-width: 768px) {
  .navbar .nav-link {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
  }

  .navbar .dropdown-item {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
  }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

/* ============================================================================
   WRITING PIECES — Individual pieces within category pages
   ============================================================================ */

.writing-piece {
  margin-bottom: 4rem;
}

.writing-piece-title {
  font-size: 1.6rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.08em;
  color: #ffffff !important;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.writing-piece-meta {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9a948d !important;
  margin-bottom: 2.5rem;
}

.writing-piece-body {
  line-height: 1.8;
}

.writing-piece-body p {
  margin-bottom: 1.2rem;
  color: #e8e4de !important;
}

.writing-piece-body .dialogue {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
  border-left: 2px solid #2d2b2a;
}

.writing-piece-body .dialogue p {
  margin-bottom: 0.8rem;
}

.writing-piece-body .poem-line {
  margin-bottom: 0.2rem;
}

.writing-piece-body .poem-stanza {
  margin-bottom: 1.5rem;
}

.writing-piece-body .refrain {
  font-style: italic;
  margin: 1.5rem 0;
}

.writing-piece-body .dinka-text {
  font-style: italic;
  color: #b5aea6 !important;
}

.writing-piece-body .speech-section-heading {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #e85a2c !important;
  margin: 2.5rem 0 1.2rem;
}

.writing-piece-body .attribution {
  text-align: right;
  font-style: italic;
  color: #9a948d !important;
  margin-top: 2rem;
}

.writing-piece-body .source-note {
  font-size: 0.85rem;
  color: #7a756f !important;
  margin-top: 2rem;
  font-style: italic;
}

.writing-piece-body .numbered-list {
  padding-left: 1.5rem;
  margin: 1.5rem 0;
}

.writing-piece-body .numbered-list li {
  margin-bottom: 0.6rem;
  color: #e8e4de !important;
}

.writing-piece-body .closing-signature {
  margin-top: 2rem;
  color: #b5aea6 !important;
  font-style: italic;
}

.writing-sep {
  width: 60px;
  height: 1px;
  background: #2d2b2a;
  margin: 4rem auto;
}

/* Dialogue Scene — clean speaker-exchange format (no borders, no decoration) */
.writing-piece-body .dialogue-scene {
  margin: 2.5rem 0;
}

.writing-piece-body .dialogue-block {
  margin-bottom: 2.2rem;
}

.writing-piece-body .dialogue-block:last-child {
  margin-bottom: 0;
}

.writing-piece-body .speaker-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9a948d !important;
  margin-bottom: 0.4rem;
}

.writing-piece-body .dialogue-block p {
  margin-bottom: 0;
}

.writing-piece-body .piece-ending {
  text-align: center;
  font-style: italic;
  color: #b5aea6 !important;
  margin: 3rem 0 1rem;
  letter-spacing: 0.05em;
}

/* Poem — structured verse and refrain with visual differentiation */
.writing-piece-body .poem-text {
  white-space: pre-line;
  line-height: 2.0;
  color: #e8e4de !important;
  margin-bottom: 1.2rem;
}

.writing-piece-body .poem-verse {
  white-space: pre-line;
  line-height: 2.0;
  color: #e8e4de !important;
  margin-bottom: 2rem;
}

.writing-piece-body .poem-refrain {
  white-space: pre-line;
  line-height: 2.0;
  color: #b5aea6 !important;
  font-style: italic;
  margin-bottom: 2rem;
  padding-left: 1.5rem;
}

/* Poem Prayer — liturgical closing set apart from stanzas */
.writing-piece-body .poem-prayer {
  white-space: pre-line;
  line-height: 2.0;
  color: #b5aea6 !important;
  font-style: italic;
  margin: 2.5rem 0 2rem;
  padding: 1.5rem 0 1.5rem 2rem;
  border-left: 2px solid #e85a2c;
}

/* Dinka Prayer — liturgical text set apart from narrative */
.writing-piece-body .dinka-prayer {
  display: block;
  font-style: italic;
  color: #b5aea6 !important;
  margin: 1.5rem 0;
  padding: 0.8rem 0 0.8rem 1.5rem;
  border-left: 2px solid #2d2b2a;
  line-height: 1.9;
}

/* Opening Paragraph — signature treatment for prose writings */
.writing-piece-body .opening-paragraph {
  max-width: 68ch;
  line-height: 2.1;
  color: #f5f0e8 !important;
  margin-bottom: 1.8rem;
}

.writing-piece-body .opening-paragraph::first-letter {
  font-family: 'Allura', cursive;
  font-size: 3.4em;
  float: left;
  line-height: 0.8;
  margin-right: 0.08em;
  margin-top: 0.05em;
  color: #e85a2c;
}

@media print {
  .navbar,
  .hero-scroll-indicator,
  footer.footer {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .memoir-container {
    max-width: 100% !important;
    padding: 0 !important;
  }
}
