/* ================================================================
   Vits Homepage - Shared Video Animation Styles
   Shared chrome: outer container, hl-bar, play overlay, keyframes.
   Video-specific scene CSS lives in each animation partial.
   ================================================================ */

/* Scoped reset - only affects elements inside .vits-anim */
.vits-anim * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Outer wrapper */
#outer {
    width: 100%;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

/* Scene wrapper (Middleware only) - fills #v on desktop */
#sc-wrap {
    position: absolute;
    inset: 0;
}

/* Context badge - shown on scene 1 only, hidden by JS on scene change */
#hl-ctx {
    display: inline-block;
    font-size: clamp(8px, 1.2vw, 10px);
    font-weight: 700;
    color: rgba(255, 255, 255, .72);
    letter-spacing: .08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, .11);
    border: 0.5px solid rgba(255, 255, 255, .28);
    border-radius: 4px;
    padding: 2px 7px;
    margin-bottom: 5px;
}

/* Headline bar - overlaid on top of #v (absolute within #outer); stacks above on mobile */
#hl-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 16px 22px 52px;
    background: linear-gradient(to bottom, rgba(0,0,0,.88) 0%, rgba(0,0,0,.55) 55%, transparent 100%);
    pointer-events: none;
}

#hl-title {
    font-size: clamp(15px, 2.6vw, 22px);
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    transition: opacity .45s ease, transform .45s cubic-bezier(.22, 1, .36, 1);
}

#hl-sub {
    font-size: clamp(11px, 1.7vw, 14px);
    color: rgba(255, 255, 255, .45);
    margin-top: 4px;
    transition: opacity .4s ease .1s;
    display: none !important;
}

/* Video viewport */
#v {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
}

/* Scenes */
.sc {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .6s ease;
}

.sc.on {
    opacity: 1;
    pointer-events: auto;
}

/* Play overlay */
#play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
    transition: opacity .4s ease;
}

#play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#play-btn {
    width: clamp(56px, 10vw, 80px);
    height: clamp(56px, 10vw, 80px);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    border: 2px solid rgba(255, 255, 255, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, background .2s ease;
}

#play-overlay:hover #play-btn {
    background: rgba(255, 255, 255, .22);
    transform: scale(1.08);
}

.play-tri {
    width: 0;
    height: 0;
    border-top: clamp(12px, 2.2vw, 18px) solid transparent;
    border-bottom: clamp(12px, 2.2vw, 18px) solid transparent;
    border-left: clamp(20px, 3.5vw, 28px) solid #fff;
    margin-left: 4px;
}

/* Progress bar - color set via --vid-accent per video */
#prog {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    border-radius: 0 2px 2px 0;
    background: var(--vid-accent, rgba(100, 150, 255, .6));
}

/* Control bar - pause / prev / next */
#ctrl-bar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

#ctrl-bar.visible {
    opacity: 0;
    pointer-events: auto;
}

#v:hover #ctrl-bar.visible {
    opacity: 1;
}

#ctrl-bar button {
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 5px;
    color: rgba(255, 255, 255, .75);
    font-size: 10px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    line-height: 1;
}

#ctrl-bar button:hover {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

#ctrl-bar #ctrl-pause {
    min-width: 34px;
    text-align: center;
}

/* End screen base */
#s5 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.s5-logo {
    font-size: clamp(18px, 4vw, 34px);
    font-weight: 700;
    color: rgba(255, 255, 255, .92);
    letter-spacing: -.03em;
    opacity: 0;
    transform: translateY(10px);
}

.s5-tag {
    font-size: clamp(10px, 1.7vw, 13px);
    font-weight: 500;
    color: rgba(255, 255, 255, .32);
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: 0;
}

.s5-btns {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.s5-cta {
    padding: 10px 28px;
    border-radius: 6px;
    border: 0.5px solid var(--vid-cta-border, rgba(100, 150, 255, .38));
    background: var(--vid-cta-bg, rgba(100, 150, 255, .07));
    color: var(--vid-cta-color, rgba(130, 170, 255, .9));
    font-size: clamp(11px, 1.9vw, 14px);
    font-weight: 700;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    opacity: 0;
    transform: translateY(6px);
    cursor: pointer;
}

.s5-cta:hover {
    background: var(--vid-cta-hover, rgba(100, 150, 255, .15));
}

.s5-replay {
    padding: 10px 22px;
    border-radius: 6px;
    border: 0.5px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .04);
    color: rgba(255, 255, 255, .45);
    font-size: clamp(11px, 1.9vw, 14px);
    font-weight: 700;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    opacity: 0;
    transform: translateY(6px);
    cursor: pointer;
}

.s5-replay:hover {
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .75);
}

/* Shared keyframes */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(.8); }
}

@keyframes ripple {
    0% { transform: scale(1); opacity: .7; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* Mobile: headline font only - no scale-down, percentage layouts handle it */
@media (max-width: 768px) {

    #hl-title {
        font-size: clamp(11px, 3.2vw, 14px) !important;
    }
}

/* ----------------------------------------------------------------
   Mobile / narrow screens - headline sits above the scene area
   ---------------------------------------------------------------- */
@media (max-width: 560px) {
    #outer {
        display: flex;
        flex-direction: column;
    }

    /* hl-bar leaves the absolute overlay and becomes a real block */
    #hl-bar {
        position: relative !important;
        background: rgba(6, 6, 14, .97);
        flex-shrink: 0;
        padding: 8px 14px 10px;
        min-height: 54px;
    }

    /* keep height stable when innerHTML is cleared (e.g. on replay) */
    #hl-title {
        min-height: 1.4em;
    }

    #hl-sub {
        min-height: 1.3em;
    }

    /* video viewport: maintain 16:9 based on actual container width */
    #v {
        width: 100%;
        aspect-ratio: 16 / 9 !important;
        height: auto !important;
        flex-shrink: 0;
    }

    /* sc-wrap (Middleware inner wrapper) stays absolute inside #v */

    #v #ctrl-bar.visible {
        opacity: 1;
    }

    /* End screen: hide in-scene replay button - ctrl-bar replay button takes over */
    .s5-replay {
        display: none !important;
    }
}
