/* ===== IOSP Search — フルカスタム検索UI（新DS v2「版ズレ編集」先行適用） =====
 * スコープ: .iosp-search（オーバーレイ） / .iosp-search-page（検索結果ページ）
 * トークンは design-system/lib/tokens.css から必要分をローカル定義（サイト全体を汚さない）
 */
.iosp-search,
.iosp-search-page {
  --ds-cream: #f7f3ea;
  --ds-ink: #1a1714;
  --ds-yellow: #ffd400;
  --ds-accent: #d6006e;
  --ds-accent-text: #b3005f;
  --ds-rule: #e2dac9;
  --ds-muted: #6e6353;
  --ds-card-bg: #ffffff;
  --ds-ff-gothic: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --ds-ff-body: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --ds-ff-hand: "Zen Kurenaido", "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --ds-shadow-card: 0 1px 2px rgba(26, 23, 20, .05), 0 8px 24px rgba(26, 23, 20, .07);
  --ds-shadow-hover: 0 2px 4px rgba(26, 23, 20, .06), 0 14px 32px rgba(26, 23, 20, .10);
  --ds-focus-ring: 0 0 0 3px rgba(179, 0, 95, .8);
  font-family: var(--ds-ff-body);
  color: var(--ds-ink);
}

/* ---------- 共通パーツ ---------- */
.iosp-kicker {
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--ds-accent-text);
  text-transform: uppercase;
  margin: 0;
}

.iosp-sr-group { margin: 28px 0 0; }
.iosp-sr-group__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.iosp-sr-num {
  font-family: var(--ds-ff-gothic);
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  color: var(--ds-cream);
  background: var(--ds-ink);
  padding: 5px 7px 4px;
  letter-spacing: .06em;
}
.iosp-sr-group__title {
  font-family: var(--ds-ff-gothic);
  font-weight: 900;
  font-size: 16px;
  margin: 0;
}
.iosp-sr-group__count {
  font-size: 12px;
  color: var(--ds-muted);
  white-space: nowrap;
}
.iosp-sr-group__all {
  margin-left: auto;
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 12px;
  color: var(--ds-accent-text) !important;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  white-space: nowrap;
}
.iosp-sr-group__all:hover { color: var(--ds-accent) !important; }

/* 行アイテム（オーバーレイ・大学リスト共用） */
.iosp-sr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ds-card-bg);
  border-radius: 0;
  box-shadow: var(--ds-shadow-card);
  padding: 10px 14px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--ds-ink) !important;
  transition: box-shadow .15s ease;
}
.iosp-sr-item:hover { box-shadow: var(--ds-shadow-hover); }
.iosp-sr-item:hover .iosp-sr-item__title { color: var(--ds-accent-text); }
.iosp-sr-item__thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  background-color: var(--ds-cream);
  background-size: cover;
  background-position: center;
}
.iosp-sr-item__body { min-width: 0; }
.iosp-sr-item__title {
  display: block;
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.iosp-sr-item__meta {
  display: block;
  font-size: 12px;
  color: var(--ds-muted);
  margin-top: 2px;
}
.iosp-sr-item__price {
  margin-left: auto;
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  padding-left: 10px;
}

/* チップ（人気キーワード） */
.iosp-sr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.iosp-sr-chip {
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 13px;
  color: var(--ds-ink) !important;
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-ink);
  border-radius: 0;
  padding: 8px 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s ease;
}
.iosp-sr-chip:hover { background: var(--ds-yellow); }

.iosp-sr-empty {
  font-family: var(--ds-ff-hand);
  font-size: 18px;
  margin: 26px 0 0;
}
.iosp-sr-links { font-size: 13px; margin-top: 18px; }
.iosp-sr-links a {
  color: var(--ds-accent-text) !important;
  border-bottom: 1px solid currentColor;
  text-decoration: none;
  margin-right: 16px;
}

/* ローディング（検索中） */
.iosp-search__results { transition: opacity .15s ease; }
.iosp-search__results.is-loading { opacity: .45; }
.iosp-sr-loading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 26px 0 0;
}
.iosp-sr-loading span {
  width: 9px;
  height: 9px;
  background: var(--ds-accent);
  animation: iospPulse .9s ease-in-out infinite;
}
.iosp-sr-loading span:nth-child(2) { animation-delay: .15s; }
.iosp-sr-loading span:nth-child(3) { animation-delay: .3s; }
.iosp-sr-loading i {
  font-style: normal;
  font-size: 12px;
  color: var(--ds-muted);
  margin-left: 4px;
}
@keyframes iospPulse {
  0%, 100% { opacity: .15; }
  50% { opacity: 1; }
}

/* 点描 dotrule（1画面1箇所限定） */
.iosp-dotrule {
  border: 0;
  height: 4px;
  margin: 18px 0 0;
  background-image: radial-gradient(circle, var(--ds-ink) 1.1px, transparent 1.3px);
  background-size: 10px 4px;
  background-repeat: repeat-x;
  background-position: left center;
  opacity: .35;
}

/* ---------- オーバーレイ ---------- */
.iosp-search {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--ds-cream);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.iosp-search[hidden] { display: none; }
html.iosp-search-open,
html.iosp-search-open body { overflow: hidden; }

.iosp-search__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 26px 20px 90px;
}
.iosp-search__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.iosp-search__head .iosp-kicker { line-height: 1; margin: 0; }
.iosp-search__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--ds-ink);
  border-radius: 0;
  background: var(--ds-card-bg);
  color: var(--ds-ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background .12s ease;
}
.iosp-search__close:hover { background: var(--ds-yellow); }
.iosp-search__form { position: relative; margin: 0; }
.iosp-search__input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--ds-ink);
  border-radius: 0;
  background: transparent;
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 20px;
  color: var(--ds-ink);
  padding: 10px 2px 12px;
  box-shadow: none;
}
.iosp-search__input:focus {
  outline: none;
  box-shadow: none;
  border-bottom-color: var(--ds-accent);
}
.iosp-search__input::placeholder { color: var(--ds-muted); opacity: .75; font-weight: 400; }
.iosp-search__hint {
  font-size: 11px;
  color: var(--ds-muted);
  margin: 8px 0 0;
}

/* ---------- 検索結果ページ ---------- */
.iosp-search-page {
  background: var(--ds-cream);
  padding: 40px 0 90px;
}
.iosp-search-page .iosp-sp-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}
.iosp-search-page h1.iosp-sp-title {
  font-family: var(--ds-ff-gothic);
  font-weight: 900;
  font-size: 26px;
  line-height: 1.4;
  margin: 6px 0 0;
  color: var(--ds-ink);
}
.iosp-sp-form { position: relative; max-width: 560px; margin: 22px 0 6px; }
.iosp-sp-form .iosp-search__input { font-size: 17px; }
.iosp-sp-count { font-size: 12px; color: var(--ds-muted); margin: 10px 0 0; }

/* 商品グリッド */
.iosp-sp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.iosp-sp-card {
  background: var(--ds-card-bg);
  border-radius: 0;
  box-shadow: var(--ds-shadow-card);
  text-decoration: none;
  color: var(--ds-ink) !important;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s ease;
}
.iosp-sp-card:hover { box-shadow: var(--ds-shadow-hover); }
.iosp-sp-card:hover .iosp-sp-card__title { color: var(--ds-accent-text); }
.iosp-sp-card__thumb {
  aspect-ratio: 4 / 3;
  background-color: #efe9dc;
  background-size: cover;
  background-position: center;
}
.iosp-sp-card--product .iosp-sp-card__thumb { aspect-ratio: 1 / 1; }
.iosp-sp-card__body { padding: 10px 12px 12px; }
.iosp-sp-card__title {
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.iosp-sp-card__meta { font-size: 11px; color: var(--ds-muted); margin-top: 4px; display: block; }
.iosp-sp-card__price {
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 13px;
  margin-top: 6px;
  display: block;
}

/* ページネーション */
.iosp-sp-pager {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 30px 0 0;
}
.iosp-sp-pager a,
.iosp-sp-pager span {
  font-family: var(--ds-ff-gothic);
  font-weight: 700;
  font-size: 13px;
  min-width: 38px;
  text-align: center;
  padding: 9px 10px;
  border: 1px solid var(--ds-ink);
  background: var(--ds-card-bg);
  color: var(--ds-ink) !important;
  text-decoration: none;
}
.iosp-sp-pager a:hover { background: var(--ds-yellow); }
.iosp-sp-pager .is-current {
  background: var(--ds-ink);
  color: var(--ds-cream) !important;
}

@media (max-width: 849px) {
  .iosp-sp-grid { grid-template-columns: repeat(2, 1fr); }
  .iosp-search__inner { padding: 18px 16px 70px; }
  .iosp-search__input { font-size: 17px; }
  .iosp-search-page h1.iosp-sp-title { font-size: 21px; }
  .iosp-sr-item__thumb { flex-basis: 46px; width: 46px; height: 46px; }
}
