/* ========================================== 1. Base Reset & Variables (Existing) ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { 
    --primary-color: #CCFF33; 
    --secondary-color: #0066ff; 
    --bg-dark: #02050a; 
    --bg-gradient: radial-gradient(circle at center, #051020 0%, #02050a 100%); 
    --text-light: #e0f7fa; 
    --glass-bg: rgba(255, 255, 255, 0.03); 
    --glass-border: rgba(0, 242, 255, 0.15); 
    --color-cmd-main: #00f2ff; 
    --color-cmd-sub: #bc13fe; 
    --color-group: #00f2ff; 
    --color-unit: #ff00ff; 
    --font-heading: 'Orbitron', sans-serif; 
    --font-accent: 'Exo 2', sans-serif; 
    --font-base: 'Noto Sans JP', sans-serif; 
}
html { scroll-behavior: smooth; } 
body { font-family: var(--font-base); background-color: var(--bg-dark); background: var(--bg-gradient); color: var(--text-light); line-height: 1.6; overflow-x: hidden; }

/* ========================================== 2. Cyber Background Layers (Existing) ========================================== */
.bg-layers { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -10; pointer-events: none; }
.bg-gradient { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle at center, #0a1a3a 0%, #02050a 100%); z-index: -3; }
.starfield { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background-image: radial-gradient(1px 1px at 30px 60px, #fff, rgba(0,0,0,0)), radial-gradient(2px 2px at 150px 250px, var(--primary-color), rgba(0,0,0,0)); background-size: 400px 400px; opacity: 0.6; animation: meteor-drift 30s linear infinite; z-index: -2; }
@keyframes meteor-drift { from { transform: translate(0, 0) rotate(0deg); } to { transform: translate(-15%, -15%) rotate(3deg); } }

/* ========================================== 3. Navigation (Existing) ========================================== */
header { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; background: rgba(5, 10, 16, 0.68); border-bottom: 1px solid var(--glass-border); }
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 5%; max-width: 1400px; margin: 0 auto; }
.logo { font-family: var(--font-heading); font-size: 1.4rem; font-weight: bold; color: var(--primary-color); text-shadow: 0 0 10px var(--primary-color); text-decoration: none; display: inline-block; position: relative; cursor: pointer; }
.logo::after { content: ''; position: absolute; bottom: -5px; left: 50%; width: 0; height: 3px; background-color: var(--primary-color); box-shadow: 0 0 15px var(--primary-color), 0 0 30px var(--primary-color); transition: width 0.4s ease, left 0.4s ease; }
.logo:hover::after { width: 100%; left: 0; }
.logo:hover { color: #fff; text-shadow: 0 0 12px rgba(0, 242, 255, 0.8), 0 0 30px rgba(0, 242, 255, 0.5), 0 0 50px rgba(0, 242, 255, 0.3); }

.nav-links { display: flex; list-style: none; }
.nav-links li a { margin-left: 2rem; font-size: 1.1rem; text-decoration: none; color: #39FF14; transition: all 0.3s ease; font-family: var(--font-accent); position: relative; font-weight: 800; text-shadow: 0 0 10px rgba(57, 255, 20, 0.8), 0 0 25px rgba(57, 255, 20, 0.4), 0 0 40px rgba(57, 255, 20, 0.2); }
.nav-links li a::after { content: ''; position: absolute; bottom: -5px; left: 50%; width: 0; height: 3px; background-color: var(--color-cmd-main); box-shadow: 0 0 15px var(--color-cmd-main), 0 0 30px var(--color-cmd-main); transition: width 0.3s ease, left 0.3s ease; }
.nav-links li a:hover::after { width: 100%; left: 0; }
.nav-links li a:hover { color: var(--primary-color); text-shadow: 0 0 12px rgba(0, 242, 255, 0.8), 0 0 30px rgba(0, 242, 255, 0.5), 0 0 50px rgba(0, 242, 255, 0.3); }
.nav-links li a.active-link::after { width: 100%; left: 0; }

.btn-cyber { background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); padding: 0.5rem 1rem; cursor: pointer; font-family: var(--font-heading); transition: all 0.3s ease; }
.btn-cyber:hover { background: var(--primary-color); color: var(--bg-dark); box-shadow: 0 0 15px var(--primary-color); }
.nav-controls { display: flex; align-items: center; gap: 1rem; }

/* Hamburger */ .hamburger { display: none; flex-direction: column; justify-content: space-between; width: 30px; height: 24px; cursor: pointer; z-index: 1001; }
.hamburger span { display: block; width: 100%; height: 3px; background-color: var(--primary-color); border-radius: 2px; transition: all 0.3s ease; }

@media screen and (max-width: 768px) { 
    .logo { font-size:0.8rem; }
    .nav-links { position: fixed; right: -100%; top: 70px; flex-direction: column; width: 100%; text-align: center; transition: 0.3s; padding: 2rem 0; background: rgba(5, 10, 16, 0.65); backdrop-filter: blur(5px); } 
    .nav-links.active { right: 0; display: flex; } 
    .nav-links li a { margin-left: 0; margin-bottom: 1.5rem; } 
    .hamburger { display: flex; } 
}

/* ========================================== 4. Hero Section (Existing) ========================================== */
#home{ margin-top:70px; }
.hero.fv-content { position: relative; width: 100%; height: 88vh; overflow: hidden; background-color: #000; }
@media screen and (max-width:767px) { .hero.fv-content { height: 60vh; } }
.contents-wrapper{ width: calc(100% - 100px); max-width: 1280px; margin: 0 auto; padding: 0 clamp(20px, 2.6596vw + -0.43px, 40px); position: relative; z-index: 10; }
@media screen and (max-width:767px) { .contents-wrapper{ width:100%; padding: 0; } }

/* ========================================== 5. Gallery Section (Existing & Updated) ========================================== */
.container { padding: 80px 5%; max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
.section-title { font-family: var(--font-heading); font-size: 2.5rem; text-align: center; margin-bottom: 3rem; color: var(--primary-color); text-shadow: 0 0 10px rgba(0, 242, 255, 0.8), 0 0 20px rgba(0, 242, 255, 0.4); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; padding: 40px; margin: 20px auto; max-width: 1200px; }
.gallery-item { position: relative; overflow: hidden; border-radius: 12px; aspect-ratio: 16 / 9; cursor: pointer; box-shadow: 0 8px 32px 0 rgba(0, 255, 255, 0.1); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.gallery-item:hover img { transform: scale(1.1); }
.gallery-overlay { position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(transparent, rgba(0, 255, 255, 0.4), rgba(0, 0, 0, 0.6)); display: flex; align-items: flex-end; padding: 25px; opacity: 0; transition: opacity 0.3s ease; }
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-overlay span { color: #fff; font-weight: bold; font-size: 1.2rem; text-shadow: 0 0 15px rgba(0, 255, 255, 0.9); }

/* ========================================== 6. LIGHTBOX STYLES (UPDATED TO 3D) ========================================== */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(2, 5, 10, 0.95);
    display: none; /* JSで制御 */
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(8px);
}
.lightbox.active { display: flex; }

/* Background Shake Effect */
.lightbox-bg-shake {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(51, 255, 0, 0.05);
    pointer-events: none; z-index: -1;
}
.shake-active .lightbox-bg-shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, -2px, 0); }
  20%, 80% { transform: translate3d(4px, 4px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, -4px, 0); }
  40%, 60% { transform: translate3d(6px, 4px, 0); }
}

/* 3D Carousel Mechanism */
.carousel-viewport {
    perspective: 900px; /* 1200px から 2000px に拡大（遠近感を弱めて隣が見えにくくする） */
    width: 80vw;
    max-width: 700px;
    height: 50vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
    position: absolute;
    width: 69%;           /* width: 100% から 80% に変更（少し小さくする） */
    height: 69%;          /* height: 100% から 80% に変更 */
    left: 18%;           /* 中央寄せにするための調整 */
    top: 10%;            /* 中央寄せにするための調整 */
    backface-visibility: hidden;
    border: 3px solid rgba(51, 255, 0, 1);
    box-shadow: 0 0 30px rgba(51, 255, 0, 0.4), inset 0 0 20px rgba(51, 255, 0, 0.2);
}

.carousel-slide img { width: 100%; height: 100%; object-fit: contain; background: #000; }

.lightbox-content { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }

/* Lightbox内のキャプション設定 - 視認性強化版 */
#lightbox-caption {
    position: absolute;
    bottom: -115px;        
    left: 50%;            
    transform: translateX(-50%); 
    width: fit-content;   
    min-width: 60%;       
    max-width: 90%;       
    padding: 12px 30px;   

    background: linear-gradient(
        to bottom, 
        transparent, 
        rgba(204, 255, 51, 0.4), 
        rgba(0, 0, 0, 0.6)
    );

    color: #31FF00; 
    text-align: center;
    z-index: 10001;       
    pointer-events: none; 
    font-family: "Hiragino Maru Gothic ProN", "Yu Gothic Medium", sans-serif;
    font-size: 1.9rem;
    font-weight: bold;

    /* ↓↓↓ アニメーションの適用 ↓↓↓ */
    animation: breathingGlow 3s ease-in-out infinite;
}

@keyframes breathingGlow {
    0% {
        color: rgba(49, 255, 0, 0.7);
        /* 黒い縁取り + ネオンの光（最小） */
        text-shadow: 
            -1px -1px 0 #CCFF00,  
             1px -1px 0 #CCFF00,
            -1px  1px 0 #CCFF00,
             1px  1px 0 #CCFF00,
             0 0 5px rgba(49, 255, 0, 0.5),
             0 0 10px rgba(49, 255, 0, 0.3);
    }
    50% {
        color: rgba(49, 255, 0, 1);
        /* 黒い縁取り + ネオンの光（最大） */
        text-shadow: 
            -1px -1px 0 #31FF00,  
             1px -1px 0 #31FF00,
            -1px  1px 0 #31FF00,
             1px  1px 0 #31FF00,
             0 0 10px rgba(49, 255, 0, 0.8),
             0 0 20px rgba(49, 255, 0, 0.6),
             0 0 35px rgba(49, 255, 0, 0.4);
    }
    100% {
        color: rgba(49, 255, 0, 0.7);
        /* 黒い縁取り + ネオンの光（最小） */
        text-shadow: 
            -1px -1px 0 #7FFFD4,  
             1px -1px 0 #7FFFD4,
            -1px  1px 0 #7FFFD4,
             1px  1px 0 #7FFFD4,
             0 0 5px rgba(49, 255, 0, 0.5),
             0 0 10px rgba(49, 255, 0, 0.3);
    }
}

/* スライド（画像）からはみ出してもキャプションが見えるように強制解除 */
.carousel-slide {
    overflow: visible !important; /* これが重要：これがないとマイナス値にした時に消えます */
}

/* Controls */
.lightbox-close { position: absolute; top: 30px; right: 40px; font-size: 50px; color: rgba(51, 255, 0, 1); cursor: pointer; z-index: 3001; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(51, 255, 0, 0.3); border: 1px solid var(--glass-border); color: rgba(51, 255, 0, 1); padding: 20px 15px; cursor: pointer; font-size: 30px; z-index: 3001; transition: all 0.3s ease; }
.lightbox-prev { left: 20px; } .lightbox-next { right: 20px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(51, 255, 0, 0.2); border-color: rgba(51, 255, 0, 1); box-shadow: 0 0 15px rgba(51, 255, 0, 1); }

@media (max-width: 768px) {
    .lightbox-prev, .lightbox-next { padding: 15px 10px; font-size: 24px; }
    .lightbox-caption { font-size: 1rem; text-align: center; }
    .carousel-viewport { height: 40vh; width: 90vw; }
}

/* ========================================== 7. Footer (Existing) ========================================== */
footer { text-align: center; padding: 2rem; border-top: 1px solid var(--glass-border); font-size: 0.8rem; position: relative; z-index: 1; }

/* Back Button Section (Existing) */
.back-button-container { text-align: center; margin: 60px auto 40px; position: relative; z-index: 10; }
.btn-back { padding: 1rem 3rem !important; font-size: 1.2rem !important; letter-spacing: 0.2em !important; position: relative; overflow: hidden; }
.btn-back:hover { transform: scale(1.1); background: var(--primary-color) !important; color: var(--bg-dark) !important; box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--color-cmd-main), inset 0 0 15px rgba(255, 255, 255, 0.5) !important; }
.btn-back:active { transform: scale(0.95); }

@media (max-width: 768px) {
    .back-button-container { margin: 40px auto 30px; }
    .btn-back { padding: 0.8rem 2rem !important; font-size: 1rem !important; }
}

/* Footer Glitch Effect (Existing) */
footer .paragraph a { position: relative; display: inline-block; color: var(--text-light); text-decoration: none; cursor: pointer; transition: color 0.3s ease; text-shadow: 1px 0 rgba(255, 0, 255, 0.4), -1px 0 rgba(0, 255, 255, 0.4); }
footer .paragraph a::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(255, 255, 255, 0.1) 50%); background-size: 100% 4px; opacity: 0; z-index: 3; pointer-events: none; }
footer .paragraph a:hover { animation: jitter 0.1s infinite; text-shadow: 3px 0 #ff00ff, -3px 0 #00ffff; }
footer .paragraph a:hover::before { opacity: 1; animation: glitch-anim 0.2s infinite; z-index: -2; color: #00ffff; }
footer .paragraph a:hover::after { opacity: 1; animation: scanline-anim 0.1s infinite, flicker-anim 0.15s infinite; }

@keyframes jitter { 0% { transform: translate(0); } 25% { transform: translate(-1px, 1px); } 50% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, -1px); } 100% { transform: translate(1px, 1px); } }
@keyframes glitch-anim { 0% { clip-path: inset(20% 0 30% 0); } 20% { clip-path: inset(60% 0 10% 0); } 40% { clip-path: inset(10% 0 70% 0); } 60% { clip-path: inset(80% 0 5% 0); } 80% { clip-path: inset(30% 0 40% 0); } 100% { clip-path: inset(50% 0 20% 0); } }
@keyframes scanline-anim { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
@keyframes flicker-anim { 0%, 100% { opacity: 0.8; } 50% { opacity: 1; } }
/* PDF版ボタン（aタグ）のスタイルを調整 */
.btn-back a {
    text-decoration: none; /* 下線を消す */
    color: inherit;        /* 親要素（button）の文字色を引き継ぐ */
    display: block;        /* クリック範囲をボタン全体に広げる */
    width: 100%;
    height: 100%;
}

/* ボタン全体のホバー挙動を整理 */
.btn-back:hover {
    background-color: var(--primary-color) !important; /* ライムイエロー */
    color: #000 !important;                            /* 文字は黒 */
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--color-cmd-main);
}

/* ボタン内の文字色もホバー時に確実に黒にする */
.btn-back:hover span {
    color: #000 !important;
}