/* Parte festiva de la Navidad, compartida por la home y menuNavidad.html */

[hidden] {
    display: none !important;
}

[data-navidad-escena] {
    position: relative;
    overflow: hidden;
    padding-bottom: 9rem;
}

/* El contenido queda por encima del paisaje */
[data-navidad-escena] > *:not(.paisaje):not(.guirnalda):not(.nieve):not(.trineo) {
    position: relative;
    z-index: 2;
}

[data-navidad-escena].fx-pausado * {
    animation-play-state: paused !important;
}

/* ---------- Paisaje ---------- */

.paisaje {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.colina {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 150px;
}

.colina-fondo path {
    fill: #1c5a4d;
}

.colina-relleno {
    fill: var(--suelo, #ffffff);
}

.colina-cresta {
    fill: none;
    stroke: #ffffff;
    stroke-width: 5;
    vector-effect: non-scaling-stroke;
}

/* ---------- Guirnalda ---------- */

.guirnalda {
    position: absolute;
    top: var(--guirnalda-top, 0);
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 3;
    overflow: hidden;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cpath d='M0 4Q60 34 120 4' fill='none' stroke='%23082a24' stroke-width='2'/%3E%3C/svg%3E") repeat-x;
}

.luz {
    position: absolute;
    width: 9px;
    height: 13px;
    margin-left: -4px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: var(--color);
    box-shadow: 0 0 10px 3px var(--color);
    animation: parpadeo 2.1s ease-in-out infinite;
}

@keyframes parpadeo {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---------- Nieve ---------- */

.nieve {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.nieve-fija {
    position: fixed;
    z-index: 0;
}

.copo {
    position: absolute;
    top: -30px;
    border-radius: 50%;
    background: #ffffff;
    animation: caer linear infinite;
}

.copo-cristal {
    border-radius: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -16 32 32' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M0-14V14M-12-7L12 7M-12 7L12-7M0-9l-3-3M0-9l3-3M0 9l-3 3M0 9l3 3'/%3E%3C/svg%3E") center / contain no-repeat;
}

@keyframes caer {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); }
    50% { transform: translate3d(var(--vaiven), calc(var(--caida, 100vh) / 2), 0) rotate(180deg); }
    100% { transform: translate3d(0, var(--caida, 100vh), 0) rotate(360deg); }
}

/* ---------- Trineo ---------- */

.trineo {
    position: absolute;
    top: var(--trineo-top, 7.5rem);
    left: 0;
    z-index: 1;
    pointer-events: none;
    animation: vuelo 22s linear 1.5s infinite both;
}

@keyframes vuelo {
    0% { transform: translate3d(-280px, 40px, 0); }
    40% { transform: translate3d(calc(100vw + 40px), 0, 0); }
    100% { transform: translate3d(calc(100vw + 40px), 0, 0); }
}

.trineo-bote {
    display: inline-flex;
    align-items: flex-end;
    position: relative;
    font-size: 2.4rem;
    line-height: 1;
    color: #ffffff;
    animation: bote 1.6s ease-in-out infinite;
}

.trineo-rienda {
    position: absolute;
    left: 1em;
    right: 0.55em;
    bottom: 0.72em;
    height: 1.5px;
    background: #ffd166;
}

.reno {
    position: relative;
    width: 1.3em;
    height: auto;
    margin-left: -0.1em;
    margin-bottom: 0.12em;
    overflow: visible;
    fill: #ffffff;
}

.reno-patas path,
.reno-astas {
    fill: none;
    stroke: #ffffff;
    stroke-linecap: round;
}

.reno-patas path {
    stroke-width: 2.8;
}

.reno-astas {
    stroke-width: 1.7;
}

.reno-patas {
    animation: galope 0.56s ease-in-out var(--retraso, 0s) infinite alternate;
}

.reno-patas-delanteras {
    transform-origin: 36px 33px;
}

.reno-patas-traseras {
    transform-origin: 15px 33px;
    animation-direction: alternate-reverse;
}

@keyframes galope {
    from { transform: rotate(-22deg); }
    to { transform: rotate(22deg); }
}

.reno-nariz {
    fill: #ff3b30;
    animation: parpadeo 1.2s ease-in-out infinite;
}

@keyframes bote {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-12px) rotate(3deg); }
}

.trineo-estela {
    position: absolute;
    top: 55%;
    width: 8px;
    height: 8px;
    background: #ffd166;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    animation: chispear 1s ease-in-out infinite;
}

.trineo-estela:nth-child(1) { left: -16px; }
.trineo-estela:nth-child(2) { left: -36px; top: 30%; animation-delay: 0.3s; }
.trineo-estela:nth-child(3) { left: -58px; top: 65%; animation-delay: 0.6s; }

/* ---------- Título ---------- */

[data-navidad-escena] h1,
[data-navidad-escena] h2 {
    position: relative;
}

.palabra {
    display: inline-block;
}

.fx-on .palabra {
    animation: palabra-entra 520ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) both;
}

@keyframes palabra-entra {
    0% { opacity: 0; transform: translateY(18px) scale(0.92) rotate(-3deg); }
    65% { opacity: 1; transform: translateY(-4px) scale(1.04) rotate(1deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

.chispa {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #ffd166;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0;
}

.fx-on .chispa {
    animation: chispear 2.75s ease-in-out infinite;
}

@keyframes chispear {
    0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.1) rotate(90deg); }
}

/* ---------- Puertas de calendario ---------- */

[data-noche] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

[data-dia] {
    position: relative;
    perspective: 300px;
}

.puerta {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #ffffff;
    background: #d6322c;
    border-radius: inherit;
    transform-origin: left center;
    backface-visibility: hidden;
    transition: transform 420ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}

.is-abierta .puerta {
    transform: rotateY(-180deg);
}

.puerta-cerrada {
    background: #5d6f6a;
}

/* ---------- Noches sin encargos: sello y texto en rojo ---------- */

[data-noche].is-cerrado {
    position: relative;
    border-color: rgba(255, 107, 96, 0.55);
    background-color: rgba(0, 0, 0, 0.12);
}

[data-noche].is-cerrado [data-plazo] {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ff8a80;
}

[data-noche].is-cerrado::after {
    content: attr(data-sello);
    position: absolute;
    top: -12px;
    right: -8px;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ffffff;
    background: #d6322c;
    border: 2px solid #ffffff;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transform: rotate(8deg);
}

.fx-on .fx-visible [data-noche].is-cerrado::after {
    animation: sello 380ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) 500ms both;
}

@keyframes sello {
    0% { opacity: 0; transform: rotate(8deg) scale(1.6); }
    70% { opacity: 1; transform: rotate(8deg) scale(0.94); }
    100% { opacity: 1; transform: rotate(8deg) scale(1); }
}

@keyframes pop {
    0% { opacity: 0; transform: scale(0.9); }
    60% { opacity: 1; transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}

/* ---------- Platos ---------- */

.fx-on .plato {
    opacity: 0;
    transform: translateY(14px);
    transition:
        opacity 260ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) calc(var(--i, 0) * 60ms),
        transform 260ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) calc(var(--i, 0) * 60ms);
}

.fx-on .fx-visible .plato {
    opacity: 1;
    transform: translateY(0);
}

.fx-on .fx-visible .plato-precio {
    animation: pop 420ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) calc(var(--i, 0) * 60ms + 120ms) both;
}

.plato {
    cursor: pointer;
    touch-action: manipulation;
}

/* ---------- Títulos de categoría ---------- */

.categoria h2 i {
    margin-right: 0.5rem;
    font-size: 0.7em;
    color: var(--primary-color);
}

.fx-on .categoria h2 i {
    display: inline-block;
}

.fx-on .categoria.fx-visible h2 i {
    animation: icono-baila 700ms ease-in-out 1;
}

@keyframes icono-baila {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-18deg) scale(1.2); }
    55% { transform: rotate(14deg) scale(1.1); }
    80% { transform: rotate(-6deg) scale(1.03); }
}

.fx-on .categoria h2::after {
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 500ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) 150ms;
}

.fx-on .categoria.fx-visible h2::after {
    transform: scaleX(1);
}

/* ---------- Botones ---------- */

.navidad-cta,
.pedido-telefono {
    position: relative;
}

.navidad-cta,
.barra-encargo,
.pedido-telefono {
    overflow: hidden;
}

.fx-on .navidad-cta::after,
.fx-on .barra-encargo::after,
.fx-on .pedido-telefono::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    pointer-events: none;
    animation: brillo 4.5s ease-in-out infinite;
}

@keyframes brillo {
    0%, 60% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.fx-on .navidad-cta .fa-gift,
.fx-on .barra-encargo i,
.fx-on .pedido-telefono i {
    display: inline-block;
    animation: sacudir 3.5s ease-in-out infinite;
}

@keyframes sacudir {
    0%, 78%, 100% { transform: rotate(0deg); }
    82% { transform: rotate(-16deg); }
    86% { transform: rotate(14deg); }
    90% { transform: rotate(-10deg); }
    94% { transform: rotate(6deg); }
}

/* ---------- Estrellitas sueltas ---------- */

.estrella {
    position: fixed;
    z-index: 1100;
    width: 20px;
    height: 20px;
    pointer-events: none;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

/* ---------- Navbar de la home ---------- */

.fx-on .nav-navidad .fa-snowflake {
    display: inline-block;
    animation: girar 6s linear infinite;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

@media (hover: hover) and (pointer: fine) {
    .plato:hover .plato-precio {
        transform: scale(1.12) rotate(-3deg);
    }

    .plato-precio {
        transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
    }

    .fx-on .categoria:hover h2 i {
        animation: icono-baila 700ms ease-in-out 1;
    }
}

.plato:active {
    transform: scale(0.99);
}

@media (max-width: 768px) {
    [data-navidad-escena] {
        padding-bottom: 7rem;
    }

    .colina {
        height: 105px;
    }

    .trineo {
        top: var(--trineo-top-movil, 7rem);
    }

    .trineo-bote {
        font-size: 1.8rem;
    }
}

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

    .puerta {
        transition: opacity 200ms ease;
    }

    .is-abierta .puerta {
        transform: none;
        opacity: 0;
    }
}
