/* CatholicDoorway.com — shared styles */
:root {
  --bg: #faf6ee;
  --bg-alt: #f3ecdd;
  --surface: #ffffff;
  --ink: #1f2430;
  --ink-soft: #4a5060;
  --navy: #1d2b4f;
  --navy-deep: #131d38;
  --gold: #a8802f;
  --gold-soft: #e7d6ad;
  --line: #e2d8c3;
  --link: #24407a;
  --link-hover: #8a5f12;
  --focus: #c8962e;
  --shadow: 0 1px 2px rgba(29, 43, 79, .06), 0 6px 20px rgba(29, 43, 79, .06);
  --radius: 14px;
  --maxw: 1120px;
  --read: 70ch;
  --serif-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* liturgical colors */
  --lit-green: #3f7a4a;
  --lit-violet: #6a3f8a;
  --lit-white: #c9a64a;
  --lit-red: #a8322d;
  --lit-rose: #c9798e;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151d;
    --bg-alt: #181c27;
    --surface: #1c2130;
    --ink: #ece7dc;
    --ink-soft: #b9b3a6;
    --navy: #d9c48f;
    --navy-deep: #0c0f16;
    --gold: #d4b26a;
    --gold-soft: #3b3423;
    --line: #2c3243;
    --link: #a9c1f0;
    --link-hover: #e2c37c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151d;
  --bg-alt: #181c27;
  --surface: #1c2130;
  --ink: #ece7dc;
  --ink-soft: #b9b3a6;
  --navy: #d9c48f;
  --navy-deep: #0c0f16;
  --gold: #d4b26a;
  --gold-soft: #3b3423;
  --line: #2c3243;
  --link: #a9c1f0;
  --link-hover: #e2c37c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { font-family: var(--serif-display); color: var(--navy); line-height: 1.15; font-weight: 600; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); margin-top: .2em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.3rem); }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }
p, ul, ol { margin: 0 0 1em; }
li { margin-bottom: .35em; }
small, .small { font-size: .9rem; }
.muted { color: var(--ink-soft); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.prose { max-width: var(--read); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--navy); }
.brand svg { width: 34px; height: 40px; flex: none; }
.brand-name { font-family: var(--serif-display); font-size: 1.45rem; font-weight: 600; letter-spacing: .01em; line-height: 1; }
.brand-name span { color: var(--gold); }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  font: 600 .95rem var(--sans); color: var(--navy);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: .45rem .9rem; cursor: pointer;
}
.nav-toggle svg { width: 18px; height: 18px; }
.site-nav { display: none; }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; text-decoration: none; color: var(--ink);
  font: 500 1.02rem var(--sans); padding: .7rem .2rem; border-bottom: 1px solid var(--line);
}
.site-nav a[aria-current="page"] { color: var(--gold); font-weight: 700; }
.site-nav a:hover { color: var(--link-hover); }
@media (max-width: 1199px) {
  .site-nav.open { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: .25rem 16px 1rem; max-height: calc(100vh - 64px); overflow-y: auto; }
  .site-nav.open ul { columns: 2; column-gap: 1.5rem; }
  .site-nav.open li { break-inside: avoid; }
}
@media (max-width: 420px) { .site-nav.open ul { columns: 1; } }
@media (min-width: 1200px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; }
  .site-nav ul { display: flex; gap: .1rem; flex-wrap: nowrap; white-space: nowrap; justify-content: flex-end; }
  .site-nav a { border: 0; padding: .4rem .5rem; font-size: .93rem; border-radius: 8px; }
  .site-nav a[aria-current="page"] { background: var(--gold-soft); color: var(--navy); }
}
.theme-btn { background: none; border: 0; color: var(--ink-soft); cursor: pointer; padding: .4rem; border-radius: 8px; display: inline-flex; }
.theme-btn svg { width: 20px; height: 20px; }
.header-tools { display: flex; align-items: center; gap: .35rem; }
.header-tools, .theme-btn { flex: none; }
@media (min-width: 1200px) { .header-tools { order: 3; } .site-nav { order: 2; margin-left: auto; } .site-nav li:first-child { display: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 400px at 50% -10%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 3.5rem 0 3rem;
}
.hero-door { width: 74px; margin: 0 auto 1rem; color: var(--gold); }
.verse { font-family: var(--serif-display); font-size: clamp(1.9rem, 5.2vw, 3.3rem); line-height: 1.18; color: var(--navy); margin: 0 auto .6rem; max-width: 22ch; font-weight: 500; font-style: italic; }
.verse-cite { font: 600 .95rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 1.6rem; }
.hero-lede { max-width: 46ch; margin: 0 auto 1.8rem; color: var(--ink-soft); font-size: 1.15rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 1rem var(--sans); text-decoration: none; cursor: pointer;
  padding: .8rem 1.3rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--navy); color: var(--bg); min-height: 48px;
}
.btn:hover { color: var(--bg); filter: brightness(1.12); }
.btn.secondary { background: transparent; color: var(--navy); border-color: var(--gold); }
.btn.secondary:hover { background: var(--gold-soft); color: var(--navy); }
.btn.small { padding: .5rem .9rem; min-height: 40px; font-size: .92rem; }

/* ---------- Page header ---------- */
.page-head { background: linear-gradient(180deg, var(--bg-alt), var(--bg)); border-bottom: 1px solid var(--line); padding: 2.4rem 0 1.8rem; }
.page-head .kicker { font: 700 .82rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 0 0 .4rem; }
.page-head p.lede { max-width: 62ch; color: var(--ink-soft); font-size: 1.15rem; margin: 0; }

main { padding-bottom: 4rem; }
section { scroll-margin-top: 80px; }
.section { padding: 2.5rem 0 0; }

/* ---------- Today strip ---------- */
.today { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: -1.6rem auto 0; position: relative; }
@media (min-width: 760px) { .today { grid-template-columns: 1.3fr 1fr 1fr; } }
.today .card { padding: 1.2rem 1.3rem; }
.season-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .45rem; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }
.label { font: 700 .78rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 .3rem; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.5rem; }
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.tile { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: var(--ink); transition: transform .15s ease, border-color .15s ease; }
.tile:hover { transform: translateY(-2px); border-color: var(--gold); color: var(--ink); }
.tile .icon { width: 40px; height: 40px; color: var(--gold); margin-bottom: .3rem; }
.tile h3 { font-size: 1.45rem; margin: 0; }
.tile p { color: var(--ink-soft); margin: 0; font-size: 1rem; }
.tile .go { font: 600 .9rem var(--sans); color: var(--link); margin-top: auto; padding-top: .5rem; }
.tile.feature { background: linear-gradient(160deg, var(--navy), var(--navy-deep)); color: #f4efe3; border-color: transparent; }
.tile.feature h3, .tile.feature .icon { color: #e9cf8e; }
.tile.feature p { color: #d9d3c4; }
.tile.feature .go { color: #e9cf8e; }
:root[data-theme="dark"] .tile.feature { background: linear-gradient(160deg, #2a3557, #1a2140); }

/* ---------- Callouts ---------- */
.note { border-left: 4px solid var(--gold); background: var(--bg-alt); padding: 1rem 1.2rem; border-radius: 0 10px 10px 0; margin: 1.2rem 0; }
.note > :last-child { margin-bottom: 0; }

/* ---------- Steps / timeline ---------- */
.steps { list-style: none; padding: 0; margin: 1.5rem 0; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 1.6rem 3.4rem; counter-increment: step; margin: 0; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 2.3rem; height: 2.3rem; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 1rem var(--sans); color: var(--bg); background: var(--navy);
}
.steps > li::after { content: ""; position: absolute; left: 1.13rem; top: 2.5rem; bottom: .3rem; width: 2px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps h3 { margin: .1rem 0 .3rem; font-size: 1.4rem; }
.rite { display: inline-block; font: 600 .85rem var(--sans); background: var(--gold-soft); color: var(--navy); padding: .3rem .75rem; border-radius: 10px; margin: .2rem 0 .5rem; }

.timeline-bar { display: grid; grid-template-columns: 3fr 4fr 1.2fr 1.5fr; gap: 3px; margin: 1.2rem 0 .4rem; font: 600 .82rem var(--sans); }
.timeline-bar div { padding: .55rem .5rem; color: #fff; text-align: center; border-radius: 6px; }
.timeline-legend { display: flex; justify-content: space-between; font: .85rem var(--sans); color: var(--ink-soft); }
@media (max-width: 600px) { .timeline-bar { grid-template-columns: 1fr; } }

/* ---------- Prayers ---------- */
.toc { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0; padding: 0; list-style: none; }
.toc a { display: inline-block; font: 500 .92rem var(--sans); text-decoration: none; border: 1px solid var(--line); background: var(--surface); padding: .4rem .8rem; border-radius: 999px; color: var(--ink); }
.toc a:hover { border-color: var(--gold); }
.prayer { margin: 0 0 1.2rem; }
.prayer h3 { margin-top: 0; }
.prayer .text { font-size: 1.2rem; line-height: 1.75; white-space: pre-line; }
.prayer .text em { color: var(--ink-soft); }
.prayer-tools { display: flex; gap: .5rem; margin-top: .8rem; }
.copy-btn { font: 600 .85rem var(--sans); background: transparent; border: 1px solid var(--line); color: var(--ink-soft); padding: .35rem .75rem; border-radius: 999px; cursor: pointer; }
.copy-btn:hover { border-color: var(--gold); color: var(--ink); }

.mysteries { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.mysteries .card.today-mystery { border: 2px solid var(--gold); }
.mysteries ol { padding-left: 1.2rem; margin-bottom: 0; }
.badge { display: inline-block; font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: .2rem .55rem; border-radius: 999px; background: var(--gold); color: #fff; vertical-align: middle; margin-left: .4rem; }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 700 .82rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); background: var(--bg-alt); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.2rem 0; }
.search {
  flex: 1 1 260px; font: 1rem var(--sans); padding: .75rem 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 48px;
}
.chip { font: 600 .9rem var(--sans); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .5rem .95rem; border-radius: 999px; cursor: pointer; min-height: 40px; }
.chip[aria-pressed="true"] { background: var(--navy); color: var(--bg); border-color: var(--navy); }

/* ---------- Saints ---------- */
.saint { display: flex; flex-direction: column; gap: .2rem; }
.saint h3 { font-size: 1.35rem; margin: 0; }
.saint .meta { font: .88rem var(--sans); color: var(--ink-soft); }
.saint p { font-size: 1rem; margin: .4rem 0 0; }
.status { align-self: flex-start; font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: .22rem .6rem; border-radius: 999px; margin-bottom: .4rem; }
.status.s-saint { background: #f3e6c4; color: #6b4d10; }
.status.s-blessed { background: #dfe8f6; color: #23407a; }
.status.s-venerable { background: #e6def0; color: #4d2d6b; }
.status.s-servant { background: #e2ece3; color: #2c5634; }
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1.4rem 0; counter-reset: lad; }
.ladder div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem; position: relative; }
.ladder div strong { display: block; font-family: var(--serif-display); font-size: 1.25rem; color: var(--navy); }
.ladder div span { font-size: .92rem; color: var(--ink-soft); display: block; line-height: 1.45; }
@media (max-width: 760px) { .ladder { grid-template-columns: 1fr 1fr; } }

/* ---------- Glossary ---------- */
.alpha { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0; }
.alpha a { font: 600 .9rem var(--sans); text-decoration: none; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
dl.glossary dt { font-family: var(--serif-display); font-size: 1.4rem; font-weight: 600; color: var(--navy); margin-top: 1.3rem; scroll-margin-top: 80px; }
dl.glossary dd { margin: .2rem 0 0; max-width: var(--read); }
dl.glossary dt:target { background: var(--gold-soft); border-radius: 6px; padding: 0 .3rem; }
.letter-head { font: 700 1rem var(--sans); color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: .3rem; margin-top: 2.2rem; letter-spacing: .1em; }

/* ---------- Structure diagram ---------- */
.org { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 1.5rem 0; }
.org .node { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; text-align: center; width: min(100%, 520px); box-shadow: var(--shadow); }
.org .node strong { font-family: var(--serif-display); font-size: 1.3rem; color: var(--navy); display: block; }
.org .node span { font-size: .95rem; color: var(--ink-soft); }
.org .node.top { border: 2px solid var(--gold); }
.org .link { width: 2px; height: 22px; background: var(--gold); }
.org .side { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; width: min(100%, 520px); }
.org .side .node { width: 100%; }

/* ---------- Map ---------- */
.map-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.2rem; }
@media (min-width: 960px) { .map-layout { grid-template-columns: 1.6fr 1fr; } }
#map { height: 62vh; min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 1; }
.map-search { display: flex; flex-wrap: wrap; gap: .6rem; }
.map-search .search { flex: 1 1 240px; }
.results { max-height: 62vh; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; padding-right: 2px; }
@media (max-width: 959px) { .results { max-height: none; } }
.church h3 { font-size: 1.25rem; margin: 0 0 .2rem; }
.church .dist { font: 600 .85rem var(--sans); color: var(--gold); }
.church .addr { font-size: .98rem; margin: .2rem 0 .5rem; }
.church .actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.church .times { font-size: .92rem; background: var(--bg-alt); padding: .5rem .7rem; border-radius: 8px; margin: .4rem 0 .6rem; }
.church.active { border-color: var(--gold); border-width: 2px; }
.status-msg { font: 1rem var(--sans); color: var(--ink-soft); padding: .8rem 0; }
.leaflet-popup-content { font-family: var(--sans); font-size: .95rem; }
.leaflet-popup-content strong { font-size: 1.05rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-deep); color: #cfc8b8; padding: 2.8rem 0 2rem; font-size: 1rem; }
.site-footer a { color: #e9cf8e; }
.footer-grid { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.site-footer h4 { color: #f1e9d6; margin: 0 0 .6rem; font-size: 1.25rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .35rem; }
.footer-verse { font-family: var(--serif-display); font-style: italic; font-size: 1.3rem; color: #f1e9d6; }
.footer-base { border-top: 1px solid rgba(255,255,255,.1); margin-top: 2rem; padding-top: 1.2rem; font-size: .88rem; color: #a59f92; }

/* Two-column content with side nav on wide screens */
.with-aside { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .with-aside { grid-template-columns: 220px 1fr; } .aside-nav { position: sticky; top: 90px; align-self: start; } }
.aside-nav ul { list-style: none; padding: 0; margin: 1.5rem 0 0; border-left: 2px solid var(--line); }
.aside-nav a { display: block; padding: .3rem .9rem; text-decoration: none; font: 500 .95rem var(--sans); color: var(--ink-soft); }
.aside-nav a:hover { color: var(--link-hover); }
@media (max-width: 1023px) { .aside-nav { display: none; } }

.sacraments { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.sacraments .card h4 { margin: 0 0 .3rem; font-size: 1.3rem; }
.sacraments .card p { font-size: 1rem; }
.group-label { font: 700 .78rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }

@media print {
  .site-header, .site-footer, .nav-toggle, .copy-btn, .btn-row { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .card { box-shadow: none; }
}

.cd-pin { background: none; border: 0; }
[hidden] { display: none !important; }
.section > h2:first-child { margin-top: .4em; }
