/* 
   Tulip Clinic - Advanced Gallery System
   "Quiet Luxury" Aesthetic - Premium Medical Vibe
*/

:root {
    --primary: #0A66C2;
    --primary-light: #E6F0FA;
    --accent: #2EC4B6;
    --dark: #1A202C;
    --gray-light: #F7FAFC;
    --gray-border: #EDF2F7;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-section {
    padding-top: 80px;
    padding-bottom: 80px;
}

/* Breadcrumbs */
.breadcrumb-bar {
    background: #F7FAFC;
    padding: 15px 0;
    border-bottom: 1px solid #EDF2F7;
    font-size: 14px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #718096;
}

.breadcrumbs a {
    color: #0A66C2;
    font-weight: 500;
}

.breadcrumbs span {
    opacity: 0.5;
}

/* Page Hero */
.page-hero {
    padding: 100px 0;
    text-align: center;
}

.page-hero h1 {
    font-size: 48px;
    margin: 15px 0;
    color: #1A202C;
}

.page-hero p {
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto;
    color: #4A5568;
}

/* Compact variant — smaller, tighter hero */
.page-hero--compact { padding: 56px 0 48px; }
.page-hero--compact h1 { font-size: 34px; margin: 10px 0; }
.page-hero--compact p { font-size: 15px; max-width: 560px; }

@media (max-width: 768px) {
    .page-hero--compact { padding: 44px 0 36px; }
    .page-hero--compact h1 { font-size: 26px; }
    .page-hero--compact p { font-size: 14px; }
}

/* Filter Tabs */
.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 14px;
    background: var(--gray-light);
    color: #4A5568;
    border: 1px solid var(--gray-border);
    transition: var(--transition);
    cursor: pointer;
}

.filter-btn:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(10, 102, 194, 0.2);
}

/* Grid System */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.gallery-grid.filtering {
    opacity: 0;
}

@media (max-width: 1024px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}

@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (max-width: 380px) {
    .gallery-grid { gap: 10px; }
}

/* Gallery Item */
.gallery-item {
    display: block;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4/5;
    background: var(--gray-light);
    cursor: pointer;
    animation: fadeIn 0.6s ease backwards;
    color: inherit;
    text-decoration: none;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

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

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(10, 102, 194, 0.9) 0%, rgba(10, 102, 194, 0.2) 50%, rgba(10, 102, 194, 0) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    opacity: 0;
    transition: var(--transition);
    transform: translateY(10px);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    transform: translateY(0);
}

.gallery-overlay h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.gallery-overlay p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Video Special Icon */
.video-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    z-index: 2;
}

/* Hide legacy lightbox markup (replaced by .gmodal) */
#lightbox { display: none !important; }

/* ==============================================
   Single-image Gallery Modal — centered popup
   ============================================== */
.gmodal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gmodal.open {
    display: flex;
    opacity: 1;
}

.gmodal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gmodal-box {
    position: relative;
    width: min(85%, 880px);
    max-width: 880px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(8px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease;
}

.gmodal.open .gmodal-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.gmodal-media {
    position: relative;
    background: #0F172A;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    flex: 1 1 auto;
    overflow: hidden;
}

.gmodal-img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 110px);
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.gmodal-box:hover .gmodal-img { transform: scale(1.02); }

.gmodal-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: none;
    background: #000;
}

.gmodal-video.active { display: block; }

.gmodal-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Portrait variant — for YouTube Shorts (9:16) */
.gmodal-box.portrait { width: min(95%, 420px); }
.gmodal-box.portrait .gmodal-video {
    aspect-ratio: 9 / 16;
    max-height: 75vh;
    margin: 0 auto;
}
.gmodal-box.portrait .gmodal-media { min-height: 0; }
@media (max-width: 600px) {
    .gmodal-box.portrait { width: min(96%, 380px); }
    .gmodal-box.portrait .gmodal-video { max-height: 70vh; }
}
@media (max-height: 700px) {
    .gmodal-box.portrait { width: min(85%, 360px); }
    .gmodal-box.portrait .gmodal-video { max-height: 65vh; }
}

.gmodal-caption {
    padding: 16px 24px 20px;
    background: #fff;
    border-top: 1px solid #EDF2F7;
}

.gmodal-caption .gmodal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1A202C;
    margin: 0 0 4px;
    line-height: 1.35;
}

.gmodal-caption .gmodal-subtitle {
    font-size: 12px;
    color: #4A5568;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.gmodal-caption .gmodal-subtitle:empty { display: none; }
.gmodal-caption .gmodal-title:empty { display: none; }

/* Close button */
.gmodal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #1A202C;
    border: 0;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, background 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.gmodal-close:hover {
    background: #fff;
    transform: scale(1.08) rotate(90deg);
}

/* Loading spinner inside modal media */
.gmodal-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gmodalSpin 0.8s linear infinite;
    display: none;
}

.gmodal-media.loading .gmodal-spinner { display: block; }
.gmodal-media.loading .gmodal-img { opacity: 0; }

@keyframes gmodalSpin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tablet */
@media (max-width: 1024px) {
    .gmodal { padding: 18px; }
    .gmodal-box { width: 92%; }
}

/* Large mobile / phablet */
@media (max-width: 768px) {
    .gmodal { padding: 14px; }
    .gmodal-box {
        width: 100%;
        max-height: 92vh;
        border-radius: 14px;
    }
    .gmodal-img { max-height: calc(92vh - 96px); }
    .gmodal-caption { padding: 14px 18px 18px; }
    .gmodal-caption .gmodal-title { font-size: 16px; }
}

/* Mobile */
@media (max-width: 600px) {
    .gmodal { padding: 10px; }
    .gmodal-box {
        width: 100%;
        max-height: 94vh;
        border-radius: 12px;
    }
    .gmodal-close {
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
    }
    .gmodal-close svg { width: 16px; height: 16px; }
    .gmodal-media { min-height: 160px; }
    .gmodal-img { max-height: calc(94vh - 90px); }
    .gmodal-caption { padding: 12px 16px 16px; }
    .gmodal-caption .gmodal-title { font-size: 15px; line-height: 1.35; }
    .gmodal-caption .gmodal-subtitle { font-size: 11px; letter-spacing: 0.06em; }
}

/* Small mobile */
@media (max-width: 380px) {
    .gmodal { padding: 8px; }
    .gmodal-img { max-height: calc(94vh - 80px); }
    .gmodal-caption { padding: 10px 14px 14px; }
}

/* Enhanced Gallery Layout */
.gallery-intro {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 50px;
}

.gallery-intro .eyebrow {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 13px;
}

.gallery-intro h2 {
    font-size: 34px;
    margin: 12px 0 16px;
    color: #1A202C;
    line-height: 1.2;
}

.gallery-intro p {
    color: #4A5568;
    font-size: 16px;
}

/* Stat Bar */
.gallery-stats {
    background: linear-gradient(135deg, #0A66C2 0%, #085299 100%);
    padding: 60px 0;
    color: #fff;
    margin-top: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    text-align: center;
}

.stat-item .stat-num {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #C8DFF5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-item .stat-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.85;
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Section Heading inside galleries */
.gallery-block {
    margin-top: 70px;
}

.gallery-block:first-of-type {
    margin-top: 0;
}

.block-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 18px;
    border-bottom: 1px solid #EDF2F7;
}

.block-heading h3 {
    font-size: 24px;
    color: #1A202C;
}

.block-heading .block-tag {
    font-size: 12px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 6px 14px;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Tall card variant — rectangle for portrait images */
.gallery-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
    .gallery-grid.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}

@media (max-width: 900px) {
    .gallery-grid.grid-3 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (max-width: 768px) {
    .gallery-grid.grid-3 { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (max-width: 380px) {
    .gallery-grid.grid-3 { gap: 10px; }
}

.gallery-item.tall { aspect-ratio: 3/4; }
.gallery-item.wide { aspect-ratio: 4/3; }

/* Always-visible caption variant for case studies */
.gallery-item.caption-visible .gallery-overlay {
    opacity: 1;
    transform: translateY(0);
    background: linear-gradient(0deg, rgba(10, 102, 194, 0.92) 0%, rgba(10, 102, 194, 0.4) 50%, rgba(10, 102, 194, 0) 100%);
}

/* Secondary button (for CTAs in galleries) */
.btn-secondary {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -8px rgba(10, 102, 194, 0.35);
}

/* CTA Section */
.gallery-cta {
    background: var(--bg-soft);
    padding: 80px 0;
    text-align: center;
    margin-top: 60px;
    border-top: 1px solid #EDF2F7;
}

.gallery-cta h2 {
    font-size: 32px;
    color: #1A202C;
    margin-bottom: 14px;
}

.gallery-cta p {
    color: #4A5568;
    max-width: 560px;
    margin: 0 auto 28px;
}

.gallery-cta .cta-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Cross-link tiles */
.gallery-explore {
    padding: 80px 0;
    background: #fff;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-top: 30px;
}

.explore-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    display: block;
}

.explore-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.explore-tile:hover img { transform: scale(1.08); }

.explore-tile .label {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 60%);
    color: #fff;
    display: flex;
    align-items: flex-end;
    padding: 18px;
    font-weight: 700;
    font-size: 16px;
}

@media (max-width: 768px) {
    .explore-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Video specific layout */
.video-channel-cta {
    margin-top: 50px;
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    border-radius: 20px;
    padding: 40px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    flex-wrap: wrap;
}

.video-channel-cta h3 {
    font-size: 24px;
    margin-bottom: 6px;
}

.video-channel-cta p {
    opacity: 0.9;
    font-size: 15px;
}

.video-channel-cta .btn-yt {
    background: #fff;
    color: #CC0000;
    padding: 14px 28px;
    border-radius: 100px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.video-channel-cta .btn-yt:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,0.2); }

@media (max-width: 600px) {
    .page-hero h1 { font-size: 32px; }
    .page-hero { padding: 60px 0; }
    .gallery-section { padding-top: 50px; padding-bottom: 50px; }
    .gallery-intro h2 { font-size: 26px; }
}

/* =========================================================================
   VIDEO GALLERY (Redesigned)
   ========================================================================= */

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-top: 30px;
}

.video-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: 0.3s ease;
    background: #fff;
    border: 1px solid var(--border, #EDF2F7);
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.35); /* Crop top/bottom black bars from hqdefault.jpg */
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 2; /* ensure overlay sits above scaled image */
}

.video-card:hover .video-overlay {
    background: rgba(0,0,0,0.4);
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.45);
}

.video-card:hover .video-thumbnail video {
    transform: scale(1.1);
}

.play-icon {
    width: 60px;
    height: 60px;
    color: #fff;
    opacity: 0.9;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.video-card:hover .play-icon {
    transform: scale(1.15);
    opacity: 1;
}

.video-info {
    padding: 20px;
    flex: 1;
}

.video-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-dark, #1A202C);
    line-height: 1.4;
}

.video-info p {
    font-size: 14px;
    color: var(--text-light, #718096);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal Video Player */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-modal.active {
    display: flex;
    opacity: 1;
}

.video-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.video-modal.active .video-modal-content {
    transform: scale(1);
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
}

.video-modal-close:hover {
    transform: scale(1.2);
    color: var(--accent, #2EC4B6);
}

.video-modal iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    background: #000;
}

@media (max-width: 992px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}

@media (max-width: 768px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .video-info { padding: 14px; }
    .video-info h3 { font-size: 15px; }
    .video-info p { font-size: 12px; }
}

@media (max-width: 576px) {
    .video-modal-content { width: 95%; }
    .video-modal-close { right: 5px; top: -35px; }
    .play-icon { width: 44px; height: 44px; }
}

@media (max-width: 380px) {
    .video-grid { gap: 10px; }
}
