/* Single product layout (design 04-product) */
.cg-product { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: clamp(20px, 3vw, 40px); align-items: start; padding-bottom: 32px; }
.cg-product__media { position: sticky; top: calc(var(--erp-header-h) + 70px); display: grid; gap: 18px; }
.admin-bar .cg-product__media { top: calc(var(--erp-header-h) + 102px); }

/* Gallery */
.cg-gallery { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; }
.cg-gallery:not(:has(.cg-gallery__thumbs)) { grid-template-columns: 1fr; }
/* Thumbnail rail: max 5 visible, arrows scroll the rest (never squeezed). */
.cg-gallery__rail { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.cg-gallery__thumbs { display: flex; flex-direction: column; gap: 10px; max-height: calc(5 * 76px + 4 * 10px); overflow: hidden; scroll-behavior: smooth; overscroll-behavior: contain; }
.cg-gallery__thumb { flex: none; width: 76px; height: 76px; padding: 0; border: 1.5px solid var(--erp-line); border-radius: 10px; overflow: hidden; background: var(--erp-soft); }
.cg-gallery__more { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--erp-line-strong); background: #fff; color: var(--erp-ink); display: grid; place-items: center; transition: opacity .15s, border-color .15s; }
.cg-gallery__more .cg-icon { width: 18px; height: 18px; transform: rotate(90deg); }
.cg-gallery__more:hover:not(:disabled) { border-color: var(--erp-primary); color: var(--erp-primary); }
.cg-gallery__more:disabled { opacity: .35; cursor: default; }
.cg-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cg-gallery__thumb.is-active { border-color: var(--erp-primary); }
.cg-gallery__main { position: relative; border-radius: var(--erp-r-lg); background: #f4f3f1; overflow: hidden; aspect-ratio: 1 / 1.1; }
.cg-gallery__slide { margin: 0; height: 100%; }
.cg-gallery__slide img { width: 100%; height: 100%; object-fit: contain; }
.cg-gallery__nav, .cg-gallery__full { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: var(--erp-ink); display: grid; place-items: center; box-shadow: var(--erp-shadow); }
.cg-gallery__nav .cg-icon, .cg-gallery__full .cg-icon { width: 20px; height: 20px; }
.cg-gallery__nav--prev { left: 12px; bottom: 14px; }
.cg-gallery__nav--next { left: 60px; bottom: 14px; }
.cg-gallery__full { right: 12px; bottom: 14px; }
.cg-lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(17, 20, 24, .92); display: grid; place-items: center; padding: 24px; }
.cg-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cg-lightbox button { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 24px; }

.cg-perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cg-perks li { padding: 14px 18px; border-radius: var(--erp-r); background: var(--erp-soft); }
.cg-perks .cg-feature__icon .cg-icon { width: 32px; height: 32px; }
.cg-perks .cg-feature__title { font-size: .9375rem; font-weight: 600; }

/* Summary */
.cg-product__summary { display: grid; gap: 14px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.cg-product__summary > *, .cg-tabs, .cg-tabs__panel, .cg-product__media > * { min-width: 0; }
.cg-product__summary > .cg-badge { justify-self: start; }
.cg-product__titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cg-product__title { font-size: var(--erp-fs-h1-set, clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem)); margin: 0; }
.cg-product__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: .875rem; }
.cg-stock { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.cg-stock.is-in { color: var(--erp-green); }
.cg-stock.is-out { color: var(--erp-primary); }
.cg-stock .cg-icon { width: 18px; height: 18px; }
.cg-sku { color: var(--erp-muted); }
.cg-product__lead { color: var(--erp-text); font-size: 1.0625rem; }
.cg-product__lead p:last-child { margin-bottom: 0; }
.cg-product__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding-bottom: 4px; }
.cg-product__facts .cg-feature__icon .cg-icon { width: 28px; height: 28px; }

/* Tabs */
.cg-tabs__list { display: flex; gap: 4px; border-bottom: 1px solid var(--erp-line); overflow-x: auto; scrollbar-width: none; }
.cg-tabs__tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 16px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--erp-muted); font-weight: 600; font-size: .875rem; white-space: nowrap; }
.cg-tabs__tab .cg-icon { width: 18px; height: 18px; color: var(--erp-primary); }
.cg-tabs__tab.is-active { color: var(--erp-ink); border-bottom-color: var(--erp-primary); font-weight: 800; }
.cg-tabs__panel { padding-top: 16px; }
.cg-prose { font-size: 1rem; line-height: 1.7; }
.cg-prose img { border-radius: var(--erp-r); }
.cg-tabs__panel .woocommerce-product-attributes { width: 100%; border-collapse: collapse; }
.cg-tabs__panel .woocommerce-product-attributes th, .cg-tabs__panel .woocommerce-product-attributes td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--erp-line); }
.cg-tabs__panel .woocommerce-product-attributes th { width: 40%; color: var(--erp-muted); font-weight: 600; }
.cg-tabs__panel .woocommerce-product-attributes td p { margin: 0; }

/* Reviews */
#reviews .commentlist { list-style: none; padding: 0; }
#reviews .comment_container { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--erp-line); }
#reviews .avatar { border-radius: 50%; }
#review_form .comment-form { display: grid; gap: 12px; }
#review_form .stars a { color: var(--erp-star); }

@media (max-width: 1024px) {
	.cg-product { grid-template-columns: 1fr; }
	.cg-product__media { position: static; }
	.cg-perks { display: none; }
}
@media (max-width: 640px) {
	.cg-gallery { grid-template-columns: 1fr; }
	.cg-gallery__rail { flex-direction: row; order: 2; }
	.cg-gallery__thumbs { flex-direction: row; max-height: none; max-width: calc(4 * 60px + 3 * 8px); gap: 8px; overflow: hidden; }
	.cg-gallery__thumb { width: 60px; height: 60px; }
	.cg-gallery__more .cg-icon { transform: none; }
	.cg-product__facts { grid-template-columns: 1fr 1fr; }
}

/* Availability + production time line */
.cg-avail { display: inline-flex; align-items: center; gap: 8px; font-size: .9375rem; }
.cg-avail__dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 0%, transparent); }
.cg-avail--green .cg-avail__dot { box-shadow: 0 0 0 4px rgba(22, 163, 74, .15); }
.cg-avail--orange .cg-avail__dot { box-shadow: 0 0 0 4px rgba(234, 138, 12, .15); }
.cg-avail--red .cg-avail__dot { box-shadow: 0 0 0 4px rgba(220, 38, 38, .15); }
.cg-avail__time { display: inline-flex; align-items: center; gap: 6px; padding-left: 14px; border-left: 1px solid var(--erp-line); color: var(--erp-text); font-size: .9375rem; }
.cg-avail__time .cg-icon { width: 17px; height: 17px; color: var(--erp-muted); }
.cg-avail__time strong { color: var(--erp-ink); }
@media (max-width: 480px) { .cg-avail__time { padding-left: 0; border-left: 0; width: 100%; } }
/* Exactly 5 photos: all fit on desktop, arrows only matter on phones. */
@media (min-width: 641px) { .cg-gallery__rail:has(.cg-gallery__thumb:nth-child(5):last-child) .cg-gallery__more { display: none; } }
