/*
 * Events Manager output (Events & Webinars list, single events, proposal
 * page) in the STORM design system. Loaded together with the plugin's own
 * stylesheet. Colours come from the Customizer palette, category colours
 * from Events → Categories, and the list / single event markup from
 * Events → Settings → Formatting.
 */

/* Plugin variables → palette and fonts */
.em {
    --font-family: inherit;
    --font-size: 1rem;
    --line-height: 1.6;
    --font-weight: inherit;
    --text-color-richer: var(--theme-palette-color-4);
    --text-color-normal: var(--theme-palette-color-4);
    --text-color-softer: var(--theme-palette-color-5);
    --accent-color: var(--theme-palette-color-1);
    --accent-color-hover: var(--theme-palette-color-2);
    --border-color: var(--theme-palette-color-6);
    --border-color-softer: var(--theme-palette-color-6);
    --background-color-softer: var(--theme-palette-color-7);
}


/* Upcoming / Past links above the list: white pills like the Knowledge
   Centre quick links, soft shadow on hover; the current view (aria-current,
   set in functions.php) filled navy. */
.storm-event-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-weight: 600;
}

.storm-event-tabs a {
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    background: var(--storm-ui-surface);
    color: var(--theme-palette-color-1);
    font-size: 0.9rem;
    text-decoration: none;
    transition: box-shadow 0.2s ease;
}

.storm-event-tabs a:is(:hover, :focus-visible) {
    box-shadow: var(--storm-ui-shadow);
}

.storm-event-tabs a[aria-current] {
    background: var(--theme-palette-color-1);
    color: var(--theme-palette-color-8);
}


/* Search bar: a white panel with the faint edge (as the Knowledge Centre
   filter panel); the dividers between its fields use the same faint edge. */
.em.em-search {
    --border-color: var(--storm-ui-border-faint);
}

.em.em-search .em-search-main-bar {
    border-radius: var(--storm-ui-radius);
    background: var(--storm-ui-surface);
}


/* Event card (list item format): white with the faint edge, as the
   Knowledge Centre cards; the left stripe in the event type's colour
   (Events → Categories) is kept on purpose (decision 50). */
.storm-event {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 1.5rem;
    margin-block: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--storm-ui-border-faint);
    border-left: 4px solid var(--storm-event-color, var(--theme-palette-color-1));
    border-radius: var(--storm-ui-radius);
    background: var(--storm-ui-surface);
}

.storm-event__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 0.5rem;
    border-radius: 6px;
    background: var(--theme-palette-color-7);
    text-align: center;
}

.storm-event__day {
    color: var(--theme-palette-color-1);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.1;
}

.storm-event__month {
    color: var(--theme-palette-color-5);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.storm-event__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.storm-event__note {
    color: var(--theme-palette-color-5);
    font-size: 0.85rem;
}

.storm-event__title {
    margin-block: 0.5rem 0.75rem;
}

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

.storm-event__title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.storm-event__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--theme-palette-color-5);
    font-size: 0.9rem;
}

.storm-event__meta li,
.storm-event-single__facts p {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.storm-event :is(.storm-event__meta, .storm-event__date) .em-icon,
.storm-event-single__facts .em-icon {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    background-size: 16px;
}

.storm-event__excerpt {
    margin-block: 0.75rem 1.25rem;
}

.storm-event__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.storm-event__organiser {
    margin-left: auto;
    color: var(--theme-palette-color-5);
    font-size: 0.85rem;
}

.storm-event__cancelled {
    color: var(--storm-ui-danger);
    font-weight: 600;
}

@media (max-width: 599px) {
    .storm-event {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
        padding: 1.25rem;
    }

    .storm-event__date {
        flex-direction: row;
        justify-content: flex-start;
        width: fit-content;
        padding: 0.4rem 0.75rem;
    }

    .storm-event__day {
        font-size: 1.25rem;
    }

    .storm-event__organiser {
        margin-left: 0;
        flex-basis: 100%;
    }
}


/* Event type pills: category colour as a dot, dark text for contrast */
.storm-event ul.event-categories,
.storm-event-single ul.event-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

ul.event-categories a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--storm-event-color, var(--theme-palette-color-1)) 14%, var(--theme-palette-color-8));
    color: var(--theme-palette-color-4);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

ul.event-categories a::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--storm-event-color, var(--theme-palette-color-1));
}

ul.event-categories a:hover {
    text-decoration: underline;
}


/* Single event */

/* Image from the proposal or the editor: whole picture, never cropped
   (posters stay readable), at most 28rem high. On wide screens it sits
   beside the facts box; without an image the facts box keeps the full width. */
.storm-event-single__image {
    margin: 0 0 1.5rem;
}

.storm-event-single__image img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 28rem;
    border-radius: 8px;
}

@media (min-width: 960px) {
    .storm-event-single:has(> .storm-event-single__image) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 2rem;
        align-items: start;
    }

    /* Everything except the image and the facts spans both columns. */
    .storm-event-single:has(> .storm-event-single__image) > :not(.storm-event-single__image, .storm-event-single__facts) {
        grid-column: 1 / -1;
    }

    .storm-event-single:has(> .storm-event-single__image) > .storm-event-single__image {
        margin-bottom: 2rem;
    }

    .storm-event-single:has(> .storm-event-single__image) > .storm-event-single__facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Facts box: white with the faint edge on the light grey page (Customizer →
   Events single → Page Background), with the event type's colour stripe as
   on the cards (decision 50). */
.storm-event-single__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--storm-ui-border-faint);
    border-left: 4px solid var(--storm-event-color, var(--theme-palette-color-1));
    border-radius: var(--storm-ui-radius);
    background: var(--storm-ui-surface);
}

/* Small labels; they stay H2 for the page outline */
.storm-event-single__facts h2 {
    margin: 0 0 0.5rem;
    color: var(--theme-palette-color-5);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.storm-event-single__facts p {
    margin: 0 0 0.35rem;
}

/* Events Manager's "Add To Calendar" button: a link-style line with the
   same icon size and indent as the date and time above it; its dropdown
   arrow stays at the end. The plugin sets the padding with !important. */
.storm-event-single__facts button.input.em-event-add-to-calendar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: auto;
    min-height: 0;
    margin: 0.35rem 0 0 !important;
    padding: 0 1.5rem 0 0 !important;
    border: 0;
    background-color: transparent;
    background-position: 100% 50% !important;
    box-shadow: none;
    color: var(--theme-palette-color-1);
    font: inherit;
    font-weight: 600;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.storm-event-single__facts button.input.em-event-add-to-calendar:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.storm-event-single__facts button.input.em-event-add-to-calendar:focus-visible {
    outline: 2px solid var(--theme-palette-color-1);
    outline-offset: 3px;
}

.storm-event-single__facts button.input.em-event-add-to-calendar .em-icon {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    background-size: 16px;
}

.storm-event-single__register {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}
