/* VARIABLES CSS (PALETA DE COLORES FINAL) */
:root {
    --color-primary-red: #A91F2D;      /* Rojo Principal (CTA) */
    --color-secondary-green: #797645;  /* Verde Oliva (Acentos Naturales) */
    --color-granate-deep: #5A000A;     /* Granate Profundo (Fondos oscuros) */
    --color-accent-pink: #D52044;      /* Rosa Intenso (Detalles) */
    --color-light: #C4C1A7;
    --color-dark: #333333;
    --color-background-light: #fcf8e4; /* Fondo de secciones */
    /* Uso exclusivo de Montserrat como fuente primaria */
    --font-primary: 'Montserrat', sans-serif;
    --font-serif: var(--font-primary);
    --font-sans: var(--font-primary);
}

/* RESET BÁSICO Y TIPOGRAFÍA BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--color-dark);
    line-height: 1.6;
    background-color: var(--color-light);
    scroll-behavior: smooth; /* Desplazamiento suave para UX */
}

h1, h2, h3 {
    font-family: var(--font-serif);
    color: var(--color-primary-red);
    font-weight: 700;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5em; line-height: 1.1; }
h2 { font-size: 2em; }
h3 { font-size: 1.5em; }

.text-center { text-align: center; }

/* LAYOUT GENERAL */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: var(--color-light);
    font-weight: 800;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 900; /* Asegura que el header siempre esté encima */
}

.logo img {
    max-height: 60px; 
    width: auto;
}

/* NAVEGACIÓN */
.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li a {
    text-decoration: none;
    color: var(--color-dark);
    padding: 10px 15px;
    display: block;
    transition: color 0.3s ease;
}

.main-nav ul li a:hover {
    color: var(--color-primary-red);
}

/* BOTÓN DE TOGGLE (Menú Hamburguesa) */
.nav-toggle {
    display: none; /* Ocultar por defecto en escritorio */
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--color-primary-red);
    padding: 5px;
}

/* BOTONES CTA */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.1s ease;
    display: inline-block; /* Permite aplicar margenes verticales y padding consistentemente */
}

.btn:active {
    transform: scale(0.98); /* Feedback táctil para UX */
}

.btn-whatsapp, .btn-hero-large {
    background-color: var(--color-primary-red);
    color: var(--color-light);
}

.btn-whatsapp:hover, .btn-hero-large:hover {
    background-color: var(--color-accent-pink);
}

.btn-hero-large {
    padding: 15px 30px;
    font-size: 1.1em;
    /* Aumentar separación respecto al texto en hero */
    margin-top: 1.5rem; /* 24px por defecto */
}

.btn-whatsapp-small {
    background-color: var(--color-secondary-green);
    color: var(--color-light);
    margin-top: 15px;
    display: inline-block;
    padding: 8px 15px;
    font-size: 0.9em;
}

.btn-whatsapp-small:hover {
    background-color: var(--color-granate-deep);
}

/* BOTÓN DESTACADO (HISTORIA) */
.btn-highlight {
    background-color: var(--color-primary-red);
    color: var(--color-light);
    padding: 12px 28px;
    font-size: 1.05em;
    font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    display: inline-block;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn-highlight:hover,
.btn-highlight:focus {
    background-color: var(--color-accent-pink);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.btn-highlight:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(169, 31, 45, 0.12), 0 12px 28px rgba(0, 0, 0, 0.16);
}

/* Ajustes para que el botón destaque en móviles */
@media (max-width: 768px) {
    .btn-highlight {
        width: 100%;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        display: block;
    }
}


        /* Historia content layout (texto centrado) */
        .historia-content {
            max-width: 900px;
            margin: 0 auto;
            padding: 20px 0;
            text-align: center;
        }
/* Mueve la separación del botón a CSS en la sección Historia */
.historia-content .btn-highlight {
    margin-top: 20px;
}


/* HERO SECTION */
.hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 80px 5%;
    gap: 48px; /* separa el contenido del hero y la imagen */
    background-color: var(--color-background-light); 
    /* Imagen de fondo (cambia al archivo disponible en /img) */
    background-image: url("../img/fondo%20papo_Mesa%20de%20trabajo%201.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative; /* para overlay */
    min-height: 520px; /* hace que el hero sea más alto con la imagen */
}

/* Overlay para mejorar contraste del texto sobre el fondo */
.hero::before {
    content: "";
    position: absolute;
    inset: 0; /* top/right/bottom/left */
    background: rgba(0, 0, 0, 0.30); /* ligera capa oscura */
    z-index: 0;
    border-radius: 0; /* overlay sin bordes para todo el ancho */
}

.hero-content {
    flex: 1 1 50%;
    min-width: 300px;
    max-width: 700px; /* limita anchura del texto para mejor legibilidad */
    position: relative; /* sitúa por delante del overlay */
    z-index: 1;
    color: rgba(var(--color-primary-red), 0.1); /* texto claro sobre fondo oscuro */
}

/* Añade espacio entre el párrafo y el CTA en la sección hero */
.hero-content p {
    margin-bottom: 1.5rem; /* 24px para dar separación consistente */
    color: rgba(var(--color-primary-red), 0.1); /* texto claro sobre fondo oscuro */
}

.hero-image {
    flex: 1 1 40%;
    min-width: 150px;
    text-align: right;
    align-self: center; /* asegura que la imagen se centre verticalmente */
    position: relative; /* sitúa por delante del overlay */
    z-index: 1;
}

/* Ajuste fino para que el titular se vea mejor sobre la imagen */
.hero h1 {
    color: rgba(var(--color-primary-red), 0.1); /* texto claro sobre fondo oscuro */
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.hero-image img {
    max-width: 100%;
    height: auto;
}

/* SECCIÓN PRODUCTOS */
.productos-section {
    padding: 60px 5%;
    text-align: center;
}

.productos-intro {
    margin-bottom: 40px;
    font-size: 1.1em;
    color: var(--color-granate-deep);
}

.productos-grid {
    display: grid;
    gap: 30px;
    /* Aumenta min width para alojar imágenes mucho más grandes sin desbordes */
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.producto-card {
    padding: 30px;
    border: 1px solid #eee;
    border-radius: 12px;
    background-color: var(--color-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    text-align: left;
}

/* Centrar los botones dentro de las tarjetas de producto */
.producto-card .btn-whatsapp-small {
    display: block; /* hace que el botón ocupe su propio bloque */
    margin: 18px auto 0; /* centrado horizontal y separación superior */
    text-align: center;
    min-width: 160px; /* evita que el botón sea muy estrecho */
}

/* En pantallas pequeñas, hace el botón full-width dentro de la tarjeta */
@media (max-width: 480px) {
    .producto-card .btn-whatsapp-small {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
    }
}

.producto-card:hover {
    transform: translateY(-8px); 
    box-shadow: 0 15px 30px rgba(var(--color-primary-red), 0.1); 
}

.producto-card img {
    /* 3x el tamaño anterior: más grande, centrada y con ajuste de aspecto */
    width: 420px; /* 3x de 140px */
    height: 420px; /* 3x de 140px */
    max-width: 100%; /* evita overflow en tarjetas más estrechas */
    object-fit: contain; /* mantiene la proporción sin recortar */
    display: block; /* permite centrar con margin */
    margin: 0 auto 24px; /* centrado horizontal y margen inferior ligeramente mayor */
    transition: transform 0.3s ease; /* para el zoom suave */
}

.producto-card img:hover {
    transform: scale(1.1); /* zoom in al pasar el mouse */
}

.producto-card h3 {
    color: var(--color-primary-red);
    margin-top: 15px;
    font-size: 1.5em;
}


/* SECCIÓN HISTORIA */
.historia-section {
    padding: 60px 5%;
    background-color: var(--color-secondary-green);
    background-image: url("../img/fondo%20papo_Mesa%20de%20trabajo%201.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* parallax effect */
    color: var(--color-light); /* texto claro sobre fondo oscuro */
    text-align: center;
    position: relative; /* para overlay */
    overflow: hidden;
}

/* Overlay para mejorar contraste del texto sobre el fondo */
.historia-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.40); /* overlay para contraste */
    z-index: 0;
}

.historia-section h2 {
    color: var(--color-light);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.historia-content {
    position: relative;
    z-index: 1;
}

.historia-content p {
    max-width: 800px;
    margin: 0 auto 30px auto;
    font-size: 1.1em;
    color: var(--color-light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* SECCIÓN TESTIMONIOS */
.testimonials-section {
    padding: 60px 5%;
    background-color: var(--color-light); 
}

.testimonials-grid {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin-top: 30px;
}

.testimonial-card {
    background-color: rgba(var(--color-secondary-green), 0.1);
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
}

.testimonial-card p {
    font-style: italic;
    color: var(--color-dark);
    margin-bottom: 20px;
}

.testimonial-card footer {
    font-weight: 600;
    color: var(--color-primary-red);
}

/* CONTACTO Y MAPA */
.location-contact-section {
    padding: 60px 5%;
    background-color: var(--color-background-light);
    position: relative; /* para overlay y parallax */
    overflow: hidden;
    /* Imagen de fondo con efecto parallax (desktop) */
    background-image: url("../img/mesa\ con\ cafecitos.jpg");
    background-size: cover;
    background-position: left center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* parallax effect */
    color: var(--color-light); /* texto claro sobre el overlay */
}

.location-contact-section h2 {
    color: var(--color-dark);
}

.location-contact-section p {
    color: var(--color-dark);
}

.contact-grid {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.location-contact-section::before {
    content: "";
    position: absolute;
    inset: 0;

    z-index: 0;
}

.location-contact-section * {
    position: relative; /* Sitúa el contenido por encima del overlay */
    z-index: 1;
}

/* Mobile fallback para parallax */
@media (max-width: 768px) {
    .location-contact-section {
        background-attachment: scroll;
        padding: 40px 4%;
    }
    .location-contact-section::before {
        background: rgba(0,0,0,0.46);
    }
    .contact-info h3 { color: var(--color-light); }
}

.contact-info, .map-container {
    flex: 1 1 45%;
    min-width: 300px;
}

.contact-info h3 {
    color: var(--color-dark);
    margin-bottom: 15px;
}

.contact-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
    color: var(--color-dark);
}

.contact-list li {
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--color-dark);
}

.contact-list a {
    color: var(--color-primary-red);
    text-decoration: none;
}

.map-container {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* FOOTER */
.main-footer {
    background-color: var(--color-granate-deep); /* fallback */
    color: #ffffff; /* texto claro sobre fondo decorativo */
    text-align: center;
    padding: 40px 5%;
    font-size: 0.9em;
    position: relative; /* para overlay */
    overflow: hidden;
    /* Imagen de fondo (sin parallax) */
    background-image: url("../img/fondo%20papo_Mesa%20de%20trabajo%201.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll; /* removed parallax effect */
}

/* Overlay para mejorar contraste del texto sobre la imagen de fondo */
.main-footer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.55) 100%);
    z-index: 0;
}

.main-footer * {
    position: relative; /* elementos por delante del overlay */
    z-index: 1;
}

/* Mobile fallback: background-attachment fixed puede ser problemático en iOS/Android */
@media (max-width: 768px) {
    .main-footer {
        padding: 32px 4%;
    }
    .main-footer::before {
        background: rgba(0,0,0,0.5); /* overlay más simple en móviles */
    }
}

/* BOTÓN FLOTANTE DE WHATSAPP */
.whatsapp-float {
    position: fixed;
    width: 64px;
    height: 64px;
    bottom: 30px;
    right: 30px;
    color: var(--color-light);
    border-radius: 50%;
    text-align: center;
    font-size: 28px;
    line-height: 64px;
    z-index: 1000;
    box-shadow: 0 6px 18px rgba(0,0,0,0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.12s ease;
    cursor: pointer; /* ensure pointer on hover */
}

/* MEDIA QUERIES PARA RESPONSIVE (MÓVIL PRIMERO) */
@media (max-width: 768px) {
    .main-header {
        flex-wrap: wrap;
    }

    .header-cta { 
        display: none; /* Ocultar el CTA del header en móvil (usamos el flotante) */
    }

    .nav-toggle {
        display: block; /* Mostrar el botón de toggle en móvil */
    }

    /* Ocultar menú por defecto y mostrar al hacer toggle */
    .main-nav {
        order: 3; 
        flex-basis: 100%; 
        display: none; 
        border-top: 1px solid #eee;
        padding: 10px 0;
    }

    .main-nav.nav-open {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
    }

    .hero {
        flex-direction: column; 
        text-align: center;
        padding: 40px 4%;
        min-height: 420px; /* reduce la altura del hero en móviles */
    }

    .hero-image {
        margin-top: 0; /* remove extra margin; gap provides spacing */
        order: -1; /* Mueve la imagen arriba del texto en móvil */
        text-align: center; /* Centra la imagen en móvil */
    }

    .productos-section, .location-contact-section, .testimonials-section, .historia-section {
        padding: 40px 4%;
    }

    /* Mobile fallback para parallax en historia */
    .historia-section {
        background-attachment: scroll;
    }

    .historia-section::before {
        background: rgba(0,0,0,0.50); /* overlay más fuerte en móviles */
    }

    .contact-info, .map-container {
        flex: 1 1 100%; /* Una sola columna en móviles */
    }

    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 25px;
        line-height: 50px;
    }

    /* Ajustes responsivos para imágenes de producto en móvil (3x de 110 => 330) */
    .producto-card img {
        width: 330px;
        height: 330px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    /* En pantallas muy pequeñas, 3x de 96 => 288; se limita con max-width */
    .producto-card img {
        width: 288px;
        height: 288px;
        max-width: 100%;
    }
}

/* En móviles, baja el min-width de la grid para que las tarjetas no se rompan */
@media (max-width: 768px) {
    .productos-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Use the SVG file as an icon inside the floating button */
.whatsapp-float::before {
    content: "";
    display: block;
    width: 45px;
    height: 45px;
    background-image: url("../img/whatsapp.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.whatsapp-float:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0,0,0,0.32);
}

.whatsapp-float:active {
    transform: translateY(-2px) scale(0.98);
}

.whatsapp-float:focus {
    outline: none;
    box-shadow: 0 0 0 6px rgba(37,211,102,0.24), 0 14px 34px rgba(0,0,0,0.32);
}

/* Visually hidden utility for screen readers */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
