/* 共通ヘッダーの国検索(src/motion/headerSearch.ts)。寸法・色・動きはAppleのヘッダー検索の実測値 */
.gn-tools { gap: 38px; align-items: center; }
.gn-search-button { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; }
.gn-search-button svg { display: block; width: 15px; height: 15px; }

.gn-search { --gn-search-clear-mark: #fafafc; position: absolute; left: 0; right: 0; top: 100%; overflow: hidden; visibility: hidden; height: 0; background: #fafafc; color: #333336; transition: height 0.24s cubic-bezier(0.4, 0, 0.6, 1), visibility 0.24s step-end; }
.gn-search.is-open { visibility: visible; transition: height 0.24s cubic-bezier(0.4, 0, 0.6, 1), visibility 0.24s step-start; }
.gn-dark .gn-search { --gn-search-clear-mark: #161617; background: #161617; color: #e8e8ed; }

.gn-search-inner { box-sizing: content-box; max-width: 980px; max-height: calc(100vh - 124px); overflow-y: auto; margin: 0 auto; padding: 32px 22px 80px; opacity: 0; transition: opacity 0.2s linear; }
.gn-search.is-open .gn-search-inner { opacity: 1; transition-delay: 0.08s; }

/* 入力欄。文字の頭を見出しより少し右へ、虫眼鏡は見出しの頭に揃える */
.gn-search-form { position: relative; height: 40px; margin: 0; }
.gn-search-input { display: block; box-sizing: border-box; width: calc(100% + 12px); height: 40px; margin-inline: -6px; padding: 0 34px; border: 0; border-radius: 0; outline: 0; background: transparent; color: inherit; font-family: inherit; font-size: 24px; line-height: 24px; font-weight: 600; letter-spacing: 0.009em; text-overflow: ellipsis; appearance: none; }
.gn-search-input::placeholder { color: #6e6e73; opacity: 1; }
.gn-dark .gn-search-input::placeholder { color: #86868b; }
.gn-search-field-icon { position: absolute; inset-inline-start: 0; top: 11px; width: 18px; height: 18px; color: #6e6e73; pointer-events: none; }
.gn-dark .gn-search-field-icon { color: #86868b; }
.gn-search-field-icon svg { display: block; width: 100%; height: 100%; }
.gn-search-clear { position: absolute; inset-inline-end: -4px; top: 8px; width: 24px; height: 24px; padding: 4px; border: 0; background: none; color: #6e6e73; cursor: pointer; }
.gn-dark .gn-search-clear { color: #86868b; }
.gn-search-clear[hidden] { display: none; }
.gn-search-clear svg { display: block; width: 16px; height: 16px; }
.gn-search-close { display: none; }

/* 候補 */
.gn-search-results { margin-top: 32px; }
.gn-search-heading { margin: 0; color: #6e6e73; font-size: 12px; line-height: 16px; font-weight: 400; }
.gn-dark .gn-search-heading { color: #86868b; }
.gn-search-heading[hidden], .gn-search-list[hidden], .gn-search-empty[hidden] { display: none; }
.gn-search-list { margin: 7px -8px 0; padding: 0; list-style: none; }
.gn-search-row + .gn-search-row { margin-top: 4px; }
.gn-search-option { display: flex; align-items: center; gap: 8px; box-sizing: border-box; min-height: 24px; padding: 4px 8px; border-radius: 6px; color: #333336; font-size: 12px; line-height: 16px; font-weight: 600; text-decoration: none; }
.gn-dark .gn-search-option { color: #e8e8ed; }
.gn-search-option:hover, .gn-search-option[aria-selected="true"] { background: #f5f5f7; color: #1d1d1f; }
.gn-dark .gn-search-option:hover, .gn-dark .gn-search-option[aria-selected="true"] { background: #2a2a2d; color: #fff; }
.gn-search-flag { flex: none; font-size: 14px; line-height: 16px; }
.gn-search-empty { margin: 0; color: #6e6e73; font-size: 12px; line-height: 16px; }
.gn-dark .gn-search-empty { color: #86868b; }

/* 後ろの幕。flyoutと同じ html::after を使う。クリックを受けて閉じるので pointer-events を戻す */
html.gn-search-open::after { visibility: visible; opacity: 1; pointer-events: auto; transition: opacity 0.32s cubic-bezier(0.4, 0, 0.6, 1) 80ms, visibility 0.32s step-start 80ms; }

@media (max-width: 833px) {
  .gn-tools { gap: 18px; }
  .gn-search-button svg { width: 24px; height: 24px; }
}

/* スマホは全画面 */
@media (max-width: 734px) {
  html.gn-search-open body { overflow: hidden; }
  .gn-search { position: fixed; inset: 0; z-index: 1; height: 100%; opacity: 0; transition: opacity 0.24s cubic-bezier(0.4, 0, 0.6, 1), visibility 0.24s step-end; }
  .gn-search.is-open { opacity: 1; transition: opacity 0.24s cubic-bezier(0.4, 0, 0.6, 1), visibility 0.24s step-start; }
  .gn-search-inner { box-sizing: border-box; max-width: none; max-height: none; height: 100%; padding: 54px 48px 48px; }
  .gn-search-form { height: 38px; }
  .gn-search-input { width: 100%; height: 38px; margin-inline: 0; padding-block: 0; padding-inline: 34px 26px; font-size: 28px; line-height: 28px; letter-spacing: 0.007em; }
  .gn-search-field-icon { top: 8px; width: 22px; height: 22px; }
  .gn-search-clear { inset-inline-end: -4px; top: 7px; }
  .gn-search-close { position: absolute; inset-inline-end: 3px; top: 2px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
  .gn-search-close svg { display: block; width: 18px; height: 18px; }
  .gn-search-results { margin-top: 49px; }
  .gn-search-heading { font-size: 17px; line-height: 21px; }
  .gn-search-list { margin: 10px -12px 0; }
  .gn-search-row + .gn-search-row { margin-top: 6px; }
  .gn-search-option { min-height: 33px; padding: 4px 12px 3px; font-size: 17px; line-height: 26px; }
  .gn-search-flag { font-size: 18px; line-height: 26px; }
  .gn-search-empty { font-size: 17px; line-height: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .gn-search, .gn-search.is-open, .gn-search-inner, .gn-search.is-open .gn-search-inner { transition: none; }
}
