/*
 * Christmas theme ("Felices Fiestas") - loaded after main.css only when "Theme:Christmas" is true in appsettings.json.
 * Everything is scoped to body.christmas, so switching the flag off restores the normal site.
 */

html:has(body.christmas) {
    scrollbar-color: #d62839 #051a22;
}

body.christmas ::selection {
    background: #d62839;
    color: #fff;
}

/* Shared winter night: guiding star, stars and a warm glow on the horizon */
body.christmas .hero,
body.christmas .page-hero,
body.christmas .page-hero.is-business,
body.christmas .page-hero.is-investor {
    position: relative;
    overflow: hidden;
    color: #f4f8ff;
    background:
        radial-gradient(circle at 88% 20%, #fffbe8 0, #f2c14e 8px, rgba(242, 193, 78, 0.35) 12px, transparent 90px),
        radial-gradient(1.5px 1.5px at 8% 18%, #fff, transparent),
        radial-gradient(1px 1px at 22% 40%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 35% 12%, #fff, transparent),
        radial-gradient(1px 1px at 48% 30%, #fff, transparent),
        radial-gradient(1px 1px at 62% 14%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 72% 42%, #fff, transparent),
        radial-gradient(1px 1px at 15% 70%, #fff, transparent),
        radial-gradient(1px 1px at 55% 62%, #fff, transparent),
        radial-gradient(ellipse at 50% 115%, rgba(242, 193, 78, 0.3), transparent 60%),
        linear-gradient(180deg, #051a22 0%, #0b2e33 50%, #0f3d2e 100%);
}

/* Snowy hills with pine trees along the bottom edge */
body.christmas .hero::after,
body.christmas .page-hero::after,
body.christmas .cta-section::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60px;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='60' viewBox='0 0 600 60'%3E%3Cg fill='%230a3324'%3E%3Cpath d='M90 6L74 30h8L70 46h40L98 30h8z'/%3E%3Cpath d='M230 18L219 34h6L214 46h32L235 34h6z'/%3E%3Cpath d='M450 2L432 28h9L426 46h48L459 28h9z'/%3E%3Cpath d='M340 24L332 36h4L328 46h24L344 36h4z'/%3E%3C/g%3E%3Cpath d='M90 6l-6 9h12zM450 2l-7 10h14zM230 18l-4 6h8z' fill='%23f4f8ff'/%3E%3Ccircle cx='450' cy='2' r='3' fill='%23f2c14e'/%3E%3Cpath d='M0 60V44Q150 32 300 42T600 40V60Z' fill='%23eef5fb'/%3E%3Crect x='520' y='30' width='18' height='14' rx='1' fill='%23d62839'/%3E%3Cpath d='M528 30h2v14h-2zM520 36h18v2h-18z' fill='%23f2c14e'/%3E%3Crect x='150' y='34' width='13' height='10' rx='1' fill='%231f7a4d'/%3E%3Cpath d='M155.5 34h2v10h-2z' fill='%23d62839'/%3E%3C/svg%3E") repeat-x bottom / 600px 60px;
}

body.christmas .hero-container,
body.christmas .page-hero-container,
body.christmas .cta-section .container {
    position: relative;
    z-index: 1;
}

body.christmas .hero-title,
body.christmas .page-hero-title {
    color: #f4f8ff;
}

body.christmas .hero-subtitle,
body.christmas .page-hero-text,
body.christmas .hero-switch {
    color: rgba(244, 248, 255, 0.8);
}

body.christmas .page-hero-meta {
    color: rgba(244, 248, 255, 0.5);
}

body.christmas .hero-hook {
    color: #fff3c4;
}

body.christmas .hero-hook-lead,
body.christmas .hero-switch a {
    color: #f2c14e;
}

body.christmas .hero-hook-word {
    background: rgba(214, 40, 57, 0.25);
    color: #ffe29a;
}

body.christmas .hero .stat-number {
    color: #f2c14e;
    text-shadow: 0 0 12px rgba(242, 193, 78, 0.5);
}

body.christmas .hero .stat-label {
    color: rgba(244, 248, 255, 0.72);
}

body.christmas .hero .audience-badge,
body.christmas .page-hero .audience-badge {
    background: rgba(214, 40, 57, 0.22);
    color: #ffe29a;
}

/* Candy-cane gradient: red into pine green */
body.christmas .gradient-text,
body.christmas .fresh-text {
    background-image: linear-gradient(135deg, #c1121f, #1f7a4d, #c1121f);
    background-size: 200% 200%;
}

body.christmas .hero .gradient-text,
body.christmas .page-hero .gradient-text {
    background-image: linear-gradient(135deg, #f2c14e, #fff3c4, #f2c14e);
    filter: drop-shadow(0 0 10px rgba(242, 193, 78, 0.45));
}

/* Navigation: a winter night bar on every page */
body.christmas .nav,
body.christmas .nav.scrolled {
    background: rgba(5, 26, 34, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 3px solid transparent;
    border-image: repeating-linear-gradient(90deg, #d62839 0 18px, #f4f8ff 18px 36px) 1;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

body.christmas .nav .nav-links a:not(.btn) {
    color: rgba(244, 248, 255, 0.9);
}

body.christmas .nav .nav-links a:not(.btn):hover {
    color: #f2c14e;
}

body.christmas .nav-links a::after {
    background: linear-gradient(135deg, #d62839, #f2c14e);
}

body.christmas .nav .nav-links .btn {
    background: #d62839;
    border-color: #d62839;
    color: #fff;
    font-weight: 600;
}

body.christmas .nav .nav-links .btn:hover {
    background: #e63946;
    box-shadow: 0 0 18px rgba(214, 40, 57, 0.55);
}

body.christmas .nav .logo-image {
    filter: brightness(0) invert(1) drop-shadow(0 0 8px rgba(242, 193, 78, 0.45));
}

body.christmas .nav .hamburger-line {
    background-color: #f4f8ff;
}

body.christmas .mobile-nav {
    background: rgba(5, 26, 34, 0.97);
}

body.christmas .mobile-nav-links a,
body.christmas .mobile-menu-close {
    color: #f4f8ff;
}

body.christmas .mobile-nav-links a:hover,
body.christmas .mobile-menu-close:hover {
    color: #f2c14e;
}

body.christmas .mobile-nav-links .btn {
    background: #d62839;
    border-color: #d62839;
    color: #fff;
}

/* Buttons: wrapped in red */
body.christmas .btn-primary {
    background: linear-gradient(135deg, #d62839, #9b1b2a);
    color: white;
}

body.christmas .btn-primary:hover {
    box-shadow: 0 10px 28px rgba(214, 40, 57, 0.4), 0 0 0 3px rgba(242, 193, 78, 0.3);
}

body.christmas .btn-outline {
    color: #1f7a4d;
    border-color: #1f7a4d;
}

body.christmas .btn-outline:hover {
    background-color: #1f7a4d;
    color: white;
}

body.christmas .btn-white {
    color: #9b1b2a;
}

/* Dark sections become a pine-forest night */
body.christmas .section-purple,
body.christmas .investors-section,
body.christmas .digitalize-section {
    background:
        radial-gradient(1px 1px at 12% 20%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 30% 75%, #fff, transparent),
        radial-gradient(1px 1px at 68% 18%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 88% 60%, #fff, transparent),
        radial-gradient(circle at 85% 15%, rgba(242, 193, 78, 0.18), transparent 50%),
        radial-gradient(circle at 12% 85%, rgba(214, 40, 57, 0.22), transparent 55%),
        linear-gradient(160deg, #0b2e33, #0f3d2e 60%, #135237);
}

body.christmas .section-light,
body.christmas .audience-nav {
    background-color: #fbf6ef;
}

body.christmas .cta-section {
    position: relative;
    overflow: hidden;
    padding-bottom: 120px;
    background:
        radial-gradient(ellipse at 50% 120%, rgba(242, 193, 78, 0.35), transparent 60%),
        linear-gradient(180deg, #051a22, #0b2e33);
}

body.christmas .cta-title::after {
    content: ' 🎄';
}

/* Cards glow like fairy lights when hovered */
body.christmas .audience-card:hover,
body.christmas .update-card:hover,
body.christmas .step-card:hover,
body.christmas .feature-card:hover,
body.christmas .business-card:hover,
body.christmas .investor-card:hover,
body.christmas .value-card:hover,
body.christmas .download-card:hover {
    border-color: rgba(214, 40, 57, 0.4);
    box-shadow: 0 14px 34px rgba(214, 40, 57, 0.16), 0 0 0 1px rgba(242, 193, 78, 0.35);
}

/* Plain pages (Nosotros, Descargar, legal) */
body.christmas .about-title,
body.christmas .terms-title {
    text-shadow: 0 0 18px rgba(242, 193, 78, 0.35);
}

body.christmas .about-title::before,
body.christmas .terms-title::before {
    content: '❄️ ';
}

body.christmas .about-title::after,
body.christmas .terms-title::after {
    content: ' ❄️';
}

/* Footer: under the tree */
body.christmas .footer {
    position: relative;
    background: #051a22;
    border-top: 4px solid transparent;
    border-image: repeating-linear-gradient(90deg, #d62839 0 18px, #f4f8ff 18px 36px, #1f7a4d 36px 54px, #f4f8ff 54px 72px) 1;
}

body.christmas .footer-link:hover,
body.christmas .social-link:hover {
    color: #f2c14e;
}

body.christmas .footer-bottom::before {
    content: '🎄 ¡Felices Fiestas! Este año regala comida rescatada. 🎁';
    display: block;
    margin-bottom: 8px;
    color: #f2c14e;
    font-weight: 600;
}

/* Site-wide decorations from _ChristmasDecor.cshtml */
.christmas-decor {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    overflow: hidden;
}

.cd-flake {
    position: absolute;
    top: -40px;
    left: var(--x);
    color: #fff;
    font-size: var(--s, 1rem);
    opacity: 0.85;
    text-shadow: 0 0 4px rgba(120, 170, 210, 0.9), 0 0 1px rgba(40, 80, 110, 0.8);
    animation: cd-fall var(--d, 14s) linear infinite, cd-drift 3.5s ease-in-out infinite alternate;
    animation-delay: var(--delay, 0s), 0s;
}

.cd-holly {
    position: absolute;
    left: 10px;
    bottom: 8px;
    width: 86px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.cd-santa {
    position: absolute;
    top: 16%;
    left: 100%;
    font-size: 2rem;
    white-space: nowrap;
    filter: drop-shadow(0 0 6px rgba(242, 193, 78, 0.7));
    animation: cd-santa 38s linear infinite;
    animation-delay: -6s;
}

.cd-gift {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 56px;
    filter: drop-shadow(0 0 12px rgba(242, 193, 78, 0.6));
    animation: cd-gift-peek 16s ease-in-out infinite;
}

.cd-gift svg {
    display: block;
    animation: cd-gift-bob 2.6s ease-in-out infinite;
}

/* Burst spawned by christmas.js on click */
.cd-treat {
    position: fixed;
    z-index: 1001;
    pointer-events: none;
    font-size: 1.3rem;
    animation: cd-treat 0.9s ease-out forwards;
}

@keyframes cd-fall {
    from { transform: translateY(0); }
    to { transform: translateY(calc(100vh + 80px)); }
}

@keyframes cd-drift {
    from { margin-left: -14px; }
    to { margin-left: 14px; }
}

@keyframes cd-santa {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-35vw, -24px); }
    50% { transform: translate(-70vw, 16px); }
    100% { transform: translate(calc(-100vw - 440px), -10px); }
}

@keyframes cd-gift-peek {
    0%, 30% { transform: translateY(140%); opacity: 0; }
    40%, 70% { transform: translateY(0); opacity: 1; }
    80%, 100% { transform: translateY(140%); opacity: 0; }
}

@keyframes cd-gift-bob {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-8px) rotate(5deg); }
}

@keyframes cd-treat {
    from { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
    to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(var(--rot)); opacity: 0; }
}

@media (max-width: 768px) {
    .cd-flake:nth-child(n+10) {
        display: none;
    }

    .cd-holly {
        width: 60px;
    }

    .cd-gift {
        width: 42px;
    }

    .cd-santa {
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .christmas-decor,
    .cd-treat {
        display: none;
    }

    body.christmas .gradient-text,
    body.christmas .fresh-text {
        animation: none;
    }
}
