/*
 * 商品ページのレビュー欄
 *
 * 値は公開サイトの Judge.me のレビュー欄を測った仕様書（docs/specs/product/reviews・review-card）から。
 * 星は Judge.me の専用書体の代わりに、Tabler Icons（MIT）の星の形を CSS のマスクで描く。
 */

.gb-reviews {
	--gb-reviews-color: #108474;
	--gb-reviews-muted: #7b7b7b;
	padding-block: 16px;
	color: #333;
	font-size: 17px;
	line-height: 1.4;
}

/* ------------------------------------------------------------------ 星 */

/* 輪郭の星 5 つの上に、塗った星を評価の分の幅だけ重ねる（星 16px・間 4px） */
.gb-rstars {
	--gb-rstars-size: 16px;
	--gb-rstars-step: 20px;
	position: relative;
	display: inline-block;
	width: calc(var(--gb-rstars-step) * 5 - 4px);
	height: var(--gb-rstars-size);
	vertical-align: middle;
}

.gb-rstars::before,
.gb-rstars::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	background: var(--gb-reviews-color, #108474);
	-webkit-mask-repeat: repeat-x;
	mask-repeat: repeat-x;
	-webkit-mask-size: var(--gb-rstars-step) var(--gb-rstars-size);
	mask-size: var(--gb-rstars-step) var(--gb-rstars-size);
}

.gb-rstars::before {
	right: 0;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29.65 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29.65 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z'/%3E%3C/svg%3E");
}

.gb-rstars::after {
	width: var(--gb-rstars-fill, 0);
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29.65 24' fill='%23000'%3E%3Cpath d='M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29.65 24' fill='%23000'%3E%3Cpath d='M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z'/%3E%3C/svg%3E");
}

/* 棒グラフの行の星（13px・間 3px） */
.gb-rstars--sm {
	--gb-rstars-size: 13px;
	--gb-rstars-step: 16px;
	width: 80px;
}

.gb-rstars--sm::after {
	width: calc(var(--gb-rstars-fill, 0px) * 0.8);
}

/* 棒は星の少ない行ほど薄い */
.gb-reviews__row:nth-child(2) .gb-reviews__bar span {
	opacity: 0.8;
}

.gb-reviews__row:nth-child(3) .gb-reviews__bar span {
	opacity: 0.6;
}

.gb-reviews__row:nth-child(4) .gb-reviews__bar span {
	opacity: 0.4;
}

.gb-reviews__row:nth-child(5) .gb-reviews__bar span {
	opacity: 0.2;
}

/* ------------------------------------------------------------------ 集計のカード */

.gb-reviews__summary,
.gb-reviews__sort,
.gb-review {
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.gb-reviews__summary {
	padding: 24px 16px 16px;
	text-align: center;
}

.gb-reviews__title {
	margin: 0 0 12px;
	color: inherit;
	font-family: var(--gb-font-heading);
	font-size: 25.5px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: -0.02em;
}

.gb-reviews__average {
	margin-bottom: 24px;
}

.gb-reviews__score {
	margin-left: 4px;
	vertical-align: middle;
}

.gb-reviews__histogram {
	margin-bottom: 24px;
	font-size: 13.6px;
	line-height: 14px;
}

.gb-reviews__row {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 14px;
	margin-bottom: 10px;
}

.gb-reviews__row:last-child {
	margin-bottom: 0;
}

.gb-reviews__bar {
	width: 140px;
	height: 14px;
	margin-inline: 24px;
	overflow: hidden;
	border-radius: 10px;
	background: rgba(224, 224, 224, 0.5);
}

.gb-reviews__bar span {
	display: block;
	height: 100%;
	border-radius: 10px;
	background: var(--gb-reviews-color);
}

.gb-reviews__num {
	width: 24px;
	color: var(--gb-reviews-muted);
	text-align: left;
}

.gb-reviews__actions {
	margin-bottom: 8px;
}

/* 「レビューを書く」：緑の丸いボタン */
.gb-reviews__write,
.gb-reviews__cancel {
	display: inline-block;
	min-width: 187px;
	max-width: 100%;
	margin-inline: 5px;
	padding: 10px 20px;
	border: 2px solid var(--gb-reviews-color);
	border-radius: 25px;
	background: var(--gb-reviews-color);
	color: #fff;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	cursor: pointer;
	transition: opacity var(--gb-duration) var(--gb-ease);
}

.gb-reviews__write:hover,
.gb-reviews__cancel:hover {
	opacity: 0.8;
}

.gb-reviews__cancel {
	border-color: #a4a4a4;
	background: #fff;
	color: #a4a4a4;
}

.gb-reviews__notice {
	margin: 16px 0 8px;
	padding: 12px 16px;
	border-radius: 5px;
	background: rgba(16, 132, 116, 0.1);
	color: var(--gb-reviews-color);
	font-size: 15px;
	font-weight: 500;
}

.gb-reviews__none {
	margin: 0 0 24px;
	color: var(--gb-reviews-muted);
	font-size: 15px;
	text-align: center;
}

/* ------------------------------------------------------------------ 投稿フォーム */

.gb-review-form {
	margin-top: 16px;
	padding-top: 24px;
	border-top: 1px solid rgba(164, 164, 164, 0.1);
}

.gb-review-form[hidden] {
	display: none;
}

.gb-review-form__title {
	margin: 0 0 16px;
	color: inherit;
	font-family: var(--gb-font-heading);
	font-size: 25.5px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: -0.02em;
}

.gb-review-form__message {
	margin: 0 0 16px;
	font-size: 15px;
	line-height: 1.7;
}

.gb-review-form__message a,
.gb-review-form__rules a {
	color: var(--gb-reviews-color);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.gb-review-form__rating {
	margin: 0 0 20px;
	padding: 0;
	border: 0;
}

.gb-review-form legend,
.gb-review-form label {
	display: block;
	width: 100%;
	margin-bottom: 8px;
	padding: 0;
	font-size: 13px;
	line-height: 1.4;
	letter-spacing: 0.02em;
}

.gb-review-form__required {
	color: var(--gb-color-accent);
	font-size: 12px;
}

.gb-review-form__row {
	margin: 0 0 20px;
}

.gb-review-form .gb-input {
	border-radius: 16px;
	font-size: 15px;
	line-height: 1.6;
}

.gb-review-form textarea.gb-input {
	height: auto;
	min-height: 150px;
	resize: vertical;
	font-family: inherit;
}

.gb-review-form__hint {
	display: block;
	margin-top: 6px;
	color: var(--gb-reviews-muted);
	font-size: 12px;
	line-height: 1.6;
}

.gb-review-form__rules {
	margin: 0 0 20px;
	padding: 12px 16px;
	border-radius: 5px;
	background: rgba(164, 164, 164, 0.1);
	font-size: 13px;
	line-height: 1.7;
	text-align: left;
}

.gb-review-form__rules p {
	margin: 0;
}

.gb-review-form__rules p:first-child {
	font-weight: 500;
}

.gb-review-form__buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.gb-review-form__error {
	margin: 12px 0 0;
	color: var(--gb-color-accent);
	font-size: 13px;
}

.gb-review-form__error[hidden] {
	display: none;
}

/* 評価を選ぶ星（大きい星 5 つ。選んだ星までを塗る） */
.gb-rating-input {
	display: inline-flex;
	gap: 4px;
}

.gb-rating-input label {
	width: 28px;
	height: 28px;
	margin: 0;
	background: var(--gb-reviews-color);
	cursor: pointer;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.gb-rating-input label.is-on {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z'/%3E%3C/svg%3E");
}

.gb-rating-input input:focus-visible + label {
	outline: 2px solid var(--gb-color-focus);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ 並べ替え */

.gb-reviews__sort {
	position: relative;
	display: flex;
	align-items: center;
	margin-block: 24px;
	padding: 8px 16px;
	color: #a4a4a4;
}

.gb-reviews__sort select {
	position: relative;
	z-index: 1;
	height: 50px;
	padding: 10px 24px 10px 0;
	border: 0;
	background: none;
	color: #a4a4a4;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

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

.gb-reviews__sort .gb-icon {
	margin-left: -18px;
}

/* ------------------------------------------------------------------ レビューのカード（PC は 2 列、スマホは 1 列） */

.gb-reviews__cards {
	columns: 2;
	column-gap: 16px;
}

/* JS が動くときは、カードを上から順に、低いほうの列へ置いていく（公開サイトと同じ並び） */
.gb-reviews__cards.is-masonry {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	columns: auto;
}

.gb-reviews__col {
	flex: 1 1 0;
	min-width: 0;
}

.gb-reviews__list[aria-busy='true'] {
	opacity: 0.5;
}

.gb-review {
	margin: 0 0 16px;
	padding: 16px;
	break-inside: avoid;
}

.gb-review__header {
	margin-bottom: 15px;
}

.gb-review__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	min-height: 24.8px;
	margin-bottom: 8px;
}

.gb-review__date {
	color: var(--gb-reviews-muted);
	font-size: 13.6px;
	line-height: 1.4;
}

.gb-review__author {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	min-height: 36px;
}

.gb-review__avatar {
	position: relative;
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-right: 8px;
	border-radius: 10px;
	background: rgba(224, 224, 224, 0.5);
	color: #a4a4a4;
}

/* 購入者：右下に緑の丸いチェック */
.gb-review__avatar.is-verified::after {
	content: '';
	position: absolute;
	right: -3px;
	bottom: -3px;
	width: 14px;
	height: 14px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--gb-reviews-color) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l10 -10'/%3E%3C/svg%3E") center / 8px no-repeat;
}

.gb-review__name {
	margin-top: 1px;
	color: var(--gb-reviews-color);
	line-height: 20px;
}

.gb-review__verified {
	margin-top: 3px;
	margin-left: 5px;
	padding: 2px 6px;
	border-radius: 5px;
	background: var(--gb-reviews-color);
	color: #fff;
	font-size: 12px;
	line-height: 12px;
}

.gb-review__title {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
}

.gb-review__body p {
	margin: 0;
}

/* 長い本文は 6 行まで。「続きを読む」で開く */
.gb-review__body.is-clamped {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 6;
	line-clamp: 6;
}

.gb-review__more {
	margin-top: 4px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--gb-reviews-muted);
	font-family: inherit;
	font-size: 17px;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.gb-review__more[hidden] {
	display: none;
}

.gb-review__photos {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.gb-review__photos img {
	width: 72px;
	height: 72px;
	border-radius: 5px;
	object-fit: cover;
}

/* ページ送り */
.gb-reviews__pages {
	display: flex;
	align-items: center;
	justify-content: center;
	padding-block: 16px;
}

.gb-reviews__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	padding: 4px 8px;
	color: var(--gb-reviews-color);
	font-size: 17px;
	line-height: 1;
}

.gb-reviews__page.is-current {
	color: var(--gb-reviews-muted);
	font-size: 24px;
}

@media (max-width: 767px) {
	.gb-reviews__cards {
		columns: 1;
	}

	.gb-reviews__write,
	.gb-reviews__cancel {
		display: block;
		width: 100%;
		margin-inline: 0;
	}
}
