/* Bio-Event-Agenda — agenda list with <dialog> filter panel, für Mobile und Tablet.
 * Scoped to .bea-agenda. Hidden on desktop (≥1025px); the existing calendar view stays visible there.
 *
 * Die 1024px sind Elementors Tablet-Breakpoint (Option elementor_viewport_lg = 1025), nicht
 * frei gewählt: Auf der Programmseite versteckt Elementor die Desktop-Kalender-View per
 * `elementor-hidden-tablet elementor-hidden-mobile`. Solange dieses Widget erst ab 767px
 * ansprang, zeigte der Bereich 768–1024px gar keine Veranstaltungen. Die beiden Werte
 * gehören zusammen — ändert jemand den Elementor-Breakpoint, muss dieser mit. */

.bea-agenda { display: none; }

@media (max-width: 1024px) {
    .bea-agenda { display: block; position: relative; padding-block-start: 3.5rem; }
}

.bea-agenda *, .bea-agenda *::before, .bea-agenda *::after { box-sizing: border-box; }

/* -------- Floating Action Button -------- */
.bea-agenda__fab {
    position: fixed;
    /* Das Theme setzt rechts eine Sticky-Leiste über die volle Seitenhöhe
     * (#page #sidenav: Social-Icons + Seitennavigation). Ihr oberstes Icon
     * klebt bei top:0 und lief dem Button ab ca. 400px Scroll ins Bild.
     * Der Button weicht ihr aus, statt sich darüberzulegen.
     *
     * Der Inset läuft über eine Variable, weil oben und rechts denselben Wert
     * halten müssen — der Button soll optisch gleich weit von Oberkante und
     * rechtem Rand sitzen. vw statt %: Prozente beziehen sich bei
     * inset-block-start auf die Viewport-Höhe, bei inset-inline-end auf die
     * Breite; das ergäbe zwei verschiedene Pixelwerte und genau nicht die
     * gewünschte Symmetrie.
     *
     * Die 10vw sind die Leistenbreite laut Theme-style.css
     * (`#page #sidenav { width: 10% }`); ab 768px sind es dort 8%, siehe
     * Media-Query unten. Die 5% ab 1200px sind hier egal — das Widget rendert
     * nur bis 1024px. Ändert das Theme die Breiten, müssen diese Werte mit. */
    --bea-fab-inset: calc(10vw + 1rem);
    inset-inline-end: var(--bea-fab-inset);
    inset-block-start: var(--bea-fab-inset);
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 0;
    border-radius: 999px;
    padding: .75rem 1.25rem;
    font: inherit;
    font-weight: 600;
    background: #2c6e49;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    cursor: pointer;
    min-height: 44px;            /* WCAG target size */
}
@media (min-width: 768px) {
    /* Ab hier ist die Theme-Leiste schmaler: `#page #sidenav { width: 8% }`. */
    .bea-agenda__fab { --bea-fab-inset: calc(8vw + 1rem); }
}

.bea-agenda__fab:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }

/* Der FAB erscheint erst, wenn die Agenda zur Hälfte im Blick ist. Die Klasse
 * setzt agenda.js — ohne JS oder ohne IntersectionObserver bleibt der Button
 * sichtbar, statt unerreichbar zu werden. visibility (nicht nur opacity) nimmt
 * ihn im verborgenen Zustand aus Tab-Reihenfolge und Screenreader-Baum; die
 * 0s-Verzögerung schaltet sie erst nach dem Ausblenden. */
.bea-agenda--io .bea-agenda__fab {
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility 0s linear .2s;
}
.bea-agenda--io .bea-agenda__fab.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity .2s ease, visibility 0s linear 0s;
}
@media (prefers-reduced-motion: reduce) {
    .bea-agenda--io .bea-agenda__fab,
    .bea-agenda--io .bea-agenda__fab.is-visible { transition: none; }
}

.bea-agenda__heading {
    text-transform: uppercase;
    font-size: 20px;
    margin-block-end: 40px;
}
.bea-agenda__fab-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 .375rem;
    border-radius: 999px;
    background: #ffd166;
    color: #1a1a1a;
    font-size: .75rem;
    font-weight: 700;
}

/* -------- Dialog / Bottom Sheet -------- */
/* The UA default on <dialog> is `max-width: calc(100% - 2em - 6px)` and
 * `margin: auto`, which both need to be overridden for a full-width bottom sheet. */
.bea-agenda__panel {
    border: 0;
    padding: 0;
    margin: 0;
    inset-block-start: auto;
    inset-block-end: 0;
    inset-inline: 0;
    inline-size: 100%;
    max-inline-size: 100%;
    max-width: 100%;              /* override UA default */
    max-block-size: 90svh;
    max-height: 90svh;            /* override UA default cap */
    border-start-start-radius: 16px;
    border-start-end-radius: 16px;
    background: #fff;
    color: inherit;
    box-shadow: 0 -8px 32px rgba(0,0,0,.25);
}
.bea-agenda__panel::backdrop { background: rgba(0,0,0,.5); }
.bea-agenda__panel[open] { display: flex; flex-direction: column; }

.bea-agenda__form {
    display: flex;
    flex-direction: column;
    min-block-size: 0;
    max-block-size: inherit;
}

.bea-agenda__panel-header {
    position: sticky;
    inset-block-start: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: #fff;
    border-block-end: 1px solid rgba(0,0,0,.08);
    z-index: 1;
}
.bea-agenda__panel-title { margin: 0; font-size: 1.125rem; }
.bea-agenda__close {
    inline-size: 44px; block-size: 44px;
    border: 0;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}
.bea-agenda__close:focus-visible { outline: 3px solid #2c6e49; outline-offset: 2px; }

/* -------- Fieldsets -------- */
.bea-agenda__fs {
    border: 0;
    padding: 1rem 1.25rem;
    margin: 0;
    border-block-end: 1px solid rgba(0,0,0,.06);
}
.bea-agenda__fs:last-of-type { border-block-end: 0; }
.bea-agenda__fs legend {
    padding: 0 0 .5rem;
    font-size: .875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .8;
}

.bea-agenda__field { display: flex; flex-direction: column; gap: .25rem; }
.bea-agenda__field-label { font-size: .75rem; opacity: .7; }
.bea-agenda__field input,
.bea-agenda__field select {
    font: inherit;
    padding: .625rem .75rem;
    border: 1px solid rgba(0,0,0,.2);
    border-radius: 8px;
    background: #fff;
    min-block-size: 44px;
    inline-size: 100%;
}
.bea-agenda__field input:focus-visible,
.bea-agenda__field select:focus-visible {
    outline: 3px solid #2c6e49;
    outline-offset: 1px;
    border-color: #2c6e49;
}

.bea-agenda__plz-grid,
.bea-agenda__date-grid { display: grid; grid-template-columns: 2fr 1fr; gap: .75rem; }
.bea-agenda__date-grid { grid-template-columns: 1fr 1fr; }

/* -------- Chips (checkbox toggles) -------- */
.bea-agenda__chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.bea-agenda__chip {
    display: inline-flex;
    align-items: center;
    min-block-size: 36px;
    padding: .375rem .75rem;
    border: 1px solid rgba(0,0,0,.25);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s, border-color .15s, color .15s;
}
.bea-agenda__chip input {
    position: absolute;
    inline-size: 1px; block-size: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}
.bea-agenda__chip:has(input:checked) {
    background: #2c6e49;
    border-color: #2c6e49;
    color: #fff;
}
.bea-agenda__chip:has(input:focus-visible) {
    outline: 3px solid #ffd166;
    outline-offset: 2px;
}
.bea-agenda__chip-label { font-size: .875rem; }

/* -------- Panel footer -------- */
.bea-agenda__panel-footer {
    position: sticky;
    inset-block-end: 0;
    display: flex;
    gap: .75rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-block-start: 1px solid rgba(0,0,0,.08);
}
.bea-agenda__btn {
    flex: 1;
    font: inherit;
    font-weight: 600;
    min-block-size: 44px;
    padding: .625rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
}
.bea-agenda__btn--primary { background: #2c6e49; color: #fff; }
.bea-agenda__btn--secondary { background: #fff; color: inherit; border-color: rgba(0,0,0,.25); }
.bea-agenda__btn:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }

/* -------- Agenda list -------- */
.bea-agenda__list { padding-block-end: 1.5rem; }
.bea-agenda__list[aria-busy="true"] { opacity: .5; pointer-events: none; }

.bea-agenda__pagination { padding-block-end: 1.5rem; display: flex; justify-content: center; }
.bea-agenda__load-more { min-inline-size: 12rem; }
.bea-agenda__load-more[hidden] { display: none; }

.bea-agenda__hint { margin: .5rem 0 0; font-size: .8rem; color: #b00020; }
.bea-agenda__hint[hidden] { display: none; }

.bea-agenda__date-header { margin-block: 1.5rem .5rem; font-size: 1rem; font-weight: 600; }
.bea-agenda__day { display: flex; flex-direction: column; gap: .75rem; }
.bea-agenda__card {
    padding: 1rem;
    background: #fff;
    border-block-start: 1px solid rgba(0,0,0,.1);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.bea-agenda__card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}
.bea-agenda__title { margin: 0; font-size: 1.05rem; line-height: 1.3; flex: 1; }
.bea-agenda__title a { color: inherit; text-decoration: none; }
.bea-agenda__title a:hover,
.bea-agenda__title a:focus-visible { text-decoration: underline; }

.bea-agenda__ical {
    display: inline-grid;
    place-items: center;
    inline-size: 40px;
    block-size: 40px;
    flex: 0 0 auto;
    border-radius: 8px;
    color: #2c6e49;
    text-decoration: none;
}
.bea-agenda__ical:focus-visible { outline: 3px solid #2c6e49; outline-offset: 2px; }

.bea-agenda__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    font-size: .875rem;
    opacity: .8;
    margin: 0;
}
.bea-agenda__time { font-weight: 600; font-variant-numeric: tabular-nums; opacity: 1; }
.bea-agenda__venue::before { content: "·"; margin-inline-end: .75rem; opacity: .5; }

.bea-agenda__excerpt {
    margin: 0;
    font-size: .9rem;
    line-height: 1.45;
    color: inherit;
    opacity: .85;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.bea-agenda__tags {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
}
.bea-agenda__tag {
    display: inline-flex;
    align-items: center;
    padding: .125rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    line-height: 1.5;
    border: 1px solid transparent;
}
.bea-agenda__tag--art     { background: #eaf3ee; color: #1f4d36; }
.bea-agenda__tag--verband { background: #fff4dc; color: #6a4500; border-color: #f0d089; }
.bea-agenda__tag--zusatz  { background: transparent; color: inherit; border-color: rgba(0,0,0,.2); opacity: .8; }
.bea-agenda__empty { padding: 2rem 0; text-align: center; opacity: .6; }

/* -------- Screen reader only -------- */
.bea-agenda .screen-reader-text {
    position: absolute !important;
    inline-size: 1px; block-size: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}
