/**
 * nav-sheet.css — 記事ページ専用のナビゲーション・ボトムシート
 *
 * 構成:
 *  - .nav-launcher        : 左下固定のランチャ（pill 型ボタン）
 *  - .nav-sheet-backdrop  : 半透明オーバーレイ
 *  - .nav-sheet           : ボトムシート本体（下からスライドアップ）
 *  - .nav-sheet-head      : ヘッダー（grip + eyebrow + title + close）
 *  - .nav-sheet-body      : スクロール可能なボディ
 *  - .nav-sheet-section   : 各セクションの共通枠（目次 / トップへ戻る / 殿堂入り）
 *
 * 配色は --accent / --accent-rgb / --ink / --ink-2 / --muted / --line / --soft
 * を参照して全テーマで自動追従する（テーマ別の上書きは原則不要）。
 */

/* ========================================
   .nav-launcher — 左下固定の pill 型ランチャ
   ======================================== */
.nav-launcher {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 190;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow:
    0 14px 32px -12px rgba(var(--accent-rgb), 0.28),
    0 4px 12px -4px rgba(20, 30, 25, 0.12);
  cursor: pointer;
  /* 初期: 非表示。スクロール 400px 超で .is-visible で表示 */
  opacity: 0;
  pointer-events: none;
  transform: translateY(120%);
  transition:
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.3s ease,
    box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-launcher.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-launcher:hover {
  transform: translateY(-1px);
  box-shadow:
    0 18px 38px -10px rgba(var(--accent-rgb), 0.34),
    0 6px 16px -4px rgba(20, 30, 25, 0.14);
}

.nav-launcher:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.nav-launcher:active {
  transform: translateY(0);
}

.nav-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.nav-launcher-icon svg {
  display: block;
}

.nav-launcher-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  line-height: 1;
}

/* ========================================
   .nav-sheet-backdrop — 半透明オーバーレイ
   ======================================== */
.nav-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(20, 25, 22, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.nav-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ========================================
   .nav-sheet — ボトムシート本体
   ======================================== */
.nav-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 230;
  display: flex;
  flex-direction: column;
  max-height: min(82vh, 720px);
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow:
    0 -24px 60px -20px rgba(20, 30, 25, 0.25),
    0 -6px 16px -4px rgba(20, 30, 25, 0.08);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.85, 0.25, 1);
  overflow: hidden;
}

.nav-sheet.is-open {
  transform: translateY(0);
}

/* PC では中央寄せの浮島スタイル */
@media (min-width: 768px) {
  .nav-sheet {
    left: 50%;
    right: auto;
    width: calc(100% - 48px);
    max-width: 560px;
    bottom: 24px;
    border-radius: 24px 24px 12px 12px;
    border: 1px solid var(--line);
    transform: translateX(-50%) translateY(140%);
  }
  .nav-sheet.is-open {
    transform: translateX(-50%) translateY(0);
  }
}

/* ========================================
   .nav-sheet-head — ヘッダー
   ======================================== */
.nav-sheet-head {
  position: relative;
  padding: 22px 56px 14px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.nav-sheet-grip {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}

.nav-sheet-eyebrow {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin: 0 0 4px;
  text-transform: uppercase;
}

.nav-sheet-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0;
  line-height: 1.4;
}

/* 右上の × 閉じるボタン（.float-cta .close の擬似要素方式を踏襲） */
.nav-sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 4px 10px -2px rgba(20, 30, 25, 0.12);
  cursor: pointer;
  padding: 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-sheet-close::before,
.nav-sheet-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 1.5px;
  background: var(--muted);
  transform-origin: center;
  transition: background 0.15s ease;
}
.nav-sheet-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.nav-sheet-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

.nav-sheet-close:hover {
  background: var(--soft);
}
.nav-sheet-close:hover::before,
.nav-sheet-close:hover::after {
  background: var(--ink);
}
.nav-sheet-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========================================
   .nav-sheet-body — スクロール領域
   ======================================== */
.nav-sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 22px calc(24px + env(safe-area-inset-bottom, 0px));
  scrollbar-gutter: stable;
  flex: 1 1 auto;
}

.nav-sheet-section + .nav-sheet-section {
  margin-top: 22px;
}

.nav-sheet-section[hidden] {
  display: none !important;
}

/* ========================================
   .nav-sheet-section-title — eyebrow 風セクションタイトル
   ======================================== */
.nav-sheet-section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-sheet-section-rule {
  display: inline-block;
  width: 22px;
  height: 1px;
  background: var(--accent);
}

/* ========================================
   .nav-sheet-toc — 目次（本文 .toc の clone を受ける）
   ======================================== */
.nav-sheet-toc .toc-list,
.nav-sheet-toc .toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-sheet-toc .toc-item > a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-sheet-toc .toc-item > a:hover {
  background: var(--soft);
  color: var(--accent);
}

.nav-sheet-toc .toc-level-3 > a {
  padding-left: 28px;
  font-size: 13px;
  color: var(--ink-2);
}

.nav-sheet-toc .toc-item.is-active > a {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font-weight: 700;
}

/* 本文側の "もっと見る" トグルが clone で紛れ込んでも非表示にする防御 */
.nav-sheet-toc .toc-toggle {
  display: none !important;
}

/* ========================================
   .nav-sheet-to-top-btn — ページトップへ戻るプライマリボタン
   ======================================== */
.nav-sheet-to-top-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow:
    0 8px 18px -6px rgba(var(--accent-rgb), 0.55),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.nav-sheet-to-top-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 22px -6px rgba(var(--accent-rgb), 0.6),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.nav-sheet-to-top-btn:active {
  transform: translateY(0);
}

.nav-sheet-to-top-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.nav-sheet-to-top-icon {
  display: inline-flex;
  align-items: center;
}

.nav-sheet-to-top-icon svg {
  display: block;
}

/* ========================================
   .nav-sheet-halloffame — 殿堂入り記事リスト
   ======================================== */
.nav-sheet-hall-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-sheet-hall-link {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--soft, #f7f7f5);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-sheet-hall-link:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -10px rgba(var(--accent-rgb), 0.35);
}

.nav-sheet-hall-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-sheet-hall-thumb {
  width: 88px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(var(--accent-rgb), 0.18),
    rgba(var(--accent-rgb), 0.05)
  );
  flex-shrink: 0;
}

.nav-sheet-hall-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nav-sheet-hall-meta {
  min-width: 0;
}

.nav-sheet-hall-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 4px;
}

.nav-sheet-hall-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

/* ========================================
   body スクロールロック
   ======================================== */
body.has-sheet-open {
  overflow: hidden;
}

/* ========================================
   モバイル微調整
   ======================================== */
@media (max-width: 1023px) {
  /* mobile-cta-bar と被らないよう上方向にずらす */
  .nav-launcher {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 639px) {
  .nav-launcher {
    left: 16px;
    padding: 9px 14px 9px 11px;
  }
  .nav-launcher-label {
    font-size: 11.5px;
  }
}

/* ========================================
   reduced-motion 対応
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .nav-launcher,
  .nav-sheet,
  .nav-sheet-backdrop,
  .nav-sheet-to-top-btn,
  .nav-sheet-hall-link {
    transition: none;
  }
}
