/* Single product page. Mobile first: photos, price, options and Add to cart come first. */

.gg-product { padding-block: 1rem clamp(3rem, 6vw, 5rem); }

.gg-product__top {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(1.25rem, 4vw, 3.5rem);
	margin-top: .75rem;
}

@media (min-width: 48rem) {
	.gg-product__top { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
	.gg-gallery { position: sticky; top: calc(var(--gg-header-offset) + 1rem); }
}

/* Gallery */
.gg-gallery__main {
	margin: 0;
	overflow: hidden;
	border-radius: var(--gg-radius-md);
	background: var(--gg-warm);
	aspect-ratio: 1;
}

.gg-gallery__main img { width: 100%; height: 100%; object-fit: cover; }

.gg-gallery__thumbs {
	position: relative;
	display: flex;
	gap: .6rem;
	margin: .75rem 0 0;
	padding: 0 0 .25rem;
	overflow-x: auto;
	list-style: none;
	scroll-snap-type: x mandatory;
}

.gg-gallery__thumbs li { flex: 0 0 4.5rem; scroll-snap-align: start; }

.gg-gallery__thumbs a {
	display: block;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: var(--gg-radius-sm);
	aspect-ratio: 1;
}

.gg-gallery__thumbs a[aria-current="true"] { border-color: var(--gg-ink); }
.gg-gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* Summary */
.gg-product__summary h1 { margin-bottom: .35rem; font-size: clamp(1.5rem, 3.2vw, 2.2rem); }
.gg-product__summary .gg-price--lg { margin-bottom: .75rem; }
.gg-product__lede { color: var(--gg-muted); }

.gg-buy { display: grid; gap: 1rem; margin-block: 1.25rem; }

.gg-swatches legend { margin-bottom: .6rem; font-weight: 400; }

.gg-swatches__list { display: flex; flex-wrap: wrap; gap: .6rem; }

.gg-swatch {
	position: relative;
	display: block;
	width: 3.5rem;
	height: 3.5rem;
	overflow: hidden;
	border: 2px solid var(--gg-line);
	border-radius: 50%;
	cursor: pointer;
}

.gg-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.gg-swatch img { width: 100%; height: 100%; object-fit: cover; }
.gg-swatch:has(input:checked) { border-color: var(--gg-ink); box-shadow: 0 0 0 2px var(--gg-paper) inset; }
.gg-swatch:has(input:focus-visible) { outline: 3px solid var(--gg-focus); outline-offset: 2px; }

.gg-swatch--soldout { cursor: not-allowed; opacity: .45; }
.gg-swatch--soldout::after {
	position: absolute;
	top: 50%;
	left: -10%;
	width: 120%;
	height: 2px;
	background: var(--gg-ink);
	content: "";
	transform: rotate(-45deg);
}

.gg-stock { margin: 0; color: var(--gg-success); font-size: .9rem; font-weight: 700; }
.gg-stock--low { color: var(--gg-stock-low); }
.gg-stock--out { color: var(--gg-sale); }

.gg-buy__row { display: flex; gap: .75rem; }
.gg-buy__add { flex: 1; min-height: 3.2rem; font-size: 1rem; }

.gg-accordions { border-top: 1px solid var(--gg-line); }
.gg-accordions details { border-bottom: 1px solid var(--gg-line); }

.gg-accordions summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 3.25rem;
	font-weight: 700;
	list-style: none;
	cursor: pointer;
}

.gg-accordions summary::-webkit-details-marker { display: none; }
.gg-accordions summary:hover { color: var(--gg-link); }
.gg-accordions details[open] summary .gg-icon { transform: rotate(180deg); }
.gg-accordions details > :not(summary) { color: var(--gg-muted); }
.gg-accordions ul { padding-left: 1.2rem; }

.gg-product__meta { display: grid; gap: .25rem; margin: 1.25rem 0 0; font-size: .88rem; }
.gg-product__meta div { display: flex; gap: .5rem; }
.gg-product__meta dt { color: var(--gg-muted); }
.gg-product__meta dd { margin: 0; }

/* Tabs */
.gg-product .gg-tabs { margin-top: clamp(2.5rem, 6vw, 4rem); }
.gg-product .gg-tabs__panel { max-width: 50rem; }
.gg-product .gg-tabs__panel h3 { margin-top: 1.25rem; font-size: 1.05rem; }
.gg-tabs__fallback-title { font-size: 1.25rem; }

/* Related carousel */
.gg-related { margin-top: clamp(3rem, 6vw, 4.5rem); }
.gg-related__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.gg-related__head h2 { margin: 0; }
.gg-related__controls { display: flex; gap: .5rem; }

.gg-related__track {
	position: relative;
	display: grid;
	grid-auto-columns: calc((100% - 3 * 1.5rem) / 4);
	grid-auto-flow: column;
	gap: 1.5rem;
	padding-bottom: .5rem;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
}

.gg-related__track > * { scroll-snap-align: start; }

@media (max-width: 63.9375rem) {
	.gg-related__track { grid-auto-columns: calc((100% - 1rem) / 2.4); gap: 1rem; }
}

/* Sticky add-to-cart bar (phones only) */
.gg-sticky-buy {
	position: fixed;
	z-index: 40;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom));
	border-top: 1px solid var(--gg-line);
	background: var(--gg-paper);
	box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
}

.gg-sticky-buy[hidden] { display: none; }

/* Room under the footer so its last links can scroll clear of the bar. */
@media (max-width: 47.9375rem) {
	body:has(.gg-sticky-buy) .gg-footer { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
}

.gg-sticky-buy__name { flex: 1; overflow: hidden; font-size: .85rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.gg-sticky-buy__price { font-weight: 700; }

@media (min-width: 48rem) {
	.gg-sticky-buy { display: none !important; }
}

.gg-swatch--text {
	width: auto;
	height: auto;
	min-width: 2.9rem;
	min-height: 2.9rem;
	padding: .55rem 1rem;
	border-radius: 999px;
	font-size: .88rem;
	font-weight: 700;
	text-align: center;
}

.gg-swatch--text span { display: inline-block; }
.gg-swatch--text:has(input:checked) { color: var(--gg-paper); background: var(--gg-ink); }
.gg-swatch--text.gg-swatch--soldout::after { display: none; }
.gg-swatch--text.gg-swatch--soldout { text-decoration: line-through; }

/* Quick-view preview dialog */
.gg-quickview { width: min(60rem, calc(100vw - 2rem)); }
.gg-quickview[open] { display: block; }

.gg-preview {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(1rem, 3vw, 2rem);
	padding: clamp(1rem, 3vw, 2rem);
}

.gg-preview .gg-gallery { position: static; }
.gg-preview .gg-product__title { padding-right: 2.5rem; font-size: clamp(1.3rem, 2.5vw, 1.75rem); }
.gg-preview__full { display: inline-block; margin-top: .5rem; }
.gg-preview__message { margin: 0 0 .75rem; padding: .7rem .9rem; border-radius: var(--gg-radius-sm); font-weight: 700; }
.gg-preview__message.is-ok { color: var(--gg-success); background: var(--gg-ok-bg); }
.gg-preview__message.is-error { color: var(--gg-sale); background: var(--gg-err-bg); }
.gg-card-product__link[aria-busy="true"] { cursor: progress; opacity: .7; }

@media (max-width: 40rem) {
	.gg-preview { grid-template-columns: 1fr; }
	.gg-quickview { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--gg-radius-lg) var(--gg-radius-lg) 0 0; }
}
/* Signed-in customer reviews and product questions. */
.gg-product-posts { margin-block: clamp(3rem, 8vw, 6rem); padding-block: clamp(2rem, 5vw, 4rem); border-block: 1px solid var(--gg-line); }
.gg-product-posts__header { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
.gg-product-posts__form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 50rem; margin-block: 1.5rem 2.5rem; padding: clamp(1rem, 4vw, 2rem); background: var(--gg-warm); border-radius: var(--gg-radius-md); }
.gg-product-posts__form label { display: grid; gap: .35rem; font-weight: 700; }
.gg-product-posts__form label:nth-of-type(n+3), .gg-product-posts__form .gg-form-hint { grid-column: 1 / -1; }
.gg-product-posts__list { display: grid; gap: 1rem; }
.gg-product-post { padding: clamp(1rem, 4vw, 1.5rem); border: 1px solid var(--gg-line); border-radius: var(--gg-radius-md); }
.gg-product-post > header, .gg-product-post details > header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; color: var(--gg-muted); font-size: .88rem; }
.gg-product-post__kind, .gg-product-post__verified { padding: .2rem .5rem; background: var(--gg-warm); border-radius: 999px; color: var(--gg-ink); font-weight: 700; }
.gg-product-post--collapsed summary { cursor: pointer; font-weight: 700; }
.gg-product-post__reply { margin: 1rem 0 0 1rem; padding: 1rem; border-left: 3px solid var(--gg-gold); background: var(--gg-warm); }
@media (max-width: 38rem) { .gg-product-posts__form { grid-template-columns: 1fr; } .gg-product-posts__form label { grid-column: 1; } }

.gg-product-post__photos { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.gg-product-post__photos img { width: 6rem; height: 6rem; border-radius: .5rem; object-fit: cover; }

/* Staff-only remove control on each review/comment/question (Studio and admin accounts). */
.gg-product-post__staff { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .85rem; padding: .6rem .75rem; border: 1px dashed var(--gg-line); border-radius: var(--gg-radius-sm); background: var(--gg-subtle-bg); font-size: .9rem; }
.gg-product-post__staff span { color: var(--gg-muted); font-weight: 700; }
.gg-product-post__staff select { min-height: 2.5rem; }
.gg-product-post__staff .gg-button { min-height: 2.5rem; padding-inline: 1rem; }
