/* =========================================================================
   ÓPTICA PURAVISIÓN — Hoja de estilos principal
   -------------------------------------------------------------------------
   Organización:
     1. Tokens de diseño (variables CSS)
     2. Base y utilidades
     3. Cabecera y navegación
     4. Hero
     5. Secciones genéricas
     6. Componentes (tarjetas, galería, testimonios, formulario, mapa)
     7. Llamado a la acción y footer
     8. Animaciones y accesibilidad
     9. Responsive
   Se usan variables CSS para que un cambio de color de marca se haga en un
   único lugar, sin recorrer todo el archivo.
   ========================================================================= */

/* ============================ 1. TOKENS DE DISEÑO ======================== */
:root {
    /* Paleta: azul (confianza/salud), blanco y gris claro. */
    --pv-primary: #0b63c5;
    --pv-primary-dark: #084a95;
    --pv-primary-darker: #0a2a43;
    --pv-primary-light: #e8f1fc;
    --pv-accent: #16b8c9;
    --pv-whatsapp: #25d366;

    --pv-body: #445064;
    --pv-heading: #0f2136;
    --pv-muted: #6b7a90;

    --pv-surface: #ffffff;
    --pv-surface-alt: #f5f7fa;
    --pv-border: #e3e8ef;

    /* Sombras modernas y suaves (efecto "clínica limpia"). */
    --pv-shadow-sm: 0 2px 8px rgba(15, 33, 54, .06);
    --pv-shadow-md: 0 12px 30px rgba(15, 33, 54, .08);
    --pv-shadow-lg: 0 24px 60px rgba(11, 99, 197, .16);

    --pv-radius-sm: .6rem;
    --pv-radius: 1rem;
    --pv-radius-lg: 1.75rem;

    --pv-transition: .3s cubic-bezier(.4, 0, .2, 1);

    /* Sobrescritura de tokens de Bootstrap para no pelear con !important. */
    --bs-primary: var(--pv-primary);
    --bs-primary-rgb: 11, 99, 197;
    --bs-body-color: var(--pv-body);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-border-color: var(--pv-border);
}

/* ============================ 2. BASE Y UTILIDADES ======================= */
html {
    scroll-behavior: smooth;
    /* Compensa la altura del navbar fijo al navegar por anclas. */
    scroll-padding-top: 5.5rem;
}

body {
    background-color: var(--pv-surface);
    color: var(--pv-body);
    font-family: var(--bs-body-font-family);
    line-height: 1.7;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--pv-heading);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--pv-primary);
    text-decoration: none;
    transition: color var(--pv-transition);
}

a:hover {
    color: var(--pv-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

.text-gradient {
    background: linear-gradient(120deg, var(--pv-primary) 0%, var(--pv-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem 1rem;
    border-radius: 999px;
    background: var(--pv-primary-light);
    color: var(--pv-primary-dark);
    font-size: .875rem;
    font-weight: 600;
}

/* ---- Botones ---- */
.btn {
    --bs-btn-font-weight: 600;
    border-radius: 999px;
    padding-inline: 1.6rem;
    transition: transform var(--pv-transition), box-shadow var(--pv-transition),
                background-color var(--pv-transition), color var(--pv-transition);
}

.btn-primary {
    --bs-btn-bg: var(--pv-primary);
    --bs-btn-border-color: var(--pv-primary);
    --bs-btn-hover-bg: var(--pv-primary-dark);
    --bs-btn-hover-border-color: var(--pv-primary-dark);
    --bs-btn-active-bg: var(--pv-primary-dark);
    box-shadow: 0 10px 24px rgba(11, 99, 197, .28);
}

.btn-outline-primary {
    --bs-btn-color: var(--pv-primary);
    --bs-btn-border-color: var(--pv-primary);
    --bs-btn-hover-bg: var(--pv-primary);
    --bs-btn-hover-border-color: var(--pv-primary);
}

.btn-whatsapp {
    background-color: var(--pv-whatsapp);
    border-color: var(--pv-whatsapp);
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 211, 102, .3);
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
    background-color: #1eb85a;
    border-color: #1eb85a;
    color: #fff;
}

.btn:hover {
    transform: translateY(-2px);
}

/* ============================ 3. CABECERA Y NAV ========================== */
.skip-link {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 1100;
    background: var(--pv-primary);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: var(--pv-radius-sm);
}

.topbar {
    background: var(--pv-primary-darker);
    color: rgba(255, 255, 255, .82);
    font-size: .875rem;
    padding: .55rem 0;
}

.topbar__item {
    color: rgba(255, 255, 255, .82);
}

.topbar__item:hover {
    color: #fff;
}

.site-navbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    padding-block: .85rem;
    transition: box-shadow var(--pv-transition), padding var(--pv-transition),
                border-color var(--pv-transition);
    z-index: 1030;
}

/* Clase aplicada por site.js al hacer scroll. */
.site-navbar.is-scrolled {
    box-shadow: var(--pv-shadow-sm);
    border-bottom-color: var(--pv-border);
    padding-block: .5rem;
}

/* Logotipo: la altura manda y el ancho se ajusta solo, así el archivo
   se puede reemplazar por otro de distinta proporción sin tocar el CSS. */
.navbar-brand__logo {
    height: 46px;
    width: auto;
    display: block;
}

.site-footer__logo {
    height: 58px;
    width: auto;
    display: block;
}

.site-navbar .nav-link {
    color: var(--pv-body);
    font-weight: 500;
    padding-inline: .9rem;
    position: relative;
}

.site-navbar .nav-link::after {
    content: "";
    position: absolute;
    left: .9rem;
    right: .9rem;
    bottom: .35rem;
    height: 2px;
    background: var(--pv-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--pv-transition);
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
    color: var(--pv-primary);
}

.site-navbar .nav-link:hover::after,
.site-navbar .nav-link.active::after {
    transform: scaleX(1);
}

/* ================================ 4. HERO =============================== */
.hero {
    position: relative;
    padding: clamp(3rem, 8vw, 6rem) 0 clamp(3.5rem, 9vw, 7rem);
    background: linear-gradient(160deg, #f7fafd 0%, #eaf2fc 55%, #ffffff 100%);
    overflow: hidden;
}

/* Halo decorativo: aporta profundidad sin usar imágenes pesadas. */
.hero__glow {
    position: absolute;
    top: -18%;
    right: -12%;
    width: 46rem;
    height: 46rem;
    background: radial-gradient(circle, rgba(22, 184, 201, .22) 0%, rgba(11, 99, 197, 0) 65%);
    pointer-events: none;
}

.hero__title {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    margin: 1.25rem 0 1rem;
    letter-spacing: -.02em;
}

.hero__subtitle {
    font-size: clamp(1.05rem, 1.5vw, 1.2rem);
    color: var(--pv-muted);
    max-width: 34rem;
}

.hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--pv-border);
}

.hero__stat-value {
    display: block;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--pv-primary);
    line-height: 1.1;
}

.hero__stat-label {
    font-size: .9rem;
    color: var(--pv-muted);
}

.hero__image-wrapper {
    position: relative;
}

.hero__image {
    width: 100%;
    border-radius: var(--pv-radius-lg);
    box-shadow: var(--pv-shadow-lg);
    /* Animación sutil de flotación (se desactiva si el usuario reduce el movimiento). */
    animation: pv-float 6s ease-in-out infinite;
}

.hero__floating-card {
    position: absolute;
    left: -1rem;
    bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #fff;
    padding: .85rem 1.15rem;
    border-radius: var(--pv-radius);
    box-shadow: var(--pv-shadow-md);
}

.hero__floating-card i {
    font-size: 1.4rem;
    color: var(--pv-primary);
}

/* =========================== 5. SECCIONES GENÉRICAS ===================== */
.section {
    padding: clamp(3.5rem, 8vw, 6rem) 0;
}

.section--light {
    background: var(--pv-surface-alt);
}

.section--dark {
    background: linear-gradient(140deg, var(--pv-primary-darker) 0%, #0d3d6b 100%);
    color: rgba(255, 255, 255, .85);
}

.section__header {
    max-width: 46rem;
    margin: 0 auto clamp(2rem, 4vw, 3.25rem);
}

.section__eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .8rem;
    font-weight: 700;
    color: var(--pv-primary);
    margin-bottom: .75rem;
}

.section__eyebrow--light {
    color: var(--pv-accent);
}

.section__title {
    font-size: clamp(1.75rem, 3.2vw, 2.5rem);
    margin-bottom: 1rem;
}

.section__lead {
    color: var(--pv-muted);
    font-size: 1.05rem;
    max-width: 42rem;
}

.section__lead--light {
    color: rgba(255, 255, 255, .75);
}

.check-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.check-list li {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: .6rem;
}

.check-list i {
    color: var(--pv-accent);
    margin-top: .3rem;
}

/* ---- Imagen de "Sobre nosotros" ---- */
.about__image-stack {
    position: relative;
}

.about__image {
    width: 100%;
    border-radius: var(--pv-radius-lg);
    box-shadow: var(--pv-shadow-md);
}

.about__badge {
    position: absolute;
    right: -.5rem;
    bottom: -1rem;
    background: var(--pv-primary);
    color: #fff;
    border-radius: var(--pv-radius);
    padding: 1rem 1.25rem;
    text-align: center;
    box-shadow: var(--pv-shadow-lg);
}

.about__badge-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.about__badge-label {
    font-size: .8rem;
    opacity: .85;
}

/* =============================== 6. COMPONENTES ========================== */

/* ---- Tarjetas de servicio ---- */
.service-card {
    background: #fff;
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    padding: 2rem 1.75rem;
    box-shadow: var(--pv-shadow-sm);
    transition: transform var(--pv-transition), box-shadow var(--pv-transition),
                border-color var(--pv-transition);
}

.service-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--pv-shadow-md);
    border-color: rgba(11, 99, 197, .25);
}

.service-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--pv-radius-sm);
    background: linear-gradient(135deg, var(--pv-primary) 0%, var(--pv-accent) 100%);
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 20px rgba(11, 99, 197, .25);
}

.service-card__title {
    font-size: 1.15rem;
    margin-bottom: .6rem;
}

.service-card__text {
    color: var(--pv-muted);
    font-size: .95rem;
    margin-bottom: 0;
}

/* ---- Tarjetas de ventajas (sección oscura) ---- */
.benefit-card {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--pv-radius);
    padding: 1.5rem;
    transition: background var(--pv-transition), transform var(--pv-transition);
}

.benefit-card:hover {
    background: rgba(255, 255, 255, .11);
    transform: translateY(-4px);
}

.benefit-card__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--pv-accent);
    color: #06263c;
    font-size: 1.3rem;
}

.benefit-card__title {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: .35rem;
}

.benefit-card__text {
    color: rgba(255, 255, 255, .72);
    font-size: .92rem;
    margin-bottom: 0;
}

/* ---- Galería ---- */
.gallery-item {
    position: relative;
    margin: 0;
    border-radius: var(--pv-radius);
    overflow: hidden;
    box-shadow: var(--pv-shadow-sm);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .5s ease;
}

.gallery-item:hover img {
    transform: scale(1.06);
}

.gallery-item__caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.75rem .9rem .8rem;
    background: linear-gradient(to top, rgba(10, 42, 67, .85), transparent);
    color: #fff;
    font-size: .9rem;
    font-weight: 500;
}

/* ---- Testimonios ---- */
.testimonial-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    padding: 1.75rem;
    box-shadow: var(--pv-shadow-sm);
    transition: transform var(--pv-transition), box-shadow var(--pv-transition);
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--pv-shadow-md);
}

.testimonial-card__stars {
    color: #f5a623;
    margin-bottom: .85rem;
}

.testimonial-card__quote {
    color: var(--pv-body);
    font-size: .97rem;
    flex-grow: 1;
    margin-bottom: 1.25rem;
}

.testimonial-card__author {
    display: flex;
    align-items: center;
    gap: .75rem;
    border-top: 1px solid var(--pv-border);
    padding-top: 1rem;
}

.testimonial-card__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: var(--pv-primary-light);
    color: var(--pv-primary-dark);
    font-weight: 700;
}

/* ---- Formulario e información de contacto ---- */
.contact-card,
.info-card {
    background: #fff;
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    padding: clamp(1.5rem, 3vw, 2.25rem);
    box-shadow: var(--pv-shadow-sm);
}

/* Solo el formulario ocupa toda la altura de la fila.
   La columna derecha apila ficha de datos + mapa con su altura natural:
   si se le pone height:100% a la ficha, el mapa se sale de la sección
   y termina montándose sobre el pie de página. */
.contact-card {
    height: 100%;
}

.form-label {
    font-weight: 600;
    color: var(--pv-heading);
    font-size: .92rem;
}

.form-control,
.input-group-text {
    border-color: var(--pv-border);
    padding-block: .7rem;
}

.input-group-text {
    background: var(--pv-surface-alt);
    color: var(--pv-primary);
}

.form-control:focus {
    border-color: var(--pv-primary);
    box-shadow: 0 0 0 .2rem rgba(11, 99, 197, .15);
}

/* Campo trampa anti-spam: invisible y fuera del flujo de tabulación. */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.info-card__title {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    display: flex;
    gap: .85rem;
    padding: .85rem 0;
    border-bottom: 1px dashed var(--pv-border);
}

.info-list li:last-child {
    border-bottom: 0;
}

.info-list i {
    color: var(--pv-primary);
    font-size: 1.15rem;
    margin-top: .2rem;
}

.info-list__label {
    display: block;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pv-muted);
}

.map-card {
    border-radius: var(--pv-radius);
    overflow: hidden;
    box-shadow: var(--pv-shadow-sm);
    border: 1px solid var(--pv-border);
    background: #fff;
}

/* El mapa nunca debe desbordar su tarjeta, sin importar el ancho que traiga
   el iframe de Google en el atributo width. */
.map-card iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 260px;
    border: 0;
}

.map-card__placeholder {
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--pv-surface-alt);
}

.map-card__placeholder i {
    font-size: 2rem;
    color: var(--pv-primary);
    display: block;
    margin-bottom: .5rem;
}

/* ---- Página de error ---- */
.error-code {
    font-size: clamp(4rem, 12vw, 7rem);
    font-weight: 800;
    line-height: 1;
    margin: 0;
    color: var(--pv-primary-light);
}

/* ====================== 7. LLAMADO A LA ACCIÓN Y FOOTER ================== */
.cta-band {
    padding: clamp(2rem, 5vw, 3rem) 0;
}

.cta-band__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
    background: linear-gradient(120deg, var(--pv-primary) 0%, var(--pv-accent) 100%);
    border-radius: var(--pv-radius-lg);
    padding: clamp(2rem, 4vw, 3rem);
    box-shadow: var(--pv-shadow-lg);
}

.cta-band__title {
    color: #fff;
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: .5rem;
}

.cta-band__text {
    color: rgba(255, 255, 255, .9);
}

.site-footer {
    background: var(--pv-primary-darker);
    color: rgba(255, 255, 255, .72);
    padding: clamp(3rem, 6vw, 4.5rem) 0 2rem;
}

.site-footer a {
    color: rgba(255, 255, 255, .72);
}

.site-footer a:hover {
    color: #fff;
}

.site-footer__text {
    font-size: .93rem;
    max-width: 24rem;
}

.site-footer__title {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.site-footer__list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: .93rem;
}

.site-footer__list li {
    margin-bottom: .6rem;
}

.site-footer__divider {
    border-color: rgba(255, 255, 255, .15);
    margin: 2.5rem 0 1.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    transition: background var(--pv-transition), transform var(--pv-transition);
}

.social-link:hover {
    background: var(--pv-accent);
    color: #06263c;
    transform: translateY(-3px);
}

/* Botón flotante de WhatsApp (conversión rápida en móvil). */
.whatsapp-float {
    position: fixed;
    right: 1.15rem;
    bottom: 1.15rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    background: var(--pv-whatsapp);
    color: #fff;
    font-size: 1.7rem;
    box-shadow: 0 12px 28px rgba(37, 211, 102, .4);
    transition: transform var(--pv-transition);
}

.whatsapp-float:hover {
    color: #fff;
    transform: scale(1.08);
}

/* ======================= 8. ANIMACIONES Y ACCESIBILIDAD ================== */

/* Aparición suave al hacer scroll. El estado inicial solo se aplica cuando
   JavaScript está disponible (clase .js en <html>), para que sin JS el
   contenido siempre sea visible. */
.js [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .7s ease, transform .7s ease;
}

.js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

@keyframes pv-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* Respeta la preferencia del sistema de reducir el movimiento. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .js [data-reveal] {
        opacity: 1;
        transform: none;
    }
}

/* Foco visible y consistente para navegación por teclado. */
a:focus-visible,
button:focus-visible,
.form-control:focus-visible {
    outline: 3px solid rgba(11, 99, 197, .45);
    outline-offset: 2px;
}

/* ============================== 9. RESPONSIVE ============================ */
@media (max-width: 991.98px) {
    .site-navbar .navbar-collapse {
        background: #fff;
        border-radius: var(--pv-radius);
        box-shadow: var(--pv-shadow-md);
        margin-top: .75rem;
        padding: 1rem;
    }

    .site-navbar .nav-link::after {
        display: none;
    }

    .hero__floating-card {
        left: 50%;
        transform: translateX(-50%);
        bottom: -1.25rem;
    }

    .about__badge {
        right: 1rem;
    }
}

@media (max-width: 575.98px) {
    .hero__stats {
        gap: 1.5rem;
    }

    .cta-band__inner {
        text-align: center;
        justify-content: center;
    }

    .whatsapp-float {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }
}
