/**
 * Member Detail Overlay Styles
 * メンバー詳細オーバーレイのスタイル
 * 
 * レイアウト構成:
 * PC: リンク（左下）→ 立ち絵（中央）→ プロフィール（右）
 * スマホ: 立ち絵（上）→ リンク（中央横並び）→ プロフィール（下）
 */

/* ========================================
   オーバーレイコンテナ
   ======================================== */

.member-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  background: white;
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  font-weight: 700;
}

.member-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ========================================
   背景画像
   ======================================== */

.member-overlay-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: left top;
  background-repeat: no-repeat;
  z-index: 1;
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.member-overlay.active .member-overlay-background {
  opacity: 1;
  transform: translateX(0);
}

/* ========================================
   テーマカラーリボン（左上）
   ======================================== */

.member-theme-ribbon {
  position: absolute;
  top: 150px;
  left: -290px;
  width: 1200px;
  height: 131px;
  background: #ffffff;
  transform-origin: top left;
  transform: rotate(-15deg) translate(-50px, 0);
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 200px;
  padding-right: 200px;
  /* 初期状態: 左側に隠れている */
  opacity: 0;
  transform: rotate(-15deg) translate(-2000px, 0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* アクティブ時: リボンがスライドイン */
.member-overlay.active .member-theme-ribbon {
  opacity: 1;
  transform: rotate(-15deg) translate(-50px, 0);
  transition-delay: 0.3s;
}

.member-ribbon-text {
  font-size: 62px;
  font-weight: 700;
  color: #f7f9fb;
  text-transform: uppercase;
  letter-spacing: 2px;
  /* 初期状態: 透明 */
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* アクティブ時: 文字がフェードイン（リボンの後） */
.member-overlay.active .member-ribbon-text {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.9s;
}

/* ========================================
   コンテンツエリア
   ======================================== */

.member-overlay-content {
  position: relative;
  z-index: 50;
  padding: 0;
  color: white;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  box-sizing: border-box;
}

/* ========================================
   3カラムレイアウト（PC）
   合計: 5vw + 30vw + 55vw = 90vw
   ======================================== */

.member-content-wrapper {
  display: flex;
  gap: 60px;
  width: 100%;
  height: 100%;
  align-items: stretch;
  padding: 30px;
  box-sizing: border-box;
  overflow: hidden;
}

/* リンクセクション（左下配置） */
.member-section-links {
  order: 1;
  flex: 0 0 auto;
  width: 5vw;
  min-width: 5vw;
  max-width: 5vw;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  align-self: flex-end;
}

/* 立ち絵セクション（中央配置） */
.member-section-image {
  order: 2;
  flex: 0 0 auto;
  width: 30vw;
  min-width: 30vw;
  max-width: 30vw;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.member-main-image {
  max-width: none;
  max-height: 95dvh;
  width: auto;
  height: 95dvh;
  object-fit: cover;
}

/* プロフィールセクション（右側、画面いっぱい） */
.member-section-profile {
  order: 3;
  flex: 0 0 auto;
  width: 55vw;
  min-width: 55vw;
  max-width: 55vw;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* プロフィールラッパー（アスペクト比維持: 1:1.04） */
.member-profile-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
}

/* 背景画像用div（右上と左下に分割） */
.member-profile-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* 右上のフレーム */
.member-profile-background::before {
  content: '';
  position: absolute;
  top: -20px;
  right: 24px;
  width: 50%;
  aspect-ratio: 1 / 1;
  background-image: url('/img/member_frame_right.png');
  background-size: contain;
  background-position: top right;
  background-repeat: no-repeat;
}

/* 左下のフレーム */
.member-profile-background::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 24px;
  width: 50%;
  aspect-ratio: 1 / 1;
  background-image: url('/img/member_frame_left.png');
  background-size: contain;
  background-position: bottom left;
  background-repeat: no-repeat;
}

/* プロフィールスクロールエリア */
.member-profile-scroll {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 140px 60px 140px;
  box-sizing: border-box;
  z-index: 2;
  /* スクロールバーを非表示 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  /* 上下にフェードマスク */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 50px,
    black calc(100% - 50px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 50px,
    black calc(100% - 50px),
    transparent 100%
  );
}

/* Webkit系ブラウザ（Chrome, Safari）のスクロールバーを非表示 */
.member-profile-scroll::-webkit-scrollbar {
  display: none;
}

/* ========================================
   閉じるボタン
   ======================================== */

.member-overlay-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: #202023;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-overlay-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.member-overlay-close:active {
  transform: scale(0.95);
}

/* ========================================
   プロフィール内容
   ======================================== */

/* ロゴバナー（中央上配置） */
.member-logo {
  text-align: center;
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.member-logo-image {
  max-width: 450px;
  width: 100%;
  height: auto;
}

/* モバイル用ロゴ（デフォルトで非表示） */
.member-logo-mobile {
  display: none;
}

/* モバイル用フレーム画像（デフォルトで非表示） */
.member-frame-mobile-right,
.member-frame-mobile-left {
  display: none;
}

/* メンバー情報 */
.member-info {
  padding-top:0px !important;
  margin-bottom: 0;
}

.member-description {
  font-size: 1.3rem;
  line-height: 2.0 !important;
  color: #202023;
  white-space: pre-wrap;
  margin: 0;
  padding: 0;
}

.member-description p:last-child {
  margin-bottom: 20px;
}

.member-description p:first-child {
  margin-top: 20px;
}

/* 代表作セクション（TOPカテゴリ内） */
.masterpiece-section {
  margin: 0;
  padding: 0;
  white-space: normal;
}

.masterpiece-label {
  font-weight: 700;
  color: #202023;
  margin-bottom: 12px;
  font-size: 1.3rem;
}

/* プロフィール項目 */
.member-profile-items {
  margin-bottom: 40px;
  padding-left: 24px;
  padding-right: 24px;
}

/* プロフィールセクション見出し */
.profile-section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #202023;
  margin-top: 40px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.profile-section-title:first-child {
  margin-top: 0;
}

.profile-item {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  background-image: url('/img/profile_line.png');
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% auto;
}

.profile-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.profile-label {
  font-weight: 700;
  color: #202023;
  min-width: 220px;
  max-width: 220px;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.profile-value {
  flex: 1;
  color: #202023;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* YouTube埋め込み用スタイル */
.profile-item-youtube {
  display: block;
}

.profile-value-youtube {
  width: 100%;
}

.youtube-embed-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  margin-top: 4px;
}

.youtube-embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  overflow: hidden;
}

/* ========================================
   リンク一覧
   ======================================== */

.member-links {
  margin-bottom: 40px;
}

.member-links-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-links-list li {
  margin: 0;
}

.member-links-list a {
  display: block;
  transition: transform 0.2s;
}

.member-links-list a:hover {
  transform: scale(1.1);
}

.link-icon {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

/* ========================================
   ポートフォリオ一覧
   ======================================== */

.member-portfolio {
  margin-bottom: 40px;
  padding-left: 24px;
  padding-right: 24px;
}

.member-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.portfolio-item {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s;
}

/* 拡大表示: 2列分を使用 */
.portfolio-item-large {
  grid-column: span 2;
}

.portfolio-item:hover {
  transform: scale(1.05);
}

.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* YouTube埋め込み用スタイル */
.portfolio-item-video {
  aspect-ratio: 16 / 9;
}

.portfolio-item-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ========================================
   レスポンシブ対応: スマホ（767px以下）
   ======================================== */

@media (max-width: 767px) {
  /* オーバーレイを全画面表示 */
  .member-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center center !important;
  }
  
  /* コンテンツを縦スクロール可能に */
  .member-overlay-content {
    width: 100% !important;
    height: calc(100% - 160px) !important;
    margin-top: 130px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 20px 0 40px !important;
    -webkit-overflow-scrolling: touch !important;
    /* 上下にフェードマスク */
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      black 50px,
      black calc(100% - 20px),
      transparent 100%
    ) !important;
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      black 50px,
      black calc(100% - 20px),
      transparent 100%
    ) !important;
  }
  
  /* 縦並びレイアウトに変更 */
  .member-content-wrapper {
    flex-direction: column !important;
    gap: 32px !important;
    min-height: auto !important;
    align-items: center !important;
    padding: 0 50px !important;
    height: auto !important;
  }
  
  /* 閉じるボタンを右上に配置（48px × 48px） */
  .member-overlay-close {
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 28px !important;
    z-index: 2001 !important;
  }
  
  /* テーマカラーリボンを表示（モバイル用に調整） */
  .member-theme-ribbon {
    display: flex !important;
    top: 100px !important;
    left: -200px !important;
    width: 800px !important;
    height: 60px !important;
    padding-left: 100px !important;
    padding-right: 100px !important;
  }
  
  .member-ribbon-text {
    font-size: 28px !important;
  }
  
  /* 背景画像を非表示（モバイル用は.member-overlayに直接適用） */
  .member-overlay-background {
    display: none !important;
  }
  
  /* 立ち絵セクション（上部） */
  .member-section-image {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    align-self: auto !important;
    position: relative !important;
    margin-top: 25px !important;
    overflow: visible !important;
  }
  
  .member-main-image {
    max-width: none !important;
    max-height: 75vh !important;
    width: auto !important;
    height: 75vh !important;
    object-fit: cover !important;
  }
  
  /* モバイル用フレーム画像（右上） */
  .member-frame-mobile-right {
    display: block !important;
    position: fixed !important;
    top: 120px !important;
    right: 10px !important;
    width: 40vw !important;
    height: 40vw !important;
    background-image: url('/img/sumaho_creator_frame_right.png') !important;
    background-size: contain !important;
    background-position: top right !important;
    background-repeat: no-repeat !important;
    z-index: 90 !important;
    pointer-events: none !important;
  }
  
  /* モバイル用フレーム画像（左下） */
  .member-frame-mobile-left {
    display: block !important;
    position: fixed !important;
    bottom: 20px !important;
    left: 10px !important;
    width: 40vw !important;
    height: 40vw !important;
    background-image: url('/img/sumaho_creator_frame_left.png') !important;
    background-size: contain !important;
    background-position: bottom left !important;
    background-repeat: no-repeat !important;
    z-index: 90 !important;
    pointer-events: none !important;
  }
  
  /* モバイル用ロゴをリボンの下、左上に配置 */
  .member-logo-mobile {
    display: block !important;
    position: absolute !important;
    top: 100px !important;
    left: 24px !important;
    z-index: 100 !important;
    text-align: left !important;
  }
  
  .member-logo-image-mobile {
    max-width: 250px !important;
    width: 100% !important;
    height: auto !important;
  }
  
  /* PC用ロゴを非表示 */
  .member-logo-pc {
    display: none !important;
  }
  
  /* リンクセクション（モバイル: ポートフォリオの下、スクロール内） */
  .member-section-links {
    order: 4 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    align-self: auto !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    z-index: auto !important;
    margin-top: 0 !important;
    margin-bottom: 20px !important;
  }
  
  .member-links {
    margin-bottom: 0 !important;
  }
  
  .member-links-list {
    flex-direction: row !important;
    justify-content: center !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
  }
  
  .link-icon {
    width: 64px !important;
    height: 64px !important;
  }
  
  /* プロフィールセクション（下部、全幅） */
  .member-section-profile {
    order: 3 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    align-self: auto !important;
  }
  
  /* プロフィールラッパー（高さ自動） */
  .member-profile-wrapper {
    width: 100% !important;
    height: auto !important;
    position: relative !important;
  }
  
  /* 背景フレームを非表示 */
  .member-profile-background::before,
  .member-profile-background::after {
    display: none !important;
  }
  
  /* プロフィールスクロールエリア（通常フロー） */
  .member-profile-scroll {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    padding: 20px 0 !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }
  
  /* ロゴバナー */
  .member-logo-image {
    max-width: 300px !important;
  }
  
  /* プロフィール項目 */
  .member-profile-items {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  .profile-section-title {
    font-size: 1.5rem !important;
    margin-top: 32px !important;
    margin-bottom: 20px !important;
  }
  
  .profile-item {
    flex-direction: column !important;
    gap: 8px !important;
  }
  
  .profile-label {
    min-width: auto !important;
    max-width: none !important;
    font-size: 1rem !important;
  }
  
  .profile-value {
    font-size: 1rem !important;
  }
  
  /* メンバー情報 */
  .member-info {
    padding: 0px !important;
  }
  
  .member-description {
    font-size: 1rem !important;
    line-height: 1.8 !important;
  }
  
  .masterpiece-label {
    font-size: 1rem !important;
  }
  
  /* ポートフォリオ */
  .member-portfolio {
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-bottom: 20px !important;
  }
  
  .member-portfolio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  
  /* 拡大表示も2列分を使用 */
  .portfolio-item-large {
    grid-column: span 2 !important;
  }
}

/* ========================================
   レスポンシブ対応: タブレット（768px〜1024px）
   ======================================== */

@media (min-width: 768px) and (max-width: 1024px) {
  .member-content-wrapper {
    gap: 40px;
  }
  
  .member-section-links {
    flex: 0 0 10%;
    min-width: 70px;
    max-width: 100px;
  }
  
  .member-section-image {
    flex: 0 0 450px;
  }
  
  .member-overlay-content {
    padding: 30px;
  }
  
  .member-description {
    font-size: 1rem;
  }
  
  .member-portfolio-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}


/* ========================================
   画像ポップアップオーバーレイ
   ======================================== */

.image-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-popup-overlay.active {
  opacity: 1;
}

.image-popup-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-popup-close:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
  transform: rotate(90deg);
}

.image-popup-content {
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-popup-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

@media (max-width: 767px) {
  .image-popup-close {
    width: 48px;
    height: 48px;
    font-size: 28px;
    top: 10px;
    right: 10px;
  }
  
  .image-popup-content {
    max-width: 95%;
    max-height: 95%;
  }
}
