/* 基本リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* フォント設定 */
body {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* テーマの基本設定 */
body.dark-theme {
    background-color: #000;
    color: #fff;
}

body.light-theme {
    background-color: #fff;
    color: #000;
}

/* ロゴアニメーション */
#logo-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#logo-animation img {
    width: 60%;
    max-width: 600px;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

#logo-animation img.appear {
    opacity: 1;
    transform: translateY(0);
}

/* メインコンテンツ */
#main-content {
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

/* ヘッダー要素 */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    z-index: 5;
    pointer-events: auto; /* これを追加 */
}

#logo-container {
    position: relative;
    width: 80px;  /* デフォルトサイズ */
    height: 80px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#logo-container:hover {
    transform: scale(1.05);
}

#logo-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* ロゴの表示制御 */
body.dark-theme #logo-container .dark-theme-logo,
body.light-theme #logo-container .light-theme-logo {
    opacity: 1;
}

body.dark-theme #logo-container .light-theme-logo,
body.light-theme #logo-container .dark-theme-logo {
    opacity: 0;
}

/* ハンバーガーメニュー */
#hamburger-menu {
    cursor: pointer;
    z-index: 5;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 2px;
    margin: 6px 0;
    transition: all 0.3s ease;
}

/* ハンバーガーメニューの×印 */
#hamburger-menu.active .line1 {
    transform: translateY(8px) rotate(45deg);
}

#hamburger-menu.active .line2 {
    opacity: 0;
}

#hamburger-menu.active .line3 {
    transform: translateY(-8px) rotate(-45deg);
}

/* メニューオーバーレイ */
#menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    transition: right 0.3s ease;
    z-index: 4;
}

body.dark-theme #menu-overlay {
    background-color: rgba(0, 0, 0, 0.9);
}

body.light-theme #menu-overlay {
    background-color: rgba(255, 255, 255, 0.9);
}

#menu-overlay.open {
    right: 0;
}

/* メニューコンテンツ */
#menu-overlay .menu-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

/* メニューオーバーレイの背景クリックで閉じる */
#menu-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 4;
}

/* ナビゲーションメニュー */
nav ul {
    list-style: none;
    text-align: center;
}

nav ul li {
    margin: 20px 0;
}

nav ul li a {
    font-family: 'Inter', 'Roboto', sans-serif;
    text-decoration: none;
    font-size: 24px;
    transition: color 0.3s ease;
}

body.dark-theme nav ul li a {
    color: #fff;
}

body.light-theme nav ul li a {
    color: #000;
}

nav ul li a:hover {
    opacity: 0.7;
}

/* メニュー内のSNSアイコンの配置とボーダー */
.menu-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid;
    border-color: inherit;
}

body.dark-theme .menu-footer {
    border-color: rgba(255, 255, 255, 0.4);
}

body.light-theme .menu-footer {
    border-color: rgba(0, 0, 0, 0.2);
}

.menu-footer .social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* 動画セクション */
#video-section {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
}

#video-section::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 のアスペクト比を維持 */
}

#background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* セクション共通スタイル */
.section {
    text-align: left;
    background-color: inherit;
}

.section h2 {
    font-size: 2rem;
    margin-bottom: 40px;
    text-align: center;
}

/* About セクションのスタイル */
#about {
    max-width: 800px;
    margin: 0 auto;
    padding: 100px 20px;
}

#about .profile-name {
    position: relative;
    width: 200px;  /* デフォルトサイズ */
    height: auto;
    margin-bottom: 15px;
}

#about .profile-name img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

/* ロゴの縦横比のためのスペーサー要素 */
#about .profile-name::after {
    content: '';
    display: block;
    padding-bottom: 10%;  /* ロゴの高さを調整 */
}

#about .profile-title {
    font-size: 1.2rem;  /* デフォルトサイズ */
    margin-bottom: 50px;
    opacity: 0.9;
    letter-spacing: 0.05em;
    white-space: nowrap;  /* 改行を防ぐ */
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    #about .profile-name {
        width: 180px;
    }
    #about .profile-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    #about .profile-name {
        width: 160px;
    }
    #about .profile-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #about .profile-name {
        width: 140px;
    }
    #about .profile-title {
        font-size: 0.9rem;
    }
}

/* ロゴの表示制御（Aboutセクション） */
body.dark-theme #about .profile-name .dark-theme-logo,
body.light-theme #about .profile-name .light-theme-logo {
    opacity: 1;
}

body.dark-theme #about .profile-name .light-theme-logo,
body.light-theme #about .profile-name .dark-theme-logo {
    opacity: 0;
}

#about p {
    font-size: 0.95rem;
    line-height: 2;
    margin-bottom: 20px;
}

#about .logo-meaning {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
}

body.dark-theme #about .logo-meaning {
    border-top: 1px solid rgba(255, 255, 255, 0.4);
}

/* Works セクション全体 */
#works {
    width: 100%;
    padding: 40px 0 0; /* 上部のパディングのみ残し、下部は削除 */
}

/* Works コンテナ */
.works-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0; /* inline-blockの隙間を解消 */
}

/* Worksセクションのグリッドコンテナ */
.works-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 0; /* 行間の余白を削除 */
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .works-grid {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .works-grid {
        width: 80%;
    }
}

@media (max-width: 480px) {
    .works-grid {
        width: 70%;
    }
}

/* 々の作品アイテム */
.works-item {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    font-size: 0; /* inline-blockの隙間を解消 */
    line-height: 0; /* 行間の余白を削除 */
}

.works-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: block; /* 画像下部の余白を削除 */
}

/* Contact セクションのスタイル */
#contact {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* SNSアイコン */
.social-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
}

.social-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    position: relative;
}

.social-icon:hover {
    opacity: 0.7;
}

.social-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

body.dark-theme .social-icon img.light-theme-icon,
body.light-theme .social-icon img.dark-theme-icon {
    opacity: 0;
}

body.dark-theme .social-icon img.dark-theme-icon,
body.light-theme .social-icon img.light-theme-icon {
    opacity: 1;
}

/* フルスクリーン表示 */
#fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    cursor: pointer;
}

#fullscreen-overlay img {
    max-width: 85%;
    max-height: 85vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
}

.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
}

/* レスポンシブ対応 - 幅のみ調整 */
@media (max-width: 1024px) {
    .works-grid {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .works-grid {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .works-grid {
        width: 100%;
    }
}

/* 画像のドラッグ防止 */
.work-item img {
    user-select: none;
    -webkit-user-drag: none;
}

/* オーバーレイの追加 */
.work-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}

/* ホワイトモード時のロゴとハンバーガーメニューの初期表示 */
body.light-theme #logo-container .dark-theme-logo {
    opacity: 0;
}

body.light-theme #logo-container .light-theme-logo {
    opacity: 1;
}

body.light-theme #hamburger-menu {
    color: #000;
}

body.dark-theme #hamburger-menu {
    color: #fff;
}

/* メニューオーバーレイが開いているときの線の色 */
body.light-theme #menu-overlay.open ~ #overlay .hamburger-line {
    background-color: #000; /* メニューが開いているときは黒固定 */
}

/* メニュー開いているときの線の色 */
body.light-theme #hamburger-menu.active .hamburger-line {
    background-color: #000; /* ライトモード時のメニュー展開時は常に黒 */
}

body.dark-theme #hamburger-menu.active .hamburger-line {
    background-color: #fff; /* ダークモード時のメニュー展開時は常に白 */
}

/* 基本的な線の色定 */
body.dark-theme .hamburger-line {
    background-color: #fff;
}

body.light-theme .hamburger-line {
    background-color: var(--hamburger-color, #000);
}

/* メニューが開いているときの線の色（セレクタの詳細度を上げる） */
html body.light-theme #overlay #hamburger-menu.active .hamburger-line {
    background-color: #000;
}

html body.dark-theme #overlay #hamburger-menu.active .hamburger-line {
    background-color: #fff;
}

/* フルスクリーン表示時の画像 */
#fullscreen-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    #logo-container {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 768px) {
    #logo-container {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    #logo-container {
        width: 50px;
        height: 50px;
    }
    
    /* ハンバーガーメニューとの間隔整 */
    #overlay {
        padding: 15px;  /* パディングも小さく */
    }
}

/* メニューが開いているときのロゴとハンバーガーメニューの色制御を修正 */
body.light-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo,
body.dark-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

body.light-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo,
body.dark-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* メニューが開いているときのハンバーガーメニューの線の色 */
body.light-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #000;
    transition: background-color 0.3s ease;
}

body.dark-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #fff;
    transition: background-color 0.3s ease;
}

/* 通常時（テーマに従う） */
body.light-theme #overlay:not(.over-dark-section) #logo-container .light-theme-logo,
body.light-theme #overlay:not(.over-dark-section) #hamburger-menu .hamburger-line {
    opacity: 1;
}

body.light-theme #overlay:not(.over-dark-section) #logo-container .dark-theme-logo {
    opacity: 0;
}

body.dark-theme #overlay:not(.over-dark-section) #logo-container .dark-theme-logo,
body.dark-theme #overlay:not(.over-dark-section) #hamburger-menu .hamburger-line {
    opacity: 1;
}

body.dark-theme #overlay:not(.over-dark-section) #logo-container .light-theme-logo {
    opacity: 0;
}

/* 暗いセクション上（常に白） */
#overlay.over-dark-section #logo-container .dark-theme-logo {
    opacity: 1;
}

#overlay.over-dark-section #logo-container .light-theme-logo {
    opacity: 0;
}

#overlay.over-dark-section #hamburger-menu .hamburger-line {
    background-color: #fff;
}

/* メニューが開いているとき */
body.light-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #000 !important;
}

body.dark-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #fff !important;
}

/* ハンバーガーメニューの基本スタイル */
#hamburger-menu {
    cursor: pointer;
    z-index: 5;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 2px;
    margin: 6px 0;
    transition: all 0.3s ease;
}

/* ハンバーガーメニューの×印 */
#hamburger-menu.active .line1 {
    transform: translateY(8px) rotate(45deg);
}

#hamburger-menu.active .line2 {
    opacity: 0;
}

#hamburger-menu.active .line3 {
    transform: translateY(-8px) rotate(-45deg);
}

/* メニューが開いているときの色制御 */
/* ライトモード */
body.light-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #000;
}

body.light-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 1;
}

body.light-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 0;
}

/* ダークモード */
body.dark-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #fff;
}

body.dark-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 1;
}

body.dark-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 0;
}

/* メニューが閉じているときの色制御 */
/* 動画・画像上 */
#overlay.over-dark-section #hamburger-menu .hamburger-line {
    background-color: #fff;
}

#overlay.over-dark-section #logo-container .dark-theme-logo {
    opacity: 1;
}

#overlay.over-dark-section #logo-container .light-theme-logo {
    opacity: 0;
}

/* 通常時 - ライトモード */
body.light-theme #overlay:not(.over-dark-section) #hamburger-menu .hamburger-line {
    background-color: #000;
}

body.light-theme #overlay:not(.over-dark-section) #logo-container .light-theme-logo {
    opacity: 1;
}

body.light-theme #overlay:not(.over-dark-section) #logo-container .dark-theme-logo {
    opacity: 0;
}

/* 通常時 - ダークモード */
body.dark-theme #overlay:not(.over-dark-section) #hamburger-menu .hamburger-line {
    background-color: #fff;
}

body.dark-theme #overlay:not(.over-dark-section) #logo-container .dark-theme-logo {
    opacity: 1;
}

body.dark-theme #overlay:not(.over-dark-section) #logo-container .light-theme-logo {
    opacity: 0;
}

/* 1. メニューが開いているきの処理 */
/* ライトモード + メニュー開 */
body.light-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #000 !important;
}

/* ライトモード時のロゴ（黒） */
body.light-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 1 !important;
}

body.light-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 0 !important;
}

/* ダークモード + メニュー開 */
body.dark-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #fff !important;
}

/* ダークモード時のロゴ（白） */
body.dark-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 1 !important;
}

body.dark-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 0 !important;
}

/* ハンバーガーメニューの×印を確実に適用 */
#hamburger-menu.active .line1 {
    transform: translateY(8px) rotate(45deg) !important;
}

#hamburger-menu.active .line2 {
    opacity: 0 !important;
    background-color: transparent !important;
}

#hamburger-menu.active .line3 {
    transform: translateY(-8px) rotate(-45deg) !important;
}

/* 2. メニューが閉じているときの処理（既存の処理をそのまま使用） */
/* 動画・画像上 */
#overlay.over-dark-section #hamburger-menu .hamburger-line {
    background-color: #fff;
}

#overlay.over-dark-section #logo-container .dark-theme-logo {
    opacity: 1;
}

#overlay.over-dark-section #logo-container .light-theme-logo {
    opacity: 0;
}

/* 通常時 - ライトモード */
body.light-theme #overlay:not(.over-dark-section) #hamburger-menu .hamburger-line {
    background-color: #000;
}

body.light-theme #overlay:not(.over-dark-section) #logo-container .light-theme-logo {
    opacity: 1;
}

body.light-theme #overlay:not(.over-dark-section) #logo-container .dark-theme-logo {
    opacity: 0;
}

/* 通常時 - ダークモード */
body.dark-theme #overlay:not(.over-dark-section) #hamburger-menu .hamburger-line {
    background-color: #fff;
}

body.dark-theme #overlay:not(.over-dark-section) #logo-container .dark-theme-logo {
    opacity: 1;
}

body.dark-theme #overlay:not(.over-dark-section) #logo-container .light-theme-logo {
    opacity: 0;
}

/* メニューが開いているときのロゴの色制御 */
#menu-overlay.open ~ #overlay #logo-container .light-theme-logo,
#menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    transition: opacity 0.3s ease;
}

/* ライトモード時のロゴ表示 */
body.light-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 1;
}

body.light-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 0;
}

/* ダークモード時のロゴ表示 */
body.dark-theme #menu-overlay.open ~ #overlay #logo-container .dark-theme-logo {
    opacity: 1;
}

body.dark-theme #menu-overlay.open ~ #overlay #logo-container .light-theme-logo {
    opacity: 0;
}

/* メニューが開いているときのハンバーガーメニューの線の色 */
body.light-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #000;
}

body.dark-theme #menu-overlay.open ~ #overlay #hamburger-menu .hamburger-line {
    background-color: #fff;
}
