/* ============================================================
   TS Events — twoseconds GmbH
   Naming: BEM  (.ts-events__element--modifier)
   Theming: CSS custom properties per brand modifier class
   ============================================================ */

@font-face {
    font-family: "Verveine";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/verveineregular.ttf") format("truetype");
}

/* ── Design tokens (default / no brand) ─────────────────── */
.ts-events {
    --tse-brand:       #719430;
    --tse-pill:        #719430;
    --tse-pill-hover:  #5c7a27;
    --tse-lime:        #c8e641;
    --tse-white:       #ffffff;
    --tse-card-odd:    #ffffff;
    --tse-card-even:   #c8e641;
    --tse-heading:     #c7047d;
    --tse-radius-card: 20px;
    --tse-radius-pill: 50px;
    --tse-gap:         8px;
    --tse-card-width:  320px;
    --tse-font-body:   sans-serif;
    --tse-font-display:"snaga-unicase-display", sans-serif;
}

/* Brand modifier tokens */
.ts-events--maedchenklamotte { --tse-pill: #FF3E1A; --tse-pill-hover: #e0341a; --tse-heading: #D40075; }
.ts-events--fellnase         { --tse-pill: #719430; --tse-pill-hover: #5c7a27; --tse-heading: #719430; }
.ts-events--mamimini         { --tse-pill: #7a2583; --tse-pill-hover: #61206a; --tse-heading: #7a2583; }
.ts-events--ddflohmarkt      { --tse-pill: #ec6327; --tse-pill-hover: #d4571f; --tse-heading: #ec6327; }

/* Special-class overrides (applied per pill by JS) */
.ts-events .ts-event__pill--special-turkois { --tse-pill: #80c7be; --tse-pill-hover: #6ab3aa; }
.ts-events .ts-event__pill--special-violet  { --tse-pill: #792583; --tse-pill-hover: #61206a; }

/* ── Base ───────────────────────────────────────────────── */
.ts-events,
.ts-events *,
.ts-events *::before,
.ts-events *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.ts-events {
    font-family: var(--tse-font-body);
    font-size: 15px;
    line-height: 1.5;
    width: 100%;
    color: #111;
}

/* ── ZIP filter (standalone shortcode) ──────────────────── */
.ts-events-filter {
    display: block;
}

.ts-events-filter__input {
    display: block;
    width: 100%;
    max-width: 340px;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--tse-radius-pill, 50px);
    padding: 12px 24px;
    font-family: var(--tse-font-body);
    font-size: 15px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    /* remove browser search input decorations */
    -webkit-appearance: none;
    appearance: none;
}

.ts-events-filter__input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.ts-events-filter__input:focus {
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.26);
}

/* ── Event container — 3-column grid ────────────────────── */
.ts-events__container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 1100px) {
    .ts-events__container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .ts-events__container { grid-template-columns: 1fr; }
}

.ts-events__container::-webkit-scrollbar        { height: 4px; }
.ts-events__container::-webkit-scrollbar-track  { background: transparent; }
.ts-events__container::-webkit-scrollbar-thumb  { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* ── Loading dots ───────────────────────────────────────── */
.ts-events__loading {
    display: flex;
    gap: 6px;
    padding: 24px 0;
}

.ts-events__loading span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    animation: tse-pulse 1.2s ease-in-out infinite;
}

.ts-events__loading span:nth-child(2) { animation-delay: 0.2s; }
.ts-events__loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tse-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
    40%            { opacity: 1;   transform: scale(1); }
}

/* ── Month column card ──────────────────────────────────── */
.ts-events__month {
    flex: 0 0 var(--tse-card-width);
    min-width: 260px;
    border-radius: var(--tse-radius-card);
    padding: 24px 20px;
    background: var(--tse-card-odd);
}

.ts-events__month:nth-child(even) {
    background: var(--tse-card-even);
}

/* Month heading */
.ts-events__month-title {
    font-family: var(--tse-font-display);
    font-size: clamp(36px, 4vw, 52px);
    font-weight: 700;
    line-height: 1;
    color: var(--tse-heading);
    text-transform: none;
    margin-bottom: 16px;
    letter-spacing: 0.01em;
}

/* Event list inside a month */
.ts-events__list {
    display: flex;
    flex-direction: column;
    gap: var(--tse-gap);
}

/* ── Single event ───────────────────────────────────────── */
.ts-event {
    /* wrapper: pill + expandable details */
}

/* The pill button */
.ts-event__pill {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: var(--tse-pill);
    border: none;
    border-radius: var(--tse-radius-pill);
    padding: 7px 16px 7px 7px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, opacity 0.2s;
}

.ts-event__pill:hover {
    background: var(--tse-pill-hover);
}

.ts-event__pill:focus-visible {
    outline: 3px solid var(--tse-lime);
    outline-offset: 2px;
}

/* Date badge — circle on the left */
.ts-event__date {
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ts-event__day-abbr {
    font-family: var(--tse-font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--tse-white);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.ts-event__day-num {
    font-family: var(--tse-font-body);
    font-size: 26px;
    font-weight: 800;
    color: var(--tse-lime);
    line-height: 1;
}

/* Market info — centre */
.ts-event__info {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ts-event__name {
    display: block;
    font-family: var(--tse-font-body);
    font-size: 18px;
    font-weight: 700;
    color: var(--tse-white);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-event__sold-out {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.85;
}

.ts-event__city {
    display: block;
    font-family: var(--tse-font-body);
    font-size: 18px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chevron — right */
.ts-event__chevron {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--tse-lime);
    transition: transform 0.25s ease;
    pointer-events: none;
}

.ts-event--open .ts-event__chevron {
    transform: rotate(180deg);
}

.ts-event__pill[aria-expanded="true"] {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.ts-event__pill[aria-expanded="true"] .ts-event__date {
    background: transparent;
}

/* ── Expanded details panel ─────────────────────────────── */
.ts-event__details {
    background: var(--tse-white);
    border: 1px solid rgba(0,0,0,0.08);
    border-top: none;
    border-radius: 0 0 14px 14px;
    padding: 14px;
    margin-top: -6px;
}

.ts-event__details[hidden] {
    display: none;
}

.ts-event__details-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Info block (description / time / location) */
.ts-event__block {
    display: block;
    background: #fdeff4;
    border-radius: 10px;
    padding: 14px;
}

.ts-event__block-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #333;
    margin-top: 1px;
}

.ts-event__block-body {
    flex: 1;
    min-width: 0;
}

.ts-event__block-title {
    font-family: var(--tse-font-body);
    font-size: 17px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 5px;
}

.ts-event__block-text {
    font-family: var(--tse-font-body);
    font-size: 17px;
    color: #555;
    line-height: 1.55;
}

.ts-event__block-text a {
    color: var(--tse-pill);
    text-decoration: none;
}

.ts-event__block-text a:hover {
    text-decoration: underline;
}

/* Two-column row for time + location */
.ts-event__block-row {
    display: flex;
    gap: 10px;
}

.ts-event__block-row .ts-event__block {
    flex: 1 1 0;
    min-width: 0;
}

/* Collapsible description */
.ts-event__desc-content {
    position: relative;
    max-height: 120px;
    overflow: hidden;
    white-space: pre-wrap;
    transition: max-height 0.3s ease;
}

.ts-event__desc-content::after {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: linear-gradient(to top, #fdeff4 20%, transparent);
    pointer-events: none;
    transition: opacity 0.2s;
}

.ts-event__desc-content--expanded {
    max-height: 2000px;
}

.ts-event__desc-content--expanded::after {
    opacity: 0;
    pointer-events: none;
}

.ts-event__toggle-desc {
    font-family: var(--tse-font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--tse-white);
    background: var(--tse-pill);
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
    transition: background 0.2s;
}

.ts-event__toggle-desc:hover {
    background: var(--tse-pill-hover);
}

/* File downloads */
.ts-event__files {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.ts-event__file-link {
    font-family: var(--tse-font-body);
    font-size: 13px;
    color: var(--tse-pill);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ts-event__file-link:hover {
    text-decoration: underline;
}

/* ── Empty / error / no-results states ──────────────────── */
.ts-events__message {
    font-family: var(--tse-font-body);
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    padding: 16px 0;
}

.ts-events__no-results {
    font-family: var(--tse-font-body);
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    padding: 16px 0;
    display: none;
}

.ts-events__no-results--visible {
    display: block;
}

/* ── Future month cards — soft-pink pills, pink text ────── */
/* Odd = white card: soft-pink pill. Even = lime card: white pill.
   Direct background override (not via --tse-pill) so the brand token stays
   intact for details-panel elements: toggle-desc, file links, map link. */
.ts-events__month--future:nth-child(odd) .ts-event__pill:not([class*="pill--special"]) {
    background: rgba(212, 0, 117, 0.07);
    border: 1px solid rgba(212, 0, 117, 0.18);
    box-shadow: none;
}
.ts-events__month--future:nth-child(odd) .ts-event__pill:not([class*="pill--special"]):hover {
    background: rgba(212, 0, 117, 0.13);
    opacity: 1;
}

.ts-events__month--future:nth-child(even) .ts-event__pill:not([class*="pill--special"]) {
    background: #ffffff;
    border: 1px solid rgba(212, 0, 117, 0.18);
    box-shadow: none;
}
.ts-events__month--future:nth-child(even) .ts-event__pill:not([class*="pill--special"]):hover {
    background: #f7f7f7;
    opacity: 1;
}

.ts-events__month--future .ts-event__pill:not([class*="pill--special"]) .ts-event__date {
    background: rgba(212, 0, 117, 0.1);
}

.ts-events__month--future .ts-event__pill:not([class*="pill--special"]) .ts-event__day-abbr {
    color: #D40075;
}

.ts-events__month--future .ts-event__pill:not([class*="pill--special"]) .ts-event__day-num {
    color: #FF3E1A;
}

.ts-events__month--future .ts-event__pill:not([class*="pill--special"]) .ts-event__name {
    color: #D40075;
}

.ts-events__month--future .ts-event__pill:not([class*="pill--special"]) .ts-event__city {
    color: rgba(212, 0, 117, 0.65);
}

.ts-events__month--future .ts-event__pill:not([class*="pill--special"]) .ts-event__chevron {
    color: #FF3E1A;
}

/* ── Load more button ───────────────────────────────────── */
.ts-events__load-more {
    display: block;
    width: 100%;
    background: transparent;
    border: 2px solid var(--tse-pill, #FF3E1A);
    border-radius: 50px;
    color: var(--tse-pill, #FF3E1A);
    font-family: var(--tse-font-body);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    cursor: pointer;
    margin-top: 10px;
    text-align: center;
    letter-spacing: 0.02em;
    transition: background 0.2s, color 0.2s;
}

.ts-events__load-more:hover {
    background: var(--tse-pill, #FF3E1A);
    color: #fff;
}

/* Future month load more uses D40075 */
.ts-events__month--future .ts-events__load-more {
    border-color: #D40075;
    color: #D40075;
}

.ts-events__month--future .ts-events__load-more:hover {
    background: #D40075;
    color: #fff;
}

/* ── Grid: load more months button ──────────────────────── */
.ts-events__month-load-more {
    display: block;
    width: 100%;
    background: transparent;
    border: 2px solid var(--tse-pill, #FF3E1A);
    border-radius: 50px;
    color: var(--tse-pill, #FF3E1A);
    font-family: var(--tse-font-body);
    font-size: 14px;
    font-weight: 700;
    padding: 14px 24px;
    cursor: pointer;
    margin-top: 24px;
    text-align: center;
    letter-spacing: 0.02em;
    transition: background 0.2s, color 0.2s;
}

.ts-events__month-load-more:hover {
    background: var(--tse-pill, #FF3E1A);
    color: #fff;
}

.ts-events--btn-white .ts-events__month-load-more {
    border-color: #fff;
    color: #fff;
}

.ts-events--btn-white .ts-events__month-load-more:hover {
    background: #fff;
    color: #111;
}

/* ── Hidden events (load more) ──────────────────────────── */
.ts-event--hidden {
    display: none;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 767px) {
    .ts-events__container {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .ts-events__month {
        flex: 0 0 100%;
        min-width: 0;
    }

    .ts-event__block-row {
        flex-direction: column;
    }

    .ts-events-filter__input {
        max-width: 100%;
    }

    .ts-event__name { font-size: 15px; white-space: normal; overflow: visible; text-overflow: clip; }
    .ts-event__city { font-size: 14px; }
}

/* ============================================================
   [ts_termine] — Full section shortcode
   Usage: [ts_termine type="maedchenklamotte" months="3"
            heading="unsere Termine" subtext="..." bg="#c7047d"]
   ============================================================ */

.ts-termine {
    --ts-termine-bg: #d40075;
    background-color: var(--ts-termine-bg);
    width: 100%;
    padding: 72px 0vw 72px 6vw;
    overflow: visible !important;
    box-sizing: border-box;
}

.ts-termine__inner {
    display: flex;
    align-items: center;
    gap: 48px;
    width: 100%;
}

/* ── Left column ────────────────────────────────────────── */
.ts-termine__left {
    flex: 0 0 300px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ts-termine__heading {
    font-family: "snaga-unicase-display", sans-serif;
    font-size: clamp(32px, 3.6vw, 54px);
    font-weight: 700;
    color: #fff;
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.ts-termine__subtext {
    font-size: 15px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.6;
    margin: 0;
}

/* Filter input inherits .ts-events-filter__input styles,
   just constrain width inside the left column */
.ts-termine__filter .ts-events-filter__input {
    width: 100%;
    max-width: 300px;
}

/* ── Right column — events (Swiper carousel) ────────────── */
.ts-termine__right {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    margin-right: -150px;
}

/* Carousel — CSS Grid with auto columns + scroll-snap */
.ts-termine__right .ts-events__container {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-auto-columns: calc(50% - 10px);
    gap: 20px;

    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-x: contain;

    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;

    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: nowrap !important;

    box-sizing: border-box;
    padding: 0 !important;
    touch-action: pan-x pan-y;
}

.ts-termine__right .ts-events__container::-webkit-scrollbar {
    height: 6px;
}
.ts-termine__right .ts-events__container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.ts-termine__right .ts-events__month {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    min-width: 0 !important;
    height: auto;
    box-sizing: border-box;
    scroll-snap-align: start;
}

/* Trailing spacer so the last card can snap to the left edge */
.ts-termine__right .ts-events__container::after {
    content: '';
    display: block;
    width: calc(50% - 10px);
    flex-shrink: 0;
}

/* Last slide active — restore section padding & right bleed */
@media (min-width: 901px) {
    .ts-termine {
        transition: padding 0.35s ease;
    }
    .ts-termine__right {
        transition: margin-right 0.35s ease;
    }
    .ts-termine--last-visible {
        padding-right: 6vw;
    }
    .ts-termine--last-visible .ts-termine__right {
        margin-right: 0;
    }
}

/* ── Scroll dots ─────────────────────────────────────────── */
/* Sits inside .ts-termine__right, centered below the carousel */
.ts-termine__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 6px 0 0;
    width: 100%;
    box-sizing: border-box;
}

/* Button is the 44×44 touch target; ::after is the visual dot */
.ts-termine__dot {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-termine__dot::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transition: background 0.25s, width 0.25s, border-radius 0.25s;
}

.ts-termine__dot--active::after {
    width: 24px;
    background: #ffffff;
    border-radius: 4px;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .ts-termine {
        padding: 56px 24px;
        overflow: hidden !important;
    }

    .ts-termine__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 36px;
    }

    .ts-termine__left {
        flex: none;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .ts-termine__filter .ts-events-filter__input {
        max-width: 100%;
    }

    .ts-termine__right {
        width: 100%;
        overflow: visible;
    }

    /* Mobile: one full card per view */
    .ts-termine__right .ts-events__container {
        grid-auto-columns: 100% !important;
    }

    /* No trailing spacer needed on mobile */
    .ts-termine__right .ts-events__container::after {
        display: none;
    }
}