/* ==========================================================================
   CERRAMIENTOS DE TERRAZAS · Tapeta (fondo de toda la página)
   - Azulejo andaluz de "cuerda seca" (images/tapetas/ceramica.svg) muy
     suave en el fondo de la página, detrás de TODO: secciones, tarjetas,
     tablas y widgets van siempre por encima.
   - El azulejo no se mueve (es una pared); lo único animado es un brillo de
     sol que pasa despacio sobre el esmalte.
   - Las secciones claras son transparentes para que se vea la tapeta;
     las oscuras (hero, Málaga, proceso) y las de foto son paneles opacos.
   - Se para con "reducir movimiento" y con el botón de pausa
     (html.tapeta-paused, lo pone tapeta.js).
   ========================================================================== */

/* ------------------------------------------------------------------------
   1. Los azulejos (capa fija, z-index -1: por debajo de todo el contenido)
   ------------------------------------------------------------------------ */
body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
}
body::before {
    inset: 0;
    background: url("/images/tapetas/ceramica.svg") 0 0 / 150px 150px repeat;
    opacity: .17;
    filter: saturate(.75);
}

/* Brillo de sol que resbala despacio sobre el esmalte */
body::after {
    inset: -30%;
    background:
        radial-gradient(26% 22% at 28% 30%, rgba(255, 244, 222, .85), rgba(255, 244, 222, 0) 70%),
        radial-gradient(22% 18% at 74% 62%, rgba(255, 238, 210, .6), rgba(255, 238, 210, 0) 70%);
    animation: tapeta-sol 80s ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes tapeta-sol {
    from { transform: translate3d(-8%, -5%, 0); }
    to   { transform: translate3d(9%, 7%, 0); }
}

/* ------------------------------------------------------------------------
   2. Secciones claras transparentes: la tapeta se ve detrás del contenido
   ------------------------------------------------------------------------ */
.pres-embed,
.gallery,
.about,
.services,
.benefits,
.technology,
.before-after,
.process-visual,
.faq,
.stats-band { background: transparent; }

/* Detrás de los textos la tapeta se difumina, para que se lean limpios */
.pres-hero .container,
.gallery .text-center,
.about .text-center,
.services .text-center,
.benefits .text-center,
.technology .text-center,
.before-after .text-center,
.process-visual .text-center,
.faq .text-center,
.tech-info { position: relative; }
/* Sticky solo en desktop: en móvil el h2 y la ask-card tapan las FAQ al hacer scroll. */
@media (min-width: 901px) {
    .faq .text-center { position: sticky; }
}
.pres-hero .container::before,
.gallery .text-center::before,
.about .text-center::before,
.services .text-center::before,
.benefits .text-center::before,
.technology .text-center::before,
.before-after .text-center::before,
.process-visual .text-center::before,
.faq .text-center::before,
.tech-info::before {
    content: "";
    position: absolute;
    inset: -48px -72px;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(closest-side, rgba(243, 241, 237, .94) 0%, rgba(243, 241, 237, .78) 55%, rgba(243, 241, 237, 0) 100%);
}
@media (max-width: 900px) {
    .pres-hero .container::before,
    .gallery .text-center::before,
    .about .text-center::before,
    .services .text-center::before,
    .benefits .text-center::before,
    .technology .text-center::before,
    .before-after .text-center::before,
    .process-visual .text-center::before,
    .faq .text-center::before,
    .tech-info::before { inset: -32px -12px; }
}
/* Nada de scroll lateral por los velos de los textos */
.pres-embed, .gallery, .about, .services, .benefits, .technology,
.before-after, .process-visual, .faq, .pres-main, .pres-hero { overflow-x: clip; }

/* Widgets y cabecera siempre opacos: nada se ve a través de ellos */
.header { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
.quick-calc { background: rgba(255, 255, 255, .97); }

/* ------------------------------------------------------------------------
   3. Paneles con foto real (Proceso, Testimonios, Contacto)
   ------------------------------------------------------------------------ */
.tw--foto {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    overflow: clip;
}
.tw--foto::before {
    content: "";
    position: absolute;
    inset: -2%;
    z-index: -1;
    pointer-events: none;
    background-image: var(--foto-velo), var(--foto);
    background-size: cover, cover;
    background-position: center, var(--foto-pos, center);
    filter: saturate(.6);
    animation: tw-kenburns 40s ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes tw-kenburns {
    from { transform: scale(1) translate3d(0, 0, 0); }
    to   { transform: scale(1.07) translate3d(-1.5%, -1%, 0); }
}
.process.tw--foto {
    --foto: url("/images/malaga/malaga-puerto-panoramica-1600.jpg");
    --foto-velo: linear-gradient(160deg, rgba(10, 22, 28, .93) 0%, rgba(22, 44, 56, .88) 55%, rgba(28, 60, 66, .84) 100%);
}
.testimonials.tw--foto {
    --foto: url("/images/malaga/malaga-playa-malagueta-1600.jpg");
    --foto-pos: center 60%;
    --foto-velo: linear-gradient(180deg, rgba(243, 241, 237, .95) 0%, rgba(243, 241, 237, .8) 30%, rgba(243, 241, 237, .5) 100%);
}
.contact.tw--foto {
    --foto: url("/images/malaga/rincon-victoria-sombrillas-1600.jpg");
    --foto-velo: linear-gradient(180deg, rgba(243, 241, 237, .95) 0%, rgba(243, 241, 237, .82) 28%, rgba(243, 241, 237, .6) 100%);
}

/* Fotos de fondo: 800 px en móvil y AVIF/WebP donde el navegador lo admita */
@media (max-width: 900px) {
    .process.tw--foto { --foto: url("/images/malaga/malaga-puerto-panoramica-800.jpg"); }
    .testimonials.tw--foto { --foto: url("/images/malaga/malaga-playa-malagueta-800.jpg"); }
    .contact.tw--foto { --foto: url("/images/malaga/rincon-victoria-sombrillas-800.jpg"); }
}
@supports (background-image: image-set(url("a.avif") type("image/avif"))) {
    .process.tw--foto { --foto: image-set(url("/images/malaga/malaga-puerto-panoramica-1600.avif") type("image/avif"), url("/images/malaga/malaga-puerto-panoramica-1600.webp") type("image/webp"), url("/images/malaga/malaga-puerto-panoramica-1600.jpg") type("image/jpeg")); }
    .testimonials.tw--foto { --foto: image-set(url("/images/malaga/malaga-playa-malagueta-1600.avif") type("image/avif"), url("/images/malaga/malaga-playa-malagueta-1600.webp") type("image/webp"), url("/images/malaga/malaga-playa-malagueta-1600.jpg") type("image/jpeg")); }
    .contact.tw--foto { --foto: image-set(url("/images/malaga/rincon-victoria-sombrillas-1600.avif") type("image/avif"), url("/images/malaga/rincon-victoria-sombrillas-1600.webp") type("image/webp"), url("/images/malaga/rincon-victoria-sombrillas-1600.jpg") type("image/jpeg")); }
    @media (max-width: 900px) {
        .process.tw--foto { --foto: image-set(url("/images/malaga/malaga-puerto-panoramica-800.avif") type("image/avif"), url("/images/malaga/malaga-puerto-panoramica-800.webp") type("image/webp"), url("/images/malaga/malaga-puerto-panoramica-800.jpg") type("image/jpeg")); }
        .testimonials.tw--foto { --foto: image-set(url("/images/malaga/malaga-playa-malagueta-800.avif") type("image/avif"), url("/images/malaga/malaga-playa-malagueta-800.webp") type("image/webp"), url("/images/malaga/malaga-playa-malagueta-800.jpg") type("image/jpeg")); }
        .contact.tw--foto { --foto: image-set(url("/images/malaga/rincon-victoria-sombrillas-800.avif") type("image/avif"), url("/images/malaga/rincon-victoria-sombrillas-800.webp") type("image/webp"), url("/images/malaga/rincon-victoria-sombrillas-800.jpg") type("image/jpeg")); }
    }
}

/* ------------------------------------------------------------------------
   4. Botón de pausa (discreto) y movimiento reducido
   ------------------------------------------------------------------------ */
.tapeta-toggle {
    position: fixed;
    left: 20px;
    bottom: 76px;
    z-index: 60;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    background: #fff;
    color: var(--petrol);
    box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .35);
    transition: transform .2s ease;
}
.tapeta-toggle:hover { transform: scale(1.06); }
.tapeta-toggle svg { width: 18px; height: 18px; }
.tapeta-toggle[aria-pressed="true"] { color: var(--ink-55); }
@media (max-width: 599px) {
    .tapeta-toggle { left: 14px; bottom: 66px; }
}

html.tapeta-paused body::before,
html.tapeta-paused body::after,
html.tapeta-paused .tw--foto::before { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
    body::before, body::after, .tw--foto::before { animation: none !important; }
    .tapeta-toggle { display: none; }
}

/* Créditos de fotos en el pie */
.footer-photo-credits {
    margin: 0;
    max-width: none;
    font-size: 11px;
    line-height: 1.6;
    color: rgba(250, 249, 247, .5);
}
.footer-photo-credits a { color: rgba(250, 249, 247, .7); text-decoration: underline; text-underline-offset: 2px; }
.footer-photo-credits a:hover { color: #fff; }
