/* ==========================================================================
   オープニング画面スタイル
   ========================================================================== */

/* 
 * オープニングオーバーレイ
 * 全体を覆うコンテナ。背景色はユーザー指定の #6eb8c3 (ポスター背景色)
 */
#opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    /* 最前面 */
    background: #6eb8c3;
    /* ユーザー指定カラー */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    overflow: hidden;
    /* 内部でのスクロールも防止 */
}

/* フェードアウト用クラス */
#opening-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/*
 * 0. 白幕 (White Curtain)
 * 最初は真っ白で、ポスターの上に重なっている。
 * これをフェードアウトさせることで「白からポスターがフェードイン」を表現。
 */
#opening-curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    z-index: 10;
    /* ポスターより上 */
    opacity: 1;
    transition: opacity 1.5s ease;
    /* ゆっくりフェード */
    pointer-events: none;
}

#opening-curtain.fade-out {
    opacity: 0;
}

/* 
 * 1. ポスター画面
 */
#opening-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 5;
}

#opening-poster.hidden {
    opacity: 0;
    pointer-events: none;
}

#opening-poster picture,
#opening-poster img {
    /* 
       スマホ: 読み込み時は左上→全画面中央に (flexで中央寄せ済み)
       PC: 全画面表示
    */
    width: 100%;
    height: 100vh;
    object-fit: contain;
    /* 中央に配置し、はみ出さない */
}

/* PCの場合は全画面カバー (既存の要望) */
@media (min-width: 768px) {

    #opening-poster picture,
    #opening-poster img {
        object-fit: cover;
    }
}

/* 
 * 2. スローガン画面 (白背景・明朝体・縦書き)
 */
#opening-slogan {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    /* 最初は非表示 */
    pointer-events: none;
    transition: opacity 0.8s ease;
    z-index: 6;
    /* カーテンよりは下だが、ポスターより上(後で出すため) -> いや、不透明度で制御するのでOK */
}

#opening-slogan.visible {
    opacity: 1;
    pointer-events: auto;
    z-index: 20;
    /* 出現時は最前面へ */
}

.slogan-text {
    font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "HGS明朝E", "MS PMincho", "MS 明朝", serif;
    font-size: 2rem;
    font-weight: bold;
    color: #000;
    writing-mode: vertical-rl;
    /* 縦書き */
    letter-spacing: 0.2em;
    line-height: 2;
}


/* ==========================================================================
   ヒーロー動画セクション (フルワイド・中央寄せ)
   ========================================================================== */

/* 
 * ユーザーが配置するブロックコンテナに relative を強制する 
 * これがないと、内部の絶対配置ボタンがページ最下部に飛んでしまう
 */
body.home .wp-block-cover,
body.home .wp-block-group,
body.home .hero-video-section {
    position: relative;
}

.hero-video-section {
    position: relative;
    /* 画面幅いっぱいにする */
    width: 100vw;
    /* 親要素の制限を解除するためのネガティブマージン */
    margin-left: calc(50% - 50vw);
    width: 100vw;
    background: #000;
    overflow: hidden;

    /* PCのデフォルト高さ */
    height: 100vh;
}

/* 
   動画コンテナとiframe
   上下左右中央寄せ + アスペクト比維持でカバー
*/
.hero-video-container,
.hero-video-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    /* 動画への操作を無効化 */
}

/* PC/タブレット: 16:9を維持してカバー */
.hero-video-container iframe {
    width: 100vw;
    height: 56.25vw;
    /* 100vw * 9/16 */
    min-height: 100vh;
    min-width: 177.77vh;
    /* 100vh * 16/9 */
}

/* ==========================================
   レスポンシブ対応
   ========================================== */

/* タブレット */
@media (max-width: 1199px) {
    .hero-video-section {
        height: 70vh;
    }

    .hero-video-container iframe {
        min-height: 70vh;
        min-width: calc(70vh * 16 / 9);
    }
}

/* スマートフォン (Lightning: 991px以下) */
@media (max-width: 991px) {
    .slogan-text {
        font-size: 1.5rem;
        /* スマホでは文字サイズ調整 */
    }

    .hero-video-section {
        height: 60vh;
        /* 高さ60% */
        width: 100vw;
        margin-left: calc(50% - 50vw);
    }

    /* 
       スマホ動画の黒縁削除 + 左右クロップ
       親が60vhなので、動画も最低60vhの高さが必要。
       横幅はアスペクト比(16:9)を維持して広げる。
    */
    .hero-video-container {
        width: 100%;
        height: 100vh;
    }

    .hero-video-container iframe {
        /* 高さを基準にする (60vh) */
        height: 60vh;
        /* 幅はそれに合わせる (60vh * 16/9) */
        width: 106.66vh;

        /* もし画面幅(100vw)の方が広い場合は、幅基準にする必要がある */
        min-width: 100vw;
        min-height: 56.25vw;

        /* 常にカバーするように設定 */
        width: 100vw;
        height: 56.25vw;
        /* 16:9 */

        /* 
           重要なのは「コンテナ(60vh)を埋めること」。
           1. height: 100% (=60vh) にすると width: 106.6vh になる。 -> OK
           2. width: 100% (=100vw) にすると height: 56.25vw になる。
           
           56.25vw < 60vh の場合（縦長スマホ）、高さが足りずに黒帯が出る。
           106.6vh > 100vw の場合、横がはみ出る（OK）。
           
           よって、縦長スマホでは height: 100% (60vh) を優先すべき。
        */

        width: auto;
        /* 幅は自動 */
        height: 100vh;
        /* 高さは親(60vh)に合わせる */
        aspect-ratio: 16/9;

        /* ただし、横長画面スマホの場合に幅が足りなくなる可能性がある */
        min-width: 100%;
        min-height: 100vh;

        /* 強制的にカバーするための記述 */
        width: 177.77vh;
        /* 高さ(100%=60vhではないかもだが)に対する比率 */
        height: 100vh;
        /* 確実に埋めるために大きめに取る */

        /* 修正案: object-fit: cover的に振る舞わせるための絶対値指定 */
        /* スマホの画角だと縦長なので、高さを基準(=100vh相当)にとって横をはみ出させるのが無難 */
        width: 177.77vh;
        height: 100vh;
    }
}

/* オープニング中はヘッダー、モバイルメニューボタン、およびメインのコンテンツを隠す */
body.opening-active .site-header,
body.opening-active .vk-mobile-nav-menu-btn,
body.opening-active #hero-section,
body.opening-active .hero-video-section,
/* 追加: 手動HTMLブロック用 */
body.opening-active .siteContent,
/* 追加: Lightningのメインコンテンツ */
body.opening-active .site-footer {
    /* 追加: フッター */
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: opacity 0.5s ease;
}

body:not(.opening-active) .site-header,
body:not(.opening-active) .vk-mobile-nav-menu-btn,
body:not(.opening-active) .hero-video-section,
body:not(.opening-active) .siteContent,
body:not(.opening-active) .site-footer {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* オープニング中はスクロール無効（htmlとbody両方に適用） */
html.opening-active,
body.opening-active {
    overflow: hidden !important;
    height: 100vh !important;
    width: 100vw !important;
    position: fixed !important;
    /* スクロールを物理的に止める */
}

/* ==========================================
   テーマ既存の余白削除 (トップページのみ)
   ========================================== */
body.home .site-body {
    padding-top: 0 !important;
}

body.home .siteContent {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* それでも消えない場合の強制調整 */
body.home .hero-video-section {
    margin-top: -2px;
    /* 微調整 */
}

/* Lightningのデフォルトコンテナ余白を打ち消す */
@media (min-width: 992px) {
    body.home .site-body {
        padding-top: 0 !important;
    }
}

/* ==========================================================================
   動画モーダル (ポップアップ)
   ========================================================================== */

/* トリガーボタン */
.hero-btn {
    position: absolute;
    bottom: 40px;
    right: 40px;
    z-index: 100;
    /* 動画より上 */
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(5px);
}

.hero-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.hero-btn i {
    font-size: 1.2em;
}

/* モーダル本体 */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    /* 最前面 */
    display: none;
    /* 初期非表示 */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-modal.active {
    display: flex;
    opacity: 1;
}

/* モーダルコンテンツ */
.video-modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background: #000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* 閉じるボタン */
.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: transform 0.3s ease;
}

.video-modal-close:hover {
    transform: rotate(90deg);
}

/* 動画ラッパー (16:9) */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 767px) {
    .hero-btn {
        bottom: 20px;
        right: 20px;
        /* スマホは少し内側に */
        padding: 10px 18px;
        font-size: 0.8rem;
    }

    .video-modal-close {
        top: -30px;
        right: -10px;
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   Hero Section (After Opening) - ハイブリッド配置 & pv_testデザイン継承
   ========================================================================== */

.hero-section {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 100;
    background: #000;
    display: none;
    opacity: 0;
    transition: opacity 1.5s ease;
    overflow: hidden;
}

.hero-section.visible {
    display: block;
    opacity: 1;
}

/* 背景動画 */
.hero-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* アスペクト比を維持しつつカバー (pv_test仕様) */
.hero-video-bg iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100vh;
    min-width: 177.77vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* 黒入れレイヤー (pv_test デザイン継承: 強めのグラデーション) */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 2;
}

/* メインコンテンツ (中央配置) */
.hero-main-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    color: #fff;
    width: 90%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-title {
    margin-bottom: 60px;
    /* ボタンとの距離を広げる */
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.9);
}

.hero-title-main {
    display: block;
    font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    line-height: 1.2;
}

.hero-title-sub {
    display: block;
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: 0.5em;
    margin-top: 25px;
    /* メインタイトルとの距離を少し広げる */
    opacity: 0.9;
    text-transform: uppercase;
}

/* ボタンデザイン (pv_test 継承: 水色基調 + 白文字) */
.hero-section .hero-btn,
.hero-video-section .hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 50px;
    background: #6eb8c3;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    border-radius: 60px;
    text-decoration: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    backdrop-filter: blur(10px);
    cursor: pointer;
    margin-top: 20px;
    /* 念のための追加マージン */
}

.hero-section .hero-btn:hover,
.hero-video-section .hero-btn:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    background: #5aa7b1;
    /* 少し濃いめの水色 */
    color: #fff;
}

/* サブ情報 (右下配置) */
.hero-bottom-info {
    position: absolute;
    bottom: 50px;
    right: 50px;
    z-index: 10;
    text-align: right;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.info-badge {
    display: inline-block;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.info-location {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.95;
}

.info-location i {
    font-size: 1.4rem;
}

/* スマートフォン対応調整 */
@media (max-width: 991px) {
    .hero-main-content {
        top: 40%;
    }

    .hero-title-main {
        font-size: 2.8rem;
        letter-spacing: 0.15em;
    }

    .hero-title-sub {
        font-size: 1.1rem;
        letter-spacing: 0.3em;
    }

    .hero-section .hero-btn {
        padding: 16px 36px;
        font-size: 1.1rem;
    }

    .hero-bottom-info {
        bottom: 40px;
        right: 0;
        left: 0;
        text-align: center;
        width: 100%;
        padding: 0 20px;
    }

    .info-location {
        justify-content: center;
        font-size: 1rem;
    }

    .info-badge {
        font-size: 0.95rem;
        padding: 8px 20px;
    }
}

/* ==========================================================================
   追加の微調整（水色バー削除 & テキスト重ね対応）
   ========================================================================== */

/* 「明日への約束」の上の水色バー（境界線や擬似要素）を強制的に削除 */
.hero-title::before,
.hero-title::after,
.hero-title-main::before,
.hero-title-main::after,
.slogan-text::before,
.slogan-text::after,
h2.hero-title,
.slogan-text {
    border-top: none !important;
    border-bottom: none !important;
}

/* 投稿・固定ページ内の .hero-video-section に対するテキスト重ね設定 */
.hero-video-section {
    position: relative;
    width: 100vw !important;
    /* 画面幅いっぱいに強制 */
    margin-left: 50% !important;
    transform: translateX(-50%) !important;
    height: 100vh;
    /* 画面いっぱいに広げる */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    z-index: 10;
}

/* ビデオセクション内でのメインコンテンツの配置（中央固定を強化） */
.hero-video-section .hero-main-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 20 !important;
    /* オーバーレイより上に確実に配置 */
    text-align: center !important;
    color: #fff !important;
    width: 90% !important;
    max-width: 1000px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* WordPressが自動挿入する可能性のあるpタグ対策 */
.hero-video-section .hero-main-content p {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* タイトルの強制センター */
.hero-video-section .hero-title {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 50px !important;
    text-align: center !important;
}

/* ボタンの強制センター（あらゆる干渉を排除） */
.hero-video-section .hero-btn,
.hero-video-section .hero-main-content p .hero-btn {
    display: inline-flex !important;
    /* flex or inline-flex */
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
    /* 上下0、左右自動 */
    float: none !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    text-indent: 0 !important;
    width: auto !important;
    max-width: 100% !important;
}

/* ビデオセクション内でのサブ情報（右下固定） */
.hero-video-section .hero-bottom-info {
    position: absolute !important;
    bottom: 40px !important;
    right: 40px !important;
    z-index: 20 !important;
    text-align: right !important;
    color: #fff !important;
    margin: 0 !important;
    width: auto !important;
}

/* スマホ対応（情報表示を中央・小さめに） */
@media (max-width: 991px) {
    .hero-video-section .hero-bottom-info {
        right: 0 !important;
        left: 0 !important;
        bottom: 20px !important;
        text-align: center !important;
        width: 100% !important;
        padding: 0 10px !important;
    }

    .info-badge {
        font-size: 0.85rem !important;
        padding: 6px 16px !important;
        margin-bottom: 8px !important;
    }

    .info-location {
        justify-content: center !important;
        font-size: 0.9rem !important;
        flex-direction: column;
        /* 縦並びにしてスッキリさせる */
        gap: 5px !important;
    }

    .info-location i {
        font-size: 1rem !important;
        margin-bottom: 2px;
    }
}