/**
 * Termine Section ContentBlock (bruchwerk_terminesection)
 * Refactored from inline styles (Phase 7C-D).
 * Contains the Pretix events list AND the Pretix-error/no-events fallback.
 * Mobile-first; desktop variants via media query.
 */

.termine-section {
    position: relative;
    border-top: 1px solid rgba(14, 14, 16, 0.18);
}

.termine-section__wrap {
    padding-top: 64px;
    padding-bottom: 56px;
}

/* --- Section header --- */
.termine-section__head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: end;
    margin-bottom: 40px;
}

.termine-section__headline {
    font-size: clamp(40px, 12vw, 96px);
    margin: 12px 0 0;
}

.termine-section__side-right {
    text-align: left;
}

.termine-section__description {
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #4a4a42;
    max-width: 420px;
    margin: 0;
}

.termine-section__btnrow {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* --- Meta strip (column headers above ticket rows) --- */
.termine-section__meta-strip {
    display: none;
    grid-template-columns: 180px 1fr 220px;
    border-top: 2px solid var(--bg);
    border-bottom: 1px solid rgba(14, 14, 16, 0.25);
    margin-bottom: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4a4a42;
}

.termine-section__meta-cell {
    padding: 10px 24px;
}

.termine-section__meta-cell--mid {
    padding: 10px 32px;
}

.termine-section__meta-cell--right {
    padding: 10px 24px;
    text-align: right;
}

/* --- Ticket list --- */
.termine-section__list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.termine-section__row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 72px;
    border: 1px solid rgba(14, 14, 16, 0.25);
    position: relative;
}

.termine-section__row > * {
    min-width: 0;
}

.termine-section__row-left {
    padding: 16px 6px;
    background: rgba(14, 14, 16, 0.04);
    border-right: 1px dashed rgba(14, 14, 16, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* One event per compact horizontal row, not three stacked ticket panels. */
.termine-section__row-weekday,
.termine-section__row-tagline,
.termine-section__row-location,
.termine-section__ticket-label--wide {
    display: none;
}

.termine-section__row-day {
    font-size: 32px;
    line-height: 1;
}

.termine-section__row-month {
    font-size: 13px;
    letter-spacing: 0;
}

.termine-section__row-weekday {
    font-size: 11px;
    letter-spacing: 0.14em;
    color: #6a6a60;
    margin-top: 8px;
}

.termine-section__row-mid {
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.termine-section__row-tagline {
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.termine-section__row-tag {
    border-color: currentColor;
}

.termine-section__row-title {
    font-size: clamp(18px, 4vw, 28px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

/* Genre chips of the production page: visible at every width, they wrap and stay below the row-wide ticket link.
   Compact spacing like the row buttons on the phone, so two usual chips share one line. */
.termine-section__row-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.termine-section__row-genre {
    max-width: 100%;
    padding: 3px 6px;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.termine-section__row-location {
    font-size: 12px;
    color: #6a6a60;
}

.termine-section__row-right {
    padding: 12px 4px;
    border-left: 1px dashed rgba(14, 14, 16, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.termine-section__row .row-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 5px;
    font-size: 10px;
    letter-spacing: 0;
    gap: 3px;
}

.termine-section__row .row-btn > [aria-hidden] {
    display: none;
}

/* Infos sits above the row-wide ticket link as the secondary action. */
.termine-section__row-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.termine-section__row .termine-section__info-btn {
    position: relative;
    z-index: 2;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 10px 5px;
    font-size: 10px;
    letter-spacing: 0;
}

.termine-section__row-time-wrap {
    text-align: center;
}

.termine-section__row-time-label {
    font-size: 9px;
    letter-spacing: 0.02em;
    color: #6a6a60;
}

.termine-section__row-time {
    font-size: 24px;
    line-height: 1;
}

/* --- Footer (after the ticket list) --- */
.termine-section__list-footer {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.termine-section__footer-text {
    font-size: 11px;
    letter-spacing: 0.14em;
    color: #6a6a60;
    text-transform: uppercase;
    margin: 0;
}

/* --- Fallback (Pretix unreachable / no events) --- */
.termine-section__fallback {
    border: 1px dashed rgba(14, 14, 16, 0.35);
    padding: 40px 20px;
    text-align: center;
    background: rgba(14, 14, 16, 0.03);
}

.termine-section__fallback-status {
    font-size: 11px;
    letter-spacing: 0.22em;
    color: #6a6a60;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.termine-section__fallback-text {
    font-size: clamp(20px, 5vw, 28px);
    line-height: 1.25;
    margin: 0 auto;
    max-width: 640px;
}

.termine-section__fallback-cta {
    margin-top: 24px;
}

/* --- Desktop --- */
@media (min-width: 961px) {
    .termine-section__head {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }

    .termine-section__side-right {
        text-align: right;
    }

    .termine-section__description {
        margin-left: auto;
    }

    .termine-section__btnrow {
        justify-content: flex-end;
    }

    .termine-section__meta-strip {
        display: grid;
    }

    .termine-section__row {
        grid-template-columns: 180px minmax(0, 1fr) 220px;
    }

    .termine-section__row-weekday,
    .termine-section__row-location {
        display: block;
    }

    .termine-section__row-tagline { display: flex; }
    .termine-section__row-genre {
        padding: 4px 10px;
        letter-spacing: .18em;
    }
    .termine-section__ticket-label--wide,
    .termine-section__row .row-btn > [aria-hidden] { display: inline; }
    .termine-section__ticket-label--compact { display: none; }

    .termine-section__row .row-btn,
    .termine-section__row .termine-section__info-btn {
        padding: 14px 22px;
        font-size: 12px;
        letter-spacing: .18em;
        gap: 10px;
    }

    .termine-section__row-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .termine-section__row-left {
        padding: 28px 24px;
        border-right: 1px dashed rgba(14, 14, 16, 0.35);
        border-bottom: 0;
    }

    .termine-section__row-day {
        font-size: 64px;
    }

    .termine-section__row-month {
        font-size: 20px;
    }

    .termine-section__row-mid {
        padding: 28px 32px;
    }

    .termine-section__row-title {
        font-size: 36px;
    }

    .termine-section__row-right {
        padding: 28px 24px;
        border-left: 1px dashed rgba(14, 14, 16, 0.35);
        border-top: 0;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-end;
    }

    .termine-section__row-time-wrap {
        text-align: right;
    }

    .termine-section__row-time {
        font-size: 48px;
    }

    .termine-section__fallback {
        padding: 48px 32px;
    }

    .termine-section__fallback-text {
        font-size: clamp(22px, 2.4vw, 32px);
    }
}
