/* Public events listing (/public-events): date-led cards, URL-driven filters, explainer below the grid */
.pev-page {
    --pev-ink: #0f172a;
    --pev-muted: #64748b;
    --pev-line: rgba(15, 23, 42, 0.08);
    --pev-surface: #f8fafc;
    --pev-accent: var(--primary, #e11d48);
}

/* Bootstrap .py-4 uses !important, so mobile top spacing needs the same weight */
@media (max-width: 767.98px) {
    section.pev-page {
        padding-top: calc(2.25rem + env(safe-area-inset-top, 0px)) !important;
    }
}

/* Hero */
.pev-hero {
    background: linear-gradient(180deg, var(--pev-surface) 0%, #fff 100%);
    border: 1px solid var(--pev-line);
    border-radius: 16px;
    padding: 1.25rem 1.25rem 1.35rem;
    margin-bottom: 1.1rem;
}

@media (min-width: 768px) {
    .pev-hero {
        padding: 1.6rem 1.75rem 1.7rem;
    }
}

.pev-hero__eyebrow {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pev-accent);
    margin-bottom: 0.45rem;
}

.pev-hero__title {
    font-size: clamp(1.35rem, 2.6vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.18;
    color: var(--pev-ink);
    text-wrap: balance;
    margin: 0 0 0.4rem 0;
}

.pev-hero__lead {
    font-size: 0.92rem;
    line-height: 1.55;
    color: rgba(15, 23, 42, 0.68);
    max-width: 44rem;
    margin: 0 0 0.9rem 0;
}

.pev-chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.1rem;
    margin: 0;
    padding: 0;
}

.pev-chips li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.79rem;
    font-weight: 600;
    color: #334155;
}

.pev-chips i {
    font-size: 1rem;
    color: var(--pev-accent);
}

/* Filter bar */
.pev-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    margin-bottom: 1.25rem;
    background: #fff;
    border: 1px solid var(--pev-line);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.pev-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pev-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.9rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    background: var(--pev-surface);
    border: 1px solid var(--pev-line);
    border-radius: 999px;
    text-decoration: none;
    touch-action: manipulation;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pev-tab:hover {
    color: var(--pev-ink);
    background: #f1f5f9;
    text-decoration: none;
}

.pev-tab[aria-current='page'] {
    color: #fff;
    background: var(--pev-accent);
    border-color: var(--pev-accent);
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}

.pev-tab:focus-visible,
.pev-card__cta:focus-visible,
.pev-category__select:focus-visible,
.pev-category__apply:focus-visible,
.pev-inline-link:focus-visible {
    outline: 2px solid var(--pev-accent);
    outline-offset: 2px;
}

.pev-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.pev-category__label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pev-muted);
    margin: 0;
    white-space: nowrap;
}

.pev-category__select {
    min-width: 10rem;
    height: auto;
    padding: 0.38rem 0.6rem;
    font-size: 0.84rem;
    color: var(--pev-ink);
    background-color: #fff;
    border: 1px solid var(--pev-line);
    border-radius: 8px;
}

.pev-category__apply {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pev-accent);
    background: #fff;
    border: 1px solid rgba(225, 29, 72, 0.35);
    border-radius: 999px;
    white-space: nowrap;
    touch-action: manipulation;
    transition: background 0.15s ease, color 0.15s ease;
}

.pev-category__apply:hover {
    color: #fff;
    background: var(--pev-accent);
}

@media (max-width: 575.98px) {
    .pev-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .pev-category {
        flex-wrap: wrap;
    }

    .pev-category__select {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* Event card */
.pev-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr));
    gap: 1.15rem;
    margin-bottom: 2.5rem;
}

.pev-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--pev-line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.pev-card:hover {
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
    transform: translateY(-3px);
    border-color: rgba(225, 29, 72, 0.2);
}

.pev-card--cancelled {
    opacity: 0.92;
}

/* Organiser banners are portrait notices; crop from the top so the headline survives */
.pev-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #eef2f7;
}

.pev-card__img,
.pev-card__media-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.pev-card__media-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2.25rem;
}

/* Date tear-off: the one thing a family scans for first */
.pev-card__date {
    position: absolute;
    left: 0.7rem;
    bottom: -0.85rem;
    min-width: 3.4rem;
    padding: 0.35rem 0.5rem 0.4rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--pev-line);
    border-top: 3px solid var(--pev-accent);
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
    font-variant-numeric: tabular-nums;
}

.pev-card__date-day {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    color: var(--pev-ink);
}

.pev-card__date-month {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pev-muted);
}

.pev-card__status {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.22rem 0.55rem;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 6px;
    line-height: 1.25;
}

.pev-card__status--cancelled {
    background: #dc2626;
    color: #fff;
}

.pev-card__status--past {
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
}

.pev-card__status--upcoming {
    background: #047857;
    color: #fff;
}

.pev-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.35rem 1rem 1rem;
}

.pev-card__category {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--pev-accent);
    margin: 0 0 0.3rem 0;
}

.pev-card__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--pev-ink);
    margin: 0 0 0.6rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.pev-meta {
    list-style: none;
    margin: 0 0 0.75rem 0;
    padding: 0;
}

.pev-meta li {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    min-width: 0;
    font-size: 0.79rem;
    line-height: 1.4;
    color: #475569;
    margin-bottom: 0.28rem;
}

.pev-meta i {
    flex: 0 0 auto;
    margin-top: 0.05rem;
    font-size: 0.95rem;
    color: #94a3b8;
}

.pev-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.pev-card__note {
    font-size: 0.74rem;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
}

.pev-card__note--open {
    color: #047857;
}

/* Fallback notice: no upcoming events, showing the full archive instead */
.pev-fallback {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    color: #0c4a6e;
    background: #f0f9ff;
    border: 1px solid rgba(2, 132, 199, 0.25);
    border-radius: 10px;
}

.pev-fallback i {
    font-size: 1.1rem;
    line-height: 1.4;
}

.pev-card__note--closed {
    color: #b91c1c;
}

.pev-card__note--muted {
    color: var(--pev-muted);
}

.pev-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--pev-line);
}

.pev-card__fee {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--pev-ink);
    font-variant-numeric: tabular-nums;
}

.pev-card__fee--free {
    color: #047857;
}

.pev-card__seats {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--pev-muted);
}

.pev-card__cta {
    flex: 0 0 auto;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: var(--pev-accent);
    border-radius: 999px;
    text-decoration: none;
    touch-action: manipulation;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.pev-card__cta:hover {
    color: #fff;
    text-decoration: none;
    filter: brightness(0.94);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.28);
}

/* Empty state */
.pev-empty {
    max-width: 32rem;
    margin: 0 auto 2.5rem;
    padding: 2rem 1.25rem;
    text-align: center;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    border: 1px solid var(--pev-line);
    border-radius: 14px;
}

.pev-empty i {
    font-size: 2.5rem;
    color: #cbd5e1;
}

.pev-empty__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pev-ink);
    margin: 0.75rem 0 0.35rem;
}

.pev-empty__text {
    font-size: 0.88rem;
    color: var(--pev-muted);
    margin: 0 0 1rem;
}

/* Explainer below the grid: indexable copy without pushing events down */
.pev-about {
    padding-top: 1.75rem;
    border-top: 1px solid var(--pev-line);
}

.pev-about__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .pev-about__grid {
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
        gap: 2.5rem;
    }
}

.pev-about__title,
.pev-steps__title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--pev-ink);
    margin: 0 0 0.75rem 0;
}

.pev-about__text p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #475569;
    margin: 0 0 0.85rem 0;
    max-width: 42rem;
}

.pev-about__text p:last-child {
    margin-bottom: 0;
}

.pev-steps {
    padding: 1.25rem 1.25rem 1.35rem;
    background: var(--pev-surface);
    border: 1px solid var(--pev-line);
    border-radius: 14px;
    align-self: start;
}

.pev-steps ol {
    list-style: none;
    counter-reset: pev-step;
    margin: 0;
    padding: 0;
}

.pev-steps li {
    counter-increment: pev-step;
    position: relative;
    padding-left: 2rem;
    font-size: 0.86rem;
    line-height: 1.55;
    color: #475569;
    margin-bottom: 0.75rem;
}

.pev-steps li:last-child {
    margin-bottom: 0;
}

.pev-steps li::before {
    content: counter(pev-step);
    position: absolute;
    left: 0;
    top: 0.05rem;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--pev-accent);
    background: #fff;
    border: 1px solid rgba(225, 29, 72, 0.25);
    border-radius: 50%;
    font-variant-numeric: tabular-nums;
}

.pev-inline-link {
    color: var(--pev-accent);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .pev-card,
    .pev-tab,
    .pev-card__cta {
        transition: none;
    }

    .pev-card:hover {
        transform: none;
    }
}
