/* ============================================================
   galeria.css — Galería clínica premium — Clinidental v3
   ============================================================ */


/* ── HERO VIDEO ─────────────────────────────────────────────── */

.gl-hero {
    position: relative;
    height: 100vh;
    height: 100dvh;
    max-height: 700px;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gl-hero-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Fallback mientras no hay video */
.gl-hero-fallback {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        135deg,
        #070d1a 0%,
        #0f1c2e 50%,
        #0a1628 100%
    );
    background-image:
        radial-gradient(rgba(0,212,255,0.08) 1px, transparent 1px);
    background-size: 28px 28px;
}

.gl-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(7,13,26,0.35) 0%, rgba(7,13,26,0.80) 100%),
        linear-gradient(135deg, rgba(0,212,255,0.06) 0%, rgba(124,58,237,0.06) 100%);
}

.gl-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--space-md);
}

.gl-hero-tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    margin-bottom: 1rem;
}

.gl-hero-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 7vw, 6rem);
    font-weight: 800;
    line-height: 1.0;
    letter-spacing: -0.03em;
    color: var(--color-white);
    margin: 0 0 0.75rem;
    /* Gradiente sutil en el título */
    background: linear-gradient(135deg, #ffffff 40%, rgba(0,212,255,0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gl-hero-sub {
    font-size: var(--fs-base);
    color: rgba(255,255,255,0.55);
    font-style: italic;
    margin: 0;
    letter-spacing: 0.02em;
}

/* Indicador de scroll */
.gl-hero-scroll {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255,255,255,0.35);
    font-size: 1rem;
    animation: bounceDown 2s ease-in-out infinite;
    transition: opacity var(--transition);
    cursor: default;
}

@keyframes bounceDown {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(7px); }
}


/* ── LAYOUT PRINCIPAL ───────────────────────────────────────── */

.gl-container {
    max-width: 1100px;
    margin-inline: auto;
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 3rem;
}


/* ── SECCIÓN POR ESPECIALIDAD ───────────────────────────────── */

.gl-section {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.gl-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.gl-section-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-soft);
}

.gl-section-header h2 {
    font-size: var(--fs-lg);
    color: var(--color-white);
    margin: 0 0 0.2rem;
}

.gl-section-header p {
    font-size: var(--fs-xs);
    color: var(--color-text-dim);
    margin: 0;
}

/* Ícono de especialidad */
.gl-esp-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.gl-esp-icon--cyan   { background: rgba(0,212,255,0.10); border: 1px solid rgba(0,212,255,0.22); color: var(--color-primary); }
.gl-esp-icon--violet { background: rgba(124,58,237,0.10); border: 1px solid rgba(124,58,237,0.22); color: var(--color-secondary-light); }
.gl-esp-icon--green  { background: rgba(0,255,136,0.08); border: 1px solid rgba(0,255,136,0.20); color: var(--color-accent); }


/* ── CARD DE CASO ───────────────────────────────────────────── */

.gl-caso {
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.gl-caso:hover {
    border-color: rgba(0,212,255,0.22);
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    transform: translateY(-4px);
}

/* Zona de fotos */
.gl-caso-fotos {
    position: relative;
    aspect-ratio: 3/2;
    background: var(--color-surface-2);
    overflow: hidden;
}

.gl-caso-fotos img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none; /* JS controla cuál se muestra */
    will-change: transform;
}

.gl-caso-fotos img:first-of-type { display: block; }

/* Placeholder */
.gl-caso-ph {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.gl-caso-ph i    { font-size: 2.8rem; opacity: 0.13; }
.gl-caso-ph span { font-size: 0.78rem; font-weight: 600; opacity: 0.25; color: var(--color-text); }

.gl-caso-ph--cyan   { background: linear-gradient(160deg, rgba(0,212,255,0.05), rgba(0,212,255,0.11)); }
.gl-caso-ph--violet { background: linear-gradient(160deg, rgba(124,58,237,0.05), rgba(124,58,237,0.11)); }
.gl-caso-ph--green  { background: linear-gradient(160deg, rgba(0,255,136,0.04), rgba(0,255,136,0.09)); }
.gl-caso-ph--cyan i   { color: var(--color-primary); }
.gl-caso-ph--violet i { color: var(--color-secondary-light); }
.gl-caso-ph--green i  { color: var(--color-accent); }

/* Badge de especialidad */
.gl-caso-badge {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 2;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.22rem 0.7rem;
    border-radius: var(--radius-round);
    background: rgba(7,13,26,0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.10);
}

.gl-caso-badge--cyan   { color: var(--color-primary); border-color: rgba(0,212,255,0.28); }
.gl-caso-badge--violet { color: var(--color-secondary-light); border-color: rgba(124,58,237,0.28); }
.gl-caso-badge--green  { color: var(--color-accent); border-color: rgba(0,255,136,0.28); }



/* Texto del caso */
.gl-caso-info {
    padding: 0.6rem 0.85rem 0.85rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gl-caso-info h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-white);
    line-height: 1.3;
    margin: 0;
}

.gl-caso-info p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ── CARD ANTES / DESPUÉS ───────────────────────────────────── */

.gl-caso--ab .gl-ab-fotos {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    aspect-ratio: 16/9;
    background: var(--color-surface-2);
    overflow: hidden;
}

.gl-ab-photo {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gl-ab-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
    transition: transform 0.4s ease;
}

.gl-caso--ab:hover .gl-ab-photo img {
    transform: scale(1.04);
}

/* Divisor vertical con ícono */
.gl-ab-divider {
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.25), transparent);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

/* Labels Antes / Después */
.gl-ab-label {
    position: absolute;
    bottom: 0.7rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.18rem 0.6rem;
    border-radius: var(--radius-round);
    background: rgba(7,13,26,0.85);
    backdrop-filter: blur(8px);
    white-space: nowrap;
    z-index: 2;
}

.gl-ab-label--antes   { color: #ff6b6b; border: 1px solid rgba(255,107,107,0.35); }
.gl-ab-label--despues { color: var(--color-accent); border: 1px solid rgba(0,255,136,0.35); }

/* Tag "Antes · Después" en el info */
.gl-ab-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-secondary-light);
    background: rgba(124,58,237,0.10);
    border: 1px solid rgba(124,58,237,0.22);
    padding: 0.18rem 0.6rem;
    border-radius: var(--radius-round);
}

.gl-caso--ab.gl-caso:hover {
    border-color: rgba(124,58,237,0.3);
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}


/* ── SPLIDE OVERRIDES ───────────────────────────────────────── */

.gl-splide .splide__arrow {
    background: rgba(7,13,26,0.85);
    border: 1px solid rgba(255,255,255,0.12);
    width: 40px;
    height: 40px;
    opacity: 1;
    backdrop-filter: blur(8px);
    transition: all var(--transition);
}

.gl-splide .splide__arrow svg { fill: var(--color-text-muted); width: 14px; height: 14px; }

.gl-splide .splide__arrow:hover {
    background: rgba(0,212,255,0.15);
    border-color: rgba(0,212,255,0.3);
}

.gl-splide .splide__arrow:hover svg { fill: var(--color-primary); }

.gl-splide .splide__pagination__page {
    background: rgba(255,255,255,0.2);
    width: 6px;
    height: 6px;
    margin: 0 3px;
    transition: all var(--transition);
}

.gl-splide .splide__pagination__page.is-active {
    background: var(--color-primary);
    transform: scale(1.4);
    box-shadow: 0 0 8px rgba(0,212,255,0.5);
}

.gl-splide .splide__track {
    padding-bottom: 2.5rem; /* espacio para pagination */
}


/* ── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 768px) {
    .gl-hero { max-height: 500px; min-height: 320px; }
    .gl-hero-title { font-size: clamp(2.2rem, 10vw, 3.5rem); }
    .gl-container { padding: var(--space-lg) var(--space-sm); gap: var(--space-lg); }
    .gl-esp-icon { width: 44px; height: 44px; min-width: 44px; font-size: 1.1rem; }
    .gl-section-header h2 { font-size: var(--fs-base); }
    .gl-caso-expand { opacity: 1; } /* siempre visible en móvil */
    .gl-caso-info { padding: 0.85rem; }
}

@media (max-width: 480px) {
    .gl-hero { max-height: 380px; }
    .gl-ab-fotos { aspect-ratio: 4/3; }
}


/* ── LIGHTBOX ───────────────────────────────────────────────── */

.gl-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.gl-lightbox.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.gl-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4,9,18,0.94);
    backdrop-filter: blur(14px);
    cursor: pointer;
}

.gl-lightbox-content {
    position: relative;
    z-index: 1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-md);
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,212,255,0.08);
}

@keyframes modalIn {
    from { opacity:0; transform: scale(0.94) translateY(12px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}

.gl-lightbox-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    z-index: 2;
}

.gl-lightbox-close:hover {
    background: rgba(255,107,107,0.2);
    border-color: rgba(255,107,107,0.4);
    color: #ff6b6b;
    transform: rotate(90deg);
}

.gl-lightbox-img-wrap {
    width: 100%;
    min-height: 260px;
    max-height: 60vh;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gl-lightbox-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-lg);
}

.gl-lightbox-info h3 {
    font-size: var(--fs-lg);
    color: var(--color-white);
    margin-bottom: 0.4rem;
}

.gl-lightbox-info p {
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
    line-height: 1.7;
    margin: 0;
}

@media (max-width: 600px) {
    .gl-lightbox { padding: var(--space-sm); }
    .gl-lightbox-content { padding: var(--space-sm); border-radius: var(--radius-lg); }
    .gl-lightbox-img-wrap { min-height: 200px; max-height: 50vh; }
    .gl-lightbox-info h3 { font-size: var(--fs-base); }
}


/* ── FOTOS CLICKEABLES ──────────────────────────────────────── */

.gl-clickable {
    cursor: pointer;
}

.gl-clickable::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,212,255,0.06);
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 1;
    pointer-events: none;
}

.gl-clickable:hover::after {
    opacity: 1;
}

/* ── VIDEOS CLOUDINARY ──────────────────────────────────────── */

.gl-video-item {
    position: relative;
    aspect-ratio: 9/16;
    max-height: 480px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gl-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.gl-video-ph {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(160deg, rgba(0,212,255,0.05), rgba(124,58,237,0.08));
}

.gl-video-ph i    { font-size: 3rem; color: var(--color-primary); opacity: 0.25; }
.gl-video-ph span { font-size: 0.8rem; font-weight: 600; opacity: 0.3; color: var(--color-text); }

.gl-video-info {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 1rem;
    background: linear-gradient(0deg, rgba(7,13,26,0.92) 0%, transparent 100%);
    z-index: 2;
}

.gl-video-info h3 { font-size: var(--fs-sm); font-weight: 700; color: var(--color-white); margin-bottom: 0.2rem; }
.gl-video-info p  { font-size: var(--fs-xs); color: var(--color-text-muted); margin: 0; }

.gl-video-splide { padding-bottom: 2.5rem; }
.gl-video-splide .splide__track { padding: 0 0.5rem; }
.gl-video-splide .splide__list  { align-items: stretch; }
.gl-video-splide .splide__slide {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 480px;
}
.gl-video-splide .splide__slide .gl-video-item {
    width: 100%;
    max-width: 280px;
    height: 100%;
    min-height: 480px;
}

/* Móvil — 1 video centrado grande */
@media (max-width: 768px) {
    .gl-video-splide .splide__slide {
        min-height: 420px;
        justify-content: center;
    }
    .gl-video-splide .splide__slide .gl-video-item {
        max-width: 220px;
        min-height: 420px;
    }
    .gl-video-item {
        max-height: 420px;
    }
}





/* ── LIGHTBOX — botones de navegación ───────────────────────── */

.gl-lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(7,13,26,0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--color-text);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.gl-lb-nav--prev { left: 1.5rem; }
.gl-lb-nav--next { right: 1.5rem; }

.gl-lb-nav:hover {
    background: rgba(0,212,255,0.2);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

@media (max-width: 600px) {
    .gl-lb-nav--prev { left: 0.5rem; }
    .gl-lb-nav--next { right: 0.5rem; }
    .gl-lb-nav { width: 38px; height: 38px; font-size: 0.85rem; }
}


/* ── VIDEOS ─────────────────────────────────────────────────── */

.gl-video-item {
    position: relative;
    aspect-ratio: 9/16;
    max-height: 480px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gl-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.gl-video-ph {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(160deg, rgba(0,212,255,0.05), rgba(124,58,237,0.08));
}

.gl-video-ph i    { font-size: 3rem; color: var(--color-primary); opacity: 0.25; }
.gl-video-ph span { font-size: 0.8rem; font-weight: 600; opacity: 0.3; color: var(--color-text); }

.gl-video-info {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 1.25rem 1rem 1rem;
    background: linear-gradient(0deg, rgba(7,13,26,0.92) 0%, transparent 100%);
    z-index: 2;
}

.gl-video-info h3 {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--color-white);
    margin: 0;
}

.gl-video-splide { padding-bottom: 2.5rem; }
.gl-video-splide .splide__slide { display: flex; justify-content: center; }
