/**
 * Experience Grid — shortcode [go_experiences]
 *
 * Scoped to .go-exp-grid — no global side effects.
 * Uses CSS custom property --go-grid-cols (set inline by shortcode, default 3).
 *
 * Layout:
 *   Mobile  (<640px)  : 1 column
 *   Tablet  (<1024px) : 2 columns
 *   Desktop           : --go-grid-cols columns (1–4)
 *
 * Page speed:
 *   - aspect-ratio on image container → zero layout shift (CLS = 0)
 *   - No web fonts, no icon libraries loaded
 *   - CSS is only enqueued when shortcode is present on the page
 */

/* ─── Wrapper ─────────────────────────────────────────────────────────────── */

.go-exp-grid {
    /* Component-specific layout tokens — not shared across files */
    --go-grid-cols: 3;
    --go-grid-gap: 1.5rem;

    /* Shared design tokens come from tokens.css (:root):
     * --goe-radius-card, --goe-shadow-card, --goe-shadow-card-hover
     * --goe-cta-bg, --goe-cta-color, --goe-tab-active, --goe-price-color
     * --goe-badge-text (white)
     */
    width: 100%;

    /* Container queries — adapts to the element's own width, not the viewport.
     * Required when shortcode is used in sidebar, block-editor columns, etc.
     * Progressive enhancement: @container rules layer on top of media queries.
     * 93.46% global support (Chrome 106+, Firefox 110+, Safari 16+). */
    container: go-exp-grid / inline-size;
}

/* ─── Filter tabs ─────────────────────────────────────────────────────────── */

.go-exp-grid__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--goe-border);
}

.go-exp-grid__tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--goe-text-secondary);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px;
    white-space: nowrap;
    outline-offset: 2px;
}

.go-exp-grid__tab:hover {
    color: var(--goe-tab-active);
}

.go-exp-grid__tab--active {
    color: var(--goe-tab-active);
    border-bottom-color: var(--goe-tab-active);
    font-weight: 600;
}

/* ─── Type filter tabs (niveau 2: tur, kursus, event…) ───────────────────── */

.go-exp-grid__type-tabs {
    margin-top: -1.25rem;   /* tuck under the main tabs */
    margin-bottom: 1.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--goe-border) 60%, transparent);
}

.go-exp-grid__type-tabs .go-exp-grid__tab {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    color: var(--goe-text-secondary);
    opacity: 0.8;
}

.go-exp-grid__type-tabs .go-exp-grid__tab--active {
    color: var(--goe-tab-active);
    border-bottom-color: var(--goe-tab-active);
    font-weight: 500;
    opacity: 1;
}

/* ─── City filter tabs (niveau 3: by) ────────────────────────────────────── */

.go-exp-grid__city-tabs {
    margin-top: -1.25rem;   /* tuck under the type tabs (or main tabs) */
    margin-bottom: 1.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--goe-border) 40%, transparent);
}

.go-exp-grid__city-tabs .go-exp-grid__tab {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    color: var(--goe-text-secondary);
    opacity: 0.7;
}

.go-exp-grid__city-tabs .go-exp-grid__tab--active {
    color: var(--goe-tab-active);
    border-bottom-color: var(--goe-tab-active);
    font-weight: 500;
    opacity: 1;
}

/* ─── Cards grid ──────────────────────────────────────────────────────────── */

.go-exp-grid__cards {
    display: grid;
    grid-template-columns: repeat(var(--go-grid-cols), 1fr);
    gap: var(--go-grid-gap);
}

@media (max-width: 1023px) {
    .go-exp-grid__cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 639px) {
    .go-exp-grid__cards {
        grid-template-columns: 1fr;
    }
}

/* Container-query equivalents (progressive enhancement — co-exist with media queries above) */
@container go-exp-grid (max-width: 1023px) {
    .go-exp-grid__cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container go-exp-grid (max-width: 639px) {
    .go-exp-grid__cards {
        grid-template-columns: 1fr;
    }
}

/* ─── Single card ─────────────────────────────────────────────────────────── */

.go-exp-grid .go-exp-grid__card {
    display: flex;
    flex-direction: column;
    background: var(--goe-card-surface);
    color: var(--goe-card-body-color);
    border-radius: var(--goe-radius-card);
    box-shadow: var(--goe-shadow-card);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.go-exp-grid .go-exp-grid__card:hover {
    box-shadow: var(--goe-shadow-card-hover);
    transform: translateY(-2px);
}

/* Hidden state for JS filter */
.go-exp-grid .go-exp-grid__card[hidden] {
    display: none;
}

/* Pagination: cards beyond current page (managed by JS & server-side class) */
.go-exp-grid .go-exp-grid__card--paged-out {
    display: none;
}

/* ─── Load-more button ────────────────────────────────────────────────────── */

.go-exp-grid__load-more {
    display: block;
    margin: 2rem auto 0;
    padding: 0.75rem 2.5rem;
    background: var(--goe-surface);
    color: var(--goe-cta-bg, #1a2e1a);
    border: 2px solid var(--goe-cta-bg, #1a2e1a);
    border-radius: 3px;
    font-size: 0.9375rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.go-exp-grid__load-more:hover {
    background: var(--goe-cta-bg, #1a2e1a);
    color: #ffffff;
}

.go-exp-grid__load-more[hidden] {
    display: none;
}

/* ─── Card image ──────────────────────────────────────────────────────────── */

.go-exp-grid__card-image-link {
    display: block;
    text-decoration: none;
}

.go-exp-grid__card-image-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--goe-surface-subtle);
}

.go-exp-grid__card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.go-exp-grid__card:hover .go-exp-grid__card-image {
    transform: scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
    .go-exp-grid__card-image {
        transition: none;
    }
    .go-exp-grid__card:hover .go-exp-grid__card-image {
        transform: none;
    }
}

.go-exp-grid__card-image-placeholder {
    width: 100%;
    height: 100%;
    background: var(--goe-border);
}

/* ─── Category badge (image overlay) ─────────────────────────────────────── */

.go-exp-grid__card-badges {
    position: absolute;
    bottom: 0.625rem;
    left: 0.625rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: calc(100% - 1.25rem);
    pointer-events: none;
}

.go-exp-grid__card-badge {
    --go-cat-color: #888888;
    background-color: var(--go-cat-color);
    color: var(--goe-badge-text, #ffffff);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.25rem 0.625rem;
    border-radius: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Type badge (niveau 2) — outline style, visually lighter */
.go-exp-grid__card-badge--type {
    background-color: rgba(0, 0, 0, 0.45);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

/* ─── Card body ───────────────────────────────────────────────────────────── */

.go-exp-grid .go-exp-grid__card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--goe-card-padding);
    gap: var(--goe-card-gap);
    color: var(--goe-card-body-color);
}

/* Theme hardening: directly target the visible card nodes so generic theme
 * selectors such as `.light p`, `.entry-content a`, or builder heading rules
 * cannot bleed into the component. Avoid `all: reset/revert`; keep semantics. */
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-title,
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-desc,
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-price,
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-location,
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-cta {
    font-style: normal;
    letter-spacing: normal;
    text-transform: none;
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-title {
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.35;
    font-weight: 700;
    color: var(--goe-card-title-color);
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-title a {
    color: var(--goe-card-title-color);
    text-decoration: none;
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-title a:hover {
    text-decoration: underline;
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-desc {
    margin: 0;
    font-size: 0.875rem;
    line-height: var(--goe-card-desc-line-height);
    color: var(--goe-card-muted-color);
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-price {
    margin: 0.25rem 0 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--goe-card-price-color);
}

/* City / location badge */
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--goe-card-meta-color);
    line-height: 1.2;
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-location .go-exp-grid__card-location-icon {
    flex-shrink: 0;
    color: var(--goe-card-icon-color);
}

/* Push CTA to bottom of card */
.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-cta {
    margin-top: auto;
    padding-top: 0.75rem;
    display: inline-block;
    background: var(--goe-card-cta-bg);
    color: var(--goe-card-cta-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 3px;
    transition: background 0.15s ease, opacity 0.15s ease;
    align-self: flex-start;
}

.go-exp-grid .go-exp-grid__card-body > .go-exp-grid__card-cta:hover {
    opacity: 0.85;
    color: var(--goe-card-cta-color);
    text-decoration: none;
}

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

.go-exp-grid__empty {
    color: var(--goe-text-secondary);
    font-style: italic;
}

/* ─── Searchable dropdown (.go-exp-search) ────────────────────────────────── */
/*
 * Reusable combobox search for any experience grid.
 * Rendered by SearchableDropdown::render() (PHP) when search_dropdown="yes".
 * Behaviour driven by public/js/goe-searchable-dropdown.js.
 *
 * Scoped to .go-exp-grid .go-exp-search — no global side effects.
 */

.go-exp-search {
    position: relative;
    margin-bottom: 1.5rem;
}

/* Combobox row: icon + input + clear button */

.go-exp-search__combobox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--goe-surface);
    border: 1px solid var(--goe-border);
    border-radius: var(--goe-radius-sm);
    padding: 0 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.go-exp-search__combobox:focus-within {
    border-color: var(--goe-tab-active);
    box-shadow: 0 0 0 3px rgba(26, 46, 26, 0.12);
    outline: none;
}

.go-exp-search__icon {
    flex-shrink: 0;
    color: var(--goe-icon-muted);
    pointer-events: none;
}

.go-exp-search__input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--goe-text-body);
    padding: 0.75rem 0;
    outline: none;
    min-width: 0;

    /* Remove default browser "×" in search inputs */
    -webkit-appearance: none;
    appearance: none;
}

.go-exp-search__input::placeholder {
    color: var(--goe-text-secondary);
}

/* Remove browser-native clear button on <input type="search"> */
.go-exp-search__input::-webkit-search-cancel-button,
.go-exp-search__input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.go-exp-search__clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--goe-icon-muted);
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.go-exp-search__clear:hover {
    color: var(--goe-text-body);
    background: var(--goe-surface-subtle);
}

.go-exp-search__clear[hidden] {
    display: none;
}

/* Suggestion listbox */

.go-exp-search__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--goe-surface);
    border: 1px solid var(--goe-border);
    border-radius: var(--goe-radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;

    /* Show exactly 5 items, then scroll */
    max-height: calc(5 * 2.75rem);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.go-exp-search__dropdown[hidden] {
    display: none;
}

/* Thin scrollbar for suggestion list (Webkit + Firefox) */
.go-exp-search__dropdown::-webkit-scrollbar {
    width: 4px;
}

.go-exp-search__dropdown::-webkit-scrollbar-thumb {
    background: var(--goe-border);
    border-radius: 2px;
}

.go-exp-search__dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--goe-border) transparent;
}

/* Individual suggestion item */

.go-exp-search__suggestion {
    padding: 0.6875rem 1rem;
    font-size: 0.9375rem;
    color: var(--goe-text-body);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    transition: background 0.1s ease;
}

.go-exp-search__suggestion:hover,
.go-exp-search__suggestion--active {
    background: var(--goe-surface-subtle);
    color: var(--goe-text-strong);
}

.go-exp-search__suggestion--active {
    background: var(--goe-surface-subtle);
    outline: 2px solid var(--goe-tab-active);
    outline-offset: -2px;
}