/*
Theme Name: gamtec
Description: Ultimate fix. Replaced slide-in menu with a full-screen fade-in overlay to permanently eliminate horizontal ghost scrolls. Removed all body overflow restrictions to fully restore position: sticky functionality.
Author: gamtec
Version: 7.0
*/

/* ==========================================================================
   01. Base Styles & Variables
   ========================================================================== */
   :root {
    --bg: #1c1d21;
    --surface: #26272b;
    --text: #e6e6eb;
    --muted: #a0a0b0;
    --border: #33343a;
    --accent: #6f5ae6;
    --accent2: #b7a8ff;
    --swiper-theme-color: #ffffff;
  }
  
  * { box-sizing: border-box; }
  
  /* 余計なハックはすべて削除。要素がはみ出さないクリーンな設計に依存させます */
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
  }
  
  body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.8;
  }
  
  a { color: inherit; text-decoration: none; transition: 0.3s ease; }
  a:hover { color: var(--accent2); }
  
  /* ==========================================================================
     02. Header & Global Navigation & Controls
     ========================================================================== */
  .site-header {
    position: sticky; 
    top: 0; 
    z-index: 900; 
    background: rgba(28, 29, 33, 0.95); 
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  
  .site-header__inner {
    max-width: 1120px; margin: 0 auto; padding: 16px 20px;
    display: flex; justify-content: space-between; align-items: center;
  }
  
  .site-brand a { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.01em; }
  
  .header-controls { display: flex; align-items: center; gap: 30px; }
  .global-nav__list { list-style: none; display: flex; gap: 32px; margin: 0; padding: 0; }
  .global-nav__list a { font-size: 0.95rem; font-weight: 700; }
  
  .hamburger { display: none; }
  
  /* ==========================================================================
     03. Text-Based BGM Player & Marquee
     ========================================================================== */
  .bgm-player {
    display: flex; align-items: center; gap: 12px;
    background: rgba(0, 0, 0, 0.4); padding: 6px 16px; border-radius: 6px;
    border: 1px solid var(--border); backdrop-filter: blur(5px);
  }
  .bgm-player__info { display: flex; align-items: center; gap: 8px; width: 160px; min-width: 0; }
  .bgm-player__icon { font-size: 0.7rem; font-weight: 800; color: var(--muted); letter-spacing: 0.05em; flex-shrink: 0; }
  .bgm-marquee { flex: 1; overflow: hidden; white-space: nowrap; position: relative; min-width: 0; }
  .bgm-player__title {
    display: inline-block; font-size: 0.75rem; color: var(--accent2);
    font-family: monospace; padding-left: 100%;
    animation: marquee 8s linear infinite;
  }
  @keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
  .bgm-player__buttons { display: flex; gap: 12px; align-items: center; border-left: 1px solid var(--border); padding-left: 12px; flex-shrink: 0; }
  .bgm-btn {
    background: none; border: none; color: var(--text); cursor: pointer;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; padding: 0;
    display: flex; align-items: center; justify-content: center; transition: 0.3s ease;
  }
  .bgm-btn:hover { color: var(--accent); }
  
  /* ==========================================================================
     04. Top Page Hero Slider
     ========================================================================== */
  .hero-slider { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
  @media (min-width: 769px) { .hero-slider { width: calc(100% - 40px); max-width: 1280px; margin: 24px auto 0; border-radius: 24px; aspect-ratio: 21 / 9; height: auto; min-height: auto; } }
  .swiper { width: 100%; height: 100%; }
  .swiper-slide img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.6); display: block; }
  .hero-slider__overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; z-index: 10; pointer-events: none; }
  .hero-slider__title { color: #ffffff; font-size: clamp(1.5rem, 7vw, 4.5rem); font-weight: 800; text-align: center; margin: 0; }
  
  /* ==========================================================================
     05. Home Content & Alternating Sections
     ========================================================================== */
  .home-content { padding: 40px 0 80px; }
  .home-section { padding: 60px 20px; }
  .home-section__inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 60px; }
  @media (min-width: 769px) { .home-section.is-left .home-section__inner { flex-direction: row; } .home-section.is-right .home-section__inner { flex-direction: row-reverse; } }
  .home-section__body { flex: 1; }
  .home-section__title { font-size: 2.2rem; margin: 0 0 20px; color: var(--accent2); }
  .home-section__text { font-size: 1.1rem; color: var(--text); margin-bottom: 32px; }
  .home-link { display: inline-block; color: var(--accent); font-weight: 700; border-bottom: 2px solid transparent; padding-bottom: 4px; }
  .home-link:hover { border-bottom-color: var(--accent); }
  .home-section__figure { flex: 1; margin: 0; display: flex; flex-direction: column; gap: 16px; }
  .home-section__visual { width: 100%; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--surface), var(--border)); border-radius: 24px; overflow: hidden; }
  .home-section__visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .home-section__caption { text-align: center; font-size: 0.85rem; color: var(--muted); line-height: 1.4; padding: 0 10px; }
  .home-section:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
  
  /* ==========================================================================
     06. Projects Page
     ========================================================================== */
  .projects-page { padding-bottom: 100px; }
  .page-header { padding: 100px 0 60px; text-align: center; background: linear-gradient(180deg, rgba(111,90,230,0.05) 0%, transparent 100%); }
  .page-title { font-size: 3.5rem; margin: 0 0 16px; color: var(--accent2); }
  .page-lead { color: var(--muted); font-size: 1.2rem; }
  .project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; margin-top: 50px; }
  .project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 30px; cursor: pointer; transition: 0.3s ease; display: flex; flex-direction: column; justify-content: space-between; }
  .project-card:hover { border-color: var(--accent); transform: translateY(-5px); background: #2d2e33; }
  .project-card__status { font-size: 0.75rem; font-weight: 800; color: var(--accent2); text-transform: uppercase; margin-bottom: 8px; display: inline-block; }
  .project-card__title { font-size: 1.4rem; margin: 10px 0 15px; }
  .project-card__excerpt { font-size: 0.95rem; color: var(--muted); line-height: 1.6; }
  
  /* ==========================================================================
     07. Members Page
     ========================================================================== */
  .member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px; margin-top: 40px; }
  .member-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; height: 100%; cursor: pointer; transition: transform 0.3s ease, border-color 0.3s ease; }
  .member-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
  .member-card__visual { position: relative; width: 100%; background: #111; flex-shrink: 0; }
  .member-card__visual::before { content: ""; display: block; padding-top: 100%; }
  .member-card__visual img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
  .member-card__content { padding: 24px 15px; flex: 1; display: flex; flex-direction: column; justify-content: flex-start; text-align: center; }
  .member-card__title { font-size: 1.5rem; margin: 0 0 8px 0; color: #fff; }
  .member-card__excerpt { font-size: 0.85rem; color: var(--muted); margin: 0; }
  
  /* ==========================================================================
     08. Blog Page & Single Post
     ========================================================================== */
  .post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }
  .post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; transition: transform 0.3s ease, border-color 0.3s ease; display: flex; flex-direction: column; }
  .post-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
  .post-card__link { display: flex; flex-direction: column; height: 100%; }
  .post-card__visual { width: 100%; aspect-ratio: 16 / 9; background: #111; overflow: hidden; }
  .post-card__visual img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; display: block; }
  .post-card:hover .post-card__visual img { transform: scale(1.05); }
  .post-card__placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, var(--surface), var(--border)); }
  .post-card__content { padding: 24px; flex: 1; display: flex; flex-direction: column; }
  .post-card__meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .post-card__date { font-size: 0.85rem; color: var(--muted); font-family: monospace; }
  .post-card__cat { background: rgba(111, 90, 230, 0.15); color: var(--accent2); padding: 4px 10px; border-radius: 20px; font-weight: 700; font-size: 0.75rem; }
  .post-card__title { font-size: 1.4rem; margin: 0 0 12px 0; color: #fff; line-height: 1.5; }
  .post-card__excerpt { font-size: 0.95rem; color: var(--text); line-height: 1.6; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  
  .pagination { margin-top: 60px; display: flex; justify-content: center; gap: 10px; }
  .pagination a, .pagination span { padding: 10px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: bold; transition: 0.3s ease; }
  .pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
  .pagination a:hover { background: var(--border); color: var(--accent2); }
  
  .post-container { max-width: 900px; margin: 0 auto; padding: 40px 20px 100px; }
  .post-hero { position: relative; background-color: var(--surface); background-size: cover; background-position: center; border-radius: 24px; overflow: hidden; margin-bottom: 40px; min-height: 400px; display: flex; align-items: flex-end; }
  .post-hero::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.1) 100%); z-index: 1; }
  .post-hero__inner { position: relative; z-index: 2; padding: 50px; width: 100%; }
  .post-hero__title { font-size: clamp(2rem, 5vw, 3.5rem); color: #fff; margin: 0 0 20px 0; line-height: 1.3; }
  .post-hero__meta { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 1rem; }
  .post-hero__author { color: var(--accent2); font-weight: 700; }
  .post-body { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 50px; }
  .post-content { font-size: 1.1rem; line-height: 2; color: var(--text); }
  .post-content h2 { font-size: 1.8rem; color: var(--accent2); margin: 2em 0 1em; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .post-content h3 { font-size: 1.4rem; color: #fff; margin: 1.5em 0 0.8em; }
  .post-content p { margin-bottom: 1.5em; }
  .post-content img { max-width: 100%; height: auto; border-radius: 12px; margin: 1.5em 0; }
  .post-content pre { background: #111; padding: 20px; border-radius: 12px; overflow-x: auto; margin: 1.5em 0; border: 1px solid var(--border); }
  .post-content code { font-family: monospace; background: #111; padding: 2px 6px; border-radius: 4px; color: var(--accent2); }
  .post-content blockquote { border-left: 4px solid var(--accent); padding: 15px 20px; margin: 1.5em 0; color: var(--muted); font-style: italic; background: rgba(255,255,255,0.02); border-radius: 0 12px 12px 0; }
  
  /* ==========================================================================
     09. Modal Overlay
     ========================================================================== */
  .modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: none; justify-content: center; align-items: center; z-index: 1000; padding: 20px; backdrop-filter: blur(8px); }
  .modal.is-active { display: flex; }
  .modal__content { background: var(--surface); max-width: 800px; width: 100%; max-height: 90vh; border-radius: 24px; padding: 50px; position: relative; overflow-y: auto; border: 1px solid var(--border); }
  .modal__close { position: absolute; top: 20px; right: 20px; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; }
  .modal__title { font-size: 2.2rem; color: var(--accent2); margin-bottom: 30px; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
  .modal-section { margin-bottom: 30px; }
  .modal-section__heading { font-size: 1.2rem; color: var(--accent2); margin: 0 0 12px 0; border-left: 4px solid var(--accent); padding-left: 12px; font-weight: 700; }
  .modal-section__heading-sub { font-size: 1rem; color: var(--muted); margin: 0 0 12px 0; font-weight: 700; }
  .modal-section__text { margin: 0; font-size: 1rem; line-height: 1.8; color: var(--text); }
  .modal-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }
  .modal-meta-item { display: flex; flex-direction: column; gap: 4px; }
  .modal-meta-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
  .modal-meta-value { font-size: 1rem; color: var(--text); }
  .modal-tags { display: flex; gap: 10px; flex-wrap: wrap; }
  .tag { color: var(--muted); font-family: monospace; font-size: 0.9rem; }
  
  .modal-member-profile { display: flex; gap: 24px; align-items: center; margin-bottom: 30px; border-bottom: 1px solid var(--border); padding-bottom: 20px; text-align: left; }
  .modal-member-profile__vis { flex: 0 0 80px; width: 80px; height: 80px; border-radius: 12px; overflow: hidden; background: #111; }
  .modal-member-profile__vis img { width: 100%; height: 100%; object-fit: cover; }
  .modal-member-profile__txt h2 { margin: 0; font-size: 2.2rem; color: #fff; font-weight: 800; line-height: 1.2; }
  
  /* ==========================================================================
     10. Global Responsive Design (Mobile Setup)
     ========================================================================== */
  @media (max-width: 768px) {
    /* ヘッダー1行化＆Flexbox */
    .site-header__inner {
      flex-direction: row; 
      align-items: center;
      flex-wrap: nowrap;
      gap: 15px;
      padding: 10px 15px;
    }
    
    .site-brand {
      width: auto;
      flex: 1; /* 余白をロゴが吸収 */
      min-width: 0;
    }
    .site-brand a {
      display: block;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 1.1rem;
    }
    
    .header-controls {
      width: auto;
      display: flex;
      flex-direction: row; 
      align-items: center;
      gap: 12px;
    }
  
    /* プレイヤーとハンバーガー */
    .bgm-player {
      order: 1;
      width: auto;
      max-width: 200px; /* 長すぎる場合は制限 */
      display: inline-flex;
      padding: 4px 8px;
      gap: 6px;
      flex-shrink: 0;
    }
    .bgm-player__info { 
      flex: 1;
      min-width: 0;
    }
    .bgm-player__icon { display: none; }
    .bgm-btn { font-size: 0.65rem; }
  
    .hamburger {
      order: 2;
      display: block; 
      background: none; border: none; width: 32px; height: 32px;
      position: relative;
      z-index: 110; cursor: pointer; padding: 0;
      flex-shrink: 0;
    }
    .hamburger span {
      position: absolute; left: 4px; width: 24px; height: 2px;
      background: #fff; transition: 0.3s ease;
    }
    .hamburger span:nth-child(1) { top: 8px; }
    .hamburger span:nth-child(2) { top: 15px; }
    .hamburger span:nth-child(3) { top: 22px; }
    .hamburger.is-active span:nth-child(1) { top: 15px; transform: rotate(45deg); }
    .hamburger.is-active span:nth-child(2) { opacity: 0; }
    .hamburger.is-active span:nth-child(3) { top: 15px; transform: rotate(-45deg); }
  
    /* ▼ 【完全解決】フルスクリーン・フェードインメニュー ▼ */
    /* transformなどで要素を画面外に置くのを一切やめ、全画面を覆う形に変更 */
    .global-nav {
      position: fixed; 
      top: 0; 
      left: 0; 
      width: 100%; 
      height: 100vh;
      background: rgba(28, 29, 33, 0.98); 
      backdrop-filter: blur(10px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 105;
      
      visibility: hidden;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .global-nav.is-active { 
      visibility: visible;
      opacity: 1;
      pointer-events: auto;
    }
    
    .global-nav__list { 
      flex-direction: column; 
      gap: 35px; 
      text-align: center;
    }
    .global-nav__list a { font-size: 1.5rem; }
  
    /* Modal & Content Fixes */
    .modal__content { padding: 24px 20px; max-height: 80vh; border-radius: 16px; }
    .modal-member-profile { flex-direction: column; text-align: center; gap: 16px; }
    .modal-member-profile__txt h2 { font-size: 1.6rem; }
    .modal__title { font-size: 1.6rem; margin-bottom: 20px; }
    
    .home-section__inner { flex-direction: column !important; gap: 30px; }
    .project-grid, .post-grid { grid-template-columns: 1fr; }
    .member-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .post-hero { min-height: 280px; padding: 20px; border-radius: 16px; }
    .post-hero__inner { padding: 20px; }
    .post-body { padding: 30px 20px; border-radius: 16px; }
  }