/* ============================
   History page (Timeline)
============================ */

/* 既存の .section p の “左右padding” が History に入ると読みにくいので打ち消す */
.history-section p,
.history-section li {
  padding: 0;
}

/* タイトル周り */
.history-intro {
  text-align: center;
  margin-bottom: 22px;
}

.history-eyebrow {
  font-family: "Cinzel", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  opacity: 0.65;
  margin-bottom: 6px;
}

.history-title {
  font-family: "Cinzel", serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 10px 0;
}

.history-subtitle {
  margin: 0 auto;
  max-width: 74ch;
  font-family: "Libre Baskerville", serif;
  font-size: clamp(1rem, 1.1vw, 1.1rem);
  opacity: 0.82;
}

/* 重要ポイントのボックス */
.history-callout {
  margin: 22px auto 18px;
  max-width: 1100px;
  padding: 18px 18px;
  border-radius: 18px;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.82),
    rgba(240, 247, 255, 0.62)
  );
  border: 1px solid rgba(40, 110, 220, 0.10);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.05);
}

.history-callout__title {
  font-family: "Cinzel", serif;
  font-size: 18px;
  margin-bottom: 10px;
}

.history-callout__list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-family: "Libre Baskerville", serif;
  opacity: 0.9;
}

/* ツールバー（フィルタ / 検索） */
.timeline-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin: 18px 0 18px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(250, 247, 240, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  /* ★スクロールしても常に操作できるように（ヘッダーの下） */
  position: sticky;
  top: 110px;
  z-index: 50;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tl-chip {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 10px;

  font-family: "Libre Baskerville", serif;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.05);

  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.tl-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.07);
}

.tl-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--tl-accent, rgba(40, 110, 220, 0.9));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85);
}

.tl-chip[data-lane="world"] { --tl-accent: rgba(75, 105, 135, 0.95); }
.tl-chip[data-lane="japan-nagasaki"] { --tl-accent: rgba(40, 110, 220, 0.95); }
.tl-chip[data-lane="goto"] { --tl-accent: rgba(179, 120, 24, 0.95); }

.tl-chip:not(.is-active) {
  opacity: 0.45;
}

.timeline-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tl-label {
  font-family: "Cinzel", serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.tl-search {
  width: min(320px, 70vw);
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.tl-search:focus {
  outline: 2px solid rgba(40, 110, 220, 0.35);
  outline-offset: 2px;
}

.tl-clear {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;

  font-family: "Libre Baskerville", serif;
  font-size: 13px;

  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tl-clear:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
}

.tl-count {
  font-family: "Libre Baskerville", serif;
  font-size: 12px;
  opacity: 0.72;
  margin-left: 6px;
}

/* JSが無いときの表示 */
.tl-noscript {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.75);
  font-family: "Libre Baskerville", serif;
  opacity: 0.85;
}

/* レイアウト（タイムライン + 詳細） */
.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.timeline-wrap {
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

/* ここにJSで tl-grid を生成する */
.timeline {
  position: relative;
  padding: 18px;
}

/* 目盛り + レーンを並べるグリッド */
.tl-grid {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 16px;
  align-items: start;
}

.tl-scale {
  position: relative;
}

/* 目盛りの縦線 */
.tl-scale::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 16px;
  width: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.10);
}

.tl-tick {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.tl-tick__line {
  width: 10px;
  height: 2px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.18);
}

.tl-tick__label {
  font-family: "Cinzel", serif;
  font-size: 12px;
  opacity: 0.72;
  white-space: nowrap;
}

/* レーン群（3列） */
.tl-stage {
  position: relative;
}

.tl-gridlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.tl-gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
}

.tl-lanes {
  position: relative;
  z-index: 1;

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* 1レーン */
.tl-lane {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.62);

  /* 上にレーンタイトル、下に余白 */
  padding: 54px 12px 24px 12px;

  /* absoluteなイベントがあるので高さはJSで min-height を入れる */
  overflow: visible;
}

/* 各レーンのアクセント */
.tl-lane--world { --tl-accent: rgba(75, 105, 135, 0.95); }
.tl-lane--japan-nagasaki { --tl-accent: rgba(40, 110, 220, 0.95); }
.tl-lane--goto {
  --tl-accent: rgba(179, 120, 24, 0.95);
  background: linear-gradient(
    180deg,
    rgba(255, 248, 235, 0.78),
    rgba(255, 255, 255, 0.60)
  );
  border-color: rgba(179, 120, 24, 0.22);
}

/* レーンタイトル */
.tl-lane__header {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 14px;

  display: flex;
  align-items: center;
  gap: 10px;
}

.tl-lane__marker {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--tl-accent);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85);
}

.tl-lane__title {
  font-family: "Cinzel", serif;
  font-size: 15px;
  letter-spacing: 0.02em;
  margin: 0;
}

/* レーンの縦トラック */
.tl-lane::before {
  content: "";
  position: absolute;
  left: 21px;  /* イベントのドット中心と揃える */
  top: 54px;
  bottom: 18px;
  width: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.10);
}

/* レーンをOFFにしたとき */
.tl-lane.is-off {
  opacity: 0.45;
  filter: grayscale(0.15);
}

/* イベント */
.tl-event {
  position: absolute;
  left: 12px;
  right: 12px;
  transform: translateY(-50%) translateY(12px);
  opacity: 0;

  transition: opacity 0.35s ease, transform 0.35s ease;
}

.tl-event.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateY(0);
}

/* listitemとして扱う */
.tl-event[role="listitem"] {
  list-style: none;
}

.tl-event__btn {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;

  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;

  text-align: left;
  font: inherit;
}

.tl-event__btn:focus-visible {
  outline: 2px solid rgba(40, 110, 220, 0.35);
  outline-offset: 6px;
  border-radius: 14px;
}

.tl-event__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--tl-accent);
  justify-self: center;
  margin-top: 12px;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.90),
    0 0 0 7px rgba(0, 0, 0, 0.06);
}

/* イベントのカード */
.tl-event__content {
  display: block;
  padding: 10px 12px;
  border-radius: 16px;

  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 3px solid var(--tl-accent);

  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);

  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tl-event__btn:hover .tl-event__content {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.08);
}

.tl-event__year {
  display: inline-block;
  font-family: "Cinzel", serif;
  font-size: 12px;
  opacity: 0.75;
  margin-right: 8px;
}

.tl-event__name {
  font-family: "Libre Baskerville", serif;
  font-size: 14px;
  font-weight: 700;

  /* 長すぎるタイトルを見やすく */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  /* 標準プロパティ（lint対策 + 将来互換） */
  line-clamp: 2;

  overflow: hidden;
}


/* 選択中 */
.tl-event.is-selected .tl-event__content {
  border-color: rgba(0, 0, 0, 0.12);
  border-left-color: var(--tl-accent);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.10);
  transform: translateY(-2px);
}

/* 詳細パネル */
.timeline-detail {
  position: sticky;
  top: 110px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.05);
  padding: 18px 18px;
}

.timeline-detail__inner {
  display: grid;
  gap: 10px;
}

.timeline-detail__hint {
  font-family: "Libre Baskerville", serif;
  opacity: 0.8;
}

.timeline-detail__tip {
  font-family: "Libre Baskerville", serif;
  opacity: 0.7;
  font-size: 0.95rem;
}

.timeline-detail__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.timeline-detail__close {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;

  display: grid;
  place-items: center;
}

.timeline-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.timeline-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;

  font-family: "Libre Baskerville", serif;
  font-size: 12px;

  background: rgba(250, 247, 240, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.timeline-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--tl-accent);
}

.timeline-badge--world { --tl-accent: rgba(75, 105, 135, 0.95); }
.timeline-badge--japan-nagasaki { --tl-accent: rgba(40, 110, 220, 0.95); }
.timeline-badge--goto { --tl-accent: rgba(179, 120, 24, 0.95); }

.timeline-detail__year {
  font-family: "Cinzel", serif;
  font-size: 12px;
  opacity: 0.75;
}

.timeline-detail__title {
  font-family: "Cinzel", serif;
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
}

.timeline-detail__remark {
  font-family: "Libre Baskerville", serif;
  opacity: 0.9;
  line-height: 1.7;
  margin: 0;
}

/* レスポンシブ */
@media (max-width: 980px) {
  .history-grid {
    grid-template-columns: 1fr;
  }

  .timeline-detail {
    position: static;
  }

  /* 横幅が足りない端末では、タイムラインだけ横スクロール可能に */
  .timeline-wrap {
    overflow-x: auto;
  }

  .tl-grid {
    min-width: 980px;
  }
}

@media (max-width: 640px) {
  .section.history-section {
    padding: 26px;
  }

  .timeline-toolbar {
    top: 100px;
  }

  .tl-search {
    width: 100%;
  }
}

/* 動きを減らしたいユーザー向け */
@media (prefers-reduced-motion: reduce) {
  .tl-event,
  .tl-event__content,
  .tl-chip,
  .tl-clear {
    transition: none !important;
  }
}

