/* ==========================================================================
   7. ヒーロー検索バー
   ========================================================================== */
.hero {
  padding-block: var(--space-7) var(--space-6);
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 100%);
  text-align: center;
}

.hero__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

@media (min-width: 960px) {
  .hero__inner {
    padding-inline: var(--space-6);
  }
}

.hero__title {
  font-size: var(--text-2xl);
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

@media (min-width: 640px) {
  .hero__title {
    font-size: var(--text-3xl);
  }
}

.hero__subtitle {
  font-size: var(--text-md);
  color: var(--ink-700);
  max-width: 480px;
}

.search-bar {
  width: 100%;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  text-align: left;
}

.search-bar__field {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  /* ラベル含むフィールド全体がクリック領域（search.js がコントロールへ転送する） */
  cursor: pointer;
}

/* 区切り線: border だとフィールドの border-radius で端が丸く曲がるため疑似要素で直線を描く */
.search-bar__field::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-4);
  right: var(--space-4);
  height: 1px;
  background: var(--border-color);
}

.search-bar__field:first-of-type::before {
  display: none;
}

.search-bar__field:hover,
.search-bar__field:focus-within {
  background: var(--surface-sunken);
}

.search-bar__field-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-900);
}

.search-bar__field-input {
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
  /* 16px: iOSで入力フォーカス時の自動ズームを防ぎつつ、可読性のため少し大きめにする */
  font-size: var(--text-md);
  color: var(--ink-700);
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

/* iOS/WebKit の <input type="date"> は値テキストを既定で中央寄せするため、
   他フィールド（エリア/時間帯ボタン）と左端が揃うよう明示的に左寄せする。 */
.search-bar__field-input::-webkit-date-and-time-value {
  text-align: left;
}

.search-bar__field-input:focus {
  outline: none;
}

.search-bar__field-input.select {
  border: none;
  padding: 0 20px 0 0;
  background-position: right 0 center;
}

.search-bar__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.search-bar__submit:hover {
  background: var(--accent-dark);
}

@media (min-width: 640px) {
  .search-bar {
    flex-direction: row;
    align-items: stretch;
    padding: var(--space-2);
    border-radius: var(--radius-pill);
  }

  .search-bar__field {
    padding-inline: var(--space-5);
    justify-content: center;
  }

  .search-bar__field::before {
    top: var(--space-2);
    bottom: var(--space-2);
    left: 0;
    right: auto;
    width: 1px;
    height: auto;
  }

  .search-bar__submit {
    margin: 0;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: var(--radius-pill);
    align-self: center;
  }

  .search-bar__submit-label {
    display: none;
  }
}

/* 検索トップの「詳細条件（任意）」折りたたみ。見た目は結果画面サイドバーのアコーディオン
   （.sidebar-accordion）を再利用し、検索バー（max-width 880px）と横幅・左寄せを揃える。
   中身のフィルターセクションは results-filters.js の filterSectionsHtml を共有する。 */
.search-detail {
  width: 100%;
  max-width: 880px;
  text-align: left;
}

/* 検索トップだけフルラウンド化: 検索バー（>=640pxでピル型）・結果画面のソートドロップダウン
   （.select--sort = radius-pill）と丸みを揃える。<details> の外枠のままピル化すると開いた
   ときに縦長の箱ごと丸まって崩れるため、外枠は summary（トリガー）側に移し、開いたパネルは
   margin-top で分離した角丸カードにする（閉=ピル / 開=トリガーはピルのまま）。
   サイドバーの「詳細絞り込み」は他フィールド（radius-md）と揃える現状のままにする。
   ※ .sidebar-accordion（後方で定義）の border/background に同点詳細度で負けないよう
   compound セレクタで上書きする。 */
.sidebar-accordion.search-detail {
  border: none;
  background: transparent;
}

.sidebar-accordion.search-detail > .sidebar-accordion__summary {
  min-height: 44px;
  padding: 8px var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.sidebar-accordion.search-detail > .sidebar-accordion__summary:hover {
  border-color: var(--ink-400);
}

.sidebar-accordion.search-detail > .sidebar-accordion__body {
  margin-top: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

/* 検索トップの詳細条件はクリアのみ（「N件を表示」は結果画面側の役割）。左寄せで軽く見せる。 */
.search-detail .sidebar-detail__actions {
  justify-content: flex-start;
}

/* 使い方3ステップ（検索フォーム直下）。検索 → 検討リストに追加 → みんなで投票 の流れを
   アイコン＋短い見出し＋補足1行だけで控えめに示す。検索バー（max-width 880px）と横幅を揃える。
   モバイル（<640px）は縦積み（アイコン左・テキスト右のコンパクトな行）、640px以上は3カラム。 */
.usage {
  width: 100%;
  max-width: 880px;
  /* 検索フォームとの間隔を広げる。.hero__inner の flex gap（--space-5 = 24px）に
     margin-top（--space-7 = 48px）を足し、合計 72px = 従来間隔（24px）の3倍にする。 */
  margin-top: var(--space-7);
}

.usage__caption {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink-900);
  text-align: center;
  margin-bottom: var(--space-4);
}

.usage-steps {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.usage-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.usage-step__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent-dark);
}

.usage-step__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.usage-step__title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink-900);
}

.usage-step__desc {
  font-size: var(--text-sm);
  color: var(--ink-500);
}

@media (min-width: 640px) {
  .usage-steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* エリア / スタート時間帯 のマルチセレクト（チェックボックス・ポップアップ）。
   同じ見た目・挙動のパターンなので、時間帯ピッカー（.time-picker*）はエリアピッカーの
   ルールをそのまま共有する（クラス名を並記してCSSの重複を避ける。地方まとめてチェック等
   エリア固有の要素は .area-picker__region のように単独のままでよい）。 */
.area-picker,
.time-picker,
.date-picker {
  position: relative;
}

.area-picker__toggle,
.time-picker__toggle,
.date-picker__toggle {
  text-align: left;
  cursor: pointer;
  color: var(--ink-700);
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.area-picker__popup,
.time-picker__popup {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: 60;
  width: min(560px, calc(100vw - 32px));
  max-height: min(440px, 70vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  text-align: left;
  cursor: default;
}

.area-picker__groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.area-picker__group {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.area-picker__region {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: var(--space-2);
  cursor: pointer;
}

.area-picker__prefs,
.time-picker__options {
  /* 等幅グリッドで各項目の左端（チェックボックス）を縦に揃える。flex-wrap だと
     ラベル幅がバラつき列の縦ラインがずれるため grid に変更。auto-fit + 1fr で
     ポップアップ幅に応じて列数が変わっても各列は等幅・チェックボックスが整列する。 */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--space-2) var(--space-4);
}

.area-picker__pref,
.time-picker__option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--ink-700);
  cursor: pointer;
  min-width: 88px;
}

.area-picker__pref input,
.area-picker__region input,
.time-picker__option input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.area-picker__footer,
.time-picker__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-color);
}

/* モバイル: ポップアップは検索バー（field）幅いっぱいに広げる */
@media (max-width: 639px) {
  .area-picker__popup,
  .time-picker__popup {
    width: calc(100vw - 48px);
    max-width: 100%;
    left: 50%;
    transform: translateX(-50%);
  }

  /* a11y（#20）: 選択フィールド（エリア県/地方/時間帯のチェックボックス行）の
     タップターゲットをラベル全体で 44px 以上確保する。ラベルは input+テキストを内包し
     クリック判定は行全体（cursor:pointer）なので、min-height を足すだけでヒット領域が
     44px に広がる。デスクトップ（>=640px）は従来の 22px 密度のまま影響しない。 */
  .area-picker__pref,
  .area-picker__region,
  .time-picker__option {
    min-height: 44px;
  }
}

/* プレー日カレンダー（date-picker。js/components/date-picker.js）。
   ネイティブ <input type="date"> の置き換え。ポップアップの外殻トークン（角丸・影・余白）は
   エリア/時間ピッカーと共通。サイドバー内は .sidebar-picker__popup を併記して幅100%等の
   サイドバー流儀を継承する（§8 のルールがソース順で勝つ）。 */
.date-picker__popup {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: 60;
  width: min(316px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  text-align: left;
  cursor: default;
}

.date-picker__popup[hidden] {
  display: none;
}

.date-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.date-picker__month {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-900);
}

.date-picker__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
}

.date-picker__nav:hover:not(:disabled) {
  background: var(--surface-sunken);
}

.date-picker__nav:disabled {
  color: var(--ink-300);
  cursor: default;
}

.date-picker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-picker__weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-500);
}

/* 日曜=赤系・土曜=青系の控えめな色分け（ゴルフは週末利用が多いため視認の手がかりにする。
   彩度を落とした専用色。--danger 等のセマンティック色は流用しない）。 */
.date-picker__weekday--sun {
  color: var(--cal-sun);
}

.date-picker__weekday--sat {
  color: var(--cal-sat);
}

.date-picker__day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink-800);
  cursor: pointer;
}

.date-picker__day--empty {
  cursor: default;
}

.date-picker__day--sun:not(:disabled):not(.is-selected) {
  color: var(--cal-sun);
}

.date-picker__day--sat:not(:disabled):not(.is-selected) {
  color: var(--cal-sat);
}

.date-picker__day:hover:not(:disabled):not(.is-selected) {
  background: var(--surface-sunken);
}

/* 今日マーカー: アクセント緑の細リング（選択日の塗りと混同しない控えめな表現）。 */
.date-picker__day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}

.date-picker__day.is-selected {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
}

.date-picker__day:disabled {
  color: var(--ink-300);
  cursor: default;
}

/* モバイル: ヒーロー検索バーのカレンダーは中央寄せ + セルのタップターゲットを44px相当に。
   （サイドバー内はドロワー幅に追従するため中央寄せの transform は掛けない）。 */
@media (max-width: 639px) {
  .search-bar .date-picker__popup {
    width: calc(100vw - 32px);
    max-width: 360px;
    left: 50%;
    transform: translateX(-50%);
  }

  .date-picker__day {
    min-height: 44px;
  }
}

