/* ========================================
   統一ナビゲーションシステム v9.0.0
   デザインシステムv9.0.0に統合
   FUTURE × LIFE × SCIENCE
   ======================================== */

/* ========================================
   ヘッダー共通設定
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #FFFFFF; /* 完全な白背景（ロゴ背景を目立たなくする） */
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(10, 61, 61, 0.04); /* 非常に薄いボーダー */
}

.header.scrolled {
    background: #FFFFFF; /* 完全な白 */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); /* より薄いシャドウ */
    border-bottom-color: rgba(10, 61, 61, 0.06); /* 薄いボーダー */
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(20px, 3vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    gap: clamp(16px, 2vw, 32px);
}

/* ヘッダー内のコンテナはpaddingをリセット */
.header .container {
    padding: 0 !important;
}

/* ========================================
   ロゴセクション
   ======================================== */
.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.logo:hover {
    opacity: 0.85;
}

.logo-image {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #FFFFFF; /* 白背景でロゴの背景を目立たなくする */
    flex-shrink: 0;
}

.logo picture {
    display: block;
    line-height: 0;
    width: 56px;
    height: 56px;
    background: #FFFFFF; /* 白背景でロゴの背景を目立たなくする */
}

.logo picture img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #FFFFFF; /* 白背景でロゴの背景を目立たなくする */
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.logo-subtitle {
    font-family: 'IBM Plex Mono', monospace; /* v9.0.0: ラベルフォント */
    font-size: 0.625rem; /* 10px */
    color: #C9A961; /* Gold */
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1;
}

.logo-title {
    font-family: 'Noto Serif JP', serif; /* v9.0.0: ディスプレイフォント */
    font-size: 1.125rem; /* 18px */
    font-weight: 500;
    color: #0A3D3D; /* Deep Teal */
    letter-spacing: 0.05em;
    line-height: 1.3;
}

/* ========================================
   デスクトップナビゲーション
   ======================================== */
.nav-menu {
    display: flex;
    align-items: center;
    gap: clamp(12px, 1.5vw, 20px);
    flex: 1;
    justify-content: flex-end;
    max-width: 100%;
    flex-wrap: nowrap;
    margin-right: 0;
}

.nav-menu a {
    position: relative;
    font-family: 'Noto Sans JP', sans-serif; /* v9.0.0: 本文フォント */
    font-size: 0.875rem;
    font-weight: 500;
    color: #2A2A2A; /* Charcoal */
    padding: 10px 6px;
    letter-spacing: 0.03em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-decoration: none;
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* アンダーラインアニメーション */
.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #C9A961; /* Gold */
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ホバー時 */
.nav-menu a:hover {
    color: #0A3D3D; /* Deep Teal */
    background: transparent !important;
    background-color: transparent !important;
    transform: translateY(-1px);
}

.nav-menu a:hover::after {
    width: 100%;
}

/* アクティブ状態（現在のページ） */
.nav-menu a.active {
    color: #0A3D3D; /* Deep Teal */
    font-weight: 600;
    background: transparent !important;
    background-color: transparent !important;
}

.nav-menu a.active::after {
    width: 100%;
    background: #0A3D3D; /* Deep Teal */
}

/* フォーカス時（キーボードナビゲーション） */
.nav-menu a:focus {
    outline: 3px solid #C9A961; /* Gold */
    outline-offset: 4px;
    background: transparent !important;
    border-radius: 4px;
}

/* ========================================
   CTAボタン
   ======================================== */
.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #0A3D3D; /* Deep Teal */
    color: white;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0; /* v9.0.0: 角ばったデザイン */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.05em;
    border: 2px solid #0A3D3D;
}

.nav-cta:hover {
    background: transparent;
    color: #0A3D3D;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(10, 61, 61, 0.15);
}

.nav-cta:focus {
    outline: 3px solid #C9A961;
    outline-offset: 4px;
}

/* CTAアイコン（絵文字を使わない） */
.nav-cta::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-cta:hover::before {
    transform: scale(1.15);
}

/* ========================================
   ヘッダー右側（ハンバーガーメニューボタンを含む）
   ======================================== */
.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ========================================
   ハンバーガーメニュー
   ======================================== */
.hamburger {
    display: none; /* デフォルトは非表示（モバイルで表示） */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: relative;
    z-index: 10004; /* さらに高く（メニューの上） */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger:hover {
    opacity: 0.8;
}

.hamburger:focus {
    outline: 3px solid #C9A961;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ハンバーガーライン（v9.0.0: 高級感のあるデザイン） */
.hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    background: #0A3D3D; /* Deep Teal */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 2px;
}

.hamburger span:nth-child(1) {
    top: 10px;
}

.hamburger span:nth-child(2) {
    top: 20px;
    opacity: 1;
}

.hamburger span:nth-child(3) {
    top: 30px;
}

/* メニューオープン時のアニメーション（×マーク） */
.hamburger.active span:nth-child(1) {
    top: 20px;
    transform: translateX(-50%) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-50%) scale(0);
}

.hamburger.active span:nth-child(3) {
    top: 20px;
    transform: translateX(-50%) rotate(-45deg);
}

/* ========================================
   モバイルメニュー
   ======================================== */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* 閉じた状態：画面外右側 */
    width: 85%; /* 100%から85%に変更 */
    max-width: 380px; /* 400pxから380pxに調整 */
    height: 100vh;
    height: 100dvh; /* 動的ビューポート高さ対応 */
    background: #0A3D3D; /* Deep Teal背景 */
    padding: 100px 30px 120px 30px; /* 下部に余白追加（固定CTA分） */
    overflow-y: auto;
    overflow-x: hidden; /* 横スクロール無効 */
    -webkit-overflow-scrolling: touch; /* スムーズスクロール（iOS） */
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10002; /* 1000から10002に引き上げ */
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3); /* シャドウを濃く */
}

.mobile-menu.active {
    right: 0 !important; /* 開いた状態：画面右端 */
}

/* モバイルメニュー内の閉じるボタン */
.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background: rgba(255, 255, 255, 0.15); /* 背景色を少し濃く */
    border: 2px solid rgba(255, 255, 255, 0.5); /* ボーダーを濃く */
    border-radius: 6px; /* 角を少し丸く */
    color: rgba(255, 255, 255, 0.95);
    font-size: 26px;
    cursor: pointer;
    z-index: 10003; /* さらに高く */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #C9A961; /* Gold */
    color: #C9A961;
    transform: rotate(90deg);
}

.mobile-menu-close:active {
    transform: rotate(90deg) scale(0.95);
}

.mobile-menu-close:focus {
    outline: 3px solid #C9A961;
    outline-offset: 4px;
}

/* モバイル閉じるボタンのレスポンシブ対応 */
@media (max-width: 480px) {
    .mobile-menu-close {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 24px;
    }
}

@media (max-width: 360px) {
    .mobile-menu-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 22px;
    }
}

/* モバイルメニューリンク */
.mobile-menu-nav a,
.mobile-menu a {
    display: block;
    padding: 18px 0; /* パディングを増やして見やすく */
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15); /* ボーダーを少し濃く */
    letter-spacing: 0.05em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active,
.mobile-menu a:hover,
.mobile-menu a.active {
    color: #C9A961; /* Gold */
    padding-left: 12px;
    border-bottom-color: rgba(201, 169, 97, 0.3);
}

/* モバイルメニューCTA */
.mobile-menu .nav-cta {
    margin-top: 32px;
    width: 100%;
    justify-content: center;
    background: #C9A961; /* Gold */
    color: #0A3D3D;
    border-color: #C9A961;
}

.mobile-menu .nav-cta:hover {
    background: transparent;
    color: #C9A961;
}

/* オーバーレイ */
.menu-overlay,
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(10, 61, 61, 0.5); /* 少し濃く */
    backdrop-filter: blur(6px); /* ブラーを強く */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001; /* 999から10001に */
    pointer-events: none; /* 閉じている時はクリック無効 */
}

.menu-overlay.active,
.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* 開いている時はクリック有効 */
}

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

/* タブレット以下 */
@media (max-width: 1024px) {
    .nav-menu {
        gap: clamp(8px, 1vw, 12px);
    }
    
    .nav-menu a {
        font-size: 0.8125rem;
        padding: 8px 4px;
    }
    
    .nav-cta {
        padding: 9px 18px;
        font-size: 0.8125rem;
    }
}

/* モバイル */
@media (max-width: 768px) {
    .header-container {
        min-height: 70px;
        padding: 0 20px;
        justify-content: space-between; /* ロゴを左、ハンバーガーを右に配置 */
    }
    
    .logo {
        flex: 0 0 auto; /* ロゴは固定幅 */
    }
    
    .logo-image,
    .logo picture {
        width: 48px;
        height: 48px;
    }
    
    .logo-subtitle {
        font-size: 0.5625rem; /* 9px */
    }
    
    .logo-title {
        font-size: 1rem; /* 16px */
    }
    
    /* デスクトップナビゲーションを非表示 */
    .nav-menu {
        display: none;
    }
    
    /* ハンバーガーメニューを表示 */
    .hamburger {
        display: flex;
    }
    
    /* ヘッダー右側を右端に固定 */
    .header-right {
        margin-left: auto; /* 自動的に右端に配置 */
    }
}

/* 極小デバイス */
@media (max-width: 375px) {
    .header-container {
        padding: 0 16px;
    }
    
    .logo-text {
        gap: 2px;
    }
    
    .mobile-menu {
        padding: 90px 28px 28px 28px;
    }
    
    .mobile-menu a {
        font-size: 1rem;
        padding: 14px 0;
    }
}

/* アクセシビリティ：モーション削減設定 */
@media (prefers-reduced-motion: reduce) {
    .header,
    .nav-menu a,
    .nav-menu a::after,
    .nav-cta,
    .hamburger,
    .hamburger span,
    .mobile-menu,
    .menu-overlay {
        transition: none !important;
    }
}

/* プリント用 */
@media print {
    .header {
        position: static;
        box-shadow: none;
        border-bottom: 1px solid #ccc;
    }
    
    .hamburger,
    .mobile-menu,
    .menu-overlay {
        display: none !important;
    }
}
