/*
 * index.css — 解説ライブラリ スタイルシート
 * みさと天文台 星空ツアーアイテム集 統一デザイン（濃紺・宇宙テーマ）
 */

/* ─── デザイントークン ────────────────────────────────────────── */
:root {
  --bg-color: #030508;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-bg-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(0, 210, 255, 0.35);
  --accent-blue: #00d2ff;
  --accent-blue-dim: rgba(0, 210, 255, 0.15);
  --accent-orange: #ffcf80;
  --accent-orange-dim: rgba(255, 207, 128, 0.12);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --note-bg: rgba(255, 207, 128, 0.08);
  --note-border: rgba(255, 207, 128, 0.35);
  --nav-height: 60px;
  --max-width: 720px;
  --radius-card: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ─── リセット & ベース ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  background-image:
    radial-gradient(circle at 15% 20%, rgba(0, 210, 255, 0.04) 0%, transparent 55%),
    radial-gradient(circle at 85% 75%, rgba(112, 0, 255, 0.04) 0%, transparent 55%);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── 背景：星キャンバス ─────────────────────────────────────── */
#lib-star-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── ナビゲーションバー ─────────────────────────────────────── */
.lib-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--nav-height);
  padding: 0 20px;
  background: rgba(3, 5, 8, 0.80);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--glass-border);
}

/* 戻るボタン */
#back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

#back-btn:hover {
  background: var(--accent-blue-dim);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

#back-btn .back-arrow {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

#back-btn:hover .back-arrow {
  transform: translateX(-3px);
}

/* パンくず */
#breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.crumb-link {
  color: var(--accent-blue);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumb-link:hover {
  opacity: 0.75;
}

.crumb-sep {
  color: var(--text-secondary);
  opacity: 0.5;
}

.crumb-current {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* ─── メインコンテナ ─────────────────────────────────────────── */
.lib-main {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ─── 画面切替（ビュー） ─────────────────────────────────────── */
.lib-view {
  display: none;
  animation: viewFadeIn 0.35s ease forwards;
}

.lib-view.active {
  display: block;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── ページヘッダー（テーマ一覧トップ） ────────────────────── */
.lib-page-header {
  text-align: center;
  margin-bottom: 48px;
}

.lib-page-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-blue) 0%, #ffffff 60%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  line-height: 1.2;
}

.lib-page-header .lib-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ─── テーマ数バッジ ────────────────────────────────────────── */
.lib-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.lib-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--accent-blue-dim);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: var(--accent-blue);
}

/* ─── カード（テーマ一覧） ───────────────────────────────────── */
.lib-card-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lib-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.lib-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 50%, rgba(0, 210, 255, 0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lib-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--glass-border-hover);
  transform: translateX(4px);
  box-shadow: 0 4px 24px rgba(0, 210, 255, 0.10);
}

.lib-card:hover::before {
  opacity: 1;
}

.lib-card:active {
  transform: translateX(2px) scale(0.99);
}

/* カード：絵文字アイコン（テーマ一覧のみ） */
.lib-card-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.2));
}

/* カード：テキスト部 */
.lib-card-body {
  flex: 1;
  min-width: 0;
}

.lib-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.lib-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.lib-card-count {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--accent-blue);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* カード：矢印 */
.lib-card-arrow {
  font-size: 1.4rem;
  color: var(--text-secondary);
  opacity: 0.5;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.lib-card:hover .lib-card-arrow {
  transform: translateX(4px);
  opacity: 1;
  color: var(--accent-blue);
}

/* ─── セクションヘッダー（項目一覧） ───────────────────────── */
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
  padding: 20px 22px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  border-left: 3px solid var(--accent-blue);
}

.section-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.section-title-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ─── 項目アコーディオン（item単位） ───────────────────────── */
.item-acc {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  margin-bottom: 14px;
  overflow: hidden;
  transition: var(--transition);
}

.item-acc:hover {
  border-color: var(--glass-border-hover);
}

/* 開いているときは枠を強調 */
.item-acc:has(.item-acc-header[aria-expanded="true"]) {
  border-color: var(--glass-border-hover);
  box-shadow: 0 4px 24px rgba(0, 210, 255, 0.10);
}

.item-acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: transparent;
  border: none;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease;
}

.item-acc-header:hover {
  background: var(--card-bg-hover);
}

.item-acc-header[aria-expanded="true"] {
  background: var(--accent-blue-dim);
  border-bottom: 1px solid var(--glass-border);
}

.item-acc-body {
  flex: 1;
  min-width: 0;
}

.item-acc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.item-acc-summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* 開閉アイコン（＋ / −） */
.item-acc-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-blue-dim);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: var(--accent-blue);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.2s ease;
}

.item-acc-header[aria-expanded="true"] .item-acc-icon {
  transform: rotate(180deg);
}

/* 開いたときの詳細パネル */
.item-acc-panel {
  padding: 22px 22px 26px;
}

/* ─── 詳細本文（パネル内・全表示） ─────────────────────────── */
.detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.3;
}

.detail-summary {
  font-size: 0.98rem;
  color: var(--accent-blue);
  font-weight: 500;
  margin-bottom: 18px;
  line-height: 1.55;
}

.detail-divider {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin-bottom: 22px;
}

/* 本文：通常テキスト */
.body-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.85;
  margin-bottom: 18px;
}

/* 本文内の強調（星の倍率などを目立たせる） */
.body-text .emph {
  font-size: 1.18em;
  font-weight: 800;
  color: var(--accent-blue);
  letter-spacing: 0.01em;
}

/* 本文：小見出し */
.body-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-orange);
  margin: 30px 0 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent-orange);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

/* 本文：補足ノート */
.body-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 20px 0;
}

.body-note-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.body-note p {
  font-size: 0.92rem;
  color: var(--accent-orange);
  line-height: 1.7;
}

/* 本文：画像 */
.body-image-wrap {
  margin: 24px 0;
  text-align: center;
}

.body-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

/* 本文：リンク */
.body-link-wrap {
  margin: 16px 0;
}

.body-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-blue);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 210, 255, 0.3);
  padding-bottom: 2px;
  transition: border-color 0.2s, opacity 0.2s;
}

.body-link:hover {
  opacity: 0.8;
  border-color: var(--accent-blue);
}

.body-link-icon {
  font-size: 0.9rem;
}

/* パネル内の先頭・末尾ブロックの余白調整 */
.item-acc-panel .body-heading:first-child,
.item-acc-panel .body-text:first-child {
  margin-top: 0;
}

.item-acc-panel>*:last-child {
  margin-bottom: 0;
}

/* ─── フッター ──────────────────────────────────────────────── */
.lib-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(2, 2, 8, 0.7);
  letter-spacing: 0.05em;
}

/* ─── レスポンシブ ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .lib-page-header h1 {
    font-size: 1.8rem;
  }

  .lib-main {
    padding: 28px 14px 60px;
  }

  .lib-card {
    padding: 16px 16px;
    gap: 14px;
  }

  .lib-card-icon {
    font-size: 2rem;
  }

  .section-header {
    padding: 16px 16px;
    gap: 12px;
  }

  .item-acc-header {
    padding: 16px 16px;
    gap: 14px;
  }

  .item-acc-panel {
    padding: 16px 16px 20px;
  }

  .detail-title {
    font-size: 1.3rem;
  }
}

/* ─── タップハイライト除去 ───────────────────────────────────── */
button {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}