:root {
  --surface:        #F7F2E8;
  --surface-2:   #EDE4D2;
  --accent:         #7A5C12;
  --accent-2:   #b68e2c;
  --rubric:       #7A2020;
  --ink:          #3D2A0E;
  --ink-body:     #2B1E0A;
  --bg:       #C8B89A;
  /* --bg #C8B89A is the deep parchment BEHIND the cream card — about five
     times darker than --surface, and the surface the footer and the page kicker
     sit on directly. --accent on the card is fine; the same gold on the ground
     is 2.61:1, and even the darkened site gold only reaches 3.20. No value
     that still reads as gold clears 4.5 there, so text ON the ground takes its
     own token. 4.66:1 in day. Absent from the night block on purpose: there
     --bg is #0E0A06 and the light night gold is already 7.55:1, so it
     falls back to --accent. */
  --accent-ground:  #5C450D;
  --ink-3:   #4E402A;
  --rule:       rgba(139,105,20,0.30);
  --shadow:  0 2px 18px rgba(80,55,15,0.12), 0 1px 3px rgba(80,55,15,0.08);
  --focus-ring:   #B68F2C;
  --font-display: 'Cinzel', Georgia, serif;
  --font-body:    'EB Garamond', Georgia, serif;
  --font-italic:  'IM Fell English', Georgia, serif;
}
[data-theme="night"] {
  --surface:        #1A1410;
  --surface-2:   #221912;
  --accent:         #c9a14a;
  --accent-2:   #dbaf4e;
  --rubric:       #e8736e;
  --ink:          #E8DCC8;
  --ink-body:     #D8CCB8;
  --bg:       #0E0A06;
  --accent-ground:  var(--accent);
  --ink-3:   #ACA191;
  --rule:       rgba(196,154,60,0.28);
  --shadow:  0 2px 22px rgba(0,0,0,0.55), 0 1px 4px rgba(0,0,0,0.40);
  --focus-ring:   #DBB84E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

body {
  background: var(--bg);
  color: var(--ink-body);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.65;
  min-height: 100vh;
  transition: background-color 280ms ease, color 280ms ease;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--surface);
  padding: 0.75rem 1.25rem; font-family: var(--font-display);
  text-decoration: none; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; outline: 3px solid var(--focus-ring); }

/* ── TOP BAR ─────────────────────────────────────────── */
.topbar {
  background: var(--ink);
  color: var(--surface);
  padding: 0.65rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
  border-bottom: 2px solid var(--accent);
  position: sticky; top: 0; z-index: 50;
}
[data-theme="night"] .topbar { background: #0A0704; }

/* topbar-night-fix */
/* .topbar sets color: var(--surface), the page-background token, which
   inverts to #1A1410 at night while the bar goes to #0A0704 — dark on
   darker, 1.1:1. --ink inverts the other way (#3D2A0E day, #E8DCC8
   night), so it is the correct token for text on a permanently dark
   bar. Scoped to night only; day was already correct. */
[data-theme="night"] .topbar,
[data-theme="night"] .topbar a,
[data-theme="night"] .topbar button,
[data-theme="night"] .topbar-brand { color: var(--ink); }

.topbar a {
  color: var(--surface); text-decoration: none;
  font-family: var(--font-display); font-size: 0.85rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.35rem 0.65rem; border-radius: 2px;
  transition: background-color 180ms ease;
}
.topbar a:hover, .topbar a:focus { background: rgba(255,255,255,0.10); outline: none; }
.topbar a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.topbar-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.topbar-brand {
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.95rem; letter-spacing: 0.10em;
}
.topbar-brand .cross { color: var(--accent-2); margin-right: 0.4rem; }

.theme-toggle {
  background: transparent; color: var(--surface); border: 1px solid rgba(255,255,255,0.30);
  padding: 0.35rem 0.85rem; border-radius: 2px;
  font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}
.theme-toggle:hover { background: rgba(255,255,255,0.10); border-color: var(--accent-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ── PAGE FRAME ───────────────────────────────────────── */
main {
  max-width: 720px;
  margin: 2rem auto 4rem;
  padding: 0 1.5rem;
}

.parchment {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3rem 3.25rem 3.5rem;
  box-shadow: var(--shadow);
  position: relative;
}
.parchment::before, .parchment::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  width: 70%; height: 1px; background: var(--rule);
}
.parchment::before { top: 1rem; }
.parchment::after  { bottom: 1rem; }

/* ── HEADING BLOCK ───────────────────────────────────── */
.kicker {
  font-family: var(--font-display);
  color: var(--accent); font-size: 0.85rem; letter-spacing: 0.20em;
  text-transform: uppercase; text-align: center;
  margin-bottom: 0.9rem;
}
.kicker .cross { color: var(--accent-2); margin: 0 0.45rem; }
h1 {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: clamp(1.85rem, 3.6vw, 2.55rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center; line-height: 1.18;
  margin: 0.4rem 0 1.0rem;
}
.subtitle {
  font-family: var(--font-italic);
  color: var(--rubric);
  font-size: 1.20rem; font-style: italic;
  text-align: center;
  margin-bottom: 0.5rem;
}
.dateline {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  text-align: center; opacity: 0.78;
  margin-bottom: 2.4rem;
}

/* ── PASTORAL PREFACE ASIDE ──────────────────────────── */
.preface {
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  border-radius: 0 3px 3px 0;
  padding: 1.15rem 1.4rem;
  margin: 0 0 2.2rem;
  font-family: var(--font-italic);
  font-style: italic;
  color: var(--ink-body);
  font-size: 1.05rem; line-height: 1.6;
}
.preface .label {
  display: block;
  font-family: var(--font-display);
  font-style: normal;
  color: var(--accent);
  font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

/* ── PROPERS CARD ───────────────────────────────────── */
.propers {
  border: 1px solid var(--rule);
  background: var(--surface-2);
  border-radius: 3px;
  padding: 1.5rem 1.6rem 1.2rem;
  margin: 0 0 2.4rem;
  font-size: 0.98rem;
}
.propers-title {
  font-family: var(--font-display);
  color: var(--rubric);
  font-size: 0.78rem; letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 1.0rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--rule);
}
.propers dt {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.74rem; letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 0.85rem;
}
.propers dt:first-child { margin-top: 0; }
.propers dd {
  font-family: var(--font-body);
  color: var(--ink-body);
  margin: 0.20rem 0 0;
  line-height: 1.55;
}
.propers dd em { font-family: var(--font-italic); }
.propers-note {
  font-family: var(--font-italic);
  font-style: italic;
  color: var(--ink-body);
  opacity: 0.75;
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 1.0rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}


/* ── BODY PROSE ─────────────────────────────────────── */
.homily-body {
  font-family: var(--font-body);
  color: var(--ink-body);
  font-size: 1.10rem;
  line-height: 1.72;
  text-align: justify;
  hyphens: auto;
}
.homily-body p { margin: 0 0 1.15rem; }
.homily-body em { font-family: var(--font-italic); font-style: italic; }
.homily-body strong { font-weight: 600; color: var(--ink); }

/* drop cap on first paragraph */
.homily-body > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.55rem;
  font-weight: 600;
  color: var(--accent);
  float: left;
  line-height: 0.92;
  margin: 0.18rem 0.55rem -0.10rem 0;
}

/* movement headings */
.movement {
  font-family: var(--font-display);
  color: var(--rubric);
  font-size: 1.10rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  margin: 2.4rem 0 1.1rem;
  padding: 0;
}
.movement em { font-family: var(--font-italic); font-style: italic; }

/* section ornaments */
.ornament {
  text-align: center;
  margin: 2.0rem 0;
  color: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 0.5em;
}
.ornament::before { content: "✟ ❦ ✟"; opacity: 0.55; }

/* pull quote */
.pullquote {
  margin: 2.0rem 1.5rem;
  padding: 1.0rem 1.2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-italic);
  font-style: italic;
  color: var(--accent);
  font-size: 1.15rem;
  text-align: center;
  line-height: 1.45;
}

/* benediction */
.benediction {
  font-family: var(--font-italic);
  font-style: italic;
  color: var(--rubric);
  font-size: 1.10rem;
  text-align: center;
  margin: 2.3rem 0 0.6rem;
  line-height: 1.55;
}
.benediction .amen {
  display: block;
  font-family: var(--font-display);
  font-style: normal;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  margin-top: 0.8rem;
}

/* signature */
.sig {
  margin: 2.6rem 0 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-family: var(--font-italic);
  font-style: italic;
  color: var(--ink-body);
  font-size: 0.95rem;
  line-height: 1.65;
}
.sig .name {
  display: block;
  font-family: var(--font-display); font-style: normal;
  color: var(--ink); font-size: 0.85rem;
  letter-spacing: 0.10em; text-transform: uppercase;
  margin-bottom: 0.30rem;
}

/* ── FOOTER ─────────────────────────────────────────── */
footer {
  max-width: 720px; margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  text-align: center;
  font-family: var(--font-display);
  color: var(--ink-body);
  font-size: 0.78rem; letter-spacing: 0.12em;
  /* opacity:0.78 used to mute the whole footer, which also muted the link
     inside it: --accent-ground rendered as #745e2c on the ground, 3.18:1, so
     the fix above did nothing until this came out. The fade is baked into
     --ink-3 instead — the same pixels as 0.78 over --bg, 5.16:1 in
     day and 7.76:1 at night — leaving the LINK at full strength, which is
     what it needed to be. */
  text-transform: uppercase; color: var(--ink-3);
}
footer a { color: var(--accent-ground); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── MOBILE ─────────────────────────────────────────── */
@media (max-width: 540px) {
  body { font-size: 17px; }
  main { margin: 1rem auto 2.5rem; padding: 0 0.75rem; }
  .parchment { padding: 2rem 1.4rem 2.3rem; }
  .homily-body { font-size: 1.04rem; text-align: left; hyphens: manual; }
  .homily-body > p:first-of-type::first-letter { font-size: 2.85rem; }
  .pullquote { margin: 1.5rem 0.5rem; font-size: 1.05rem; }
  .topbar { padding: 0.55rem 0.85rem; }
  .topbar-brand { font-size: 0.85rem; }
  .topbar a { font-size: 0.74rem; padding: 0.30rem 0.50rem; }
  .preface { padding: 0.95rem 1.05rem; font-size: 0.98rem; }
}

/* ── PRINT ───────────────────────────────────────────── */
@media print {
  body { background: white; color: black; font-size: 12pt; }
  .topbar, .theme-toggle, .skip-link, footer { display: none !important; }
  main { margin: 0; padding: 0; max-width: 100%; }
  .parchment { box-shadow: none; border: none; padding: 0; }
  .parchment::before, .parchment::after { display: none; }
  .homily-body { font-size: 12pt; }
  h1 { font-size: 22pt; }
  .preface, .propers { page-break-inside: avoid; }
  a { color: black; text-decoration: none; }
}

/* skip-link:begin */
.skip-link{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}
.skip-link:focus{position:fixed;top:.75rem;left:.75rem;z-index:1000;width:auto;height:auto;margin:0;padding:.6rem 1rem;overflow:visible;clip:auto;clip-path:none;background:#2a1a08!important;color:#FAF5EB!important;font-family:'Cinzel',Georgia,serif;font-size:.8rem;letter-spacing:.08em;text-decoration:none;border-radius:3px;outline:2px solid #FAF5EB;outline-offset:-4px;box-shadow:0 0 0 2px #2a1a08,0 0 0 4px #FAF5EB}
/* skip-link:end */
