/* Explore gets its own simple, centred column (not the talk-page bleed grid).
   It aligns to the same 1240px content band as the site header; the gutter is
   added on top of the max so content edges line up with the header while small
   screens still get a margin. */
.explore-page {
    inline-size: 100%;
    max-inline-size: calc(1240px + (2 * var(--space-s)));
    margin-inline: auto;
    padding-inline: var(--space-s);
}

/* ==========================================================================
   Explore — search + category filter
   ========================================================================== */

.explore-controls {
    margin-block: var(--space-l);
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

/* --- Search --- */

.explore-search {
    position: relative;
    animation: explore-search-in 0.2s ease;
}

/* Tag search is hidden when a category (not "All") is selected. */
.explore-search.is-hidden {
    display: none;
}

@keyframes explore-search-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* The field is a flex container holding the selected-tag chips and the input,
   so chips "rack up" inline ahead of the cursor and wrap as they accumulate. */
.explore-search__field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2xs);

    inline-size: 100%;
    min-block-size: 3rem;
    padding: var(--space-2xs) var(--space-xl) var(--space-2xs) var(--space-s);

    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--space-m);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.explore-search__field:focus-within {
    border-color: #96000c;
    box-shadow: 0 0 0 3px rgba(150, 0, 12, 0.12);
}

.explore-search__input {
    flex: 1 1 8ch;
    min-inline-size: 8ch;

    border: none;
    background: transparent;
    padding-block: var(--space-3xs);

    font-family: var(--font-sans);
    font-size: var(--step-0);
    color: #333;
}

.explore-search__input:focus {
    outline: none;
}

.explore-search__input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

/* Hide the native search clear "×"; tags are removed via their own chips. */
.explore-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* Selected-tag chips inside the field. */
.explore-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    padding-block: var(--space-3xs);
    padding-inline: var(--space-xs) var(--space-3xs);

    font-family: var(--font-sans);
    font-size: var(--step--2);
    font-weight: 600;
    white-space: nowrap;

    color: #fff;
    background: #96000c;
    border-radius: 999px;
}

.explore-tag-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 1.3em;
    block-size: 1.3em;
    padding: 0;

    font-size: 1.15em;
    line-height: 1;
    color: rgba(255, 255, 255, 0.75);

    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.explore-tag-chip__remove:hover,
.explore-tag-chip__remove:focus-visible {
    color: #fff;
}

.explore-search__icon {
    position: absolute;
    inset-inline-end: var(--space-s);
    inset-block-start: 1.5rem; /* centre on the first row even when chips wrap */
    transform: translateY(-50%);

    inline-size: 1.2em;
    block-size: 1.2em;
    color: rgba(0, 0, 0, 0.45);
    fill: none; /* override the global `svg { fill: currentcolor }` so the lens is an open ring */
    pointer-events: none;
}

/* --- Tag autocomplete suggestions --- */

.explore-search__suggestions {
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: calc(100% + var(--space-3xs));
    inline-size: 100%;
    max-inline-size: 26rem;
    z-index: 10;

    list-style: none;
    margin: 0;
    padding: var(--space-3xs);

    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--space-2xs);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);

    max-block-size: 60vh;
    overflow-y: auto;
}

.explore-search__suggestions[hidden] {
    display: none;
}

.explore-search__suggestion {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-s);
    padding: var(--space-2xs) var(--space-s);
    border-radius: var(--space-3xs);

    font-family: var(--font-sans);
    font-size: var(--step--1);
    color: #333;
    cursor: pointer;
}

.explore-search__suggestion-count {
    font-size: var(--step--2);
    color: rgba(0, 0, 0, 0.4);
}

.explore-search__suggestion.is-active,
.explore-search__suggestion:hover {
    background: var(--color-background-dark);
    color: #96000c;
}

/* --- Category chips --- */

.explore-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
}

/* A scroller wraps each row with flanking arrows; the viewport clips overflow
   and carries the edge gradients. On wide screens the row wraps and shows every
   chip; below the medium breakpoint it becomes a single horizontally-scrollable
   row, and JS reveals the gradient + arrow affordances when content overflows. */
.explore-filters__scroller {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
}

.explore-filters__scroller[hidden] {
    display: none;
}

.explore-filters__viewport {
    position: relative;
    flex: 1 1 auto;
    min-inline-size: 0;
    overflow: hidden;
}

/* Edge fades hint that more chips sit off-screen. */
.explore-filters__viewport::before,
.explore-filters__viewport::after {
    content: '';
    position: absolute;
    inset-block: 0;
    inline-size: var(--space-l);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.explore-filters__viewport::before {
    inset-inline-start: 0;
    background: linear-gradient(to right, var(--color-background), transparent);
}

.explore-filters__viewport::after {
    inset-inline-end: 0;
    background: linear-gradient(to left, var(--color-background), transparent);
}

.explore-filters__scroller.can-scroll-left .explore-filters__viewport::before,
.explore-filters__scroller.can-scroll-right .explore-filters__viewport::after {
    opacity: 1;
}

.explore-filters__arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 1.9rem;
    block-size: 1.9rem;
    padding: 0;

    font-size: var(--step-0);
    line-height: 1;
    color: #96000c;

    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;

    transition: color 0.2s ease;
}

.explore-filters__arrow[hidden] {
    display: none;
}

.explore-filters__arrow:hover,
.explore-filters__arrow:focus-visible {
    color: #5e0008;
}

.explore-filters__row {
    list-style: none;
    padding: 0;
    margin: 0;

    display: flex;
    flex-wrap: wrap; /* wide screens: show every chip */
    gap: var(--space-2xs);
}

@media (width < 800px) {
    .explore-filters__row {
        flex-wrap: nowrap; /* small screens: one scrollable row */
        overflow-x: auto;
        scrollbar-width: none; /* Firefox */
        -webkit-overflow-scrolling: touch;
    }

    .explore-filters__row::-webkit-scrollbar {
        display: none; /* Chrome / Safari */
    }
}

.explore-filters__row--children {
    padding-block-start: var(--space-2xs);
}

/* Categories read as underlined text links (not pills), so they're visually
   distinct from the tag pills. Active = brand-red + a thicker underline,
   matching the site header's current-nav convention. */
.explore-filters__chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: var(--space-3xs) var(--space-2xs);

    font-family: var(--font-sans);
    font-size: var(--step--2);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;

    color: rgba(0, 0, 0, 0.6);
    text-decoration: none;

    background: transparent;
    border: none;
    cursor: pointer;

    transition: color 0.2s ease;
}

.explore-filters__chip:hover,
.explore-filters__chip:focus-visible,
.explore-filters__chip.is-active {
    color: #96000c;
}

/* Underline only the text label, not the caret or the gap beside it. */
.explore-filters__chip-label {
    text-underline-offset: 0.35em;
    text-decoration-thickness: 1px;
}

.explore-filters__chip:hover .explore-filters__chip-label,
.explore-filters__chip:focus-visible .explore-filters__chip-label {
    text-decoration: underline;
}

.explore-filters__chip.is-active .explore-filters__chip-label {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* Child chips read as a quieter, secondary level. */
.explore-filters__row--children .explore-filters__chip {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.explore-filters__caret {
    display: inline-block;
    font-size: 0.7em;
    transition: transform 0.2s ease;
}

.explore-filters__chip[aria-expanded='true'] .explore-filters__caret {
    transform: rotate(180deg);
}

/* --- Result count --- */

.explore-count {
    font-family: var(--font-sans);
    font-size: var(--step--1);
    color: rgba(0, 0, 0, 0.55);
    margin: var(--space-s) 0 0;
}

.explore-card[hidden],
.explore-empty[hidden] {
    display: none;
}

/* ==========================================================================
   Explore — vertical card list
   ========================================================================== */

.explore-list {
    display: flex;
    flex-direction: column;
    margin-block-start: var(--space-l);
}

.explore-card {
    border-block-start: 1px solid rgba(0, 0, 0, 0.12);

    &:last-child {
        border-block-end: 1px solid rgba(0, 0, 0, 0.12);
    }
}

.explore-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding-block: var(--space-l);
    transition: background-color 0.25s ease;
}

.explore-card__link:hover,
.explore-card__link:focus-visible {
    background-color: rgba(150, 0, 12, 0.02);
}

.explore-card__published {
    font-family: var(--font-sans);
    font-size: var(--step--2);
    color: rgba(0, 0, 0, 0.55);
    margin: var(--space-s) 0 0;
}

.explore-card__title {
    font-family: var(--font-serif);
    font-size: var(--step-4);
    font-weight: 500;
    line-height: 110%;
    margin: 0 0 var(--space-2xs);
    max-inline-size: var(--measure);

    transition: color 0.3s ease;
}

.explore-card__location {
    font-family: var(--font-sans);
    font-size: var(--step--1);
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 var(--space-2xs);
}

.explore-card__context {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 160%;
    margin: 0 0 var(--space-m);
    max-inline-size: var(--measure);
}

.explore-card__read-more {
    display: inline-block;

    font-family: var(--font-sans);
    font-size: var(--step--1);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #96000c;
}

.explore-card__arrow {
    display: inline-block;
    margin-inline-start: 0.4em;
    transition: transform 0.2s ease;
}

.explore-card__link:hover .explore-card__title,
.explore-card__link:focus-visible .explore-card__title {
    color: #96000c;
}

.explore-card__link:hover .explore-card__arrow,
.explore-card__link:focus-visible .explore-card__arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   Explore — card featured image
   ========================================================================== */

/* Default (mobile): image sits full-width between the title and the excerpt,
   following the DOM order. Cards with no thumbnail simply omit it. */
.explore-card__image {
    display: block;
    inline-size: 100%;
    block-size: auto;
}

/* The featured image is in the markup twice: an "inline" copy that sits between
   the title and excerpt on mobile, and an "aside" copy that moves into a right
   column on desktop. Only one is ever shown. */
.explore-card__media--inline {
    margin-block: var(--space-s) var(--space-m);
}

.explore-card__media--inline .explore-card__image {
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.explore-card__media--aside {
    display: none;
}

/* Desktop: text body on the left, image in the right third at its natural
   aspect ratio. Plain flexbox keeps the text's natural, compact spacing. */
@media (width >= 800px) {
    .explore-card--has-media .explore-card__link {
        display: flex;
        align-items: flex-end;
        gap: var(--space-xl);
    }

    .explore-card--has-media .explore-card__body {
        flex: 1 1 0;
        min-inline-size: 0;
    }

    .explore-card__media--inline {
        display: none;
    }

    .explore-card__media--aside {
        display: block;
        flex: 0 0 32%;
    }
}
