/**
 * 無料スクールバス パーツ共通 CSS（BGU-397・修正ラウンド1）
 *
 * v1（/access・event 詳細）と nx（トップ・OC一覧）の両方で読み込まれる自己完結 CSS。
 * すべて .bgu-bus* 名前空間に閉じ、既存ページのスタイルへ干渉しない。
 *
 * 基調色はふじみ野キャンパスのテーマカラー var(--campus-Fujimino, #726994)。
 * 変数はテーマで未定義（既存 v1 CSS もフォールバック併記で運用）のため、
 * 濃淡は同系統のローカル値で設計する:
 *   main #726994（対白コントラスト 4.8:1 = AA）／dark #574F78（小さめ本文用）
 *   light #F4F2F8／tint #DAD5E4。運休・注意の赤 #C22929 は機能色として維持。
 */

.bgu-bus,
.bgu-bus-launcher,
.bgu-bus-stop {
  /* 修正ラウンド5 M23: 時刻表・乗り場はフラット配色。
     採用候補① 明るい緑 var(--Green,#02C39A)×濃色文字（既定）／候補② フッター濃グレー #2B3337×白文字（--alt-gray）。
     campus カラー（紫）の塗りはランチャーのピルのみ（M9） */
  --bgu-flat-fill: var(--Green, #02c39a);
  --bgu-flat-ink: var(--Black, #333);
  --bgu-flat-line: #d9dee3;
  --bgu-flat-soft: #f5f7f8;
  --bgu-bus-text: #2b3c4f;
  --bgu-bus-alert: #c22929;
  box-sizing: border-box;
  width: 100%;
  max-width: 900px;
  margin: 40px auto;
  color: var(--bgu-bus-text);
  font-size: 15px;
  line-height: 1.8;
  text-align: left;
}

.bgu-bus *,
.bgu-bus-launcher *,
.bgu-bus-stop * {
  box-sizing: border-box;
}

/* M23 比較用候補②: フッター濃グレー（.footer-black #2B3337 系） */
.bgu-bus--alt-gray,
.bgu-bus-stop--alt-gray {
  --bgu-flat-fill: #2b3337;
  --bgu-flat-ink: #ffffff;
}

/* ---------- 見出し ---------- */

.bgu-bus__heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 20px;
  padding-left: 14px;
  border-left: 6px solid var(--bgu-flat-fill);
  border-radius: 2px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  line-height: 1.4;
}

.bgu-bus__heading-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--bgu-bus-text);
}

/* ---------- バッジ ---------- */

.bgu-bus__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--text-secondary, #2b3c4f);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: middle;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* 本日バッジの配色は M17（ランチャー）と同一系: 平常=ニュートラル/臨時=アクセント/運休=赤 */
.bgu-bus__badge--regular {
  background: #eef1f4;
  color: var(--text-secondary, #2b3c4f);
}

.bgu-bus__badge--special {
  background: var(--brand-accent-03, #f46643);
  color: #fff;
}

.bgu-bus__badge--suspended {
  background: #c22929;
  color: #fff;
}

.bgu-bus__badge--type {
  background: #fff;
  color: var(--text-secondary, #2b3c4f);
  border: 1px solid var(--bgu-flat-line);
  white-space: nowrap;
}

/* 「M/D 適用」チップは修正ラウンド7 M29（B案）で全廃 — スタイルも撤去済み */

/* ---------- 本日の運行ステータス ---------- */

.bgu-bus__today {
  margin: 0 0 20px;
  padding: 14px 18px;
  border: 2px solid var(--bgu-flat-fill);
  border-radius: 14px;
  background: #fff;
}

.bgu-bus__today--special {
  padding-bottom: 18px;
}

.bgu-bus__today-date {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
}

.bgu-bus__today-dia {
  margin: 6px 0 12px;
  font-size: 14px;
}

.bgu-bus__suspended {
  margin: 6px 0 0;
  font-size: 15px;
}

.bgu-bus__suspended strong {
  color: var(--bgu-bus-alert);
  font-size: 17px;
}

.bgu-bus__suspended-reason {
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

/* ---------- 時刻表テーブル（SP 横スクロールなし） ---------- */

.bgu-bus__table-scroll {
  width: 100%;
}

.bgu-bus__table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
  table-layout: fixed;
}

.bgu-bus__caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
}

.bgu-bus__th {
  padding: 8px 8px;
  background: var(--bgu-flat-fill);
  color: #fff; /* M27: 緑背景セルは白抜き（分の数字=白背景セルは濃色のまま） */
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--bgu-flat-fill);
  line-height: 1.4;
}

.bgu-bus__th-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
}

.bgu-bus__th--hour {
  width: 3.2em;
}

.bgu-bus__hour {
  padding: 6px 4px;
  background: var(--bgu-flat-fill);
  color: #fff; /* M27: 時間帯列も白抜き */
  font-weight: 700;
  text-align: center;
  border: 1px solid #fff;
  border-top: none;
  font-variant-numeric: tabular-nums;
}

.bgu-bus__cell {
  padding: 6px 10px;
  border: 1px solid var(--bgu-flat-line);
  text-align: left;
  font-variant-numeric: tabular-nums;
  word-spacing: 2px;
  overflow-wrap: anywhere;
}

.bgu-bus__table tbody tr:nth-child(even) .bgu-bus__cell {
  background: var(--bgu-flat-soft);
}

.bgu-bus__min {
  display: inline-block;
  min-width: 2em;
  letter-spacing: 0.02em;
}

.bgu-bus__footnotes {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

/* ---------- ダイヤ一覧（アコーディオン） ---------- */

.bgu-bus__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 20px;
}

/* M25/M26: 本日カードとの間に上余白 + 既存見出し意匠（左バー）の一段下スタイル */
.bgu-bus__list-title {
  margin: 40px 0 14px;
  padding-left: 12px;
  border-left: 5px solid var(--bgu-flat-fill);
  border-radius: 2px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  line-height: 1.4;
}

.bgu-bus__details {
  border: 1px solid var(--bgu-flat-line);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.bgu-bus__details[open] {
  padding-bottom: 14px;
}

.bgu-bus__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  list-style: none;
  position: relative;
  padding-right: 42px;
  background: #fff;
}

.bgu-bus__summary::-webkit-details-marker {
  display: none;
}

/* 開閉可能と一目で分かる chevron（開閉で回転 — M22） */
.bgu-bus__summary::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -7px;
  border-right: 2px solid var(--Gray, #646f70);
  border-bottom: 2px solid var(--Gray, #646f70);
  transform: rotate(45deg);
  transition: transform 0.2s;
}

.bgu-bus__details[open] > .bgu-bus__summary::after {
  transform: rotate(225deg);
  margin-top: -2px;
}

.bgu-bus__summary:hover {
  background: var(--bgu-flat-soft);
}

/* 本日のダイヤ（初期展開はこれのみ — M22） */
.bgu-bus__details--today {
  border: 2px solid var(--bgu-flat-fill);
}

.bgu-bus__summary-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bgu-bus__summary-dates {
  font-size: 12px;
  font-weight: 500;
  color: var(--bgu-bus-text);
}

.bgu-bus__details > .bgu-bus__table-scroll,
.bgu-bus__details > .bgu-bus__footnotes,
.bgu-bus__details > .bgu-bus__note {
  margin: 12px 14px 0;
  width: auto;
}

/* ---------- 注記・出典 ---------- */

.bgu-bus__note {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--bgu-flat-soft);
  border-radius: 8px;
  font-size: 13px;
}

.bgu-bus__suspend-list {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--bgu-flat-line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
}

.bgu-bus__suspend-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--bgu-bus-alert);
}

.bgu-bus__suspend-list ul {
  margin: 0;
  padding: 0 0 0 1.4em;
}

.bgu-bus__common-notes {
  margin: 0 0 8px;
  padding: 0 0 0 1.4em;
  font-size: 13px;
}

.bgu-bus__source {
  margin: 0;
  font-size: 12px;
  color: #66617a;
}

.bgu-bus__empty {
  margin: 0 0 16px;
  font-size: 14px;
}

/* 指定日モード（M31）: 全時刻表への導線・フォールバック */
.bgu-bus__more-link-wrap {
  margin: 12px 0 0;
}

.bgu-bus__more-link,
.bgu-bus__fallback a {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #333);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bgu-bus__fallback {
  margin: 16px auto;
  max-width: 900px;
  font-size: 14px;
  text-align: left;
}

/* ---------- 次発ランチャー（修正ラウンド2 M9/M10: 白基調・紫はピルのみ・中央寄せ） ---------- */

.bgu-bus-launcher {
  max-width: 800px;
  padding: 20px 22px 18px;
  border: 1px solid #e3e6ec;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(51, 51, 51, 0.06);
}

.bgu-bus-launcher__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin-bottom: 14px;
}

/* 紫の使用はこのピルのみ（M9） */
.bgu-bus-launcher__campus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--campus-Fujimino, #726994);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.bgu-bus-launcher__heading {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  line-height: 1.4;
}

.bgu-bus-launcher__heading-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--Gray, #646f70);
  margin-top: 2px;
}

.bgu-bus-launcher__clock {
  margin: 0;
  font-size: 12px;
  color: var(--Gray, #646f70);
  font-variant-numeric: tabular-nums;
}

/* 本日の適用ダイヤ種別バッジ（M17。M9 の規律内: 平常=ニュートラル／臨時=既存アクセント／運休=機能赤） */
.bgu-bus-launcher__daybadge {
  margin: 2px 0 0;
  display: inline-flex;
  align-items: center;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.bgu-bus-launcher__daybadge--regular {
  background: #eef1f4;
  color: var(--text-secondary, #2b3c4f);
}

.bgu-bus-launcher__daybadge--special {
  background: var(--brand-accent-03, #f46643);
  color: #fff;
}

.bgu-bus-launcher__daybadge--suspended {
  background: #c22929;
  color: #fff;
}

.bgu-bus-launcher__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bgu-bus-launcher__card {
  flex: 1 1 0; /* SP でも横並び 2 カラム（M14） */
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #e9ecf1;
  border-radius: 14px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
}

.bgu-bus-launcher__dir {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.bgu-bus-launcher__dir svg {
  display: block;
  width: 32px;
  height: 32px;
}

/* 校章ロゴは電車ピクト（32px ボックス・実描画約 28px）と視覚等価の高さに揃える（M13） */
.bgu-bus-launcher__logo {
  display: block;
  width: auto;
  height: 27px;
}

.bgu-bus-launcher__dir-arrow svg {
  width: 20px;
  height: 20px;
}

.bgu-bus-launcher__dir-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
}

.bgu-bus-launcher__next {
  margin: 2px 0 0;
  line-height: 1.1;
}

.bgu-bus-launcher__time {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  font-variant-numeric: tabular-nums;
}

.bgu-bus-launcher__countdown {
  margin: 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e3e6ec;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  overflow-wrap: anywhere;
}

.bgu-bus-launcher__status {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f7f8fa;
  font-size: 13px;
  text-align: center;
}

/* バス乗り場セクション（M15: PC=左マップ/右ステップ・SP=縦積み） */
.bgu-bus-launcher__stop {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e9ecf1;
}

.bgu-bus-launcher__stop-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  text-align: center;
}

.bgu-bus-launcher__stop-body {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.bgu-bus-launcher__stop-map {
  flex: 1 1 280px;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid #e3e6ec;
  overflow: hidden;
}

.bgu-bus-launcher__stop-map iframe {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
}

.bgu-bus-launcher__stop-steps {
  flex: 1 1 280px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: bgu-bus-launcher-step;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.7;
  text-align: left;
}

.bgu-bus-launcher__stop-steps li {
  position: relative;
  padding-left: 30px;
  counter-increment: bgu-bus-launcher-step;
}

.bgu-bus-launcher__stop-steps li::before {
  content: counter(bgu-bus-launcher-step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--text-secondary, #2b3c4f);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bgu-bus-launcher__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}

/* サイト標準ボタン意匠（.am-common-button 系統: ピル型・Green・白文字）を流用 */
.bgu-bus-launcher__refresh {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background-color: var(--Green, #02c39a);
  color: var(--White, #fff);
  font-size: 14px;
  font-weight: 700;
  height: 42px;
  padding: 8px 24px;
  cursor: pointer;
  line-height: 1.4;
  transition: 0.5s;
}

.bgu-bus-launcher__refresh svg {
  display: block;
  width: 16px;
  height: 16px;
}

.bgu-bus-launcher__refresh:hover {
  background-color: var(--HoverGreen, #00a896);
}

.bgu-bus-launcher__refresh[disabled] {
  opacity: 0.5;
  cursor: wait;
}

.bgu-bus-launcher__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #333);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bgu-bus-launcher__noscript {
  margin: 12px 0 0;
  font-size: 13px;
}

/* ---------- 乗り場案内 ---------- */

.bgu-bus-stop__body {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

/* M21: 埋め込みマップを主役に（左カラム）。SVG 案内図は撤去済み */
.bgu-bus-stop__map-col {
  flex: 1.3 1 340px;
  min-width: 0;
}

.bgu-bus-stop__embed--primary iframe {
  aspect-ratio: auto;
  height: 260px; /* SP・折返し時の基準高さ */
}

/* M42: PC 2 カラム時は右カラム（ステップ + 注記 + 写真）の高さにマップが追随して揃う */
@media (min-width: 768px) {
  .bgu-bus-stop__body {
    align-items: stretch;
  }

  .bgu-bus-stop__map-col {
    display: flex;
    flex-direction: column;
  }

  .bgu-bus-stop__embed--primary {
    flex: 1 1 auto;
    display: flex;
  }

  .bgu-bus-stop__embed--primary iframe {
    height: auto;
    min-height: 340px;
    flex: 1 1 auto;
  }
}

/* M40: OC ページのアクセス区画では内部コンポーネントの 900px キャップを解除し
   コンテナ（max-w 1200px）の幅体系に一貫させる */
.bgu-bus-full .bgu-bus,
.bgu-bus-full .bgu-bus-stop,
.bgu-bus-full .bgu-bus-launcher {
  max-width: none;
}

.bgu-bus-stop__info {
  flex: 1 1 300px;
  min-width: 0;
}

.bgu-bus-stop__steps {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  counter-reset: bgu-bus-step;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.bgu-bus-stop__steps li {
  position: relative;
  padding-left: 34px;
  counter-increment: bgu-bus-step;
}

.bgu-bus-stop__steps li::before {
  content: counter(bgu-bus-step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bgu-flat-fill);
  color: var(--bgu-flat-ink);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bgu-bus-stop__notes {
  margin: 0 0 16px;
  padding: 12px 14px 12px 2em;
  background: var(--bgu-flat-soft);
  border-radius: 10px;
  font-size: 13px;
}

.bgu-bus-stop__photo {
  margin: 0 0 16px;
  max-width: 360px;
}

.bgu-bus-stop__photo img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--bgu-flat-line);
}

.bgu-bus-stop__photo figcaption {
  margin-top: 4px;
  font-size: 12px;
  color: #66617a;
}

.bgu-bus-stop__embed {
  margin: 0 0 10px;
  border-radius: 14px;
  border: 1px solid var(--bgu-flat-line);
  overflow: hidden;
}

.bgu-bus-stop__embed iframe {
  display: block;
  width: 100%;
  aspect-ratio: 460 / 286;
  border: 0;
}

.bgu-bus-stop__map-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary, #2b3c4f);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- アンカー着地時の余白（/access#fujimino ほか） ---------- */

#fujimino,
#hongo,
#bus-timetable,
#bus-stop-guide {
  scroll-margin-top: 90px;
}

/* ---------- SP ---------- */

@media (max-width: 767px) {
  .bgu-bus,
  .bgu-bus-launcher,
  .bgu-bus-stop {
    font-size: 14px;
    margin: 32px auto;
  }

  .bgu-bus__heading {
    font-size: 18px;
  }

  .bgu-bus__table {
    font-size: 12px;
  }

  .bgu-bus__cell {
    padding: 5px 6px;
    word-spacing: 1px;
  }

  .bgu-bus__min {
    min-width: 1.8em;
  }

  .bgu-bus__th--hour {
    width: 2.6em;
  }

  .bgu-bus-launcher {
    padding: 18px 14px 14px;
  }

  /* M14: SP でも方向カードは横並び 2 カラム（320px 幅ではみ出さないサイズへ縮小） */
  .bgu-bus-launcher__grid {
    gap: 8px;
  }

  .bgu-bus-launcher__card {
    padding: 12px 6px;
    gap: 4px;
  }

  .bgu-bus-launcher__dir svg {
    width: 26px;
    height: 26px;
  }

  .bgu-bus-launcher__logo {
    height: 22px;
  }

  .bgu-bus-launcher__dir-arrow svg {
    width: 16px;
    height: 16px;
  }

  .bgu-bus-launcher__dir {
    gap: 6px;
  }

  .bgu-bus-launcher__dir-label {
    font-size: 10px;
  }

  .bgu-bus-launcher__time {
    font-size: 26px;
  }

  .bgu-bus-launcher__countdown {
    font-size: 11px;
    padding: 2px 8px;
  }

  .bgu-bus-launcher__stop-map iframe {
    height: 200px;
  }
}
