/*
 * Back to School Theme for play.brainfusion.games
 * Active: August 15 - September 15
 * Features: Floating school supplies, bright primary colors, academic atmosphere
 */

/* ===== COLOR PALETTE ===== */
body.theme-backtoschool {
    --school-red: hsl(355, 75%, 55%);             /* #e64a4a */
    --school-blue: hsl(210, 80%, 50%);            /* #1a8cff */
    --school-yellow: hsl(45, 95%, 55%);           /* #f9d835 */
    --school-green: hsl(145, 60%, 45%);           /* #2db869 */
    --school-orange: hsl(30, 90%, 55%);           /* #f28c28 */
    --school-white: hsl(0, 0%, 98%);              /* #fafafa */

    /* Background gradient: soft cream to light blue */
    background: linear-gradient(180deg, hsl(45, 40%, 95%) 0%, hsl(210, 40%, 95%) 100%);
    background-attachment: fixed;
    color: #2c3e50;
}

/* ===== HEADER THEMING ===== */
body.theme-backtoschool .header-top {
    background: var(--school-blue);
    box-shadow: 0 2px 10px rgba(26, 140, 255, 0.3);
}

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

/* ===== BUTTON THEMING ===== */
body.theme-backtoschool wa-button::part(base) {
    background: var(--school-blue);
    border-color: var(--school-yellow);
}

body.theme-backtoschool wa-button::part(base):hover {
    background: var(--school-red);
}

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

/* Direct styling of Web Awesome input focus border using CSS parts */
body.theme-backtoschool wa-input:focus-within::part(base) {
    border-color: var(--school-blue);
    outline: 3px solid var(--school-blue);
    outline-offset: 1px;
    box-shadow: 0 0 0 3px rgba(26, 140, 255, 0.2);
}

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

/* ===== TEXT STYLING ===== */
body.theme-backtoschool h2 {
    color: var(--school-blue);
    text-shadow: 1px 1px 2px rgba(26, 140, 255, 0.2);
}

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

/* ===== FALLING SCHOOL SUPPLIES ===== */
/* Book */
body.theme-backtoschool .theme-decorations::before {
    content: '📚';
    position: absolute;
    font-size: 42px;
    top: -50px;
    left: 12%;
    animation: fall-school 14s ease-in-out infinite;
    will-change: transform, opacity;
    opacity: 0.85;
}

/* Pencil */
body.theme-backtoschool .theme-decorations::after {
    content: '✏️';
    position: absolute;
    font-size: 38px;
    top: -70px;
    left: 68%;
    animation: fall-school 16s ease-in-out infinite 2s;
    will-change: transform, opacity;
    opacity: 0.8;
}

/* Apple */
body.theme-backtoschool .container::before {
    content: '🍎';
    position: fixed;
    font-size: 40px;
    top: -60px;
    left: 38%;
    animation: fall-school 13s ease-in-out infinite 1s;
    will-change: transform, opacity;
    opacity: 0.75;
    z-index: 1;
    pointer-events: none;
}

/* Backpack */
body.theme-backtoschool .container::after {
    content: '🎒';
    position: fixed;
    font-size: 38px;
    top: -80px;
    left: 82%;
    animation: fall-school 15s ease-in-out infinite 3s;
    will-change: transform, opacity;
    opacity: 0.9;
    z-index: 1;
    pointer-events: none;
}

/* 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. */

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

/* Falling school supply animation with gentle sway */
@keyframes fall-school {
    0% {
        transform: translateY(-10vh) translateX(0);
        opacity: 1;
    }
    25% {
        transform: translateY(25vh) translateX(-12px);
    }
    50% {
        transform: translateY(50vh) translateX(18px);
    }
    75% {
        transform: translateY(75vh) translateX(-8px);
    }
    100% {
        transform: translateY(110vh) translateX(0);
        opacity: 0.5;
    }
}

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

    /* Smaller items on mobile */
    body.theme-backtoschool .theme-decorations::before {
        font-size: 34px;
    }

    body.theme-backtoschool .theme-decorations::after {
        font-size: 30px;
    }

    body.theme-backtoschool .container::before {
        font-size: 32px;
    }
}

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

    /* Keep only 2 items falling */
    body.theme-backtoschool .theme-decorations::before {
        font-size: 30px;
    }

    body.theme-backtoschool .theme-decorations::after {
        font-size: 28px;
    }
}

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