@import url("https://fonts.googleapis.com/css2?family=Lora:wght@400..700&family=Source+Sans+3:wght@400..700&display=swap");

/* Palettes. js/settings.js sets data-theme / data-contrast / data-motion on
<html> from the visitor's choice or, on "Automatic", their device settings.
*/
/* Abbreviations used below:
   wght = weight (the font-weight range requested from Google Fonts)
   bg   = background (the page background color, --bg)
   acc  = accent (the highlight color, --acc; -line is its border/line color and -bg its background color)
*/
:root {
  color-scheme: dark;
  --bg: #0f1218; --panel: #171c25; --header: #12161d; --field: #10141b; --active: #1d2430;
  --line: #2a3140; --control: #687286; --text: #e8edf5; --muted: #8b95a8;
  --acc: #c9a45c; --acc-line: #8f7644; --acc-bg: #2a2418; --link: #8cb4ff;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fff9e9; --panel: #fff; --header: #f3f2ec; --field: #fff; --active: #e7edf8;
  --line: #d5d9e0; --control: #7a8394; --text: #1a1f29; --muted: #545e70;
  --acc: #7a5516; --acc-line: #9a7a3e; --acc-bg: #fbf4e4; --link: #1d4fb8;
}
:root[data-contrast="more"] {
  --bg: #000; --panel: #000; --header: #000; --field: #000; --active: #1f1f1f;
  --line: #8a8a8a; --control: #fff; --text: #fff; --muted: #d0d6e2;
  --acc: #ffd24d; --acc-line: #ffd24d; --acc-bg: #000; --link: #9cc3ff;
}
:root[data-contrast="more"][data-theme="light"] {
  --bg: #fff; --panel: #fff; --header: #fff; --field: #fff; --active: #e0e0e0;
  --line: #555; --control: #000; --text: #000; --muted: #303030;
  --acc: #5c3d00; --acc-line: #000; --acc-bg: #fff; --link: #0033aa;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-size: 0.9375rem; line-height: 1.4; font-family: "Source Sans 3", sans-serif; }
h1, h2, h3, h4, h5, h6 { font-family: "Lora", serif; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Text that stays in the page source but shows as a solid bar that can't be
   read, selected, or copied. Screen readers skip it (aria-hidden in the HTML). */
.redacted {
  color: transparent; background: var(--text); border-radius: 2px;
  -webkit-user-select: none; user-select: none; forced-color-adjust: none;
}
.skip {
  position: absolute; left: 8px; top: -48px; z-index: 2000; padding: 6px 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--control); border-radius: 6px;
}
.skip:focus { top: 8px; }
header {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--header);
}
header h1 { margin: 0; font-size: 1rem; font-weight: 650; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.logo { width: 28px; height: 28px; flex: none; }
header nav { margin-right: auto; }
.menu-btn, .nav-title { display: none; }
nav a { display: inline-block; padding: 4px 0; margin-left: 12px; color: var(--muted); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }
body.app { display: flex; flex-direction: column; }
.layout { display: grid; grid-template-columns: 320px 1fr; flex: 1; min-height: 0; }
.filters, .list { border-right: 1px solid var(--line); overflow: auto; background: var(--panel); }
.filters { padding: 12px; }
.filters label { display: block; font-size: 0.75rem; color: var(--muted); margin: 10px 0 4px; }
.filters input {
  width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--control);
  border-radius: 6px; padding: 7px 8px;
}
.filters button {
  margin-top: 12px; width: 100%; padding: 8px; border-radius: 6px;
  border: 1px solid var(--acc-line); background: var(--acc-bg); color: var(--acc); cursor: pointer;
}
.filters #use-location { margin-top: 6px; }
/* Opens the search dialog; an accent button like the others in this panel. */
.filters .search-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; }
.filters .search-btn svg { flex: none; }
.filters .search-btn span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Filter dropdowns: a button that opens a checklist, so several values can be chosen. */
.filters .ms-btn {
  position: relative; display: block; margin: 0; padding: 7px 28px 7px 8px; text-align: left;
  color: var(--text); background: var(--field); border: 1px solid var(--control); border-radius: 6px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.filters .ms-btn::after {
  content: ""; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px;
  border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg);
}
.filters .ms-btn[aria-expanded="true"]::after { transform: translateY(-30%) rotate(-135deg); }
.ms-panel { margin-top: 4px; padding: 4px 6px; background: var(--field); border: 1px solid var(--line); border-radius: 6px; }
.filters .ms-opt { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 5px 2px; font-size: 0.8125rem; color: var(--text); cursor: pointer; }
.filters .ms-opt input { width: auto; flex: none; margin: 2px 0 0; padding: 0; accent-color: var(--acc); }
#status, .copyright { color: var(--muted); font-size: 0.75rem; margin: 8px 0 0; }
.card {
  padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.card:hover, .card.active { background: var(--active); }
.card h2 { margin: 0 0 4px; font-size: 0.9375rem; }
.card-open {
  padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: none; border: 0;
}
.meta { color: var(--muted); font-size: 0.8125rem; }
.card-site { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.list-empty { display: grid; place-items: center; min-height: 100%; margin: 0; padding: 16px 14px; text-align: center; color: var(--muted); }
/* Card tags: rounded bubbles in the accent colours. */
.tags { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.tag {
  padding: 1px 8px; border: 1px solid var(--acc-line); border-radius: 99px;
  font-size: 0.8125rem; color: var(--acc); background: var(--acc-bg);
}
/* Asterisk after a women's-ordination stance, linking to the acknowledgements note. */
.wo-note { margin-left: 2px; color: var(--acc); font-weight: 700; text-decoration: none; }
.wo-note:hover, .wo-note:focus-visible { text-decoration: underline; }
#map { height: 100%; min-height: 400px; min-width: 0; }
.leaflet-control-attribution a { text-decoration: underline; }
/* Light and dark tiles come from CARTO (see ensureMap in app.js); high
   contrast adds a filter on top. Markers sit in other panes and are unaffected. */
.leaflet-container { background: var(--bg); }
:root[data-contrast="more"] .leaflet-tile-pane { filter: grayscale(1) brightness(0.75) contrast(2.5); }
/* Dark Matter is mostly near-black with dim labels, so brighten instead of adding contrast. */
:root[data-contrast="more"][data-theme="dark"] .leaflet-tile-pane { filter: grayscale(1) brightness(3); }
.leaflet-bar a, .leaflet-bar a:hover { background-color: var(--panel); color: var(--text); border-bottom-color: var(--line); }
.leaflet-bar { border: 1px solid var(--line); }

/* Cathedral pins (pinIcon in app.js): a faint ground shadow like Leaflet's default, and a soft gold glow around the pin. */
/* Cluster bubbles (iconCreateFunction in app.js): the site's panel, accent ring and text colors. */
.parish-cluster {
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--acc); color: var(--text);
  font: 600 14px/1 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.parish-cluster span { pointer-events: none; }
.cathedral-pin .pin-shadow { fill: #000; fill-opacity: 0.3; filter: blur(1.5px); }
.cathedral-pin .pin-body { filter: drop-shadow(0 0 3px rgba(255, 201, 60, 0.75)); }
.about { max-width: 720px; margin: 0 auto; padding: 32px 16px 80px; }
.about .compass-rose { display: block; width: 50%; height: auto; margin: 24px auto 0; }
@media (max-width: 900px) {
  body.app { display: block; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 60vh; }
  .filters { max-height: 40vh; }
}
.view-toggle { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; }
.view-toggle span { color: var(--muted); cursor: pointer; user-select: none; }
.view-toggle span.on { color: var(--acc); }
#view-switch {
  position: relative; width: 40px; height: 22px; padding: 0; cursor: pointer;
  border: 1px solid var(--acc-line); border-radius: 99px; background: var(--panel);
}
#view-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--acc); transition: transform 0.15s;
}
#view-switch[aria-checked="true"]::after { transform: translateX(18px); }
#layout[data-view="list"] #map { display: none; }
#layout[data-view="map"] .list { display: none; }
[data-motion="reduce"] #view-switch::after { transition: none; }
[data-contrast="more"] nav a { text-decoration: underline; }
[data-contrast="more"] .card.active { outline: 2px solid var(--acc); outline-offset: -2px; }
[data-contrast="more"] .leaflet-container .leaflet-control-attribution { background: var(--panel); color: var(--text); }
[data-contrast="more"] .leaflet-container .leaflet-control-attribution a { color: var(--link); }
.settings { position: relative; }
#settings-btn {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;
  color: var(--muted); background: transparent; border: 1px solid var(--control); border-radius: 6px;
}
#settings-btn:hover, #settings-btn[aria-expanded="true"] { color: var(--text); }
.settings-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1500; width: 220px; padding: 4px 12px 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--control); border-radius: 8px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.35);
}
.settings-panel[hidden] { display: none; }
.settings-panel fieldset { border: 0; margin: 8px 0 0; padding: 0; }
.settings-panel legend { padding: 0; margin-bottom: 4px; font-size: 0.8125rem; font-weight: 600; }
.settings-panel label { display: flex; align-items: center; gap: 6px; min-height: 24px; font-size: 0.8125rem; cursor: pointer; }
.settings-panel input { accent-color: var(--acc); margin: 0; }
.settings-range { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.settings-range input { flex: 1; min-width: 0; }
.settings-range output { width: 3.5em; text-align: right; font-size: 0.8125rem; color: var(--muted); }
.settings-hint { margin: 10px 0 0; font-size: 0.75rem; color: var(--muted); }
.settings-panel .copyright { display: none; }
/* Windows contrast themes replace our colors; keep the switch knob and the
   selected card visible with system colors. */
@media (forced-colors: active) {
  #view-switch::after { forced-color-adjust: none; background: ButtonText; }
  .card.active { outline: 2px solid Highlight; outline-offset: -2px; }
  .view-toggle span.on { text-decoration: underline; }
  .leaflet-container .leaflet-control-attribution { background: Canvas; color: CanvasText; }
  .leaflet-container .leaflet-control-attribution a { color: LinkText; }
  .tag { border-color: CanvasText; }
}
/* Parish search: a panel near the top of the dimmed page, with matches listed under
   the box. The dialog itself fills the screen (transparent) so a tap anywhere
   outside the panel lands on it and closes the search, including on iOS. */
.search-dlg {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  color: var(--text); background: transparent; border: 0; overscroll-behavior: contain;
}
.search-dlg::backdrop { background: rgb(0 0 0 / 0.6); }
.search-panel {
  display: flex; flex-direction: column; width: min(520px, 100% - 32px); max-height: 75%;
  margin: 10vh auto 0; background: var(--panel); border: 1px solid var(--control); border-radius: 10px;
  box-shadow: 0 12px 48px rgb(0 0 0 / 0.5); overflow: hidden;
}
.search-dlg form { padding: 16px; }
.search-dlg label { display: block; margin-bottom: 8px; font-weight: 600; }
.search-dlg input {
  box-sizing: border-box; width: 100%; padding: 9px 10px; font: inherit; color: var(--text);
  background: var(--field); border: 1px solid var(--control); border-radius: 6px;
}
.search-results { margin: 0; padding: 0; list-style: none; overflow: auto; overscroll-behavior: contain; }
.search-results:empty { display: none; }
.search-results li { border-top: 1px solid var(--line); }
.search-results button {
  display: block; width: 100%; padding: 10px 16px; font: inherit; text-align: left; color: var(--text);
  background: transparent; border: 0; cursor: pointer;
}
.search-results button:hover, .search-results button:focus-visible { background: var(--active); }
.search-results strong { display: block; font-size: 0.9375rem; }
.search-results .search-none { padding: 12px 16px; color: var(--muted); }
@media (max-width: 600px) {
  .search-panel { margin-top: 16px; }
}
/* Parish detail: a panel over the dimmed page; full screen on phones. */
.detail {
  width: min(760px, 100% - 48px); max-width: none; max-height: calc(100% - 48px); padding: 0;
  color: var(--text); background: var(--panel); border: 1px solid var(--control); border-radius: 10px;
  box-shadow: 0 12px 48px rgb(0 0 0 / 0.5); overscroll-behavior: contain;
}
.detail[open] { display: flex; flex-direction: column; }
.detail::backdrop { background: rgb(0 0 0 / 0.6); }
html:has(.detail[open]) { overflow: hidden; }
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--line);
}
.detail-head h2 { margin: 0 0 4px; font-size: 1.25rem; }
.detail-close {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; cursor: pointer;
  color: var(--muted); background: transparent; border: 1px solid var(--control); border-radius: 6px;
}
.detail-close:hover { color: var(--text); }
.detail-actions { display: flex; gap: 8px; flex: none; }
.detail-body { flex: 1; min-height: 0; overflow: auto; padding: 0 20px 20px; overflow-wrap: anywhere; }
.detail-body h3 {
  margin: 18px 0 6px; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--acc);
}
.detail-body dl { margin: 0; }
.detail-body dl > div {
  display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line);
}
.detail-body dt { color: var(--muted); }
.detail-body dd { margin: 0; }
.detail-body dd.freeform { white-space: pre-line; }
.detail-body ul { margin: 0; padding-left: 1.1em; }
@media (max-width: 600px) {
  .detail { width: 100%; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .detail-head { padding: 12px 16px; }
  .detail-body { padding: 0 16px 24px; }
  .detail-body dl > div { grid-template-columns: 1fr; gap: 2px; }
  .detail-close { width: 44px; height: 44px; }
}
/* Phone: site links live behind a waffle button at the top left. */
@media (max-width: 600px) {
  header { position: relative; }
  .menu-btn {
    display: grid; place-items: center; width: 32px; height: 32px; padding: 0; flex: none; cursor: pointer;
    color: var(--muted); background: transparent; border: 1px solid var(--control); border-radius: 6px;
  }
  .menu-btn:hover, .menu-btn[aria-expanded="true"] { color: var(--text); }
  header .brand { margin-right: auto; }
  .nav-js header nav { display: none; }
  .nav-js header nav.open { display: block; }
  header nav {
    position: absolute; left: 0; top: 100%; z-index: 1500; width: min(280px, 100%);
    padding: 12px 16px 8px; margin: 0; background: var(--panel); border: 1px solid var(--control);
    border-top: 0; border-radius: 0 0 8px 0; box-shadow: 0 6px 24px rgb(0 0 0 / 0.35);
  }
  .nav-title { display: block; margin-bottom: 4px; font-weight: 650; }
  header nav a { display: block; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
  /* The copyright moves from the bottom of the filters to the settings menu. */
  .filters .copyright { display: none; }
  .settings-panel .copyright { display: block; }
}

/* Diocesan boundary overlay */
path.diocese-shape { stroke: var(--acc); stroke-opacity: 0.9; fill: var(--acc); fill-opacity: 0.06; }
path.diocese-shape:hover { fill-opacity: 0.16; }
.leaflet-tooltip.diocese-label {
  padding: 0; background: transparent; border: 0; box-shadow: none; pointer-events: none;
  font-size: var(--diocese-label-size, 0.8125rem); font-weight: 600; letter-spacing: 0.02em; color: var(--acc);
  white-space: normal; width: max-content; max-width: 9em; text-align: center; line-height: 1.2;
  text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 6px var(--bg);
}
.leaflet-tooltip.diocese-label::before { display: none; }
/* Too far out for the names to fit (touch devices, where every name is shown). */
.diocese-labels-hidden .leaflet-tooltip.diocese-label { display: none; }
.settings-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.settings-switch > span { font-size: 0.8125rem; font-weight: 700; }
.settings-panel label.switch { position: relative; flex: none; width: 36px; min-height: 20px; gap: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  flex: none; position: relative; width: 36px; height: 20px; border-radius: 10px;
  background: var(--field); border: 1px solid var(--control); transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--control); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-track { background: var(--acc-bg); border-color: var(--acc-line); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--acc); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--link); outline-offset: 2px; }
[data-motion="reduce"] .switch-track, [data-motion="reduce"] .switch-track::after { transition: none; }
/* Touch devices always show names, so the setting only applies with a hover pointer. */
.names-switch { margin-top: 6px; }
.names-switch:has(input:disabled) { opacity: 0.45; }
.names-switch input:disabled { cursor: not-allowed; }
@media (hover: none) { .names-switch { display: none; } }
