/* =========================================
   CUSTOM HEADER STYLES (Responsive & Lightweight)
   ========================================= */

/* --- PC / Tablet Base Styles --- */
#custom-header {
    position: fixed; top: 0; left: 0; width: 100%; padding: 20px 40px;
    display: flex; justify-content: space-between; align-items: center;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: padding 0.3s, background 0.3s;
}

.logo img {
    height: 32px; width: auto; display: block;
    filter: brightness(0) invert(1); transition: height 0.3s;
    position: relative; z-index: 101; /* メニューが開いてもロゴは最前面 */
}

/* PC Nav */
#custom-nav ul { display: flex; gap: 30px; list-style: none; margin: 0; padding: 0; }
#custom-nav a {
    text-decoration: none; color: #ffffff; font-weight: 700; font-size: 0.9rem;
    opacity: 0.8; transition: 0.3s; letter-spacing: 0.05em; position: relative;
}
#custom-nav a:hover { opacity: 1; color: #00c6ff; }
#custom-nav a::after {
    content: ''; position: absolute; bottom: -5px; left: 0; width: 0%; height: 2px;
    background: #00c6ff; transition: 0.3s;
}
#custom-nav a:hover::after { width: 100%; }

/* ハンバーガーボタン（PCでは非表示） */
.hamburger { display: none; }
#mobile-menu-overlay { display: none; }


/* =========================================
   MOBILE OPTIMIZATION & HAMBURGER MENU
   ========================================= */
@media (max-width: 768px) {
    #custom-header {
        padding: 15px 20px;
        backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
        background: rgba(10, 10, 10, 0.95) !important; /* 軽量化黒背景 */
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }
    .logo img { height: 24px; }
    #custom-nav { display: none; }

    /* --- 1. Hamburger Button Style --- */
    .hamburger {
        display: block;
        position: relative;
        width: 30px;
        height: 20px;
        cursor: pointer;
        z-index: 101; /* メニューより手前 */
    }
    .hamburger span {
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: #fff;
        transition: 0.4s;
    }
    /* 3本線の配置 */
    .hamburger span:nth-of-type(1) { top: 0; }
    .hamburger span:nth-of-type(2) { top: 9px; }
    .hamburger span:nth-of-type(3) { bottom: 0; }

    /* Active State (X印になるアニメーション) */
    .hamburger.active span:nth-of-type(1) {
        transform: translateY(9px) rotate(45deg);
        background-color: #00c6ff; /* 開いた時はアクセントカラー */
    }
    .hamburger.active span:nth-of-type(2) {
        opacity: 0;
    }
    .hamburger.active span:nth-of-type(3) {
        transform: translateY(-9px) rotate(-45deg);
        background-color: #00c6ff;
    }

    /* --- 2. Mobile Menu Overlay --- */
    #mobile-menu-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: #000; /* 完全な黒（軽量） */
        z-index: 1002;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.4s ease, visibility 0.4s ease;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    #mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Menu Content */
    .mobile-nav-content ul {
        list-style: none;
        padding: 0;
        text-align: center;
    }
    .mobile-nav-content li {
        margin-bottom: 30px;
        opacity: 0;
        transform: translateY(20px);
        transition: 0.5s ease;
    }
    
    /* メニューが開いた時にリンクが順番に出てくる演出 */
    #mobile-menu-overlay.active li { opacity: 1; transform: translateY(0); }
    #mobile-menu-overlay.active li:nth-child(1) { transition-delay: 0.1s; }
    #mobile-menu-overlay.active li:nth-child(2) { transition-delay: 0.2s; }
    #mobile-menu-overlay.active li:nth-child(3) { transition-delay: 0.3s; }
    #mobile-menu-overlay.active li:nth-child(4) { transition-delay: 0.4s; }
    #mobile-menu-overlay.active li:nth-child(5) { transition-delay: 0.5s; }

    .mobile-nav-content a {
        text-decoration: none;
        color: #fff;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .mobile-nav-content .en {
        font-family: 'Montserrat', sans-serif;
        font-size: 2rem;
        font-weight: 900;
        letter-spacing: 0.1em;
        line-height: 1.2;
        transition: 0.3s;
    }
    .mobile-nav-content .jp {
        font-size: 0.8rem;
        color: #888;
        margin-top: 5px;
        font-weight: 400;
    }
    
    /* タップ時の反応 */
    .mobile-nav-content a:active .en {
        color: #00c6ff;
        transform: scale(0.95);
    }
}

/* =========================================
   FIX: Z-INDEX FORCE (最前面表示の強制)
   ========================================= */

/* 1. ヘッダー（とハンバーガーボタン）を画面の最前面に固定 */
#custom-header {
    z-index: 9999 !important;
}

/* 2. メニューの黒背景は、ヘッダーより一つ後ろに配置 */
#mobile-menu-overlay {
    z-index: 9990 !important;
}

/* 3. ハンバーガーボタン自体も念のため最前面を確保 */
.hamburger {
    z-index: 10000 !important;
    position: relative;
}

/* =========================================
   CUSTOM CURSOR (Global)
   ========================================= */

/* 1. 配置と基本設定 */
#cursor-dot, #cursor-circle {
    position: fixed;
    top: 0; left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999 !important; /* 最前面 */
    transform: translate(-50%, -50%);
    display: block;
}

/* 2. ドット（中心の点） */
#cursor-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

/* 3. サークル（追従する円） */
#cursor-circle {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 198, 255, 0.5);
    background: rgba(0, 198, 255, 0.05);
    transition: width 0.3s, height 0.3s, background-color 0.3s, border-color 0.3s;
    will-change: transform; /* パフォーマンス向上 */
}

/* 4. ホバー時の変化 */
body.hovering #cursor-circle {
    width: 60px;
    height: 60px;
    background: rgba(0, 198, 255, 0.2);
    border-color: #00c6ff;
    mix-blend-mode: screen;
}
body.hovering #cursor-dot {
    opacity: 0; /* ホバー時は点を消す */
}

/* 5. PCのみ表示（スマホでは非表示） */
@media (max-width: 768px) {
    #cursor-dot, #cursor-circle {
        display: none !important;
    }
}
@media (min-width: 769px) {
    /* デフォルトの矢印カーソルを消す */
    html, body, a, button, input, textarea, select {
        cursor: none !important;
    }
}