/* =========================================================
   CENTRO PULMONAR — Sistema de diseño
   Paleta derivada de la marca (banners institucionales)
   ========================================================= */
:root {
    --primary:       #0284c7;   /* Azul institucional */
    --primary-dark:  #0369a1;
    --primary-light: #e0f2fe;
    --accent:        #0d9488;   /* Verde-teal salud */
    --accent-light:  #ccfbf1;
    --wa:            #25d366;
    --bg-light:      #f6f9fc;
    --surface:       rgba(255, 255, 255, 0.88);
    --text:          #0f172a;
    --muted:         #5b6b80;
    --border:        rgba(203, 213, 225, 0.7);
    --radius:        18px;
    --shadow-sm:     0 2px 10px rgba(15, 23, 42, 0.05);
    --shadow-md:     0 12px 30px rgba(2, 132, 199, 0.10);
    --shadow-lg:     0 24px 60px rgba(2, 60, 105, 0.16);
    --nav-h:         72px;
    --ease-out:      cubic-bezier(.22, 1, .36, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg-light);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.15rem; }

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

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 6px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 5%; }

section { padding: clamp(56px, 8vw, 96px) 0; }

.section-head { text-align: center; max-width: 720px; margin: 0 auto clamp(32px, 5vw, 56px); }
.section-head .eyebrow {
    display: inline-block;
    font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-light);
    padding: 6px 14px; border-radius: 999px; margin-bottom: 14px;
}
.section-head p { color: var(--muted); margin-top: 12px; font-size: 1.05rem; }

/* =========================================================
   NAVBAR — sticky, glass, responsive con hamburguesa
   ========================================================= */
.navbar {
    position: sticky; top: 0; z-index: 1000;
    height: var(--nav-h);
    background: var(--surface);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 5%;
    transition: box-shadow .3s ease;
}
.navbar.scrolled { box-shadow: var(--shadow-md); }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--primary-dark); text-decoration: none; z-index: 1002; }
.logo-icon { font-size: 2rem; animation: breathe 5s ease-in-out infinite; display: inline-block; }
.logo small { font-size: 0.72rem; color: var(--accent); font-weight: 700; letter-spacing: 0.08em; }

.nav-links { display: flex; gap: 6px; list-style: none; align-items: center; }
.nav-links a {
    text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.95rem;
    padding: 9px 14px; border-radius: 10px;
    transition: color .25s, background .25s;
}
.nav-links a:hover { color: var(--primary); background: var(--primary-light); }
.nav-links a.active { color: var(--primary-dark); background: var(--primary-light); }

.btn-cita {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff !important; padding: 11px 24px; border-radius: 999px;
    font-weight: 700; text-decoration: none; border: none; cursor: pointer;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.30);
    transition: transform .3s var(--ease-out), box-shadow .3s;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-cita:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(2, 132, 199, 0.38); background: linear-gradient(135deg, var(--primary), var(--accent)); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 24px; border-radius: 999px; font-weight: 700; text-decoration: none;
    color: #fff; border: 2px solid rgba(255,255,255,0.65);
    transition: background .3s, transform .3s var(--ease-out);
}
.btn-ghost:hover { background: rgba(255,255,255,0.15); transform: translateY(-3px); }

/* Hamburguesa */
.nav-toggle {
    display: none;
    width: 44px; height: 44px;
    background: none; border: none; cursor: pointer;
    flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    z-index: 1002;
}
.nav-toggle span {
    width: 24px; height: 2.5px; background: var(--text); border-radius: 2px;
    transition: transform .35s var(--ease-out), opacity .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* =========================================================
   HERO SLIDER
   ========================================================= */
.slider-wrapper {
    position: relative; width: 100%;
    height: clamp(480px, calc(100vh - var(--nav-h)), 760px);
    overflow: hidden; background: #06233a;
}
.slide {
    position: absolute; inset: 0;
    opacity: 0; visibility: hidden;
    transition: opacity 1s ease, visibility 1s;
    display: flex; align-items: center; justify-content: center;
}
.slide.active { opacity: 1; visibility: visible; }

.slide-bg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0.5;
}
.slide.active .slide-bg { animation: kenburns 7s ease-out forwards; }

.slide::after { /* velo para legibilidad */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(6,35,58,0.25) 0%, rgba(6,35,58,0.55) 100%);
}

.slide-content {
    position: relative; z-index: 2; text-align: center; color: #fff;
    max-width: 820px; padding: 0 24px;
}
.slide-content .slide-tag {
    display: inline-block; font-size: 0.78rem; font-weight: 800;
    letter-spacing: 0.16em; text-transform: uppercase;
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.25);
    padding: 7px 16px; border-radius: 999px; margin-bottom: 18px;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.slide-content h1 { text-shadow: 0 4px 18px rgba(0,0,0,0.45); margin-bottom: 16px; }
.slide-content h1 em { font-style: normal; color: #7dd3fc; }
.slide-content p {
    font-size: clamp(1rem, 2vw, 1.2rem); margin-bottom: 28px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.45); color: rgba(255,255,255,0.92);
}
.slide-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Entrada escalonada del contenido del slide activo */
.slide .slide-tag, .slide h1, .slide p, .slide .slide-actions {
    opacity: 0; transform: translateY(24px);
}
.slide.active .slide-tag      { animation: riseIn .7s var(--ease-out) .15s forwards; }
.slide.active h1              { animation: riseIn .7s var(--ease-out) .30s forwards; }
.slide.active p               { animation: riseIn .7s var(--ease-out) .45s forwards; }
.slide.active .slide-actions  { animation: riseIn .7s var(--ease-out) .60s forwards; }

/* Controles */
.slider-nav {
    position: absolute; bottom: 26px; width: 100%;
    display: flex; justify-content: center; gap: 10px; z-index: 10;
}
.dot {
    width: 12px; height: 12px; border: none; padding: 0;
    background: rgba(255,255,255,0.45); border-radius: 999px; cursor: pointer;
    transition: all .35s var(--ease-out);
}
.dot.active { background: #fff; width: 34px; }

.slider-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
    width: 46px; height: 46px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.12); color: #fff; font-size: 1.2rem;
    cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: background .3s, transform .3s;
    display: flex; align-items: center; justify-content: center;
}
.slider-arrow:hover { background: rgba(255,255,255,0.28); }
.slider-arrow.prev { left: 18px; }
.slider-arrow.next { right: 18px; }

/* Onda divisoria (firma visual: respiración) */
.wave-divider { display: block; width: 100%; height: 70px; margin-top: -1px; }
.wave-divider path { fill: var(--bg-light); }

/* =========================================================
   TARJETAS
   ========================================================= */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

.card {
    background: #fff; padding: 32px; border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    transition: transform .35s var(--ease-out), box-shadow .35s, border-color .35s;
    position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: rgba(2,132,199,0.35); }
.card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease-out);
}
.card:hover::before { transform: scaleX(1); }

.card .card-icon {
    width: 58px; height: 58px; border-radius: 16px;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; margin-bottom: 18px;
}
.card p { color: var(--muted); margin-top: 10px; font-size: 0.95rem; }

/* Tarjeta de servicio (catálogo) */
.service-card {
    display: flex; flex-direction: column; justify-content: space-between;
}
.service-card .badge {
    font-size: 0.72rem; font-weight: 800; color: var(--accent);
    background: var(--accent-light); padding: 4px 10px; border-radius: 999px;
}
.service-card .cat-label { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.service-card a.cta-link {
    margin-top: 18px; text-decoration: none; color: var(--primary); font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px; transition: gap .25s var(--ease-out);
}
.service-card a.cta-link:hover { gap: 12px; }

/* Filtros de categoría */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.filter-chip {
    border: 1px solid var(--border); background: #fff; color: var(--muted);
    font-weight: 700; font-size: 0.85rem; padding: 9px 18px; border-radius: 999px;
    cursor: pointer; transition: all .25s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.search-input {
    width: 100%; max-width: 520px; padding: 15px 22px; margin-top: 24px;
    border-radius: 999px; border: 1px solid var(--border); outline: none;
    font-size: 0.98rem; font-family: inherit; background: #fff;
    box-shadow: var(--shadow-sm); transition: border-color .3s, box-shadow .3s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(2,132,199,0.12); }

.empty-state { display: none; text-align: center; color: var(--muted); padding: 50px 0; }
.empty-state.show { display: block; }

/* =========================================================
   FORMULARIOS
   ========================================================= */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 13px 16px; border-radius: 12px;
    border: 1px solid var(--border); background: #f8fafc;
    font-size: 0.95rem; font-family: inherit; outline: none;
    transition: border-color .3s, background .3s, box-shadow .3s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 4px rgba(2,132,199,0.10);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.btn-submit-wa {
    width: 100%; background: var(--wa); color: #fff; border: none;
    padding: 15px; border-radius: 999px; font-weight: 800; font-size: 1rem;
    font-family: inherit; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
    transition: transform .25s var(--ease-out), background .25s;
}
.btn-submit-wa:hover { transform: translateY(-2px); background: #1eb857; }

/* =========================================================
   BOTÓN FLOTANTE WHATSAPP
   ========================================================= */
.wa-float {
    position: fixed; bottom: 22px; right: 22px; z-index: 999;
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--wa); color: #fff; font-size: 1.7rem;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(37,211,102,0.45);
    animation: waPulse 2.6s ease-in-out infinite;
    transition: transform .25s var(--ease-out);
}
.wa-float:hover { transform: scale(1.1); }

/* =========================================================
   FOOTER
   ========================================================= */
footer {
    background: #0f172a; color: #fff;
    padding: 60px 5% 25px; margin-top: 80px;
}
footer .foot-grid {
    max-width: 1200px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px;
    padding-bottom: 40px; border-bottom: 1px solid #1e293b;
}
footer h3 { font-size: 1.15rem; color: #f8fafc; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
footer h4 { font-size: 1rem; color: #f1f5f9; margin-bottom: 15px; border-left: 3px solid var(--primary); padding-left: 10px; }
footer p, footer a { color: #94a3b8; font-size: 0.9rem; }
footer ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
footer ul a { text-decoration: none; transition: color .25s, padding-left .25s; }
footer ul a:hover { color: #38bdf8; padding-left: 5px; }
footer .foot-bottom {
    max-width: 1200px; margin: 25px auto 0;
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    gap: 15px; color: #64748b; font-size: 0.85rem;
}
footer .credit {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.03); padding: 6px 14px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.06);
}
footer .credit a { color: #38bdf8; font-weight: 700; text-decoration: none; transition: color .25s, text-shadow .25s; }
footer .credit a:hover { color: #7dd3fc; text-shadow: 0 0 10px rgba(56,189,248,0.5); }

/* =========================================================
   ANIMACIONES (reveal por IntersectionObserver)
   ========================================================= */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal-left  { opacity: 0; transform: translateX(-40px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal-right { opacity: 0; transform: translateX(40px);  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal.active, .reveal-left.active, .reveal-right.active { opacity: 1; transform: none; }

/* Escalonado dentro de grillas */
.grid > .reveal:nth-child(2) { transition-delay: .12s; }
.grid > .reveal:nth-child(3) { transition-delay: .24s; }
.grid > .reveal:nth-child(4) { transition-delay: .36s; }

@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }
@keyframes kenburns { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes waPulse {
    0%, 100% { box-shadow: 0 10px 26px rgba(37,211,102,0.45), 0 0 0 0 rgba(37,211,102,0.35); }
    50%      { box-shadow: 0 10px 26px rgba(37,211,102,0.45), 0 0 0 14px rgba(37,211,102,0); }
}

/* Contadores / stats */
.stats-band {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    border-radius: var(--radius); color: #fff;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px; padding: clamp(28px, 4vw, 48px); text-align: center;
    box-shadow: var(--shadow-lg);
}
.stats-band .num { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; }
.stats-band .lbl { font-size: 0.88rem; opacity: 0.9; margin-top: 4px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
    .nav-links { gap: 2px; }
    .nav-links a { padding: 8px 10px; font-size: 0.88rem; }
}

@media (max-width: 900px) {
    .nav-toggle { display: flex; }
    .nav-links {
        position: fixed; inset: 0; z-index: 1001;
        background: rgba(248, 250, 252, 0.98);
        -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
        flex-direction: column; justify-content: center; align-items: center; gap: 8px;
        opacity: 0; visibility: hidden; transform: translateY(-14px);
        transition: opacity .35s var(--ease-out), transform .35s var(--ease-out), visibility .35s;
    }
    .nav-links.open { opacity: 1; visibility: visible; transform: none; }
    .nav-links a { font-size: 1.15rem; padding: 12px 24px; }
    .nav-links .btn-cita { margin-top: 12px; }
    body.nav-locked { overflow: hidden; }

    .form-row { grid-template-columns: 1fr; }
    .slider-arrow { display: none; }
}

@media (max-width: 640px) {
    .slide-content h1 { font-size: 1.75rem; }
    .card { padding: 26px 22px; }
    footer .foot-bottom { justify-content: center; text-align: center; }
    .wa-float { width: 52px; height: 52px; bottom: 16px; right: 16px; }
}

/* Accesibilidad: usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
    .reveal, .reveal-left, .reveal-right { opacity: 1; transform: none; }
}
