/* ============================================================
   Sites of Grace — site chrome (header, nav, footer)
   Brand tokens from the brand guide. Page-body styles live
   elsewhere; this file only dresses the shell.
   ============================================================ */

:root {
  --navy:      #032553;  /* Deep Marian Navy */
  --blue:      #173A61;  /* Pilgrimage Blue  */
  --ivory:     #FDF9F2;  /* Sacred Ivory     */
  --parchment: #F9F1E8;  /* Pilgrim Parchment*/
  --gold:      #C79A42;  /* Soft Sacred Gold */
  --red:       #D96B5F;  /* Miracle Red      */
  --stone:     #5F6470;  /* Stone Gray       */
  --gold-soft: rgba(199,154,66,.35);

  --serif-titling: "Cinzel", Georgia, serif;
  --serif-display: "Cormorant Garamond", Georgia, serif;
  --serif-body:    "Lora", Georgia, serif;
  --sans:          "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--serif-body);
  color: var(--navy);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.container { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 10px; z-index: 2000;
  background: var(--navy); color: var(--ivory); padding: .5rem 1rem; border-radius: 6px;
}
.skip-link:focus { left: 12px; }

:where(a, button, input):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  border-radius: 999px; padding: 10px 20px; border: 1px solid transparent;
  cursor: pointer; transition: background .18s ease, transform .18s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: var(--ivory); }
.btn-primary:hover { background: var(--blue); }
.btn-secondary { background: var(--ivory); color: var(--navy); border: 1px solid var(--gold); }
.btn-secondary:hover { background: var(--parchment); }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-gold:hover { filter: brightness(1.05); }

/* ---------- Header ---------- */
.site-header {
  /* 1100, not 1000: Leaflet's controls sit at z-index 1000 in the root
     stacking context, and the account menu panel (a child of this header)
     has to open over them on the map page. */
  position: sticky; top: 0; z-index: 1100;
  background: rgba(253,249,242,.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gold-soft);
}
.header-inner {
  display: flex; align-items: center; gap: 28px; min-height: 84px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo, .footer-logo { display: block; height: auto; }
.brand-wordmark {
  font-family: var(--serif-titling); font-weight: 500;
  font-size: 26px; letter-spacing: .06em; color: var(--navy);
}

.primary-nav { flex: 1; }
.nav-list {
  display: flex; align-items: center; gap: 26px;
  list-style: none; margin: 0; padding: 0; justify-content: center;
  font-family: var(--sans); font-size: 15px; font-weight: 500;
}
.nav-item { position: relative; }
.nav-item > a {
  padding: 8px 0; display: inline-flex; align-items: center; gap: 5px;
  border-bottom: 2px solid transparent; transition: color .15s ease, border-color .15s ease;
}
.nav-item > a:hover,
.nav-item.active > a { color: var(--gold); border-color: var(--gold); }
.caret { font-size: 10px; color: var(--gold); }

/* Dropdown — opens on hover and keyboard focus */
.subnav {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(6px);
  min-width: 230px; list-style: none; margin: 0; padding: 8px;
  background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(3,37,83,.35);
  opacity: 0; visibility: hidden; transition: opacity .16s ease, transform .16s ease;
}
.has-submenu:hover > .subnav,
.has-submenu:focus-within > .subnav {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(4px);
}
.subnav .nav-item > a {
  display: block; padding: 9px 12px; border: 0; border-radius: 8px; font-weight: 500;
}
.subnav .nav-item > a:hover { background: var(--parchment); color: var(--navy); }

.header-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* The header search box gives up width before anything else does: 220px
   when there's room, down to 130px as the bar fills (search.css sets the
   fixed 220px; this lets it flex instead). The nav text never shrinks. */
.header-actions .sog-search--header { width: auto; flex: 0 1 220px; min-width: 130px; }
.header-actions .sog-search--header input[type="search"] { min-width: 0; }
.nav-toggle {
  display: none; background: transparent; border: 0; font-size: 24px;
  color: var(--navy); cursor: pointer; line-height: 1;
}

/* ---------- Account menu (signed in) ----------
   includes/_account_menu.html: a <details> disclosure under the pilgrim's
   name. The trigger takes the nav items' "current" treatment on any of the
   pilgrim's own pages. */
.account-menu { position: relative; }
.account-trigger {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  list-style: none; padding: 6px 2px; border-bottom: 2px solid transparent;
  font-family: var(--sans); font-size: 15px; font-weight: 500; color: var(--navy);
  transition: color .15s ease, border-color .15s ease;
}
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger:hover,
.account-menu.is-current > .account-trigger { color: var(--gold); border-color: var(--gold); }
.account-trigger:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.account-avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center;
  background: var(--gold-soft); color: var(--navy);
  font-family: var(--serif-display); font-size: 17px; font-weight: 600; line-height: 1;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-trigger-name {
  max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 900-1179px: the nav and search need the room, so the trigger is the
   avatar alone (the full name stays in its title and aria-label), the nav
   gaps tighten, and the search box may go down to 116px -- the signed-out
   "Sign in" button is wider than the avatar and needs the extra 14px just
   above 900px. At 1180px and up the name shows beside the avatar. */
@media (min-width: 901px) and (max-width: 1179.98px) {
  .account-trigger-name { display: none; }
  .nav-list { gap: 12px; }
  .header-inner { gap: 18px; }
  .header-actions .sog-search--header { min-width: 116px; }
}
.account-trigger-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.account-chevron { width: 12px; height: 12px; flex: none; color: var(--gold); transition: transform .16s ease; }
.account-menu[open] .account-chevron { transform: rotate(180deg); }

.account-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 10;
  width: 240px; padding: 8px;
  background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(3,37,83,.35);
  font-family: var(--sans);
}
.account-panel-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--gold-soft);
}
.account-panel-name {
  font-family: var(--serif-display); font-size: 19px; font-weight: 600; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-panel-profile { font-size: 12.5px; font-weight: 600; color: var(--blue); }
.account-panel-profile:hover,
.account-panel-profile[aria-current="page"] { color: var(--gold); }
.account-panel-list { list-style: none; margin: 0; padding: 0; }
.account-panel-list a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--navy);
}
.account-panel-list a:hover { background: var(--parchment); }
.account-panel-list a[aria-current="page"] { color: var(--gold); font-weight: 600; }
.account-icon { flex: none; width: 18px; height: 18px; color: var(--gold); }
.account-icon svg { width: 18px; height: 18px; display: block; }
.account-panel-signout { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--gold-soft); }
.account-panel-signout button,
.mobile-signout button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--stone);
  padding: 9px 10px; border-radius: 8px;
}
.account-panel-signout button:hover { background: var(--parchment); color: var(--navy); }
.account-panel-list .pilgrims-nav-badge,
.mobile-account-list .pilgrims-nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: auto;
  border-radius: 999px; background: var(--gold); color: #fff;
  font-family: var(--sans); font-size: 11px; font-weight: 700;
}

/* ---------- Mobile nav ---------- */
.mobile-nav { border-top: 1px solid var(--gold-soft); background: var(--ivory); }
.mobile-list, .mobile-sublist { list-style: none; margin: 0; padding: 0; font-family: var(--sans); }
.mobile-list > li > a {
  display: block; padding: 14px 20px; font-size: 16px; font-weight: 500;
  border-bottom: 1px solid var(--parchment);
}
.mobile-sublist > li > a { display: block; padding: 10px 20px 10px 36px; color: var(--stone); }

/* "My account" group (signed in): heading with avatar + name, then the
   pilgrim's own links, above the site links. Sign out comes last. */
.mobile-account { background: var(--parchment); border-bottom: 1px solid var(--gold-soft); }
.mobile-account-head {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 20px 6px;
  font-family: var(--sans); font-weight: 600; color: var(--navy);
}
.mobile-account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-account-list > li > a { display: flex; align-items: center; padding: 12px 20px 12px 62px; font-size: 15px; border-bottom: 0; }
.mobile-account-list a[aria-current="page"] { color: var(--gold); }
.mobile-signout { border-top: 1px solid var(--gold-soft); }
.mobile-signout button { padding: 14px 20px; font-size: 16px; border-radius: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: rgba(253,249,242,.82); margin-top: 64px; }
.footer-grid {
  display: grid; gap: 34px; padding: 52px 0 40px;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1.4fr;
}
.site-footer h3 {
  font-family: var(--serif-titling); font-weight: 500; font-size: 13px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
  margin: 0 0 14px;
}
.footer-wordmark {
  font-family: var(--serif-titling); font-size: 22px; letter-spacing: .06em;
  color: var(--ivory); display: block; margin-bottom: 12px;
}
.footer-summary { font-size: 14px; line-height: 1.6; max-width: 34ch; margin: 0 0 16px; }
.social { display: flex; gap: 10px; }
.social a {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--gold-soft);
  display: grid; place-items: center; color: var(--ivory); font-size: 13px;
  transition: background .15s ease, color .15s ease;
}
.social a:hover { background: var(--gold); color: var(--navy); border-color: var(--gold); }

.footer-links { list-style: none; margin: 0; padding: 0; font-size: 14.5px; }
.footer-links li { margin: 0 0 9px; }
.footer-links a { color: rgba(253,249,242,.82); transition: color .15s ease; }
.footer-links a:hover { color: var(--gold); }

.footer-newsletter p { font-size: 14px; line-height: 1.55; margin: 0 0 14px; }
.newsletter-form { display: flex; background: #fff; border-radius: 999px; padding: 4px; max-width: 340px; }
.newsletter-form input {
  flex: 1; border: 0; background: transparent; padding: 0 16px;
  font: inherit; color: var(--navy); min-width: 0;
}
.newsletter-form input:focus { outline: none; }

.footer-base { border-top: 1px solid rgba(199,154,66,.25); background: #021b3d; }
.footer-base-inner {
  display: flex; gap: 20px; align-items: center; justify-content: space-between;
  padding: 18px 0; font-size: 12.5px; color: rgba(253,249,242,.6);
}
.footer-base .disclaimer { margin: 0; max-width: 78ch; line-height: 1.55; }
.footer-base .copyright { margin: 0; white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .primary-nav { display: none; }
  .nav-toggle { display: block; }
  .header-actions .btn-primary { display: none; }
  .header-actions .account-menu { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand, .footer-newsletter { grid-column: 1 / -1; }
  .footer-base-inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Section navigation ("On this page") ----------
   One markup component, two layouts: a sticky chip bar under the header by
   default, and a sticky rail in the left margin from 1200px up, where the
   1180px container has room for it beside the 900px reading column. */

.section-layout > :first-child { margin-top: 0; }

.section-nav {
  position: sticky; top: 84px; z-index: 900;
  background: rgba(253, 249, 242, .95);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gold-soft);
  margin-bottom: 6px;
}
.section-nav-title {
  font-family: var(--serif-titling, var(--serif-display)); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--stone);
  margin: 0; padding: 10px 20px 0;
}
.section-nav-list {
  display: flex; gap: 8px; list-style: none; margin: 0;
  padding: 10px 20px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.section-nav-list::-webkit-scrollbar { display: none; }
.section-nav-item { flex: none; scroll-snap-align: center; }
.section-nav-link {
  display: block; white-space: nowrap; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--gold-soft); background: var(--ivory);
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: var(--blue); text-decoration: none; transition: color .15s, border-color .15s;
}
.section-nav-link:hover { color: var(--navy); border-color: var(--gold); }
.section-nav-link[aria-current="true"] {
  color: var(--navy); border-color: var(--gold); background: var(--parchment);
}

/* Second rail level. Only rendered inside a parent entry, only visible in rail
   mode, and only while that parent is the section being read -- otherwise a
   site page's twelve travel panels would make the rail taller than the
   viewport. In chip-bar mode the sub-list is hidden outright: nineteen chips
   scrolling sideways is not navigation. */
.section-nav-sublist { display: none; }

/* Anchor targets clear the sticky header (84px) plus the chip bar. */
.section-anchor { scroll-margin-top: 150px; }

@media (min-width: 1200px) {
  /* Only --with-nav becomes a grid. A bare .section-layout has no rail to sit
     beside it, so it must stay a plain block or its content lands in the
     210px nav column. */
  .section-layout--with-nav {
    display: grid; grid-template-columns: 210px minmax(0, 900px); gap: 40px;
    width: min(1150px, calc(100% - 40px)); margin-inline: auto; align-items: start;
  }
  .section-layout-main { min-width: 0; }

  .section-nav {
    position: sticky; top: 108px; z-index: 1;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    border-bottom: 0; border-left: 1px solid var(--gold-soft);
    margin-bottom: 0; padding: 4px 0 4px 18px;
  }
  .section-nav-title { padding: 0 0 12px; }
  .section-nav-list {
    display: block; padding: 0; overflow: visible;
  }
  .section-nav-item { margin-bottom: 2px; }
  .section-nav-link {
    white-space: normal; border: 0; background: none; border-radius: 0;
    padding: 7px 0 7px 14px; margin-left: -19px;
    border-left: 2px solid transparent;
    font-weight: 500; font-size: 13.5px; line-height: 1.35; color: var(--stone);
  }
  .section-nav-link:hover { color: var(--navy); background: none; }
  .section-nav-link[aria-current="true"] {
    color: var(--navy); font-weight: 600; background: none;
    border-left-color: var(--gold);
  }

  .section-nav-item--parent.is-open > .section-nav-sublist {
    display: block; list-style: none; margin: 2px 0 8px; padding: 0;
  }
  .section-nav-subitem { margin: 0; }
  .section-nav-sublink {
    position: relative; display: block; text-decoration: none;
    font-family: var(--sans); font-size: 12px; line-height: 1.35;
    font-weight: 500; color: var(--stone);
    padding: 4px 0 4px 26px; transition: color .15s;
  }
  .section-nav-sublink::before {
    content: ""; position: absolute; left: 12px; top: 11px;
    width: 6px; height: 1px; background: var(--gold-soft); transition: width .15s;
  }
  .section-nav-sublink:hover { color: var(--navy); }
  .section-nav-sublink[aria-current="true"] { color: var(--gold); font-weight: 600; }
  .section-nav-sublink[aria-current="true"]::before { width: 10px; background: var(--gold); }
  .section-anchor { scroll-margin-top: 108px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* ---------- Rich-text images ----------
   Wagtail already writes the editor's alignment choice onto the tag as
   `richtext-image left|right|full-width`; nothing styled it, so every image
   rendered as a block in the text flow. Left/right float beside the copy and
   unfloat on narrow screens, where a 320px image next to a 40-character
   measure would be unreadable. The page's own hero image is outside the rich
   text and is untouched by all of this. */

.richtext-image {
  max-width: 100%; height: auto; display: block;
  border-radius: 12px; border: 1px solid var(--gold-soft);
}
.richtext-image.full-width { width: 100%; margin: 26px 0; }
.richtext-image.left  { float: left;  width: min(40%, 340px); margin: 6px 30px 20px 0; }
.richtext-image.right { float: right; width: min(40%, 340px); margin: 6px 0 20px 30px; }

/* Contain the float so a tall image in a short section cannot spill into the
   next one. */
.catalog-section::after,
.learn-body::after,
.rich-text::after {
  content: ""; display: block; clear: both;
}

@media (max-width: 760px) {
  .richtext-image.left,
  .richtext-image.right { float: none; width: 100%; margin: 22px 0; }
}
/* ---------- Rich-text images ----------
   Wagtail already writes the editor's alignment choice onto the tag as
   `richtext-image left|right|full-width`; nothing styled it, so every image
   rendered as a block in the text flow. Left/right float beside the copy and
   unfloat on narrow screens. The hero image is outside the rich text and is
   untouched by all of this. */

.richtext-image {
  max-width: 100%; height: auto; display: block;
  border-radius: 12px; border: 1px solid var(--gold-soft);
}
.richtext-image.full-width { width: 100%; margin: 26px 0; }
.richtext-image.left  { float: left;  width: min(40%, 340px); margin: 6px 30px 20px 0; }
.richtext-image.right { float: right; width: min(40%, 340px); margin: 6px 0 20px 30px; }

.catalog-section::after,
.learn-body::after,
.rich-text::after {
  content: ""; display: block; clear: both;
}

@media (max-width: 760px) {
  .richtext-image.left,
  .richtext-image.right { float: none; width: 100%; margin: 22px 0; }
}
