/*
   LIQUID ASSETS — RESPONSIVE INTRO
   ------------------------------------------------------------
   Desktop / landscape tablet:
     - panoramic intro
     - cover

   Portrait phone / portrait tablet:
     - mobile intro
     - contain (no text/logo cropping)

   This file is intentionally loaded AFTER app.css so it only
   overrides the intro where needed.
*/

/* More reliable viewport sizing on Safari/iOS and Android browsers. */
.intro-overlay {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    background: #000;
    overflow: hidden;
}

/* Default: desktop and landscape tablet. */
.intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    background: #000;
}

/* PHONE + TABLET — PORTRAIT
   The vertical asset is shown in full instead of being cropped. */
@media (orientation: portrait) and (max-width: 1366px) {
    .intro-video {
        width: 100%;
        height: 100%;
        object-fit: contain !important;
        object-position: center center !important;
    }

    .intro-close {
        right: max(20px, env(safe-area-inset-right));
        bottom: max(20px, env(safe-area-inset-bottom));
        font-size: 0.68rem;
        letter-spacing: 0.16em;
    }

    .intro-continue {
        left: 50%;
        right: auto;
        bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px));
        transform: translateX(-50%);
        white-space: nowrap;
    }
}

/* SMALL PHONES */
@media (max-width: 600px) and (orientation: portrait) {
    .intro-close {
        right: max(16px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    .intro-continue {
        bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px));
        gap: 12px;
    }

    .intro-continue-label {
        font-size: 0.72rem;
        letter-spacing: 0.22em;
    }

    .intro-continue-line {
        width: 34px;
    }

    .intro-continue-arrow {
        font-size: 0.9rem;
    }
}

/* TABLETS — PORTRAIT */
@media (min-width: 601px) and (max-width: 1366px) and (orientation: portrait) {
    .intro-continue {
        bottom: max(38px, calc(env(safe-area-inset-bottom) + 24px));
    }

    .intro-continue-label {
        font-size: 0.8rem;
    }

    .intro-continue-line {
        width: 46px;
    }
}

/* TABLETS — LANDSCAPE
   Use the desktop/panoramic video, but keep controls clear of safe areas. */
@media (min-width: 700px) and (max-width: 1366px) and (orientation: landscape) {
    .intro-video {
        object-fit: cover;
        object-position: center center;
    }

    .intro-close {
        right: max(24px, env(safe-area-inset-right));
        bottom: max(22px, env(safe-area-inset-bottom));
    }

    .intro-continue {
        bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
    }
}


/* -------------------------------------------------------
   iPhone / iPad autoplay fallback
   -------------------------------------------------------
   iOS may intentionally block autoplay while Low Power Mode
   is enabled. The video is normally non-interactive, but when
   autoplay is rejected JavaScript adds .is-play-required.
------------------------------------------------------- */

.intro-play {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 8;
    display: inline-flex;
    align-items: center;
    gap: 13px;
    padding: 12px 4px;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.82);
    font: inherit;
    font-size: .66rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .22em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, calc(-50% + 12px));
    transition:
        opacity 650ms cubic-bezier(.22, 1, .36, 1),
        transform 650ms cubic-bezier(.22, 1, .36, 1),
        visibility 0s linear 650ms,
        color 250ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.intro-play.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%);
    transition-delay: 120ms, 120ms, 0s, 0s;
}

.intro-play-icon {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid rgba(255,255,255,.72);
    transition: border-left-color 250ms ease, transform 300ms ease;
}

.intro-play:hover,
.intro-play:focus-visible {
    color: #fff;
}

.intro-play:hover .intro-play-icon,
.intro-play:focus-visible .intro-play-icon {
    border-left-color: #fff;
    transform: translateX(2px);
}

.intro-play:focus-visible {
    outline: none;
}

/* app.css intentionally sets pointer-events:none on the film.
   Enable direct tapping only when iOS has blocked autoplay. */
.intro-overlay.is-play-required .intro-video {
    pointer-events: auto !important;
    cursor: pointer;
}

/* A subtle shade makes the manual play action readable without
   turning the intro into a conventional video player. */
.intro-overlay.is-play-required::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    background: rgba(0,0,0,.10);
}

.intro-overlay.is-awaiting-continue .intro-play,
.intro-overlay.is-leaving .intro-play {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 600px) and (orientation: portrait) {
    .intro-play {
        font-size: .62rem;
        gap: 11px;
    }
}
