/* ==========================================================================
   Variationsauswahl „Ausführung" (22.09.2026) — inc/class-variation-select.php
   Teil A: .ac-var--fabric (Desktop-Carousel 42b, mobil Feld 42e + Sheet 43c)
   Teil B: .ac-var--list   (Feld 45c/46a, Desktop-Dropdown, mobil Sheet)
   Font monument_grotesk 300/400/500, Serif nur Sheet-Titel. Highlight #fff8c1.
   ========================================================================== */

.ac-var {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 6px 0 16px; /* unten = Abstand Materialmuster-Karte → Warenkorb-Button (16px), damit alle Blöcke gleich weit auseinander sitzen */
    font-family: "monument_grotesk", sans-serif;
    font-weight: 400;
    color: #000;
    box-sizing: border-box;
}
.ac-var *, .ac-var *::before, .ac-var *::after { box-sizing: border-box; }
.ac-var :where(button) { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; box-shadow: none; line-height: 1.3; text-transform: none; letter-spacing: normal; }
.ac-var__native { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.ac-var__native select { pointer-events: none; }

/* Tabellenlabel/Reset der WooCommerce-Variationstabelle bei unserem Block ausblenden */
.woocommerce div.product table.variations tr:has(.ac-var) th.label,
.woocommerce div.product table.variations tr:has(.ac-var) a.reset_variations { display: none !important; }
/* Tabelle als Block: sonst weitet die Zelle sich auf die Kachelreihe aus und das Carousel scrollt nicht */
.woocommerce div.product table.variations:has(.ac-var),
.woocommerce div.product table.variations:has(.ac-var) > tbody,
.woocommerce div.product table.variations:has(.ac-var) > tbody > tr,
.woocommerce div.product table.variations:has(.ac-var) td.value { display: block; width: 100%; min-width: 0; padding: 0 !important; margin: 0; border: 0; }
.woocommerce div.product table.variations:has(.ac-var) + .reset_variations_alert { display: none; }
.ac-var__track, .ac-var__carousel, .ac-var__desktop { min-width: 0; width: 100%; }
.sticky-cart-form .ac-var { display: none; }
/* Materialmuster-Karte bringt eigene 18px oben mit – nach unserem Block nur unser Abstand zählen */
.variations_form:has(.ac-var) .ac-swatch-cta { margin-top: 0 !important; }

/* ── Kopfzeile (42b) ── */
.ac-var__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ac-var__label { font-size: 1rem; font-weight: 400; } /* wie Lieferzeit-Zeile (p.custom-lead-time = 1rem) */
.ac-var__current { font-weight: 500; }
.ac-var__short { font-size: 13px; color: #8f8f8f; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Carousel (42b) ── */
.ac-var__carousel { position: relative; margin-top: 8px; }
.ac-var__track {
    display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden;
    padding: 5px 72px 5px 5px; margin-left: -5px; /* rechts: Platz unter Fade + Pfeil, damit die letzte Kachel frei anklickbar wird */
    scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none;
}
.ac-var__track::-webkit-scrollbar { display: none; }
.ac-var__tile {
    flex: none; width: 56px; height: 56px; border-radius: 8px;
    background-color: #e6e3dd; background-size: cover; background-position: center;
    outline: 2px solid transparent; outline-offset: 3px;
    transition: outline-color .15s ease;
}
.ac-var__tile.is-selected { outline-color: #000; }
.ac-var__tile:focus-visible { outline-color: #000; }
.ac-var__tile.is-unavailable { opacity: .35; cursor: default; }
.ac-var__fade {
    position: absolute; top: 0; right: 0; bottom: 0; width: 72px; pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,0), #fff 70%);
}
.ac-var__next {
    position: absolute; top: 50%; right: 0; transform: translateY(-50%);
    width: 36px; height: 36px; border-radius: 50%; background: #000; color: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s ease, opacity .15s ease;
}
.ac-var__next .las { font-size: 16px; line-height: 1; }
.ac-var:not(.has-overflow) .ac-var__fade, .ac-var:not(.has-overflow) .ac-var__next { display: none; }
.ac-var.is-at-end .ac-var__next { transform: translateY(-50%) rotate(180deg); } /* am Ende: zurück */
.ac-var.is-at-end .ac-var__fade { opacity: 0; } /* am Ende nichts mehr abdecken */

/* ── Auswahlfeld (42e / 45c / 46a) ── */
.ac-var__field {
    width: 100%; min-height: 44px;
    border: 1px solid rgba(0,0,0,.14); border-radius: 10px;
    padding: 12px 16px; display: flex; align-items: center; gap: 14px;
    background: #fff; transition: border-color .15s ease;
    position: relative; z-index: 11;
}
.ac-var__field--fabric { padding: 12px 14px; }
.ac-var__field:hover, .ac-var.is-open .ac-var__field { border-color: #000; }
.ac-var__field-tile { flex: none; width: 44px; height: 44px; border-radius: 10px; background-color: #e6e3dd; background-size: cover; background-position: center; }
.ac-var__field-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ac-var__field-label { font-size: 12px; color: #8f8f8f; text-transform: uppercase; letter-spacing: .05em; }
.ac-var__field-name { font-size: 1rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-var__stack { display: flex; align-items: center; flex: none; }
.ac-var__dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #fff; background-color: #e6e3dd; background-size: cover; background-position: center; margin-left: -6px; }
.ac-var__dot:first-child { margin-left: 0; }
.ac-var__more { font-size: 11px; color: #8f8f8f; margin-left: 6px; }
.ac-var__count { font-size: 12px; color: #8f8f8f; flex: none; }
.ac-var__chevron { font-size: 18px; line-height: 1; flex: none; transition: transform .2s ease; }
.ac-var.is-open .ac-var__chevron { transform: rotate(180deg); }

/* ── Radio-Liste (Teil B) ── */
.ac-var__list { display: flex; flex-direction: column; }
.ac-var__row {
    display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%;
    border-radius: 0 !important; /* Theme-Buttons sind Pills – Listenzeilen nicht */
    transition: background-color .15s ease;
}
.ac-var__row + .ac-var__row { border-top: 1px solid rgba(0,0,0,.08); }
.ac-var__row.is-selected { background: #fff8c1; }
.ac-var__row:focus-visible { outline: 2px solid #000; outline-offset: -2px; }
.ac-var__row.is-unavailable { opacity: .4; cursor: default; }
.ac-var__radio { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #8f8f8f; background: #fff; }
.ac-var__row.is-selected .ac-var__radio { border: 6px solid #000; }
.ac-var__row-name { flex: 1; font-size: 15px; }
.ac-var__row.is-selected .ac-var__row-name { font-weight: 500; }
.ac-var__row-price { font-size: 13px; color: #8f8f8f; white-space: nowrap; }

/* ── Sheet (43c / 45c) ── */
/* z-index unter dem Grain-Overlay (.grain-overlay = 9999): die Körnung liegt immer über allem */
.ac-var__overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9990; }
.ac-var__sheet, .ac-var__panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9991;
    background: #fff; border-radius: 20px 20px 0 0; padding: 14px 0 24px;
    max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.ac-var__grip { display: block; width: 36px; height: 4px; border-radius: 2px; background: #dcdad5; margin: 0 auto 14px; }
.ac-var__sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 14px; border-bottom: 1px solid rgba(0,0,0,.08); }
.ac-var__sheet-title { font-family: 'SourceSerif4', serif; font-weight: 400; font-size: 20px; margin: 0; line-height: 1.2; }
/* Close wie beim Warenkorb-/Sprach-Panel (.button-close): ohne Fläche, Kreis-X-Icon 39 px */
.ac-var__close { width: 40px; height: 40px; margin: -8px -8px -8px 0; display: flex; align-items: center; justify-content: center; background: none; color: #000; }
.ac-var__close .las { font-size: 39px; line-height: 1; }
.ac-var__preview {
    position: relative; margin: 16px 20px 0; height: 200px; border-radius: 14px; overflow: hidden;
    background-color: #e6e3dd; background-size: cover; background-position: center;
    display: flex; align-items: flex-end; justify-content: space-between; padding: 14px 16px; gap: 12px;
}
.ac-var__preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.28)); pointer-events: none; }
.ac-var__preview-name, .ac-var__preview-material { position: relative; color: #fff; }
.ac-var__preview-name { font-size: 16px; font-weight: 500; }
.ac-var__preview-material { font-size: 12px; color: rgba(255,255,255,.75); }
.ac-var__preview.is-light::before { display: none; }
.ac-var__preview.is-light .ac-var__preview-name { color: #000; }
.ac-var__preview.is-light .ac-var__preview-material { color: rgba(0,0,0,.6); }
.ac-var__grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px 0; }
.ac-var__tile--sheet { width: 48px; height: 48px; border-radius: 10px; outline-width: 1.5px; }
.ac-var__long { font-size: 13.5px; line-height: 1.45; color: #4a4a4a; padding: 16px 20px 0; margin: 0; }
.ac-var__long:empty { display: none; }
.ac-var__apply {
    display: block; width: calc(100% - 40px); margin: 14px 20px 0; height: 54px;
    background: #000; color: #fff; border-radius: 30px; font-size: 15px; font-weight: 400; text-align: center;
}
.ac-var__unsure { text-align: center; font-size: 13px; color: #8f8f8f; margin: 12px 20px 0; }
.ac-var__unsure a { color: #000; text-decoration: underline; text-underline-offset: 3px; }
.ac-var__panel .ac-var__list { padding-top: 4px; }
.ac-var__panel .ac-var__row { padding: 14px 20px; }
body.ac-var-open { position: fixed; width: 100%; overflow: hidden; }

/* ── Breakpoints ── */
@media (max-width: 991.98px) {
    .ac-var__desktop { display: none; }
    .ac-var { max-width: none; }
}
@media (min-width: 992px) {
    .ac-var__field--fabric, .ac-var--fabric .ac-var__overlay, .ac-var--fabric .ac-var__sheet { display: none !important; }

    /* Teil B: Dropdown statt Sheet */
    .ac-var--list .ac-var__overlay { display: none !important; }
    .ac-var--list.is-open .ac-var__field { border-radius: 10px 10px 0 0; }
    .ac-var--list .ac-var__panel {
        position: absolute; left: 0; right: 0; top: 100%; bottom: auto; z-index: 10;
        border: 1px solid #000; border-top: none; border-radius: 0 0 10px 10px;
        padding: 0; max-height: none; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.08);
    }
    .ac-var--list .ac-var__grip, .ac-var--list .ac-var__sheet-head { display: none; }
    .ac-var--list .ac-var__panel .ac-var__list { padding-top: 0; max-height: 320px; overflow-y: auto; }
    .ac-var--list .ac-var__panel .ac-var__row { padding: 13px 16px; }
    body.ac-var-open { position: static; overflow: visible; }
}

/* ── Ausverkauft (Spezifikation 23.09.2026) ─────────────────────────────
   Kachel bleibt wählbar; weißer Schleier + diagonaler weißer Strich (2 px,
   oben links → unten rechts). Auswahlring (outline) bleibt unverändert. */
.variation-status { color: #8f8f8f; font-weight: 400; }
.variation-status[hidden] { display: none; }
.ac-var__tile.is-soldout,
.ac-var__field-tile.is-soldout { position: relative; }
.ac-var__tile.is-soldout::after,
.ac-var__field-tile.is-soldout::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background:
        linear-gradient(to top right, transparent calc(50% - 1px), #fff calc(50% - 1px), #fff calc(50% + 1px), transparent calc(50% + 1px)),
        rgba(255, 255, 255, .35);
}
/* Mobiles Feld: Name + Status in einer Zeile */
.ac-var__field-line { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.ac-var__field-line .ac-var__field-name { min-width: 0; }
.ac-var__field-line .variation-status { flex: none; font-size: 14px; }
/* Radio-Liste: Status hinter dem Namen */
.ac-var__row .variation-status { font-weight: 400; }
