/* ==========================================================================
   Aldevia — Estilos de la landing pública.
   Colores de marca vía variables --brand-primary / --brand-secondary
   (inyectadas desde settings en el layout).
   ========================================================================== */

:root {
    --brand-primary: #4f46e5;
    --brand-secondary: #0ea5e9;
    --ink: #1f2430;
    --muted: #6b7280;
    --soft-bg: #f7f8fc;
    --card-radius: 18px;
}

* { box-sizing: border-box; }

body.public-body {
    margin: 0;
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); }

/* Unificar Bootstrap con la marca (enlaces, foco) */
:root {
    --bs-primary: var(--brand-primary);
    --bs-link-color: var(--brand-primary);
    --bs-link-hover-color: var(--brand-primary);
}
.btn:focus-visible, .form-control:focus, .navbar-toggler:focus {
    box-shadow: 0 0 0 .25rem rgba(79, 70, 229, .3);
}
/* Foco visible por teclado (accesibilidad) */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, textarea:focus-visible, .gallery-item:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}
/* Respeta usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

.btn-brand {
    /* Usamos el sistema de variables de Bootstrap para que el fondo/So texto
       de marca se respeten en TODOS los estados (normal, hover, active, focus).
       Antes, ".btn:hover" de Bootstrap (más específico) pisaba el fondo en hover
       y lo dejaba transparente => texto blanco sobre fondo blanco. */
    --bs-btn-color: var(--brand-primary-text, #fff);
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-color: var(--brand-primary-text, #fff);
    --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary);
    --bs-btn-active-color: var(--brand-primary-text, #fff);
    --bs-btn-active-bg: var(--brand-primary);
    --bs-btn-active-border-color: var(--brand-primary);
    --bs-btn-disabled-color: var(--brand-primary-text, #fff);
    --bs-btn-disabled-bg: var(--brand-primary);
    --bs-btn-disabled-border-color: var(--brand-primary);
    padding: .7rem 1.6rem; border-radius: 999px; font-weight: 600;
    transition: transform .15s, box-shadow .15s, filter .15s;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.btn-brand:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 10px 26px rgba(0, 0, 0, .24); }

/* ----------------------------------------------------------------- Preview bar */
.preview-bar {
    background: #111827; color: #fff; text-align: center; padding: .6rem 1rem; font-size: .9rem;
}
.preview-bar a { color: #93c5fd; }

/* ----------------------------------------------------------------- Navbar */
.public-navbar {
    background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
    border-bottom: 1px solid #eef0f5; padding: .7rem 0; transition: box-shadow .2s;
}
.public-navbar.scrolled { box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.public-navbar .navbar-brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.public-navbar .brand-text { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.public-navbar .nav-link { font-weight: 500; color: var(--ink); margin: 0 .1rem; }
.public-navbar .nav-link:hover { color: var(--brand-primary); }

/* ----------------------------------------------------------------- Sections base */
.section-block { padding: 5rem 0; }
.section-alt { background: var(--soft-bg); }
.section-head { max-width: 720px; margin: 0 auto 3rem; }
.section-eyebrow { display: inline-block; color: var(--brand-primary); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; margin-bottom: .6rem; }
.section-title { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 .5rem; }
.section-lead { color: var(--muted); font-size: 1.1rem; }
.rich-text { color: #374151; font-size: 1.05rem; }
.rich-text :first-child { margin-top: 0; }
.rich-text a { text-decoration: underline; }

/* ----------------------------------------------------------------- Hero */
.hero { position: relative; display: flex; align-items: center; color: var(--ink); padding: 5rem 0;
    background-size: cover; background-position: center; }
.hero.has-bg { color: #fff; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(120deg, rgba(17,24,39,.72), rgba(17,24,39,.45)); }
.hero .container { position: relative; z-index: 2; }
.hero-auto { min-height: auto; }
.hero-pequena { min-height: 42vh; }
.hero-mediana { min-height: 62vh; }
.hero-grande { min-height: 86vh; }
.hero-content { max-width: 780px; }
.hero-content.align-items-center { margin: 0 auto; }
.hero-content.align-items-end { margin-left: auto; }
.hero-title { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 850; letter-spacing: -.03em; line-height: 1.08; margin-bottom: 1rem; }
.hero-subtitle { font-size: clamp(1.05rem, 2vw, 1.35rem); opacity: .92; margin-bottom: 1.8rem; }
.hero:not(.has-bg) .hero-title { background: none; }

/* ----------------------------------------------------------------- Services */
.service-card {
    background: #fff; border: 1px solid #eef0f5; border-radius: var(--card-radius);
    padding: 2rem 1.6rem; text-align: center; transition: transform .18s, box-shadow .18s;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.service-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(16,24,40,.1); }
.service-icon { width: 62px; height: 62px; border-radius: 16px; margin: 0 auto 1.2rem;
    display: grid; place-items: center; font-size: 1.5rem; color: var(--brand-primary-text, #fff);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); }
.service-img { width: 100%; height: 170px; object-fit: cover; border-radius: 12px; margin-bottom: 1.1rem; }
.service-title { font-size: 1.2rem; font-weight: 700; margin-bottom: .5rem; }
.service-desc { color: var(--muted); margin: 0; }

/* ----------------------------------------------------------------- Gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; grid-auto-flow: dense; }
.gallery-item { position: relative; display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 4/3; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item.gallery-main { grid-column: span 2; grid-row: span 2; }
.gallery-caption { position: absolute; inset: auto 0 0 0; padding: .8rem; color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,.72)); display: flex; flex-direction: column; }
.gallery-caption small { opacity: .85; }

/* ----------------------------------------------------------------- Testimonials */
.testimonial-card { background: #fff; border: 1px solid #eef0f5; border-radius: var(--card-radius); padding: 1.8rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.stars { color: #f59e0b; margin-bottom: .8rem; }
.testimonial-body { font-size: 1.05rem; color: #374151; margin-bottom: 1.2rem; }
.testimonial-author { display: flex; align-items: center; gap: .8rem; }
.testimonial-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.placeholder-avatar { display: grid; place-items: center; background: var(--brand-primary); color: var(--brand-primary-text, #fff); font-weight: 700; text-transform: uppercase; }
.author-name { font-weight: 700; }
.author-role { color: var(--muted); font-size: .88rem; }

/* ----------------------------------------------------------------- FAQ */
.faq-accordion .accordion-item { border: 1px solid #eef0f5; border-radius: 12px !important; margin-bottom: .7rem; overflow: hidden; }
.faq-accordion .accordion-button { font-weight: 600; }
.faq-accordion .accordion-button:not(.collapsed) { color: var(--brand-primary); background: #f5f4ff; box-shadow: none; }
.faq-accordion .accordion-button:focus { box-shadow: none; }

/* ----------------------------------------------------------------- Contact */
.contact-info { background: #fff; border: 1px solid #eef0f5; border-radius: var(--card-radius); padding: 1.8rem; }
.contact-row { display: flex; align-items: center; gap: .9rem; padding: .5rem 0; }
.ci-icon { width: 40px; height: 40px; border-radius: 10px; background: #f5f4ff; color: var(--brand-primary); display: grid; place-items: center; flex: none; }
.contact-socials { display: flex; gap: .6rem; margin-top: 1rem; }
.contact-socials a, .footer-socials a { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #f0f1f6; color: var(--ink); font-size: 1.05rem; transition: all .15s; }
.contact-socials a:hover, .footer-socials a:hover { background: var(--brand-primary); color: var(--brand-primary-text, #fff); }
.map-embed iframe { display: block; }

/* ----------------------------------------------------------------- Public comments */
.public-comment { display: flex; gap: .9rem; padding: 1rem 0; border-bottom: 1px solid #eef0f5; }
.pc-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-secondary); color: var(--brand-secondary-text, #fff); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; flex: none; }
.pc-head { display: flex; gap: .6rem; align-items: baseline; }
.pc-date { color: var(--muted); font-size: .82rem; }
.pc-body { color: #374151; }
.comment-form-card { background: #fff; border: 1px solid #eef0f5; border-radius: var(--card-radius); padding: 1.8rem; }
/* Honeypot: oculto para humanos, visible para bots */
.hp-field { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* ----------------------------------------------------------------- Footer */
.public-footer { background: #111827; color: #cbd0da; padding: 3rem 0 1.5rem; }
.footer-grid { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding-bottom: 1.5rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.footer-brand { font-weight: 800; font-size: 1.2rem; color: #fff; margin-bottom: .6rem; }
.public-footer a { color: #cbd0da; text-decoration: none; }
.public-footer a:hover { color: #fff; }
/* Iconos sociales del footer: chip visible sobre el fondo oscuro.
   Mayor especificidad para no ser pisados por ".public-footer a". */
.public-footer .footer-socials a { background: rgba(255, 255, 255, .1); color: #fff; }
.public-footer .footer-socials a:hover { background: var(--brand-primary); color: var(--brand-primary-text, #fff); }
.footer-bottom { text-align: center; padding-top: 1.2rem; font-size: .85rem; color: #9aa0ad; }

/* ----------------------------------------------------------------- Carrusel (marquee infinito) */
.carousel-section { overflow: hidden; }
.marquee {
    position: relative; width: 100%; overflow: hidden; padding: .6rem 0;
    /* Difuminado en los bordes para reforzar la sensación de giro continuo */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee-track {
    display: flex; width: max-content;
    animation: marquee-left var(--marquee-duration, 40s) linear infinite;
}
/* Pausa elegante al pasar el cursor */
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item {
    position: relative; flex: 0 0 auto; margin-right: 1.4rem;
    border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(16, 24, 40, .12);
}
.marquee-item a { display: block; position: relative; color: #fff; text-decoration: none; cursor: pointer; }
.marquee-item img {
    display: block; height: var(--marquee-height, 230px); width: auto;
    object-fit: cover; transition: transform .4s ease;
}
.marquee-item:hover img { transform: scale(1.05); }
/* Ícono de "ampliar" al pasar el cursor */
.marquee-zoom {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.8);
    width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff;
    display: grid; place-items: center; font-size: 1.1rem; pointer-events: none;
    opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.marquee-item:hover .marquee-zoom { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.marquee-cap {
    position: absolute; inset: auto 0 0 0; padding: .7rem .9rem;
    color: #fff; font-weight: 600; font-size: .9rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
}
/* Bucle sin salto: la pista tiene 2 copias; -50% equivale a una copia exacta.
   Va de 0 a -50% => las imágenes se desplazan hacia la izquierda. */
@keyframes marquee-left {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .marquee-track { animation: none !important; }
    .marquee { overflow-x: auto; }
}

/* ----------------------------------------------------------------- Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; will-change: opacity, transform; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ----------------------------------------------------------------- Lightbox */
.lightbox {
    position: fixed; inset: 0; z-index: 2000; padding: 2rem;
    background: rgba(15, 17, 26, .92); display: grid; place-items: center;
    opacity: 0; transition: opacity .2s ease;
}
.lightbox.open { opacity: 1; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); object-fit: contain; }
.lightbox figcaption { color: #e5e7eb; font-size: .95rem; text-align: center; }
.lightbox-close {
    position: absolute; top: 1rem; right: 1.25rem; background: none; border: none;
    color: #fff; font-size: 2.6rem; line-height: 1; cursor: pointer; opacity: .8; z-index: 2;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 52px; height: 52px; border-radius: 50%; border: none;
    background: rgba(255, 255, 255, .12); color: #fff; font-size: 2rem; line-height: 1;
    cursor: pointer; display: grid; place-items: center; transition: background .15s ease; z-index: 2;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, .25); }
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }
@media (max-width: 575px) {
    .lightbox-prev { left: .4rem; }
    .lightbox-next { right: .4rem; }
    .lightbox-nav { width: 44px; height: 44px; font-size: 1.6rem; }
}

/* ----------------------------------------------------------------- Botones flotantes */
.floating-actions {
    position: fixed; right: 22px; bottom: 22px; z-index: 1030;
    display: flex; flex-direction: column; gap: 14px; align-items: flex-end;
}
.fab {
    width: 56px; height: 56px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; cursor: pointer; text-decoration: none; font-size: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, background .18s ease;
}
.fab:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0, 0, 0, .3); }
.fab:active { transform: translateY(-1px); }

/* WhatsApp */
.fab-whatsapp { background: #25d366; color: #fff; position: relative; }
.fab-whatsapp:hover { color: #fff; background: #1ebe5b; }
.fab-whatsapp .fab-label {
    position: absolute; right: calc(100% + 12px); top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #111827; color: #fff; padding: .45rem .8rem; border-radius: 10px;
    font-size: .85rem; font-weight: 600; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}
.fab-whatsapp .fab-label::after {
    content: ''; position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
    border: 6px solid transparent; border-left-color: #111827;
}
.fab-whatsapp:hover .fab-label { opacity: 1; transform: translateY(-50%) translateX(0); }
/* halo animado sutil */
.fab-whatsapp::before {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: #25d366; z-index: -1; animation: fabPulse 2.4s ease-out infinite;
}
@keyframes fabPulse {
    0% { transform: scale(1); opacity: .5; }
    70% { transform: scale(1.7); opacity: 0; }
    100% { opacity: 0; }
}

/* Volver arriba (aparece al hacer scroll) */
.fab-top {
    background: var(--brand-primary); color: var(--brand-primary-text, #fff);
    opacity: 0; visibility: hidden; transform: translateY(10px);
}
.fab-top.visible { opacity: 1; visibility: visible; transform: none; }
.fab-top:hover { color: var(--brand-primary-text, #fff); filter: brightness(1.06); }

@media (max-width: 575px) {
    .floating-actions { right: 14px; bottom: 14px; }
    .fab { width: 50px; height: 50px; font-size: 1.3rem; }
}

/* ----------------------------------------------------------------- Aviso de cookies */
.cookie-banner {
    position: fixed; left: 20px; bottom: 20px; z-index: 1040; max-width: 380px;
    background: #fff; border: 1px solid #e6e8f0; border-radius: 14px;
    box-shadow: 0 12px 40px rgba(16, 24, 40, .18); padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: .9rem;
    transform: translateY(16px); opacity: 0; transition: opacity .3s ease, transform .3s ease;
}
.cookie-banner.show { transform: none; opacity: 1; }
.cookie-text { font-size: .85rem; color: #4b5563; }
.cookie-banner .btn { flex: none; }

/* ----------------------------------------------------------------- Páginas legales */
.legal-page { padding: 3rem 0 4rem; max-width: 820px; margin: 0 auto; }
.legal-title { font-size: 2rem; font-weight: 800; margin-bottom: .3rem; }
.legal-page h2 { font-size: 1.2rem; font-weight: 700; margin: 1.8rem 0 .6rem; }
.legal-page p, .legal-page li { color: #374151; line-height: 1.7; }
.legal-page ul { padding-left: 1.2rem; }
.legal-note { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid #eef0f5; font-size: .85rem; font-style: italic; }

/* ----------------------------------------------------------------- Responsive */
@media (max-width: 767px) {
    .section-block { padding: 3.2rem 0; }
    .gallery-item.gallery-main { grid-column: span 1; grid-row: span 1; }
    .footer-grid { flex-direction: column; }
    .cookie-banner { left: 12px; right: 12px; bottom: 12px; max-width: none; flex-direction: column; align-items: stretch; text-align: center; }
}
