/* ── Cloudinary Video Hero — Frontend v3.1 ── */

.cvh-hero-section {
    box-sizing: border-box;
    contain: layout style paint;
}
.cvh-hero-section > div,
.cvh-hero-section > picture,
.cvh-hero-section > video,
.cvh-hero-section > img,
.cvh-hero-section > button,
.cvh-hero-section > noscript,
.cvh-hero-section .cvh-layer,
.cvh-hero-section .cvh-layer > div,
.cvh-hero-section .cvh-layer img,
.cvh-hero-section .cvh-layer picture,
.cvh-hero-section .cvh-layer a {
    box-sizing: border-box;
}

/*
 * isolation:isolate on #cvh-outer-X creates a stacking context without
 * assigning a z-index, so the hero group stays below themed nav (z:100+).
 *
 * Theme compatibility: the hero's stacking context (isolation:isolate)
 * ensures all hero z-indices are scoped. If your theme's header appears
 * behind the hero, add z-index:100 to your header element in your theme CSS.
 * CVH no longer forces z-index on theme selectors to avoid side effects.
 */

/* Full-width breakout */
.cvh-full-width {
    width: 100vw !important;
    max-width: 100vw !important;
}

[id$="-outer"]:has(.cvh-full-width) {
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
}

/* Background media — never interactive */
.cvh-placeholder,
.cvh-video {
    pointer-events: none !important;
    -webkit-user-select: none;
    user-select: none;
}

/* Layers */
.cvh-layer {
    pointer-events: none;
}
.cvh-layer a,
.cvh-layer button,
.cvh-layer input,
.cvh-layer select,
.cvh-layer textarea,
.cvh-layer [role="button"],
.cvh-layer [tabindex] {
    pointer-events: auto;
}

/* Tint: uses rgba() background — no CSS opacity needed */
.cvh-tint {
    pointer-events: none !important;
    -webkit-user-select: none;
    user-select: none;
}

/* Cloudinary image layers */
.cvh-layer img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── Play button overlay ── */
.cvh-play-btn {
    /* Reset browser button styles */
    background: rgba(0, 0, 0, 0.45);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    /* Visual */
    width: 64px;
    height: 64px;
    border-radius: 50%;
    color: #fff;          /* SVG polygon uses currentColor */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    pointer-events: auto;
}
/* SVG inside play button: inherits color, no-shrink */
.cvh-play-btn svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-left: 3px; /* optical centering for play triangle */
}

.cvh-play-btn:hover,
.cvh-play-btn:focus-visible {
    background: rgba(0, 0, 0, 0.65);
    transform: scale(1.1);
    outline: 2px solid rgba(255,255,255,0.6);
    outline-offset: 3px;
}

.cvh-play-btn:active {
    transform: scale(0.95);
}

/* When section has play mode, cursor is pointer */
.cvh-has-playbtn {
    cursor: pointer;
}

/* Responsive — smaller button on mobile */
@media (max-width: 480px) {
    .cvh-play-btn {
        width: 48px;
        height: 48px;
    }
    .cvh-play-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* ── Blur overlay (z:6) ── */
/*
 * Uses backdrop-filter for a frosted-glass effect behind the element.
 * -webkit-backdrop-filter covers Safari 9+ and older Chrome/Edge.
 * Transition gives a smooth fade when video starts/pauses.
 * Falls back to a semi-dark overlay on browsers without backdrop-filter
 * (Firefox < 103, old Android Chrome) — JS adds a background rgba() there.
 */
.cvh-blur-overlay {
    /* Transition: opacity fade, not filter change — more performant */
    transition: opacity 0.35s ease;
    opacity: 1; /* starts visible; JS hides it on play */

    /* Promote to GPU layer to avoid repainting neighbors */
    will-change: opacity;

    /* Ensure it never captures pointer events */
    pointer-events: none !important;
    -webkit-user-select: none;
    user-select: none;
}

/* While video is playing, JS sets opacity:0 */
/* While paused/not started, JS sets opacity:1 */

/* ─────────────────────────────────────────────────────
   Responsive play button tweaks
   On very small viewports, keep the button accessible
───────────────────────────────────────────────────── */
@media (max-width: 360px) {
    .cvh-play-btn {
        width: 44px;
        height: 44px;
    }
    .cvh-play-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ── Poster blur (loading state) ── */
/*
 * Applied via class when "Blur Placeholder" is enabled.
 * The blur+scale is set inline (amount is configurable), but the
 * transition lives here so it's cached and minifiable.
 * When the video starts playing the placeholder is hidden — the transition
 * fires briefly for a smooth dissolve from blur → video.
 */
.cvh-poster-blur {
    transition: filter 0.4s ease, opacity 0.4s ease;
}

/* ── CVH Layer Button ── */
.cvh-layer-btn {
    /* hover handled via opacity + slight lift */
}
.cvh-layer-btn:hover,
.cvh-layer-btn:focus-visible {
    opacity: .85;
    transform: translateY(-2px);
    outline: 3px solid rgba(255,255,255,.5);
    outline-offset: 2px;
}
.cvh-layer-btn:active {
    transform: translateY(0);
    opacity: .7;
}

/* Dark + outline_dark buttons: dark outline on hover */
.cvh-layer-btn-dark:hover,
.cvh-layer-btn-dark:focus-visible,
.cvh-layer-btn-outline_dark:hover,
.cvh-layer-btn-outline_dark:focus-visible {
    outline-color: rgba(0,0,0,.3);
}

/* Glass button: brighter on hover */
.cvh-layer-btn-glass:hover,
.cvh-layer-btn-glass:focus-visible {
    background: rgba(255,255,255,.22) !important;
    outline-color: rgba(255,255,255,.4);
}

/* Gradient button: slight glow */
.cvh-layer-btn-gradient:hover,
.cvh-layer-btn-gradient:focus-visible {
    box-shadow: 0 4px 20px rgba(102,126,234,.4);
    outline-color: rgba(255,255,255,.4);
}

/* ═══════════════════════════════════════════════════════════
   DEBUG OVERLAY  (z:999 — always on top within the hero)
   Only rendered for logged-in admin users or when
   localStorage.cvhDebug='1'. Never visible to front-end
   visitors unless they explicitly activate it.
═══════════════════════════════════════════════════════════ */

/* Toggle button — floating in top-right of the hero */
.cvh-debug-btn {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 999;
    padding: 4px 10px;
    background: rgba(0,0,0,0.65);
    color: #7affb2;
    border: 1px solid rgba(122,255,178,0.4);
    border-radius: 4px;
    font: 600 11px/1 monospace;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.15s;
    letter-spacing: .04em;
}
.cvh-debug-btn:hover,
.cvh-debug-btn.active {
    background: rgba(20,20,20,0.9);
    border-color: #7affb2;
}

/* Full-hero debug panel */
.cvh-debug-panel {
    position: absolute;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.88);
    color: #e8e8e8;
    overflow-y: auto;
    padding: 0 0 12px;
    pointer-events: auto;
    font: 12px/1.5 monospace;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Header bar */
.cvh-dbg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(122,255,178,0.12);
    border-bottom: 1px solid rgba(122,255,178,0.25);
    position: sticky;
    top: 0;
    z-index: 1;
}
.cvh-dbg-title {
    color: #7affb2;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .03em;
}
.cvh-dbg-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.cvh-dbg-close:hover { color: #fff; }

/* Data table */
.cvh-dbg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
}
.cvh-dbg-table th {
    text-align: left;
    padding: 8px 14px 4px;
    color: #7affb2;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.cvh-dbg-table td {
    padding: 3px 14px;
    vertical-align: top;
    word-break: break-all;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cvh-dbg-table td:first-child {
    color: #aaa;
    width: 120px;
    white-space: nowrap;
    word-break: normal;
}
.cvh-dbg-table a {
    color: #6bbdff;
    text-decoration: none;
}
.cvh-dbg-table a:hover { text-decoration: underline; }

/* Active breakpoint highlight */
.cvh-dbg-active-bp td { background: rgba(122,255,178,0.08); }
.cvh-dbg-active-bp td:first-child { color: #7affb2; font-weight: 700; }

/* Source labels */
.cvh-dbg-local { color: #7affb2; font-size: 10px; font-weight: 700; }
.cvh-dbg-cld   { color: #f5a623; font-size: 10px; }
