/* =========================
   下層ページ共通レイアウト
   About・プロジェクト詳細で共通のスタイルをまとめて定義する。
   class名はページごとの名前のまま、複数セレクタでまとめて当てる。
========================= */

/* 共通コンテナ（1100px + 左右padding 16px / SP 20px）。
   背景装飾は .deco-wrapper（css/decor.css）に分離したので、ここには無い */
.about-inner,
.project-detail-inner {
  position: relative;
  width: 100%;
  max-width: calc(1100px + 32px);
  margin: 0 auto;
  padding: 0 16px;

  @media (max-width: 768px) {
    padding: 0 20px;
  }
}

/* メンバー写真（丸/四角）。ホバーで拡大する */
.about-member-photo-wrap,
.project-member-photo-wrap {
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 10px;

  @media (max-width: 768px) {
    width: 214px;
    margin: 0 auto;
  }
}

.about-member-photo,
.project-member-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.about-member:hover .about-member-photo,
.project-member-card:hover .project-member-photo {
  transform: scale(1.08);
}

/* メンバー一覧グリッドの768px縦積みは、about.css/project-detail.cssそれぞれの
   960px側ルール（同じファイル内で後勝ちさせる必要がある）と同じセレクタの
   詳細度になるため、ここに共通化すると別ファイル＝読み込み順の関係で負けて
   しまう。そのためこの部分だけは各ページのCSSファイル側に残している。 */

/* メンバーカード全体がクリック可能（ボタン）。他のリンク画像と同じくhoverで写真を拡大 */
.about-member-card,
.project-member-card {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.about-member-card:focus-visible,
.project-member-card:focus-visible {
  outline: 2px solid var(--color-pink);
  outline-offset: 4px;
}

/* =========================
   メンバー紹介ポップアップ
   About・プロジェクト詳細で共通。
   幅520pxのモーダル基準。閉じるボタンは常時表示の
   別要素にして、中身(.member-popup-scroll)だけスクロールさせる
========================= */
.member-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 17, 17, 0.6);

  @media (max-width: 600px) {
    padding: 20px;
  }
}

.member-popup-overlay[hidden] {
  display: none;
}

body.has-member-popup {
  overflow: hidden;
}

.member-popup {
  position: relative;
  width: 520px;
  max-width: 100%;
  max-height: 88vh;
  background: var(--color-white);
  border-radius: 16px;
  overflow: hidden;

  @media (max-width: 600px) {
    width: 100%;
  }
}

.member-popup-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  color: #999999;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.member-popup-close:hover,
.member-popup-close:focus-visible {
  color: var(--color-text);
}

.member-popup-close:focus-visible {
  outline: 2px solid var(--color-pink);
  outline-offset: 2px;
  border-radius: 2px;
}

.member-popup-close svg {
  width: 32px;
  height: 32px;
}

.member-popup-scroll {
  max-height: 88vh;
  padding: 92px 20px 48px 20px;
  overflow-y: auto;
  /* 端までスクロールしても背景のページへ連動させない */
  overscroll-behavior: contain;
  font-family: var(--font-jp);
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-text);
  /* スクロールバーはpaddingの中に収まるようこの要素自身に持たせる
     （外側の.member-popupに置くと、paddingとは別にスクロールバー分
     余計に幅を取ってしまい、左右非対称に見える）。
     さらにバー自体も細く・トラック(背景)は枠線なしのシンプルな見た目にする */
  scrollbar-width: thin; /* Firefox: バーの色 背景の色 */
  scrollbar-color: #cccccc transparent;

  @media (max-width: 600px) {
    max-height: 92vh;
  }
}

.member-popup-scroll::-webkit-scrollbar {
  width: 6px;
}

.member-popup-scroll::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}

.member-popup-scroll::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 999px;
}

.member-popup-scroll > * {
  margin: 0;
}

.member-popup-scroll > * + * {
  margin-top: 32px;
}

.member-popup-scroll > :first-child {
  margin-top: 0;
}

.member-popup-image img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

.member-popup-quote {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

.member-popup-role {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-popup-role-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.member-popup-role-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-popup-role-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.member-popup-role-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

/* 本文(紹介文・変遷・仕事内容・Q&A)。ブロックエディタの出力(inc/member-blocks.php)
   段落=説明文 / 見出し3=見出しラベル / グループ(is-style-member-timeline)=変遷の項目 / 画像 / 詳細(details)=Q&A */
.member-popup-body {
  margin-top: 16px;
}

.member-popup-body > * {
  margin: 0;
}

.member-popup-body > * + * {
  margin-top: 32px;
}

.member-popup-body > h3 + * {
  margin-top: 16px;
}

.member-popup-body > p {
  color: #858585;
  font-size: 11px;
  line-height: 1.5;
}

/* 見出し（変遷など／仕事内容など）。本文見出しの.entry-content h2より一段小さい簡易ラベル */
.member-popup-body > h3 {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: #858585;
}

.member-popup-body > .wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* 変遷の項目: 見出し4(丸+見出し)と段落(縦線つきの内容) */
.member-popup-body > .is-style-member-timeline + .is-style-member-timeline {
  margin-top: 8px;
}

.member-popup-body .is-style-member-timeline > h4 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  color: var(--color-text);
}

.member-popup-body .is-style-member-timeline > h4::before {
  content: "";
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #cbcbcb;
}

.member-popup-body .is-style-member-timeline > p {
  margin: 8px 0 0 5px;
  padding: 12px 0 12px 24px;
  border-left: 1px solid #cbcbcb;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
}

/* Q&A: 詳細ブロック(常に開いた状態)。質問=summary、回答=中の段落 */
.member-popup-body > .wp-block-details + .wp-block-details {
  margin-top: 40px;
}

.member-popup-body .wp-block-details > summary,
.member-popup-body .wp-block-details > p {
  position: relative;
  margin: 0;
  padding-left: 52px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text);
}

.member-popup-body .wp-block-details > summary {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px; /* ラベル(Q.)の高さ分 */
  padding-left: 0;
  list-style: none;
  cursor: default;
}

.member-popup-body .wp-block-details > summary .member-qa-text,
.member-popup-body .wp-block-details > p:first-of-type .member-qa-text {
  flex: 1;
  min-width: 0;
}

.member-popup-body .wp-block-details > summary::-webkit-details-marker {
  display: none;
}

.member-popup-body .wp-block-details > p {
  margin-top: 16px;
  padding-block: 6px;
  padding-left: 52px;
}

.member-popup-body .wp-block-details > p:first-of-type {
  display: flex;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
  min-height: 60px; /* ラベル(A.)の高さ + 上下の余白 */
  padding-left: 0;
}

.member-popup-body .wp-block-details > p + p {
  margin-top: 8px;
}

.member-popup-body .wp-block-details > summary::before,
.member-popup-body .wp-block-details > p:first-of-type::before {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-family: var(--font-en);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.5;
  color: #858585;
}

.member-popup-body .wp-block-details > summary::before {
  content: "Q.";
  position: static;
  flex-grow: 0;
  flex-shrink: 0;
}

.member-popup-body .wp-block-details > p:first-of-type::before {
  content: "A.";
  position: static;
  flex-grow: 0;
  flex-shrink: 0;
}

/* ページネーションのドット（3つ縦積み）。.donate-more と同じ考え方 */
.member-popup-dots {
  position: relative;
  width: 12px;
  height: 52px;
  margin-inline: auto;
  background: radial-gradient(circle, #cccccc 6px, transparent 6px) center / 12px 12px no-repeat;
}

.member-popup-dots::before,
.member-popup-dots::after {
  content: "";
  position: absolute;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cccccc;
}

.member-popup-dots::before {
  top: 0;
}

.member-popup-dots::after {
  bottom: 0;
}
