@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

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

:root {
    --ink:    #405662;
    --ink-2:  #60717a;
    --line:   #b6bec2;
    --soft:   #f2f2f1;
    --soft-2: #e9e9e7;
    --red:    #d83343;
    --shadow: 0 2px 7px rgb(24 42 50 / .22);
    /* alias for any inline styles in PHP */
    --rojo:   #d83343;
    --oscuro: #405662;
    --sub:    #3d4a52;
    --borde:  #b6bec2;
    --texto:  #405662;
    --max:    1200px;
    --mont:   'Montserrat', sans-serif;
    --popp:   'Montserrat', sans-serif;
}

html { scroll-behavior: smooth; font-size: 15px; }
body { font-family: var(--mont); color: var(--ink); background: #fff; -webkit-font-smoothing: antialiased; }
img  { display: block; max-width: 100%; }
a    { color: inherit; text-decoration: none; }
address { font-style: normal; }

.contenedor  { max-width: var(--max); margin: 0 auto; padding: 0 max(6vw, 32px); }
.section-pad { padding-left: max(6vw, 32px); padding-right: max(6vw, 32px); }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 0; top: 0; z-index: 9999; background: var(--red); color: #fff; padding: 8px 16px; }

/* ── HEADER ────────────────────────────────────────────────── */
.site-header {
    height: 88px; background: rgba(255,255,255,.96);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 42px; border-bottom: 1px solid #aeb9bf;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 1px 2px rgb(0 0 0 / .08);
}
.header-marca { display: flex; align-items: center; height: 100%; }
.header-logo  {
    display: flex; align-items: center;
    padding-right: 28px; height: 70%;
    border-right: 1px solid #9aa8af;
}
.header-logo img { height: 38px; width: auto; }
.header-sep   { display: none; }
.header-promo {
    height: 70%; display: flex; align-items: center;
    padding: 0 34px; border-right: 1px solid #9aa8af;
    font-size: 1.32rem; color: #5e7079; font-weight: 400;
}

.site-nav { display: flex; align-items: center; gap: 19px; font-size: .65rem; text-transform: uppercase; white-space: nowrap; }
.site-nav a { font-weight: 600; letter-spacing: .07em; transition: color .2s; }
.site-nav a:hover { color: var(--red); }

.nav-toggle {
    display: none; flex-direction: column; justify-content: center;
    gap: 5px; background: none; border: none; cursor: pointer;
    padding: 4px; width: 32px; height: 32px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); transition: .3s; border-radius: 1px; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── HERO ──────────────────────────────────────────────────── */
.hero { height: 650px; overflow: hidden; line-height: 0; }
.hero-img { width: 100%; height: 100%; object-fit: cover; object-position: center; }

/* ── STATS BAR ─────────────────────────────────────────────── */
.stats-bar { background: var(--soft); padding: 22px max(5vw,20px) 0; }
.stats-inner {
    max-width: 1160px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
    gap: 18px; transform: translateY(-4px);
    justify-content: center;
}
.stat-item {
    min-height: 124px; background: #f6f6f5;
    border: 1px solid #9fa9ae; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-transform: uppercase;
    gap: 8px; text-align: center; text-decoration: none; padding: 12px;
}
.stat-label { font-size: .72rem; font-weight: 600; letter-spacing: .07em; }
.stat-value { font-size: 2rem; line-height: 1; font-weight: 700; }
.stat-value sup { font-size: .75em; vertical-align: super; }
.stat-icon svg { width: 34px; height: 34px; fill: var(--ink); }

.stat-item--contacto { background: var(--ink); color: #fff; cursor: pointer; transition: background .2s; }
.stat-item--contacto:hover { background: var(--red); border-color: var(--red); }
.stat-item--contacto .stat-label { color: rgba(255,255,255,.7); }
.stat-item--contacto .stat-icon svg { fill: #fff; width: 44px; height: 44px; }

/* ── ESTADO DE OBRA ────────────────────────────────────────── */
.obras-section { background: var(--soft); padding: 20px max(5vw,20px) 30px; }
.obras-inner   { max-width: 810px; margin: 0 auto; }
.obras-track {
    height: 25px; border: 1px solid #b7bdc0;
    background: #fff; box-shadow: inset 0 0 2px rgb(0 0 0 / .14);
    position: relative; padding: 4px; overflow: visible;
}
.obras-fill { display: block; height: 100%; background: var(--red); position: relative; }
.obras-fill::after {
    content: ''; position: absolute;
    right: -11px; top: 50%; transform: translateY(-50%);
    border-left: 11px solid var(--red);
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
}
.obras-dots  { display: none; }
.obras-labels {
    display: grid; grid-template-columns: repeat(4,1fr);
    font-size: .67rem; color: var(--sub); margin-top: 10px; text-align: center;
}
.obras-labels span:first-child { text-align: left; }
.obras-labels span:last-child  { text-align: right; }

/* ── ABOUT / SPLIT SECTION ─────────────────────────────────── */
.about-section { display: grid; grid-template-columns: 1fr 1fr; min-height: 400px; }
.about-section.sin-imagen { grid-template-columns: 1fr; }
.about-texto-col { padding-top: 66px; padding-bottom: 58px; display: flex; flex-direction: column; justify-content: center; }
.about-numero { font-size: 2.6rem; line-height: 1.08; font-weight: 700; text-transform: uppercase; color: var(--ink); margin-bottom: 4px; }
.about-h1 { font-size: 2.6rem; line-height: 1.08; margin-bottom: 30px; font-weight: 700; text-transform: uppercase; color: var(--ink); }
.about-texto { font-size: .85rem; line-height: 1.75; color: var(--sub); }
.about-texto p { margin-bottom: .8em; text-align: justify; }
.about-imagen { overflow: hidden; min-height: 400px; }
.about-imagen img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── SECTION TITLE ─────────────────────────────────────────── */
.seccion-titulo {
    font-size: 2.6rem; letter-spacing: .035em; text-align: center;
    margin: 0 0 28px; font-weight: 700; text-transform: uppercase; color: var(--ink);
}

/* ── GALERÍA ───────────────────────────────────────────────── */
.galeria-section { background: var(--soft-2); padding-top: 50px; padding-bottom: 45px; }
.gallery-shell {
    display: grid; grid-template-columns: 54px 1fr 54px;
    align-items: center; max-width: 1180px; margin: 0 auto;
}
.carousel { overflow: hidden; }
.carousel-track { display: flex; transition: transform .42s cubic-bezier(.4,0,.2,1); will-change: transform; touch-action: pan-y; cursor: grab; user-select: none; }
.carousel-track.dragging { cursor: grabbing; }
.carousel-slide { flex-shrink: 0; padding: 0 6px; }
.carousel-img-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.carousel-slide img { width: 100%; height: 230px; object-fit: cover; display: block; -webkit-user-drag: none; }

.gallery-arrow {
    height: 92px; border: 0; background: var(--ink); color: #fff;
    font-size: 3rem; font-weight: 200; cursor: pointer; width: 100%; line-height: 1;
}
.gallery-arrow:hover { background: #304651; }

.carousel-dots { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.carousel-dot  {
    width: 8px; height: 8px; border-radius: 50%;
    background: #87939a; border: none; padding: 0; cursor: pointer; transition: background .2s;
}
.carousel-dot.on { background: var(--ink); transform: scale(1.2); }

/* ── LIGHTBOX ──────────────────────────────────────────────── */
.lightbox {
    position: fixed; inset: 0; background: rgb(15 20 23 / .94);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; padding: 60px;
}
.lightbox.open { display: flex; }
.lightbox-img { max-width: 90vw; max-height: 85vh; object-fit: contain; display: block; }
.lightbox-close {
    position: absolute; top: 18px; right: 22px; background: none; border: 0;
    color: #fff; font-size: 2.2rem; line-height: 1; cursor: pointer; padding: 8px;
}
.lightbox-prev, .lightbox-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgb(255 255 255 / .12); border: 0; color: #fff;
    font-size: 2rem; width: 52px; height: 52px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .2s; line-height: 1;
}
.lightbox-prev:hover, .lightbox-next:hover { background: rgb(255 255 255 / .25); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* ── LOCALIZACIÓN ──────────────────────────────────────────── */
.mapa-section { background: #fff; padding-top: 30px; }
.mapa-section .seccion-titulo { margin-bottom: 18px; }
.mapa-wrap { height: 360px; overflow: hidden; width: 100%; }
.mapa-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.mapa-wrap img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); opacity: .83; display: block; }

/* ── EQUIPAMIENTO ──────────────────────────────────────────── */
.equipamiento-section { padding: 34px max(6vw,32px) 48px; background: #fff; }
.equipamiento-section .seccion-titulo { margin-bottom: 28px; }
.equipamiento-iconos {
    max-width: 980px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
    gap: 20px; align-items: start; justify-content: center;
}
.equipamiento-item { text-align: center; }
.equip-icono {
    width: 130px; height: 130px; margin: 0 auto 10px;
    border: 1px solid #c2c8cb;
    display: flex; align-items: center; justify-content: center;
    padding: 11px;
}
.certificacion-energetica .equip-icono {
    border: 0;
}
.equip-icono img { width: 100%; height: 100%; object-fit: contain; display: block; }
.equip-label { font-size: .55rem; text-transform: uppercase; color: #4f616a; line-height: 1.5; letter-spacing: .05em; }

/* ── TIPOLOGÍAS ────────────────────────────────────────────── */
.tipologias-section { position: relative; background: var(--soft-2); padding: 34px max(6vw,32px) 58px; }
.tabla-wrap { max-width: 1120px; margin: 0 auto; overflow-x: auto; box-shadow: 0 2px 5px rgb(0 0 0 / .16); }
.tabla-tipologias { width: 100%; border-collapse: collapse; font-size: .72rem; text-align: center; min-width: 850px; background: #f7f7f6; }
.tabla-tipologias thead tr { background: var(--ink); }
.tabla-tipologias thead th { color: #fff; padding: 13px 10px; text-transform: uppercase; font-size: .65rem; font-weight: 700; border-right: 1px solid #87959b; letter-spacing: .05em; }
.tabla-tipologias tbody td { padding: 11px 10px; border-bottom: 1px solid #c7cccf; color: #4d5c65; }
.tabla-tipologias tbody tr:nth-child(even) { background: #e5e7e8; }
.tabla-tipologias td:first-child { text-align: left; padding-left: 24px; color: #475b65; text-transform: uppercase; }
.tabla-tipologias td a { text-decoration: underline; color: var(--ink); }
.tabla-asterisco { font-size: .78rem; color: var(--sub); margin-top: 10px; max-width: 1120px; margin-left: auto; margin-right: auto; }

.tipologias-docs { display: flex; align-items: center; gap: 16px; margin-top: 28px; flex-wrap: wrap; max-width: 1120px; margin-left: auto; margin-right: auto; }
.btn-doc {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 42px; padding: 0 28px;
    background: var(--ink); color: #fff;
    font-size: .68rem; font-weight: 600; letter-spacing: .05em;
    text-transform: uppercase; border: 2px solid var(--ink);
    cursor: pointer; text-decoration: none; transition: background .2s, color .2s;
}
.btn-doc:hover { background: #fff; color: var(--ink); }
.btn-doc svg { width: 14px; height: 14px; fill: currentColor; }

.financiado-bloque {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-left: auto;
    text-align: left;
}
.financiado-texto-label { font-size: .55rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); }
.financiado-bloque img { height: 100px; width: auto; }
.financiado-bloque span { font-size: .88rem; font-weight: 700; }

/* ── CONTACTO ──────────────────────────────────────────────── */
.contacto-section { display: grid; grid-template-columns: 1fr 1fr; min-height: 400px; background: #fff; }
.contacto-section.sin-imagen { grid-template-columns: 1fr; }
.contacto-titulo { grid-column: 1 / -1; padding: 44px max(6vw,32px) 0; }
.contacto-imagen { overflow: hidden; min-height: 400px; }
.contacto-imagen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.contacto-form-col { padding-top: 32px; padding-bottom: 50px; display: flex; flex-direction: column; justify-content: center; }
.contacto-subtitulo { font-size: .85rem; color: var(--sub); text-align: left; margin-bottom: 32px; line-height: 1.7; max-width: 600px; }
.contacto-subtitulo strong { color: var(--ink); font-weight: 600; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.form-grupo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-grupo label { font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.form-grupo input,
.form-grupo textarea {
    border: 0; border-bottom: 1px solid #aeb6ba;
    padding: 8px 0; font: inherit; outline: none;
    background: transparent; color: var(--ink);
    transition: border-color .2s; width: 100%;
}
.form-grupo input:focus,
.form-grupo textarea:focus { border-color: var(--red); }
.form-grupo textarea { border: 1px solid #aeb6ba; padding: 10px; height: 110px; resize: vertical; }

.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.form-check input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; accent-color: var(--red); }
.form-check label { font-size: .62rem; color: var(--sub); line-height: 1.6; }
.form-check a { color: #525d61; text-decoration: underline; }

.btn-enviar {
    width: 100%; min-height: 42px; padding: 0 28px;
    background: var(--ink); color: #fff; border: none;
    font-family: var(--mont); font-size: .68rem; font-weight: 600;
    letter-spacing: .05em; text-transform: uppercase;
    cursor: pointer; transition: background .2s;
}
.btn-enviar:hover { background: var(--red); }

.alerta { padding: 12px 18px; margin-bottom: 20px; font-size: .82rem; }
.alerta-ok    { background: #dff0d8; border-left: 3px solid #3c763d; color: #3c763d; }
.alerta-error { background: #f2dede; border-left: 3px solid #c0392b; color: #c0392b; }

/* ── FOOTER ────────────────────────────────────────────────── */
.site-footer { background: #efefee; border-top: 1px solid #ddd; padding: 40px 0 30px; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 0 max(6vw,32px); text-align: center; }
.footer-logo  { display: flex; justify-content: center; margin-bottom: 10px; }
.footer-logo img { height: 46px; width: auto; }
.footer-tagline { font-size: 1.2rem; color: var(--ink); margin: 22px 0 0; }
.footer-oficinas {
    max-width: 930px; margin: 24px auto 0;
    border-top: 1px solid #8c999f; border-bottom: 1px solid #8c999f;
    padding: 24px 0;
    display: grid; grid-template-columns: 1fr 1fr auto;
    gap: 48px; align-items: center; text-align: left;
}
.footer-oficina { display: flex; flex-direction: column; gap: 4px; }
.footer-oficina h3 { font-size: .85rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }
.footer-oficina p  { font-size: .9rem; color: var(--sub); line-height: 1.8; }
.footer-oficina a  { color: var(--sub); }
.footer-social { display: flex; flex-direction: row; justify-content: flex-end; align-items: center; gap: 12px; }
.footer-social a { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #111; transition: background .2s; }
.footer-social a:hover { background: var(--red); }
.footer-social svg { width: 14px; height: 14px; fill: #fff; }
.footer-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 24px; margin-bottom: 8px; }
.footer-legal-links a { font-size: .8rem; color: #556267; transition: color .2s; }
.footer-legal-links a:hover { color: var(--red); }
.footer-copy { font-size: .75rem; color: #525d61; }
.footer-copy a { color: #525d61; text-decoration: underline; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .site-header { padding: 0 24px; }
    .site-nav {
        display: none; position: absolute; top: 88px; left: 0; right: 0;
        background: #fff; border-bottom: 1px solid #ddd;
        flex-direction: column; gap: 0; z-index: 99; padding: 8px 0;
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 12px 24px; border-bottom: 1px solid #f0f0f0; }
    .nav-toggle { display: flex; }

    .hero { height: 520px; }

    .stats-inner { grid-template-columns: repeat(2,1fr); }
    .stat-value  { font-size: 1.45rem; }

    .about-section { grid-template-columns: 1fr; }
    .about-texto-col { order: 2; max-width: 100%; }
    .about-imagen { order: 1; min-height: 300px; }
    .about-h1, .about-numero, .seccion-titulo { font-size: 2.2rem; }

    .gallery-shell { grid-template-columns: 38px 1fr 38px; }
    .carousel-slide img { height: 180px; }

    .equipamiento-iconos { grid-template-columns: repeat(3,1fr); }

    .tipologias-docs { flex-direction: column; align-items: flex-start; }
    .financiado-bloque { margin-left: 0; }

    .contacto-section { grid-template-columns: 1fr; }
    .contacto-imagen { min-height: 260px; }
    .contacto-form-col { padding-top: 40px; padding-bottom: 40px; }
    .form-row { grid-template-columns: 1fr; }

    .footer-oficinas { grid-template-columns: 1fr; gap: 20px; text-align: center; padding: 24px 10px; }
    .footer-oficina  { align-items: center; }
    .footer-social   { justify-content: center; }
}

@media (max-width: 780px) {
    .site-header { height: 72px; padding: 0 14px; }
    .site-nav { top: 72px; }
    .header-logo { padding-right: 14px; }
    .header-promo { font-size: .95rem; padding: 0 15px; border-right: 0; }
    .about-h1, .about-numero, .seccion-titulo { font-size: 1.7rem; }

    .hero { height: 360px; }

    .stats-inner { gap: 12px; }
    .stat-item { min-height: 104px; }
    .stat-item--contacto { grid-column: 1 / -1; }

    .gallery-arrow { height: 70px; font-size: 2.3rem; }
    .carousel-slide img { height: 200px; }

    .lightbox { padding: 20px; }
    .lightbox-prev, .lightbox-next { width: 40px; height: 40px; font-size: 1.5rem; }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }

    .mapa-wrap { height: 260px; }

    .equipamiento-iconos { grid-template-columns: repeat(2,1fr); gap: 25px 10px; }

    /* Tabla de tipologías → tarjetas apiladas, sin scroll horizontal */
    .tabla-wrap { overflow-x: visible; box-shadow: none; }
    .tabla-tipologias { min-width: 0; }
    .tabla-tipologias thead { display: none; }
    .tabla-tipologias, .tabla-tipologias tbody, .tabla-tipologias tr, .tabla-tipologias td { display: block; width: 100%; }
    .tabla-tipologias tr {
        margin-bottom: 12px; background: #f7f7f6;
        border: 1px solid #c7cccf; box-shadow: 0 2px 5px rgb(0 0 0 / .1);
    }
    .tabla-tipologias tbody tr:nth-child(even) { background: #f7f7f6; }
    .tabla-tipologias td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        text-align: right; padding: 10px 16px; border-bottom: 1px solid #dfe2e3;
    }
    .tabla-tipologias tr td:last-child { border-bottom: 0; }
    .tabla-tipologias td:first-child { padding-left: 16px; }
    .tabla-tipologias td::before {
        content: attr(data-label); font-weight: 700; text-transform: uppercase;
        font-size: .62rem; letter-spacing: .05em; color: var(--ink); text-align: left;
    }
}

@media (max-width: 460px) {
    .header-promo { display: none; }
    .hero { height: 285px; }
    .stats-inner { grid-template-columns: 1fr 1fr; }
    .stat-item { min-height: 92px; }
    .stat-value { font-size: 1.2rem; }
    .about-h1, .about-numero, .seccion-titulo { font-size: 1.6rem; }
    .equipamiento-iconos { grid-template-columns: repeat(2,1fr); }
    .obras-labels span:nth-child(2),
    .obras-labels span:nth-child(3) { display: none; }
    .obras-labels { grid-template-columns: 1fr 1fr; }
}
