/**
 * =========================================================
 * SUNIVA Experience Engine
 * Cinema Styles v1.0.0
 *
 * 配置先
 * /html/assets/css/suniva/cinema.css
 * =========================================================
 */


/* =========================================================
   Viewer
   ========================================================= */

.suniva-cinema-viewer {
    position: fixed;
    z-index: 12000;
    inset: 0;
    display: grid;
    overflow: hidden;
    color: #ffffff;
    background: #050403;
    opacity: 0;
    visibility: hidden;
    cursor: default;
    isolation: isolate;
    transition:
        opacity 700ms ease,
        visibility 700ms ease;
}

.suniva-cinema-viewer::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        radial-gradient(
            circle at 50% 40%,
            rgba(199, 163, 106, 0.08),
            transparent 46%
        );
}

.suniva-cinema-viewer[hidden] {
    display: none;
}

.suniva-cinema-viewer.is-open {
    opacity: 1;
    visibility: visible;
}

.suniva-cinema-viewer.is-fullscreen {
    width: 100vw;
    height: 100svh;
}

.suniva-cinema-viewer.is-cursor-hidden {
    cursor: none;
}


/* =========================================================
   Stage
   ========================================================= */

.suniva-cinema-stage {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #050403;
}

.suniva-cinema-scene-container {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
}


/* =========================================================
   Active Scene
   ========================================================= */

.suniva-cinema-active-scene {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    opacity: 0;
    will-change:
        opacity,
        transform,
        filter;
}

.suniva-cinema-active-scene.is-visible {
    opacity: 1;
}

.suniva-cinema-active-scene > * {
    width: 100%;
    height: 100%;
}

.suniva-cinema-active-scene img,
.suniva-cinema-active-scene video,
.suniva-cinema-active-scene picture {
    display: block;
    width: 100%;
    height: 100%;
}

.suniva-cinema-active-scene img,
.suniva-cinema-active-scene video {
    object-fit: contain;
}


/* 全面表示用 */

.suniva-cinema-active-scene
    [data-cinema-cover] img,
.suniva-cinema-active-scene
    img[data-cinema-cover],
.suniva-cinema-active-scene
    .is-cinema-cover img {
    object-fit: cover;
}


/* =========================================================
   Fade Transition
   ========================================================= */

.suniva-cinema-transition--fade {
    transform: scale(1.012);
    transition:
        opacity 1400ms ease,
        transform 8000ms linear;
}

.suniva-cinema-transition--fade.is-visible {
    transform: scale(1.035);
}


/* =========================================================
   Zoom Transition
   ========================================================= */

.suniva-cinema-transition--zoom {
    filter: brightness(0.82);
    transform: scale(1.1);
    transition:
        opacity 1600ms ease,
        filter 1800ms ease,
        transform 9000ms
            cubic-bezier(0.18, 0.7, 0.24, 1);
}

.suniva-cinema-transition--zoom.is-visible {
    filter: brightness(1);
    transform: scale(1);
}


/* =========================================================
   Slide Transition
   ========================================================= */

.suniva-cinema-transition--slide {
    transform: translateX(5%);
    transition:
        opacity 1100ms ease,
        transform 1800ms
            cubic-bezier(0.22, 1, 0.36, 1);
}

.suniva-cinema-transition--slide.is-visible {
    transform: translateX(0);
}


/* =========================================================
   Soft Transition
   ========================================================= */

.suniva-cinema-transition--soft {
    filter: blur(16px);
    transform: scale(1.025);
    transition:
        opacity 1700ms ease,
        filter 2000ms ease,
        transform 7000ms ease;
}

.suniva-cinema-transition--soft.is-visible {
    filter: blur(0);
    transform: scale(1);
}


/* =========================================================
   Cinema内テキスト
   ========================================================= */

.suniva-cinema-active-scene
    [data-cinema-content] {
    position: absolute;
    z-index: 3;
    right:
        clamp(34px, 8vw, 140px);
    bottom:
        clamp(60px, 10vh, 140px);
    left:
        clamp(34px, 8vw, 140px);
    width: min(760px, 78vw);
    height: auto;
    color: #ffffff;
    text-shadow:
        0 4px 24px rgba(0, 0, 0, 0.42);
}

.suniva-cinema-active-scene
    [data-cinema-title] {
    margin: 0;
    color: #ffffff;
    font-size:
        clamp(42px, 7vw, 112px);
    font-weight: 500;
    line-height: 1.06;
    letter-spacing: -0.045em;
}

.suniva-cinema-active-scene
    [data-cinema-caption] {
    max-width: 660px;
    margin: 28px 0 0;
    color:
        rgba(255, 255, 255, 0.82);
    font-size:
        clamp(16px, 2vw, 26px);
    line-height: 1.8;
}


/* =========================================================
   QR Scene
   ========================================================= */

.suniva-cinema-viewer.is-qr-scene
    .suniva-cinema-active-scene::before {
    position: absolute;
    z-index: 1;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        radial-gradient(
            circle at center,
            rgba(255, 255, 255, 0.08),
            rgba(5, 4, 3, 0.4) 72%
        );
}

.suniva-cinema-viewer.is-qr-scene
    [data-cinema-qr] {
    position: relative;
    z-index: 2;
}

.suniva-cinema-viewer.is-qr-scene
    [data-cinema-qr-image],
.suniva-cinema-viewer.is-qr-scene
    .suniva-cinema-qr-image {
    width:
        clamp(220px, 25vw, 420px);
    height:
        clamp(220px, 25vw, 420px);
    padding:
        clamp(12px, 1.5vw, 22px);
    border-radius:
        clamp(18px, 2vw, 30px);
    background: #ffffff;
    box-shadow:
        0 30px 100px
        rgba(0, 0, 0, 0.45),
        0 0 70px
        rgba(230, 211, 173, 0.18);
    object-fit: contain;
    animation:
        sunivaCinemaQrGlow
        3.2s ease-in-out infinite;
}

@keyframes sunivaCinemaQrGlow {
    0%,
    100% {
        box-shadow:
            0 30px 100px
            rgba(0, 0, 0, 0.45),
            0 0 36px
            rgba(230, 211, 173, 0.12);
    }

    50% {
        box-shadow:
            0 30px 100px
            rgba(0, 0, 0, 0.45),
            0 0 90px
            rgba(230, 211, 173, 0.3);
    }
}


/* =========================================================
   Loading
   ========================================================= */

.suniva-cinema-loading {
    position: absolute;
    z-index: 6;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    pointer-events: none;
    background:
        rgba(5, 4, 3, 0.72);
    transition:
        opacity 400ms ease;
}

.suniva-cinema-loading[hidden] {
    display: none;
}

.suniva-cinema-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background:
        var(--suniva-gold-light, #e6d3ad);
    animation:
        sunivaCinemaLoading
        1.3s ease-in-out infinite;
}

.suniva-cinema-loading
    span:nth-child(2) {
    animation-delay: 130ms;
}

.suniva-cinema-loading
    span:nth-child(3) {
    animation-delay: 260ms;
}

@keyframes sunivaCinemaLoading {
    0%,
    65%,
    100% {
        opacity: 0.28;
        transform: translateY(0);
    }

    32% {
        opacity: 1;
        transform: translateY(-8px);
    }
}


/* =========================================================
   Controls
   ========================================================= */

.suniva-cinema-controls {
    position: fixed;
    z-index: 12;
    bottom:
        max(
            24px,
            env(safe-area-inset-bottom)
        );
    left: 50%;
    display: flex;
    min-height: 54px;
    align-items: center;
    gap: 5px;
    padding: 7px;
    border:
        1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background:
        rgba(12, 10, 9, 0.56);
    box-shadow:
        0 18px 60px
        rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter:
        blur(20px);
    backdrop-filter:
        blur(20px);
    opacity: 1;
    transform: translateX(-50%);
    transition:
        opacity 500ms ease,
        transform 500ms
            cubic-bezier(0.22, 1, 0.36, 1);
}

.suniva-cinema-controls button {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    transition:
        color 220ms ease,
        background-color 220ms ease,
        transform 220ms ease;
}

.suniva-cinema-controls button:hover {
    color:
        var(--suniva-gold-light, #e6d3ad);
    background:
        rgba(255, 255, 255, 0.1);
    transform: scale(1.06);
}

.suniva-cinema-counter {
    min-width: 72px;
    padding-inline: 9px;
    color:
        rgba(255, 255, 255, 0.65);
    font-size: 10px;
    font-variant-numeric:
        tabular-nums;
    letter-spacing: 0.16em;
    text-align: center;
}


/* =========================================================
   Close
   ========================================================= */

.suniva-cinema-close {
    position: fixed;
    z-index: 12;
    top:
        max(18px, env(safe-area-inset-top));
    right:
        max(18px, env(safe-area-inset-right));
    display: grid;
    width: 50px;
    height: 50px;
    padding: 0;
    place-items: center;
    border:
        1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    color: #ffffff;
    background:
        rgba(12, 10, 9, 0.42);
    -webkit-backdrop-filter:
        blur(16px);
    backdrop-filter:
        blur(16px);
    cursor: pointer;
    font-size: 31px;
    font-weight: 200;
    line-height: 1;
    opacity: 1;
    transition:
        opacity 500ms ease,
        background-color 250ms ease,
        border-color 250ms ease,
        transform 250ms ease;
}

.suniva-cinema-close:hover {
    border-color:
        rgba(255, 255, 255, 0.52);
    background:
        rgba(255, 255, 255, 0.14);
    transform: rotate(6deg);
}


/* =========================================================
   UI非表示
   ========================================================= */

.suniva-cinema-viewer.is-interface-hidden
    .suniva-cinema-controls {
    pointer-events: none;
    opacity: 0;
    transform:
        translateX(-50%)
        translateY(20px);
}

.suniva-cinema-viewer.is-interface-hidden
    .suniva-cinema-close {
    pointer-events: none;
    opacity: 0;
}


/* =========================================================
   Progress
   ========================================================= */

.suniva-cinema-progress {
    position: fixed;
    z-index: 11;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    background:
        rgba(255, 255, 255, 0.08);
    opacity: 1;
    transition:
        opacity 500ms ease;
}

.suniva-cinema-progress-bar {
    display: block;
    width: 0;
    height: 100%;
    background:
        linear-gradient(
            90deg,
            var(--suniva-gold-dark, #8b6a37),
            var(--suniva-gold-light, #e6d3ad),
            #ffffff
        );
    box-shadow:
        0 0 18px
        rgba(230, 211, 173, 0.48);
    transform-origin: left center;
}

.suniva-cinema-viewer.is-interface-hidden
    .suniva-cinema-progress {
    opacity: 0;
}

@keyframes sunivaCinemaProgress {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}


/* =========================================================
   Playing / Paused
   ========================================================= */

.suniva-cinema-viewer:not(
    .is-playing
) .suniva-cinema-active-scene {
    animation-play-state: paused;
}

.suniva-cinema-viewer:not(
    .is-playing
) .suniva-cinema-progress-bar {
    animation-play-state: paused !important;
}

.suniva-cinema-viewer.is-muted
    .suniva-cinema-sound {
    color:
        rgba(255, 255, 255, 0.42);
}


/* =========================================================
   大型モニター向け
   ========================================================= */

@media (min-width: 1800px) {
    .suniva-cinema-controls {
        min-height: 66px;
        gap: 8px;
        padding: 9px;
    }

    .suniva-cinema-controls button {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .suniva-cinema-counter {
        min-width: 88px;
        font-size: 12px;
    }

    .suniva-cinema-close {
        width: 60px;
        height: 60px;
        font-size: 37px;
    }
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 1024px) {
    .suniva-cinema-active-scene
        [data-cinema-content] {
        right: 60px;
        bottom: 100px;
        left: 60px;
        width: auto;
    }
}


/* =========================================================
   Smartphone
   ========================================================= */

@media (max-width: 767px) {
    .suniva-cinema-active-scene {
        padding:
            max(
                54px,
                env(safe-area-inset-top)
            )
            8px
            max(
                68px,
                calc(
                    env(safe-area-inset-bottom)
                    + 54px
                )
            );
    }

    .suniva-cinema-active-scene > * {
        height: auto;
        max-height: 100%;
    }

    .suniva-cinema-active-scene img,
    .suniva-cinema-active-scene video {
        max-height:
            calc(
                100svh -
                130px -
                env(safe-area-inset-top) -
                env(safe-area-inset-bottom)
            );
        object-fit: contain;
    }

    .suniva-cinema-active-scene
        [data-cinema-content] {
        right: 20px;
        bottom:
            max(
                80px,
                calc(
                    env(safe-area-inset-bottom)
                    + 65px
                )
            );
        left: 20px;
        width: auto;
    }

    .suniva-cinema-active-scene
        [data-cinema-title] {
        font-size:
            clamp(30px, 11vw, 54px);
    }

    .suniva-cinema-active-scene
        [data-cinema-caption] {
        display: -webkit-box;
        margin-top: 14px;
        overflow: hidden;
        font-size: 13px;
        line-height: 1.65;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
    }

    .suniva-cinema-controls {
        bottom:
            max(
                12px,
                env(safe-area-inset-bottom)
            );
        min-height: 46px;
        gap: 0;
        padding: 4px;
    }

    .suniva-cinema-controls button {
        width: 34px;
        height: 34px;
        font-size: 12px;
    }

    .suniva-cinema-counter {
        min-width: 55px;
        padding-inline: 4px;
        font-size: 8px;
    }

    .suniva-cinema-close {
        top:
            max(
                10px,
                env(safe-area-inset-top)
            );
        right:
            max(
                10px,
                env(safe-area-inset-right)
            );
        width: 43px;
        height: 43px;
        font-size: 26px;
    }

    .suniva-cinema-viewer.is-qr-scene
        [data-cinema-qr-image],
    .suniva-cinema-viewer.is-qr-scene
        .suniva-cinema-qr-image {
        width:
            min(64vw, 290px);
        height:
            min(64vw, 290px);
        padding: 12px;
        border-radius: 18px;
    }
}


/* =========================================================
   横向きスマートフォン
   ========================================================= */

@media (
    max-height: 520px
) and (
    orientation: landscape
) {
    .suniva-cinema-active-scene {
        padding: 8px 64px;
    }

    .suniva-cinema-active-scene img,
    .suniva-cinema-active-scene video {
        max-height:
            calc(100svh - 16px);
    }

    .suniva-cinema-active-scene
        [data-cinema-content] {
        right: 80px;
        bottom: 35px;
        left: 80px;
    }

    .suniva-cinema-controls {
        bottom: 7px;
    }

    .suniva-cinema-close {
        top: 7px;
        right: 7px;
    }

    .suniva-cinema-viewer.is-qr-scene
        [data-cinema-qr-image],
    .suniva-cinema-viewer.is-qr-scene
        .suniva-cinema-qr-image {
        width:
            min(48vh, 260px);
        height:
            min(48vh, 260px);
    }
}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (
    prefers-reduced-motion: reduce
) {
    .suniva-cinema-viewer,
    .suniva-cinema-active-scene,
    .suniva-cinema-controls,
    .suniva-cinema-close,
    .suniva-cinema-progress {
        transition-duration: 0.01ms;
    }

    .suniva-cinema-active-scene,
    .suniva-cinema-active-scene.is-visible {
        filter: none;
        transform: none;
    }

    .suniva-cinema-loading span,
    .suniva-cinema-viewer.is-qr-scene
        [data-cinema-qr-image],
    .suniva-cinema-viewer.is-qr-scene
        .suniva-cinema-qr-image {
        animation: none;
    }
}