/* =============================================================================
   バイクツーリング旅のしおり - スタイルシート (style.css)
   ============================================================================= */

:root {
  --bg-dark: #0f1117;
  --card-bg: rgba(22, 27, 34, 0.88);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --accent-orange: #ff6b00;
  --accent-cyan: #00e5ff;
  --accent-green: #2ea043;
  --accent-gold: #f1e05a;
  --google-blue: #1a73e8;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 全画面地図コンテナ */
#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* 上部固定ナビゲーションバー */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(15, 17, 23, 0.85) 0%, rgba(15, 17, 23, 0) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--card-border);
  padding: 6px 14px;
  border-radius: 999px;
}

.brand-badge span.icon {
  font-size: 18px;
}

.nav-actions {
  display: flex;
  gap: 10px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(22, 27, 34, 0.85);
  color: var(--text-main);
  border: 1px solid var(--card-border);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-pill:hover {
  background: rgba(255, 107, 0, 0.2);
  border-color: var(--accent-orange);
  color: #fff;
  transform: translateY(-1px);
}

.btn-pill.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 107, 0, 0.5);
}

/* ストーリーテリングのカードスクロール領域 */
#story {
  position: relative;
  z-index: 10;
  width: 100%;
  pointer-events: none; /* 背景の地図操作を通すため */
}

.chapters-container {
  width: 100%;
  max-width: 480px;
  margin-left: 40px; /* デフォルトPCは左寄せでカードを配置 */
  padding-top: 10vh;
  padding-bottom: 40vh;
}

/* 各チャプター（しおりカード） */
.chapter-step {
  padding: 10vh 0;
  pointer-events: auto; /* カード内はクリック可能 */
  opacity: 0.35;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.96);
}

.chapter-step.active {
  opacity: 1;
  transform: scale(1);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2);
  transition: border-color 0.3s ease;
}

.chapter-step.active .card {
  border-color: rgba(255, 107, 0, 0.5);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(255, 107, 0, 0.2);
}

/* カードヘッダー */
.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-start   { background: rgba(0, 229, 255, 0.2); color: var(--accent-cyan); border: 1px solid var(--accent-cyan); }
.badge-winding { background: rgba(255, 107, 0, 0.2); color: var(--accent-orange); border: 1px solid var(--accent-orange); }
.badge-lunch   { background: rgba(241, 224, 90, 0.2); color: var(--accent-gold); border: 1px solid var(--accent-gold); }
.badge-seaside { background: rgba(0, 229, 255, 0.15); color: #80e9ff; border: 1px solid #00b0ff; }
.badge-goal    { background: rgba(46, 160, 67, 0.2); color: #56d364; border: 1px solid #2ea043; }
.badge-default { background: rgba(255, 255, 255, 0.1); color: #e6edf3; }

.time-stamp {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.card h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
  color: #fff;
}

.card p.description {
  font-size: 14px;
  line-height: 1.7;
  color: #c9d1d9;
  margin-bottom: 16px;
}

/* コツ・注意点ボックス */
.card-tips {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-orange);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: #d2a8ff;
  margin-bottom: 18px;
}

/* チェックリスト */
.checklist-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.checklist-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.checklist-items {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.checklist-items li {
  font-size: 12px;
  color: #c9d1d9;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Googleマップ起動ボタン */
.btn-gmap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
}

.btn-gmap:hover {
  background: linear-gradient(135deg, #1967d2 0%, #0d47a1 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(26, 115, 232, 0.5);
}

.btn-gmap svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* カスタムマップマーカー */
.custom-marker {
  width: 38px;
  height: 38px;
  background: var(--bg-dark);
  border: 2px solid var(--accent-orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(255, 107, 0, 0.6);
  transition: transform 0.2s ease;
}

.custom-marker:hover {
  transform: scale(1.2);
  border-color: var(--accent-cyan);
}

.custom-marker.active-marker {
  transform: scale(1.25);
  background: var(--accent-orange);
  border-color: #fff;
  box-shadow: 0 0 25px rgba(255, 107, 0, 0.9);
}

/* 動画撮影/自動再生用の再生プログレスバー */
.autoplay-progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--accent-orange);
  width: 0%;
  z-index: 999;
  transition: width 0.1s linear;
}

/* レスポンシブ対応 (スマホ) */
@media (max-width: 768px) {
  .chapters-container {
    max-width: 90%;
    margin: 0 auto;
    padding-top: 15vh;
  }
  
  .card {
    padding: 18px;
  }

  .card h2 {
    font-size: 18px;
  }

  .brand-badge {
    font-size: 13px;
    padding: 4px 10px;
  }

  .btn-pill {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* =============================================================================
   概要スペックグリッド ＆ 走行距離プログレスゲージ
   ============================================================================= */

/* 概要カード内のスペックグリッド */
.overview-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.spec-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spec-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.spec-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.spec-val.highlight {
  color: var(--accent-orange);
}

/* 各スポットカードの走行距離プログレスボックス */
.distance-progress-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 14px 0 16px 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}

.progress-title {
  color: #c9d1d9;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-title strong {
  color: var(--accent-cyan);
  font-size: 14px;
}

.remaining-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 107, 0, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 107, 0, 0.3);
  font-weight: 600;
}

.remaining-badge.goal {
  background: rgba(46, 160, 67, 0.2);
  color: #56d364;
  border-color: rgba(46, 160, 67, 0.4);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e5ff 0%, #ff6b00 100%);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
  transition: width 0.6s ease;
}

.progress-fill.goal {
  background: linear-gradient(90deg, #56d364 0%, #2ea043 100%);
  box-shadow: 0 0 10px rgba(46, 160, 67, 0.6);
}

/* =============================================================================
   スマホ専用：上下スプリット ＆ 横スワイプ連動カルーセル (Mobile Split UI)
   ============================================================================= */

@media (max-width: 768px) {
  html, body {
    overflow: hidden; /* スマホではページ全体の縦スクロールを防止 */
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* 上部ナビバーをコンパクトに1行化 */
  .top-nav {
    height: 52px;
    padding: 8px 12px;
    box-sizing: border-box;
    background: rgba(15, 17, 23, 0.95);
    border-bottom: 1px solid var(--card-border);
  }

  .brand-badge {
    font-size: 12px;
    padding: 4px 8px;
    gap: 4px;
    max-width: 55%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-badge span.icon {
    font-size: 14px;
  }

  .nav-actions {
    gap: 6px;
  }

  .btn-pill {
    padding: 6px 10px;
    font-size: 11px;
    gap: 4px;
  }

  /* 地図コンテナを画面上部42%に完全固定！ */
  #map {
    position: absolute;
    top: 52px;
    left: 0;
    width: 100%;
    height: 42vh;
    z-index: 10;
    pointer-events: auto !important; /* 地図を直接タッチ操作可能に */
  }

  /* 下部カードコンテナを画面下部58%に固定 */
  #story {
    position: absolute;
    top: calc(52px + 42vh);
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(58vh - 52px);
    z-index: 20;
    pointer-events: auto;
    background: linear-gradient(180deg, rgba(15, 17, 23, 0.6) 0%, rgba(15, 17, 23, 0.95) 15%, #0f1117 100%);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* カルーセル（横スワイプ）コンテナ */
  .chapters-container {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 10px 14px 20px 14px !important;
    box-sizing: border-box;
    gap: 12px;
  }

  /* スクロールバー非表示 */
  .chapters-container::-webkit-scrollbar {
    display: none;
  }

  /* 各カード：横幅86%で左右に並ぶスワイプカード */
  .chapter-step {
    flex: 0 0 86% !important;
    width: 86% !important;
    height: 100% !important;
    padding: 0 !important;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    opacity: 0.45;
    transform: scale(0.96);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-sizing: border-box;
  }

  .chapter-step.active {
    opacity: 1 !important;
    transform: scale(1) !important;
  }

  /* カード内部のスクロール対応（長い文章用） */
  .card {
    height: 100% !important;
    padding: 14px 16px !important;
    border-radius: var(--radius-md) !important;
    overflow-y: auto !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  .card h2 {
    font-size: 16px !important;
    margin-bottom: 8px !important;
  }

  .card p.description {
    font-size: 13px !important;
    line-height: 1.5 !important;
    margin-bottom: 12px !important;
  }

  .overview-specs {
    margin: 8px 0 !important;
    gap: 6px !important;
  }

  .spec-item {
    padding: 8px 10px !important;
  }

  .spec-val {
    font-size: 13px !important;
  }

  .distance-progress-box {
    padding: 8px 10px !important;
    margin: 8px 0 10px 0 !important;
  }

  .card-tips {
    padding: 8px 10px !important;
    font-size: 11px !important;
    margin-bottom: 12px !important;
  }

  .checklist-box {
    padding: 10px !important;
    margin-bottom: 12px !important;
  }

  .btn-gmap {
    padding: 10px 14px !important;
    font-size: 13px !important;
    margin-top: auto; /* ボタンをカード下部に配置 */
  }

  /* スマホ用インジケーター（スワイプ促し） */
  .swipe-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
  }
}
