/* ============================================================
   GeoBizz skeleton loaders (images & videos)
   - .skl-host  : shimmer placeholder painted on the element itself
   - .skl-ready : element revealed with a soft fade
   - Theme-aware (Bootstrap data-bs-theme) + reduced-motion safe
   ============================================================ */

:root {
    --skl-base: #e9ecef;
    --skl-shine: rgba(255, 255, 255, .65);
    --skl-icon: rgba(99, 102, 241, .55);
}

[data-bs-theme="dark"] {
    --skl-base: #1d2433;
    --skl-shine: rgba(255, 255, 255, .07);
    --skl-icon: rgba(148, 163, 255, .4);
}

/* ---- Placeholder state (before the media is ready) ---- */
.skl-host {
    position: relative;
    background-color: var(--skl-base);
    overflow: hidden;
}

/* keep the shimmer visible before video dimensions are known */
.skl-host[data-skl="video"] { min-height: 120px; }

/* animated shine sweep */
.skl-host::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    transform: translateX(-100%);
    background: linear-gradient(
        100deg,
        transparent 20%,
        var(--skl-shine) 50%,
        transparent 80%
    );
    animation: skl-shimmer 1.4s ease-in-out infinite;
}

@keyframes skl-shimmer {
    100% { transform: translateX(100%); }
}

/* small icon: image frame or play button, centered */
.skl-host::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    opacity: .85;
    pointer-events: none;
    background-color: var(--skl-icon);
    -webkit-mask: var(--skl-mask) center / contain no-repeat;
            mask: var(--skl-mask, none) center / contain no-repeat;
}

/* images: little "photo" glyph */
.skl-host[data-skl="image"]::after {
    --skl-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'><rect x='3' y='3' width='18' height='18' rx='2'/><circle cx='8.5' cy='8.5' r='1.5' fill='black' stroke='none'/><path d='M21 15l-5-5L5 21'/></svg>");
}

/* videos: play button glyph */
.skl-host[data-skl="video"]::after {
    width: 44px;
    height: 44px;
    --skl-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M8 5.5v13a1 1 0 0 0 1.5.87l11-6.5a1 1 0 0 0 0-1.74l-11-6.5A1 1 0 0 0 8 5.5z'/></svg>");
}

/* ---- Ready state: fade the real media in ---- */
.skl-host > img,
.skl-host > video,
.skl-host > source + * { min-height: 1px; }

.skl-host.skl-ready::before,
.skl-host.skl-ready::after {
    animation: none;
    opacity: 0;
    transition: opacity .45s ease;
}

/* hide the image until ready, then fade it in.
   Videos are NOT hidden: their poster acts as the visual placeholder and
   the shimmer sweeps on top until real frames start rendering. */
.skl-host img {
    opacity: 0;
    transition: opacity .45s ease;
    display: block;
    width: 100%;
    height: auto;
}

.skl-host video {
    display: block;
}

.skl-host.skl-ready img {
    opacity: 1;
}

/* ---- Alternative: soft pulse style (opt-in via data-skl-style="pulse") ---- */
.skl-pulse {
    animation: skl-pulse 1.6s ease-in-out infinite;
}

@keyframes skl-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .55; }
}

/* ---- Reduced motion: static placeholder, instant reveal ---- */
@media (prefers-reduced-motion: reduce) {
    .skl-host::before { animation: none; transform: none; opacity: .5; }
    .skl-host img,
    .skl-host video { transition: none; }
}
