/* ===================================
   NARUTO02 共通スタイル
   =================================== */

/* 共通設定 */
#naruto02-wrapper,
#naruto02-detail-wrapper {
    width: 100%;
    min-height: 100vh;
    padding-top: 120px; /* ヘッダーとの距離 */
    padding-bottom: 0; /* フッターとの距離 */
}

/* ===================================
   トップページ スタイル
   =================================== */

.naruto02-top {
    background-color: #F5A21E; /* 🔧 preparing.png の背景色に統一 */
    padding: 40px 20px;
}

/* トップページのフッターとの下部余白
   （コピーライトを外したため、エリア未選択の初回表示でも余白を確保する。詳細ページには影響させない） */
#naruto02-wrapper {
    padding-bottom: 60px; /* 🔧 フッターとの距離（調整可能） */
}

/* 矢印 + バナー全体の外側ラッパー
   - position:relative + z-index:0 でスタッキングコンテキストを形成
     → 矢印(z-index:1) が コンテナ(z-index:0) より確実に前面に描画される
   - overflow:hidden は設定しない → 矢印がクリップされず画面端に表示される
   - margin:0 -20px で親padding(20px)を打ち消し画面端まで拡張 */
.banner-outer-wrapper {
    position: relative;
    z-index: 0;
    margin-left: -20px;
    margin-right: -20px;
}

/* スライドクリップ専用ラッパー
   - overflow:hidden でペークスライドを画面端でクリップ
   - 矢印は .banner-outer-wrapper の直接の子なのでここでクリップされない
   - position / z-index は不要（矢印の基準は外側ラッパーに委譲） */
.top-image-wrapper {
    overflow: hidden;
}

/* スライダーコンテナ（max-width で中央配置）
   z-index: 0 を設定することでスタッキングコンテキストを明示的に作成し、
   JS により transform が付与されたトラックのスタッキングコンテキストを
   z-index:0 のレイヤー内に封じ込める → 矢印（z-index:1）が確実に前面に出る */
.top-banner-container {
    position: relative;
    z-index: 0;
    max-width: 1000px;
    margin: 0 auto;
}

.top-banner-slider {
    position: relative;
    overflow: visible; /* 左右ペークのため visible に */
    border-radius: 0;
}

.top-banner-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* will-change: transform を削除
       GPU コンポジットレイヤー化により矢印（z-index:10）が裏側に隠れる問題を防ぐ
       transition: transform は will-change なしでも現代ブラウザが自動でハードウェア加速する */
}

.top-banner-slide {
    flex: 0 0 calc(100% - 120px); /* 左右60pxずつのぞかせる */
    flex-shrink: 0;
    margin-right: 16px;
    border-radius: 16px;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

/* 矢印ボタン（画像使用・画面端配置）
   z-index: 1 → .top-banner-container（z-index:0）より確実に前面 */
.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 0;
}

.banner-arrow img {
    display: block;
    height: 160px; /* 🔧 矢印画像の高さ（調整可能） */
    width: auto;
}

.banner-prev {
    left: 0;
}

.banner-next {
    right: 0;
}

.top-main-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
}

/* バナードット（インジケーター） */
.banner-dots {
    text-align: center;
    margin-top: 12px;
    margin-bottom: 60px; /* .top-image-wrapper から移動（ドットが wrapper 外に出たため） */
}

.banner-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    margin: 0 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.banner-dot.active {
    background-color: #ffffff;
}

/* EC販売なしの注意書き（赤文字・バナーと地域選択の間） */
.ec-notice-wrapper {
    max-width: 1000px;
    margin: 0 auto 40px;
    padding: 0 20px;
    text-align: center;
}

.ec-notice {
    margin: 0;
    color: #e60012; /* 🔧 赤文字 */
    font-size: 15px;
    font-weight: bold;
    line-height: 1.8;
}

/* 地域選択セクション */
.region-selection-wrapper {
    max-width: 1000px;
    margin: 0 auto 60px;
    display: flex;
    align-items: flex-start;
    gap: 80px;
}

/* 左側エリア（地域から探す） */
.region-left-wrapper {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.region-title-wrapper {
    flex-shrink: 0;
}

.region-title-image {
    width: 240px; /* 🔧 ガンダムの「地域から探す」と同じ描画高さ(約160px)に合わせて調整。巻物画像が縦長のため幅300pxより縮小 */
    height: auto;
}

/* 右側のコンテンツエリア（ボタン） */
.region-content-wrapper {
    flex: 1;
}

.region-buttons-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* 地域ボタン */
.region-button {
    background-color: #ffffff;
    color: #333333;
    border: none;
    border-radius: 32px;
    padding: 0px 0px;
    font-size: 27px;
    font-weight: bold;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    text-align: center;
    width: 100%;
}

.region-button:hover {
    background-color: #060302; /* 🔧 ホバー時（クリック色に合わせて統一） */
    color: #ffffff;
}

.region-button.active {
    background-color: #060302; /* 🔧 選択中（クリック時の色） */
    color: #ffffff;
}

/* カテゴリ一覧エリア */
.product-list-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.product-item {
    background-color: transparent;
    /* 背景が馴染み境目が見えないため角丸なし。
       角丸+overflow:hidden だと横幅いっぱいのラベル（例:シャインマスカット）の端が切れるため 0 に */
    border-radius: 0;
    overflow: visible;
    box-shadow: none; /* 🔧 ドロップシャドウ無し */
    transition: transform 0.3s ease;
}

.product-item:hover {
    transform: translateY(-5px);
}

.product-link {
    display: block;
    text-decoration: none;
}

/* バナー画像は透過余白をトリミング済みのため、実寸比のまま余白なく表示
   （正方形cover強制は円・帯が切れるため使用しない） */
.product-image {
    width: 100%;
    /* 全ボタンを同一比率の枠に統一してサイズを揃える。
       枠比率を最大幅の画像 yamanashi01(2618×2070) に合わせる＝「最大に合わせる」暫定対応。
       これにより横長デザインはフル表示、縦長の標準デザインは左右に透明余白が入り一段小さく見える。
       🔧 標準デザイン中心に大きく見せたい場合は 95 / 100 等の縦長比率に戻す（その場合は横長画像が小さくなる） */
    aspect-ratio: 2618 / 2070;
    height: auto;
    /* 枠に切り抜かず収める。異形画像は不足分が透明余白になる（デザインは欠けない） */
    object-fit: contain;
    display: block;
}

/* ===================================
   詳細ページ スタイル
   =================================== */

.naruto02-detail {
    background-color: #ffffff;
    padding: 0;
}

/* データが無い（preparing.png 表示）ときだけ背景を preparing.png の背景色に。
   商品がある通常時は上の #ffffff のまま（準備中画像の有無で自動判定） */
.naruto02-detail:has(.preparing-wrapper) {
    background-color: #F5A21E;
}

/* 詳細トップ画像 */
.detail-top-image-wrapper {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.detail-top-image {
    width: 100%;
    height: auto;
    display: block;
}

/* 商品種別セクション（見出し画像＋キャラ行のまとまり） */
.type-section {
    max-width: 1200px;
    margin: 0 auto 80px;
    padding: 0 20px;
}

/* セクション見出し画像（種別ごと1枚） */
.type-title-wrapper {
    margin-bottom: 30px;
    text-align: center;
}

.type-title-image {
    width: 100%;
    max-width: 1100px;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* 商品（キャラ）行 … .type-section 内に複数並ぶ。左右padding/幅は親に委譲 */
.product-section {
    margin: 0 0 40px;
}

/* 旧・商品タイトル画像（詳細では未使用。念のため残置） */
.product-title-wrapper {
    margin-bottom: 30px;
    text-align: center;
}

.product-title-image {
    width: 100%;
    max-width: 1100px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.product-content {
    display: flex;
    gap: 20px;
}

/* 商品画像1（左側・大きめ） */
.product-main-image-wrapper {
    flex: 0 0 35%;
}

.product-main-image {
    width: 100%;
    height: auto;
    border-radius: 40px;
    border: 2px solid #cccccc;
}

/* 商品画像2・3（中央・縦2段） */
.product-detail-images {
    flex: 0 0 16%;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.product-detail-image {
    width: 100%;
    height: auto;
    border-radius: 22px;
    border: 2px solid #cccccc;
}

/* 説明テキスト（右側） */
.product-description {
    flex: 1;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-sizing: border-box;
}

.product-text {
    font-size: 14px;
    line-height: 1;
    color: #333333;
    white-space: pre-line;
}

/* エラーメッセージ */
.error-message,
.no-products {
    max-width: 600px;
    margin: 100px auto;
    padding: 40px;
    text-align: center;
    background-color: #f8f8f8;
    border-radius: 8px;
}

.error-message p,
.no-products p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.6;
}

.error-message a,
.no-products a {
    color: #ef7a00;
    text-decoration: underline;
}

/* 商品ページ準備中（データが無いスポット） */
.preparing-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 20px 80px;
    text-align: center;
}

.preparing-image {
    width: 600px; /* 🔧 準備中画像の表示幅（調整可能） */
    max-width: 100%;
    height: auto;
    display: inline-block;
}

/* ===================================
   画像拡大モーダル
   =================================== */

/* モーダル背景 */
.image-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    cursor: default;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease, background-color 0.3s ease;
}

/* モーダル表示時 */
.image-modal.active {
    visibility: visible;
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.9);
    transition: visibility 0s 0s, opacity 0.3s ease, background-color 0.3s ease;
}

/* 画像コンテナ */
.image-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 拡大画像 */
.image-modal img {
    min-width: 600px;
    max-width: 1200px;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s ease;
    user-select: none;
}

/* 画像表示時のアニメーション */
.image-modal.active img {
    opacity: 1;
    transform: scale(1);
}

/* 閉じるボタン */
.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease;
    user-select: none;
}

.image-modal.active .image-modal-close {
    opacity: 1;
}

.image-modal-close:hover {
    color: #cccccc;
}

/* 左右の矢印ボタン */
.image-modal-prev,
.image-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease, background-color 0.3s ease;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px 15px;
    border-radius: 8px;
}

.image-modal.active .image-modal-prev,
.image-modal.active .image-modal-next {
    opacity: 0.7;
}

.image-modal-prev:hover,
.image-modal-next:hover {
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.8);
}

.image-modal-prev {
    left: 20px;
}

.image-modal-next {
    right: 20px;
}

/* 画像インジケーター */
.image-modal-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease;
    user-select: none;
}

.image-modal.active .image-modal-indicator {
    opacity: 1;
}

/* クリック可能な画像のカーソル */
.product-main-image,
.product-detail-image {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.product-main-image:hover,
.product-detail-image:hover {
    opacity: 0.8;
}

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

/* タブレット（768px - 1023px） */
@media (max-width: 1023px) {
    /* ヘッダー余白調整 */
    #naruto02-wrapper,
    #naruto02-detail-wrapper {
        padding-top: 80px;
    }

    /* トップページ - 地域選択 */
    .region-selection-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .region-left-wrapper {
        gap: 20px;
        align-items: center;
    }

    .region-title-image {
        width: 180px;
    }

    .region-content-wrapper {
        width: 100%;
    }

    .region-buttons-wrapper {
        grid-template-columns: repeat(3, 1fr);
    }


    /* トップページ - カテゴリ一覧 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* 詳細ページ - 商品コンテンツ */
    .product-content {
        flex-wrap: wrap;
        gap: 20px;
    }

    .product-main-image-wrapper {
        flex: 0 0 100%;
    }

    .product-detail-images {
        flex: 0 0 100%;
        flex-direction: row;
        gap: 20px;
    }

    .product-detail-image {
        width: calc(50% - 10px);
    }

    .product-description {
        flex: 0 0 100%;
    }
}

/* ===================================
   スマートフォン（767px以下）
   🔧 ここから下がスマホ版の調整箇所です
   =================================== */
@media (max-width: 767px) {
    /* ヘッダー余白調整 */
    #naruto02-wrapper,
    #naruto02-detail-wrapper {
        padding-top: 80px; /* 🔧 調整可能: ヘッダーとの距離 */
        padding-bottom: 120px; /* 🔧 調整可能: フッターとの距離 */
    }

    /* ===== トップページ ===== */

    .naruto02-top {
        padding: 20px 0; /* 🔧 左右の余白を0に（上下のみ余白を残す） */
    }

    /* 📱 トップ画像（ローテーションバナー）の調整 */
    .banner-outer-wrapper {
        margin-left: 0;  /* 親の左右padding=0なので打ち消し不要 */
        margin-right: 0;
        margin-bottom: 30px; /* 🔧 画像下の余白 */
    }
    .top-image-wrapper {
        padding: 0;
    }

    .top-banner-slider {
        border-radius: 0; /* 🔧 スマホでは角丸を無効化 */
    }

    .top-banner-slide {
        flex: 0 0 calc(100% - 80px); /* 🔧 スマホでは両側40pxのぞかせる */
        margin-right: 12px;
    }

    .banner-arrow img {
        height: 50px; /* 🔧 スマホ用矢印サイズ */
    }

    .banner-prev { left: 0; }
    .banner-next { right: 0; }

    .top-main-image {
        max-width: 100%;
        width: 100%;
    }

    /* 📱 EC販売なし注意書き */
    .ec-notice-wrapper {
        margin-bottom: 24px;
        padding: 0 16px;
    }

    .ec-notice {
        font-size: 12px;
        line-height: 1.7;
        text-align: left; /* スマホは左寄せで折り返しを読みやすく */
    }

    /* 📱 「地域から探す」の調整 */
    .region-selection-wrapper {
        margin-bottom: 30px;
        gap: 20px;
        padding: 0;
        flex-direction: column;
        align-items: center;
    }

    .region-left-wrapper {
        gap: 20px;
        align-items: center;
    }

    .region-title-wrapper {
        text-align: center;
    }

    .region-title-image {
        width: 150px; /* 🔧 画像の横幅 */
        max-width: 100%;
    }

    .region-content-wrapper {
        width: 100%;
    }

    /* 📱 地域ボタンの調整 */
    .region-buttons-wrapper {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px; /* 🔧 ボタン間の余白 */
        padding: 0 10px;
    }

    .region-button {
        /* 🔧 折り返し防止：画面幅に応じて文字サイズを縮小（最小10px〜最大13px） */
        font-size: clamp(10px, 3.1vw, 13px);
        padding: 8px 4px; /* 🔧 左右余白を詰めて文字スペースを確保 */
        white-space: nowrap; /* 折り返さない（ボタン高さを揃える） */
        letter-spacing: -0.02em;
    }

    /* 📱 カテゴリ一覧の調整 */
    .product-list-wrapper {
        padding: 20px 10px; /* 🔧 一覧エリア全体の余白（上下 左右） */
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr); /* 2列表示 */
        gap: 10px;
        padding: 0 10px;
    }

    .product-item {
        border-radius: 0; /* 🔧 ラベル端の切れ防止のため角丸なし */
    }

    /* ===== 詳細ページ ===== */

    /* 📱 詳細トップ画像の調整 */
    .detail-top-image-wrapper {
        margin-bottom: 40px;
        padding: 0;
    }

    .detail-top-image {
        width: 100%;
    }

    /* 📱 商品種別セクション全体 */
    .type-section {
        margin-bottom: 40px;
        padding: 0 10px;
    }

    /* 📱 商品（キャラ）行 */
    .product-section {
        margin-bottom: 30px;
        padding: 0;
    }

    /* 📱 セクション見出し画像の調整 */
    .type-title-wrapper {
        margin-bottom: 20px;
        text-align: center;
        padding: 0 10px;
    }

    .type-title-image {
        max-width: 100%;
        width: 100%;
    }

    /* 📱 商品コンテンツ */
    .product-content {
        flex-wrap: wrap;
        gap: 15px;
    }

    /* 📱 商品画像1（メイン画像）の調整 */
    .product-main-image-wrapper {
        flex: 0 0 100%;
        text-align: center;
    }

    .product-main-image {
        max-width: 88%; /* 🔧 横幅 */
        width: 100%;
        border-radius: 16px; /* 🔧 角丸のサイズ */
    }

    /* 📱 商品画像2・3（詳細画像）の調整 */
    .product-detail-images {
        flex: 0 0 100%;
        flex-direction: row;
        gap: 15px;
        justify-content: center;
    }

    .product-image-wrapper {
        flex: 0 0 calc(50% - 7.5px);
        max-width: 200px; /* 🔧 各画像の最大横幅 */
    }

    .product-detail-image {
        width: 100%;
        border-radius: 16px; /* 🔧 角丸のサイズ */
    }

    /* 📱 説明テキストの調整 */
    .product-description {
        flex: 0 0 100%;
        padding: 15px;
    }

    .product-text {
        font-size: 14px; /* 🔧 テキストサイズ */
        line-height: 1;
    }

    /* 📱 画像拡大モーダル（スマホ版） */
    .image-modal img {
        min-width: 150px;
        max-width: 95%;
        max-height: 95vh;
    }
}

/* ===================================
   極小スマートフォン（480px以下）
   🔧 さらに小さい画面用の調整箇所
   =================================== */
@media (max-width: 480px) {
    .region-title-image {
        width: 120px; /* 🔧 調整可能: さらに小さいタイトル画像 */
    }

    /* .region-button は767px以下の clamp 指定に一本化（折り返し防止）。
       以前の font-size:14px / padding:8px 16px の上書きは折り返しの原因になるため撤去 */
}
