/**
 * Travel Gallery Gallery Frontend Styles
 */

/* ── Inherit theme font for all interactive elements ─────────── */
.tvg-gallery-container button,
.tvg-gallery-container input,
.tvg-gallery-container select,
.tvgembed-wrap button,
.tvgembed-wrap input,
.tvgembed-wrap select {
    font-family: inherit;
    font-size: inherit;
}

/* ── Container — full-width breakout ─────────────────────────── */
.tvg-gallery-container {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 500px;
    box-sizing: border-box;
    margin: 0;
}

/* ── Stats header ─────────────────────────────────────────────── */
.tvg-gallery-stats-header {
    font-size: 22px;
    color: #444;
    margin-bottom: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}
.tvg-gallery-stats-header strong { color: #111; font-weight: 700; }

/* ── Toolbar ──────────────────────────────────────────────────── */
.tvg-gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px 0;
    flex-wrap: wrap;
}


/* ── Gallery Tabs ─────────────────────────────────────────────── */
.tvg-gallery-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e0e0;
}

.tvg-tab-btn {
    padding: 12px 28px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.tvg-tab-btn:hover {
    color: #333;
}
.tvg-tab-btn--active {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

/* ── UNESCO Grid ──────────────────────────────────────────────── */
.tvg-unesco-grid {
    padding: 8px 0 40px;
}

.tvg-unesco-show-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    padding: 7px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
}
.tvg-unesco-show-all:hover {
    background: #f0f0f0;
    border-color: #bbb;
    color: #111;
}

.tvg-unesco-country-section {
    margin-bottom: 48px;
}

.tvg-unesco-country-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #1a1a1a;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.tvg-unesco-country-heading:hover {
    color: #1a5276;
}
.tvg-unesco-country-heading:hover::after {
    content: ' →';
    font-weight: 400;
    font-size: 0.9em;
    opacity: 0.6;
}
.tvg-unesco-country-heading .tvg-unesco-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: #999;
    letter-spacing: 0.08em;
    margin-left: 4px;
}

.tvg-unesco-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ── Back to Countries button ─────────────────────────────────── */
.tvg-back-to-countries-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
}
.tvg-back-to-countries-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
    color: #111;
}

/* ── Country Card Grid ────────────────────────────────────────── */
.tvg-country-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 20px 0 40px;
}

.tvg-country-card {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}
.tvg-country-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.13);
    transform: translateY(-3px);
}
.tvg-country-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    opacity: 0.92;
}

/* Image container */
.tvg-country-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    pointer-events: none;
}

/* Photo card */
.tvg-country-card-photo {
    padding: 0;
    background: #e8e8e8;
}
.tvg-country-card-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    pointer-events: none;
}
.tvg-country-card:hover .tvg-country-card-photo-img {
    transform: scale(1.05);
}

/* Placeholder */
.tvg-country-card-placeholder {
    background: #f0f0f0;
}
.tvg-country-initial {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ccc;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    user-select: none;
    pointer-events: none;
}

/* Country name — sits below the image */
.tvg-country-card-name {
    padding: 10px 8px 12px;
    text-align: center;
    pointer-events: none;
}
.tvg-country-card-name span {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a1a1a;
    line-height: 1.3;
    display: block;
}

/* View transition — fade */
.tvg-country-grid,
.tvg-gallery-grid {
    transition: opacity 0.3s ease;
}
.tvg-view-fading {
    opacity: 0;
    pointer-events: none;
}

/* ── Country sections ─────────────────────────────────────────── */
.tvg-country-block { margin-bottom: 64px; }

.tvg-country-name {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 40px;
    color: #1a1a1a;
    padding-bottom: 18px;
    border-bottom: 1px solid #e0e0e0;
}

/* ── Place-grouped sections ───────────────────────────────────── */
.tvg-place-block { margin-bottom: 48px; }

.tvg-place-name {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 6px;
    color: #1a1a1a;
}

.tvg-place-date {
    font-size: 0.82rem;
    color: #999;
    text-align: center;
    letter-spacing: 0.08em;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.tvg-place-subtitle {
    font-size: 0.85rem;
    color: #888;
    margin: 0 0 12px;
    text-align: center;
    letter-spacing: 0.05em;
}

.tvg-place-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}

.tvg-place-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: #555;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 5px 14px;
    transition: border-color 0.2s, color 0.2s;
}
.tvg-place-link:hover { color: #1a1a1a; border-color: #999; }

.tvg-place-description {
    width: 100%;
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.75;
    color: #444;
    text-align: left;
}


.tvg-place-row {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
}
.tvg-place-row.cols-1 { grid-template-columns: 1fr; }
.tvg-place-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.tvg-place-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tvg-place-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Gallery Item ─────────────────────────────────────────────── */
.tvg-gallery-item {
    position: relative;
    cursor: pointer;
    animation: gtFadeIn 0.5s ease;
}

/* Image inner — clips image to rounded corners; caption sits outside */
.tvg-img-inner {
    overflow: hidden;
    border-radius: 4px;
}

.tvg-gallery-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

/* First photo (solo row): show natural aspect ratio */
.tvg-place-row.cols-1 .tvg-gallery-item img {
    aspect-ratio: auto;
    height: auto;
}

.tvg-gallery-item:hover img { transform: scale(1.05); }
.tvg-gallery-item:hover { border-radius: 4px; }

/* Photo caption (location + date) */
.tvg-photo-caption {
    font-size: 13px;
    color: #555;
    text-align: center;
    padding: 5px 4px 2px;
    line-height: 1.3;
}

.tvg-no-results { text-align: center; padding: 60px 20px; color: #666; font-size: 18px; }

/* ── Loading state ────────────────────────────────────────────── */
.tvg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
    color: #888;
    font-size: 1rem;
    letter-spacing: 0.06em;
}
.tvg-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: tvgSpin 0.75s linear infinite;
}
@keyframes tvgSpin {
    to { transform: rotate(360deg); }
}

/* ── Pagination load-more sentinel ────────────────────────────── */
.tvg-load-more {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}
.tvg-load-more-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: tvgSpin 0.75s linear infinite;
}

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

/* ── Lightbox — fullscreen image only ─────────────────────────── */
.tvg-lightbox-dynamic {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important; height: 100vh !important;
    z-index: 2147483647 !important;
    background: #000 !important;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0 !important; padding: 0 !important;
    transform: none !important;
}

.tvg-lightbox-dynamic .lightbox-image-dynamic {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.tvg-lightbox-dynamic .lightbox-close-dynamic {
    position: absolute; top: 18px; right: 24px;
    font-size: 44px; line-height: 1;
    color: #fff; background: none; border: none;
    cursor: pointer; opacity: 0.75; transition: opacity 0.2s;
    z-index: 10; padding: 0;
}
.tvg-lightbox-dynamic .lightbox-close-dynamic:hover { opacity: 1; }

.tvg-lightbox-dynamic .lightbox-prev-dynamic,
.tvg-lightbox-dynamic .lightbox-next-dynamic {
    position: absolute; top: 50%; transform: translateY(-50%);
    font-size: 72px; line-height: 1;
    color: #fff; background: none; border: none;
    cursor: pointer; padding: 16px;
    opacity: 0.6; transition: opacity 0.2s;
    z-index: 10;
}
.tvg-lightbox-dynamic .lightbox-prev-dynamic:hover,
.tvg-lightbox-dynamic .lightbox-next-dynamic:hover { opacity: 1; }
.tvg-lightbox-dynamic .lightbox-prev-dynamic { left: 10px; }
.tvg-lightbox-dynamic .lightbox-next-dynamic { right: 10px; }

.tvg-lightbox-dynamic .lightbox-caption-dynamic {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 60px 40px 28px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    z-index: 20;
    pointer-events: none;
}

@media (max-width: 600px) {
    .tvg-lightbox-dynamic .lightbox-prev-dynamic,
    .tvg-lightbox-dynamic .lightbox-next-dynamic { font-size: 48px; padding: 10px; }
}

/* ── Responsive gallery ───────────────────────────────────────── */
@media (max-width: 1199px) { .tvg-gallery-container { padding: 0 12px; } }

@media (max-width: 900px) {
    .tvg-gallery-toolbar { flex-wrap: wrap; }
}

@media (max-width: 1366px) {
    .tvg-place-row.cols-4 { grid-template-columns: repeat(3, 1fr); }
    .tvg-country-cards { grid-template-columns: repeat(3, 1fr); }
    .tvg-unesco-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .tvg-place-row.cols-4,
    .tvg-place-row.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .tvg-country-cards { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .tvg-unesco-cards { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (max-width: 600px) {
    .tvg-gallery-container { padding: 0 12px !important; }
    .tvg-country-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .tvg-country-card-name span { font-size: 0.82rem; }
    .tvg-place-row { grid-template-columns: 1fr !important; }
    .tvg-country-name { font-size: 1.4rem; letter-spacing: 0.2em; margin-bottom: 24px; }
    .tvg-place-name { font-size: 0.95rem; letter-spacing: 0.15em; }
    .tvg-gallery-item { border-radius: 0; }
    .tvg-gallery-item img { aspect-ratio: auto; height: auto; }
    .tvg-unesco-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .tvg-tab-btn { padding: 10px 16px; font-size: 0.8rem; letter-spacing: 0.08em; }
    .tvg-unesco-country-heading { font-size: 0.95rem; letter-spacing: 0.18em; }
}

/* ═══════════════════════════════════════════════════════════════════
   [travel_photos] POST EMBED
   Desktop/iPad : hero full-width + CSS-grid below
   Mobile       : horizontal swipe carousel (CSS scroll-snap)
   ═══════════════════════════════════════════════════════════════════ */

.tvgembed-wrap {
    margin: 0;
}

.tvgembed-place {
    margin-bottom: 32px;
}

.tvgembed-place-name {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
}

/* ── Desktop / iPad: embed layout ── */
.tvgembed-photos { display: grid; gap: 6px; }
.tvgembed-photos .tvgembed-hero img { aspect-ratio: 16 / 9; }

/* ── Mobile (≤768px): JS carousel ── */
@media (max-width: 768px) {
    .tvgembed-carousel-wrap {
        position: relative;
        width: 100%;
        margin-bottom: 8px;
    }

    .tvgembed-photos {
        overflow: hidden !important;
        display: block !important;
        grid-template-columns: none !important;
    }

    .tvgembed-track {
        display: flex;
        transition: transform 0.35s ease;
        will-change: transform;
    }

    .tvgembed-track .tvg-gallery-item {
        flex: 0 0 100% !important;
        grid-column: unset !important;
        min-width: 0;
    }

    .tvgembed-track .tvg-gallery-item img {
        aspect-ratio: 4 / 3 !important;
        height: auto;
        width: 100%;
        display: block;
    }

    /* Prev/Next buttons — inside .tvgembed-photos which is position:relative */
    .tvgembed-carousel-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0,0,0,0.45);
        color: #fff;
        border: none;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    .tvgembed-prev { left: 8px; }
    .tvgembed-next { right: 8px; }

    /* Dots */
    .tvgembed-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        padding: 8px 0 4px;
    }
    .tvgembed-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #ccc;
        cursor: pointer;
        transition: background 0.2s;
    }
    .tvgembed-dot.active { background: #555; }
}

.tvgembed-no-results { color: #999; font-size: 14px; padding: 16px 0; }

/* ── Map detail panel (photos below map) ─────────────────────── */
#tvg-map-detail {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}
.tvg-map-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}
.tvg-map-detail-close {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tvg-map-detail-close:hover { background: #f5f5f5; color: #111; }

/* ── Map tab ──────────────────────────────────────────────────── */
#tvg-map-pane {
    padding: 8px 0 40px;
}

#tvg-map {
    width: 100%;
    height: 75vh;
    min-height: 500px;
    max-height: 900px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

/* Leaflet pin — strip default background/border from divIcon */
.tvg-map-pin {
    background: none !important;
    border: none !important;
}

/* Map popup */
.tvg-map-popup { font-family: inherit; min-width: 160px; }
.tvg-map-popup-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    margin-bottom: 8px;
}
.tvg-map-popup-name {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin-bottom: 2px;
    line-height: 1.3;
}
.tvg-map-popup-country {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}
.tvg-map-popup-meta {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
}
.tvg-map-popup-btn {
    display: block;
    width: 100%;
    padding: 6px 10px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: background 0.2s;
}
.tvg-map-popup-btn:hover { background: #333; }

/* Loading overlay */
.tvg-map-loading {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border-radius: 8px;
}
.tvg-map-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 14px;
}
.tvg-map-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: tvg-spin 0.8s linear infinite;
}
@keyframes tvg-spin { to { transform: rotate(360deg); } }

/* Legend control */
.tvg-map-legend-control {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 10px 12px;
    min-width: 140px;
}
.tvg-map-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.tvg-map-legend-row:hover { background: #f5f5f5; }
.tvg-map-legend-row svg { flex-shrink: 0; }
.tvg-map-legend-label { flex: 1; font-size: 13px; color: #333; font-weight: 500; }
.tvg-map-legend-count {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 10px;
}
.tvg-map-legend-row.tvg-legend-active .tvg-map-legend-label { color: #111; font-weight: 700; }
.tvg-map-legend-row.tvg-legend-dimmed { opacity: 0.35; }

