/*
 * EVENTS: LIST OF DATES (plugin events_list, layout "dates", design F6)
 * Each date is an E2 button (.btn--wide) over the full width with a spacing of 16, "More events" is an E2 with arrow
 * down at a spacing of 32 (see List.fluid.html of the theme's events templates).
 * - Narrow: date, time and location above the title
 * - From 48rem: date, time and location left of the middle, the title starting 8 right of the middle. Both halves
 *   are single line and cut with "…", the full text stays in the link (screen readers) and the title attribute of
 *   the title.
 * The title comes first in the markup (screen readers read it before the date), the grid places it after the date.
 */

.event-dates__list {
    display: flex;
    flex-direction: column;
    gap: var(--layout--gap--default);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* The row is the label of the button, the icon (::after) stays at the right */
/*
 * Narrow the row wraps over several lines: radius 20 like the boxes instead of fully rounded, so the text doesn't run
 * into the rounding, and the line height of the small text (the button's single line height would be too tight)
 */
.event-dates__link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space--xs) var(--space--s);
    padding-block: var(--space--xs);
    border-radius: var(--border-radius--default);
    line-height: var(--line-height--text-small);
    text-align: left;
}

.event-dates__meta,
.event-dates__title {
    grid-column: 1;
    min-width: 0;
}

.event-dates__meta {
    grid-row: 1;
}

.event-dates__title {
    grid-row: 2;
}

.event-dates__link::after {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
}

.event-dates__meta {
    font-weight: var(--font-weight--regular);
}

/* The date is bold, time and location regular */
.event-dates__meta > time:first-child {
    font-weight: var(--font-weight--bold);
}

.event-dates__more {
    margin-top: var(--layout--gap--large);
}

@container content-element (min-width: 45rem) {
    /* Single line E2 again (design F6) */
    .event-dates__link {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        column-gap: 0;
        padding-block: var(--space--xs);
        border-radius: var(--border-radius--round);
        line-height: var(--line-height--single);
    }

    /* The vertical padding keeps the descenders (g, p, y) visible despite overflow: hidden with line-height 1, the
       negative margin keeps the button height (like .btn--wide .btn__label in base.css) */
    .event-dates__meta,
    .event-dates__title {
        overflow: hidden;
        margin-block: -.25em;
        padding-block: .25em;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .event-dates__meta {
        padding-right: var(--layout--gap--small);
    }

    .event-dates__title {
        grid-column: 2;
        grid-row: 1;
        padding-left: var(--layout--gap--small);
    }

    .event-dates__link::after {
        grid-column: 3;
        grid-row: 1;
        margin-left: var(--layout--gap--default);
    }
}
