/* ─────────────────────────────────────────────
   Church Directory Grid
───────────────────────────────────────────── */
.church-directory-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px;
    width: 100%;
    box-sizing: border-box;
}

/* ─────────────────────────────────────────────
   Church Card
───────────────────────────────────────────── */
.church-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.church-card:hover {
    border-color: #aac0d4;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.13);
}

/* ─────────────────────────────────────────────
   Church Image
───────────────────────────────────────────── */
.church-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

/* ─────────────────────────────────────────────
   Church Title
───────────────────────────────────────────── */
.church-title {
    margin: 20px 0 10px;
}

.church-title a {
    text-decoration: none;
}

/* ─────────────────────────────────────────────
   Church Meta
───────────────────────────────────────────── */
.church-pastor {
    margin-bottom: 10px;
}

.church-address {
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────
   Church Buttons
───────────────────────────────────────────── */
.church-buttons {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.church-button {
    display: inline-block;
    padding: 10px 18px;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color .3s ease, color .3s ease;
    background: #002540;
    color: #fff !important;
}

/* Both buttons share the same base style */
.church-button-primary {
    background: #002540;
    color: #fff;
}

.church-button-secondary {
    background: #002540;
    color: #fff;
}

.church-button:hover {
    background: #003a60;
    color: #fff;
}

/* WCAG: visible focus ring for keyboard navigation */
.church-button:focus-visible {
    outline: 3px solid #D8AE00;
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   State Filter Bar
───────────────────────────────────────────── */
.church-state-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.state-filter {
    padding: 8px 16px;
    background: #e8e8e8;
    color: #444;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    font-size: 14px;
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
    cursor: pointer;
}

/* Combined: hover and active state are identical */
.state-filter:hover,
.state-filter.active {
    background: #C0C0C0;
    border-color: #D6D6D6;
    color: #000 !important;
}

/* WCAG: visible focus ring for keyboard navigation */
.state-filter:focus-visible {
    outline: 3px solid #D8AE00;
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   Responsive Breakpoints
───────────────────────────────────────────── */
@media (max-width: 980px) {
    .church-directory-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 770px) {
    .church-directory-grid {
        grid-template-columns: 1fr !important;
    }

    /* Buttons stretch full width on mobile */
    .church-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .church-button {
        text-align: center;
        width: 100%;
        box-sizing: border-box;
    }

    .church-image img {
        height: 310px;
    }
}

/* ─────────────────────────────────────────────
   US State Map
───────────────────────────────────────────── */
.cd-map-wrap {
    width: 75%;
    margin: 0 auto 20px;
}

.cd-map-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Inactive background states */
.cd-map-bg path {
    fill: #d0d0d0;
    stroke: #fff;
    stroke-width: 1;
}

/* Clickable active states */
.cd-map-state {
    fill: #003157;
    stroke: #fff;
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill .2s ease;
}

.cd-map-state:hover {
    fill: #005a9e;
}

.cd-map-state.cd-map-active {
    fill: #005a9e;
}

/* State abbreviation labels */
.cd-map-label {
    fill: #fff;
    font-size: 11px;
    font-family: sans-serif;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
}

/* Show All button inside map */
.cd-map-all rect {
    fill: #003157;
    transition: fill .2s ease;
    cursor: pointer;
}

.cd-map-all text {
    fill: #fff;
    font-size: 15px;
    font-family: sans-serif;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
}

.cd-map-all:hover rect {
    fill: #005a9e;
}

.cd-map-all.cd-map-active rect {
    fill: #005a9e;
}

.cd-map-all {
    cursor: pointer;
}

/* WCAG: keyboard focus on map elements — stroke is more reliable than outline for SVG */
.cd-map-state:focus-visible {
    stroke: #D8AE00;
    stroke-width: 3;
    outline: none;
}

.cd-map-all:focus-visible rect {
    stroke: #D8AE00;
    stroke-width: 3;
    outline: none;
}

.cd-map-hint {
    fill: #666;
    font-size: 14px;
    font-family: sans-serif;
    text-anchor: middle;
}

/* Responsive: full width map on smaller screens */
@media (max-width: 980px) {
    .cd-map-wrap {
        width: 90%;
    }
}

@media (max-width: 770px) {
    .cd-map-wrap {
        width: 100%;
    }

    .cd-map-label {
        font-size: 18px;
    }
}