/* The vernacular card's heading is the language picker (Concept A, picked by
   Mr. Egan). Ported from concepts/heading-picker-2026-10 (ffe3686),
   concepts-heading/shared/concept.css: Concept A rules, parchment popover on
   desktop, bottom sheet on phones. The Latin heading is a plain label with a
   subline. Loaded on the-angelus.html and regina-caeli.html. */
/* ---------- Card header: heading, then optional subline, then the hairline ---------- */
.prayer-column .ph-head {
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: center;
}
.prayer-column .ph-head h2 {
  margin: 0;
  padding: 0;
  border: 0;
}
.ph-anchor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Desktop: both header areas share one grid row, so the vernacular card gets a
   matching-height area and the first V. line sits level in both cards. */
@media (min-width: 701px) {
  @supports (grid-template-rows: subgrid) {
    .prayer-container { row-gap: 0; }
    .prayer-container > .prayer-column {
      display: grid;
      grid-row: span 2;
      grid-template-rows: subgrid;
      row-gap: 0;
    }
  }
}

/* ---------- Latin subline ---------- */
.prayer-column .ph-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0.1rem 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.06rem;
  line-height: 1.35;
  color: var(--color-text-muted);
}
.prayer-column .ph-sub[hidden] { display: none; }
/* ---------- Heading button ---------- */
.ph-btn {
  all: unset;
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  cursor: pointer;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}
/* Invisible band that makes the tap target at least 44px tall. */
.ph-btn::before { content: ""; position: absolute; inset: -4px -12px; }
.ph-btn:focus-visible { outline: 2px solid rgba(201,169,89,0.8); outline-offset: 4px; }
.ph-name { min-width: 0; overflow-wrap: anywhere; }
.ph-chev { flex: none; color: var(--color-gold); transition: transform .25s cubic-bezier(.4,0,.2,1); }
html:not(.ph-ready) .ph-chev { visibility: hidden; }

/* ---------- Heading + gold chevron + gold underline ---------- */
.ph-btn { gap: 9px; padding-left: 21px; } /* 12px chevron + 9px gap: keeps the name centred */
.ph-name {
  text-decoration: underline;
  text-decoration-color: rgba(201,169,89,0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  transition: text-decoration-color .2s ease;
}
.ph-btn:hover .ph-name,
.ph-btn:focus-visible .ph-name,
.ph-btn[aria-expanded="true"] .ph-name { text-decoration-color: var(--color-gold); text-decoration-thickness: 2px; }
.ph-chev { margin-top: 3px; }
.ph-btn[aria-expanded="true"] .ph-chev { transform: rotate(180deg); }

/* ---------- Popover: anchored under the heading, parchment theme ---------- */
.lp-ph {
  top: calc(100% + 12px);
  left: 50%;
  width: 280px;
  max-width: calc(100vw - 2rem);
  font-size: 0.9rem;
  transform: translate(-50%, -6px) scale(0.98);
  transform-origin: top center;
}
.lp-ph.is-open { transform: translate(-50%, 0); }
/* Small caret pointing at the heading. */
.lp-ph:not(.lp-sheet)::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: inherit;
  border-left: 1px solid rgba(201,169,89,0.5);
  border-top: 1px solid rgba(201,169,89,0.5);
  transform: rotate(45deg);
}
.lp-ph .lp-list { max-height: min(340px, 52vh); }
@media (max-width: 700px) {
  .lp-ph:not(.lp-sheet) .lp-opt { min-height: 44px; }
  .lp-ph:not(.lp-sheet) .lp-list { max-height: min(400px, 56vh); }
}

.lp-theme-parchment {
  background: #fffdf9;
  border: 1px solid rgba(201,169,89,0.5);
  box-shadow: 0 18px 44px rgba(44,36,22,0.28), 0 2px 8px rgba(44,36,22,0.12);
  color: var(--color-text);
  scrollbar-color: rgba(201,169,89,0.45) transparent;
}
.lp-theme-parchment .lp-head { border-bottom: 1px solid rgba(201,169,89,0.22); }
.lp-theme-parchment .lp-title,
.lp-theme-parchment .lp-group { color: var(--color-accent); }
.lp-theme-parchment [role="group"] + [role="group"] { border-top: 1px solid rgba(201,169,89,0.22); margin-top: 4px; }
.lp-theme-parchment .lp-opt { color: var(--color-text); font-family: var(--font-serif); font-size: 1.12rem; font-weight: 500; }
.lp-theme-parchment .lp-opt.is-active { background: rgba(201,169,89,0.14); }
.lp-theme-parchment .lp-list:focus-visible .lp-opt.is-active { outline: 1px solid rgba(201,169,89,0.75); }
.lp-theme-parchment .lp-opt.is-selected { color: #6f5a40; font-weight: 700; }
.lp-theme-parchment .lp-check { color: #a8873a; }
.lp-theme-parchment .lp-tag {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--color-text-muted);
  border: 1px solid rgba(139,115,85,0.3);
}

/* ---------- Bottom sheet (phones) ----------
   The popover element becomes a full-screen dimmed layer; its head and list form
   the sheet. Tapping the dim area, the close button or Esc closes it. */
.lp-pop.lp-sheet,
.lp-pop.lp-sheet.is-open {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: auto;
  max-width: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(20,16,10,0.5);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}
.lp-sheet .lp-head,
.lp-sheet .lp-list {
  background: #fffdf9;
  transform: translateY(28px);
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.lp-sheet.is-open .lp-head,
.lp-sheet.is-open .lp-list { transform: none; }
.lp-sheet .lp-head {
  position: relative;
  padding: 24px 56px 12px;
  text-align: center;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.25);
}
.lp-sheet .lp-head::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 2px;
  background: rgba(139,115,85,0.3);
}
.lp-sheet .lp-title { font-size: 0.7rem; }
.lp-sheet .lp-list {
  max-height: min(64vh, 540px);
  padding: 4px 12px calc(16px + env(safe-area-inset-bottom));
}
.lp-sheet .lp-opt { min-height: 46px; padding: 8px 12px; font-size: 1.2rem; }
.lp-sheet .lp-group { padding: 12px 12px 4px; }
.ph-sheet-close { display: none; }
.lp-sheet .ph-sheet-close {
  all: unset;
  position: absolute;
  top: 12px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
}
.lp-sheet .ph-sheet-close:hover { background: rgba(201,169,89,0.14); }
html.ph-sheet-open, html.ph-sheet-open body { overflow: hidden; }

.lp-instant .lp-head,
.lp-instant .lp-list { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .ph-chev, .lp-sheet .lp-head, .lp-sheet .lp-list { transition: none !important; }
}
