/* ============================================================
   GOLF DC — Course Directory Index (page-courses.php)
   Scoped: enqueued only on the /courses/ page. Tokens only.
   Breakpoints: --bp-md (640) / --bp-lg (1024). Mobile-first.
   ============================================================ */

/* ── Intro copy (admin-authored via the_content) ─────────── */

.course-directory__intro {
    margin-bottom: var(--space-8);
    font-family: var(--font-body);
    color: var(--color-text-primary);
    line-height: var(--lh-relaxed);
}

/* ── Filter form ─────────────────────────────────────────── */

.course-filter {
    margin-bottom: var(--space-8);
    padding: var(--space-5);
    background: var(--color-bg-card);
    border: var(--border-base) solid var(--color-sand-trap);
    border-radius: var(--radius-md);
}

/* Mobile-first: fields stack; each select fills the row. */
.course-filter__fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

.course-filter__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.course-filter__label {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-widest);
    text-transform: uppercase;
    color: var(--color-cart-path);
}

.course-filter__actions {
    margin-top: var(--space-4);
}

/* Auto-submit (course-filter.js) makes the button redundant when JS is on;
   keep it rendered for the no-JS GET path. */
html.has-js .course-filter__actions {
    display: none;
}

.course-filter__submit {
    width: 100%;
    min-height: var(--tap-min);
}

/* ── Index map (Leaflet, lazy-loaded) ────────────────────── */

/* Fixed height reserves layout space before Leaflet initialises, so the
   lazy-loaded map injects with zero CLS. Height steps up at wider viewports. */
.course-directory__map {
    height: 360px;
    margin-bottom: var(--space-8);
    border: var(--border-base) solid var(--color-sand-trap);
    border-radius: var(--radius-md);
    background: var(--color-bg-card-tinted);
    overflow: hidden;
    /* Contain Leaflet's z-index:1000 controls below the sticky header (z-index:100). */
    isolation: isolate;
}

/* Leaflet renders its own focus ring on the panes; keep the map keyboard-visible
   without overriding Leaflet's internal controls. */
.course-directory__map:focus-visible {
    outline: var(--border-thick) solid var(--color-border-focus);
    outline-offset: var(--border-thin);
}

.course-directory__map-popup-link {
    font-family: var(--font-ui);
    font-size: var(--text-base);
    font-weight: var(--fw-bold);
    color: var(--color-text-link);
    text-decoration: none;
}

.course-directory__map-popup-link:hover,
.course-directory__map-popup-link:focus {
    color: var(--color-text-link-hover);
    text-decoration: underline;
}

/* ── Results grid (overrides the 3-col default to a fluid fill) ─ */

.course-directory__grid {
    grid-template-columns: 1fr;
}

/* ── Empty state ─────────────────────────────────────────── */

.course-directory__empty {
    margin: 0;
    padding: var(--space-8);
    text-align: center;
    background: var(--color-bg-card);
    border: var(--border-base) dashed var(--color-sand-trap);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-md);
    color: var(--color-text-secondary);
}

/* ── >=640px: two-up fields + auto-width submit, two-col grid ─ */
@media (min-width: 640px) {
    .course-filter__fields {
        grid-template-columns: repeat(2, 1fr);
    }

    .course-filter__submit {
        width: auto;
    }

    .course-directory__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .course-directory__map {
        height: 440px;
    }
}

/* ── >=1024px: all facets in one row, three-col grid ─────── */
@media (min-width: 1024px) {
    .course-filter__fields {
        grid-template-columns: repeat(4, 1fr);
    }

    .course-directory__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .course-directory__map {
        height: 520px;
    }
}
