:root {
  --bg: #f7f7f5; --card: #fff; --text: #1d1d1f; --muted: #6b6b70; --line: #e4e4e0;
  --accent: #2f5d50; --accent-ink: #fff; --warn: #b42318; --flash: #e8f2ee;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141516; --card: #1d1f21; --text: #ececec; --muted: #9a9ca0; --line: #2d3033;
          --accent: #6fb39d; --accent-ink: #0d1b16; --warn: #f97066; --flash: #1f2e29; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
          border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
nav a { text-decoration: none; }
form.inline { display: inline; }
.linklike { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.btn { display: inline-block; flex-shrink: 0; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
       border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.small { padding: 5px 10px; font-size: .875rem; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.card.narrow { max-width: 420px; margin: 32px auto; }
.card.danger { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
h1 { margin-top: 0; font-size: 1.6rem; }
h2 { margin-top: 0; font-size: 1.2rem; }
label { display: block; margin-bottom: 14px; font-weight: 500; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line);
                border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .875rem; }
.error { color: var(--warn); }
.flash { background: var(--flash); border: 1px solid var(--line); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 { font-size: 2.2rem; }
.hero p { max-width: 620px; margin: 0 auto 24px; color: var(--muted); }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.faiths { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 24px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: var(--card); font-size: .9rem; }
.searchbar { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.searchbar h1 { margin-bottom: 4px; }
.min-w-0 { min-width: 0; flex: 1; }
.controls { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; flex-shrink: 0; }
.inline-label { margin: 0; font-size: .875rem; }
.inline-label select { padding: 8px; }
.results { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
#map { height: 600px; border-radius: 12px; border: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; max-height: 600px; overflow-y: auto; }
/* Text takes the slack and the button group never shrinks, so a long
   crowd-sourced name wraps instead of pushing one row's buttons onto a new line. */
.place { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
         border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.place-text { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.place-name { font-weight: 600; }
.place-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.badge { background: var(--flash); border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; }
@media (max-width: 800px) {
  .results { grid-template-columns: 1fr; }
  #map { height: 340px; }
  .list { max-height: none; }
  .controls { flex-shrink: 1; width: 100%; }
}
.results.no-map { grid-template-columns: 1fr; }
.combo { position: relative; margin-bottom: 14px; }
.combo label { margin-bottom: 0; }
.suggestions { position: absolute; z-index: 10; left: 0; right: 0; margin: 4px 0 0; padding: 4px 0; list-style: none;
               background: var(--card); border: 1px solid var(--line); border-radius: 8px;
               box-shadow: 0 8px 24px rgba(0, 0, 0, .12); max-height: 280px; overflow-y: auto; }
.suggestions li { padding: 8px 12px; cursor: pointer; overflow-wrap: anywhere; }
.suggestions li:hover, .suggestions li.active { background: var(--flash); }
.pwgen { margin-bottom: 14px; }
.generated { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.generated-row { display: flex; gap: 8px; align-items: center; }
.generated-row code { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: .95rem; }
.generated p { margin: 6px 0 0; }
.brand img { display: block; height: 32px; width: auto; }
.hero-mark { display: block; margin: 0 auto 16px; width: 88px; height: 88px; }
@media (prefers-color-scheme: dark) {
  /* The wordmark's dark ink would vanish on the dark header. */
  .brand img { content: url("/static/brand/logo-inverse.svg"); }
}
/* Loading state */
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent;
           border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -0.15em; flex-shrink: 0; }
.status.loading { display: flex; align-items: center; gap: 8px; }
.status.loading::before { content: ""; width: 1em; height: 1em; border: 2px solid var(--accent); border-right-color: transparent;
                          border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
.map-wrap { position: relative; }
.map-loading { position: absolute; z-index: 500; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px;
               align-items: center; background: var(--card); color: var(--text); border: 1px solid var(--line);
               border-radius: 999px; padding: 6px 14px; font-size: .9rem; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.map-loading[hidden] { display: none; }
.map-loading .spinner { color: var(--accent); }
.skeleton { cursor: default; }
.skeleton .bar { height: 12px; border-radius: 6px; margin: 4px 0 10px; background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%);
                 background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton .w60 { width: 60%; height: 16px; } .skeleton .w85 { width: 85%; }
.skeleton .pill { width: 64px; height: 22px; border-radius: 999px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  /* Still clearly "busy" without anything moving. */
  .spinner, .status.loading::before { animation: none; border-right-color: currentColor; opacity: .6; }
  .skeleton .bar { animation: none; }
}
/* Home-page preview */
.faiths-block { margin-top: 24px; text-align: center; }
.faiths-hint { color: var(--muted); margin: 0 0 12px; }
button.chip { font: inherit; color: var(--text); cursor: pointer; transition: background .15s, border-color .15s; }
button.chip:hover { border-color: var(--accent); }
button.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview { margin-top: 40px; }
#preview { scroll-margin-top: 12px; }
.preview h2 { font-size: 1.4rem; margin-bottom: 4px; }
.place-form { display: flex; gap: 6px; margin: 0; flex: 1 1 260px; min-width: 0; }
.place-form input { margin: 0; min-width: 0; padding: 9px 12px; }
.cta { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-top: 20px; flex-wrap: wrap; }
/* Text takes a full line before it would get narrower than this, so on a
   phone the button drops below it instead of squeezing it into a column. */
.cta .min-w-0 { display: flex; flex-direction: column; gap: 2px; flex: 1 1 300px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
