/* ============================================================
   metro.css — CB-Factory LP v2
   metro map アニメーション + ダークモード + レスポンシブ CSS
   接続先: index.html / js/metro.js
   ============================================================ */

/* ===================== CSS VARIABLES ===================== */
:root {
  --bg-base:        #0f0f1a;
  --bg-card:        #141426;
  --bg-panel:       #0d0d1e;
  --bg-hover:       #1c1c30;
  --text-head:      #f0f4ff;
  --text-body:      #b8c0d8;
  --text-muted:     #6b7a99;
  --accent-blue:    #4a9eff;
  --accent-pink:    #ff6b9d;
  --accent-green:   #00c896;
  --accent-glow:    rgba(74, 158, 255, 0.25);
  --border:         #1e2840;
  --border-accent:  rgba(74, 158, 255, 0.2);

  --node-idle:      #3a3a5a;
  --node-active:    #4a9eff;
  --node-done:      #00c896;

  /* === 追加変数 (design_spec.md section E) === */
  --bg-darker:         #0a0a14;
  --border-subtle:     #2a2a4a;
  --text-muted:        #6a7080;
  --accent-blue-dim:   rgba(74, 158, 255, 0.15);
  --accent-green-dim:  rgba(0, 200, 150, 0.15);
  --accent-pink-dim:   rgba(255, 107, 157, 0.15);
  --shadow-card:       0 4px 24px rgba(0, 0, 0, 0.25);

  --font-sans:  'Inter', 'Noto Sans JP', sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --shadow-glow: 0 0 20px rgba(74, 158, 255, 0.3);
}

/* ===================== RESET & BASE ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg-base);
  color: var(--text-body);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ===================== LAYOUT ===================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===================== NAVBAR ===================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar__logo-mark {
  font-size: 20px;
  color: var(--accent-blue);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.navbar__logo-text {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-head);
  letter-spacing: -0.02em;
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.navbar__link {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.navbar__link:hover {
  color: var(--text-head);
  text-decoration: none;
}

.navbar__lang {
  background: transparent;
  border: 1px solid var(--border-accent);
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: var(--font-sans);
}
.navbar__lang:hover {
  background: var(--accent-blue);
  color: #fff;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.btn:hover { text-decoration: none; }

.btn--primary {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.35);
}
.btn--primary:hover {
  background: #6aafff;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(74, 158, 255, 0.5);
}

.btn--ghost {
  background: transparent;
  color: var(--text-head);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.btn--lg {
  padding: 16px 40px;
  font-size: 17px;
  border-radius: var(--radius-lg);
}

/* ===================== BADGE ===================== */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.badge--new {
  background: rgba(74, 158, 255, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(74, 158, 255, 0.3);
}

.badge--safe {
  background: rgba(0, 200, 150, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(0, 200, 150, 0.3);
}

.badge--req {
  background: rgba(255, 107, 157, 0.12);
  color: var(--accent-pink);
  border: 1px solid rgba(255, 107, 157, 0.3);
}

/* ===================== SECTION COMMON ===================== */
.section-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  color: var(--text-head);
  line-height: 1.25;
  margin-bottom: 12px;
}

.section-sub {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 48px;
}

/* ===================== HERO ===================== */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  padding: 80px 0;
  background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(74, 158, 255, 0.08) 0%, transparent 70%);
  position: relative;
}

.hero .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

.hero__badge { margin-bottom: 8px; }

.hero__catch {
  font-size: clamp(32px, 6vw, 60px);
  font-weight: 700;
  color: var(--text-head);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 820px;
}

.hero__sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
  max-width: 600px;
}

.hero__actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.hero__scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 20px;
  animation: bounce 2s infinite;
  opacity: 0.6;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}

/* ===================== PROBLEM ===================== */
.problem {
  padding: 100px 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.problem__checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 40px;
}

.problem__item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s;
}
.problem__item:hover {
  border-color: rgba(255, 107, 157, 0.35);
}

.problem__icon {
  color: var(--accent-pink);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.problem__text {
  font-size: 15px;
  line-height: 1.6;
}

.problem__conclusion {
  font-size: 17px;
  color: var(--text-head);
  line-height: 1.7;
  padding: 24px 28px;
  background: rgba(74, 158, 255, 0.06);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ===================== METRO DEMO ===================== */
.metro-demo {
  padding: 100px 0;
  position: relative;
}

.metro-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

#metro-map-svg {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: var(--radius-md);
  background: #1a1a2e;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glow);
}

/* Metro node animation classes */
.metro-node circle {
  transition: fill 0.4s ease, stroke 0.4s ease, opacity 0.4s ease;
  opacity: 0.4;
}

.metro-node text {
  transition: fill 0.4s ease, opacity 0.4s ease;
  opacity: 0.5;
}

.metro-node--active circle {
  fill: var(--accent-blue);
  stroke: #fff;
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--accent-blue));
}
.metro-node--active text {
  fill: #fff;
  opacity: 1;
}

.metro-node--done circle {
  fill: var(--node-done);
  stroke: var(--accent-blue);
  opacity: 0.8;
}
.metro-node--done text {
  fill: var(--accent-blue);
  opacity: 0.8;
}

/* gemini_design ノードはピンク */
#node-gemini_design.metro-node--active circle {
  fill: var(--accent-pink);
  stroke: #fff;
  filter: drop-shadow(0 0 8px var(--accent-pink));
}
#node-gemini_design.metro-node--done circle {
  fill: rgba(255, 107, 157, 0.4);
  stroke: var(--accent-pink);
}

.metro-legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 280px;
}

.metro-legend__current {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metro-legend__dot {
  width: 10px;
  height: 10px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse-dot 1s infinite;
}

.metro-legend__name {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-head);
  font-weight: 600;
}

.metro-legend__desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===================== LOG PANEL ===================== */
.log-panel-section {
  padding: 100px 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.log-panel {
  background: #0a0a18;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 720px;
  margin: 0 auto;
  font-family: var(--font-mono);
}

.log-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.log-panel__indicator {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

.log-panel__label {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.log-panel__status {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 600;
}

.log-panel__output {
  padding: 16px 20px;
  min-height: 220px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-panel__output::-webkit-scrollbar {
  width: 4px;
}
.log-panel__output::-webkit-scrollbar-track {
  background: transparent;
}
.log-panel__output::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.log-line {
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  opacity: 0;
  animation: fadeInLine 0.3s forwards;
}

@keyframes fadeInLine {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.log-line--complete { color: var(--accent-green); }
.log-line--running  { color: #f59e0b; }
.log-line--error    { color: #ef4444; }
.log-line--info     { color: var(--text-muted); }

/* ===================== PRESETS ===================== */
.presets {
  padding: 100px 0;
}

.presets__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.preset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.preset-card--free:hover {
  border-color: rgba(74, 158, 255, 0.4);
  transform: translateY(-2px);
}

.preset-card--soon {
  opacity: 0.65;
}

.preset-card__phase {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.preset-card--free .preset-card__phase {
  color: var(--accent-blue);
}

.preset-card__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-head);
}

.preset-card__desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
}

.preset-card__cta {
  font-size: 14px;
  color: var(--accent-blue);
  font-weight: 600;
}
.preset-card__cta:hover { text-decoration: none; opacity: 0.8; }

.preset-card__soon {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 4px 12px;
  border-radius: 20px;
  align-self: flex-start;
}

/* ===================== CODE SNIPPET ===================== */
.snippet-section {
  padding: 100px 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.snippet-wrap {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.snippet-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.snippet-block {
  background: #0a0a18;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.snippet-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.snippet-block__lang {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.snippet-block__copy {
  background: transparent;
  border: 1px solid var(--border-accent);
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.2s, color 0.2s;
}
.snippet-block__copy:hover {
  background: var(--accent-blue);
  color: #fff;
}
.snippet-block__copy.copied {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #fff;
}

.snippet-block__code {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: #a8d4ff;
  overflow-x: auto;
  margin: 0;
}

.snippet-note {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===================== CTA ===================== */
.cta-section {
  padding: 120px 0;
  text-align: center;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(74, 158, 255, 0.07) 0%, transparent 70%);
}

.cta__title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  color: var(--text-head);
  margin-bottom: 16px;
}

.cta__sub {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.cta__actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===================== FOOTER ===================== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer__links {
  display: flex;
  gap: 28px;
}
.footer__links a {
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.2s;
}
.footer__links a:hover {
  color: var(--text-head);
  text-decoration: none;
}

.footer__copy {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
    gap: 12px;
  }
  .navbar__nav {
    gap: 16px;
  }
  .navbar__link {
    display: none;
  }

  .hero {
    padding: 60px 0;
    min-height: 80vh;
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .presets__grid {
    grid-template-columns: 1fr;
  }

  .cta__actions {
    flex-direction: column;
    align-items: center;
  }

  .footer__row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }

  .hero__catch {
    font-size: 28px;
  }

  #metro-map-svg {
    height: 200px;
  }
}

/* ===================== PREFERS-REDUCED-MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .metro-node circle,
  .metro-node text {
    transition: none !important;
    opacity: 1 !important;
  }

  .metro-node--active circle,
  .metro-node--done circle {
    opacity: 1 !important;
  }

  .log-line {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* ===================== DARK MODE (explicit) ===================== */
@media (prefers-color-scheme: dark) {
  /* 元々ダークテーマなので追加調整のみ */
  :root {
    --bg-base:   #0a0a18;
    --bg-card:   #111122;
    --bg-panel:  #0a0a18;
  }
}

/* ===================== LIGHT MODE OVERRIDE ===================== */
@media (prefers-color-scheme: light) {
  /* LP は常にダークモード表示のため、light mode でも同じ見た目を維持 */
  :root {
    color-scheme: dark;
  }

  body {
    background: var(--bg-base);
    color: var(--text-body);
  }
}

/* ===================== STATUS CLASSES (design_spec.md §E) ===================== */
.status-running { color: var(--accent-blue); }
.status-done    { color: var(--accent-green); }
.status-error   { color: var(--accent-pink); }
.status-idle    { color: var(--text-muted); }

/* metro-node idle/active/done を design_spec.md 配色に同期 */
.metro-node--done circle {
  fill: var(--node-done);   /* #00c896 */
  stroke: var(--accent-blue);
  opacity: 0.85;
}
.metro-node--done text {
  fill: var(--accent-green);
  opacity: 0.9;
}

/* ===================== PRESET CARD — 詳細調整 ===================== */
.preset-card {
  box-shadow: var(--shadow-card);
}
.preset-card--free:hover {
  box-shadow: 0 8px 32px rgba(74, 158, 255, 0.2);
}
.preset-card--soon {
  cursor: not-allowed;
}

/* ===================== HERO MIN-HEIGHT 100vh ===================== */
.hero {
  min-height: 100vh;
}

/* ===================== CTA セクション グラデーション ===================== */
.cta-section {
  background: linear-gradient(to bottom, var(--bg-base), #0a0810);
}

/* ===================== FOOTER ===================== */
.footer {
  background: #080810;
}

/* ===================== LOG-PANEL コードブロック色 ===================== */
.log-panel {
  background: var(--bg-darker);
}
.snippet-block {
  background: var(--bg-darker);
}
