/* ==========================================================
   Mobile Video Showcase - Structure
   1) Local Tokens
   2) Layout
   3) Device Shell + Screen
   4) Video Player + Overlay Play Button
   5) Desktop Text Controls (BIC)
   6) Responsive
   ========================================================== */

/* ==========================================================
   Local Tokens
   ========================================================== */
.mobile-video-showcase {
    --mobile-video-phone-width: 420px;
    --mobile-video-phone-height: 800px;
    --mobile-video-phone-ratio-mobile: 9 / 16;

    --mobile-video-shell-radius: 44px;
    --mobile-video-screen-radius: 34px;
    --mobile-video-shell-padding: 12px;
    --mobile-video-shell-padding-mobile: 10px;

    /* Match Slot desktop CTA size */
    --project-cta-width: auto;
    --project-cta-height: 46px;
    --project-cta-padding-y: 10px;
    --project-cta-padding-x: 26px;
    --project-cta-font-size: 24px;
}

/* ==========================================================
   Layout
   ========================================================== */
.mobile-video-showcase-layout {
    grid-template-columns: minmax(0, var(--project-showcase-copy-width)) minmax(0, var(--mobile-video-phone-width));
    column-gap: var(--project-showcase-gap);
    align-items: center;
}

.mobile-video-showcase-copy {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
}

.mobile-video-showcase-device-col {
    display: flex;
    width: min(100%, var(--mobile-video-phone-width));
    max-width: min(100%, var(--mobile-video-phone-width));
    justify-content: flex-start;
}

/* ==========================================================
   Device Shell + Screen
   ========================================================== */
.mobile-video-showcase-device {
    position: relative;
    width: var(--mobile-video-phone-width);
    max-width: 100%;
    height: var(--mobile-video-phone-height);
    margin: 0;
    padding: var(--mobile-video-shell-padding);
    border-radius: var(--mobile-video-shell-radius);
    background: var(--bg-dark);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-on-dark) 24%, transparent);
}

.mobile-video-showcase-screen {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--mobile-video-screen-radius);
    overflow: hidden;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(circle, white 99%, black 100%);
    isolation: isolate;
    background: var(--bg-dark);
}

.mobile-video-showcase-side-button {
    position: absolute;
    right: -2px;
    top: 28%;
    width: 3px;
    height: 72px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-dark) 82%, var(--text-on-dark));
    pointer-events: none;
}

/* ==========================================================
   Video Player + Overlay Play Button
   ========================================================== */
.mobile-video-showcase-player {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
}

.mobile-video-showcase-media {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    object-fit: cover;
}

.mobile-video-showcase-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 0;
    border-radius: 999px;
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    padding: 0;
    background: color-mix(in srgb, var(--bg-dark) 80%, transparent);
    color: transparent;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.mobile-video-showcase-play::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    background: var(--text-on-dark);
    clip-path: polygon(18% 12%, 18% 88%, 88% 50%);
    transform: translate(-42%, -50%);
}

.mobile-video-showcase-play:hover {
    transform: translate(-50%, -50%) scale(1.03);
}

.mobile-video-showcase-play:active {
    transform: translate(-50%, -50%) scale(0.97);
}

.mobile-video-showcase-play[aria-pressed="true"] {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================
   Desktop Text Controls (BIC)
   ========================================================== */
.mobile-video-showcase-desktop-controls {
    margin-top: var(--title-text-space, 10px);
    display: none;
}

@media (min-width: 901px) {
    body[data-project-slug="bic-shave-club"] .mobile-video-showcase-desktop-controls {
        display: flex;
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
        margin-right: 0;
        align-self: stretch;
    }

    body[data-project-slug="bic-shave-club"] .mobile-video-showcase-play {
        display: none;
    }

    body[data-project-slug="bic-shave-club"] .mobile-video-showcase-desktop-controls .js-mobile-video-desktop-toggle:not(.is-active) {
        border-color: var(--bg-dark);
        color: var(--text-on-light);
        opacity: 1;
    }

    body[data-project-slug="bic-shave-club"] .mobile-video-showcase-desktop-controls .js-mobile-video-desktop-toggle:not(.is-active):hover {
        border-color: var(--grey);
        color: var(--text-grey);
        opacity: 1;
    }

    body[data-project-slug="bic-shave-club"] .js-mobile-video-desktop-toggle.is-active {
        background: var(--bg-dark);
        border-color: var(--bg-dark);
        color: var(--text-on-dark);
        opacity: 1;
    }
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 900px) {
    .mobile-video-showcase-layout {
        grid-template-columns: 1fr;
        row-gap: var(--project-media-controls-gap-mobile);
    }

    .mobile-video-showcase-device-col {
        justify-self: center;
        margin-left: auto;
        margin-right: auto;
        justify-content: center;
    }

    .mobile-video-showcase-desktop-controls {
        display: none;
    }
}

@media (max-width: 640px) {
    .mobile-video-showcase {
        --mobile-video-phone-width: calc(100dvw - (2 * (var(--page-gutter) + 20px)));
        --mobile-video-shell-radius: 34px;
        --mobile-video-screen-radius: 26px;
        --mobile-video-shell-padding: var(--mobile-video-shell-padding-mobile);
    }

    .mobile-video-showcase-device {
        height: auto;
        aspect-ratio: var(--mobile-video-phone-ratio-mobile);
    }

    .mobile-video-showcase-screen {
        height: 100%;
    }

    /* BIC mobile: exact shell ratio lock (video 1080x1920 + shell padding) */
    body[data-project-slug="bic-shave-club"] .mobile-video-showcase {
        --mobile-video-phone-ratio-mobile: 55 / 97;
    }

    body[data-project-slug="bic-shave-club"] .mobile-video-showcase-device {
        width: var(--mobile-video-phone-width);
        height: calc(var(--mobile-video-phone-width) * 97 / 55);
        aspect-ratio: auto;
    }
}
