/* ==========================================================================
   CV REFORMAS - Hoja de estilos única
   HTML5 + CSS3 puro. Sin frameworks, sin preprocesadores, sin CDNs.
   Índice:
     1. Fuentes            8. Slider de inicio        15. Contador con anillo
     2. Variables          9. Portada interior        16. Mosaico / CTA
     3. Base              10. Secciones y rejillas    17. Galería y lightbox
     4. Botones e iconos  11. Tarjetas                18. Ventana emergente legal
     5. Cabecera          12. Pasos / fases           19. Pie de página
     6. Menú              13. Antes / después         20. Efectos de scroll
     7. Tema claro/oscuro 14. Textos legales          21. Responsive y accesibilidad
   ========================================================================== */


/* 1. FUENTES (autoalojadas, solo subconjunto latino) ----------------------- */
@font-face {
    font-family: "Raleway";
    src: url("../fonts/raleway-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Open Sans";
    src: url("../fonts/open-sans-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
}


/* 2. VARIABLES ------------------------------------------------------------- */
:root {
    --bg: #fbf8f4;
    --bg-alt: #f3ece4;
    --surface: #ffffff;
    --ink: #231d19;
    --muted: #6a6059;
    --line: #e5dbd0;
    --accent: #b83f0e;
    --accent-dark: #8f2f08;
    --accent-soft: #fbe9df;
    --sand: #e9b872;
    --dark: #231d19;
    --dark-2: #2e2620;
    --on-dark: #f6efe9;
    --on-dark-muted: #c9bdb2;
    --shadow: 0 10px 30px rgba(35, 29, 25, .10);
    --shadow-lg: 0 24px 60px rgba(35, 29, 25, .18);
    --radius: 14px;
    --radius-lg: 22px;
    --font-title: "Raleway", "Segoe UI", Arial, sans-serif;
    --font-text: "Open Sans", "Segoe UI", Arial, sans-serif;
    --header-h: 76px;
    --ease: cubic-bezier(.22, .61, .36, 1);
    color-scheme: light;
}

/* 7. TEMA OSCURO (solo si el usuario lo elige con el botón) */
[data-theme="dark"] {
    --bg: #15110f;
    --bg-alt: #1c1612;
    --surface: #231c17;
    --ink: #f3ece6;
    --muted: #b8ada3;
    --line: #3a2f27;
    --accent: #f08a4b;
    --accent-dark: #ffab7a;
    --accent-soft: #3a2519;
    --dark: #0f0c0a;
    --dark-2: #1c1612;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
    color-scheme: dark;
}


/* 3. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-text);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    overflow-x: hidden;
}

img, svg { max-width: 100%; }
img { display: block; height: auto; }

h1, h2, h3, h4 {
    font-family: var(--font-title);
    line-height: 1.15;
    margin: 0 0 .6em;
    letter-spacing: -.01em;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); font-weight: 800; }
h3 { font-size: 1.3rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1.1em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: #fff; }

.container { width: min(1200px, 100% - 3rem); margin-inline: auto; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem; top: -4rem;
    z-index: 1000;
    background: var(--accent); color: #fff;
    padding: .6rem 1rem; border-radius: 8px;
    transition: top .2s;
}
.skip-link:focus { top: 1rem; color: #fff; }

.eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--font-title);
    font-size: .82rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .9rem;
}
.eyebrow::before {
    content: ""; width: 2rem; height: 3px; border-radius: 3px;
    background: var(--accent);
}
.lead { font-size: 1.18rem; color: var(--muted); }
.pendiente { background: #fff3a8; color: #3b2f00; padding: 0 .3em; border-radius: 4px; }


/* 4. BOTONES E ICONOS ------------------------------------------------------ */
.icon {
    width: 1.25em; height: 1.25em;
    flex: none;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
    font-family: var(--font-title);
    font-size: 1rem; font-weight: 700;
    text-decoration: none; cursor: pointer;
    padding: .9rem 1.6rem;
    border: 2px solid transparent; border-radius: 999px;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, color .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(184, 63, 14, .35); }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { border-color: currentColor; color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-light { background: #fff; color: var(--accent-dark); }
.btn-light:hover { background: var(--sand); color: var(--dark); }
.btn-outline-light { border-color: rgba(255, 255, 255, .7); color: #fff; }
.btn-outline-light:hover { background: #fff; color: var(--dark); }
.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; }
.btn-row-center { justify-content: center; }
.btn-whatsapp { background: #128c4a; color: #fff; box-shadow: 0 8px 22px rgba(18, 140, 74, .3); }
.btn-whatsapp:hover { background: #0d6e3a; color: #fff; }

.icon-circle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3.4rem; height: 3.4rem; flex: none;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
}
.icon-circle .icon { width: 1.6rem; height: 1.6rem; color: #fff; stroke: #fff; }

.link-arrow {
    display: inline-flex; align-items: center; gap: .4rem;
    font-weight: 700; text-decoration: none;
}
.link-arrow .icon { transition: transform .25s var(--ease); }
.link-arrow:hover .icon { transform: translateX(5px); }


/* 5. CABECERA -------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    transition: box-shadow .3s;
}
.site-header.is-scrolled { box-shadow: var(--shadow); }

.topbar { background: var(--dark); color: var(--on-dark); font-size: .88rem; }
.topbar .container {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; min-height: 38px;
}
.topbar a { color: var(--on-dark); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: .45rem; }
.topbar a:hover { color: var(--sand); }
.topbar .topbar-note { display: inline-flex; align-items: center; gap: .45rem; color: var(--on-dark-muted); }
.topbar .icon { width: 1em; height: 1em; }

.header-main .container {
    display: flex; align-items: center; justify-content: space-between;
    min-height: var(--header-h); gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; line-height: 0; }
.brand img { height: 58px; width: auto; }
.brand .logo-dark-theme { display: none; }
[data-theme="dark"] .brand .logo-light-theme { display: none; }
[data-theme="dark"] .brand .logo-dark-theme { display: block; }

.header-actions { display: flex; align-items: center; gap: .6rem; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface); color: var(--ink);
    cursor: pointer;
    transition: background .25s, transform .25s var(--ease);
}
.icon-btn:hover { background: var(--accent-soft); transform: rotate(-12deg); }
.icon-btn .icon { width: 1.3rem; height: 1.3rem; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.menu-toggle { display: none; }


/* 6. MENÚ ------------------------------------------------------------------ */
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .25rem; }
.nav-list > li { position: relative; }
.nav-link {
    position: relative;
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .7rem .9rem;
    font-family: var(--font-title); font-weight: 700; font-size: .98rem;
    color: var(--ink); text-decoration: none;
    background: none; border: 0; cursor: pointer;
}
.nav-link::after {
    content: ""; position: absolute; left: .9rem; right: .9rem; bottom: .3rem;
    height: 3px; border-radius: 3px; background: var(--accent);
    transform: scaleX(0); transform-origin: left;
    transition: transform .35s var(--ease);
}
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link:hover { color: var(--accent); }
.nav-link .icon { width: .9em; height: .9em; transition: transform .25s; }

/* Opción activa también por CSS (según <body data-page="...">) */
body[data-page="inicio"] .nav-link[data-nav="inicio"],
body[data-page="empresa"] .nav-link[data-nav="empresa"],
body[data-page="areas"] .nav-link[data-nav="areas"],
body[data-page="reformas"] .nav-link[data-nav="areas"],
body[data-page="obra-nueva"] .nav-link[data-nav="areas"],
body[data-page="trabajos"] .nav-link[data-nav="trabajos"],
body[data-page="contacto"] .nav-link[data-nav="contacto"] { color: var(--accent); }
body[data-page="inicio"] .nav-link[data-nav="inicio"]::after,
body[data-page="empresa"] .nav-link[data-nav="empresa"]::after,
body[data-page="areas"] .nav-link[data-nav="areas"]::after,
body[data-page="reformas"] .nav-link[data-nav="areas"]::after,
body[data-page="obra-nueva"] .nav-link[data-nav="areas"]::after,
body[data-page="trabajos"] .nav-link[data-nav="trabajos"]::after,
body[data-page="contacto"] .nav-link[data-nav="contacto"]::after { transform: scaleX(1); }

.sub-menu {
    list-style: none; margin: 0; padding: .5rem;
    position: absolute; left: 0; top: 100%;
    min-width: 290px;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(10px);
    transition: opacity .25s, transform .25s var(--ease), visibility .25s;
}
.has-sub:hover > .sub-menu,
.has-sub:focus-within > .sub-menu,
.has-sub.is-open > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.has-sub:hover > .nav-link .icon,
.has-sub.is-open > .nav-link .icon { transform: rotate(180deg); }
.sub-menu a {
    display: flex; align-items: center; gap: .7rem;
    padding: .75rem 1rem; border-radius: 10px;
    color: var(--ink); text-decoration: none; font-weight: 600;
}
.sub-menu a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.sub-menu .icon { color: var(--accent); }

/* Teléfono flotante (solo móvil, ver sección 21) */
.fab-call { display: none; }


/* 8. SLIDER DE INICIO ------------------------------------------------------ */
.hero-slider {
    position: relative;
    height: clamp(480px, calc(100vh - var(--header-h) - 38px), 760px);
    background: var(--dark);
    overflow: hidden;
    color: #fff;
}
.slide {
    position: absolute; inset: 0;
    opacity: 0; visibility: hidden;
    transition: opacity 1.4s ease-in-out, visibility 0s 1.4s;
}
.slide.is-active, .slide.is-leaving { visibility: visible; transition: opacity 1.4s ease-in-out, visibility 0s; }
.slide.is-active { opacity: 1; z-index: 2; }
.slide.is-leaving { opacity: 0; z-index: 1; }

.slide-media, .slide-media img { position: absolute; inset: 0; width: 100%; height: 100%; }
.slide-media img { object-fit: cover; transform-origin: center; will-change: transform; }
.slide::after {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background:
        linear-gradient(90deg, rgba(20, 14, 10, .78) 0%, rgba(20, 14, 10, .45) 45%, rgba(20, 14, 10, .05) 100%),
        linear-gradient(0deg, rgba(20, 14, 10, .55) 0%, rgba(20, 14, 10, 0) 40%);
}

/* Efecto Ken Burns: uno distinto por diapositiva */
.slide.is-active .slide-media img,
.slide.is-leaving .slide-media img { animation-duration: 8.6s; animation-timing-function: ease-out; animation-fill-mode: both; }
.slide[data-kb="1"].is-active img, .slide[data-kb="1"].is-leaving img { animation-name: kb-1; }
.slide[data-kb="2"].is-active img, .slide[data-kb="2"].is-leaving img { animation-name: kb-2; }
.slide[data-kb="3"].is-active img, .slide[data-kb="3"].is-leaving img { animation-name: kb-3; }
.slide[data-kb="4"].is-active img, .slide[data-kb="4"].is-leaving img { animation-name: kb-4; }
.slide[data-kb="5"].is-active img, .slide[data-kb="5"].is-leaving img { animation-name: kb-5; }
.slide[data-kb="6"].is-active img, .slide[data-kb="6"].is-leaving img { animation-name: kb-6; }
@keyframes kb-1 { from { transform: scale(1) translate3d(0, 0, 0); }            to { transform: scale(1.16) translate3d(-2%, -1%, 0); } }
@keyframes kb-2 { from { transform: scale(1.16) translate3d(2%, 0, 0); }        to { transform: scale(1) translate3d(0, 0, 0); } }
@keyframes kb-3 { from { transform: scale(1.04) translate3d(-2%, 2%, 0); }      to { transform: scale(1.18) translate3d(2%, -1%, 0); } }
@keyframes kb-4 { from { transform: scale(1.18) translate3d(0, -2%, 0); }       to { transform: scale(1.02) translate3d(-1%, 1%, 0); } }
@keyframes kb-5 { from { transform: scale(1) translate3d(2%, 1%, 0); }          to { transform: scale(1.17) translate3d(-2%, 0, 0); } }
@keyframes kb-6 { from { transform: scale(1.15) translate3d(-1%, 1%, 0); }      to { transform: scale(1.02) translate3d(1%, -1%, 0); } }

/* Texto con movimiento: entra, se desplaza despacio y sale */
.slide-caption {
    position: absolute; z-index: 3;
    left: 0; right: 0; bottom: 0; top: 0;
    display: flex; align-items: center;
}
.slide-caption .container { width: min(1200px, 100% - 3rem); }
.slide-text { max-width: 640px; padding-bottom: 2.5rem; }
.slide-text .eyebrow { color: var(--sand); }
.slide-text .eyebrow::before { background: var(--sand); }
.slide-title {
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 800; line-height: 1.08;
    margin-bottom: .5em;
    text-shadow: 0 3px 24px rgba(0, 0, 0, .45);
}
.slide-sub { font-size: 1.2rem; color: #fff; max-width: 34ch; margin-bottom: 1.6rem; text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.slide-text > * { opacity: 0; }
.slide.is-active .slide-text > *,
.slide.is-leaving .slide-text > * { animation: caption 8.6s cubic-bezier(.3, .6, .4, 1) both; }
.slide.is-active .slide-text > :nth-child(2), .slide.is-leaving .slide-text > :nth-child(2) { animation-delay: .18s; }
.slide.is-active .slide-text > :nth-child(3), .slide.is-leaving .slide-text > :nth-child(3) { animation-delay: .36s; }
.slide.is-active .slide-text > :nth-child(4), .slide.is-leaving .slide-text > :nth-child(4) { animation-delay: .54s; }
@keyframes caption {
    0%   { opacity: 0; transform: translate3d(-70px, 0, 0); }
    14%  { opacity: 1; transform: translate3d(-30px, 0, 0); }
    86%  { opacity: 1; transform: translate3d(34px, 0, 0); }
    100% { opacity: 0; transform: translate3d(70px, 0, 0); }
}

.slider-controls {
    position: absolute; z-index: 5;
    left: 0; right: 0; bottom: 1.4rem;
}
.slider-controls .container { display: flex; align-items: center; gap: 1rem; }
.slider-dots { display: flex; gap: .55rem; margin-right: auto; }
.slider-dot {
    width: 14px; height: 14px; padding: 0;
    border-radius: 50%; border: 2px solid #fff;
    background: transparent; cursor: pointer;
    transition: background .25s, transform .25s;
}
.slider-dot:hover { transform: scale(1.25); }
.slider-dot[aria-current="true"] { background: #fff; }
.slider-btn {
    width: 46px; height: 46px; border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .8);
    background: rgba(20, 14, 10, .35); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    transition: background .25s, color .25s;
}
.slider-btn:hover { background: #fff; color: var(--dark); }
.slider-btn .icon { width: 1.3rem; height: 1.3rem; }
.slider-btn .icon-play { display: none; }
.hero-slider.is-paused .slider-btn .icon-pause { display: none; }
.hero-slider.is-paused .slider-btn .icon-play { display: block; }
.slider-progress {
    position: absolute; z-index: 5; left: 0; right: 0; bottom: 0;
    height: 5px; background: rgba(255, 255, 255, .22);
}
.slider-progress-bar { display: block; height: 100%; width: 100%; background: var(--sand); transform: scaleX(0); transform-origin: left; }
.slider-progress-bar.is-running { animation: progress 7s linear forwards; }
.hero-slider.is-paused .slider-progress-bar, .hero-slider.is-paused .slide * { animation-play-state: paused; }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Sin JavaScript: se muestra solo la primera diapositiva */
html:not(.js) .slide:first-child { opacity: 1; visibility: visible; }
html:not(.js) .slider-controls, html:not(.js) .slider-progress { display: none; }
html:not(.js) .slide:first-child .slide-text > * { opacity: 1; animation: none; }

/* Preferencia "reducir animaciones": el Ken Burns y el texto siguen presentes, pero mucho más suaves */
@media (prefers-reduced-motion: reduce) {
    .slide.is-active .slide-media img, .slide.is-leaving .slide-media img { animation-duration: 14s; animation-name: kb-soft; }
    .slide.is-active .slide-text > *, .slide.is-leaving .slide-text > * { animation-name: caption-soft; }
    .slide { transition-duration: .8s; }
}
@media (prefers-reduced-motion: reduce) {
    .slide[data-kb].is-active img, .slide[data-kb].is-leaving img { animation-name: kb-soft; }
}
@keyframes kb-soft { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes caption-soft {
    0%   { opacity: 0; transform: translate3d(-18px, 0, 0); }
    14%  { opacity: 1; transform: translate3d(-8px, 0, 0); }
    86%  { opacity: 1; transform: translate3d(10px, 0, 0); }
    100% { opacity: 0; transform: translate3d(18px, 0, 0); }
}

/* Intro móvil (el slider no se muestra en móvil) */
.hero-mobile { display: none; }


/* 9. PORTADA INTERIOR ------------------------------------------------------ */
.page-hero {
    position: relative;
    background-color: var(--dark);
    background-size: cover; background-position: center;
    color: #fff;
    padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4.5rem);
    border-bottom: 5px solid var(--accent);
}
.page-hero::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(20, 14, 10, .85), rgba(20, 14, 10, .35));
}
.page-hero .container { position: relative; }
.page-hero h1 { margin-bottom: .3em; }
.page-hero p { max-width: 60ch; color: #f1e8df; font-size: 1.15rem; margin: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.2rem; font-size: .9rem; }
.breadcrumb a { color: var(--sand); text-decoration: none; }
.breadcrumb li + li::before { content: "/"; margin-right: .5rem; color: rgba(255, 255, 255, .5); }
/* Fotos de portada: solo escritorio (en móvil no se descargan) */
@media (min-width: 821px) {
    .hero-empresa   { background-image: url("../images/galeria/nueva/Casa1/002 FINAL/001 Exterior/a1.jpg"); }
    .hero-areas     { background-image: url("../images/galeria/nueva/Casa2/002 FINAL/001 Exterior/a1.jpg"); }
    .hero-reformas  { background-image: url("../images/galeria/reformas/reforma1/despues/zoom/a3.jpg"); }
    .hero-obra      { background-image: url("../images/galeria/nueva/Estructuras/a5.jpg"); }
    .hero-trabajos  { background-image: url("../images/galeria/nueva/Casa1/002 FINAL/001 Exterior/b1.jpg"); }
    .hero-contacto  { background-image: url("../images/galeria/nueva/Tejados/b1.jpg"); }
}


/* 10. SECCIONES Y REJILLAS ------------------------------------------------- */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--dark); color: var(--on-dark); }
.section-dark .lead, .section-dark p { color: var(--on-dark-muted); }
.section-dark h2, .section-dark h3 { color: var(--on-dark); }
.section-head { max-width: 720px; margin-bottom: 3rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .eyebrow { justify-content: center; }

/* Subrayado animado bajo los títulos */
.u-anim { position: relative; display: inline-block; padding-bottom: .35em; }
.u-anim::after {
    content: ""; position: absolute; left: 0; bottom: 0;
    width: 4.5rem; height: 5px; border-radius: 5px;
    background: linear-gradient(90deg, var(--accent), var(--sand));
    transform: scaleX(0); transform-origin: left;
    transition: transform .9s var(--ease) .25s;
}
.section-head.center .u-anim::after { left: 50%; margin-left: -2.25rem; }
.is-visible .u-anim::after, .u-anim.is-visible::after, html:not(.js) .u-anim::after { transform: scaleX(1); }

.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.split.reverse > :first-child { order: 2; }
.media-frame {
    position: relative; overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    aspect-ratio: 4 / 3.2;
    background: var(--bg-alt);
}
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-frame[data-parallax] img { height: 118%; transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }
.media-badge {
    position: absolute; left: 1.2rem; bottom: 1.2rem; z-index: 2;
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem 1.1rem;
    background: rgba(255, 255, 255, .94); color: #231d19;
    border-radius: 999px; font-weight: 700; font-size: .95rem;
    box-shadow: var(--shadow);
}
.media-badge .icon { color: var(--accent); }

.check-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .7rem; }
.check-list li { display: flex; gap: .75rem; align-items: flex-start; }
.check-list .icon { margin-top: .25em; color: var(--accent); }

.grid { display: grid; gap: 1.6rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }


/* 11. TARJETAS ------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card .icon-circle { margin-bottom: 1.1rem; }
.card p:last-child { margin-bottom: 0; }

.area-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.area-card-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.area-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease); }
.area-card:hover .area-card-media img { transform: scale(1.08); }
.area-card-media .icon-circle { position: absolute; left: 1.4rem; bottom: -1.7rem; z-index: 2; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); border: 4px solid var(--surface); width: 4rem; height: 4rem; }
.area-card-body { padding: 2.6rem 1.8rem 1.8rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.area-card-body .check-list { margin-bottom: 1.2rem; }
.area-card-body .link-arrow { margin-top: auto; }


/* 12. PASOS / FASES -------------------------------------------------------- */
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.6rem; }
.step { position: relative; padding-top: 1rem; }
.step .icon-circle { margin-bottom: 1rem; position: relative; }
.step::before {
    counter-increment: step; content: "0" counter(step);
    position: absolute; right: 0; top: -.4rem;
    font-family: var(--font-title); font-weight: 800; font-size: 3.4rem; line-height: 1;
    color: var(--accent); opacity: .16;
}
.phases { display: grid; gap: 2.5rem; }
.phase { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.phase:nth-child(even) > .phase-media { order: 2; }
.phase-media { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 4 / 3; }
.phase-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease); }
.phase:hover .phase-media img { transform: scale(1.06); }
.phase-num { font-family: var(--font-title); font-weight: 800; color: var(--accent); font-size: .95rem; letter-spacing: .12em; text-transform: uppercase; }


/* 13. ANTES / DESPUÉS ------------------------------------------------------ */
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ba figure { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 4 / 3; }
.ba img { width: 100%; height: 100%; object-fit: cover; }
.ba figcaption {
    position: absolute; left: .8rem; top: .8rem;
    background: var(--dark); color: #fff;
    font-family: var(--font-title); font-weight: 700; font-size: .8rem;
    letter-spacing: .1em; text-transform: uppercase;
    padding: .35rem .8rem; border-radius: 999px;
}
.ba figure:last-child figcaption { background: var(--accent); }


/* 14. TEXTOS LEGALES ------------------------------------------------------- */
.legal-page { max-width: 820px; margin-inline: auto; padding: clamp(2rem, 5vw, 4rem) 0; }
.legal-page h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.legal-page h2 { font-size: 1.3rem; margin-top: 2rem; }
.legal-page ul { padding-left: 1.2rem; }
.legal-page li { margin-bottom: .4rem; }
.legal-meta { color: var(--muted); font-size: .9rem; }
.legal-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .96rem; }
.legal-table th, .legal-table td { text-align: left; padding: .65rem .8rem; border: 1px solid var(--line); vertical-align: top; }
.legal-table th { background: var(--bg-alt); width: 32%; font-family: var(--font-title); }
/* Cuando la página legal se muestra dentro de la ventana emergente */
html.in-frame body { background: var(--bg); }
html.in-frame .topbar, html.in-frame .site-header, html.in-frame .site-footer,
html.in-frame .fab-call, html.in-frame .skip-link { display: none !important; }
html.in-frame .legal-page { padding: 1.5rem 1.4rem 2.5rem; }
html.in-frame .legal-page h1 { padding-right: 3rem; }


/* 15. CONTADOR CON ANILLO -------------------------------------------------- */
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; text-align: center; }
.counter { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.ring-wrap { position: relative; width: 150px; height: 150px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: rgba(255, 255, 255, .14); }
.ring-fg { stroke: var(--sand); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1.8s var(--ease) .2s; }
.is-visible .ring-fg, html:not(.js) .ring-fg { stroke-dashoffset: var(--off, 25); }
.ring-fg.r-100 { --off: 0; } .ring-fg.r-85 { --off: 15; } .ring-fg.r-70 { --off: 30; } .ring-fg.r-55 { --off: 45; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .icon { width: 1.4rem; height: 1.4rem; color: var(--sand); margin-bottom: .15rem; }
.count-num { font-family: var(--font-title); font-weight: 800; font-size: 2.2rem; line-height: 1; color: #fff; }
.counter-label { color: var(--on-dark-muted); font-weight: 600; max-width: 18ch; }


/* 16. MOSAICO / CTA -------------------------------------------------------- */
.mosaic { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 190px; gap: .9rem; }
.mosaic a { position: relative; overflow: hidden; border-radius: var(--radius); display: block; }
.mosaic a:first-child { grid-column: span 2; grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.mosaic a:hover img { transform: scale(1.1); }
.mosaic a::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(0deg, rgba(20, 14, 10, .45), transparent 55%);
    opacity: 0; transition: opacity .35s;
}
.mosaic a:hover::after { opacity: 1; }

.cta-band {
    position: relative; overflow: hidden;
    background: linear-gradient(120deg, var(--accent-dark), var(--accent) 60%, #d9631f);
    color: #fff; border-radius: var(--radius-lg);
    padding: clamp(2rem, 5vw, 3.5rem);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem;
    box-shadow: var(--shadow-lg);
}
.cta-band h2 { color: #fff; margin: 0 0 .3em; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.cta-band p { margin: 0; color: #fff4ec; }
.cta-band .btn { font-size: 1.15rem; }

.contact-card { max-width: 720px; margin-inline: auto; text-align: center; padding: clamp(2rem, 5vw, 3.5rem); }
.contact-card .icon-circle { width: 5rem; height: 5rem; margin-bottom: 1.2rem; }
.contact-card .icon-circle .icon { width: 2.3rem; height: 2.3rem; }
.phone-number {
    display: block; font-family: var(--font-title); font-weight: 800;
    font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1.1;
    color: var(--accent); text-decoration: none; margin: .3rem 0 1.4rem;
}
.phone-number:hover { color: var(--accent-dark); }


/* 17. GALERÍA Y LIGHTBOX --------------------------------------------------- */
.jump-links { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 2.5rem; }
.chip {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .55rem 1.1rem; border-radius: 999px;
    border: 1.5px solid var(--line); background: var(--surface);
    font-weight: 700; font-size: .95rem; text-decoration: none; color: var(--ink);
    transition: background .25s, color .25s, border-color .25s;
}
.chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.gallery-group { margin-bottom: 3.5rem; }
.gallery-group > h2 { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.4rem; }

.album { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 1.1rem; overflow: hidden; }
.album summary {
    list-style: none; cursor: pointer;
    display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 1.2rem;
    padding: .8rem 1.2rem .8rem .8rem;
}
.album summary::-webkit-details-marker { display: none; }
.album summary:hover { background: var(--accent-soft); }
.album-cover { width: 120px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-title { font-family: var(--font-title); font-weight: 700; font-size: 1.2rem; display: block; }
.album-count { color: var(--muted); font-size: .92rem; }
.album summary .icon { transition: transform .3s var(--ease); color: var(--accent); }
.album[open] summary .icon { transform: rotate(180deg); }
.album[open] summary { border-bottom: 1px solid var(--line); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; padding: 1.1rem; }
.album-grid a { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--bg-alt); }
.album-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.album-grid a:hover img { transform: scale(1.1); }
.album-grid a::after {
    content: ""; position: absolute; inset: 0;
    background: rgba(184, 63, 14, .0); transition: background .3s;
}
.album-grid a:hover::after { background: rgba(184, 63, 14, .18); }

.lightbox {
    width: 100vw; height: 100vh; max-width: none; max-height: none;
    margin: 0; padding: 0; border: 0;
    background: rgba(12, 9, 7, .94); color: #fff;
}
.lightbox::backdrop { background: rgba(12, 9, 7, .94); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox-figure { margin: 0; text-align: center; max-width: 92vw; }
.lightbox-figure img { max-width: 92vw; max-height: 80vh; width: auto; height: auto; margin-inline: auto; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox-figure figcaption { margin-top: .9rem; color: #d9cdc2; font-size: .95rem; }
.lightbox-btn {
    position: absolute; width: 52px; height: 52px; border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .08); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    transition: background .25s, color .25s;
}
.lightbox-btn:hover { background: #fff; color: #111; }
.lightbox-btn .icon { width: 1.5rem; height: 1.5rem; }
.lightbox-prev { left: 1.2rem; top: 50%; margin-top: -26px; }
.lightbox-next { right: 1.2rem; top: 50%; margin-top: -26px; }
.lightbox-close { right: 1.2rem; top: 1.2rem; }


/* 18. VENTANA EMERGENTE LEGAL ---------------------------------------------- */
.legal-dialog {
    width: min(900px, 94vw); height: min(86vh, 820px);
    padding: 0; border: 0; border-radius: var(--radius-lg);
    background: var(--bg); color: var(--ink);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.legal-dialog[open] { display: block; animation: pop .35s var(--ease); }
.legal-dialog::backdrop { background: rgba(12, 9, 7, .65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.legal-dialog iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.legal-close { position: absolute; top: .8rem; right: .8rem; z-index: 3; width: 40px; height: 40px; }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }


/* 19. PIE DE PÁGINA -------------------------------------------------------- */
.site-footer { background: var(--dark); color: var(--on-dark-muted); padding: 4rem 0 0; font-size: .97rem; }
.site-footer a { color: var(--on-dark); text-decoration: none; }
.site-footer a:hover { color: var(--sand); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.1fr; gap: 2.5rem; padding-bottom: 3rem; }
.footer-brand img { height: 72px; width: auto; margin-bottom: 1rem; }
.site-footer h3 { color: #fff; font-size: 1.05rem; margin-bottom: 1rem; }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.footer-list a { display: inline-flex; align-items: center; gap: .55rem; }
.footer-list .icon { color: var(--sand); width: 1.05em; height: 1.05em; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding: 1.3rem 0; font-size: .88rem; }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem 2rem; }
.footer-legal { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; list-style: none; margin: 0; padding: 0; }
.footer-legal a { font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }


/* 20. EFECTOS DE SCROLL ---------------------------------------------------- */
html.js [data-reveal] {
    opacity: 0;
    transition: opacity .9s var(--ease), transform .9s var(--ease);
    transition-delay: var(--d, 0s);
}
html.js [data-reveal="up"]    { transform: translate3d(0, 38px, 0); }
html.js [data-reveal="left"]  { transform: translate3d(-48px, 0, 0); }
html.js [data-reveal="right"] { transform: translate3d(48px, 0, 0); }
html.js [data-reveal="zoom"]  { transform: scale(.92); }
html.js [data-reveal].is-visible { opacity: 1; transform: none; }
.d1 { --d: .1s; } .d2 { --d: .2s; } .d3 { --d: .3s; } .d4 { --d: .4s; }


/* 21. RESPONSIVE Y ACCESIBILIDAD ------------------------------------------- */
@media (max-width: 1100px) {
    .grid-4, .steps, .counters { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .mosaic { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
    :root { --header-h: 64px; }

    /* Cabecera móvil: tema (izquierda) · logo (centro) · menú (derecha) */
    .topbar { display: none; }
    .header-main .container { display: grid; grid-template-columns: 44px 1fr 44px; gap: .5rem; min-height: var(--header-h); }
    .brand { grid-column: 2; grid-row: 1; justify-self: center; }
    .brand img { height: 46px; }
    .header-actions { display: contents; }
    .theme-toggle { grid-column: 1; grid-row: 1; }
    .menu-toggle { display: inline-flex; grid-column: 3; grid-row: 1; }
    .menu-toggle .icon-close { display: none; }
    .menu-toggle[aria-expanded="true"] .icon-open { display: none; }
    .menu-toggle[aria-expanded="true"] .icon-close { display: block; }

    .main-nav {
        position: absolute; left: 0; right: 0; top: 100%;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - var(--header-h)); overflow-y: auto;
        padding: .6rem 1.2rem 1.2rem;
    }
    html.js .main-nav { display: none; }
    html.js .main-nav.is-open { display: block; animation: pop .3s var(--ease); }
    .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
    .nav-list > li { border-bottom: 1px solid var(--line); }
    .nav-list > li:last-child { border-bottom: 0; }
    .nav-link { width: 100%; justify-content: space-between; padding: 1rem .4rem; font-size: 1.05rem; }
    .nav-link::after { display: none; }
    .sub-menu {
        position: static; opacity: 1; visibility: visible; transform: none;
        box-shadow: none; border: 0; background: transparent; min-width: 0;
        padding: 0 0 .6rem .8rem; display: block;
    }
    .has-sub > .nav-link .icon { display: none; }

    /* Slider: no se muestra en móvil (y sus fotos no se descargan) */
    .hero-slider { display: none; }
    .hero-mobile {
        display: block; padding: 2.2rem 0 2rem;
        border-top: 5px solid var(--accent);
        background: var(--bg-alt);
    }
    .hero-mobile .lead { margin-bottom: 1.4rem; }
    .hero-mobile .mobile-title { font-family: var(--font-title); font-weight: 800; font-size: 2.1rem; line-height: 1.1; margin: 0 0 .7rem; }

    /* Portada interior: desaparece la foto y el fondo oscuro; queda la línea de color y el título */
    .page-hero { background: var(--bg); color: var(--ink); padding: 2rem 0 1.4rem; border-bottom: 0; border-top: 5px solid var(--accent); }
    .page-hero::before { display: none; }
    .page-hero p { color: var(--muted); font-size: 1.05rem; }
    .breadcrumb a { color: var(--accent); }
    .breadcrumb li + li::before { color: var(--muted); }

    .split, .phase { grid-template-columns: 1fr; }
    .split.reverse > :first-child, .phase:nth-child(even) > .phase-media { order: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .mosaic { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; }
    .album summary { grid-template-columns: 84px 1fr auto; gap: .8rem; }
    .album-cover { width: 84px; }
    .ba { grid-template-columns: 1fr; }
    .legal-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }

    /* Botón flotante de llamada */
    .fab-call {
        position: fixed; right: 1rem; bottom: 1rem; z-index: 90;
        display: inline-flex; align-items: center; gap: .6rem;
        background: var(--accent); color: #fff; text-decoration: none;
        font-family: var(--font-title); font-weight: 800;
        padding: .85rem 1.3rem; border-radius: 999px;
        box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
    }
    .fab-call:hover { color: #fff; }
    .site-footer { padding-bottom: 4.5rem; }
}

@media (max-width: 560px) {
    .grid-4, .steps, .counters, .footer-grid { grid-template-columns: 1fr; }
    .counters { gap: 2.5rem; }
    .container { width: min(1200px, 100% - 2rem); }
    .cta-band { text-align: center; justify-content: center; }
    .lightbox-prev { left: .4rem; } .lightbox-next { right: .4rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html.js [data-reveal] { opacity: 1; transform: none; }
    .media-frame[data-parallax] img { transform: none; height: 100%; }
}

@media print {
    .topbar, .site-header, .site-footer, .fab-call, .hero-slider { display: none !important; }
}
