/* ==========================================================================
   CIPIT Events: listing, detail and series pages
   Built on the CipitNexus tokens (shared with CipitElegante) and components in theme.css (page-hero,
   section-head, btn, filter-btn, search-bar, share, prose, empty-state).
   Loaded on event pages, the home page and event search results.
   ========================================================================== */

/* Tokens on :root because event cards also appear outside event pages (home, search). */
:root {
    --ev-green: var(--c-success);
}

/* ---------- Shared: chips, status ---------- */

.ev-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.ev-chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-pill);
    background: var(--c-paper);
    color: var(--c-muted);
    font-size: var(--fs-xs);
    font-weight: 500;
    line-height: 1.5;
}

.ev-chip--type {
    border-color: var(--c-line-strong);
    background: var(--c-paper);
    color: var(--c-brand-dark);
    font-weight: 600;
}

.ev-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .65rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--c-line-strong);
    background: var(--c-paper);
    color: var(--c-muted);
    font-size: var(--fs-2xs);
    font-weight: 700;
    line-height: 1.6;
}

.ev-status--upcoming {
    color: var(--ev-green);
}

.ev-status--live {
    color: var(--c-brand-dark);
}

.ev-status--live::before,
.ev-status--upcoming::before {
    content: "";
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: currentColor;
}

.ev-status--live::before {
    animation: ev-pulse 1.6s ease-in-out infinite;
}

@keyframes ev-pulse {
    50% {
        opacity: .3;
    }
}

/* ---------- Shared: poster media ----------
   Posters carry text, so they are never cropped: the image is contained and a
   blurred copy fills the frame behind it. */

.ev-media {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--c-soft);
    isolation: isolate;
}

.ev-media::before {
    content: "";
    position: absolute;
    inset: -20px;
    z-index: -1;
    background-image: var(--ev-media-bg, none);
    background-size: cover;
    background-position: center;
    filter: blur(18px) saturate(1.1);
    opacity: .55;
}

.ev-media__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .5s var(--ease);
}

.ev-media__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--c-brand) 8%, transparent), transparent 60%),
        var(--c-soft);
    color: color-mix(in srgb, var(--c-brand) 55%, transparent);
    font-size: var(--fs-2xs);
    font-weight: 600;
}

.ev-media__placeholder i {
    font-size: 2rem;
}

.ev-datebadge {
    position: absolute;
    top: .75rem;
    left: .75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3.4rem;
    padding: .35rem .5rem .4rem;
    border-radius: var(--radius-sm);
    background: var(--c-paper);
    line-height: 1.05;
    text-align: center;
}

.ev-datebadge__month {
    color: var(--c-brand);
    font-size: var(--fs-2xs);
    font-weight: 700;
}

.ev-datebadge__day {
    color: var(--c-ink);
    font-family: var(--font-serif);
    font-size: var(--fs-xl);
    font-weight: 700;
}

.ev-datebadge__year {
    color: var(--c-muted);
    font-size: var(--fs-2xs);
}

.ev-media .ev-status {
    position: absolute;
    top: .75rem;
    right: .75rem;
}

/* ---------- Shared: facts list ---------- */

.ev-facts {
    display: grid;
    gap: .35rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--c-muted);
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.ev-facts li {
    display: flex;
    align-items: baseline;
    gap: .6rem;
}

.ev-facts i {
    flex: none;
    width: 1rem;
    color: var(--c-brand);
    text-align: center;
}

.ev-facts abbr {
    font-size: .8em;
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Cards (same frame as .blog-card) ---------- */

.ev-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--c-paper);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .3s, transform .3s cubic-bezier(.16, 1, .3, 1);
}

.ev-card:hover {
    border-color: var(--c-line-strong);
}

.ev-card:hover .ev-media__img {
    transform: scale(1.04);
}

.ev-card .ev-media {
    aspect-ratio: 16 / 10;
}

.ev-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1.1rem;
}

.ev-card__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    line-height: 1.3;
}

.ev-card__link {
    color: var(--c-ink);
    text-decoration: none;
}

/* Whole card is clickable; links and buttons inside sit above the stretched link. */
.ev-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.ev-card:hover .ev-card__link {
    color: var(--c-brand);
}

.ev-card__excerpt {
    margin: 0;
    color: var(--c-muted);
    font-size: var(--fs-md);
}

.ev-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding-top: .25rem;
}

.ev-card__action {
    position: relative;
    z-index: 2;
}

.ev-card.is-past .ev-datebadge__day {
    color: var(--c-muted);
}

/* Feature (upcoming) card: horizontal on wide screens */
.ev-card--feature {
    flex-direction: row;
}

.ev-card--feature .ev-media {
    flex: 0 0 38.2%; /* 1/φ² of the card: the minor golden part */
    aspect-ratio: auto;
    min-height: 300px;
}

.ev-card--feature .ev-card__body {
    justify-content: center;
    gap: .9rem;
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.ev-card--feature .ev-card__title {
    font-size: var(--fs-2xl);
    line-height: var(--lh-heading);
}

.ev-card--feature .ev-facts {
    font-size: var(--fs-md);
}

/* ---------- Grids & section heads ---------- */

.ev-feature-list {
    display: grid;
    gap: 1.5rem;
}

.ev-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.ev-section + .ev-section {
    margin-top: var(--section);
}

.ev-section__head {
    justify-content: flex-start;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.ev-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 .55rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--c-line-strong);
    background: var(--c-paper);
    color: var(--c-ink);
    font-size: var(--fs-sm);
    font-weight: 700;
}

.ev-section__link {
    margin-left: auto;
}

/* ---------- Archive ---------- */

.ev-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 2.5rem;
}

.ev-toolbar .ev-filters {
    margin: 0;
}

.ev-search {
    flex: 0 1 380px;
    min-width: 260px;
}

.ev-search input[type="search"] {
    height: 38px;
}

.ev-search .btn {
    min-height: 36px;
}

.ev-results {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    margin: -1.5rem 0 2rem;
    color: var(--c-muted);
    font-size: var(--fs-sm);
}

.ev-empty {
    max-width: none;
    margin: 0;
}

.ev-empty p {
    margin: 0 0 .25rem;
}

.ev-empty__title {
    color: var(--c-ink);
    font-weight: 600;
}

/* ---------- Single: hero ---------- */

.ev-page-hero .breadcrumb ol {
    margin-bottom: 1.5rem;
}

.ev-hero {
    display: grid;
    grid-template-columns: var(--split-golden);
    gap: clamp(var(--space-4), 1rem + 3vw, var(--space-5));
    align-items: center;
}

.ev-hero--no-media {
    grid-template-columns: 1fr;
}

.ev-hero__content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.ev-hero__title {
    max-width: 24ch;
}

.ev-hero__facts {
    display: grid;
    gap: .9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ev-hero__facts li {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.ev-hero__facts strong {
    display: block;
    color: var(--c-on-dark);
    font-weight: 600;
    line-height: 1.35;
}

.ev-hero__facts small {
    display: block;
    color: var(--c-on-dark-muted);
    font-size: var(--fs-sm);
}

.ev-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid color-mix(in srgb, var(--c-on-dark) 14%, transparent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--c-on-dark) 6%, transparent);
    color: var(--c-brand-on-dark);
}

.ev-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: .25rem;
}

.ev-hero__actions .btn--ghost {
    border-color: color-mix(in srgb, var(--c-on-dark) 30%, transparent);
    color: var(--c-on-dark);
}

.ev-hero__actions .btn--ghost:hover,
.ev-dropdown[open] > .btn--ghost {
    border-color: var(--c-on-dark);
    color: var(--c-on-dark);
}

.ev-hero__note {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    color: var(--c-on-dark-muted);
    font-size: var(--fs-sm);
}

.ev-hero__note--closed {
    color: var(--c-brand-on-dark);
    font-weight: 600;
}

.ev-hero__media {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
}

.ev-hero__media:hover .ev-media__img {
    transform: scale(1.02);
}

.ev-media__zoom {
    position: absolute;
    right: .75rem;
    bottom: .75rem;
    display: inline-grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: rgb(22 23 27 / .75);
    color: var(--c-on-dark);
    font-size: var(--fs-sm);
    opacity: 0;
    transition: opacity .2s;
}

.ev-hero__media:hover .ev-media__zoom,
.ev-hero__media:focus-visible .ev-media__zoom {
    opacity: 1;
}

/* Calendar dropdown */
.ev-dropdown {
    position: relative;
}

.ev-dropdown summary {
    list-style: none;
}

.ev-dropdown summary::-webkit-details-marker {
    display: none;
}

.ev-dropdown__menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + .5rem);
    left: 0;
    min-width: 230px;
    padding: .4rem;
    background: var(--c-paper);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
}

.ev-dropdown__menu a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--c-ink);
    font-size: var(--fs-sm);
    text-decoration: none;
}

.ev-dropdown__menu a:hover {
    background: var(--c-soft);
    color: var(--c-ink);
}

.ev-dropdown__menu i {
    width: 1rem;
    color: var(--c-muted);
    text-align: center;
}

/* ---------- Single: body ---------- */

.ev-layout {
    display: grid;
    grid-template-columns: var(--split-sidebar);
    gap: clamp(var(--space-4), 1rem + 3vw, var(--space-5));
    align-items: start;
}

.ev-editions + .ev-layout {
    margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.ev-block + .ev-block {
    margin-top: var(--space-5);
}

.ev-block__title {
    margin: 0 0 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--c-line);
    font-family: var(--font-serif);
    font-size: var(--fs-xl);
}

.ev-video {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.ev-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Sidebar */
.ev-aside {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    display: grid;
    gap: 1.25rem;
}

.ev-panel {
    padding: 1.5rem;
    background: var(--c-paper);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
}

.ev-panel__title {
    margin: 0 0 .75rem;
    color: var(--c-ink);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
}

.ev-panel__cta {
    width: 100%;
}

.ev-details {
    display: grid;
    gap: 1rem;
    margin: 0 0 1.5rem;
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.ev-details dt {
    margin-bottom: .15rem;
    color: var(--c-muted);
    font-size: .8125rem;
}

.ev-details dd {
    margin: 0;
    color: var(--c-ink);
}

.ev-details__time {
    display: block;
    color: var(--c-muted);
}

.ev-panel__closed {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--c-line);
    color: var(--c-muted);
    font-size: var(--fs-sm);
}

/* Mobile sticky register bar (shown ≤ 900px) */
.ev-stickybar {
    display: none;
}

/* ==========================================================================
   Event series: edition tabs, series chip, series page
   ========================================================================== */

.ev-chip--series {
    position: relative;
    z-index: 2; /* above the card's stretched link */
    gap: .35rem;
    color: var(--c-ink);
    text-decoration: none;
    transition: border-color .2s, color .2s;
}

.ev-chip--series i {
    color: var(--c-brand);
    font-size: var(--fs-2xs);
}

.ev-chip--series:hover {
    border-color: var(--c-ink);
    color: var(--c-ink);
}

/* Edition tabs on the event page */
.ev-editions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    background: var(--c-paper);
}

.ev-editions__head {
    display: grid;
    gap: .15rem;
    min-width: 0;
}

.ev-editions__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--c-brand);
    font-size: var(--fs-2xs);
    font-weight: 600;
}

.ev-editions__series {
    color: var(--c-ink);
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}

.ev-editions__series span {
    margin-left: .35rem;
    color: var(--c-muted);
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.ev-editions__series:hover {
    color: var(--c-brand);
}

.ev-editions__list {
    display: flex;
    flex: 1;
    gap: .5rem;
    min-width: 0;
    margin: 0;
    padding: 2px;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: thin;
}

/* Edition pills follow .filter-btn: outlined, ink when current. */
.ev-edition {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 5.5rem;
    padding: .45rem 1rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    background: var(--c-paper);
    color: var(--c-ink);
    line-height: 1.25;
    text-decoration: none;
    transition: background-color .2s, border-color .2s, color .2s;
}

.ev-edition__year {
    font-weight: 700;
}

.ev-edition__note {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--c-muted);
    font-size: var(--fs-2xs);
    font-weight: 600;
    white-space: nowrap;
}

.ev-edition.is-upcoming .ev-edition__note,
.ev-edition.is-live .ev-edition__note {
    color: var(--ev-green);
}

.ev-edition:hover {
    border-color: var(--c-ink);
    color: var(--c-ink);
}

.ev-edition.is-current {
    background: var(--c-ink);
    border-color: var(--c-ink);
    color: var(--c-on-dark);
    cursor: default;
}

.ev-edition.is-current .ev-edition__note {
    color: color-mix(in srgb, var(--c-on-dark) 75%, transparent);
}

.ev-editions__all {
    margin-left: auto;
    white-space: nowrap;
}

/* Series page hero */
.ev-series__hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: end;
}

.ev-series__intro {
    display: grid;
    justify-items: start;
}

.ev-series__intro .page-hero__title {
    max-width: 26ch;
}

.ev-series__intro .ev-hero__actions {
    margin-top: 1.75rem;
}

.ev-series__stats {
    display: flex;
    gap: .75rem;
    margin: 0;
}

.ev-series__stats div {
    min-width: 6.5rem;
    padding: 1rem 1.1rem;
    border: 1px solid color-mix(in srgb, var(--c-on-dark) 14%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--c-on-dark) 6%, transparent);
    text-align: center;
}

.ev-series__stats dt {
    color: var(--c-on-dark-muted);
    font-size: var(--fs-2xs);
    font-weight: 600;
}

.ev-series__stats dd {
    margin: .15rem 0 0;
    color: var(--c-on-dark);
    font-family: var(--font-serif);
    font-size: var(--fs-2xl);
    font-weight: 700;
    line-height: 1.1;
}

/* ---------- Light page headers ----------
   The hero rules above suit the default dark header. With Site Style >
   Page headers set to Light, put the light-background colours back. */

.page-header-light .ev-hero__facts strong,
.page-header-light .ev-series__stats dd {
    color: var(--c-ink);
}

.page-header-light .ev-hero__facts small,
.page-header-light .ev-hero__note,
.page-header-light .ev-series__stats dt {
    color: var(--c-muted);
}

.page-header-light .ev-hero__note--closed {
    color: var(--c-brand);
}

.page-header-light .ev-icon,
.page-header-light .ev-series__stats div {
    border-color: var(--c-line);
    background: var(--c-paper);
}

.page-header-light .ev-icon {
    color: var(--c-brand);
}

.page-header-light .ev-hero__actions .btn--ghost {
    border-color: var(--c-line);
    background: var(--c-paper);
    color: var(--c-ink);
}

.page-header-light .ev-hero__actions .btn--ghost:hover,
.page-header-light .ev-dropdown[open] > .btn--ghost {
    border-color: var(--c-ink);
    color: var(--c-ink);
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .ev-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ev-layout {
        grid-template-columns: var(--split-golden);
    }
}

@media (max-width: 900px) {
    .ev-hero {
        grid-template-columns: 1fr;
    }

    .ev-hero__media {
        order: -1;
    }

    .ev-layout {
        grid-template-columns: 1fr;
    }

    .ev-aside {
        position: static;
    }

    .ev-card--feature {
        flex-direction: column;
    }

    .ev-card--feature .ev-media {
        flex: none;
        aspect-ratio: 16 / 10;
        min-height: 0;
    }

    .ev-card--feature .ev-card__body {
        padding: 1.25rem;
    }

    .ev-card--feature .ev-card__title {
        font-size: var(--fs-xl);
    }

    .ev-series__hero {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .ev-editions__list {
        flex: 1 1 100%;
        order: 3;
    }

    .ev-editions__all {
        order: 4;
        margin-left: 0;
    }

    .ev-stickybar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 900;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: .75rem var(--gutter) calc(.75rem + env(safe-area-inset-bottom));
        background: var(--c-paper);
        border-top: 1px solid var(--c-line);
    }

    .ev-stickybar strong,
    .ev-stickybar small {
        display: block;
        line-height: 1.3;
    }

    .ev-stickybar strong {
        color: var(--c-ink);
    }

    .ev-stickybar small {
        color: var(--ev-green);
        font-weight: 600;
    }

    /* Room for the sticky register bar at the end of the page. */
    body:has(.ev-stickybar) {
        padding-bottom: 4.5rem;
    }
}

@media (max-width: 640px) {
    .ev-toolbar {
        margin-bottom: 2rem;
    }

    .ev-toolbar .ev-filters,
    .ev-search {
        flex: 1 1 100%;
        min-width: 0;
    }

    .ev-grid {
        grid-template-columns: 1fr;
    }

    .ev-section__head {
        flex-wrap: wrap;
    }

    .ev-hero__actions .btn,
    .ev-hero__actions .ev-dropdown {
        width: 100%;
    }

    .ev-dropdown__menu {
        right: 0;
    }

    .ev-series__stats {
        width: 100%;
    }

    .ev-series__stats div {
        flex: 1;
        min-width: 0;
        padding: .8rem .5rem;
    }
}

@media print {
    .ev-stickybar,
    .ev-dropdown,
    .ev-hero__actions {
        display: none !important;
    }
}
