/* ==========================================================================
   PDH Refrigeración — Design System
   Tokens: pdh navy / celeste blue / frost white / steel gray / frost-glow cyan
   ========================================================================== */

:root {
    --pdh: #1c2331;
    --pdh-light: #2a3447;
    --celeste: #2081C3;
    --frost: #EAF6FB;
    --steel: #8B98A9;
    --frost-glow: #5FD4F4;
    --nav-h: 76px;
}

* { 
    scroll-margin-top: var(--nav-h); 
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.font-mono { 
    font-family: 'IBM Plex Mono', ui-monospace, monospace; 
}

body {
    overflow-x: hidden;
}

@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--celeste), var(--frost-glow));
    z-index: 60;
    transition: width 0.1s linear;
}

/* ---------- Reveal on scroll ---------- */
.reveal {
    opacity: 0;
    transform: translate3d(0, 36px, 0); /* Obliga a usar la Tarjeta Gráfica */
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}
.reveal.active { 
    opacity: 1; 
    transform: translate3d(0, 0, 0); 
}

.reveal-scale { 
    opacity: 0; 
    transform: scale3d(0.94, 0.94, 1); /* Aceleración GPU para el zoom */
    transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1); 
    will-change: transform, opacity;
}
.reveal-scale.active { 
    opacity: 1; 
    transform: scale3d(1, 1, 1); 
}

.reveal-left { 
    opacity: 0; 
    transform: translate3d(-40px, 0, 0); 
    transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1); 
    will-change: transform, opacity;
}
.reveal-left.active { 
    opacity: 1; 
    transform: translate3d(0, 0, 0); 
}

.reveal-right { 
    opacity: 0; 
    transform: translate3d(40px, 0, 0); 
    transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1); 
    will-change: transform, opacity;
}
.reveal-right.active { 
    opacity: 1; 
    transform: translate3d(0, 0, 0); 
}
/* ---------- WhatsApp button ---------- */

.wsp-btn {
    position: fixed !important;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 4rem;
    height: 4rem;
    z-index: 9999;

    /* Mantiene el botón en su propia capa */
    transform: translateZ(0);

    /* Evita que una animación de otro elemento lo mueva */
    will-change: transform;
}

.wsp-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;

    background-color: rgba(37, 211, 102, 0.7);

    z-index: -1;

    animation: pulse-wsp-optimized 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;

    will-change: transform, opacity;
}

@keyframes pulse-wsp-optimized {

    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    70% {
        transform: scale(1.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* WhatsApp en celulares */
@media (max-width: 767px) {

    .wsp-btn {
        bottom: 1rem;
        right: 1rem;
        width: 3.5rem;
        height: 3.5rem;
    }

}
/* ---------- Glow buttons + magnetic hover ---------- */
.btn-glow {
    position: relative;
    overflow: hidden;
}
.btn-glow::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
    will-change: transform; /* Optimización de fluidez para la GPU */
}
.btn-glow:hover::before { transform: translateX(120%); }
.btn-glow:hover { box-shadow: 0 0 25px rgba(32, 129, 195, 0.55), 0 8px 20px rgba(0,0,0,0.15); }

/* ---------- Technical frame (signature element) ---------- */
.tech-frame {
    position: relative;
    border: 1px solid rgba(32, 129, 195, 0.25);
}
.tech-frame::before,
.tech-frame::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: var(--celeste);
    border-style: solid;
    opacity: 0.8;
}
.tech-frame::before {
    top: -1px; left: -1px;
    border-width: 2px 0 0 2px;
}
.tech-frame::after {
    bottom: -1px; right: -1px;
    border-width: 0 2px 2px 0;
}

.tech-frame-light::before,
.tech-frame-light::after { border-color: var(--frost-glow); }

/* ---------- Blueprint grid backdrop ---------- */
.blueprint-grid {
    background-image:
        linear-gradient(rgba(95, 212, 244, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(95, 212, 244, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
}

/* ---------- Frost particle canvas ---------- */
#frost-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ---------- Eyebrow label ---------- */
.eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.2em;
    font-size: 0.72rem;
    font-weight: 600;
}
.eyebrow::before {
    content: '// ';
    color: var(--celeste);
}

/* ---------- Stat counters ---------- */
.stat-number {
    font-family: 'IBM Plex Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* ---------- Timeline (process) ---------- */
.timeline-line {
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform; /* Optimización de fluidez */
}
.timeline-line.active { transform: scaleY(1); }

.timeline-node {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.5s ease;
    will-change: transform, background-color; /* Optimización de fluidez */
}
.timeline-item.active .timeline-node {
    transform: scale(1);
    background-color: var(--celeste);
}

/* ---------- Mobile menu ---------- */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
#mobile-menu.open { max-height: 420px; }

.hamburger-line {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    transform-origin: center;
    will-change: transform, opacity; /* Optimización de fluidez */
}
#menu-toggle.open .line-1 { transform: translateY(7px) rotate(45deg); }
#menu-toggle.open .line-2 { opacity: 0; }
#menu-toggle.open .line-3 { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Nav active underline ---------- */
.nav-link { position: relative; }
.nav-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: -6px;
    width: 0%;
    height: 2px;
    background: var(--celeste);
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-link:hover::after,
.nav-link.text-celeste::after { width: 100%; }
/* ---------- Form states ---------- */
.form-msg {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease;
}
.form-msg.show { max-height: 100px; opacity: 1; }

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Card hover lift with glow ---------- */
.lift-card {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.5s ease;
    will-change: transform, box-shadow; /* Aceleración GPU para sombra y movimiento */
}
.lift-card:hover {
    transform: translate3d(0, -10px, 0); /* translate3d fuerza la máxima aceleración por hardware */
    box-shadow: 0 20px 40px rgba(28, 35, 49, 0.12);
    border-color: rgba(32, 129, 195, 0.35);
}

/* ---------- Icon badge ---------- */
.icon-badge {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.4s ease;
    will-change: transform; 
}
.icon-badge svg {
    transition: stroke 0.4s ease; /* Transición fluida para el cambio de color del ícono */
}
.lift-card:hover .icon-badge {
    transform: scale3d(1.1, 1.1, 1) rotate(-4deg); /* scale3d para GPU */
    background-color: var(--celeste);
}
.lift-card:hover .icon-badge svg { 
    stroke: white; 
}

/* ---------- Contenedor Marquee (SOLUCIÓN AL DESBORDAMIENTO / ZOOM OUT) ---------- */
.marquee-container,
.marquee-wrapper {
    overflow: hidden !important; /* Corta cualquier elemento que intente salir de la pantalla */
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* ---------- Marquee (clients/industries strip) ---------- */
.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 28s linear infinite;
    will-change: transform; /* Forzar renderizado por aceleración de hardware para cero tirones */
}
.marquee-track:hover { animation-play-state: paused; }
@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---------- Header shrink on scroll ---------- */
nav.shrink { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }

/* ---------- Utility: gradient text ---------- */
.text-gradient {
    background: linear-gradient(120deg, var(--celeste), var(--frost-glow));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
/* ---------- Animaciones del Carrito ---------- */
@keyframes fadeInUpCart {
    from { 
        opacity: 0; 
        transform: translateY(15px) scale(0.98); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.animate-cart-item {
    animation: fadeInUpCart 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity;
}

/* Retraso en cascada para la lista del carrito */
#lista-carrito li:nth-child(1) { animation-delay: 0.05s; }
#lista-carrito li:nth-child(2) { animation-delay: 0.1s; }
#lista-carrito li:nth-child(3) { animation-delay: 0.15s; }
#lista-carrito li:nth-child(4) { animation-delay: 0.2s; }
#lista-carrito li:nth-child(5) { animation-delay: 0.25s; }

/* Scrollbar personalizado y sutil para la lista del carrito */
#lista-carrito::-webkit-scrollbar {
    width: 6px;
}
#lista-carrito::-webkit-scrollbar-track {
    background: transparent;
}
#lista-carrito::-webkit-scrollbar-thumb {
    background-color: var(--steel);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
#lista-carrito::-webkit-scrollbar-thumb:hover {
    background-color: var(--celeste);
}
/* ---------- Animación fluida para el Checkbox del menú ---------- */
@keyframes scaleInCheck {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes drawCheckPath {
    0% { stroke-dasharray: 22; stroke-dashoffset: 22; }
    100% { stroke-dasharray: 22; stroke-dashoffset: 0; }
}

.check-icon {
    /* El efecto 'pop' elástico */
    animation: scaleInCheck 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: center;
    will-change: transform, opacity;
}

.check-icon path {
    /* El efecto de dibujo de la línea */
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: drawCheckPath 0.3s ease-out 0.1s forwards;
}
/* Bloquear el color del texto en blanco cuando el botón está activo (marcado) */
button.bg-celeste:hover, 
button.bg-celeste:focus {
    color: #ffffff !important;
}

/* Asegurar que el SVG también mantenga su color y no desaparezca */
button.bg-celeste:hover svg.check-icon {
    color: #ffffff !important;
}
/* ---------- Menú de categorías (acordeón anidado) ---------- */
.menu-categorias-lista {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.menu-categorias-lista .menu-categorias-lista {
    padding-left: 1.1rem;
    border-left: 1px dashed rgba(32, 129, 195, 0.25);
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;
}
.menu-categorias-panel details > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    font-weight: 700;
    color: var(--pdh);
    font-size: 0.92rem;
}
.menu-categorias-panel details > summary::-webkit-details-marker { display: none; }
.menu-categorias-panel details > summary::before {
    content: '▸';
    color: var(--celeste);
    transition: transform 0.25s ease;
    font-size: 0.75rem;
}
.menu-categorias-panel details[open] > summary::before { transform: rotate(90deg); }

.menu-cat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.25rem;
    font-size: 0.88rem;
    color: var(--steel);
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.menu-cat-item:hover { background-color: var(--frost); color: var(--celeste); }

.menu-cat-icono {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}
/* ---------- Botones de categoría (menú de Productos): más legibles en cualquier nivel ---------- */
#lista-categorias .categoria-btn {
    font-size: 0.92rem;
    font-weight: 600;
    color: #4b5563; /* gray-600 más oscuro, mejor contraste */
    line-height: 1.3;
}
#lista-categorias .categoria-btn:hover {
    color: var(--celeste);
}

/* Cuando la categoría está seleccionada (fondo celeste que pone el JS),
   el texto se queda SIEMPRE blanco, incluso en hover, para que no
   se "funda" con el fondo */
#lista-categorias .categoria-btn.bg-celeste,
#lista-categorias .categoria-btn.bg-celeste:hover {
    color: #ffffff !important;
}
/* Estilo para el contenedor de cada producto en el carrito */
.item-carrito {
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.4s ease-out; /* Esta es la clave para la animación */
    overflow: hidden;
}

/* Clase que agregaremos con JS cuando se presione la X */
.item-carrito.eliminando {
    opacity: 0;
    transform: translateX(100%);
    margin-bottom: -50px; /* Para que los demás productos suban suavemente */
}

/* Estilo para la "X" */
.btn-eliminar-producto {
    background: none;
    border: none;
    color: #ff4d4d; /* Un rojo suave y elegante */
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
}

/* ============================================================
   CONTROLES DEL MENÚ MÓVIL
   ============================================================ */

/* Ocultos por defecto en escritorio */
.controles-moviles {
    display: none;
    align-items: center;
    gap: 15px;
}

/* Mostrar solamente en tablets y celulares */
@media (max-width: 767px) {

    .controles-moviles {
        display: flex;
    }

}

/* Botones del carrito y menú */
.btn-abrir-carrito,
.btn-menu-lateral {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}
/* ==========================================================================
   Ajustes de Tarjetas de Productos y Botones Estilizados
   ========================================================================== */

/* Elevación suave y límites de texto */
.lift-card {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, box-shadow;
}

.lift-card:hover {
    transform: translateY(-4px);
}

/* Scrollbar personalizado para la lista de categorías */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--celeste);
}

/* Transición fluida para botones interactivos */
.lift-card button,
.lift-card a {
    letter-spacing: 0.01em;
    backface-visibility: hidden;
}
@keyframes scaleIn { to { transform: scale(1); } }

/* ============================================================
   ACORDEÓN DE CATEGORÍAS DE PRODUCTOS
   ============================================================ */

.categoria-acordeon {
    width: 100%;
}

.categoria-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.categoria-opcion {
    flex: 1;
    min-width: 0;
}

.categoria-toggle {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    margin-left: 6px;

    border: none;
    background: transparent;

    cursor: pointer;

    color: #64748b;

    border-radius: 6px;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.categoria-toggle:hover {
    background-color: #f1f5f9;
    color: #0f4c5c;
}

.flecha-acordeon {
    display: inline-block;

    font-size: 22px;
    line-height: 1;

    transition: transform 0.25s ease;
}


/* ------------------------------------------------------------
   SUBCATEGORÍAS CERRADAS
   ------------------------------------------------------------ */

.subcategorias-acordeon {
    display: none;

    flex-direction: column;
    gap: 10px;

    margin-left: 24px;
    margin-top: 8px;

    padding-left: 12px;

    border-left: 2px solid #f1f5f9;
}


/* ------------------------------------------------------------
   SUBCATEGORÍAS ABIERTAS
   ------------------------------------------------------------ */

.categoria-acordeon.abierto .subcategorias-acordeon {
    display: flex;
}


/* ------------------------------------------------------------
   ROTACIÓN DE LA FLECHA
   ------------------------------------------------------------ */

.categoria-acordeon.abierto .flecha-acordeon {
    transform: rotate(90deg);
}


/* ------------------------------------------------------------
   PEQUEÑA ANIMACIÓN
   ------------------------------------------------------------ */

.categoria-acordeon .subcategorias-acordeon {
    animation: cerrarCategoria 0.15s ease;
}

.categoria-acordeon.abierto .subcategorias-acordeon {
    animation: abrirCategoria 0.2s ease;
}

@keyframes abrirCategoria {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cerrarCategoria {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ---------- Transición fluida del Carrusel Hero ---------- */
.hero-slide {
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 6s ease-out;
    will-change: opacity, transform;
}
.hero-slide.opacity-40 {
    transform: scale(1);
}