/* ======= General ======= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
    scroll-behavior: smooth;
}

body {
    color: #2c3e50;
    background-color: #f9fafb;
}

/* ======= Encabezado ======= */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: white;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ccf5cd;
    padding: 0.8rem 2rem;
    gap: 1rem;
}

.logo {
    height: 70px;
}

/* ======= Menú ======= */
.navbar {
    background-color: #2e7d32;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: center;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: #c8e6c9;
    transform: scale(1.1);
}

/* ======= Sección Inicio ======= */
.inicio {
    background: url('../images/hero-bg11.jpeg') center/cover no-repeat;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.6);
    position: relative;
    margin-top: 130px;
}

.inicio::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(46, 125, 50, 0.75);
}

.inicio .contenido {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 2rem;
    animation: fadeIn 2s ease;
}

.logo-inicio {
    width: 440px;
    margin-bottom: 1rem;
    animation: zoomIn 1.5s ease, floatLogo 4s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(144, 238, 144, 0.8));
}

.inicio h2 {
    font-size: 3.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.inicio h2 span {
    color: #a5d6a7;
}

.inicio p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.btn-conocenos {
    display: inline-block;
    background-color: #a5d6a7;
    color: #1b5e20;
    font-weight: 600;
    text-decoration: none;
    padding: 0.9rem 2rem;
    border-radius: 30px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.btn-conocenos:hover {
    background-color: #81c784;
    transform: scale(1.05);
}

/* ===============================
   📱 MOBILE – SECCIÓN INICIO
   =============================== */
@media (max-width: 480px) {

    .inicio {
        height: auto;               /* evita cortes */
        min-height: 100vh;
        padding: 3.5rem 1.2rem;
        margin-top: 130px;          /* respeta header fijo */
        background-position: center top;
    }

    .inicio .contenido {
        padding: 1.5rem 1rem;
    }

    /* Logo */
    .logo-inicio {
        width: 260px;               /* escala correcta */
        max-width: 90%;
        margin-bottom: 1.2rem;
        animation: none;            /* opcional: menos distracción en móvil */
    }

    /* Título */
    .inicio h2 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    /* Texto */
    .inicio p {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1.8rem;
    }

    /* Botón */
    .btn-conocenos {
        width: 100%;
        max-width: 280px;
        padding: 0.9rem;
        font-size: 1rem;
    }
}

/* ===== UBICACIÓN ===== */
#ubicacion {
    padding: 50px 20px;
    text-align: center;
    background-color: #bbd3bf;
}

#ubicacion .titulo-seccion {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #1b5e20;
}

.mapa-contenedor {
    width: 100%;
    max-width: 700px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.direccion-texto {
    font-size: 1.1rem;
    color: #444;
    margin-top: 10px;
    line-height: 1.6;
}

/* Botón Cómo llegar */
.btn-maps {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 24px;
    background: #1c73e8;        /* Azul Google */
    color: white;
    text-decoration: none;
    font-size: 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background .3s ease;
}

.btn-maps:hover {
    background: #135bb5;
}

/* ======= Sección Sobre Nosotros ======= */
.nosotros {
    padding: 6rem 2rem;
    text-align: center;
    background-color: #9acaa1;
}

.nosotros h2 {
    color: #1b5e20;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    font-weight: 700;
}

.tarjetas {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.tarjeta {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    width: 300px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    animation: fadeUp 1s ease forwards;
    opacity: 0;
}

.tarjeta:nth-child(1) { animation-delay: 0.2s; }
.tarjeta:nth-child(2) { animation-delay: 0.4s; }
.tarjeta:nth-child(3) { animation-delay: 0.6s; }

.tarjeta:hover {
    transform: translateY(-10px);
    background-color: #e8f5e9;
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.tarjeta-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.tarjeta h3 {
    color: #2e7d32;
    margin-bottom: 1rem;
}

.tarjeta p {
    color: #555;
    line-height: 1.6;
}

/* ===============================
   📱 MOBILE – SOBRE NOSOTROS (FIX)
   =============================== */
@media (max-width: 480px) {

    .nosotros {
        padding: 4rem 1rem;
    }

    .tarjetas {
        display: flex;
        flex-direction: column;
        align-items: center;     /* CENTRADO REAL */
        gap: 3rem;               /* espacio visible */
    }

    .tarjeta {
        width: 90%;              /* deja respirar los lados */
        max-width: 320px;        /* tamaño controlado */
        margin: 0 auto;          /* centrado garantizado */
        padding: 2rem 1.5rem;
        opacity: 1;
        animation: none;
    }

    .tarjeta-img {
        width: 100%;
        height: 180px;
        object-fit: cover;
        border-radius: 12px;
    }
}

/* ======= Bloque descriptivo ======= */
.bloque-descriptivo {
    margin-top: 4rem;
    padding: 2.5rem 1.5rem;
    background-color: #e8f5e9;
    border-radius: 12px;
    max-width: 850px;
    margin-inline: auto;
    animation: fadeUp 1s ease forwards;
    opacity: 0;
}

.titulo-bloque {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.icono-cruz {
    width: 40px;
    height: 40px;
}

.bloque-descriptivo h3 {
    color: #1b5e20;
    font-size: 1.8rem;
}

.bloque-descriptivo p {
    color: #333;
    line-height: 1.7;
    font-size: 1.05rem;
}

/* ======= Sección Nuestros Servicios ======= */
/* Grid for controlled layout: 4 columns so we can place image in 3rd column row 2 */
.servicios {
    padding: 6rem 2rem;
    text-align: center;
    background-color: #f1f8f2;
}

.intro-servicios {
    text-align: center;
    font-size: 1.2rem;
    color: #2c3e50;
    margin-top: -10px;
    margin-bottom: 25px;
    line-height: 1.5;
    font-weight: 500;
}

.servicios h2 {
    color: #1b5e20;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    font-weight: 700;
}

.tarjetas-servicios {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(4, 1fr);
    justify-items: center;
    align-items: start;
}

/* Tarjetas iguales al bloque "Sobre Nosotros" pero con la misma animación */
.tarjeta-servicio {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 300px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    animation: fadeUp 1s ease forwards;
    opacity: 0;
}

.tarjeta-servicio:nth-child(1) { animation-delay: 0.2s; }
.tarjeta-servicio:nth-child(2) { animation-delay: 0.4s; }
.tarjeta-servicio:nth-child(3) { animation-delay: 0.6s; }
.tarjeta-servicio:nth-child(4) { animation-delay: 0.8s; }
.tarjeta-servicio:nth-child(5) { animation-delay: 1s; }
.tarjeta-servicio:nth-child(6) { animation-delay: 1.2s; }

.tarjeta-servicio:hover {
    transform: translateY(-10px);
    background-color: #e8f5e9;
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.tarjeta-servicio .tarjeta-img,
.tarjeta-servicio img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.tarjeta-servicio h3 {
    color: #2e7d32;
    margin-bottom: 1rem;
}

.tarjeta-servicio p {
    color: #555;
    line-height: 1.6;
}

/* ======= Imagen flotante en la posición exacta (3ª columna fila 2) ======= */
.espacio-imagen {
    grid-column: 3 / span 2; /* Ocupa columnas 3 y 4 */
    grid-row: 2; 
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ajusta la imagen sin deformarla */
}

.espacio-imagen img {
    width: 380px;
    border-radius: 22px;
    filter: drop-shadow(0 0 25px rgba(76,175,80,0.35));
    animation: floatSuave 4s ease-in-out infinite;
    transition: opacity 0.9s ease, transform 0.9s ease;
    opacity: 0; /* fade-scroll la mostrará */
}

/* ======= Fade-in controlado por JS ======= */
.fade-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.fade-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animación flotante */
@keyframes floatSuave {
    0% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
    100% { transform: translateY(0); }
}

/* ======= Footer ======= */
footer {
    background-color: #1b5e20;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.9rem;
}

/* ======= Animaciones base ======= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes floatLogo {
    0% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======= Responsividad ======= */
@media (max-width: 1024px) {
    .tarjetas-servicios {
        grid-template-columns: repeat(2, 1fr);
    }
    .espacio-imagen {
        grid-column: 1 / -1; /* ocupa toda la fila en pantallas medianas */
        grid-row: auto;
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {

    /* ===== CONTENEDORES DE TARJETAS ===== */
    .tarjetas,
    .tarjetas-servicios {
        display: flex;            /* 👈 mantiene flex */
        flex-direction: column;
        align-items: center;
        gap: 2.5rem;              /* 👈 separación real entre tarjetas */
    }

    /* ===== TARJETAS ===== */
    .tarjeta,
    .tarjeta-servicio {
        width: 92%;
        max-width: 340px;
        padding: 1.6rem 1.3rem;
        margin: 0 auto;           /* centrado real */
    }

    /* 🔥 FIX DEFINITIVO DE IMÁGENES */
    .tarjeta-servicio .espacio-imagen,
    .tarjeta-servicio .imagen-servicio {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .tarjeta-servicio img {
        width: 100%;
        height: auto !important;
        object-fit: contain;
        object-position: center center;
        display: block;
        margin-top: 0;
        padding-top: 0;
    }

    /* ===== IMÁGENES / ESPACIOS ===== */
    .espacio-imagen {
        margin-top: 2rem;
        text-align: center;
    }

    /* Ajuste general de texto */
    body {
        font-size: 15px;
    }

    /* Título principal */
    .inicio h2 {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    /* Subtítulo */
    .inicio p {
        font-size: 1rem;
    }

    /* Botón principal */
    .btn-conocenos {
        width: 90%;
        padding: 0.9rem;
        font-size: 1rem;
    }

    /* Navbar */
    .nav-links {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    /* Logo */
    .logo-inicio {
        width: 240px;
    }
}

.btn-servicio {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.7rem 1.6rem;
    background-color: #2e7d32;
    color: white;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s ease, background 0.3s ease;
}

.btn-servicio:hover {
    background-color: #1b5e20;
    transform: translateY(-3px);
}

/* ===============================
   📱 MOBILE – MENÚ INDEX (2 FILAS)
   =============================== */
@media (max-width: 480px) {

    /* Forzamos grid SOLO en el menú del index */
    .nav-links-index {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .nav-links-index li {
        width: 100%;
        list-style: none;
    }

    .nav-links-index a {
        display: block;
        width: 100%;
        padding: 0.9rem 0;
        text-align: center;
        font-size: 1rem;
        white-space: nowrap;
    }
}
