/**
 * ギャラリーページ v4 - マガジン風インタラクティブ版
 * サイトカラー: ブルー #4aa8de / ゴールド #d3ac2b
 */

/* ===== ブランドカラー変数 ===== */
:root {
    --brand-blue: #4aa8de;
    --brand-blue-light: #e3f0fa;
    --brand-blue-dark: #3a8fc4;
    --brand-gold: #d3ac2b;
    --brand-gold-light: #f8f3e4;
    --brand-text: #474747;
    --brand-text-muted: #6b7280;
    --brand-bg: #f9fafb;
    --brand-card-bg: #ffffff;
}

/* ===== SWELLタイトル帯の非表示 ===== */
body.page-template-template-gallery .l-topTitleArea,
body.page-template-template-gallery .c-pageTitle,
.page-template-template-gallery .l-topTitleArea,
.page-template-template-gallery .c-pageTitle {
    display: none !important;
}

/* ===== ページ全体（深淵な宇宙背景） ===== */
body.page-template-template-gallery,
body.page-template-template-gallery .l-mainContent,
main.gallery-page {
    background: #000000 !important;
}

body.page-template-template-gallery {
    position: relative;
    overflow-x: hidden;
}

body.page-template-template-gallery::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(25, 25, 70, 0.3) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 40%, rgba(30, 20, 60, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 70%, rgba(20, 30, 65, 0.25) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

body.page-template-template-gallery::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,.01) 2px, rgba(255,255,255,.01) 4px);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
}

/* 宇宙背景レイヤー */
.galaxy-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* 星雲エフェクト（参考画像スタイル） */
.nebula-layer {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        /* 右上の青紫の星雲 */
        radial-gradient(ellipse 800px 400px at 75% 20%,
            rgba(88, 56, 160, 0.4) 0%,
            rgba(59, 130, 246, 0.35) 30%,
            rgba(139, 92, 246, 0.25) 50%,
            transparent 70%
        ),
        /* 中央の流れる星雲 */
        radial-gradient(ellipse 600px 800px at 50% 45%,
            rgba(99, 102, 241, 0.3) 0%,
            rgba(147, 51, 234, 0.2) 40%,
            transparent 65%
        ),
        /* 左側のピンク混じり星雲 */
        radial-gradient(ellipse 500px 600px at 20% 60%,
            rgba(168, 85, 247, 0.25) 0%,
            rgba(219, 39, 119, 0.15) 35%,
            rgba(59, 130, 246, 0.2) 55%,
            transparent 70%
        ),
        /* 下部の暗い青 */
        radial-gradient(ellipse 700px 400px at 40% 85%,
            rgba(30, 58, 138, 0.2) 0%,
            rgba(55, 48, 163, 0.15) 45%,
            transparent 65%
        );
    animation: nebulaFloat 150s ease-in-out infinite;
    filter: blur(100px);
    opacity: 0.85;
    mix-blend-mode: screen;
}

@keyframes nebulaFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.85;
    }
    25% {
        transform: translate(1%, -0.5%) rotate(0.5deg) scale(1.02);
        opacity: 0.9;
    }
    50% {
        transform: translate(-0.5%, 1%) rotate(-0.3deg) scale(0.98);
        opacity: 0.8;
    }
    75% {
        transform: translate(-1%, -0.5%) rotate(0.4deg) scale(1.01);
        opacity: 0.88;
    }
}

/* 星レイヤー（奥・中・手前の3層） */
.stars-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.stars-layer.far {
    opacity: 0.3;
    animation: starsDrift 200s linear infinite;
}

.stars-layer.mid {
    opacity: 0.5;
    animation: starsDrift 120s linear infinite;
}

.stars-layer.near {
    opacity: 0.8;
    animation: starsDrift 80s linear infinite;
}

@keyframes starsDrift {
    from { transform: translateY(0); }
    to { transform: translateY(-100px); }
}

/* 個別の星（繊細で微細） */
.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 1px rgba(255, 255, 255, 0.8);
    opacity: 0.6;
}

/* キラキラアニメーション（控えめ） */
.star.twinkle {
    animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

/* 大きな輝く星（十字の光条付き） */
.star.bright {
    background: radial-gradient(circle,
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.8) 20%,
        rgba(220, 230, 255, 0.4) 50%,
        transparent 80%
    );
    box-shadow: 0 0 4px rgba(255, 255, 255, 1),
                0 0 8px rgba(255, 255, 255, 0.6),
                0 0 12px rgba(147, 197, 253, 0.3);
    animation: brightPulse 6s ease-in-out infinite;
    opacity: 0.9;
}

/* 十字の光条（参考画像スタイル） */
.star.bright::before,
.star.bright::after {
    content: '';
    position: absolute;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 48%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(255, 255, 255, 0.6) 52%,
        transparent 100%
    );
    opacity: 0.7;
}

.star.bright::before {
    width: 60px;
    height: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.star.bright::after {
    width: 1px;
    height: 60px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes brightPulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

/* 流れ星（繊細で速い、わずかに青白い） */
.shooting-star {
    position: absolute;
    width: 1.5px;
    height: 1.5px;
    background: rgba(220, 235, 255, 1);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(200, 220, 255, 0.8);
    opacity: 0;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 0;
    right: 1.5px;
    width: 50px;
    height: 0.8px;
    background: linear-gradient(to right,
        rgba(220, 235, 255, 0.7),
        rgba(180, 200, 255, 0.4),
        transparent
    );
    transform: translateX(100%);
    filter: blur(0.5px);
}

.shooting-star.active {
    animation: shootingStar 1.2s ease-out forwards;
}

@keyframes shootingStar {
    0% {
        opacity: 0;
        transform: translate(0, 0);
    }
    5% {
        opacity: 0.8;
    }
    95% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translate(200px, 200px);
    }
}

/* 光の粒子（極めて微細） */
.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 20s linear infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    10% {
        opacity: 0.2;
    }
    90% {
        opacity: 0.2;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1);
    }
}

/* コンテンツを前面に */
.gallery-container {
    position: relative;
    z-index: 1;
}

.gallery-page.l-mainContent {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ヘッダーエリアは通常の余白を保つ */
body.page-template-template-gallery #header,
body.page-template-template-gallery #header .l-header__inner,
body.page-template-template-gallery .l-header {
    /* SWELLデフォルトの余白を維持 */
}

/* メインコンテンツは余白なし */
body.page-template-template-gallery .l-mainContent {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ギャラリーページのヘッダー下のタイトルエリアを非表示 */
body.page-template-template-gallery .l-topTitleArea {
    display: none !important;
}

/* ===== コンテナ ===== */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 100px;
}

@media (max-width: 1024px) {
    .gallery-container {
        padding: 0 24px 60px;
    }
}

@media (max-width: 640px) {
    .gallery-container {
        padding: 0 16px 40px;
    }
}

/* ===== ヘッダー（ミニマル＆エレガント） ===== */
.gallery-header {
    text-align: center;
    padding: 120px 40px 100px;
    margin-bottom: 80px;
    position: relative;
    background: transparent;
}

.gallery-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 80px;
    background: linear-gradient(to bottom,
        rgba(255, 255, 255, 0.2),
        transparent
    );
}

@media (max-width: 768px) {
    .gallery-header {
        padding: 60px 20px 40px;
        margin-bottom: 30px;
    }
}

@media (max-width: 640px) {
    .gallery-header {
        padding: 50px 16px 30px;
        margin-bottom: 24px;
    }
}

.gallery-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.2em;
    margin: 0 0 24px;
    line-height: 1;
    opacity: 0;
    transform: translateY(30px);
    animation: titleReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
}

.gallery-title::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
}

.gallery-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    margin: 0;
    opacity: 0;
    transform: translateY(20px);
    animation: titleReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards;
}

.gallery-divider {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    margin: 40px auto 0;
    opacity: 0;
    transform: scaleX(0);
    animation: dividerReveal 1s cubic-bezier(0.22, 1, 0.36, 1) 0.7s forwards;
}

@keyframes titleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dividerReveal {
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

/* ===== マガジン風グリッド ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    grid-auto-flow: dense;
}

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 12px;
    }
}

/* ===== ギャラリーアイテム（サイズバリエーション） ===== */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: var(--brand-card-bg);
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 1px rgba(255, 255, 255, 0.1) inset;

    /* 全アイテム：1カラム幅 */
    grid-column: span 1;

    /* スクロールアニメーション初期状態 */
    opacity: 0;
    transform: translateY(60px);

    /* パフォーマンス最適化 */
    will-change: transform, filter, opacity;
}

/* ===== インタラクティブ：ホバー時に他がぼける（is-visible なアイテムにのみ適用） ===== */
.gallery-grid:hover .gallery-item.is-visible {
    filter: blur(3px) saturate(0.5);
    opacity: 0.6;
    transform: scale(0.98);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                filter 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.5s ease;
}

.gallery-grid:hover .gallery-item.is-visible:hover {
    filter: blur(0) saturate(1.1);
    opacity: 1;
    transform: scale(1.02);
    z-index: 10;
}

.gallery-item:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

/* ===== 画像リンク（16:9固定） ===== */
.gallery-image-link {
    display: block;
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.gallery-image-link.loaded {
    animation: none;
    background: var(--brand-card-bg);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.gallery-image-link img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), object-position 3s ease-in-out;
    will-change: transform, object-position;
}

/* 縦長画像の場合：上下にパン */
.gallery-image-link img[data-orientation="portrait"] {
    animation: portraitPan 8s ease-in-out infinite;
}

.gallery-item:hover .gallery-image-link img[data-orientation="portrait"] {
    animation-play-state: paused;
    object-position: center bottom;
}

/* 超横長画像の場合：左右にパン */
.gallery-image-link img[data-orientation="ultra-wide"] {
    animation: landscapePan 8s ease-in-out infinite;
}

.gallery-item:hover .gallery-image-link img[data-orientation="ultra-wide"] {
    animation-play-state: paused;
    object-position: right center;
}

/* 通常の横長・正方形画像：ズーム + 彩度アップ */
.gallery-item:hover .gallery-image-link img[data-orientation="landscape"],
.gallery-item:hover .gallery-image-link img[data-orientation="square"] {
    transform: scale(1.08);
    filter: saturate(1.15) brightness(1.05);
}

/* すべての画像：ホバー時に彩度・明度アップ */
.gallery-item:hover .gallery-image-link img[data-orientation="portrait"],
.gallery-item:hover .gallery-image-link img[data-orientation="ultra-wide"] {
    filter: saturate(1.15) brightness(1.05);
}

/* 縦長画像の自動パンアニメーション（上→下） */
@keyframes portraitPan {
    0%, 100% {
        object-position: center top;
    }
    50% {
        object-position: center bottom;
    }
}

/* 超横長画像の自動パンアニメーション（左→右） */
@keyframes landscapePan {
    0%, 100% {
        object-position: left center;
    }
    50% {
        object-position: right center;
    }
}

/* ===== オーバーレイ（ダイナミックなグラデーション） ===== */
.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 80px 24px 24px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        transparent 100%
    );
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease,
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                background 0.6s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    transform: translateY(0);
    background: linear-gradient(
        to top,
        rgba(74, 168, 222, 0.85) 0%,
        rgba(74, 168, 222, 0.4) 40%,
        rgba(211, 172, 43, 0.15) 70%,
        transparent 100%
    );
}

.gallery-overlay-text {
    color: #ffffff;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.8;
    letter-spacing: 0.03em;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ===== View ボタン（ミニマル） ===== */
.gallery-view-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 2px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.gallery-item:hover .gallery-view-btn {
    opacity: 1;
    transform: translateY(0);
}

.gallery-view-btn span {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--brand-text);
}

/* ===== スクロールアニメーション ===== */
.gallery-item.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                filter 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* スタガード遅延はJSで動的付与（gallery.js）。12件超にも対応 */

/* ===== アイテムなし ===== */
.gallery-no-items {
    text-align: center;
    padding: 120px 20px;
    color: var(--brand-text-muted);
}

.gallery-no-items p {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    margin: 0;
}

/* ===== カスタムカーソル（オプション） ===== */
.gallery-cursor {
    position: fixed;
    width: 80px;
    height: 80px;
    border: 2px solid var(--brand-gold);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
}

.gallery-cursor.is-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.gallery-cursor::after {
    content: 'VIEW';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--brand-gold);
}

/* ===== 背景スクロール防止 ===== */
body.lum-lightbox-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* ===== Luminous Lightbox ===== */
.lum-lightbox {
    z-index: 100000 !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.lum-lightbox.lum-open {
    display: flex !important;
    background: rgba(0, 0, 0, 0.92) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    animation: lightboxFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lum-lightbox.lum-closing {
    animation: lightboxFadeOut 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
    pointer-events: none !important;
}

@keyframes lightboxFadeOut {
    from {
        opacity: 1;
        visibility: visible;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.lum-lightbox:not(.lum-open) {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.lum-lightbox.lum-open .lum-lightbox-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
}

.lum-lightbox:not(.lum-open) .lum-lightbox-inner {
    opacity: 0 !important;
    pointer-events: none !important;
}

.lum-lightbox.lum-open .lum-lightbox-inner > *:not(.lum-gallery-button):not(.lum-previous-button):not(.lum-next-button):not(.lum-lightbox-caption),
.lum-lightbox.lum-open .lum-lightbox-inner > img {
    position: static !important;
    max-width: 90vw !important;
    max-height: 85vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 !important;
    display: block !important;
    border-radius: 2px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    animation: imageFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

@keyframes imageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 左右ナビゲーションのスライドアニメーション */
.lum-lightbox.lum-open .lum-lightbox-inner img.slide-in-from-left {
    animation: slideInFromLeft 0.5s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.lum-lightbox.lum-open .lum-lightbox-inner img.slide-in-from-right {
    animation: slideInFromRight 0.5s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

@keyframes slideInFromLeft {
    0% {
        opacity: 0 !important;
        transform: translateX(-80px) scale(0.92) !important;
    }
    100% {
        opacity: 1 !important;
        transform: translateX(0) scale(1) !important;
    }
}

@keyframes slideInFromRight {
    0% {
        opacity: 0 !important;
        transform: translateX(80px) scale(0.92) !important;
    }
    100% {
        opacity: 1 !important;
        transform: translateX(0) scale(1) !important;
    }
}

.lum-lightbox:not(.lum-open) .lum-lightbox-inner > *,
.lum-lightbox:not(.lum-open) .lum-lightbox-inner > img {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Lightbox キャプション */
.lum-lightbox-caption {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.98) !important;
    color: #2c2c2c !important;
    padding: 14px 28px;
    border-radius: 2px;
    font-family: 'Inter', 'Noto Sans JP', sans-serif !important;
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    letter-spacing: 0.03em;
    max-width: 70%;
    text-align: center;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    animation: captionSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes captionSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Lightbox 閉じるボタン */
.lum-close-button {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    width: 50px !important;
    height: 50px !important;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    z-index: 100002 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    transition: border-color 0.3s ease, transform 0.3s ease;
    animation: buttonFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards;
}

.lum-close-button:hover {
    border-color: rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    transform: rotate(90deg) scale(1.1) !important;
}

.lum-close-button:active {
    transform: rotate(90deg) scale(0.95) !important;
}

.lum-close-button::before,
.lum-close-button::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 1px;
    background: #fff;
}

.lum-close-button::before {
    transform: rotate(45deg);
}

.lum-close-button::after {
    transform: rotate(-45deg);
}

/* Lightbox ナビゲーション */
.lum-lightbox .lum-gallery-button,
.lum-lightbox .lum-previous-button,
.lum-lightbox .lum-next-button {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 60px !important;
    height: 60px !important;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    z-index: 100001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease, background 0.3s ease !important;
}

/* デフォルトのテキストを非表示 */
.lum-lightbox .lum-gallery-button {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    line-height: 0 !important;
}

.lum-lightbox.lum-open .lum-gallery-button,
.lum-lightbox.lum-open .lum-previous-button,
.lum-lightbox.lum-open .lum-next-button {
    animation: buttonFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards;
}

@keyframes buttonFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lum-lightbox .lum-gallery-button:hover,
.lum-lightbox .lum-previous-button:hover,
.lum-lightbox .lum-next-button:hover {
    border-color: rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.lum-lightbox .lum-gallery-button:active,
.lum-lightbox .lum-previous-button:active,
.lum-lightbox .lum-next-button:active {
    transform: translateY(-50%) scale(0.95) !important;
}

/* 前へボタン（左） */
.lum-lightbox .lum-gallery-button:first-of-type,
.lum-lightbox .lum-previous-button {
    left: 30px !important;
    right: auto !important;
}

/* 次へボタン（右） */
.lum-lightbox .lum-gallery-button:last-of-type,
.lum-lightbox .lum-next-button {
    right: 30px !important;
    left: auto !important;
}

/* 矢印（前へ：左向き） */
.lum-lightbox .lum-gallery-button:first-of-type::before,
.lum-lightbox .lum-previous-button::before {
    content: '' !important;
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    border-top: 2px solid #fff !important;
    border-right: 2px solid #fff !important;
    position: relative !important;
    transform: rotate(-135deg) !important;
    margin-left: -2px;
}

/* 矢印（次へ：右向き） */
.lum-lightbox .lum-gallery-button:last-of-type::before,
.lum-lightbox .lum-next-button::before {
    content: '' !important;
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    border-top: 2px solid #fff !important;
    border-right: 2px solid #fff !important;
    position: relative !important;
    transform: rotate(45deg) !important;
    margin-right: -2px;
}

/* ===== モバイル用 Lightbox 最適化 ===== */
@media (max-width: 640px) {
    .lum-lightbox-inner {
        padding: 20px !important;
    }

    .lum-lightbox-inner img {
        max-width: 95vw !important;
        max-height: 80vh !important;
    }

    .lum-close-button {
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }

    .lum-lightbox .lum-gallery-button,
    .lum-gallery-button,
    .lum-previous-button,
    .lum-next-button {
        width: 44px !important;
        height: 44px !important;
    }

    .lum-lightbox .lum-previous-button,
    .lum-previous-button,
    .lum-gallery-button:first-of-type {
        left: 10px !important;
    }

    .lum-lightbox .lum-next-button,
    .lum-next-button,
    .lum-gallery-button:last-of-type {
        right: 10px !important;
    }

    .lum-lightbox-caption {
        bottom: 20px;
        padding: 10px 20px;
        font-size: 0.75rem;
        max-width: 85%;
    }
}

/* ===== スムーススクロール ===== */
.gallery-page {
    scroll-behavior: smooth;
}
