/*
 * Superstruct Events: agenda list and slider.
 *
 * Colours are custom properties so each site can override them from Elementor
 * custom CSS without touching this file.
 *
 * Layout responds to the width of the overview itself (container queries),
 * not the viewport: the same shortcode sits in a full-width section, a narrow
 * theme content area or an Elementor column, and must fit each of them.
 */
.sse {
    --sse-bg: #ffffff;
    --sse-surface: #f2f2f2;
    --sse-text: #000000;
    --sse-muted: #555555;
    --sse-accent: #000000;
    --sse-accent-text: #ffffff;
    --sse-radius: 8px;
    --sse-gap: 24px;

    color: var(--sse-text);
    container-type: inline-size;
    font-family: inherit;
}

.sse a {
    color: inherit;
    text-decoration: none;
}

.sse ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sse-empty {
    padding: 24px 0;
    text-align: center;
}

/* Filters */
.sse-filters {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 0 0 40px;
}

.sse-filters__label {
    font-weight: 700;
}

.sse-filter select {
    appearance: none;
    background: var(--sse-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23000'/%3E%3C/svg%3E") no-repeat right 16px center;
    border: 1px solid var(--sse-text);
    border-radius: 999px;
    color: var(--sse-text);
    cursor: pointer;
    font: inherit;
    max-width: 100%;
    padding: 10px 40px 10px 20px;
}

/* List */
.sse-list {
    padding-bottom: clamp(48px, 8vw, 96px);
}

.sse-month + .sse-month {
    margin-top: 48px;
}

.sse-month[hidden],
.sse-row[hidden] {
    display: none;
}

.sse-month__title {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
    margin: 0 0 24px;
    text-transform: capitalize;
}

.sse-rows {
    display: grid;
    gap: 16px;
}

/* Narrow (default): image on top, date beside the text, full-width button. */
.sse-row {
    align-items: center;
    background: var(--sse-surface);
    border-radius: var(--sse-radius);
    column-gap: 16px;
    display: grid;
    grid-template-areas:
        "media media"
        "date  body"
        "action action";
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 16px;
    row-gap: 16px;
}

.sse-row__date,
.sse-card__date {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
}

.sse-row__date {
    grid-area: date;
}

.sse-row__weekday,
.sse-row__month,
.sse-card__weekday,
.sse-card__month {
    font-size: 0.875rem;
    font-weight: 700;
}

.sse-row__day,
.sse-card__day {
    font-size: 2.25rem;
    font-weight: 700;
}

/* Image boxes are 16:9; the image is pinned to all four sides and cropped
   with object-fit, so it fills the box whatever the photo's own shape.
   The image selectors are scoped under .sse to outrank theme and builder
   resets such as Elementor's `.elementor img { height: auto }`. */
.sse-row__media,
.sse-card__media {
    aspect-ratio: 16 / 9;
    background: #d9d9d9;
    border-radius: calc(var(--sse-radius) / 2);
    display: block;
    overflow: hidden;
    position: relative;
}

.sse-row__media {
    grid-area: media;
}

.sse .sse-row__image,
.sse .sse-card__image {
    display: block;
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
}

.sse-row__body {
    grid-area: body;
    min-width: 0;
}

.sse-row__title {
    font-size: clamp(1.125rem, 2vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
    text-transform: uppercase;
}

.sse-row__place {
    color: var(--sse-muted);
    margin: 0;
}

.sse-row__time {
    margin-left: 8px;
}

.sse-row__action {
    grid-area: action;
}

.sse-row__action .sse-button {
    display: block;
}

/* Medium: date and a smaller image on the left, button under the text. */
@container (min-width: 560px) {
    .sse-row {
        grid-template-areas:
            "date media body"
            "date media action";
        grid-template-columns: 64px minmax(160px, 220px) minmax(0, 1fr);
        padding: 20px;
    }

    .sse-row__body {
        align-self: end;
    }

    .sse-row__action {
        align-self: start;
    }

    .sse-row__action .sse-button {
        display: inline-block;
    }
}

/* Wide: one line per event, button on the right. */
@container (min-width: 860px) {
    .sse-row {
        column-gap: var(--sse-gap);
        grid-template-areas: "date media body action";
        grid-template-columns: 80px minmax(200px, 290px) minmax(0, 1fr) auto;
        padding: 24px;
    }

    .sse-row__body,
    .sse-row__action {
        align-self: center;
    }

    .sse-row__day {
        font-size: 3rem;
    }
}

/* Button */
.sse-button {
    background: var(--sse-accent);
    border: 1px solid var(--sse-accent);
    border-radius: 4px;
    color: var(--sse-accent-text) !important;
    display: inline-block;
    font-weight: 700;
    padding: 14px 28px;
    text-align: center;
    text-transform: uppercase;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sse-button:hover,
.sse-button:focus-visible {
    opacity: 0.8;
}

.sse-button--secondary {
    background: transparent;
    color: var(--sse-accent) !important;
}

.sse-button--sold-out {
    background: transparent;
    border-color: var(--sse-muted);
    color: var(--sse-muted) !important;
    cursor: default;
}

/* Slider */
.sse-slider {
    --sse-per-view: 3;

    position: relative;
}

/* Narrow (default): one card with the next one peeking in. */
.sse-slider__track {
    display: grid;
    gap: var(--sse-gap);
    grid-auto-columns: 85%;
    grid-auto-flow: column;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

/* Medium: two cards. Wide: the per_view setting from the shortcode. */
@container (min-width: 520px) {
    .sse-slider__track {
        grid-auto-columns: calc((100% - var(--sse-gap)) / 2);
    }
}

@container (min-width: 760px) {
    .sse-slider__track {
        grid-auto-columns: calc((100% - (var(--sse-per-view) - 1) * var(--sse-gap)) / var(--sse-per-view));
    }
}

.sse-slider__track::-webkit-scrollbar {
    display: none;
}

/*
 * Slider card: always stacked (image, date beside the text, full-width
 * button), independent of the agenda list's layouts. Cards in a row share
 * their height; the text block absorbs the slack so the buttons line up.
 */
.sse-card {
    background: var(--sse-surface);
    border-radius: var(--sse-radius);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 16px;
    scroll-snap-align: start;
}

.sse-card__info {
    align-items: center;
    column-gap: 16px;
    display: grid;
    flex: 1;
    grid-template-columns: 56px minmax(0, 1fr);
}

.sse-card__title {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
    text-transform: uppercase;
}

.sse-card__place {
    color: var(--sse-muted);
    margin: 0;
}

.sse-card__time {
    margin-left: 8px;
}

.sse-card__action .sse-button {
    display: block;
    white-space: normal;
}

.sse-slider__nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.sse-slider[data-sse-static] .sse-slider__nav {
    display: none;
}

.sse-slider__arrow {
    background: transparent;
    border: 1px solid var(--sse-text);
    border-radius: 50%;
    color: var(--sse-text);
    cursor: pointer;
    font-size: 1.5rem;
    height: 44px;
    line-height: 1;
    width: 44px;
}

.sse-slider__arrow:disabled {
    cursor: default;
    opacity: 0.3;
}

/* Small screens: filters stack under their label at full width. */
@container (max-width: 479px) {
    .sse-filters__label {
        flex-basis: 100%;
        text-align: center;
    }

    .sse-filter {
        flex: 1 1 100%;
    }

    .sse-filter select {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sse-slider__track {
        scroll-behavior: auto;
    }
}
