/* ==========================================================================
   SATELLITE ARCHIVE — 共通スタイルシート
   デザインシステムの正本。トークン定義は docs/DESIGN.md §3 を参照。
   ========================================================================== */

/* ---- 1. デザイントークン ---- */
:root {
  /* 背景 */
  --bg-0: #06060d;        /* ページ最深部 */
  --bg-1: #0d0d1a;        /* パネル */
  --bg-2: #131327;        /* パネル内の一段浅い面 */
  --bg-glass: rgba(13, 13, 26, 0.72);

  /* アクセント(紫系) */
  --accent: #8b5cf6;      /* 主アクセント */
  --accent-soft: #a78bfa; /* 明るい紫(見出し・リンク) */
  --accent-dim: #6d28d9;  /* 濃い紫(グラデ端) */
  --accent-glow: rgba(139, 92, 246, 0.35);

  /* 第2アクセント(シアン: 数値・運用中バッジ) */
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.15);

  /* 警告・終了系 */
  --rose: #fb7185;

  /* テキスト */
  --text: #e9e7f7;
  --muted: #9c98bd;
  --faint: #5d5a7a;

  /* 罫線 */
  --line: rgba(139, 92, 246, 0.20);
  --line-soft: rgba(139, 92, 246, 0.10);

  /* 字体 */
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-display: "Orbitron", "Noto Sans JP", sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, monospace;

  /* 角丸・余白 */
  --radius: 14px;
  --radius-sm: 8px;
  --gap: clamp(16px, 3vw, 28px);
}

/* ---- 2. リセット & ベース ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
}
/* 深宇宙グラデーション(星空canvasの下地) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 70% -10%, rgba(109, 40, 217, 0.28), transparent 60%),
    radial-gradient(ellipse 60% 40% at 10% 110%, rgba(34, 211, 238, 0.10), transparent 60%),
    var(--bg-0);
}
#stars { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: var(--cyan); }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-dim); color: #fff; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }

/* ---- 3. ヘッダー ---- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px; letter-spacing: 0.14em;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.brand:hover { color: var(--accent-soft); }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px var(--accent-glow);
}
.head-nav { display: flex; gap: 22px; font-size: 13.5px; letter-spacing: 0.06em; }
.head-nav a { color: var(--muted); }
.head-nav a:hover, .head-nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 520px) {
  .site-head .wrap { gap: 10px; }
  .brand { font-size: 13px; letter-spacing: 0.08em; }
  .head-nav { gap: 12px; font-size: 12px; }
}

/* ---- 4. ヒーロー ---- */
.hero { padding: clamp(56px, 10vh, 110px) 0 clamp(36px, 6vh, 64px); position: relative; }
.hero .kicker {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.3em;
  color: var(--cyan); text-transform: uppercase; margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5.5vw, 58px);
  line-height: 1.15; margin: 0 0 18px; font-weight: 800;
  background: linear-gradient(100deg, #fff 20%, var(--accent-soft) 55%, var(--cyan) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { max-width: 640px; color: var(--muted); font-size: clamp(15px, 1.6vw, 17px); }

/* ヒーロー内の統計 */
.hero-stats { display: flex; gap: clamp(20px, 4vw, 48px); margin-top: 36px; flex-wrap: wrap; }
.stat .num {
  font-family: var(--font-display); font-size: clamp(24px, 3vw, 34px);
  color: var(--cyan); font-weight: 700;
}
.stat .label { font-size: 12px; color: var(--faint); letter-spacing: 0.12em; }

/* ---- 5. フィルタ(index) ---- */
.filters {
  display: flex; flex-direction: column; gap: 12px; align-items: stretch;
  margin: 8px 0 28px;
}
.filter-line, .filter-group, .segmented {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.filter-line--primary { align-items: stretch; }
.segmented { gap: 6px; }
.search-box {
  flex: 1 1 240px; max-width: 360px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 18px;
  color: var(--text); font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.search-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box::placeholder { color: var(--faint); }
.filter-panel {
  display: grid; gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(19, 19, 39, 0.56);
}
.filter-panel[hidden] { display: none; }
.filter-label {
  min-width: 88px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.12em;
}
.filter-toggle { margin-left: auto; }
.filter-toggle[aria-expanded="true"] {
  border-color: var(--cyan);
  color: var(--text);
}
.filter-summary {
  align-self: center;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.chip {
  background: var(--bg-1); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px;
  padding: 7px 16px; font-size: 13px; cursor: pointer;
  font-family: var(--font-body); letter-spacing: 0.04em;
  transition: all .2s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.is-on {
  background: linear-gradient(120deg, var(--accent-dim), var(--accent));
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 14px var(--accent-glow);
}
@media (max-width: 720px) {
  .search-box, .filter-summary { max-width: none; width: 100%; }
  .filter-toggle { margin-left: 0; }
  .filter-label { width: 100%; min-width: 0; }
}

/* ---- 6. 衛星カード(index) ---- */
.grid-cards {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding-bottom: 80px;
}
.sat-card {
  position: relative; display: block;
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1) 65%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  color: var(--text);
  transition: transform .25s, border-color .25s, box-shadow .25s;
  overflow: hidden;
}
.sat-card::after { /* 上端の光る線 */
  content: ""; position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .5; transition: opacity .25s;
}
.sat-card:hover {
  transform: translateY(-4px);
  border-color: var(--line);
  box-shadow: 0 14px 40px -12px var(--accent-glow);
  color: var(--text);
}
.sat-card:hover::after { opacity: 1; }
.sat-card .flag { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sat-card h3 {
  margin: 0 0 4px; font-family: var(--font-display);
  font-size: 21px; font-weight: 700; letter-spacing: 0.03em;
}
.sat-card .en { font-family: var(--font-mono); font-size: 12px; color: var(--faint); letter-spacing: .08em; }
.sat-card p { font-size: 13.5px; color: var(--muted); margin: 12px 0 16px; line-height: 1.7; }
.sat-card .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.sat-card--soon { opacity: .55; pointer-events: none; }
.sat-card--soon .soon-tag {
  position: absolute; top: 16px; right: 16px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em;
  color: var(--faint); border: 1px solid var(--line-soft);
  border-radius: 4px; padding: 2px 8px;
}
/* 特別深掘りページのタグ(カード右上) */
.unl-tag {
  position: absolute; top: 16px; right: 16px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  color: #fff; border-radius: 4px; padding: 3px 9px;
  background: linear-gradient(120deg, var(--accent-dim), var(--accent) 55%, var(--cyan));
  box-shadow: 0 0 14px var(--accent-glow);
}

/* ---- 6c. 文献/推論タグ(深掘りページ・参考ページ用) ---- */
.tag-lit, .tag-inf {
  font-family: var(--font-mono); font-size: 10.5px;
  border-radius: 3px; padding: 1px 6px;
  margin-left: 8px; vertical-align: middle; letter-spacing: .06em;
  font-weight: 400; white-space: nowrap;
}
.tag-lit { color: var(--cyan); border: 1px solid var(--cyan); }
.tag-inf { color: var(--accent-soft); border: 1px solid var(--accent-soft); }

/* ---- 7. バッジ ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; letter-spacing: 0.06em;
  border-radius: 999px; padding: 3px 11px;
  border: 1px solid var(--line);
  color: var(--muted); background: rgba(255, 255, 255, 0.02);
}
.badge--active { color: var(--cyan); border-color: rgba(34, 211, 238, .4); background: var(--cyan-dim); }
.badge--active::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2s infinite;
}
.badge--ended { color: var(--rose); border-color: rgba(251, 113, 133, .35); }
@keyframes pulse { 50% { opacity: .4; } }

/* ---- 8. 詳細ページ: ページ内ナビ ---- */
.toc {
  position: sticky; top: 64px; z-index: 40;
  background: var(--bg-glass); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto; white-space: nowrap;
  -ms-overflow-style: none; scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }
.toc .wrap { display: flex; gap: 4px; padding-top: 8px; padding-bottom: 8px; }
.toc a {
  font-size: 12.5px; color: var(--muted); padding: 5px 13px;
  border-radius: 999px; letter-spacing: 0.04em; flex-shrink: 0;
}
.toc a:hover { color: var(--text); background: var(--bg-2); }
.toc a.is-active { color: #fff; background: var(--accent-dim); }

/* ---- 9. 詳細ページ: セクション ---- */
.section { padding: clamp(36px, 6vh, 64px) 0 0; }
.section:last-of-type { padding-bottom: 90px; }
.section > .wrap > h2 {
  font-family: var(--font-display); font-size: clamp(20px, 2.6vw, 27px);
  letter-spacing: 0.06em; margin: 0 0 6px;
  display: flex; align-items: baseline; gap: 14px;
}
.section h2 .sec-no { font-family: var(--font-mono); font-size: 13px; color: var(--accent); letter-spacing: .2em; }
.section .sec-lede { color: var(--muted); font-size: 14.5px; max-width: 720px; margin: 0 0 26px; }

.panel {
  background: linear-gradient(170deg, var(--bg-2), var(--bg-1) 70%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px);
}

/* ---- 10. スペック表 ---- */
.spec-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.spec-table th, .spec-table td { text-align: left; padding: 11px 14px; vertical-align: top; }
.spec-table tr { border-bottom: 1px solid var(--line-soft); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table th {
  width: 200px; color: var(--faint); font-weight: 500;
  font-size: 12.5px; letter-spacing: 0.1em; white-space: nowrap;
}
.spec-table td { color: var(--text); }
.spec-table td .sub { color: var(--muted); font-size: 12.5px; display: block; }
@media (max-width: 560px) {
  .spec-table th { width: 110px; }
}

/* 2カラムのスペックパネル */
.spec-grid { display: grid; gap: var(--gap); grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .spec-grid { grid-template-columns: 1fr; } }

/* ---- 10b. 本文プローズ(ミッション解説などの長文) ---- */
.prose h3 {
  font-size: 16.5px; color: var(--accent-soft);
  margin: 28px 0 10px; letter-spacing: 0.03em;
}
.prose h3:first-child { margin-top: 0; }
.prose h3::before { content: "▍"; color: var(--accent); margin-right: 6px; }
.prose p { margin: 0 0 14px; font-size: 14.5px; line-height: 2; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--cyan); font-weight: 600; }

/* ---- 11. タイムライン ---- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--cyan));
  opacity: .4; border-radius: 2px;
}
.timeline li { position: relative; padding: 0 0 26px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -25px; top: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg-0); border: 2px solid var(--accent);
}
.timeline li.milestone::before { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.timeline .t-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--cyan); letter-spacing: .08em; }
.timeline .t-title { font-weight: 700; font-size: 15px; }
.timeline .t-desc { font-size: 13.5px; color: var(--muted); }

/* ---- 12. 機器カード ---- */
.inst-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.inst {
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 18px 18px 14px;
  transition: border-color .2s;
}
.inst:hover { border-color: var(--line); }
.inst .abbr { font-family: var(--font-mono); font-size: 12px; color: var(--accent-soft); letter-spacing: .12em; }
.inst h4 { margin: 4px 0 8px; font-size: 15.5px; }
.inst p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ---- 13. 図版(引用) ---- */
.gallery { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
figure.cite {
  margin: 0; background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
}
figure.cite img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
figure.cite svg { width: 100%; aspect-ratio: 4 / 3; display: block; background: #070712; }
figure.cite figcaption { padding: 12px 16px 14px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
figure.cite figcaption .src { display: block; font-size: 11px; color: var(--faint); margin-top: 4px; }

/* ---- 14. 軌道図 ---- */
.orbit-figure { text-align: center; }
.orbit-figure svg { width: 100%; height: auto; max-width: 760px; }
.orbit-legend {
  display: flex; gap: 22px; justify-content: center; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); margin-top: 12px;
}
.orbit-legend .key { display: inline-flex; align-items: center; gap: 7px; }
.orbit-legend .swatch { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---- 15. 論文・リンクリスト ---- */
.paper-list { list-style: none; margin: 0; padding: 0; }
.paper-list li { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.paper-list li:last-child { border-bottom: none; }
.paper-list .p-title { font-weight: 600; font-size: 15px; }
.paper-list .p-meta { font-size: 13px; color: var(--muted); }
.paper-list .p-meta .doi { font-family: var(--font-mono); font-size: 12px; }

.link-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.link-card {
  display: block; background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 15px 18px;
  transition: border-color .2s, transform .2s;
}
.link-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.link-card .lc-title { font-weight: 700; font-size: 14.5px; color: var(--text); }
.link-card .lc-url { font-family: var(--font-mono); font-size: 11px; color: var(--faint); word-break: break-all; }

/* ---- 16. エピソード ---- */
.episode {
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(139, 92, 246, .08), transparent 70%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px; margin: 0 0 16px;
}
.episode h4 { margin: 0 0 6px; font-size: 15px; color: var(--accent-soft); }
.episode p { margin: 0; font-size: 13.5px; color: var(--muted); }
.episode .ep-src { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.episode .ep-src a { color: var(--faint); text-decoration: underline; text-underline-offset: 2px; }
.episode .ep-src a:hover { color: var(--accent-soft); }

/* ---- 17. 関連衛星ミニカード ---- */
.rel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.rel-card {
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.rel-card .r-name { font-weight: 700; font-size: 14.5px; }
.rel-card .r-why { font-size: 12.5px; color: var(--muted); }

/* ---- 18. フッター ---- */
.site-foot {
  border-top: 1px solid var(--line-soft);
  padding: 32px 0 44px; margin-top: 40px;
  font-size: 12.5px; color: var(--faint); text-align: center;
}

/* ---- 19. スクロール出現アニメーション ---- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
