/* Shared design system for don-bosco.studiovellum.ai */

:root {
  --burgundy: #6b1d1d;
  --burgundy-deep: #4a1212;
  --burgundy-soft: #faf2ef;
  --cream: #fbf8f3;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --rule: #e7e1d5;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--burgundy);
  color: var(--cream);
}

a {
  color: var(--burgundy);
  text-decoration-color: rgba(107, 29, 29, 0.35);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--burgundy);
}

em { font-style: italic; }

/* ====== TOP NAV ====== */
.site-nav {
  border-bottom: 1px solid var(--rule);
  background: rgba(251, 248, 243, 0.92);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}
.site-nav-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.site-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Brand mark (top-left) */
.site-nav .brand {
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--burgundy-deep);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-nav .brand:hover { color: var(--burgundy); }

/* Main menu (centered/right) */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-dropdown {
  position: relative;
}

.nav-trigger {
  background: transparent;
  border: none;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}
.nav-trigger:hover,
.nav-trigger:focus-visible,
.nav-dropdown.open .nav-trigger {
  color: var(--burgundy);
  background: var(--burgundy-soft);
  outline: none;
}
.nav-trigger .caret {
  font-size: 0.55rem;
  transition: transform 0.18s;
  opacity: 0.7;
}
.nav-dropdown.open .nav-trigger .caret {
  transform: rotate(180deg);
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(74, 18, 18, 0.10), 0 2px 6px rgba(74, 18, 18, 0.06);
  padding: 0.4rem 0;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
}
.nav-dropdown.open .nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-submenu li {
  margin: 0;
  padding: 0;
}
.nav-submenu li.separator {
  height: 1px;
  background: var(--rule);
  margin: 0.4rem 0;
}
.nav-submenu a {
  display: block;
  padding: 0.55rem 1.1rem;
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.4;
  transition: background 0.12s, color 0.12s;
}
.nav-submenu a:hover {
  background: var(--burgundy-soft);
  color: var(--burgundy-deep);
}
.nav-submenu a .meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-left: 0.45rem;
  font-weight: 500;
}
.nav-submenu a:hover .meta { color: var(--burgundy); }

/* Mobile menu toggle (hamburger) */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  color: var(--burgundy);
  font-size: 1.1rem;
  line-height: 1;
}
.nav-toggle:hover {
  border-color: var(--burgundy);
}

/* ====== FONT-SIZE TOGGLE ====== */
.fontsize-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  background: #ffffff;
}
.fontsize-btn {
  font-family: 'EB Garamond', serif;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.55rem;
  line-height: 1.8rem;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.fontsize-btn:hover { color: var(--burgundy); }
.fontsize-btn.active {
  background: var(--burgundy);
  color: var(--cream);
}
.fontsize-btn[data-size="md"] { font-size: 0.92rem; }
.fontsize-btn[data-size="lg"] { font-size: 1.05rem; }
.fontsize-btn[data-size="xl"] { font-size: 1.2rem; }

/* ====== READING PAGE LAYOUT ====== */
.reading {
  max-width: 680px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
  font-size: 21px;
  line-height: 1.7;
}
/* .reading wrapper scales so EM-based headings track. */
body[data-fontsize="lg"] .reading { font-size: 24px; }
body[data-fontsize="xl"] .reading { font-size: 28px; }

/* Explicit body-text rules at high specificity so the toggle change is
   guaranteed to land. Sizes tuned for comfortable larger text, not
   accessibility-mode large-print. */
.reading-body p,
.reading-body li,
.reading-body blockquote,
.reading-body dd,
.reading-body dt {
  font-size: 21px;
  line-height: 1.7;
}
body[data-fontsize="lg"] .reading-body p,
body[data-fontsize="lg"] .reading-body li,
body[data-fontsize="lg"] .reading-body blockquote,
body[data-fontsize="lg"] .reading-body dd,
body[data-fontsize="lg"] .reading-body dt {
  font-size: 24px;
  line-height: 1.65;
}
body[data-fontsize="xl"] .reading-body p,
body[data-fontsize="xl"] .reading-body li,
body[data-fontsize="xl"] .reading-body blockquote,
body[data-fontsize="xl"] .reading-body dd,
body[data-fontsize="xl"] .reading-body dt {
  font-size: 28px;
  line-height: 1.6;
}

.reading-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.reading-kicker {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--burgundy);
  margin-bottom: 1rem;
}
.reading-header h1 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 0.7rem;
  color: var(--burgundy-deep);
  letter-spacing: -0.01em;
}
.reading-header .reading-subtitle {
  font-style: italic;
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0;
}
.reading-header .reading-subtitle em { font-style: normal; }

/* Body content from pandoc. font-size is inherited from .reading (the article
   wrapper), which is overridden by body[data-fontsize="lg"|"xl"] .reading
   to scale the entire reading column. */
.reading-body {
  font-size: 1em;
}
.reading-body p {
  margin: 0 0 1.1em;
  font-size: 1em;
}
.reading-body h1 {
  /* shouldn't appear, but just in case */
  display: none;
}
.reading-body h2 {
  font-family: 'EB Garamond', serif;
  font-size: 1.35em;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--burgundy-deep);
  line-height: 1.22;
  margin: 2.6em 0 0.8em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--rule);
}
.reading-body h2:first-child {
  margin-top: 0;
}
/* Italian original title inside h2 (e.g., "(In che cosa consista...)")
   stays italic but at slightly smaller weight to keep the English title primary */
.reading-body h2 em {
  font-style: italic;
  font-weight: 400;
  color: var(--burgundy);
  font-size: 0.85em;
}
.reading-body h3 {
  font-family: 'EB Garamond', serif;
  font-size: 1.15em;
  font-weight: 500;
  color: var(--burgundy-deep);
  font-style: italic;
  margin: 2.2em 0 0.8em;
  letter-spacing: 0;
}
.reading-body hr {
  border: none;
  height: 1px;
  background: var(--rule);
  margin: 2.5rem auto;
  max-width: 200px;
}
.reading-body blockquote {
  border-left: 3px solid var(--burgundy);
  background: var(--burgundy-soft);
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  font-style: italic;
  color: var(--burgundy-deep);
  border-radius: 0 4px 4px 0;
}
.reading-body blockquote p { margin: 0.5rem 0; }
.reading-body blockquote p:first-child { margin-top: 0; }
.reading-body blockquote p:last-child { margin-bottom: 0; }

.reading-body strong {
  color: var(--burgundy-deep);
  font-weight: 600;
}

/* Tables in reading body (e.g., the 8-week arc table in Session 1) */
.reading-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 0.95em;
}
.reading-body table thead th {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-align: left;
  padding: 0.4em 0.6em 0.7em;
  border-bottom: 2px solid var(--burgundy);
}
.reading-body table tbody td {
  border-bottom: 1px solid var(--rule);
  padding: 0.65em 0.6em;
  vertical-align: top;
  line-height: 1.45;
}
.reading-body table tbody tr:last-child td {
  border-bottom: none;
}
/* First column = week number; second = date; third = session description.
   Keep the first two narrow so the session column gets the room. */
.reading-body table tbody td:first-child {
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  color: var(--burgundy);
  width: 60px;
  text-align: center;
}
.reading-body table tbody td:nth-child(2) {
  width: 90px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.reading-body table thead th:first-child {
  text-align: center;
  width: 60px;
}
.reading-body table thead th:nth-child(2) {
  width: 90px;
}

/* Translator's note styling: dropped. The previous rule used the general
   sibling combinator ~ p which matched every paragraph after the note heading,
   not just the note paragraphs, and locked them all to 0.97rem (defeating the
   font-size toggle). Cleanest fix is to remove the rule entirely; the note
   displays at body size, which is fine. */

/* Footnotes (pandoc style) */
.reading-body .footnotes {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.reading-body .footnotes hr { display: none; }
.reading-body .footnotes ol {
  padding-left: 1.5rem;
}
.reading-body .footnotes li {
  margin-bottom: 1rem;
}
.reading-body .footnote-ref {
  font-size: 0.75em;
  vertical-align: super;
  text-decoration: none;
  line-height: 0;
}
.reading-body .footnote-back {
  text-decoration: none;
  margin-left: 0.3em;
}

/* ====== READING FOOTER NAV ====== */
.reading-footer {
  max-width: 660px;
  margin: 4rem auto 0;
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid var(--rule);
}
.reading-footer-heading {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 1.25rem;
  text-align: center;
}
.reading-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .reading-cards { grid-template-columns: 1fr 1fr; }
}
.reading-card {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #ffffff;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.reading-card:hover {
  border-color: rgba(107, 29, 29, 0.35);
  box-shadow: 0 4px 14px rgba(74, 18, 18, 0.05);
  transform: translateY(-1px);
}
.reading-card .label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--burgundy);
  margin-bottom: 0.4rem;
  display: block;
}
.reading-card .title {
  font-family: 'EB Garamond', serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--burgundy-deep);
  line-height: 1.3;
  display: block;
  margin-bottom: 0.3rem;
}
.reading-card .meta {
  font-size: 0.92rem;
  color: var(--muted);
  font-style: italic;
}

/* ====== READINGS INDEX PAGE ====== */
.library {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
}
.library-header {
  text-align: center;
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.library-header h1 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 500;
  color: var(--burgundy-deep);
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
}
.library-header .lead {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 540px;
  margin: 1rem auto 0;
}
.library-list {
  display: grid;
  gap: 1.25rem;
}
.library-item {
  display: block;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.75rem 1.75rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.18s;
}
.library-item:hover {
  border-color: rgba(107, 29, 29, 0.35);
  box-shadow: 0 6px 20px rgba(74, 18, 18, 0.06);
  transform: translateY(-1px);
}
.library-item-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--burgundy);
  margin-bottom: 0.6rem;
}
.library-item h2 {
  font-family: 'EB Garamond', serif;
  font-size: 1.55rem;
  font-weight: 500;
  color: var(--burgundy-deep);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.library-item .desc {
  font-size: 1.02rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}

/* ====== MOBILE ====== */
@media (max-width: 720px) {
  .reading { font-size: 19px; padding: 2.5rem 1.25rem 4rem; }
  body[data-fontsize="lg"] .reading { font-size: 22px; }
  body[data-fontsize="xl"] .reading { font-size: 26px; }

  .reading-body p,
  .reading-body li,
  .reading-body blockquote,
  .reading-body dd,
  .reading-body dt {
    font-size: 19px;
  }
  body[data-fontsize="lg"] .reading-body p,
  body[data-fontsize="lg"] .reading-body li,
  body[data-fontsize="lg"] .reading-body blockquote,
  body[data-fontsize="lg"] .reading-body dd,
  body[data-fontsize="lg"] .reading-body dt {
    font-size: 22px;
  }
  body[data-fontsize="xl"] .reading-body p,
  body[data-fontsize="xl"] .reading-body li,
  body[data-fontsize="xl"] .reading-body blockquote,
  body[data-fontsize="xl"] .reading-body dd,
  body[data-fontsize="xl"] .reading-body dt {
    font-size: 26px;
  }
  .reading-header { margin-bottom: 2rem; padding-bottom: 1.5rem; }
  .reading-body h2 { margin: 2.5em 0 0.8em; }
  .library { padding: 2.5rem 1.25rem 4rem; }
  .library-header { margin-bottom: 2.5rem; }
  .library-item { padding: 1.4rem 1.4rem; }
  .site-nav-inner { padding: 0.6rem 1rem; }

  /* Mobile menu: hide the menu, show a hamburger toggle */
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--cream);
    border-bottom: 1px solid var(--rule);
    padding: 0.4rem 0;
    display: none;
  }
  .site-nav.nav-open .nav-menu {
    display: flex;
  }
  .nav-dropdown { width: 100%; }
  .nav-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-radius: 0;
    font-size: 0.74rem;
  }
  .nav-submenu {
    position: static;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.3rem 0;
    margin: 0;
    opacity: 1;
    visibility: hidden;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s;
  }
  .nav-dropdown.open .nav-submenu {
    visibility: visible;
    max-height: 600px;
  }
  .nav-submenu a {
    padding: 0.7rem 1.75rem;
  }
}

/* ====== PRINT ====== */
@media print {
  @page {
    size: letter;
    margin: 0.55in 0.7in 0.45in 0.7in;
  }
  body { background: #ffffff; color: #1a1a1a; }
  .site-nav,
  .fontsize-toggle,
  .reading-footer,
  .nav-toggle,
  .pdf-download { display: none !important; }

  .reading {
    max-width: none;
    padding: 0;
    margin: 0;
    font-size: 11pt;
    line-height: 1.5;
  }
  .reading-header {
    text-align: center;
    margin-bottom: 1.2em;
    padding-bottom: 0.8em;
    border-bottom: 1px solid #c8b9a8;
  }
  .reading-header h1 {
    font-size: 22pt;
    margin: 0 0 0.2em;
    color: #6b1d1d;
    line-height: 1.15;
  }
  .reading-header .reading-kicker {
    font-size: 8.5pt;
    letter-spacing: 0.2em;
    color: #6b1d1d;
    margin-bottom: 0.6em;
  }
  .reading-header .reading-subtitle {
    font-size: 11pt;
    color: #555;
  }
  .reading-body p,
  .reading-body li,
  .reading-body blockquote,
  .reading-body dd,
  .reading-body dt {
    font-size: 11pt;
    line-height: 1.5;
    margin: 0.3em 0 0.55em;
  }
  .reading-body h2 {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 14pt;
    color: #6b1d1d;
    margin: 1.1em 0 0.35em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid #ddd;
    page-break-after: avoid;
  }
  .reading-body h2 em {
    font-size: 0.85em;
    font-style: italic;
  }
  .reading-body h3 {
    font-size: 12pt;
    margin: 0.8em 0 0.3em;
    page-break-after: avoid;
  }
  .reading-body blockquote {
    background: transparent;
    border-left: 2px solid #6b1d1d;
    padding: 0.3em 0.9em;
    margin: 0.5em 0;
    font-style: normal;
    color: #1a1a1a;
    border-radius: 0;
  }
  .reading-body blockquote p {
    font-size: 11pt;
    margin: 0.25em 0;
  }
  .reading-body strong { color: #6b1d1d; }
  .reading-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 10.5pt;
  }
  .reading-body table th,
  .reading-body table td {
    border: 1px solid #ccc;
    padding: 3px 8px;
    text-align: left;
  }
  .reading-body table th {
    background: #f2eaea;
    color: #6b1d1d;
  }
  .reading-body hr {
    margin: 0.8em auto;
    max-width: 200px;
  }
  /* Avoid orphan headings + keep prayers, commitments together */
  .reading-body blockquote,
  .reading-body table { page-break-inside: avoid; }
}

/* ====== HOMEPAGE FONT-SIZE TOGGLE ======
   Mirrors the .reading scaling for the homepage's .page layout.
   Targets prose-heavy elements; structural pieces (h1/h2, kickers,
   cards) keep their fixed sizes so the layout doesn't break. */
body[data-fontsize="lg"] .page section > p,
body[data-fontsize="lg"] .page .pillar p,
body[data-fontsize="lg"] .page .session-steps li,
body[data-fontsize="lg"] .page .ask-block p,
body[data-fontsize="lg"] .page .ask-block .pull,
body[data-fontsize="lg"] .page .practical dd,
body[data-fontsize="lg"] .page .arc tbody td {
  font-size: 1.18rem;
  line-height: 1.65;
}
body[data-fontsize="xl"] .page section > p,
body[data-fontsize="xl"] .page .pillar p,
body[data-fontsize="xl"] .page .session-steps li,
body[data-fontsize="xl"] .page .ask-block p,
body[data-fontsize="xl"] .page .ask-block .pull,
body[data-fontsize="xl"] .page .practical dd,
body[data-fontsize="xl"] .page .arc tbody td {
  font-size: 1.35rem;
  line-height: 1.6;
}
