/* =====================================================
   BATTLENEXUS — LAUNCH COUNTDOWN
   Sticky Banner + Smooth 3D Flip Clock
===================================================== */

.launch-strip {
    position: sticky;
    top: 0;
    z-index: 9999;

    width: 100%;
    padding: 12px 20px;

    background: linear-gradient(
        90deg,
        #170707 0%,
        #300909 50%,
        #170707 100%
    );

    border-bottom: 1px solid rgba(255, 59, 59, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);

    color: #fff;
}

.launch-strip[hidden] {
    display: none !important;
}

.launch-strip-content {
    max-width: 1280px;
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Announcement */

.launch-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.launch-live-dot {
    width: 9px;
    height: 9px;
    flex-shrink: 0;

    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 0 12px rgba(255, 59, 59, 0.8);

    animation: launchPulse 1.8s ease-in-out infinite;
}

.launch-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.launch-label {
    font-family: "Orbitron", sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ff5757;
}

.launch-title {
    font-family: "Rajdhani", sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}

/* Countdown */

.launch-timer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.launch-time-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.launch-time-label {
    font-family: "Rajdhani", sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #aaa;
}

/* =====================================================
   FLIP CLOCK CARD
===================================================== */

.launch-flip-card {
    --card-height: 48px;
    --card-width: 56px;
    --digit-size: 19px;
    --half-height: calc(var(--card-height) / 2);

    position: relative;

    width: var(--card-width);
    height: var(--card-height);

    flex-shrink: 0;

    border-radius: 7px;
    background: #160909;

    border: 1px solid rgba(255, 59, 59, 0.28);

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.35),
        0 0 10px rgba(255, 59, 59, 0.06);

    perspective: 900px;
    -webkit-perspective: 900px;

    isolation: isolate;
}

/* Fallback number before JS initializes */

.launch-flip-value {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    font-family: "Orbitron", sans-serif;
    font-size: var(--digit-size);
    font-weight: 700;
    font-variant-numeric: tabular-nums;

    color: #fff;
}

.launch-flip-card.flip-ready .launch-flip-value {
    display: none;
}

/* =====================================================
   DIGIT HALVES
===================================================== */

.flip-face {
    position: absolute;
    left: 0;

    width: 100%;
    height: 50%;

    overflow: hidden;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flip-face.top {
    top: 0;

    border-radius: 6px 6px 0 0;

    background: linear-gradient(
        180deg,
        #291111,
        #1d0b0b
    );
}

.flip-face.bottom {
    bottom: 0;

    border-radius: 0 0 6px 6px;

    background: linear-gradient(
        180deg,
        #160808,
        #210d0d
    );
}

/*
   IMPORTANT:

   Each digit occupies the full card height.

   Top face displays the upper half.
   Bottom face displays the lower half.

   We use top positioning for BOTH halves.
*/

.flip-digit {
    position: absolute;
    left: 0;

    width: 100%;
    height: var(--card-height);

    display: flex;
    align-items: center;
    justify-content: center;

    font-family: "Orbitron", sans-serif;
    font-size: var(--digit-size);
    font-weight: 700;
    font-variant-numeric: tabular-nums;

    line-height: 1;
    white-space: nowrap;

    color: #fff;

    text-shadow: 0 0 8px rgba(255, 255, 255, 0.08);
}

.flip-face.top .flip-digit {
    top: 0;
}

.flip-face.bottom .flip-digit {
    top: calc(-1 * var(--half-height));
}

/* =====================================================
   FOUR-LAYER STACK
===================================================== */

/* Background layers */

.flip-static-top {
    z-index: 1;
}

.flip-static-bottom {
    z-index: 1;
}

/* Moving layers */

.flip-animated-top {
    z-index: 3;

    transform-origin: center bottom;
    transform: rotateX(0deg);
}

.flip-animated-bottom {
    z-index: 4;

    transform-origin: center top;
    transform: rotateX(90deg);
}

/* =====================================================
   REALISTIC FLIP SHADOWS
===================================================== */

.flip-animated-top::after,
.flip-animated-bottom::after {
    content: "";

    position: absolute;
    inset: 0;

    pointer-events: none;
}

.flip-animated-top::after {
    background: rgba(0, 0, 0, 0);
}

.flip-animated-bottom::after {
    background: rgba(0, 0, 0, 0.25);
}

/* =====================================================
   ANIMATION
===================================================== */

.flip-animated-top.play {
    animation: bnFlipTop 0.28s
        cubic-bezier(0.55, 0.05, 0.85, 0.35)
        forwards;
}

.flip-animated-bottom.play {
    animation: bnFlipBottom 0.32s
        cubic-bezier(0.15, 0.65, 0.35, 1)
        0.28s forwards;
}

@keyframes bnFlipTop {
    0% {
        transform: rotateX(0deg);
    }

    100% {
        transform: rotateX(-90deg);
    }
}

@keyframes bnFlipBottom {
    0% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

/* Center seam */

.launch-flip-card::after {
    content: "";

    position: absolute;
    top: 50%;
    left: 0;
    right: 0;

    height: 1px;

    background: rgba(0, 0, 0, 0.55);

    z-index: 5;
    pointer-events: none;
}

/* =====================================================
   LIVE DOT
===================================================== */

@keyframes launchPulse {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 12px rgba(255, 59, 59, 0.8);
    }

    50% {
        opacity: 0.45;
        box-shadow: 0 0 4px rgba(255, 59, 59, 0.3);
    }
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 768px) {
    .launch-strip {
        padding: 12px 16px;
    }

    .launch-title {
        font-size: 15px;
    }

    .launch-timer {
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .launch-strip {
        padding: 12px;
    }

    .launch-strip-content {
        flex-direction: column;
        justify-content: center;
        gap: 12px;
    }

    .launch-info {
        justify-content: center;
    }

    .launch-flip-card {
        --card-height: 44px;
        --card-width: 52px;
        --digit-size: 17px;
    }

    .launch-time-label {
        font-size: 9px;
    }
}

@media (max-width: 360px) {
    .launch-flip-card {
        --card-height: 42px;
        --card-width: 47px;
        --digit-size: 16px;
    }

    .launch-timer {
        gap: 6px;
    }

    .launch-title {
        font-size: 14px;
    }
}

/* =====================================================
   REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {
    .launch-live-dot {
        animation: none;
    }

    .flip-animated-top.play,
    .flip-animated-bottom.play {
        animation: none;
    }
}
