/* Hampshire Churches – site styles. Plain modern CSS (custom properties, nesting, :has); no framework.
   The look follows the Kent Churches site; the colours are the old Hampshire site's olive and cream. */

/* ------------------------------------------------------------------ tokens */
:root {
    color-scheme: light;
    --bg: #f7f6ea;              /* paper, from the old site's #f4f6da */
    --surface: #ffffff;
    --surface-2: #efedda;       /* stone */
    --surface-3: #e3e0c6;
    --border: #dfdbc1;
    --border-strong: #c6c1a0;
    --text: #29261a;
    --text-2: #555038;
    --text-3: #6c6750;
    --accent: #5b4c0a;          /* the old site's olive brown (#493e06), for links */
    --accent-strong: #4a3f0b;   /* buttons (white text) and the header band */
    --accent-hover: #352c05;
    --accent-soft: #ece6c3;
    --accent-soft-text: #463b08;
    --gold: #b8860b;
    --rose: #b3202c;
    --ok: #3f7d20;
    --warn-bg: #fdf6e0;
    --warn-border: #e8cc7a;
    --danger-bg: #fbecea;
    --danger-border: #e9aaa3;
    --success-bg: #eef6e6;
    --success-border: #a9cf8f;
    --info-bg: #f1f2e4;
    --info-border: #cfd0a8;
    --header-bg: #4a3f0b;
    --header-ink: #fbf8ec;
    --footer-bg: #2b2716;
    --footer-ink: #e9e5d2;
    --shadow-sm: 0 1px 2px rgb(41 38 26 / .07);
    --shadow: 0 1px 2px rgb(41 38 26 / .08), 0 4px 14px rgb(41 38 26 / .07);
    --shadow-lg: 0 12px 40px rgb(41 38 26 / .2);
    --radius: 6px;
    --radius-sm: 5px;
    --header-h: 0px;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --wrap: 1180px;
    --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #1a1912; --surface: #23221a; --surface-2: #2d2b20; --surface-3: #38362a;
        --border: #37352a; --border-strong: #4c4939; --text: #ece9da; --text-2: #c4bfa7; --text-3: #a6a189;
        --accent: #e2cb6b; --accent-strong: #6b5c12; --accent-hover: #7f6e1a; --accent-soft: #34301a; --accent-soft-text: #ecdc94;
        --ok: #8cc56b; --warn-bg: #2f2912; --warn-border: #6f5d1d; --danger-bg: #331a17; --danger-border: #7a3129;
        --success-bg: #1d2a14; --success-border: #3f6a26; --info-bg: #26261a; --info-border: #4a4935;
        --header-bg: #2c260a; --footer-bg: #12110b;
        --shadow-sm: none; --shadow: 0 2px 10px rgb(0 0 0 / .35); --shadow-lg: 0 16px 48px rgb(0 0 0 / .55);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1a1912; --surface: #23221a; --surface-2: #2d2b20; --surface-3: #38362a;
    --border: #37352a; --border-strong: #4c4939; --text: #ece9da; --text-2: #c4bfa7; --text-3: #a6a189;
    --accent: #e2cb6b; --accent-strong: #6b5c12; --accent-hover: #7f6e1a; --accent-soft: #34301a; --accent-soft-text: #ecdc94;
    --ok: #8cc56b; --warn-bg: #2f2912; --warn-border: #6f5d1d; --danger-bg: #331a17; --danger-border: #7a3129;
    --success-bg: #1d2a14; --success-border: #3f6a26; --info-bg: #26261a; --info-border: #4a4935;
    --header-bg: #2c260a; --footer-bg: #12110b;
    --shadow-sm: none; --shadow: 0 2px 10px rgb(0 0 0 / .35); --shadow-lg: 0 16px 48px rgb(0 0 0 / .55);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
    margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
    font: 1.0625rem/1.65 var(--font); color: var(--text); background: var(--bg);
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; color: var(--accent-hover); }
:root[data-theme="dark"] a:hover { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a:hover { color: var(--accent); } }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); letter-spacing: -.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
kbd { font: 600 .72rem/1 var(--font); padding: .2em .45em; border: 1px solid var(--border-strong); border-bottom-width: 2px;
    border-radius: 4px; background: var(--surface); color: var(--text-2); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--text); }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
html:not(.js) [data-needs-js] { display: none !important; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 860px; }
.page { padding-top: 2.25rem; padding-bottom: 3rem; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.lede { font-size: 1.2rem; color: var(--text-2); max-width: 42em; }
.prose { max-width: 42em; & p:last-child { margin-bottom: 0; } & ul { padding-left: 1.2em; } & li { margin-bottom: .35em; } }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--radius); }
.skip-link:focus { top: 12px; }
@media (min-width: 720px) { :root { --gutter: 20px; } }

/* ------------------------------------------------------------------ buttons & form controls */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    min-height: 42px; padding: .5em 1.05em; font: 600 .95rem/1.2 var(--font);
    color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
    &:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
    &[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-text); }
}
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff;
    &:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; } }
.btn-donate { background: #ffc439; border-color: #e6ac1f; color: #1e1a06; &:hover { background: #ffd060; color: #1e1a06; } }
.btn-sm { min-height: 34px; padding: .35em .8em; font-size: .85rem; }
.btn-lg { min-height: 50px; padding: .65em 1.4em; font-size: 1.05rem; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
    color: var(--text-2); background: transparent; border: 0; border-radius: 999px; cursor: pointer;
    & .icon { width: 20px; height: 20px; }
    &:hover { background: var(--surface-2); color: var(--text); }
}
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

input[type="text"], input[type="email"], input[type="search"], input[type="url"], input[type="date"], input[type="password"], select, textarea {
    width: 100%; min-height: 44px; padding: .55em .8em; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
    &:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent); }
}
select {
    appearance: none; padding-right: 2.2em; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c6750' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7em center; background-size: 1.1em;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-strong); width: 18px; height: 18px; margin: 0; flex: none; }
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .92rem; }
.field-error { color: #c0392b; font-size: .875rem; margin-top: 6px; }
.is-invalid { border-color: #c0392b !important; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { margin-top: 3px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Search form (Kent style) */
.search { display: flex; gap: 8px; max-width: 34rem; margin: 1.5rem 0 1rem;
    & input { flex: 1; min-width: 0; } }
.search--center { margin-inline: auto; }

/* ------------------------------------------------------------------ header */
.site-header { background: var(--header-bg); color: var(--header-ink); }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--header-ink); text-decoration: none; margin-right: auto;
    &:hover { color: var(--header-ink); text-decoration: none; } }
.brand__mark { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .35)); }
.brand__text { display: flex; flex-direction: column; font-family: var(--serif); line-height: 1.1; }
.brand__name { font-size: 1.6rem; font-weight: 600; letter-spacing: .01em; }
.brand__byline { font-size: .95rem; opacity: .85; padding-left: 4.2em; }

.site-nav { width: 100%; order: 3; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
    position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
    color: var(--header-ink); text-decoration: none; font-weight: 500;
    & .icon { display: none; }
    &:hover { background: rgb(255 255 255 / .14); color: #fff; }
    &[aria-current="page"] { background: var(--header-ink); color: var(--header-bg); }
    &:focus-visible { outline-color: #fff; }
}
.header-tools { display: flex; align-items: center; gap: 4px; order: 2; }
.site-header .icon-btn { color: var(--header-ink); &:hover { background: rgb(255 255 255 / .14); color: #fff; } &:focus-visible { outline-color: #fff; } }
.search-trigger {
    display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
    color: var(--header-ink); background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .22); border-radius: 999px;
    text-decoration: none; font-size: .92rem;
    &:hover { background: rgb(255 255 255 / .2); color: #fff; text-decoration: none; }
    & .search-trigger-text, & kbd { display: none; }
    & kbd { background: transparent; color: var(--header-ink); border-color: rgb(255 255 255 / .35); }
}
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    font-size: .72rem; font-weight: 700; line-height: 1; color: #fff; background: var(--rose); border-radius: 999px; }
[data-theme-toggle] .when-dark { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .when-dark { display: block; }
:root[data-theme="dark"] [data-theme-toggle] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) [data-theme-toggle] .when-dark { display: block; }
    :root:not([data-theme="light"]) [data-theme-toggle] .when-light { display: none; }
}

/* Phones: the menu button shows and hides the links. */
@media (max-width: 899.98px) {
    html.js .site-nav:not(.is-open) { display: none; }
    .site-nav ul { flex-direction: column; gap: 2px; padding: 6px 0 4px; border-top: 1px solid rgb(255 255 255 / .18); }
    .site-nav a { display: flex; border-radius: var(--radius); padding: 10px 12px; & .icon { display: block; opacity: .8; } }
    .brand__name { font-size: 1.3rem; }
    .brand__mark { width: 34px; height: 34px; }
}
@media (min-width: 900px) {
    .menu-btn { display: none; }
    .site-nav { width: auto; order: 2; }
    .header-tools { order: 3; }
    .brand { margin-right: 0; }
    .site-nav { margin-left: auto; }
}
@media (min-width: 1180px) {
    .search-trigger { min-width: 200px; & .search-trigger-text { display: inline; flex: 1; } & kbd { display: inline-block; } }
}
html:not(.js) .menu-btn, html:not(.js) .search-trigger { display: none; }

/* ------------------------------------------------------------------ footer */
.site-footer { margin-top: 3rem; padding: 3rem 0 2rem; background: var(--footer-bg); color: var(--footer-ink); font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer__inner { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .site-footer__inner { grid-template-columns: 1fr 1fr; gap: 4rem; } }
.support h2 { font-size: 1.25rem; color: #fff; }
.site-footer__meta ul { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer__meta p { color: #bdb7a0; }

/* ------------------------------------------------------------------ generic blocks */
.page-head { margin-bottom: 1.5rem; & h1 { margin-bottom: .25em; } }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 .4rem; font-size: .9rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .95rem; color: var(--text-3);
    & a { color: var(--text-2); } & li + li::before { content: "/"; margin-right: 8px; color: var(--border-strong); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }
.panel h2 { font-size: 1.15rem; margin-bottom: .75rem; }
.panel__note { font-size: .85rem; color: var(--text-3); margin-top: .75rem; }
.panel__none { color: var(--text-3); font-style: italic; }
.callout { border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--info-border); background: var(--info-bg); margin-bottom: 20px;
    & > :last-child { margin-bottom: 0; } & h2 { font-size: 1.1rem; } }
.callout-warning { background: var(--warn-bg); border-color: var(--warn-border); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout-success { background: var(--success-bg); border-color: var(--success-border); }
.section { margin-top: 3rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 1rem;
    & h2 { margin: 0; } & a { font-weight: 600; } }
.empty-state { text-align: center; padding: 3rem 0; & .lede { margin-inline: auto; } & .actions-row { justify-content: center; margin-top: 24px; } }
.empty-icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px;
    & .icon { width: 34px; height: 34px; } }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .85rem; font-weight: 600;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); & .icon { color: var(--text-3); } }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--dot, #999); flex: none;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .2); }

/* ------------------------------------------------------------------ home */
.hero { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.hero__inner { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-block: 3rem; align-items: center; }
@media (min-width: 860px) { .hero__inner { grid-template-columns: 1.05fr 1fr; gap: 3rem; } }
.hero__figure { margin: 0; & img { display: block; width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); } }
.hero__figure figcaption { font-size: .9rem; color: var(--text-3); margin-top: .5rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 26px; margin: 1.5rem 0 0;
    & div { display: flex; flex-direction: column; } & strong { font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
    & span { font-size: .85rem; color: var(--text-3); } }
.quick-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.quick-card {
    display: flex; gap: 14px; align-items: flex-start; padding: 16px; color: var(--text); text-decoration: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform .15s, border-color .15s;
    &:hover { color: var(--text); transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
    & strong { display: block; font-family: var(--serif); font-size: 1.1rem; margin-bottom: 2px; }
    & span { font-size: .9rem; color: var(--text-2); line-height: 1.4; }
}
.quick-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
    & .icon { width: 22px; height: 22px; } }
.signature { font-family: var(--serif); font-style: italic; }
.two-col { display: grid; gap: 2rem; }
@media (min-width: 960px) { .two-col { grid-template-columns: 1.3fr 1fr; gap: 3rem; } }
.fb-embed { min-height: 160px; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border);
    & iframe { display: block; width: 100%; max-width: 500px; height: 600px; border: 0; margin-inline: auto; } }
.fb-placeholder { padding: 24px; text-align: center; color: var(--text-2); }

/* ------------------------------------------------------------------ church cards */
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr)); }
@media (min-width: 720px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; } }
.church-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
    content-visibility: auto; contain-intrinsic-size: auto 250px;
    &:hover { transform: translateY(-2px); border-color: var(--accent); }
    &:has(.card-link:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
}
.card-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; outline: none; &:hover { color: inherit; text-decoration: none; } }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden;
    & img { width: 100%; height: 100%; object-fit: cover; display: block; } }
.card-noimg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 1rem; color: var(--text-3); font-size: .85rem; font-style: italic; text-align: center; & .icon { width: 26px; height: 26px; opacity: .55; } }
.card-badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 9px; font-size: .75rem; font-weight: 700; color: #fff; background: rgb(30 27 15 / .75); border-radius: 999px; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; line-height: 1.25; margin: 0; }
.card-sub { margin: 2px 0 0; font-size: .9rem; color: var(--text-2); line-height: 1.35; }
.card-meta { margin: 6px 0 0; font-size: .78rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.card-save {
    position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
    color: #fff; background: rgb(30 27 15 / .55); border: 0; border-radius: 999px; cursor: pointer; opacity: .92;
    & .icon { width: 18px; height: 18px; } & .on { display: none; }
    &:hover { background: rgb(30 27 15 / .8); }
    &[aria-pressed="true"] { background: var(--accent-strong); opacity: 1; & .on { display: block; } & .off { display: none; } }
}
html:not(.js) .card-save { display: none; }
.church-card.is-visited .card-title::after { content: " ✓"; color: var(--ok); }

/* ------------------------------------------------------------------ churches A–Z */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 1.5rem 0 1rem;
    & .search { flex: 1 1 22rem; margin: 0; } }
.list-count { margin: 0; color: var(--text-3); }
.chip-set { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font: 600 .85rem var(--font); color: var(--text-2);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer;
    &:hover { border-color: var(--text-3); }
    &[aria-pressed="true"] { color: var(--accent-soft-text); background: var(--accent-soft); border-color: var(--accent); } }
.letters { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--border);
    margin: 0 calc(-1 * var(--gutter)) 1.5rem; padding: 8px var(--gutter); }
.letters ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
@media (max-width: 700px) { .letters ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } }
.letters a, .letters span { display: block; min-width: 2em; text-align: center; padding: 4px 2px; border-radius: 4px; font-weight: 600; text-decoration: none; }
.letters a:hover { background: var(--surface-2); }
.letters span { color: var(--border-strong); }
.letter-group { margin-bottom: 2.5rem; scroll-margin-top: 64px; }
.letter-group__heading { font-size: 2rem; color: var(--accent); border-bottom: 2px solid var(--border); padding-bottom: .25rem; margin-bottom: 1rem; }
.card-wrap { display: flex; min-width: 0; & > .church-card { flex: 1; } }
.no-results { padding: 1.5rem; background: var(--surface-2); border-radius: var(--radius); }

/* ------------------------------------------------------------------ church page */
.church__header { margin-bottom: 1.5rem; & h1 { margin-bottom: .3rem; } }
.church__place { margin: 0 0 .2rem; font-size: .95rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.church__layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
@media (min-width: 960px) {
    .church__layout { grid-template-columns: minmax(0, 1fr) 340px; }
    .church__facts { position: sticky; top: 1rem; align-self: start; max-height: calc(100dvh - 2rem); overflow: auto; scrollbar-width: thin; }
}
.church-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 1rem 0 0; }
.photo { margin: 0 0 2rem; }
.photo a { display: block; cursor: zoom-in; }
.photo img { display: block; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface-2); margin-inline: auto; }
.photo figcaption { margin-top: .75rem; text-align: center; }
.photo__credit { font-size: .9rem; color: var(--text-3); }
.photo--missing { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; max-width: 640px;
    background: var(--surface-2); border-radius: var(--radius); color: var(--text-3); font-style: italic; margin-inline: auto;
    & p { margin: 0; } }
.church__description { text-align: center; margin: 0 auto 2rem; }
.church__facts { display: flex; flex-direction: column; gap: 1rem; }
.census { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.census__item { background: var(--surface-2); border-radius: 4px; padding: 8px 10px; }
.census dt { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.census dd { margin: 0; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.facts { margin: 0; }
.facts dt { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.facts dd { margin: 0 0 .75rem; }
.facts dd:last-child { margin-bottom: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; & li { padding: 4px 0; } }
.map-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
    & .map { height: 280px; }
    & .map-links { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px; font-size: .88rem;
        & a { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; } } }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
    & a { display: flex; flex-direction: column; text-decoration: none; font-family: var(--serif); font-size: 1.1rem; min-width: 0; }
    & .pager__next { grid-column: 2; text-align: right; }
    & .pager__label { font-family: var(--font); font-size: .85rem; color: var(--text-3); } }
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } .pager .pager__next { grid-column: 1; } }

/* ------------------------------------------------------------------ lightbox (photo viewer) */
.lightbox {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    color: #f1efe4; background: #0d0c08; overscroll-behavior: contain; touch-action: pan-y;
    &::backdrop { background: #0d0c08; }
    &[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
}
.lb-top { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px 18px; font-size: .9rem;
    & .lb-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
    & .lb-count { color: #a8a38c; font-variant-numeric: tabular-nums; }
    & .icon-btn { color: #d6d2c0; &:hover { background: rgb(255 255 255 / .1); color: #fff; } } }
.lb-stage { grid-row: 2; position: relative; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: zoom-in; }
.lightbox.is-zoomed .lb-stage { cursor: grab; &:active { cursor: grabbing; } }
.lb-stage img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; transform-origin: 0 0;
    -webkit-user-drag: none; -webkit-touch-callout: none; transition: opacity .2s; will-change: transform; }
/* Desktop: never enlarge a photo past its own size (church.js fitted() reads this). Phones still fill the screen. */
@media (min-width: 720px) { .lb-stage img { object-fit: scale-down; } }
.lb-stage img.is-animating { transition: opacity .2s, transform .25s ease; }
.lb-stage img.is-loading { opacity: .35; }
.lb-nav { position: absolute; z-index: 1; top: 50%; translate: 0 -50%; width: 52px; height: 52px; color: #fff; background: rgb(255 255 255 / .1); border-radius: 999px;
    &:hover { background: rgb(255 255 255 / .2); color: #fff; } & .icon { width: 26px; height: 26px; } }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
@media (hover: none) { .lb-nav { display: none; } }
.lightbox.is-zoomed .lb-nav { opacity: .35; }
.lb-bottom { grid-row: 3; max-height: 30vh; overflow: auto; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); font-size: .92rem; color: #d6d2c0; text-align: center;
    & a { color: #ecdc94; } & p { margin: 0 auto .5em; max-width: 80ch; } & .lb-meta { color: #a8a38c; font-size: .82rem; } }
.lightbox.is-immersive { & .lb-top, & .lb-bottom { display: none; } }

/* ------------------------------------------------------------------ county map */
.map { background: var(--surface-2); }
.map-page { display: grid; gap: 16px; }
.map-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.county-map { height: calc(100dvh - 260px); min-height: 440px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; color: var(--text-2);
    & label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; } }
.leaflet-container { font: inherit; }
.map-pin { background: none; border: 0; }
.map-pin svg { filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / .35)); }
.leaflet-popup-content-wrapper { border-radius: 8px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px; }
.map-popup { width: 200px; font-size: .85rem; line-height: 1.35;
    & a.pop-link { color: #29261a; text-decoration: none; display: block; }
    & img { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 5px; margin-bottom: 8px; background: #eee; }
    & strong { display: block; font-family: var(--serif); font-size: 1rem; }
    & .pop-sub { color: #555038; }
    & .pop-status { margin-top: 4px; color: #6c6750; font-size: .8rem; }
    & .pop-actions { display: flex; gap: 6px; margin-top: 10px; }
    & .btn { min-height: 30px; font-size: .78rem; padding: .3em .7em; color: #29261a; background: #fff; border-color: #c6c1a0; }
    & .btn[aria-pressed="true"], & .btn-primary { color: #fff; background: #4a3f0b; border-color: #4a3f0b; } }
.leaflet-control-layers, .leaflet-bar { border-radius: 6px !important; overflow: hidden; }
.you-are-here { width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgb(37 99 235 / .25); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.82) contrast(1.05) saturate(.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.82) contrast(1.05) saturate(.85); } }

/* ------------------------------------------------------------------ trip planner */
.trip-layout { display: grid; gap: 24px; align-items: start; }
@media (min-width: 1024px) { .trip-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } .trip-map-col { position: sticky; top: 16px; } }
.trip-layout:has(> .trip-map-col[hidden]) { grid-template-columns: 1fr; }
.trip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.trip-item { display: grid; grid-template-columns: auto 64px 1fr auto; gap: 12px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    & .stop { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-strong); color: #fff; font-weight: 700; font-size: .82rem; }
    & img, & .noimg { width: 64px; height: 64px; object-fit: cover; border-radius: 5px; background: var(--surface-2); display: block; }
    & h3 { font-size: 1.02rem; margin: 0; } & h3 a { color: inherit; text-decoration: none; }
    & p { margin: 0; font-size: .82rem; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    & .leg { font-weight: 600; color: var(--text-2); }
    & .item-tools { display: flex; gap: 2px; } & .icon-btn { width: 34px; height: 34px; } & .icon-btn .icon { width: 17px; height: 17px; }
    & .icon-btn[aria-pressed="true"] { color: var(--ok); background: var(--success-bg); }
    & .icon-btn:disabled { opacity: .3; cursor: default; }
    &.is-visited h3::after { content: " ✓"; color: var(--ok); } }
@media (max-width: 560px) { .trip-item { grid-template-columns: auto 52px 1fr; & img, & .noimg { width: 52px; height: 52px; } & .item-tools { grid-column: 1 / -1; justify-content: flex-end; } } }
.trip-map { height: 480px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.trip-summary { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0 0; color: var(--text-2); font-size: .9rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
    & button { position: relative; padding: 10px 14px; border: 0; background: none; font: 600 .95rem var(--font); color: var(--text-2); cursor: pointer;
        &[aria-selected="true"] { color: var(--text); &::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent-strong); } } } }
.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 10px 0 6px;
    & span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent-strong)); border-radius: inherit; transition: width .4s ease; } }
.update-date { display: inline-flex; align-items: center; gap: 5px; margin: 6px 0 0; font-size: .8rem; color: var(--text-3); & .icon { width: 13px; height: 13px; } }

/* ------------------------------------------------------------------ dialogs, toasts, consent */
.search-dialog {
    width: min(640px, calc(100% - 24px)); max-height: min(560px, calc(100dvh - 48px)); margin: 8vh auto auto; padding: 0;
    color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
    &::backdrop { background: rgb(30 27 15 / .5); }
    &[open] { display: flex; flex-direction: column; }
}
.search-box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--border);
    & > .icon { color: var(--text-3); width: 20px; height: 20px; }
    & input { border: 0; padding: 0; min-height: 48px; font-size: 1.08rem; background: transparent; box-shadow: none !important; } }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; &:empty { display: none; } }
.search-results li a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none;
    & img, & .noimg { width: 48px; height: 40px; border-radius: 4px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); }
    & .r-text { min-width: 0; flex: 1; } & strong { display: block; font-family: var(--serif); font-weight: 600; } & small { display: block; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    & mark { background: none; color: var(--accent); font-weight: 800; } }
.search-results li[aria-selected="true"] a, .search-results li a:hover { background: var(--accent-soft); }
.search-results .r-more a { justify-content: center; font-weight: 600; color: var(--accent); }
.search-empty { padding: 18px; text-align: center; color: var(--text-3); }
.search-hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-3); & kbd { margin-inline: 2px; } }
@media (hover: none) { .search-hint { display: none; } }

.toast-region { position: fixed; left: 50%; bottom: 18px; translate: -50% 0; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 999px; color: #fbf8ec; background: #2b2716; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500;
    pointer-events: auto; animation: toast-in .2s ease-out;
    & a, & button { color: #ecdc94; font-weight: 700; background: none; border: 0; cursor: pointer; font: inherit; padding: 0 4px; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.consent-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 80; max-width: 720px; margin-inline: auto;
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: .9rem;
    & p { margin: 0; flex: 1 1 300px; color: var(--text-2); } }
.consent-actions { display: flex; gap: 8px; }

/* ------------------------------------------------------------------ links, contact */
.link-sections { display: grid; gap: 1rem; margin-top: 2rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start;
    & ul { list-style: none; margin: 0; padding: 0; } & li { padding: 5px 0; border-bottom: 1px solid var(--border); } & li:last-child { border-bottom: 0; } }
.contact-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 1.5rem; }

/* ------------------------------------------------------------------ admin data tables (also used by stats) */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar .search-field { position: relative; flex: 1 1 260px;
    & .icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
    & input { padding-left: 38px; } }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
    & button, & a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 4px; background: none; font: 600 .88rem var(--font); color: var(--text-2); cursor: pointer; text-decoration: none;
        &[aria-pressed="true"], &[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); } } }
.data-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem;
    & th, & td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
    & thead th { position: sticky; top: 0; background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
    & tbody tr:hover { background: var(--surface-2); }
    & tbody tr:last-child td { border-bottom: 0; }
    & .num { text-align: right; font-variant-numeric: tabular-nums; }
    & .zero { color: var(--border-strong); }
    & a { font-weight: 600; text-decoration: none; } }
@media (max-width: 719.98px) { .data-table .opt { display: none; } }

/* ------------------------------------------------------------------ motion & print */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
    .site-header, .site-footer, .toast-region, .consent-banner, .no-print, .card-save, .letters, .list-tools, .pager, .church-actions { display: none !important; }
    body { background: #fff; color: #000; }
    .panel, .trip-item, .church-card { box-shadow: none; break-inside: avoid; }
    .trip-layout, .church__layout { grid-template-columns: 1fr; }
    .trip-map { height: 380px; }
    a { color: #000; }
}
