@font-face { font-family: "Newsreader"; src: url(../vendor/fonts/newsreader-latin-wght-normal.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(../vendor/fonts/instrument-sans-latin-wght-normal.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --paper: #fbf9f4;
  --card: rgba(251, 249, 244, .9);
  --raised: #ffffff;
  --ink: #16283a;
  --muted: #5d6974;
  --line: rgba(22, 40, 58, .12);
  --accent: #16324f;
  --on-accent: #fbf9f4;
  --gold: #99702a;
  --ring: #16283a;
  --halo: #ffffff;
  --shadow: 0 1px 2px rgba(22, 40, 58, .08), 0 18px 48px -12px rgba(22, 40, 58, .28);
  --serif: "Newsreader", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --panel-w: 384px;
  --peek: 146px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111a23; --card: rgba(17, 26, 35, .88); --raised: #1b2732; --ink: #eef0ee; --muted: #9eabb6;
    --line: rgba(238, 240, 238, .13); --accent: #e3c282; --on-accent: #17202a; --gold: #e3c282;
    --ring: #eef0ee; --halo: #111a23;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 48px -12px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { position: relative; overflow: hidden; font: 14px/1.45 var(--sans); word-spacing: .07em; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

#map { position: absolute; inset: 0; background: var(--paper); }

/* ---- panel ---- */
#panel {
  position: absolute; z-index: 1100; top: 16px; left: 16px; bottom: 16px; width: var(--panel-w);
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); overflow: hidden;
}
#panel.collapsed { bottom: auto; }
#panel.collapsed #panelBody { display: none; }
#panel header { padding: 22px 22px 16px; }
h1 { font: 500 29px/1.08 var(--serif); letter-spacing: -.012em; margin: 0; padding-right: 32px; }
#summary { margin: 6px 0 14px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

#panelToggle { position: absolute; top: 18px; right: 16px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
#panelToggle:hover { background: var(--line); }
#panelToggle span { width: 9px; height: 9px; border-left: 1.800px solid var(--muted); border-top: 1.800px solid var(--muted); transform: translateY(2px) rotate(45deg); transition: transform .2s; }
#panel.collapsed #panelToggle span { transform: translateY(-2px) rotate(225deg); }

.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.700; stroke-linecap: round; pointer-events: none; }
#search { width: 100%; height: 44px; padding: 0 14px 0 39px; font: inherit; font-size: 15px; color: inherit; background: var(--raised); border: 1px solid var(--line); border-radius: 13px; transition: border-color .15s, box-shadow .15s; }
#search::placeholder { color: var(--muted); }
#search:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }

#panelBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- tabs ---- */
.tabs { display: grid; grid-template-columns: 1fr 1.150fr 1fr; gap: 3px; margin: 0 22px; padding: 3px; background: var(--line); border-radius: 12px; }
.tabs button { position: relative; height: 36px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(22, 40, 58, .16); }
.tabs b { display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 6px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }

#filterBar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 22px 0; color: var(--muted); font-size: 12.5px; }
#clearAll, .tools button { border: 0; background: none; padding: 2px 0; font-size: 12.5px; font-weight: 600; color: var(--gold); }
#clearAll:hover, .tools button:hover { text-decoration: underline; text-underline-offset: 2px; }

.views { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 22px 8px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.views:focus-visible, section:focus-visible { outline-offset: -2px; }
section { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }
.tools { display: flex; gap: 16px; }
.pick-hint { justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 12.5px; }
.picking .pick-hint span { display: none; }
.picking .pick-hint { justify-content: flex-end; }
.tools.end { margin: 10px 0 8px; }
.note { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; }

/* ---- near you ---- */
.near-form { display: flex; gap: 6px; }
#nearInput { flex: 1; min-width: 0; height: 42px; padding: 0 12px; font: inherit; font-size: 15px; color: inherit; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; }
#nearInput:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.near-form button { height: 42px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.locate { display: inline-flex; align-items: center; gap: 7px; margin: 10px 0 2px; padding: 4px 0; border: 0; background: none; color: var(--gold); font-weight: 600; font-size: 13px; }
.locate svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.600; }
.locate:hover { text-decoration: underline; text-underline-offset: 2px; }
#nearStatus { margin: 8px 0 10px; }
#nearStatus strong { color: var(--ink); font-weight: 600; }
.near-list { list-style: none; margin: 0; padding: 0; }
.near-list button { display: grid; grid-template-columns: 15px 1fr auto; align-items: start; gap: 11px; width: calc(100% + 16px); margin: 0 -8px; padding: 9px 8px; border: 0; border-radius: 10px; background: none; text-align: left; }
.near-list button:hover { background: var(--line); }
.near-list .dot { margin-top: 3px; }
.near-list strong { display: block; font-weight: 600; line-height: 1.25; }
.near-list small { display: block; color: var(--muted); font-size: 12px; }
.near-list .mi { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.you { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--paper); box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent), 0 2px 8px rgba(0,0,0,.3); }
.leaflet-marker-icon.you-icon { background: none; border: 0; }

/* ---- denominations ---- */
.group { margin-top: 18px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.group-head span { font: italic 500 16px var(--serif); }
.group-head button { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; }
.group-head button:hover { color: var(--ink); }
.denom { display: flex; align-items: center; gap: 11px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.denom:hover { background: var(--line); }
.denom input { position: absolute; opacity: 0; width: 0; height: 0; }
.denom input:focus-visible + .dot { outline: 2px solid var(--gold); outline-offset: 2px; }
.dot { flex: none; width: 15px; height: 15px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--halo), 0 0 0 3px var(--line); }
.dot.ringed { box-shadow: 0 0 0 2px var(--ring), 0 0 0 3px var(--halo); }
.dot.hollow { background: var(--halo); box-shadow: inset 0 0 0 3.500px var(--c), 0 0 0 1px var(--line); }
.picking .denom input:not(:checked) + .dot { background: transparent; box-shadow: inset 0 0 0 1.500px var(--muted); }
.picking .denom:has(input:checked) { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.denom:has(input:checked) .name strong::after { content: " \2713"; color: var(--gold); }
.denom .name { flex: 1; min-width: 0; line-height: 1.25; }
.denom .name strong { display: block; font-weight: 600; font-size: 14px; }
.denom .name small { display: block; color: var(--muted); font-size: 12px; }
.denom .count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.picking .denom:has(input:not(:checked)) .name, .picking .denom:has(input:not(:checked)) .count { opacity: .55; }
.denom.dim .name { opacity: .5; }
.denom.dim .name strong { text-decoration: line-through; text-decoration-thickness: 1px; }

/* ---- beliefs ---- */
h3.sub { font: italic 500 16px var(--serif); margin: 4px 0 2px; }
h3.sub + .note { margin-bottom: 10px; }
.conf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.conf { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-size: 12.5px; font-weight: 600; }
.conf small { color: var(--muted); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }
.conf:hover { border-color: var(--muted); }
.conf[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.conf[aria-pressed="true"] small { color: inherit; opacity: .75; }
.pop .conf-line { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.belief { padding: 13px 0; border-top: 1px solid var(--line); }
.belief:first-child { border-top: 0; padding-top: 6px; }
.belief .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.belief .label { font-weight: 600; line-height: 1.3; }
.info { flex: none; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--muted); font: italic 500 13px/1 var(--serif); }
.info[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.help { margin: -3px 0 10px; color: var(--muted); font-size: 12.5px; }
.chips { display: grid; grid-template-columns: 1fr 1fr 1fr 1.600fr; gap: 5px; }
.chip { height: 32px; padding: 0 4px; font-size: 12.5px; font-weight: 600; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); text-decoration: line-through; transition: background .12s, color .12s; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--raised); border-color: var(--line); color: var(--ink); text-decoration: none; box-shadow: 0 1px 2px rgba(22, 40, 58, .1); }

#panel footer { padding: 12px 22px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.4; }
#panel footer p { margin: 0 0 7px; }
#panel footer p:last-child { display: flex; gap: 16px; margin: 0; font-weight: 600; font-size: 12.5px; }
#panel footer a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* ---- map furniture ---- */
.leaflet-container { font-family: var(--sans); background: var(--paper); }
.leaflet-touch .leaflet-bar, .leaflet-bar { border: 1px solid var(--line) !important; border-radius: 13px; overflow: hidden; box-shadow: 0 6px 18px -8px rgba(22, 40, 58, .45); }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; background: var(--raised); color: var(--ink); border-color: var(--line); font-weight: 400; }
.leaflet-bar a.leaflet-disabled { background: var(--raised); color: var(--muted); opacity: .6; }
.leaflet-container .leaflet-control-attribution { background: var(--card); color: var(--muted); padding: 2px 8px; border-top-left-radius: 8px; font-size: 10.5px; }
.leaflet-control-attribution a { color: inherit; }

.cl { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 3px 10px rgba(22, 40, 58, .3); transition: transform .12s; }
.cl:hover { transform: scale(1.07); }
.cl span { display: grid; place-items: center; width: calc(100% - 9px); height: calc(100% - 9px); border-radius: 50%; background: var(--raised); color: var(--ink); font: 600 12.5px var(--sans); font-variant-numeric: tabular-nums; }
.leaflet-marker-icon.cluster { background: none; border: 0; }

/* ---- popup ---- */
.leaflet-popup-content-wrapper { background: var(--paper); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow); padding: 0; }
.leaflet-popup-tip { background: var(--paper); }
.leaflet-popup-content { margin: 0; width: 300px !important; max-width: calc(100vw - 48px); font: 13px/1.45 var(--sans); }
.leaflet-container a.leaflet-popup-close-button { top: 10px; right: 10px; color: var(--muted); }
.pop { padding: 18px 20px 16px; }
.pop .dn { display: flex; align-items: center; gap: 8px; padding-right: 18px; color: var(--muted); font-size: 12px; }
.pop .dn .dot { width: 10px; height: 10px; box-shadow: none; }
.pop .dn .dot.hollow { box-shadow: inset 0 0 0 2.500px var(--c); }
.pop .dn .dot.ringed { box-shadow: 0 0 0 1.500px var(--ring); }
.pop h2 { font: 500 21px/1.15 var(--serif); margin: 7px 0 6px; }
.pop .addr { color: var(--muted); }
.pop .approx { margin-top: 6px; color: var(--muted); font-size: 12px; font-style: italic; }
.pop .status { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--gold) 13%, transparent); font-size: 12.5px; }
.pop dl { margin: 12px 0; padding: 0; border-top: 1px solid var(--line); }
.pop dl div { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; font-weight: 600; white-space: nowrap; }
.pop dd.u { font-weight: 400; color: var(--muted); }
.pop .links { display: flex; gap: 8px; }
.pop .links a { flex: 1; display: grid; place-items: center; height: 36px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.pop .links a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pop .fine { margin-top: 10px; color: var(--muted); font-size: 11px; }
.pop .fine a { color: inherit; }

/* ---- feedback ---- */
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
#feedback { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
#feedback::backdrop { background: rgba(10, 18, 26, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#fbForm { position: relative; padding: 24px 24px 18px; }
#fbForm h2 { font: 500 26px/1.1 var(--serif); margin: 0 0 16px; }
.fb-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 22px; line-height: 1; }
.fb-close:hover { background: var(--line); }
.fb-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 0 14px; padding: 3px; border: 0; background: var(--line); border-radius: 12px; }
.fb-kinds legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fb-kinds label { position: relative; }
.fb-kinds input { position: absolute; opacity: 0; }
.fb-kinds span { display: grid; place-items: center; height: 36px; padding: 0 4px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; cursor: pointer; }
.fb-kinds input:checked + span { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(22, 40, 58, .16); }
.fb-kinds input:focus-visible + span { outline: 2px solid var(--gold); }
.fb-church { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; background: color-mix(in srgb, var(--gold) 13%, transparent); font-size: 13px; }
.fb-field { display: block; margin-bottom: 12px; }
.fb-field > span { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.fb-field small { color: var(--muted); font-weight: 400; }
.fb-field textarea, .fb-field input { width: 100%; padding: 10px 12px; font: inherit; font-size: 15px; color: inherit; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; resize: vertical; }
.fb-field textarea:focus, .fb-field input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-status { min-height: 1em; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.fb-status.err { color: #b42318; } .fb-status.ok { color: var(--ink); font-weight: 600; }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fb-primary, .fb-secondary { height: 40px; padding: 0 18px; border-radius: 11px; font-weight: 600; }
.fb-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.fb-primary[disabled] { opacity: .6; cursor: default; }
.fb-secondary { border: 1px solid var(--line); background: none; }
.fb-fine { margin: 14px 0 0; color: var(--muted); font-size: 11.5px; }
.pop .fb-link { margin-top: 8px; display: inline-block; color: var(--muted); font-size: 12px; }

/* ---- phones: a bottom sheet ---- */
@media (max-width: 760px) {
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: min(74dvh, 640px); border-width: 1px 0 0; border-radius: 22px 22px 0 0; transition: height .24s ease; }
  #panel.collapsed { bottom: 0; height: var(--peek); }
  #panel.collapsed #panelBody { display: flex; visibility: hidden; }
  #panel header { padding: 22px 16px 12px; }
  h1 { font-size: 22px; padding: 0; display: inline; }
  #summary { display: inline; margin: 0 0 0 8px; font-size: 12.5px; }
  .search { margin-top: 10px; }
  #search { font-size: 16px; }
  #panelToggle { top: 0; left: 0; right: 0; width: 100%; height: 22px; border-radius: 0; }
  #panelToggle:hover { background: none; }
  #panelToggle span, #panel.collapsed #panelToggle span { width: 40px; height: 4px; border: 0; border-radius: 2px; background: var(--muted); opacity: .5; transform: none; }
  .tabs { margin: 0 16px; } #filterBar { margin: 10px 16px 0; } .views { padding: 12px 16px 8px; }
  #panel footer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
  .leaflet-bottom { bottom: var(--peek); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
