/* ==========================================================================
   11. コース詳細ページ
   ========================================================================== */
.detail-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-700);
  margin-bottom: var(--space-4);
}

.detail-back-link:hover {
  color: var(--accent-dark);
}

/* 写真は右カラム上部（またはモバイル最上部）。全幅ヒーローをやめ、列幅に対して 3:2 の
   ランドスケープで表示する（画像上に文字は乗せない＝可読性優先）。 */
.detail-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 3 / 2;
}

.detail-hero__image {
  position: absolute;
  inset: 0;
}

.detail-hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.55) 100%);
}

.detail-hero__content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-5);
  color: #fff; /* 意図的な例外: 暗い写真スクリム上の白文字（トークン化しない） */
}

.detail-hero__title {
  font-size: var(--text-2xl);
  color: #fff;
}

.detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.92);
}

/* コース写真ギャラリー（#30a）: メイン大写真 + サブサムネイル横列（booking.com のホテル詳細風）。
   写真0〜1枚（mock 含む）はサムネ列が hidden のままで現行の1枚表示と同じ見た目になる。 */
.detail-gallery {
  /* 余白はレイアウトグリッドの gap が持つ（モバイルは行gap、デスクトップは右カラム内の row-gap）。 */
  margin: 0;
}

/* 写真到着後にメイン背景divへ重ねる <img>（読み込み中は背後のグラデーション/背景画像が見える） */
.detail-hero__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* サムネ列: モバイル375pxでも崩れないよう横スクロール1列に閉じ込める */
.detail-gallery__thumbs {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 2px; /* 選択枠線・フォーカスリングのクリップ防止 */
}

.detail-gallery__thumb {
  flex: 0 0 auto;
  width: 96px;
  height: 64px; /* タップターゲット44px以上を確保 */
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.detail-gallery__thumb:hover,
.detail-gallery__thumb:focus-visible {
  opacity: 1;
}

.detail-gallery__thumb.is-selected {
  border-color: var(--accent);
  opacity: 1;
}

.detail-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* モバイル: 単一カラム。DOM順（ギャラリー→本文→サマリー）でそのまま縦積み＝画像が最上部。 */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

/* grid item の min-width:auto により子（時間チップ列など）の intrinsic 幅が
   親に伝播して横溢れするのを防ぐ。.plan-times の overflow-x:auto を効かせる前提 */
.detail-main {
  min-width: 0;
}

/* コース名・所在地・評価の左カラム見出し（画像上オーバーレイの置き換え）。 */
.detail-heading {
  margin-bottom: var(--space-6);
}

.detail-heading__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: var(--space-2);
}

.detail-heading__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-700);
}

/* デスクトップ: 左=本文（見出し＋各セクション）、右=画像→サマリー（min-content 1fr で
   右カラムを上詰めに密着させる。実測で確認済み）。 */
@media (min-width: 960px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: min-content 1fr;
    grid-template-areas:
      'main gallery'
      'main summary';
    align-items: start;
    column-gap: var(--space-6);
    row-gap: var(--space-5);
  }
  .detail-layout > .detail-gallery {
    grid-area: gallery;
  }
  .detail-layout > .detail-main {
    grid-area: main;
  }
  .detail-layout > .detail-summary-card {
    grid-area: summary;
  }
}

.detail-section {
  margin-bottom: var(--space-6);
}

.detail-section__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

/* コース情報セクション内の属性ピル列（コースデータ定義リストの下）。
   旧 detail.js のインライン style="margin-top: 12px" をこちらへ集約。 */
.detail-section .course-card__tags {
  margin-top: var(--space-3);
}

/* タブ（プラン一覧 / コース情報）。js/components/tabs.js の tabsHtml と対。
   下線タイプ（選択中のタブに --accent の下線）。ピル型ボタンが並ぶツールバーと
   見た目がぶつからないよう、あえて軽い表現にしている。 */
.tabs__list {
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-5);
  /* タブ名が長い場合（プラン一覧（19件）等）はモバイルで横スクロールさせる。
     ページ本体には横スクロールを出さない。 */
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs__list::-webkit-scrollbar {
  display: none;
}

.tabs__tab {
  flex-shrink: 0;
  appearance: none;
  background: none;
  border: none;
  /* 下線ぶんの余白を確保して、選択時に文字が動かないようにする */
  padding: var(--space-3) 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; /* リストの1px線に重ねる */
  color: var(--ink-500);
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
}

.tabs__tab:hover {
  color: var(--ink-900);
}

.tabs__tab.is-active {
  color: var(--ink-900);
  border-bottom-color: var(--accent);
}

.tabs__tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* コース規模の1行サマリー（見出し直下・常時表示）。タブを開かなくても規模が分かる。 */
.detail-heading__specs {
  margin: var(--space-2) 0 0;
  color: var(--ink-500);
  font-size: var(--text-sm);
}

/* コース情報の定義リスト（ホール数・パー・全長・コースタイプ・高低差・設計者・練習場・最寄IC）。
   実データが揃ってから表示する（js/views/detail.js の fillCourseSpecs）。行の見た目は
   サマリーカードの .stat-row と揃える（同じ「ラベル / 値」の対）。 */
.detail-specs {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 520px;
}

.detail-specs__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-sm);
}

.detail-specs__row:last-child {
  border-bottom: none;
}

.detail-specs__label {
  flex-shrink: 0;
  width: 6.5em;
  color: var(--ink-500);
}

.detail-specs__value {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--ink-900);
}

.detail-summary-card {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-sm);
}

.stat-row:last-of-type {
  border-bottom: none;
}

.stat-row__label {
  color: var(--ink-500);
}

.stat-row__value {
  font-weight: 700;
  color: var(--ink-900);
}

.plan-list {
  display: flex;
  flex-direction: column;
}

/* プラン行の区切り: 個別カード枠（border一周）はやめ、全幅リスト + 行間ディバイダーに統一した
   （タスク: 行の視認性向上。方針(a)。docs/UI-GUIDE.md §9/§11a参照）。個別カード枠だと
   プラン一覧モーダル・詳細ページのプラン一覧で「カードの中にカード」のような二重の枠が
   でき、Airbnb的なクリーンなトーンを崩すため、区切りはボーダーのみで表現する。1行目には
   border-top を付けない（親コンテナ側の枠と二重線にならないように `+ .plan-row` セレクタで
   2行目以降にのみ適用）。ホバー時は淡い背景でフィードバックする。 */
.plan-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-2);
  transition: background var(--transition-fast);
}

.plan-row + .plan-row {
  border-top: 1px solid var(--border-color);
}

.plan-row__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* flex item の min-width:auto による時間チップ列の横溢れ防止 */
}

/* 下段フッター: 左に総額（ラベル・金額・税込/1人）、右にボタン群を固定配置する
   （タスク: プラン行レイアウトの統一。プラン名の長さに関わらず、上段 .plan-row__info の
   高さが変わるだけで、料金・ボタンの位置は全行で同一になる）。 */
.plan-row__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.plan-row__title {
  font-weight: 700;
  color: var(--ink-900);
}

.plan-row__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-1);
}

/* ==========================================================================
   11b. プラン行の時間チップ（.plan-times）+ コンテキストメニュー
   旧「プラン別ティータイム ポップオーバー」（.plan-frames-popover、「残りN枠」クリック起点）を
   置き換える常時表示チップ列。横スクロール1列（time slots が多いプランでもページ全体は
   横スクロールしない = overflow-x はこのコンテナ自身に閉じる）。スクロールバーは
   .filter-pills（§5）と同じ「細い/隠す」パターンを踏襲する。
   ========================================================================== */
.plan-times {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: var(--space-1);
  padding-block: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.plan-times::-webkit-scrollbar {
  height: 4px;
}

.plan-times::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-pill);
}

/* #20 スクロール手がかり: 時間チップが右端で見切れているとき（scrollWidth > clientWidth）に、
   まだ続きがある側のチップをフェードアウトさせて「横にスクロールできる」ことを可視化する。
   クラスは bindPlanTimes（plan-row.js）が overflow / scrollLeft を実測して付け外しする
   （chip 側のマスクなのでタップ判定には影響しない）。スクロールバーは細い/隠す方針のため、
   モバイルのタッチではこのフェードが唯一の手がかりになる。 */
.plan-times.can-scroll-right {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.plan-times.can-scroll-left {
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
}

.plan-times.can-scroll-left.can-scroll-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}

.plan-time-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink-900);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast),
    color var(--transition-fast);
}

.plan-time-chip:hover,
.plan-time-chip:focus-visible {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
  outline: none;
}

/* 取得中のプレースホルダー（4個並べてレイアウトシフトを抑える） */
.plan-time-chip--skeleton {
  width: 46px;
  height: 24px;
  border: none;
  cursor: default;
}

.plan-times__empty {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.plan-times__fallback-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: underline;
}

/* アクションメニュー共通部品（js/components/menu.js の openActionMenu）。
   プラン時間チップのコンテキストメニューと統合ビューの ellipsis（…）メニューが共用する
   （旧 .plan-time-menu を汎用化してリネーム）。 */
.action-menu {
  z-index: 1000;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.action-menu__item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--ink-900);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.action-menu__item:hover,
.action-menu__item:focus-visible {
  background: var(--surface-sunken);
  outline: none;
}

/* 削除系項目（リストを削除 等）は赤文字 */
.action-menu__item--danger {
  color: var(--danger);
}

.plan-row__price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex-shrink: 0;
}

.plan-row__price-label {
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.plan-row__price-value {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--ink-900);
}

.plan-row__price-sub {
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.plan-row__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* モバイル: 左右分割を維持する（375px幅でも price / actions は横並びのまま収まる）。
   価格の桁数（¥5,500 と ¥12,800 等）によって必要幅が数px変わるため、375px幅ちょうどだと
   桁数の多い行だけ折り返して同じコース内で行ごとに配置がバラつく不具合があった
   （実測: .btn-shortlist の余白を詰める前は行によって折り返しが発生/非発生に分かれた）。
   ボタン・ギャップを少し詰めて、想定する最大桁数の料金でも1行に収まる余裕を確保する。 */
@media (max-width: 480px) {
  .plan-row__footer {
    gap: var(--space-2);
  }

  .plan-row__actions {
    gap: 6px;
  }

  .plan-row__actions .btn-shortlist {
    padding: 7px 10px;
    gap: var(--space-1);
  }
}

/* 上記の圧縮でも収まらない極端に狭い画面（iPhone SEクラス未満）だけ、
   最終フォールバックとして縦積みにする。その際も「料金→ボタン」の順を保つ
   （flex-direction: column で自然にこの順になる）。 */
@media (max-width: 340px) {
  .plan-row__footer {
    flex-wrap: wrap;
  }

  .plan-row__actions {
    flex-wrap: wrap;
  }
}

