/* ================================================
   カスタムプロパティ
   ================================================ */
:root {
  --header-height-sp: 60px;
  --header-height-pc: 72px;

  /* FABボタン */
  --fab-size: 56px;
  --fab-offset: 24px; /* 右下からのオフセット */
  --fab-bg: #1a1a1a;
  --fab-bg-active: #1a1a1a;

  /* 展開背景 */
  --expand-bg: #1a1a1a;
  --expand-transition-bg: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --expand-transition-nav: 0.4s ease;
  --expand-item-delay: 0.08s;

  /* ===== z-index 階層管理 ===== */
  --z-header:     20; /* ヘッダー背景 */
  --z-overlay:    30; /* 展開背景（オーバーレイとして機能） */
  --z-drawer:     40; /* 展開ナビゲーション */
  --z-floating:   50; /* FABボタン（常に最前面） */
}

/* ================================================
   c-header: ヘッダー全体
   ================================================ */
.c-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.c-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: calc(1200px + 20px * 2);
  margin-inline: auto;
  padding-inline: 20px;
  height: var(--header-height-sp);
}

@media (min-width: 768px) {
  .c-header__inner {
    padding-inline: 40px;
    height: var(--header-height-pc);
  }
}

.c-header__logo {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  text-decoration: none;
  letter-spacing: 0.05em;
}

@media (min-width: 768px) {
  .c-header__logo {
    font-size: 24px;
  }
}

/* ================================================
   c-nav: PCナビゲーション（横並び）
   ================================================ */
.c-nav {
  /* モバイル: 非表示 */
  display: none;
}

@media (min-width: 768px) {
  /* PC: 常に表示（横並び） */
  .c-nav {
    display: block;
  }
}

.c-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 768px) {
  .c-nav__list {
    display: flex;
    gap: 32px;
  }
}

.c-nav__link {
  display: block;
  padding: 0;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
}

/* マウス系デバイスかつホバー操作が可能な場合のみ適用（タッチデバイス・ハイブリッドのタッチ操作を除外） */
@media (any-hover: hover) and (pointer: fine) {
  .c-nav__link:hover {
    color: #0066cc;
  }
}

/* ================================================
   ベースレイアウト（スニペット共通）
   ================================================ */
.l-container {
  margin-block: 40px;
}

.l-inner {
  max-width: calc(1200px + 20px * 2);
  margin-inline: auto;
  padding-inline: 20px;
}

@media (min-width: 768px) {
  .l-inner {
    padding-inline: 40px;
  }
}

.p-snippet-title {
  font-size: 24px;
  line-height: 1.6;
  font-weight: bold;
  text-align: center;
}

@media (min-width: 768px) {
  .p-snippet-title {
    font-size: 32px;
  }
}

.p-snippet-content {
  margin-block-start: 24px;
  font-size: 16px;
  line-height: 1.8;
  color: #555;
}

/* ================================================
   c-fab: FABスタイル ハンバーガーボタン（右下固定）
   ================================================ */
.c-fab {
  /* ボタンリセット */
  appearance: none;
  border: none;
  cursor: pointer;

  /* 右下に固定配置 */
  position: fixed;
  bottom: var(--fab-offset);
  right: var(--fab-offset);
  z-index: var(--z-floating); /* FABは常に最前面 */

  /* 円形FABスタイル */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background-color: var(--fab-bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24);
  padding: 0;

  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

/* マウス系デバイスかつホバー操作が可能な場合のみ適用（タッチデバイス・ハイブリッドのタッチ操作を除外） */
@media (any-hover: hover) and (pointer: fine) {
  .c-fab:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
    transform: scale(1.05);
  }
}

/* メニュー展開時: FABの背景色を変更 */
.c-fab.is-active {
  background-color: var(--fab-bg-active);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* FABの1本線 */
.c-fab__line {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #fff;
  border-radius: 2px;
  transform-origin: center;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

/* ×（バツ）アニメーション */
/* is-active クラスが付いたとき、3本線 → × に変形 */

/* 1本目: 右上がりの斜線 */
.c-fab.is-active .c-fab__line:nth-child(1) {
  /* 線の高さ(2px) + gap(5px) = 7px（中央線との距離） */
  transform: translateY(7px) rotate(45deg);
}

/* 2本目: 非表示 */
.c-fab.is-active .c-fab__line:nth-child(2) {
  opacity: 0;
}

/* 3本目: 右下がりの斜線 */
.c-fab.is-active .c-fab__line:nth-child(3) {
  /* 線の高さ(2px) + gap(5px) = 7px（中央線との距離） */
  transform: translateY(-7px) rotate(-45deg);
}

/* PCでもFABを表示する（ポートフォリオ向けのクリエイティブUIとして） */
/* 必要に応じて以下のコメントを外してPCでは非表示にできる */
/*
@media (min-width: 768px) {
  .c-fab {
    display: none;
  }
}
*/

/* ================================================
   c-expand-bg: 展開背景（右下から円形に広がるアニメーション）
   第1段階: ボタン位置から円形に広がるダーク背景
   ================================================ */
.c-expand-bg {
  position: fixed;
  z-index: var(--z-overlay);
  pointer-events: none; /* 背景自体はクリック不可 */

  /* FABボタンの中心を起点に配置 */
  /* bottom / right はFABボタンの中心位置に合わせる */
  bottom: calc(var(--fab-offset) + var(--fab-size) / 2);
  right: calc(var(--fab-offset) + var(--fab-size) / 2);

  /* 初期状態: 小さな円（FABボタンサイズ） */
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: var(--expand-bg);

  /* transformで拡大。中心を右下に固定するためtranslateで調整 */
  transform: translate(50%, 50%) scale(0);
  transition:
    transform var(--expand-transition-bg),
    width 0s,
    height 0s;

  opacity: 0;
}

/* 第1段階: 円形背景が画面全体に広がる */
.c-expand-bg.is-expanding {
  /* 画面の対角線の2倍以上の大きさにして画面全体をカバー */
  width: 300vmax;
  height: 300vmax;
  transform: translate(50%, 50%) scale(1);
  opacity: 1;
}

/* 閉じるとき: 逆順で縮小 */
.c-expand-bg.is-closing {
  width: 300vmax;
  height: 300vmax;
  transform: translate(50%, 50%) scale(0);
  opacity: 1;
  transition:
    transform var(--expand-transition-bg),
    opacity 0.1s ease 0.4s;
}

/* ================================================
   c-expand-nav: 展開型ナビゲーション
   第2段階: リンクがフェードイン + スタッガードアニメーション
   ================================================ */
.c-expand-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);

  display: flex;
  align-items: center;
  justify-content: center;

  /* 初期状態: 非表示 */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--expand-transition-nav),
    visibility var(--expand-transition-nav);
}

/* 第2段階: ナビリンクがフェードイン */
.c-expand-nav.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (min-width: 768px) {
  /* PCでも展開ナビを使用可能にする（ポートフォリオ向け） */
  /* PCで非表示にしたい場合は以下のコメントを外す */
  /*
  .c-expand-nav {
    display: none;
  }
  */
}

/* ================================================
   c-expand-nav__list / item / link: メニューリスト
   ================================================ */
.c-expand-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}

/* 各リンクの初期状態（非表示・下にずれた位置） */
.c-expand-nav__item {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity var(--expand-transition-nav),
    transform var(--expand-transition-nav);
  /* 閉じるときは遅延なしで即座にフェードアウト */
  transition-delay: 0s;
}

/* is-open 時: 表示（元の位置に戻る） */
.c-expand-nav.is-open .c-expand-nav__item {
  opacity: 1;
  transform: translateY(0);
}

/* 各アイテムに遅延を付けてスタッガードアニメーションにする */
.c-expand-nav.is-open .c-expand-nav__item:nth-child(1) {
  transition-delay: calc(var(--expand-item-delay) * 1);
}

.c-expand-nav.is-open .c-expand-nav__item:nth-child(2) {
  transition-delay: calc(var(--expand-item-delay) * 2);
}

.c-expand-nav.is-open .c-expand-nav__item:nth-child(3) {
  transition-delay: calc(var(--expand-item-delay) * 3);
}

.c-expand-nav.is-open .c-expand-nav__item:nth-child(4) {
  transition-delay: calc(var(--expand-item-delay) * 4);
}

.c-expand-nav.is-open .c-expand-nav__item:nth-child(5) {
  transition-delay: calc(var(--expand-item-delay) * 5);
}

.c-expand-nav__link {
  display: block;
  padding: 16px 32px;
  color: #fff;
  text-decoration: none;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.1em;
  transition: color 0.2s ease;
}

@media (min-width: 768px) {
  .c-expand-nav__link {
    font-size: 36px;
    padding: 20px 40px;
  }
}

/* マウス系デバイスかつホバー操作が可能な場合のみ適用（タッチデバイス・ハイブリッドのタッチ操作を除外） */
@media (any-hover: hover) and (pointer: fine) {
  .c-expand-nav__link:hover {
    color: #6eb5ff;
  }
}
