/*
 * July 4th Theme for play.brainfusion.games
 * Active: July (full month)
 * Features: Floating stars, firework bursts, patriotic red/white/blue
 */

/* ===== COLOR PALETTE ===== */
body.theme-july4th {
    --july4th-red: hsl(355, 80%, 50%);            /* #e6173d */
    --july4th-blue: hsl(215, 80%, 45%);           /* #174f99 */
    --july4th-white: hsl(0, 0%, 98%);             /* #fafafa */
    --july4th-gold: hsl(45, 90%, 55%);            /* #f0c419 */
    --july4th-navy: hsl(215, 70%, 25%);           /* #132f54 */

    /* Background gradient: patriotic navy to lighter blue */
    background: linear-gradient(180deg, hsl(215, 70%, 25%) 0%, hsl(215, 60%, 45%) 100%);
    background-attachment: fixed;
    color: var(--july4th-white);
}

/* ===== HEADER THEMING ===== */
body.theme-july4th .header-top {
    background: var(--july4th-red);
    box-shadow: 0 2px 10px rgba(230, 23, 61, 0.4);
}

body.theme-july4th .header-btm {
    background: color-mix(in srgb, #ffffff 22%, transparent);
}

/* ===== BUTTON THEMING ===== */
body.theme-july4th wa-button::part(base) {
    background: var(--july4th-red);
    border-color: var(--july4th-white);
}

body.theme-july4th wa-button::part(base):hover {
    background: var(--july4th-blue);
    border-color: var(--july4th-gold);
}

/* ===== INPUT FOCUS THEMING ===== */
body.theme-july4th {
    --wa-color-focus: var(--july4th-red);
}

/* Direct styling of Web Awesome input focus border using CSS parts */
body.theme-july4th wa-input:focus-within::part(base) {
    border-color: var(--july4th-red);
    outline: 3px solid var(--july4th-red);
    outline-offset: 1px;
    box-shadow: 0 0 0 3px rgba(230, 23, 61, 0.2);
}

/* Also style the input part directly for better browser support */
body.theme-july4th wa-input:focus-within::part(input) {
    border-color: var(--july4th-red);
}

/* ===== TEXT STYLING ===== */
body.theme-july4th h2 {
    color: var(--july4th-white);
    text-shadow: 2px 2px 4px rgba(23, 79, 153, 0.5);
}

/* ===== DECORATIONS CONTAINER ===== */
body.theme-july4th .theme-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* ===== FLOATING STARS ===== */
/* Red star */
body.theme-july4th .theme-decorations::before {
    content: '⭐';
    position: absolute;
    font-size: 35px;
    color: var(--july4th-red);
    top: 20%;
    left: 10%;
    animation: float-star 5s ease-in-out infinite;
    will-change: transform;
    opacity: 0.9;
    filter: drop-shadow(0 0 8px rgba(230, 23, 61, 0.6));
}

/* White star */
body.theme-july4th .theme-decorations::after {
    content: '⭐';
    position: absolute;
    font-size: 30px;
    color: var(--july4th-white);
    top: 60%;
    right: 15%;
    animation: float-star 6s ease-in-out infinite 1s;
    will-change: transform;
    opacity: 0.85;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
}

/* Additional stars via container pseudo-elements */
body.theme-july4th .container::before {
    content: '⭐';
    position: fixed;
    font-size: 28px;
    color: var(--july4th-blue);
    bottom: 25%;
    left: 8%;
    animation: float-star 5.5s ease-in-out infinite 2s;
    will-change: transform;
    opacity: 0.8;
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(23, 79, 153, 0.7));
}

body.theme-july4th .container::after {
    content: '⭐';
    position: fixed;
    font-size: 32px;
    color: var(--july4th-gold);
    top: 35%;
    right: 12%;
    animation: float-star 4.5s ease-in-out infinite 3s;
    will-change: transform;
    opacity: 0.9;
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(240, 196, 25, 0.7));
}

/* Note: decoration pseudo-elements removed from .header-btm because
   backdrop-filter creates a containing block that breaks position: fixed.
   The remaining decorations on .theme-decorations, .container, and main
   provide sufficient coverage. */

/* Extra stars for desktop */
@media (min-width: 769px) {
    body.theme-july4th main::before {
        content: '⭐';
        position: fixed;
        font-size: 30px;
        color: var(--july4th-blue);
        top: 45%;
        left: 5%;
        animation: float-star 6.8s ease-in-out infinite 4s;
        will-change: transform;
        opacity: 0.7;
        z-index: 1;
        pointer-events: none;
        filter: drop-shadow(0 0 5px rgba(23, 79, 153, 0.6));
    }

    body.theme-july4th main::after {
        content: '⭐';
        position: fixed;
        font-size: 26px;
        color: var(--july4th-white);
        top: 70%;
        right: 6%;
        animation: float-star 5.8s ease-in-out infinite 3.5s;
        will-change: transform;
        opacity: 0.75;
        z-index: 1;
        pointer-events: none;
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
    }
}

/* ===== FIREWORK BURSTS (corners) ===== */
/* Firework burst effect using radial gradients */
body.theme-july4th body::before {
    content: '';
    position: fixed;
    top: 10px;
    right: 10px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, transparent 30%, var(--july4th-gold) 30%, var(--july4th-gold) 35%, transparent 35%);
    animation: firework-burst 3s ease-out infinite;
    will-change: transform, opacity;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

body.theme-july4th body::after {
    content: '';
    position: fixed;
    bottom: 50px;
    left: 20px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, transparent 30%, var(--july4th-red) 30%, var(--july4th-red) 35%, transparent 35%);
    animation: firework-burst 3.5s ease-out infinite 1.5s;
    will-change: transform, opacity;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

/* ===== ANIMATIONS ===== */

/* Floating star animation with rotation and scale */
@keyframes float-star {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-15px) rotate(90deg) scale(1.1);
    }
    50% {
        transform: translateY(-10px) rotate(180deg) scale(1.05);
    }
    75% {
        transform: translateY(-5px) rotate(270deg) scale(0.95);
    }
}

/* Firework burst animation */
@keyframes firework-burst {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Sparkle rotation animation */
@keyframes sparkle-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    /* Reduce number of stars on tablet */
    body.theme-july4th .container::after {
        display: none;
    }

    /* Smaller stars on mobile */
    body.theme-july4th .theme-decorations::before {
        font-size: 28px;
    }

    body.theme-july4th .theme-decorations::after {
        font-size: 24px;
    }

    body.theme-july4th .container::before {
        font-size: 22px;
    }

    /* Smaller firework bursts */
    body.theme-july4th body::before {
        width: 60px;
        height: 60px;
    }

    body.theme-july4th body::after {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    /* Minimal stars on very small screens */
    body.theme-july4th .container::before {
        display: none;
    }

    /* Keep only 2 stars */
    body.theme-july4th .theme-decorations::before {
        font-size: 24px;
    }

    body.theme-july4th .theme-decorations::after {
        font-size: 20px;
    }

    /* Hide firework bursts on very small screens */
    body.theme-july4th body::before,
    body.theme-july4th body::after {
        display: none;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    body.theme-july4th .theme-decorations::before,
    body.theme-july4th .theme-decorations::after,
    body.theme-july4th .container::before,
    body.theme-july4th .container::after,
    body.theme-july4th main::before,
    body.theme-july4th main::after,
    body.theme-july4th body::before,
    body.theme-july4th body::after {
        animation: none;
        position: static;
        display: none;
    }
}
