/*
 * 商品カード・一覧・絞り込み（R4）
 *
 * 値は公開サイトの表示を測った仕様書（docs/specs/collection/）から。
 * 商品カードはトップのセクション（R8）でも使うので、全ページで読み込む。
 */

/* ------------------------------------------------------------------ 商品カード */

.gb-card {
	position: relative;
	margin-bottom: 30px;
	overflow: hidden;
	text-align: center;
}

.gb-card__media {
	position: relative;
	z-index: 0;
	margin: 0 0 15px;
	overflow: hidden;
}

/* 正方形・角丸 16px。マウスを乗せると 2 枚目の画像に 0.2 秒で切り替わる */
.gb-card__image-link {
	position: relative;
	display: block;
	padding-bottom: 100%;
	overflow: hidden;
	border-radius: var(--gb-radius-block);
	transition: color var(--gb-duration) var(--gb-ease);
}

.gb-card__image {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: cover;
	transition:
		opacity 0.2s var(--gb-ease),
		filter 0.2s var(--gb-ease);
}

.gb-card__image--hover {
	z-index: 10;
	opacity: 0;
}

@media (hover: hover) {
	.gb-card__media:hover .gb-card__image--hover {
		opacity: 1;
	}

	.gb-card__media:hover .gb-card__image:not(.gb-card__image--hover) {
		opacity: 0;
	}
}

.gb-card__badge {
	position: absolute;
	top: 7px;
	right: 7px;
	z-index: 30;
}

@media (min-width: 768px) {
	.gb-card__badge {
		top: 14px;
		right: 14px;
	}
}

/* 「ポップアップ表示」：マウスを乗せると出る（PC だけ。スマホは出さない） */
.gb-card__quick {
	position: absolute;
	right: 10px;
	bottom: 10px;
	left: 10px;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	padding: 5px;
	border: 0;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
	color: var(--gb-color-text);
	font-family: inherit;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s linear;
}

.gb-card__quick span {
	font-size: 13px;
	font-weight: 500;
	line-height: 13px;
	white-space: nowrap;
}

@media (min-width: 768px) {
	.gb-card__quick {
		right: 15px;
		bottom: 15px;
		left: 15px;
	}
}

@media (hover: hover) {
	.gb-card:hover .gb-card__quick,
	.gb-card__quick:focus-visible {
		opacity: 1;
		pointer-events: auto;
	}
}

.gb-card__info {
	line-height: 17px;
}

.gb-card__vendor {
	margin-bottom: 8px;
	font-size: 11px;
	line-height: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	opacity: 0.8;
}

.gb-card__title {
	display: block;
	margin-bottom: 5px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	transition: color var(--gb-duration) var(--gb-ease);
}

.gb-card__title:hover {
	color: var(--gb-color-accent);
}

.gb-card__price {
	display: block;
}

@media (min-width: 768px) {
	.gb-card {
		margin-bottom: 20px;
	}

	.gb-card__media {
		margin-bottom: 20px;
	}
}

/* レビューの星：★5つを評価の割合（--gb-stars）で金色に塗る */
.gb-stars {
	display: inline-block;
	margin-top: 7px;
	font-family: Times, serif;
	font-size: 14px;
	line-height: 14px;
}

.gb-stars::before {
	content: '★★★★★';
	color: transparent;
	background: linear-gradient(90deg, var(--gb-color-star) var(--gb-stars), #e1e1e1 var(--gb-stars));
	-webkit-background-clip: text;
	background-clip: text;
}

.gb-stars span {
	margin-left: 8px;
	font-family: var(--gb-font-body);
	font-size: 12px;
	line-height: 12px;
}

/* サイト全体の評価（ホーム）：商品のカードと同じ星（.gb-stars）を大きく＋平均＋「お客様の評価」 */
.gb-rating-summary {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px 10px;
	align-items: center;
}

.gb-rating-summary .gb-stars {
	margin-top: 0;
	font-size: 22px;
	line-height: 22px;
	letter-spacing: 1px;
}

.gb-rating-summary__num {
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
}

.gb-rating-summary__label {
	color: var(--gb-color-text-light, #6b6b6b);
	font-size: 13px;
	line-height: 1;
}

/* ------------------------------------------------------------------ 一覧の並び */

/* PC・タブレット 4 列（間隔 20px）、スマホ 2 列（間隔 8px） */
.gb-grid {
	display: flex;
	flex-wrap: wrap;
	margin: 0 -4px 20px;
	padding: 0;
	list-style: none;
}

.gb-grid__item {
	flex: 0 0 50%;
	max-width: 50%;
	padding-inline: 4px;
}

@media (min-width: 768px) {
	.gb-grid {
		margin: 0 -10px;
	}

	.gb-grid__item {
		flex-basis: 25%;
		max-width: 25%;
		padding-inline: 10px;
	}
}

.gb-collection-header__inner {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

@media (min-width: 768px) {
	.gb-collection-header__inner {
		flex-direction: row;
	}
}

/* 上の行：左に「フィルターと並べ替え」、右に件数 */
.gb-collection__toolbar {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	gap: 20px;
	margin-bottom: 15px;
	font-size: 13px;
	line-height: 1.6;
}

.gb-collection__filter-button {
	display: inline-flex;
	align-items: center;
	justify-self: start;
	margin-right: 30px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-family: inherit;
	font-size: 12px;
	line-height: 1.6;
	cursor: pointer;
	transition: color var(--gb-duration) var(--gb-ease);
}

.gb-collection__filter-button .gb-icon {
	margin-right: 10px;
}

.gb-collection__filter-button:hover {
	color: var(--gb-color-accent);
}

.gb-collection__count {
	font-size: 12px;
	line-height: 1.6;
	text-align: right;
	white-space: nowrap;
}

.gb-collection__more {
	display: flex;
	justify-content: center;
	margin: 10px 0 40px;
}

.gb-collection__more.is-loading a {
	pointer-events: none;
	opacity: 0.6;
}

.gb-collection__empty {
	padding: 60px 0;
	text-align: center;
}

/* 指定中の絞り込み */
.gb-active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	margin: -5px 0 20px;
	font-size: 12px;
}

.gb-active-filters__chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px;
	border-radius: var(--gb-radius-button);
	background: rgba(var(--gb-color-text-rgb), 0.05);
	transition: all var(--gb-duration) var(--gb-ease);
}

.gb-active-filters__chip:hover {
	background: var(--gb-color-accent);
	color: #fff;
}

.gb-active-filters__clear {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ 絞り込みのパネル（左から出る） */

.gb-filter-drawer__form {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	margin: 0;
}

.gb-filter-drawer .gb-drawer__header-inner {
	height: auto;
	padding-block: 23px;
}

.gb-filter-drawer__title {
	display: block;
	font-family: var(--gb-font-heading);
	font-size: 18px;
	font-weight: 500;
	line-height: 18px;
}

.gb-filter-drawer__count {
	display: block;
	margin-top: 4px;
	font-family: var(--gb-font-body);
	font-size: 12px;
	font-weight: 400;
	line-height: 12px;
}

.gb-filter .gb-accordion__summary {
	letter-spacing: -0.02em;
}

.gb-filter .gb-accordion__content {
	padding-bottom: 22px;
}

/* 下：クリア ｜ 適用 */
.gb-filter-drawer__footer {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 7px;
	padding: 20px;
	border-top: 1px solid var(--gb-color-border);
}

.gb-filter-drawer__clear {
	align-self: center;
	justify-self: center;
	color: var(--gb-color-accent);
	font-size: 12px;
	font-weight: 500;
	line-height: 12px;
	letter-spacing: 0.1em;
	text-decoration: underline;
	text-transform: uppercase;
	text-underline-offset: 3px;
}

/* 在庫ありのスイッチ：入力欄そのものを 48×24・角丸 12px のスイッチの形にする */
.gb-switch {
	line-height: 25px;
}

.gb-switch__input {
	position: relative;
	width: 48px;
	height: 24px;
	margin: 0 7px 0 0;
	border: 0;
	border-radius: 12px;
	line-height: normal;
	background: var(--gb-color-border);
	vertical-align: middle;
	cursor: pointer;
	transition: background-color var(--gb-duration) var(--gb-ease);
	-webkit-appearance: none;
	appearance: none;
}

.gb-switch__input::after {
	content: '';
	position: absolute;
	top: 4px;
	left: 4px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
	transition: transform var(--gb-duration) var(--gb-ease);
}

.gb-switch__input:checked {
	background: var(--gb-color-text);
}

.gb-switch__input:checked::after {
	transform: translateX(24px);
}

.gb-switch__input:focus-visible {
	outline: 2px solid var(--gb-color-focus);
	outline-offset: 2px;
}

.gb-switch__label {
	font-size: 13px;
	line-height: 1.6;
	letter-spacing: 0.02em;
	cursor: pointer;
}

/* 価格の範囲：線の上に 2 つのつまみ（ブラウザ標準の範囲入力を重ねる）と、金額の欄 */
.gb-price-range__note {
	display: block;
	margin-bottom: 15px;
	font-size: 13px;
	line-height: 1.6;
}

.gb-price-range__slider {
	position: relative;
	height: 4px;
	margin: 0 9px 25px;
	border-radius: 2px;
	background: var(--gb-color-border);
}

.gb-price-range__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--gb-range-from, 0%);
	right: calc(100% - var(--gb-range-to, 100%));
	border-radius: 2px;
	background: var(--gb-color-text);
}

.gb-price-range__slider input[type='range'] {
	position: absolute;
	top: -6px;
	left: -9px;
	width: calc(100% + 18px);
	height: 16px;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.gb-price-range__slider input[type='range']::-webkit-slider-thumb {
	width: 16px;
	height: 16px;
	border: 1px solid var(--gb-color-text);
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	pointer-events: auto;
	-webkit-appearance: none;
	appearance: none;
}

.gb-price-range__slider input[type='range']::-moz-range-thumb {
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	border: 1px solid var(--gb-color-text);
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	pointer-events: auto;
}

.gb-price-range__slider input[type='range']::-webkit-slider-runnable-track {
	background: none;
}

.gb-price-range__slider input[type='range']:focus-visible::-webkit-slider-thumb {
	outline: 2px solid var(--gb-color-focus);
	outline-offset: 2px;
}

.gb-price-range__inputs {
	display: grid;
	grid-template-columns: 1fr 12px 1fr;
	align-items: center;
	gap: 12px;
}

.gb-price-range__field {
	position: relative;
	display: flex;
	align-items: center;
}

.gb-price-range__field > span[aria-hidden] {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	font-size: 13px;
	line-height: 1.6;
	text-align: center;
	opacity: 0.5;
}

.gb-price-range__field input {
	flex: 1;
	width: 100%;
	height: 42px;
	padding: 11px 13px 11px 30px;
	border: 1px solid var(--gb-color-input-border);
	border-radius: var(--gb-radius-input);
	background: transparent;
	font-size: 13px;
	line-height: 1.15;
	text-align: right;
	transition: all var(--gb-duration) var(--gb-ease);
}

.gb-price-range__field input:focus {
	outline: none;
	border-color: var(--gb-color-text);
}

.gb-price-range__dash {
	line-height: 24px;
}

/* タグのチェックボックスの一覧（件数は薄く） */
.gb-checklist {
	max-height: 250px;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	list-style: none;
}

.gb-checklist li {
	line-height: 24px;
}

.gb-checklist input {
	width: 14px;
	height: 14px;
	margin: 0 7px 0 0;
	line-height: normal;
	vertical-align: middle;
	accent-color: var(--gb-color-text);
}

.gb-checklist label {
	padding-left: 4px;
	letter-spacing: 0.02em;
	word-break: break-all;
	cursor: pointer;
}

.gb-checklist__count {
	margin-left: 2px;
	font-size: 13px;
	line-height: 1.6;
	opacity: 0.6;
}

/* 一覧の下のセクション（成分のカード・成分から選ぶ・LINE）。商品の並びとの間をあける */
.gb-collection-sections {
	margin-top: 75px;
}

@media (max-width: 767px) {
	.gb-collection-sections {
		margin-top: 45px;
	}
}
