/* ============================================================
 * Post 8 Sponsor Overlay for tar1090
 * ============================================================
 * Mobile-first responsive design
 * ============================================================ */

/* ---- Container ---- */
#sponsor-overlay {
    position: fixed;
    bottom: 60px;
    left: 10px;
    z-index: 1000;
    display: none;
    max-width: 280px;
    width: calc(70vw);
    font-family: Helvetica, Verdana, sans-serif;
}

/* ---- Airplane wrapper (animated element) ---- */
#sponsor-airplane {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--BGCOLOR1, #F8F8F8);
    border: 1px solid var(--ACCENT, #00596b);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 10px;
    overflow: visible;

    /* Start off-screen left for fly-in */
    transform: translateX(-150%);
    opacity: 0;

    /* GPU acceleration */
    will-change: transform, opacity;
}


/* ---- Twin emoji airplanes ---- */
#sponsor-propeller {
    position: absolute;
    left: -45px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    line-height: 1;
    opacity: 0;
    white-space: nowrap;
}

#sponsor-propeller::before {
    content: '✈️';
    display: block;
    transform: scaleX(1); /* Point right (toward the box) */
}

/* Hide the disc element — not needed for emoji version */
#sponsor-propeller-disc {
    display: none;
}

/* Show planes when spinning */
.spinning#sponsor-propeller {
    opacity: 1;
    animation: planes-wobble 0.2s ease-in-out infinite alternate;
}

@keyframes planes-wobble {
    0%   { transform: translateY(-50%) rotate(-4deg); }
    100% { transform: translateY(-50%) rotate(44deg); }
}


/* ---- Fly-in animation ---- */
@keyframes sponsor-fly-in {
    0% {
        transform: translateX(-150%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---- Fly-out animation (random angle via CSS variable) ---- */
@keyframes sponsor-fly-out {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
        opacity: 1;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translateX(calc(100vw + 100%))
                   translateY(var(--flyout-y, 0px))
                   rotate(var(--flyout-rotate, 0deg));
        opacity: .1;
    }
}


#sponsor-airplane.fly-in {
    animation: sponsor-fly-in 1.0s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#sponsor-airplane.fly-out {
    animation: sponsor-fly-out 0.85s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}


/* ---- Top bar: Dismiss + Countdown ---- */
#sponsor-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 6px;
}

#sponsor-dismiss-btn {
    background: none;
    border: none;
    color: var(--TXTCOLOR1, #123);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s, background-color 0.2s;
}

#sponsor-dismiss-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

#sponsor-countdown {
    font-size: 10px;
    color: var(--TXTCOLOR1, #003f4b);
    opacity: 0.6;
}

/* ---- Countdown progress bar ---- */
#sponsor-countdown-bar {
    width: 100%;
    height: 3px;
    background-color: var(--BGCOLOR2, #CCCCCC);
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
}

#sponsor-countdown-fill {
    height: 100%;
    background-color: #ff8c00;
    border-radius: 3px;
    width: 100%;
    transition: width 10s linear;
}

/* ---- Logo image ---- */
#sponsor-logo-link {
    display: block;
    text-align: center;
    text-decoration: none;
    width: 100%;
}

#sponsor-logo-img {
    max-width: 100%;
    max-height: 170px;
    height: auto;
    border-radius: 5px;
    object-fit: contain;
}

/* ---- Sponsor text / link text ---- */
#sponsor-link-text {
    font-size: 16px;
    color:yellow;
    background-color: #1a237e;
    padding: 4px 10px;
    border-radius: 4px;
    /* color: var(--TXTCOLOR1, #003f4b); */
    text-align: center;
    margin-top: 6px;
    text-decoration: underline;
    word-wrap: break-word;
    max-width: 100%;
}

#sponsor-link-text:hover {
    opacity: 1.0;
    color:#fff;
    background-color: #0d1657;
}

/* ---- "Sponsor Post 8" link ---- */
#sponsor-post8-link {
    font-size: 11px;
    color: var(--TXTCOLOR1, #003f4b);
    opacity: 0.5;
    text-decoration: none;
    text-align: center;
    margin-top: 6px;
    display: block;
}

#sponsor-post8-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ============================================================
 * Dark Mode Overrides
 * ============================================================ */
.darkMode #sponsor-airplane {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.darkMode #sponsor-dismiss-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================================
 * Responsive: Desktop
 * ============================================================ */
@media screen and (min-width: 768px) {
    #sponsor-overlay {
        bottom: 80px;
        left: 15px;
        width: 300px;
        max-width: 330px;
    }

    #sponsor-logo-img {
        max-height: 240px;
    }
}

/* ============================================================
 * Responsive: Small Mobile (< 380px)
 * ============================================================ */
@media screen and (max-width: 380px) {
    #sponsor-overlay {
        left: 5px;
        right: 5px;
        bottom: 50px;
        width: auto;
        max-width: none;
    }

    #sponsor-logo-img {
        max-height: 100px;
    }

    #sponsor-link-text {
        font-size: 11px;
    }
}

/* ============================================================
 * Prevent interaction while flying in/out
 * ============================================================ */
#sponsor-airplane.fly-in *,
#sponsor-airplane.fly-out * {
    pointer-events: none;
}

#sponsor-airplane.fly-in.landed * {
    pointer-events: auto;
    
}
