/* ============================================================
   Views Directory — static, crawlable A-Z archive of every view.
   Template: templates/page-views-directory.php
   Companion JS: assets/js/views-directory.js
   Design system: cream / white / ink base, green for action.
   Chip filters reuse the global .filter-btn language (matches /articles).
   ============================================================ */

.views-directory {
    width: 100%;
}

/* ---------- Page background ----------
   The whole archive page sits on the site cream so the hero's torn-paper seam
   (template-parts/tear-effect.php) blends into the page instead of meeting a
   hard color line — matching page-articles / single-state. Cards stay white
   (see .vd-card) for contrast. State pages already get cream via
   body.single-state in custom.css; this covers the archive template. */
body.page-template-page-views-directory {
    background-color: var(--color-rov-cream, #f7f6f3);
}

/* ---------- Toolbar (search + chips + count) ---------- */
.vd-toolbar {
    margin-bottom: 1.75rem;
}

.vd-search {
    position: relative;
    max-width: 520px;
    margin: 0 auto 1.25rem;
}
.vd-search__icon {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--color-rov-text-muted-light, #666);
    font-size: 0.95rem;
    pointer-events: none;
}
.vd-search__input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-rov-text-dark, #1a1a1a);
    background: #fff;
    border: 1px solid var(--color-rov-text-muted-light, #b3a890);
    border-radius: 999px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.vd-search__input:focus {
    outline: none;
    border-color: var(--color-rov-green, #00754a);
    box-shadow: 0 0 0 3px rgba(0, 117, 74, 0.12);
}
.vd-count {
    text-align: center;
    margin: 1.25rem 0 0;
    font-size: 0.9rem;
    color: var(--color-rov-text-muted, #555);
}
.vd-count #vdShown {
    font-weight: 700;
    color: var(--color-rov-green, #00754a);
}

/* ---------- Empty state ---------- */
.vd-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-rov-text-muted, #555);
    font-size: 1.05rem;
}
.vd-reset,
.vd-empty .vd-reset {
    background: none;
    border: 0;
    color: var(--color-rov-green, #00754a);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

/* ---------- Grid ---------- */
.vd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    /* Uniform card height across each row regardless of title/tag length. */
    grid-auto-rows: 1fr;
    gap: 1.5rem;
}

/* ---------- Card ---------- */
.vd-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.vd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 117, 74, 0.35);
}
/* Hidden by the filter/search JS — never removed from the DOM (SEO). */
.vd-card.is-hidden {
    display: none;
}

/* Fixed-ratio media well. A skeleton box on the server; views-directory.js
   hydrates it with the per-view image carousel (or a fallback thumb) on
   scroll. The fixed aspect-ratio + object-fit:cover keep every card the same
   size regardless of the source image's own ratio. */
.vd-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--color-rov-cream, #f7f6f3);
    overflow: hidden;
    text-decoration: none;
}
.vd-card__media.is-hydrated {
    animation: none;
}

/* Injected carousel (Splide, data-carousel-type="card") fills the well.
   The sitewide card preset (r1v-carousel.css) letterboxes images on a black
   stage; the archive wants density, so we override to cover on a cream stage
   (mirrors how the travel filter LIST opts out of the letterbox contract). */
.vd-card__media .r1v-carousel,
.vd-card__media .r1v-carousel-single {
    position: absolute;
    inset: 0;
}
.vd-card__media .r1v-carousel-single {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.vd-card__media .r1v-carousel[data-carousel-type="card"] .splide__slide {
    background: var(--color-rov-cream, #f7f6f3);
}
.vd-card__media .r1v-carousel[data-carousel-type="card"] .splide__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Fallback thumbnail (carousel fetch failed / empty) */
.vd-card__media > .vd-card__fallimg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vd-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background: rgba(0, 117, 74, 0.92);
    border-radius: 999px;
}

.vd-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 0.9rem 1rem 1rem;
}
.vd-card__title {
    font-size: 0.92rem;
    line-height: 1.3;
    margin: 0 0 0.4rem;
    font-weight: 600;
    /* Clamp to 2 lines so long titles never blow out the (uniform) card height.
       min-height reserves the 2-line box so single-line titles align too. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(0.92rem * 1.3 * 2);
}
.vd-card__title a {
    color: var(--color-rov-text-dark, #1a1a1a);
    text-decoration: none;
}
.vd-card__title a:hover {
    color: var(--color-rov-green, #00754a);
}
.vd-card__loc {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0.85rem;
    font-size: 0.85rem;
    color: var(--color-rov-text-muted, #555);
}
.vd-card__loc i {
    color: var(--color-rov-green, #00754a);
    font-size: 0.8rem;
}

.vd-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px solid #f0f0f0;
}
.vd-card__map {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-rov-green, #00754a);
    text-decoration: none;
    /* Keep "See it on the map" on a single line. */
    white-space: nowrap;
}
.vd-card__map:hover {
    color: var(--color-rov-green-hover, #005a3a);
    text-decoration: underline;
}
.vd-card__preview {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-rov-text-muted, #555);
    background: transparent;
    border: 1px solid #d9d9d9;
    border-radius: 999px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.vd-card__preview:hover {
    color: var(--color-rov-green, #00754a);
    border-color: var(--color-rov-green, #00754a);
    background: var(--color-rov-cream-alt, #e6f4ee);
}

/* Subtle linked-view invitation ("add your own experience at this place").
   Kept quiet so it doesn't compete with the map/preview actions above. */
.vd-card__contribute {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 0.6rem;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-rov-green, #00754a);
    text-decoration: none;
    background: var(--color-rov-cream, #f7f6f3);
    border: 1px dashed rgba(0, 117, 74, 0.35);
    border-radius: 8px;
    transition: all 0.15s ease;
}
.vd-card__contribute i {
    font-size: 0.72rem;
}
.vd-card__contribute:hover {
    color: #fff;
    background: var(--color-rov-green, #00754a);
    border-color: var(--color-rov-green, #00754a);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .vd-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .vd-card {
        flex-direction: row;
    }
    .vd-card__media {
        flex: 0 0 40%;
        aspect-ratio: 1 / 1;
    }
    .vd-card__body {
        flex: 1 1 auto;
        min-width: 0;
    }
    .vd-card__actions {
        flex-wrap: wrap;
    }
}

/* ============================================================
   Compact facet dropdowns (Type / Tags / State) — the /views/
   toolbar. Little popovers instead of a wall of chips. The bar
   is flush-left with .vd-grid (no step-change vs the cards).
   ============================================================ */
.vd-facetbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.vd-facetbar .vd-search {
    margin: 0;                 /* was centered; keep it inline + flush-left */
    flex: 1 1 auto;
    min-width: 220px;
    max-width: 400px;
}

.vd-facet { position: relative; }

.vd-facet-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #d9e0da;
    background: #fff;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--color-rov-dark-gray, #2d3748);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.vd-facet-pill:hover,
.vd-facet.is-open .vd-facet-pill {
    border-color: var(--color-rov-green, #00754a);
    color: var(--color-rov-green, #00754a);
}
.vd-facet-pill .fa-location-dot { color: var(--color-rov-green, #00754a); }
.vd-facet-pill__value { font-weight: 600; }
.vd-facet-caret { font-size: 11px; opacity: 0.55; transition: transform 0.2s ease; }
.vd-facet.is-open .vd-facet-caret { transform: rotate(180deg); }

.vd-facet-count {
    background: var(--color-rov-green, #00754a);
    color: #fff;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    line-height: 1.4;
}
.vd-facet-count[hidden] { display: none; }

/* ---- Popover panel ---- */
.vd-facet-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    min-width: 200px;
    background: #fff;
    border: 1px solid #dfe4e0;
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.12);
    padding: 8px;
    display: none;
}
.vd-facet.is-open .vd-facet-panel { display: block; }
/* keep the wide state tray from spilling off the right edge */
.vd-facet-panel--states { left: auto; right: 0; }

.vd-facet-h {
    font: 600 11px/1 "SF Mono", Menlo, monospace;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8a968d;
    padding: 8px 10px 6px;
}

.vd-facet-radio,
.vd-facet-check {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.vd-facet-radio:hover,
.vd-facet-check:hover { background: #f2f6f3; }
.vd-facet-check em { margin-left: auto; font-style: normal; color: #9aa69d; font-size: 12px; }
.vd-facet-check.is-hidden { display: none; }

/* ---------- Disabled state — applied dynamically when selecting a Type/Tag
   option would result in zero matching views given the rest of the filter
   set. Mirrors article-filters.css's .filter-btn.is-disabled /
   .state-filter-card.is-disabled (that CSS also ships on this page and
   already covers .state-filter-card — this is the Type/Tags equivalent for
   real <input> controls, so the input's native `disabled` does the
   click-blocking; no pointer-events:none needed here). ---------- */
.vd-facet-radio.is-disabled,
.vd-facet-check.is-disabled {
    opacity: 0.32;
    cursor: not-allowed;
}
.vd-facet-radio.is-disabled:hover,
.vd-facet-check.is-disabled:hover { background: transparent; }

/* ---- Tags panel (scrollable multi-select) ---- */
.vd-facet-panel--tags { width: 340px; }
.vd-facet-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 4px;
    border: 1px solid #e2e8e4;
    border-radius: 8px;
    color: #8a968d;
}
.vd-facet-search input { border: 0; outline: 0; font: inherit; font-size: 14px; width: 100%; background: transparent; }
.vd-facet-list {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.vd-facet-foot {
    display: flex;
    justify-content: flex-end;
    padding: 8px 6px 4px;
    border-top: 1px solid #eef1ee;
    margin-top: 4px;
}
.vd-facet-clear {
    background: none;
    border: 0;
    color: #8a968d;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
}
.vd-facet-clear:hover { color: var(--color-rov-green, #00754a); background: var(--color-rov-cream-alt, #e6f4ee); }

/* ---- State panel: reuse the /articles state-filter tray, tightened to the popover ---- */
.vd-facet-panel--states { width: 430px; }
.vd-facet-panel--states .state-filter-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px; }

@media (max-width: 640px) {
    /* Drop the open panel full-width right below the filter row — not pinned to
       the bottom of the screen. Only one facet is open at a time, so anchoring
       every panel to the facetbar (instead of its pill) is safe and keeps it
       on-screen and aligned. */
    .vd-facetbar { position: relative; }
    .vd-facet { position: static; }
    .vd-facet-panel,
    .vd-facet-panel--tags,
    .vd-facet-panel--states {
        left: 0;
        right: 0;
        top: calc(100% + 8px);
        width: auto;
        min-width: 0;
    }
    .vd-facet-list { grid-template-columns: 1fr; }
}

/* ============================================================
   Trail landing page — curated editorial sections
   (heading + intro prose + a sub-grid, on /views/{trail}/)
   ============================================================ */
.trail-section { margin: 3.5rem 0; }
.trail-section:first-of-type { margin-top: 1.5rem; }
.trail-section__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-rov-cream-alt, #e6f4ee);
}
.trail-section__title {
    font-family: var(--font-hackney, "Iowan Old Style", Georgia, serif);
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    line-height: 1.1;
    margin: 0;
    color: var(--color-rov-ink, #1a2b23);
}
.trail-section__count {
    font: 600 0.75rem/1 "SF Mono", Menlo, monospace;
    color: var(--color-rov-green, #00754a);
    background: var(--color-rov-cream-alt, #e6f4ee);
    padding: 4px 9px;
    border-radius: 99px;
    white-space: nowrap;
}
.trail-section__intro {
    max-width: 760px;
    margin: 0.25rem 0 1.6rem;
    color: #4a5751;
    font-size: 1.075rem;
    line-height: 1.65;
}
.trail-section__intro p { margin: 0 0 0.7rem; }
.trail-section__intro p:last-child { margin-bottom: 0; }

/* ============================================================
   Trails index (/trails/) — one hub card per Trail
   ============================================================ */
.trails-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.trail-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e6ebe7;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.trail-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 117, 74, 0.15);
}
.trail-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background-color: #cbd7cf;
    background-size: cover;
    background-position: center;
}
.trail-card__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.35), transparent 55%);
}
.trail-card__count {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1;
    font: 600 11px/1 "SF Mono", Menlo, monospace;
    letter-spacing: 0.04em;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 4px 9px;
    border-radius: 99px;
}
.trail-card__body {
    padding: 1rem 1.15rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.trail-card__title {
    font-family: var(--font-hackney, "Iowan Old Style", Georgia, serif);
    font-size: 1.35rem;
    line-height: 1.15;
    margin: 0;
    color: var(--color-rov-ink, #1a2b23);
}
.trail-card__sub {
    margin: 0;
    color: #5b6b63;
    font-size: 0.95rem;
    line-height: 1.45;
}
.trail-card {
    position: relative;   /* anchors the stretched title link */
}
.trail-card__title a {
    color: inherit;
    text-decoration: none;
}
/* The card as a whole follows the trail. Using a stretched link rather than
   wrapping the card in an <a> is what lets "Experience it" live inside it —
   an anchor cannot be nested in an anchor. */
.trail-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}
.trail-card__ctas {
    margin-top: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.trail-card__cta {
    color: var(--color-rov-green, #00754a);
    font-weight: 600;
    font-size: 0.9rem;
}
/* Sits above the stretched link so it is separately clickable. */
.trail-card__experience {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.85rem;
    border-radius: 99px;
    background: var(--color-rov-green, #00754a);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: background 0.15s ease;
}
.trail-card__experience::before {
    content: "\2726";           /* four-pointed star — this trail has a piece built for it */
    font-size: 0.78em;
    opacity: 0.9;
}
.trail-card__experience:hover {
    background: var(--color-rov-green-hover, #005a3a);
    color: #fff;
}
