/* ---------- Variables ---------- */
:root {
    --azul-profundo: #071A2B;   /* noche de pileta */
    --azul-agua: #1FB5C9;       /* agua (sobre fondos oscuros) */
    --agua-oscuro: #0B7285;     /* agua (texto sobre fondos claros, buen contraste) */
    --gris-claro: #F2F7F7;      /* azulejo */
    --hormigon: #5B6B76;
    --luz: #F5B942;             /* luz LED: solo para contacto */
    --blanco: #FFFFFF;
    --texto-oscuro: #16232E;
    --radio: 10px;              /* un solo radio para botones, fotos e íconos */
    --fuente-titulo: 'Manrope', system-ui, sans-serif;
    --fuente-texto: 'Manrope', system-ui, sans-serif;
    --hero-img: url('img/ilu1.jpg'); /* foto del hero: cambiala por la que prefieras */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--fuente-texto);
    font-size: 1.0625rem;
    line-height: 1.6;
    background: var(--gris-claro);
    color: var(--texto-oscuro);
}

h1, h2, h3 {
    font-family: var(--fuente-titulo);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

a:focus-visible { outline: 3px solid var(--luz); outline-offset: 3px; }

.seccion, .seccion h2, .seccion p, .seccion h3 { text-align: left; }

/* ---------- Header ---------- */
header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 6vw;
    transition: background 0.3s;
}

/* Al hacer scroll: azul noche sólido, sin efecto de vidrio */
header.header-solido {
    background: var(--azul-profundo);
    box-shadow: 0 1px 0 rgba(31, 181, 201, 0.25);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--fuente-titulo);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--blanco);
}

.logo-nombre span { color: var(--azul-agua); }

nav { display: flex; align-items: center; }

nav a {
    margin-left: 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
}

nav a:hover {
    color: var(--blanco);
    text-decoration: underline;
    text-decoration-color: var(--azul-agua);
    text-underline-offset: 6px;
}

/* Teléfono y botón: solo en pantallas anchas (en celular lo cubre la barra de WhatsApp) */
.nav-telefono, .btn-nav { display: none; }

.nav-telefono { color: var(--blanco); font-weight: 700; }

.btn-nav {
    padding: 9px 18px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: var(--radio);
    color: var(--blanco);
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-nav:hover {
    background: var(--luz);
    border-color: var(--luz);
    color: var(--azul-profundo);
    text-decoration: none;
}

@media (min-width: 900px) {
    .nav-telefono, .btn-nav { display: inline-block; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 92svh;
    display: flex;
    align-items: flex-end;
    padding: 140px 6vw 9vh;
    color: var(--blanco);
    background:
        linear-gradient(to bottom, rgba(7, 26, 43, 0.55) 0, rgba(7, 26, 43, 0) 160px),
        linear-gradient(to top, rgba(7, 26, 43, 0.92) 0%, rgba(7, 26, 43, 0.5) 55%, rgba(7, 26, 43, 0.15) 100%),
        var(--hero-img) center / cover,
        var(--azul-profundo);
}

/* La pileta "prende las luces" al cargar */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--azul-profundo);
    pointer-events: none;
    animation: luces 2.4s ease-out 0.3s forwards;
}

@keyframes luces { to { opacity: 0; } }

.hero-contenido { position: relative; z-index: 1; max-width: 760px; }

.hero h1 {
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    max-width: 18ch;
    margin-bottom: 16px;
}

/* Segundo nivel del título: especialidades, en mayúsculas y más liviano */
.hero-lema {
    max-width: 52ch;
    margin-bottom: 20px;
    font-size: clamp(0.8rem, 1.6vw, 1rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.5;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
}

.hero-texto { max-width: 52ch; color: rgba(255, 255, 255, 0.85); margin-bottom: 32px; }

/* Franja de datos reales al pie del hero */
.hero-datos {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 24px clamp(20px, 5vw, 56px);
    margin-top: 40px;
}

.hero-datos li::before {
    content: '';
    display: block;
    width: 28px;
    height: 2px;
    margin-bottom: 10px;
    background: var(--azul-agua);
}

.hero-datos strong {
    display: block;
    font-size: clamp(1.15rem, 3.5vw, 1.75rem);
    font-weight: 800;
    line-height: 1.15;
}

.hero-datos span {
    display: block;
    margin-top: 2px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.btn-principal {
    display: inline-block;
    background: var(--luz);
    color: var(--azul-profundo);
    font-weight: 700;
    text-decoration: none;
    padding: 16px 28px;
    border-radius: var(--radio);
}

.btn-principal:hover { filter: brightness(1.08); }

/* ---------- Secciones ---------- */
/* Ancho completo para poder alternar el fondo; el contenido se mantiene en 1240px */
.seccion {
    padding: clamp(64px, 10vw, 120px) max(6vw, calc((100% - 1240px) / 2));
    scroll-margin-top: 80px;
}

#servicios { background: var(--blanco); }
#trabajos { background: var(--gris-claro); }
#testimonios { background: var(--blanco); }

.etiqueta {
    color: var(--agua-oscuro);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.seccion h2 {
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    color: var(--azul-profundo);
    margin-bottom: 32px;
}

.intro-seccion { margin-bottom: 40px; max-width: 700px; }

/* Servicios: filas numeradas en vez de tarjetas */
.grid-servicios { display: block; counter-reset: servicio; }

.tarjeta-servicio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 16px 48px;
    padding: 28px 0;
    border-top: 1px solid rgba(7, 26, 43, 0.15);
    transition: border-color 0.2s;
}

.tarjeta-servicio:hover { border-top-color: var(--agua-oscuro); }

.tarjeta-servicio:last-child { border-bottom: 1px solid rgba(7, 26, 43, 0.15); }

.tarjeta-servicio h3 { font-size: clamp(1.3rem, 2.4vw, 1.8rem); color: var(--azul-profundo); }

.tarjeta-servicio h3::before {
    counter-increment: servicio;
    content: counter(servicio, decimal-leading-zero);
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--agua-oscuro);
}

.tarjeta-servicio p { color: var(--hormigon); }

/* ---------- Portafolio ---------- */
.categoria-contenedor { margin-bottom: 72px; }

.categoria-contenedor:last-child { margin-bottom: 0; }

.encabezado-categoria { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }

/* Ícono de categoría: mismo tamaño, color y radio para las cuatro */
.icono-categoria {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radio);
    background: var(--azul-profundo);
    color: var(--azul-agua);
}

.icono-categoria svg { width: 24px; height: 24px; }

.encabezado-categoria h3 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--azul-profundo); }

/* Celular: siempre dos columnas */
.grid-galeria {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 8px;
}

.item-galeria { border-radius: var(--radio); overflow: hidden; background: #dfe8ea; }

.img-galeria { display: block; width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.img-galeria { cursor: zoom-in; }

/* Celular: cada categoría muestra 4 fotos y el resto aparece con "Ver más" */
.btn-ver-mas {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px 24px;
    background: transparent;
    color: var(--azul-profundo);
    border: 2px solid var(--azul-profundo);
    border-radius: var(--radio);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-ver-mas:hover { background: var(--azul-profundo); color: var(--blanco); }

.btn-ver-mas:focus-visible { outline: 3px solid var(--luz); outline-offset: 3px; }

@media (max-width: 699px) {
    .grid-galeria.recortada .item-galeria:nth-child(n + 5) { display: none; }

    /* Si queda una foto suelta en la última fila, ocupa todo el ancho */
    .item-galeria:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .item-galeria:last-child:nth-child(odd) .img-galeria { aspect-ratio: 16 / 9; }
}

@media (min-width: 700px) {
    .grid-galeria {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        grid-auto-rows: 220px;
        gap: 12px;
    }
    .item-galeria:nth-child(5n + 1) { grid-column: span 2; grid-row: span 2; }
    .btn-ver-mas { display: none; }
}

/* ---------- Testimonios ---------- */
.grid-testimonios { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; }

.testimonio { border-left: 3px solid var(--azul-agua); padding: 4px 0 4px 20px; }

.testimonio p { font-size: 1.15rem; color: var(--texto-oscuro); }

.testimonio cite { display: block; margin-top: 12px; font-style: normal; font-weight: 600; color: var(--hormigon); }

/* ---------- Lightbox ---------- */
.lightbox {
    border: 0;
    background: var(--azul-profundo);
    width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh;
    padding: 5vh 6vw;
}

.lightbox[open] { display: flex; align-items: center; justify-content: center; }

.lightbox::backdrop { background: var(--azul-profundo); }

.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

.lightbox button {
    position: absolute;
    background: none;
    border: 0;
    color: var(--blanco);
    font-size: 2.6rem;
    line-height: 1;
    padding: 12px;
    cursor: pointer;
}

.lb-cerrar { top: 8px; right: 12px; }
.lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-sig { right: 4px; top: 50%; transform: translateY(-50%); }

/* ---------- Footer ---------- */
footer {
    background: var(--azul-profundo);
    color: rgba(255, 255, 255, 0.85);
    padding: 72px max(6vw, calc((100% - 1240px) / 2));
    scroll-margin-top: 80px;
}

footer h2 {
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
    color: var(--blanco);
    margin-bottom: 16px;
}

footer p { margin: 8px 0; }

.btn-footer { margin: 20px 0 24px; }

.contacto-etiqueta {
    display: inline-block;
    min-width: 92px;
    color: var(--azul-agua);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.link-contacto { color: var(--blanco); font-weight: 600; text-underline-offset: 4px; }

.copyright { margin-top: 40px; font-size: 0.875rem; opacity: 0.7; }

/* ---------- Botón de WhatsApp ---------- */
.barra-whatsapp {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--luz);
    color: var(--azul-profundo);
    font-weight: 700;
    text-decoration: none;
    padding: 14px 22px;
    border-radius: var(--radio);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Se esconde mientras ya se ve el botón del hero o el del footer */
.barra-whatsapp.barra-oculta {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.barra-whatsapp svg { width: 22px; height: 22px; fill: currentColor; }

/* ---------- Celular ---------- */
@media (max-width: 768px) {
    .tarjeta-servicio { grid-template-columns: 1fr; gap: 8px; }
    .barra-whatsapp {
        left: 0; right: 0; bottom: 0;
        justify-content: center;
        border-radius: 0;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    }
    footer { padding-bottom: 110px; }

    /* Footer: etiqueta arriba y dato abajo, igual en las tres filas */
    .contacto-etiqueta { display: block; min-width: 0; margin-bottom: 2px; }
    footer .link-contacto { overflow-wrap: anywhere; }
}

/* Celular: header solo con el logo; el contacto lo resuelve la barra de WhatsApp */
@media (max-width: 560px) {
    .logo { font-size: 1.15rem; }
    nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero::after { display: none; }
    .barra-whatsapp { transition: none; }
}