/*
 * Dmx4allShippingCountdown - Storefront
 * Wird unverändert ausgeliefert, kein SCSS-Build nötig.
 *
 * Optik nach der bisherigen DMX4ALL-FlipClock: Beschriftung über den
 * Ziffern, Klappkarten mit Schatten und Trennlinie, Punkte als Trenner.
 *
 * Farben kommen aus der Plugin-Konfiguration als CSS-Variablen direkt
 * am Element: --d4a-sc-bg, --d4a-sc-text, --d4a-sc-card, --d4a-sc-digit.
 */

.d4a-sc {
    --d4a-sc-bg: #06255e;
    --d4a-sc-text: #fff;
    --d4a-sc-card: #113d8e;
    --d4a-sc-digit: #fff;

    container-type: inline-size;
    box-sizing: border-box;
    flex: 0 0 100%; /* volle Zeile auch in Flex-Containern, z. B. ThemeWare-Labels */
    width: 100%;
    margin: 1rem 0;
    padding: 0.85rem 1rem 0.6rem;
    background: var(--d4a-sc-bg);
    color: var(--d4a-sc-text);
    text-align: center;
}

.d4a-sc[hidden] {
    display: none !important;
}

.d4a-sc--cart {
    margin: 0 0 1.5rem;
}

/* Kompakte Variante, entspricht #small-shippingcountdown der alten Seite */
.d4a-sc--small {
    flex-basis: auto;
    width: auto;
    margin: 15px 15px 0;
}

.d4a-sc--small .d4a-sc__message {
    font-size: 10px;
}

.d4a-sc__main {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.6rem;
}

.d4a-sc__icon {
    flex: 0 0 auto;
    width: 3.5rem;
    height: auto;
}

.d4a-sc__clock {
    display: inline-flex;
    align-items: flex-end;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.d4a-sc-days {
    display: inline-flex;
    align-items: flex-end;
}

.d4a-sc-days[hidden] {
    display: none;
}

.d4a-sc-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.d4a-sc-group__label {
    margin-bottom: 0.4rem;
    font-size: clamp(0.75rem, 0.22em, 1rem); /* em = Zifferngröße, im Banner wie bisher 16 px */
    font-weight: 700;
    line-height: 1.2;
}

.d4a-sc-group__digits {
    display: inline-flex;
    gap: 0.14em;
}

/* Trenner: zwei Punkte auf Kartenhöhe */

.d4a-sc-separator {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28em;
    width: 0.42em; /* wie bei der alten FlipClock: 20 px Trenner + 2 × 5 px Abstand */
    height: 1.25em;
}

.d4a-sc-separator__dot {
    display: block;
    width: 0.14em;
    height: 0.14em;
    border-radius: 50%;
    background: var(--d4a-sc-text);
    box-shadow: 0 0 0.07em rgba(0, 0, 0, 0.5);
}

/* Klappkarte */

.d4a-sc-digit {
    position: relative;
    display: inline-block;
    width: 0.83em;
    height: 1.25em;
    border-radius: 0.083em;
    box-shadow: 0 0.03em 0.07em rgba(0, 0, 0, 0.7);
    color: var(--d4a-sc-digit);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0.014em 0.028em #000;
    perspective: 2.8em;
}

/* Trennlinie in der Mitte */
.d4a-sc-digit::after {
    position: absolute;
    top: calc(50% - 0.02em);
    right: 0;
    left: 0;
    z-index: 3;
    height: 0.04em;
    background: rgba(0, 0, 0, 0.4);
    content: "";
}

.d4a-sc-digit__half {
    position: absolute;
    right: 0;
    left: 0;
    height: 50%;
    overflow: hidden;
    background: var(--d4a-sc-card);
    backface-visibility: hidden;
}

.d4a-sc-digit__half > span {
    position: absolute;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200%;
}

.d4a-sc-digit__upper {
    top: 0;
    border-radius: 0.083em 0.083em 0 0;
    transform-origin: 50% 100%;
}

.d4a-sc-digit__upper > span {
    top: 0;
}

.d4a-sc-digit__lower {
    bottom: 0;
    border-radius: 0 0 0.083em 0.083em;
    transform-origin: 50% 0;
}

.d4a-sc-digit__lower > span {
    bottom: 0;
}

/* Klappen mit Schattenverlauf, wie bei der alten FlipClock */

.d4a-sc-flap {
    z-index: 2;
}

.d4a-sc-flap::before {
    position: absolute;
    inset: 0;
    z-index: 1;
    content: "";
}

.d4a-sc-flap.d4a-sc-digit__upper {
    animation: d4a-sc-fold 0.3s ease-in forwards;
}

.d4a-sc-flap.d4a-sc-digit__upper::before {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.85));
    animation: d4a-sc-shade-in 0.3s linear both;
}

.d4a-sc-flap.d4a-sc-digit__lower {
    transform: rotateX(90deg);
    animation: d4a-sc-unfold 0.3s ease-out 0.3s forwards;
}

.d4a-sc-flap.d4a-sc-digit__lower::before {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.1));
    animation: d4a-sc-shade-out 0.3s linear 0.3s both;
}

@keyframes d4a-sc-fold {
    to {
        transform: rotateX(-90deg);
    }
}

@keyframes d4a-sc-unfold {
    to {
        transform: rotateX(0deg);
    }
}

@keyframes d4a-sc-shade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes d4a-sc-shade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Texte */

.d4a-sc__message {
    margin: 0.6rem 0 0.3rem;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.35;
}

.d4a-sc__hours {
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
}

.d4a-sc__notice {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
}

/* Größe an die verfügbare Breite anpassen: schmale Kaufbox bis breites Banner */

@supports (container-type: inline-size) {
    .d4a-sc__clock {
        font-size: clamp(1.35rem, 9cqi, 4.5rem);
    }

    .d4a-sc__icon {
        width: clamp(2.5rem, 14cqi, 6.25rem);
    }
}

@container (max-width: 300px) {
    .d4a-sc__icon {
        display: none;
    }

    .d4a-sc-group__label {
        font-size: 0.65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .d4a-sc-flap,
    .d4a-sc-flap::before {
        animation: none !important;
    }
}
