/* ---------------------------------------------------------------
    Divisiones P&P - Hoja de estilos principal (mobile first)
    Autor: Leonardo Bravo • Mayo 2025
------------------------------------------------------------------
    Estructura clave del layout (secciones):
    0. Reset & helpers
    1. Global (tipografía, contenedores, utilidades)
    2. Header & Hero
    3. Hero slider (Swiper) + botones
    4. KPIs
    5. Portfolio grid & filtros
    6. Servicios (tarjetas)
    7. Proceso (steps)
    8. Clientes (logos)
    9. CTA Whatsapp
    10. Contacto & formulario
    11. Footer
    12. Media-queries (≥600 px, ≥900 px, ≥1200 px)

------------------------------------------------------------------ */


/* =============================== RESET & HELPERS =============================== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html{scroll-behavior:smooth}
body{font-family:'Poppins', system-ui, sans-serif; font-size:16px; line-height:1.6;color:#222; background:#fff;}

/* Offset for the sticky header */
section[id] {
  scroll-margin-top: 5rem; /* Adjust this value to match header height */
}

img, svg{max-width:100%;display:block; height:auto;}
a{text-decoration:none; color:inherit;}
ul{list-style:none;}

:root{
    /* Branding */
    --clr-primary: #C12F30;
    --clr-primary-light: #d64849;
    --clr-accent: #000000;
    --clr-dark: #000000;
    --clr-gray: #666666;
    --clr-bg: #f7f9fc;

    /* Sizing */
    --header-height: 5rem; /* Ajustable a la altura del header */
    --container-w: 90rem; /* 1440px máx */
    --gap:1.25rem; /* 20px */
    --radius:0.5rem; /* 8px */
    --shadow:0 5px 25px rgba(0,0,0,.08);


}

/* Utilidades */
.container{width:90%; max-width:var(--container-w); margin-inline:auto;}
.center-text{text-align:center}
.flex{display:flex; gap:var(--gap)}
.between{justify-content:space-between}
.align-center{align-items:center}
.grid-3{display:grid; grid-template-columns:repeat(3,1fr); gap:var(--gap)}
.grid-4{display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:var(--gap)}
.btn{display:inline-block; padding:0.75rem 1.5rem; border-radius:var(--radius); font-weight:600; transition:background .25s, color .25s;}
.btn-primary{background:var(--clr-primary); color:#fff}
.btn-primary:hover{background:var(--clr-primary-light)}
.btn-outline{border:2px solid var(--clr-primary); color:var(--clr-primary)}
.btn-outline:hover{background:var(--clr-primary); color:#fff}
.btn-small{padding: .5rem 1rem; font-size:0.9rem}
.section-bg{background:var(--clr-bg)}
.section-bg-darker{background:#e9eef4}


/* ======================== 0.5 TOP BAR ======================== */
.top-bar{
    background: #2d2d2d;
    color: #fff;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    position: relative;
    z-index: 1001;
    transition: opacity 0.3s ease;
}
.top-bar.transparent,
.site-header.transparent{
    opacity: 0.8;
}
.top-bar:hover,
.site-header:hover {
    background-color: #2d2d2d;
}
.top-bar a{
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}
.top-bar a:hover{
    color: var(--clr-primary);
}
.contact-info-top span{
    font-weight: 500;
}
.contact-center{
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.email-icon{
    color: var(--clr-primary);
    font-style: normal;
    font-size: 1.1rem;
    vertical-align: middle;
}
.contact-right{
    gap: 1.5rem;
}
.social-icons{
    gap: 0.75rem;
}
.social-icons a{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--clr-primary);
    transition: background 0.3s ease, transform 0.3s ease;
}
.social-icons a:hover{
    background: var(--clr-primary-light);
    transform: translateY(-2px);
}
.social-icon{
    width: 16px; /* A good size for the icon */
    height: 16px; /* Maintain aspect ratio */
    filter: invert(1); /* Since the background is dark, this makes the SVG white */
}

/* Mobile responsive top bar */
@media (max-width: 56.24em){ /* < 900px */
    .top-bar{
        font-size: 0.75rem;
        padding: 0.4rem 0;
    }
    .hero-slider{
        margin-top: -7.5rem;
    }
    .contact-center{
        display: none; /* Hide email on mobile */
    }
    .contact-right{
        gap: 1rem;
    }
    .social-icons a{
        width: 25px;
        height: 25px;
    }
}

/* ======================== 1. HEADER & HERO ======================== */
.site-header{
    position:sticky; 
    top:0; 
    z-index:999; 
    background:#2d2d2d; 
    box-shadow:0 2px 8px rgba(0,0,0,.3); 
    padding:1rem 0;
    transition: opacity 0.3s ease;
}
.logo{
    font-weight:700;
    font-size:1.25rem;
    color:#fff;
    display: flex;
    align-items: center;
}
.logo span{color:var(--clr-accent)}
.logo-img{
    height: 45px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    transition: opacity 0.3s ease;
}
.logo-img:hover{
    opacity: 0.9;
}
.primary-nav {
    position: relative;
}
.primary-nav .nav-list{
    display:none;
    flex-direction:column;
    gap:1rem;
    padding: 1rem 1.5rem;
    background: #2d2d2d;
    position:absolute;
    top:calc(100% + 5px);
    right:0;
    width:240px;
    border-radius:var(--radius);
    box-shadow:var(--shadow)
}
.primary-nav .nav-list.open{display:flex}
.primary-nav .nav-list a{
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 0.5rem 0;
    color: #fff;
    transition: color 0.3s ease;
}
.primary-nav .nav-list a:hover{
    color: var(--clr-primary);
}
.primary-nav .nav-list a.active {
    color: var(--clr-primary);
}
.menu-toggle{
    background:none;
    border:none;
    font-size:1.5rem;
    cursor:pointer;
    color:#fff
}

/* Desktop nav */
@media (min-width: 56.25em){ /* 900 px */
    .site-header{padding:1.25rem 0;}
    .logo-img{
        height: 50px;
        max-width: 250px;
    }
    .primary-nav .nav-list{
        display:flex;
        flex-direction:row;
        position:static;
        width:auto;
        background:none;
        box-shadow:none;
        padding:0;
        gap: 2rem;
    }
    .primary-nav .nav-list a{
        padding: 0;
        position: relative;
    }
    .primary-nav .nav-list a::after{
        content: '';
        position: absolute;
        bottom: -5px;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--clr-primary);
        transition: width 0.3s ease;
    }
    .primary-nav .nav-list a:hover::after{
        width: 100%;
    }
    .primary-nav .nav-list a.active::after {
        width: 100%;
    }
    .menu-toggle{display:none}
}

/* Large desktop optimization */
@media (min-width: 75em){ /* 1200 px */
    .logo-img{
        height: 55px;
        max-width: 280px;
    }
    .primary-nav .nav-list{
        gap: 2.5rem;
    }
}

/* =============================== HERO SLIDER FULLSCREEN =============================== */
.hero-slider{
    height: 100vh;
    margin-top: -8.5rem; /* Ajusta este valor a la altura combinada de top-bar y site-header */
}
.hero-slide{height:100%; background-size:cover; background-position:center; position:relative}
.hero-slide .overlay{position:absolute; inset:0; background:rgba(0,0,0,.4); z-index:1}
.slide-content{position:absolute; inset:0; display:flex;flex-direction:column; justify-content:center; align-items:center;color:#fff;padding:2rem ;z-index:2}
.slide-content h1{font-size:clamp(1.8rem, 4vw, 3.5rem); line-height:1.2; margin-bottom:1.5rem; text-align:center; max-width:900px}
.slide-content a{z-index:2}


/* Swiper controles */
.swiper-pagination-bullet{background:#fff; opacity: .6}
.swiper-pagination-bullet-active{opacity:1}
.swiper-button-next,
.swiper-button-prev{
    color:var(--clr-primary) !important;
}
.swiper-button-next:after,
.swiper-button-prev:after{
    color:var(--clr-primary) !important;
}

/* ======================== 3. KPIs ========================= */
.kpis{padding:3rem 0}
.kpi{display:flex; flex-direction:column; align-items:center}
.kpi strong{font-size:2.5rem; color:var(--clr-primary);font-weight:700}
.kpi span{font-size:1rem;color:var(--clr-gray)}

/* ======================== 4. PORTFOLIO ========================= */
.portfolio{padding:4rem 0}
.portfolio-filter{margin-bottom:2rem; flex-wrap: wrap; justify-content: center}
.portfolio-filter li{cursor:pointer; padding: .5rem 1rem;  border-radius:var(--radius); font-weight:500; color:var(--clr-dark); transition:background .2s}
.portfolio-filter li.active, .portfolio-filter li:hover{background:var(--clr-primary); color:#fff}

.portfolio-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .3s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
}

.main-image {
    width: 100%;
    /* Default aspect ratio for horizontal images */
    aspect-ratio: 16 / 10;
    overflow: hidden;
    transition: aspect-ratio 0.4s ease-in-out; /* Animate the container change */
}

.main-image.is-vertical {
    /* Aspect ratio for vertical images */
    aspect-ratio: 3 / 4.2;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnail-images {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f0f0f0;
}

.thumbnail {
    width: 25%;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity .3s ease, transform .3s ease;
    border: 2px solid transparent;
}

.thumbnail:hover, .thumbnail.active-thumb {
    opacity: 1;
    transform: scale(1.05);
    border-color: var(--clr-primary);
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
    color: var(--clr-primary);
}

.project-info p {
    font-size: 0.95rem;
    color: var(--clr-gray);
    margin-bottom: 1rem;
}

.project-category {
    display: inline-block;
    background: var(--clr-primary-light);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.porfolio-item figcaption{padding: .75rem; font-size: .95rem; background:#fff}
.btn-outline{margin-top:2rem}

/* ======================== 5. SERVICIOS ========================= */
.services{padding:4rem 0}
.service-grid{display:grid; gap:var(--gap); grid-template-columns:1fr}
.card{background:#fff; border-radius:var(--radius);padding:2rem; box-shadow:var(--shadow);text-align:center;transition:transform .25s}
.card:hover{transform:translateY(-4px)}
.card .icon{width:60px; height:60px; margin-inline:auto; margin-bottom:1rem}
.service-image {
    max-width: 150px;
    margin-inline: auto;
    margin-bottom: 1.5rem;
}
.card h3{margin-bottom: .5rem; color:var(--clr-primary)}
.card p{color:var(--clr-gray); font-size: .95rem}

/* =============================== PRODUCTOS DESTACADOS - CATEGORIAS =============================== */
.product-categories {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding: 10px 0 1rem 0; /* Space for hover effect and scrollbar */
    overflow-x: auto;
    /* Hiding scrollbar for a cleaner look */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.product-categories::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.category-card {
    flex: 0 0 100px; /* Base width, prevents shrinking */
    height: 130px; /* Base height */
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px rgba(0,0,0, .05);
    border: 1px solid #eee;
    text-align: center;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.category-card.active-category {
    border-color: var(--clr-primary);
    box-shadow: 0 8px 30px rgba(193, 47, 48, 0.2);
}

.category-card img {
    height: 50px; /* Fixed height for logos */
    width: auto;
    margin-bottom: 1rem;
    object-fit: contain;
}

.category-card span {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--clr-dark);
    line-height: 1.2;
}

.category-card.active-category span {
    color: var(--clr-primary);
}

/* --- Product Grid --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.product-item {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px rgba(0,0,0, .05);
    border: 1px solid #eee;
    text-align: center;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: none; /* Hidden by default, JS will show them */
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.product-image {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 1rem;
    background: #fff;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-details {
    padding: 1rem;
    background: #fdfdfd;
}

.product-details h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

/* --- Color Swatches --- */
.color-swatches {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    justify-content: center;
    min-height: 34px; /* Altura del swatch (30px) + borde (2px * 2) */
}

.swatch {
    width: 30px;
    height: 30px;
    border-radius: 4px; /* From circle to square */
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    object-fit: contain; /* Changed from cover to contain */
    background-color: #fff; /* Added background for consistency */
    padding: 2px; /* Added padding to prevent overflow */
}

.swatch:hover {
    border-color: #999;
    transform: translateY(-2px);
}

.swatch.active-swatch {
    border: 2px solid var(--clr-primary); /* Changed to primary color */
    box-shadow: none; /* Removed shadow for a cleaner look */
}

/* ======================== 6. PROCESO ========================= */



/* ======================== CLIENTES EN MARQUEE ========================= */
.client-marquee{
    overflow:hidden;
    width:100%;
    padding-block:1rem; /* Reduced padding for tighter rows */
}
.client-marquee .track{
    display:flex;
    align-items:center;
    gap:4rem;
    animation:scroll 40s linear infinite;
}
/* New style for the reverse marquee */
.client-marquee-reverse .track{
    animation:scroll-reverse 40s linear infinite;
}

/* Todos los logos misma caja (alto 80px) */
.client-marquee img{
    height:70px; /* Slightly smaller logos */
    width:auto;
    flex:0 0 auto;
    object-fit:contain;
    filter:grayscale(100%);
    opacity: .8;
    transition:filter .3s, opacity .3s;
}
/* Vigorizamos al pasar el cursor */
.client-marquee img:hover{
    filter:none;
    opacity:1;
}
/* Animación: mueve media pista (-50%) porque la duplicamos */
@keyframes scroll{
    from{transform:translateX(0);}
    to {transform:translateX(-50%);}
}

/* New keyframe for reverse scroll */
@keyframes scroll-reverse{
    from{transform:translateX(-50%);}
    to {transform:translateX(0%);}
}

/* ======================== 7. CLIENTES ========================= */
.clients{padding:4rem 0}
.client-logos img{filter:grayscale(100%); opacity: .75; transition:filter .3s; opacity: .3s}
.client-logos img:hover{filter:none; opacity:1}


/* ======================== 8. CTA WHATSAPP ========================= */
.cta-whatsapp{background:var(--clr-primary); color: #fff; padding:3rem 0; text-align:center}
.cta-whatsapp h2{font-size: 1.75rem; margin-bottom:1rem}
.cta-whatsapp p{margin-bottom: 1.5rem}
.cta-whatsapp .btn-outline {
    background: #fff; /* Fondo blanco */
    color: var(--clr-primary); /* Texto rojo */
    border-color: #fff;
}
.cta-whatsapp .btn-outline:hover {
    background: transparent;
    color: #fff;
    border-color: #fff;
}
.btn-whatsapp{background:var(--clr-accent);color:#fff}
.btn-whatssapp:hover{background: #ff844f}


/* ======================== 9. CONTACTO ========================= */
.contact{padding:4rem 0}
.grid-contact{display:grid; gap:var(--gap); grid-template-columns:1fr}
.contact-info{display:flex; flex-direction:column; gap:1rem}
.contact-info h2{color:var(--clr-primary)}
.contact-list li{margin-bottom: .5rem; font-size: .95rem}
.contact-form{display:flex; flex-direction:column;gap:1rem; background:var(--clr-bg); padding:2rem; border-radius:var(--radius)}
.contact-form label{font-size: .9rem; color:var(--clar-dark)}
.contact-form input, .contact-form textarea{padding: .75rem;border:1px solid #ddd; border-radius:var(--radius);font-family:inherit; font-size:1rem}
.contact-form button{align-self:flex-start}

.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    height: 450px;
    box-shadow: var(--shadow);
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ======================== 10. FOOTER ========================= */
.site-footer{padding:2rem 0; font-size: .9rem; color:var(--clr-gray)}
.site-footer a{color:var(--clr-primary)}


/* ======================== 12. MEDIA-QUERIES ========================= */
@media(min-width: 37.5em){ /* 600 px */
    .portfolio-grid{columns:2 310px}
    .service-grid{grid-template-columns:repeat(2,1fr)}
    .grid-contact{grid-template-columns:1fr 1fr}
}

@media(min-width: 56.25em){ /* 900 px */
    .service-grid{grid-template-columns:repeat(3, 1fr)}
    .grid-contact{grid-template-columns:1fr 1fr}
    .hero-slider{height:100vh; margin-top:-8.5rem;}
}

@media(min-width: 75em){ /* 1200 px */
    .portfolio-grid{columns:3 310px}
    .hero-slider{height:100vh; margin-top:-8.5rem;}

    .category-card {
        flex-basis: 120px; /* xl width */
        height: 150px; /* xl height */
        padding: 1.5rem;
    }
}

@media(min-width: 90em){ /* 1440 px */
    .category-card {
        flex-basis: 140px; /* 2xl width */
        height: 170px; /* 2xl height */
    }
}

.products {
    padding: 4rem 0;
    background-color: var(--clr-bg);
}

.contact-info-text h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--clr-dark);
}

.contact-info-text p {
    margin-bottom: 1.5rem;
    color: var(--clr-gray);
}

.contact-list {
    list-style: none;
    padding: 0;
    margin-bottom: 2rem;
}

.contact-list li {
    margin-bottom: 1rem;
    color: var(--clr-gray);
}

.contact-list a {
    color: var(--clr-primary);
    text-decoration: none;
}

.contact-info-text h4 {
    margin-bottom: 1rem;
}

.social-icons-contact {
    display: flex;
    gap: 1rem;
}

.social-icons-contact a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--clr-primary);
    color: #fff;
    transition: background 0.3s ease;
}

.social-icons-contact a .social-icon {
    filter: invert(100%);
    width: 20px;
    height: 20px;
}

.social-icons-contact a:hover {
    background: var(--clr-primary-light);
}

.contact-form{display:flex; flex-direction:column;gap:1rem; background: #fff; padding:2rem; border-radius:var(--radius)}

.form-group {
    display: flex;
    flex-direction: column;
}

.contact-form label{font-size: .9rem; color: var(--clr-gray); margin-bottom: 0.5rem;}
.contact-form input, .contact-form textarea{padding: .75rem;border:1px solid #ddd; border-radius:var(--radius);font-family:inherit; font-size:1rem}
.contact-form button{align-self:flex-start}

.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    height: 450px;
    box-shadow: var(--shadow);
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: 0;
}