/* ==========================================================================
   Integral Shorts — Fullscreen Player Styles
   Always dark/immersive regardless of theme
   ========================================================================== */

/* ==========================================================================
   Player Container
   ========================================================================== */
.is-player {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none; /* Prevent pull-to-refresh on iOS Safari */
}

/* Body scroll-lock when player is open */
html.is-player-open,
body.is-player-open {
    overflow: hidden;
    overscroll-behavior: none;
}

/* ==========================================================================
   Header (top gradient overlay)
   — pointer-events: none so swipes pass through to Swiper
   — buttons get pointer-events: auto
   ========================================================================== */
.is-player__header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    pointer-events: none;
    transition: opacity 0.4s ease;
    opacity: 1;
}

.is-player__header--hidden {
    opacity: 0;
}

.is-player__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #fff;
    border-radius: 50%;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.is-player__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.is-player__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.is-player__sound,
.is-player__share {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #fff;
    border-radius: 50%;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.is-player__sound:hover,
.is-player__share:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Swiper Container
   ========================================================================== */
.is-player__swiper {
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
}

.is-player__swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Video wrapper — 9:16 centered, max 420px wide */
.is-player__video-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 100vh;
    aspect-ratio: 9 / 16;
    margin: 0 auto;
    background: #111;
    overflow: hidden;
}

/* On very wide screens, don't stretch beyond viewport height */
@media (min-aspect-ratio: 9/16) {
    .is-player__video-wrap {
        height: 100vh;
        width: auto;
    }
}

/* YouTube iframe — pointer-events: none so touches pass to touch layer */
.is-player__video-wrap iframe,
.is-player__video-wrap .is-player__yt-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

/* Touch layer — topmost interactive element, captures all touches for Swiper */
.is-player__touch-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: transparent;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

/* Poster overlay — visual only, no interaction */
.is-player__poster {
    position: absolute;
    inset: 0;
    z-index: 3;
    background-size: cover;
    background-position: center;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
}

.is-player__poster.is-hidden {
    display: none;
}

.is-player__poster-play {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Bottom Overlay (metadata + CTA)
   — pointer-events: none so swipes pass through to Swiper
   — interactive children get pointer-events: auto
   ========================================================================== */
.is-player__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 80px 20px 32px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    pointer-events: none;
    max-width: 420px;
    margin: 0 auto;
    transition: opacity 0.4s ease;
    opacity: 1;
}

.is-player__overlay--hidden {
    opacity: 0;
}

.is-player__title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.3;
}

.is-player__speaker {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 6px;
}

.is-player__description {
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 8px;
}

.is-player__description-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.is-player__description--expanded .is-player__description-text {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    max-height: 40vh;
    overflow-y: auto;
}

.is-player__description-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0 0;
    display: block;
    pointer-events: auto;
}

.is-player__topics {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.is-player__topic-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    backdrop-filter: blur(4px);
}

/* CTA Button */
.is-player__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s ease;
    pointer-events: auto;
}

.is-player__cta:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.is-player__toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: 10px 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    animation: is-toast-in 0.3s ease;
}

@keyframes is-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==========================================================================
   YouTube Unavailable Fallback (private browsing / blocked)
   ========================================================================== */
.is-player__yt-unavailable {
    position: absolute;
    bottom: 20%;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 6;
    pointer-events: auto;
}

.is-player__yt-unavailable p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 0 0 12px;
}

.is-player__yt-unavailable a {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 0, 0, 0.8);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================================================
   Thumb-accessible zones (mobile)
   ========================================================================== */
@media (pointer: coarse) {
    .is-player__close,
    .is-player__sound,
    .is-player__share {
        min-width: 44px;
        min-height: 44px;
    }
}
