/* ==========================================================================
   Mitfahrbörse (Plugin clubs_fe_lift): Listen, Detailansicht, Formulare.

   Stand vorher ("Kraut und Rüben"): zwei Tabellen mit sechs Spalten, in
   jeder Zeile derselbe Festivalname und ein Knopf in voller
   Plakatgrösse; mobil blieb von der Tabelle nur der Ort und ein
   Aufklapp-Pfeil. Überschriften halb Leseschrift, halb Plakat (Schatten
   und Versalien kamen aus der Site-CSS), Formulare ohne Gliederung,
   jede Ansicht mit eigener Breite.

   Jetzt:
   - Listen: jeder Eintrag eine Karte (Richtung, Abfahrt, Strecke,
     Personen, Bemerkung), im Raster nebeneinander. Das Markup bleibt
     eine Tabelle, damit DataTables weiter filtert und blättert — die
     Kartenform kommt allein von hier (Lift/Liste.html,
     JavaScript/Ui/table.js).
   - Einzelansichten (Detail, Kontakt, Formulare, Link anfordern): eine
     Karte in Formularbreite, mittig.
   - Alle Überschriften des Plugins in derselben Form (.lift-titel).

   Vorher stand das als Abschnitt 14a in festival.css; es lebt jetzt
   hier, weil es nur auf Seiten mit diesem Plugin gebraucht wird (über
   f:asset.css in den Templates von FrontendLift).

   Farben nur aus den Marken-Variablen der Festivalseite (festival.css:
   --fest-*), die im dunklen Thema selbst umschalten. Fallbacks, damit es
   auch auf einer Seite ohne festival.css lesbar bleibt.
   ========================================================================== */

.frame-type-clubs_fe_lift,
.tx-orgadiy:has(.lift-titel) {
    --lift-ink: var(--fest-ink, #14181f);
    --lift-muted: var(--fest-ink-muted, #4a5568);
    --lift-flaeche: var(--fest-flaeche, #fff);
    --lift-flaeche-leise: var(--fest-flaeche-leise, #f5f6f8);
    --lift-linie: var(--fest-linie, rgba(20, 24, 31, 0.12));
    --lift-primary: var(--fest-primary, var(--bs-primary, #175da9));
    --lift-on-primary: var(--fest-on-primary, #fff);
    --lift-akzent: var(--fest-primary-ink, var(--bs-primary-text-emphasis, #0b2e4f));
    --lift-radius: var(--fest-radius, 14px);
    --lift-radius-s: var(--fest-radius-s, 8px);
    --lift-schatten: var(--fest-schatten, 0 1px 2px rgba(20, 24, 31, 0.06), 0 8px 24px -12px rgba(20, 24, 31, 0.28));
    --lift-schatten-hoch: var(--fest-schatten-hoch, 0 2px 4px rgba(20, 24, 31, 0.08), 0 16px 32px -12px rgba(20, 24, 31, 0.32));
    --lift-abstand: var(--fest-space-s, 1rem);
    --lift-klein: var(--fest-step--1, 0.9rem);
    --lift-tempo: var(--fest-tempo, 180ms);
}

/* Im dunklen Thema ist die Markenfarbe als Schrift je nach Festival zu
   dunkel (Weinturm: Weinrot auf Schwarz) — aufgehellt bleibt sie
   lesbar. Dieselbe Rechnung wie in site-food-merch.css. */
html[data-bs-theme="dark"] .frame-type-clubs_fe_lift,
html[data-bs-theme="dark"] .tx-orgadiy:has(.lift-titel) {
    --lift-akzent: color-mix(in srgb, var(--fest-primary-ink, #9ec5fe) 35%, #fff);
}

/* --------------------------------------------------------------------------
   Rahmen: Seitenachse und Karten
   -------------------------------------------------------------------------- */

/* Die .container im Plugin bringen ihre eigene Bootstrap-Achse mit
   (Zentrierung, kleiner Gutter je Breakpoint). Dieselbe Achse wie
   ueberall sonst auf der Seite (1320px, --fest-space-s Gutter) kommt
   deshalb auf den Wrapper; die Kinder stehen darin als Raster mit
   gleichem Abstand. */
.festival-theme .frame-type-clubs_fe_lift .tx-orgadiy {
    display: grid;
    gap: var(--fest-space-m, 2rem);
    max-width: 1320px;
    margin-inline: auto;
    padding-inline: var(--fest-space-s, 1rem);
}

/* Einzelansichten und Formulare: eine Karte in Formularbreite, mittig.
   Vorher war die Karte immer 1320px breit und das Formular darin auf
   48rem gedeckelt — Titel links an der Kartenkante, Felder in der Mitte,
   zwei Achsen in einer Karte. */
.festival-theme .frame-type-clubs_fe_lift .tx-orgadiy > .container {
    width: 100%;
    max-width: 52rem;
    margin: 0 auto;
    /* Ohne das sprengt breiter Inhalt die Karte: ein Grid-Kind hat
       min-width: auto und waechst mit seinem breitesten Inhalt. */
    min-width: 0;
    padding-inline: var(--fest-space-m, 2rem);
    /* Abschnitt 5 in festival.css nimmt jedem .tx-orgadiy > .container
       mit padding-block: 0 !important den vertikalen Abstand weg (dort
       verhindert das doppeltes py-5). Diese Karte braucht ihn aber
       wirklich — deshalb hier gezielt zurueckerobert. */
    padding-block: var(--fest-space-m, 2rem) !important;
    background: var(--lift-flaeche);
    border: 1px solid var(--lift-linie);
    border-radius: var(--lift-radius);
    box-shadow: var(--lift-schatten);
}

/* Die Listen sind keine Karte, sondern tragen Karten: Kopfzeile plus
   Raster, auf voller Seitenbreite. Eine Karte um Karten waere Rahmen im
   Rahmen. */
.festival-theme .frame-type-clubs_fe_lift .tx-orgadiy > .lift-bereich {
    max-width: none;
    padding: 0 !important;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Die Formulare stehen jetzt in einer Karte, die selbst schon die
   Formularbreite hat (oben) — die alte Deckelung auf 48rem wuerde sie
   nur noch einmal einruecken. */
.festival-theme .frame-type-clubs_fe_lift form {
    max-width: none;
    margin: 0;
}

.festival-theme .frame-type-clubs_fe_lift form .row {
    --bs-gutter-x: var(--fest-space-s, 1rem);
}

/* --------------------------------------------------------------------------
   Ueberschriften
   -------------------------------------------------------------------------- */

/* Leseschrift, fett, ohne Versalien und ohne den Fehldruck-Schatten der
   Site-CSS (Wasted.css legt ihn auf jede h2 im Frame). Vorher kam nur
   die Schrift von hier, Versalien und Schatten aber weiter von dort —
   eine Ueberschrift, die nach keinem der beiden aussah. */
.festival-theme .frame .lift-titel,
.lift-titel {
    margin: 0;
    font-family: var(--fest-font-text, inherit) !important;
    font-size: var(--fest-step-2, 1.5rem) !important;
    font-weight: 700 !important;
    line-height: 1.2;
    letter-spacing: -0.01em !important;
    /* !important wie die Zeilen darueber: die Regel in Wasted.css
       kommt ueber :is()/:not() auf hoehere Spezifitaet als jede Klasse
       hier. */
    text-transform: none !important;
    text-shadow: none !important;
    color: var(--lift-ink);
}

.lift-unterzeile {
    max-width: var(--fest-mass, 68ch);
    margin: 0.35rem 0 0;
    color: var(--lift-muted);
}

/* Einzelansichten: Abstand zwischen Titelblock und Inhalt. */
.tx-orgadiy > .container:not(.lift-bereich) .lift-titel,
.tx-orgadiy > .container:not(.lift-bereich) .lift-unterzeile {
    margin-bottom: var(--lift-abstand);
}

.tx-orgadiy > .container:not(.lift-bereich) .lift-titel:has(+ .lift-unterzeile) {
    margin-bottom: 0;
}

/* Kopf einer Liste: Titel mit Anzahl und Unterzeile links, der Knopf
   zum Anlegen rechts daneben (mobil darunter). Vorher stand der Knopf
   unter der Liste — bei zwanzig Eintraegen also ausser Sicht. */
.lift-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--lift-abstand);
    margin-bottom: var(--lift-abstand);
    padding-bottom: var(--lift-abstand);
    border-bottom: 2px solid var(--lift-linie);
}

.lift-kopf__knopf {
    flex-shrink: 0;
}

.lift-anzahl {
    display: inline-block;
    min-width: 1.9em;
    margin-left: 0.35em;
    padding: 0.1em 0.55em;
    font-size: var(--lift-klein);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    letter-spacing: 0;
    text-align: center;
    vertical-align: 0.25em;
    color: var(--lift-ink);
    background: var(--lift-flaeche-leise);
    border: 1px solid var(--lift-linie);
    border-radius: 999px;
}

/* Leerzustand: ein Platzhalter in Kartenform, kein Text am Rand. */
.lift-leer {
    margin: 0;
    padding: var(--fest-space-m, 2rem) var(--lift-abstand);
    text-align: center;
    color: var(--lift-muted);
    border: 2px dashed var(--lift-linie);
    border-radius: var(--lift-radius);
}

.lift-hinweis {
    margin: 0;
    font-size: var(--lift-klein);
    text-align: center;
    color: var(--lift-muted);
}

/* --------------------------------------------------------------------------
   Liste als Kartenraster

   Tabelle, Kopf und Zellen geben ihr Tabellenverhalten ab; jede Zeile
   ist ein eigenes Raster. Die doppelte Klasse hebt die Spezifitaet
   ueber die Regeln von DataTables (table.dataTable > tbody > tr > td).
   -------------------------------------------------------------------------- */

.lift-liste.lift-liste {
    display: block;
    width: 100% !important;
    margin: 0;
    border: 0;
    border-collapse: separate;
}

.lift-liste.lift-liste > tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: var(--lift-abstand);
}

.lift-liste.lift-liste > tbody > tr.lift-karte {
    position: relative;
    display: grid;
    /* Links die schmalen Angaben (Richtung, Personen) in ihrer eigenen
       Breite, rechts der Rest buendig an der Kante. Kein Spaltenabstand,
       damit die Trennlinie ueber der Fusszeile durchlaeuft — den
       Abstand bringen die rechten Zellen selbst mit. */
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "richtung wann"
        "strecke  strecke"
        "notiz    notiz"
        "personen aktion";
    align-items: center;
    gap: 0.6rem 0;
    padding: var(--lift-abstand) calc(var(--lift-abstand) * 1.25);
    color: var(--lift-ink);
    background: var(--lift-flaeche);
    border: 1px solid var(--lift-linie);
    border-radius: var(--lift-radius);
    box-shadow: var(--lift-schatten);
    transition: border-color var(--lift-tempo) ease,
                box-shadow var(--lift-tempo) ease,
                transform var(--lift-tempo) ease;
}

.lift-liste.lift-liste > tbody > tr > td {
    display: block;
    padding: 0;
    text-align: left;
    background: none;
    border: 0;
    box-shadow: none;
}

/* Die ganze Karte ist der Link (stretched-link) — sie zeigt das beim
   Zeigen und beim Tastaturfokus. */
.lift-liste.lift-liste > tbody > tr.lift-karte:hover {
    border-color: color-mix(in srgb, var(--lift-akzent) 55%, transparent);
    box-shadow: var(--lift-schatten-hoch);
    transform: translateY(-2px);
}

.lift-liste.lift-liste > tbody > tr.lift-karte:has(.lift-karte__link:focus-visible) {
    outline: 3px solid var(--lift-primary);
    outline-offset: 2px;
}

.festival-theme .lift-karte__link:focus-visible,
.lift-karte__link:focus-visible {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .lift-liste.lift-liste > tbody > tr.lift-karte {
        transition: none;
    }

    .lift-liste.lift-liste > tbody > tr.lift-karte:hover {
        transform: none;
    }
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__richtung {
    grid-area: richtung;
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__wann {
    grid-area: wann;
    padding-left: 0.75rem;
    text-align: right;
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__strecke {
    grid-area: strecke;
    font-size: var(--fest-step-1, 1.2rem);
    font-weight: 700;
    line-height: 1.3;
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__notiz {
    grid-area: notiz;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: var(--lift-klein);
    color: var(--lift-muted);
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__notiz:empty {
    display: none;
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__personen {
    grid-area: personen;
    padding-top: 0.6rem;
    white-space: nowrap;
    border-top: 1px solid var(--lift-linie);
}

.lift-liste.lift-liste > tbody > tr > .lift-karte__aktion {
    grid-area: aktion;
    padding-top: 0.6rem;
    padding-left: 0.75rem;
    text-align: right;
    border-top: 1px solid var(--lift-linie);
}

.lift-karte__link {
    font-weight: 700;
    color: var(--lift-akzent);
    text-decoration: none;
}

.lift-karte:hover .lift-karte__link {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* "Keine passenden …" von DataTables kommt als eigene Zeile ohne
   .lift-karte und nimmt die ganze Breite. */
.lift-liste.lift-liste > tbody > tr:not(.lift-karte) {
    grid-column: 1 / -1;
}

.lift-liste.lift-liste > tbody > tr:not(.lift-karte) > td {
    padding: var(--fest-space-m, 2rem) var(--lift-abstand);
    text-align: center;
    color: var(--lift-muted);
    border: 2px dashed var(--lift-linie);
    border-radius: var(--lift-radius);
}

/* --------------------------------------------------------------------------
   Bausteine einer Fahrt (Karte, Detailansicht, Kontaktformular)
   -------------------------------------------------------------------------- */

.lift-strecke {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.4em;
    overflow-wrap: anywhere;
}

.lift-strecke__pfeil {
    font-weight: 400;
    color: var(--lift-akzent);
}

.lift-wann,
.lift-personen {
    font-size: var(--lift-klein);
    font-variant-numeric: tabular-nums;
}

.lift-wann {
    font-weight: 700;
    white-space: nowrap;
}

.lift-personen {
    color: var(--lift-muted);
}

/* Richtung als Plakette. Der Pfeil davor ist Deko (alt-Text leer), das
   Wort traegt die Aussage. Hinfahrt in der Markenfarbe, Rueckfahrt
   neutral gefuellt, beides nur umrandet — drei Formen, nicht nur drei
   Farben. */
.lift-richtung {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.15em 0.7em;
    font-size: var(--lift-klein);
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--lift-ink);
    border: 1px solid var(--lift-linie);
    border-radius: 999px;
}

.lift-richtung::before {
    content: "⇄" / "";
    font-weight: 400;
}

.lift-richtung--hin {
    color: var(--lift-akzent);
    background: color-mix(in srgb, var(--lift-primary) 14%, var(--lift-flaeche));
    border-color: color-mix(in srgb, var(--lift-primary) 45%, transparent);
}

.lift-richtung--hin::before {
    content: "→" / "";
}

.lift-richtung--zurueck {
    background: var(--lift-flaeche-leise);
}

.lift-richtung--zurueck::before {
    content: "←" / "";
}

/* --------------------------------------------------------------------------
   Detailansicht
   -------------------------------------------------------------------------- */

.lift-detail__kopf {
    margin-bottom: var(--lift-abstand);
    padding-bottom: var(--lift-abstand);
    border-bottom: 2px solid var(--lift-linie);
}

.lift-detail__typ {
    margin: 0 0 0.25rem;
    font-size: var(--lift-klein);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lift-akzent);
}

.tx-orgadiy > .container .lift-detail__strecke.lift-titel {
    margin-bottom: 0.75rem;
}

.lift-detail__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.lift-detail__label {
    margin: 0 0 0.25rem;
    font-family: var(--fest-font-text, inherit);
    font-size: var(--lift-klein) !important;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lift-muted);
}

.lift-detail__notiz {
    max-width: var(--fest-mass, 68ch);
}

/* --------------------------------------------------------------------------
   Formulare
   -------------------------------------------------------------------------- */

/* Zwei Gruppen (Fahrt, Kontakt) mit kleiner Zwischenueberschrift und
   Linie dazwischen — dieselbe Form wie die Zwischentexte im
   EXT:form-Formular (festival.css, Abschnitt 15). */
/* Die Linie haengt an der legend, nicht am fieldset: eine legend sitzt
   sonst mitten in der Rahmenlinie ihres fieldsets und unterbricht sie. */
.lift-gruppe {
    min-width: 0;
    margin: 0 0 var(--lift-abstand);
    padding: 0;
    border: 0;
}

.lift-gruppe__titel {
    float: none;
    display: block;
    width: 100%;
    margin: 0 0 0.75rem;
    padding: var(--lift-abstand) 0 0;
    border-top: 2px solid var(--lift-linie);
    font-size: var(--fest-step-1, 1.2rem);
    font-weight: 700;
    line-height: 1.3;
    color: var(--lift-ink);
}

.lift-gruppe__hinweis {
    max-width: var(--fest-mass, 68ch);
    margin: -0.4rem 0 var(--lift-abstand);
    font-size: var(--lift-klein);
    color: var(--lift-muted);
}

.lift-festival {
    min-height: 48px;
    font-weight: 700;
    color: var(--lift-ink);
}

/* Richtung als Umschalter: drei gleich breite Felder, die Radios
   darunter bleiben echte Radios (Pfeiltasten, Formularwert) und sind
   nur unsichtbar. Auswahl in der Markenflaeche, Fokus als Ring. */
.lift-wahl {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 2px solid var(--lift-linie);
    border-radius: var(--lift-radius-s);
    overflow: hidden;
}

.lift-wahl__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.lift-wahl__option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin: 0;
    padding: 0.4rem 0.5rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
    color: var(--lift-ink);
    background: var(--lift-flaeche);
    cursor: pointer;
    transition: background-color var(--lift-tempo) ease,
                color var(--lift-tempo) ease;
}

.lift-wahl__option + .lift-wahl__input + .lift-wahl__option {
    border-left: 2px solid var(--lift-linie);
}

.lift-wahl__option:hover {
    background: var(--lift-flaeche-leise);
}

.lift-wahl__input:checked + .lift-wahl__option {
    color: var(--lift-on-primary);
    background: var(--lift-primary);
}

.lift-wahl__input:focus-visible + .lift-wahl__option {
    position: relative;
    outline: 3px solid var(--lift-primary);
    outline-offset: -5px;
    box-shadow: inset 0 0 0 5px var(--lift-flaeche);
}

.lift-wahl__input:checked:focus-visible + .lift-wahl__option {
    outline-color: var(--lift-on-primary);
    box-shadow: inset 0 0 0 5px var(--lift-primary);
}

@media (prefers-reduced-motion: reduce) {
    .lift-wahl__option {
        transition: none;
    }
}

.frame-type-clubs_fe_lift altcha-widget {
    display: block;
    margin: var(--lift-abstand) 0;
    --altcha-border-width: 2px;
    --altcha-border-radius: var(--lift-radius-s);
    --altcha-color-border: var(--lift-linie);
    --altcha-color-text: var(--lift-ink);
    --altcha-color-base: var(--lift-flaeche);
}

/* --------------------------------------------------------------------------
   DataTables: Filter, Laenge, Blaettern

   Erst ab elf Eintraegen sichtbar (table.js). Filterfeld links mit
   Beschriftung darueber wie jedes andere Feld, Laengenauswahl rechts;
   unten Zaehler und Blaettern auf einer Linie.
   ---------------------------------------------------------------------- */

.lift-filter,
.lift-fuss {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--lift-abstand);
}

.lift-filter {
    margin-bottom: var(--lift-abstand);
}

.lift-fuss {
    align-items: center;
    margin-top: var(--lift-abstand);
}

.lift-filter .dt-search {
    display: flex;
    flex: 1 1 18rem;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 28rem;
}

.lift-filter .dt-search label {
    font-weight: 700;
    color: var(--lift-ink);
}

.lift-filter .dt-search .dt-input {
    width: 100%;
    margin: 0;
}

.lift-filter .dt-length {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--lift-muted);
}

.lift-filter .dt-length .form-select {
    width: auto;
    display: inline-block;
}

.lift-fuss .dt-info {
    font-size: var(--lift-klein);
    color: var(--lift-muted);
}

/* Bootstrap liefert die Paginierung ueber --bs-pagination-*, also wird
   hier die Variable gesetzt und nicht die Regel von DataTables
   ueberschrieben — sonst sitzt ein blauer Blaetter-Knopf zwischen
   Markenfarben. */
.frame-type-clubs_fe_lift .pagination {
    --bs-pagination-color: var(--lift-akzent);
    --bs-pagination-bg: var(--lift-flaeche);
    --bs-pagination-border-color: var(--lift-linie);
    --bs-pagination-hover-color: var(--lift-akzent);
    --bs-pagination-hover-bg: var(--lift-flaeche-leise);
    --bs-pagination-hover-border-color: var(--lift-linie);
    --bs-pagination-focus-color: var(--lift-akzent);
    --bs-pagination-focus-bg: var(--lift-flaeche-leise);
    --bs-pagination-active-color: var(--lift-on-primary);
    --bs-pagination-active-bg: var(--lift-primary);
    --bs-pagination-active-border-color: var(--lift-primary);
    --bs-pagination-disabled-color: var(--lift-muted);
    --bs-pagination-disabled-bg: var(--lift-flaeche);
    --bs-pagination-disabled-border-color: var(--lift-linie);
    flex-wrap: wrap;
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Mobil: Knoepfe im Kopf und unter den Formularen ueber die volle
   Breite, die Richtungswahl bleibt dreiteilig.
   -------------------------------------------------------------------------- */

@media (max-width: 575.98px) {
    .lift-kopf__knopf {
        width: 100%;
    }

    .frame-type-clubs_fe_lift .tx-orgadiy > .container:not(.lift-bereich) {
        padding-inline: var(--lift-abstand);
    }

    .lift-wahl__option {
        font-size: var(--lift-klein);
    }
}
