/* ==========================================================================
   西会津町観光サイト 新動画プレイヤー（単一プレイヤー＋サムネイル選択）
   ========================================================================== */

/* プレイヤー全体コンテナ */
.kanko-hero-video {
    width: 100%;
    margin: 0 auto;
    position: relative;
    background-color: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* メイン動画ラッパー（完全16:9比率を保持し、どんなウィンドウ高さにも自動フィット） */
.kanko-video-screen {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    /* JavaScriptで動的計算される利用可能最大高さ（デフォルト70vh） */
    max-height: var(--video-max-height, calc(100dvh - 200px));
    /* 高さが制限された場合、幅も16:9を保ち自動縮小（トリミングゼロ） */
    max-width: calc(var(--video-max-height, calc(100dvh - 200px)) * (16 / 9));
    background-color: #000;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* YouTube iframe を枠ピッタリに配置 */
.kanko-video-screen iframe,
.kanko-video-screen #kanko-player-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
}

/* キャプション表示（動画タイトル・YouTubeコントロールバーの上部に配置） */
.kanko-video-caption {
    position: absolute;
    bottom: 56px;
    right: 20px;
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    line-height: 1.3;
    text-shadow: 0px 2px 6px rgba(0, 0, 0, 0.85);
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.kanko-video-caption strong {
    font-size: 1.3em;
    display: inline-block;
}

/* サムネイルナビゲーションバー（高さをコンパクトにして画面内に確実に収める） */
.kanko-thumb-nav-area {
    margin: 0;
    padding: 8px 0;
    background-image: url(/img/kanko/bg_thumb.gif);
    background-position: center top;
    background-size: cover;
    background-color: #2b1f1d;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.kanko-thumb-nav-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 10px;
    display: flex;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

/* 左右送りボタン */
.kanko-thumb-arrow {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    position: relative;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.kanko-thumb-arrow:hover {
    opacity: 0.8;
}

.kanko-thumb-arrow:active {
    transform: scale(0.92);
}

.kanko-thumb-arrow::before {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-top: 2.5px solid #fff;
    border-right: 2.5px solid #fff;
}

.kanko-thumb-arrow.prev::before {
    transform: rotate(-135deg);
    margin-left: 3px;
}

.kanko-thumb-arrow.next::before {
    transform: rotate(45deg);
    margin-right: 3px;
}

/* サムネイルリストスクロールコンテナ */
.kanko-thumb-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    list-style: none;
    margin: 0;
    padding: 2px 4px;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.kanko-thumb-track::-webkit-scrollbar {
    height: 5px;
}

.kanko-thumb-track::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* 個別サムネイルボタン */
.kanko-thumb-item {
    scroll-snap-align: start;
    flex: 0 0 calc((100% - 20px) / 3);
    min-width: 110px;
    max-width: 180px;
    cursor: pointer;
    background: #000;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    transition: border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.65;
}

.kanko-thumb-item:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.kanko-thumb-item.is-active {
    border-color: #fff;
    opacity: 1;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* サムネイル画像（16:9比率） */
.kanko-thumb-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    background-color: #111;
}

.kanko-thumb-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* サムネイルのテキストラベル */
.kanko-thumb-title {
    display: block;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 4px;
    background: rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* 再生中インジケーター（再生マーク） */
.kanko-thumb-item.is-active::after {
    content: '▶';
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 9px;
    color: #fff;
    background: #e60012;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1;
    z-index: 2;
}

/* 高さ・幅に応じたレスポンシブ最適化 */
@media screen and (max-height: 700px) {
    .kanko-thumb-nav-area {
        padding: 5px 0;
    }
    .kanko-thumb-item {
        max-width: 140px;
        min-width: 95px;
    }
    .kanko-thumb-title {
        font-size: 0.7rem;
        padding: 2px 3px;
    }
    .kanko-video-caption {
        font-size: 1.4rem;
        bottom: 50px;
        right: 15px;
    }
}

@media screen and (max-height: 520px) {
    .kanko-thumb-nav-area {
        padding: 3px 0;
    }
    .kanko-thumb-item {
        max-width: 110px;
        min-width: 80px;
    }
    .kanko-thumb-title {
        display: none; /* 極小画面ではサムネイル画像のみにして高さを節約 */
    }
    .kanko-thumb-arrow {
        width: 22px;
        height: 22px;
    }
    .kanko-thumb-arrow::before {
        width: 7px;
        height: 7px;
    }
    .kanko-video-caption {
        font-size: 1.1rem;
        bottom: 44px;
        right: 10px;
    }
}

@media screen and (max-width: 768px) {
    .kanko-video-caption {
        bottom: 50px;
        right: 12px;
        font-size: 1.3rem;
    }
    
    .kanko-thumb-item {
        flex: 0 0 calc((100% - 10px) / 2.3);
        min-width: 110px;
    }
}

@media screen and (max-width: 480px) {
    .kanko-video-caption {
        bottom: 44px;
        right: 10px;
        font-size: 1.1rem;
    }

    .kanko-thumb-arrow {
        width: 24px;
        height: 24px;
    }

    .kanko-thumb-arrow::before {
        width: 8px;
        height: 8px;
    }
}