/* Tweety Variations – kružići boja + galerija */

:root {
	--twvar-radius: 18px;
	--twvar-line: #ece7ea;
	--twvar-ink: #241d26;
	--twvar-accent: #ff6a88;
}

/* ---------- Kružići boja u gridu ---------- */

.twvar-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
}

.twvar-swatch { margin: 0; line-height: 0; }

.twvar-swatch > a {
	display: block;
	padding: 2px;
	border-radius: 50%;
	border: 1.5px solid transparent;
	transition: border-color .15s ease, transform .15s ease;
}
.twvar-swatch > a:hover,
.twvar-swatch > a:focus-visible {
	border-color: var(--twvar-accent);
	transform: scale(1.08);
	outline: none;
}

.twvar-swatch__dot {
	display: block;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--twvar-color, #d8d3d6);
	box-shadow: inset 0 0 0 1px rgba(36, 29, 38, .12);
}
.twvar-swatch.is-light .twvar-swatch__dot { box-shadow: inset 0 0 0 1px rgba(36, 29, 38, .28); }

/* Boja bez definiranog hexa – prikazujemo kockicu da se vidi da nije stvarna boja. */
.twvar-swatch.is-unknown .twvar-swatch__dot {
	background:
		linear-gradient(45deg, rgba(0,0,0,.10) 25%, transparent 25% 75%, rgba(0,0,0,.10) 75%) 0 0 / 8px 8px,
		#e8e4e6;
}

/* Nema na stanju – prekriži */
.twvar-swatch.is-out > a { opacity: .55; }
.twvar-swatch.is-out .twvar-swatch__dot {
	position: relative;
	overflow: hidden;
}
.twvar-swatch.is-out .twvar-swatch__dot::after {
	content: "";
	position: absolute;
	left: -2px;
	right: -2px;
	top: 50%;
	height: 1.5px;
	background: rgba(36, 29, 38, .75);
	transform: rotate(-45deg);
}

.twvar-swatch--more > a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	border: 1px solid var(--twvar-line);
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1;
	color: #6b636f;
}
.twvar-swatch--more > a:hover { border-color: var(--twvar-accent); color: var(--twvar-accent); transform: none; }

/* ---------- Galerija na stranici proizvoda ---------- */

.twvar-gallery { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.twvar-gallery__stage {
	position: relative;
	aspect-ratio: 1 / 1;
	border-radius: var(--twvar-radius);
	overflow: hidden;
	background: linear-gradient(160deg, #fff2f5, #fff);
}

.twvar-gallery__main {
	display: flex;
	height: 100%;
	align-items: stretch;
	/* Navigacija (strelice, slicice) pomice galeriju preko scrollTo(),
	   pa overflow-x MORA ostati auto - overflow:hidden blokira i programski scroll.
	   Gasimo samo okomiti pomak i lancano skrolanje stranice. */
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.twvar-gallery__main::-webkit-scrollbar { display: none; }

.twvar-gallery__slide {
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	margin: 0;
	scroll-snap-align: center;
}
/* .woocommerce img { height:auto } je specificniji od pukog .twvar-gallery__img,
   pa slika nije popunjavala kvadrat - landscape je ostavljao bijelo ispod, a
   portret se prelijevao preko zaobljenog ruba. */
.twvar-gallery__slide img.twvar-gallery__img,
.twvar-gallery__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

.twvar-gallery__ph {
	display: block;
	aspect-ratio: 1 / 1;
	background: linear-gradient(160deg, #fff2f5, #fff);
}

.twvar-gallery__nav,
.twvar-gallery__zoom {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .9);
	color: var(--twvar-ink);
	box-shadow: 0 4px 14px rgba(36, 29, 38, .14);
	cursor: pointer;
	transition: background .15s ease, opacity .15s ease;
}
.twvar-gallery__nav:hover,
.twvar-gallery__zoom:hover { background: #fff; color: var(--twvar-accent); }

.twvar-gallery__nav { top: 50%; transform: translateY(-50%); }
.twvar-gallery__nav--prev { left: 12px; }
.twvar-gallery__nav--next { right: 12px; }
.twvar-gallery__nav[hidden] { display: none; }

.twvar-gallery__zoom { top: 12px; right: 12px; }

.twvar-gallery__thumbs {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 2px;
	list-style: none;
	overflow-x: auto;
	scrollbar-width: thin;
}
.twvar-gallery__thumbs li { margin: 0; flex: 0 0 auto; }

.twvar-gallery__thumb {
	display: block;
	width: 72px;
	height: 72px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	cursor: pointer;
	transition: border-color .15s ease;
}
.twvar-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.twvar-gallery__thumb:hover { border-color: #ffc2ce; }
.twvar-gallery__thumb.is-active { border-color: var(--twvar-accent); }

/* ---------- Lightbox ---------- */

.twvar-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(20, 15, 22, .88);
}
.twvar-lightbox img {
	max-width: 100%;
	max-height: 100%;
	border-radius: 12px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.twvar-lightbox__close {
	position: absolute;
	top: 18px;
	right: 18px;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.twvar-lightbox__close:hover { background: rgba(255, 255, 255, .3); }

@media (max-width: 640px) {
	.twvar-gallery__thumb { width: 58px; height: 58px; }
	.twvar-gallery__nav { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
	.twvar-gallery__main { scroll-behavior: auto; }
	.twvar-swatch > a:hover { transform: none; }
}

/* ---------- Izbornik atributa ---------- */

.twvar-select { margin: 18px 0 6px; }
.twvar-select__row + .twvar-select__row { margin-top: 16px; }

.twvar-select__head {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 8px;
}
.twvar-select__label {
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #6b636f;
}
.twvar-select__value { font-size: 14px; font-weight: 700; color: var(--twvar-ink); }

.twvar-select__opts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.twvar-select__opts li { margin: 0; }

.twvar-opt {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 46px;
	padding: 9px 14px;
	border: 1.5px solid var(--twvar-line);
	border-radius: 10px;
	background: #fff;
	font-size: 14px;
	font-weight: 700;
	color: var(--twvar-ink);
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.twvar-opt:hover { border-color: var(--twvar-accent); }
.twvar-opt.is-selected { border-color: var(--twvar-ink); background: var(--twvar-ink); color: #fff; }

/* Postoji, ali nije dostupno uz trenutni odabir */
/* Nedostupne opcije se ne prikazuju. Odabranu ostavljamo vidljivom i kad
   ostane bez zalihe, da kupcu ne nestane ispod prsta. */
.twvar-select__opts > li:has( > .twvar-opt.is-out:not(.is-selected) ),
.twvar-select__opts > li:has( > .twvar-opt.is-missing:not(.is-selected) ) { display: none; }

.twvar-opt.is-out,
.twvar-opt.is-missing { color: #a9a2ad; border-color: #f0ecee; background: #fbf9fa; }
.twvar-opt.is-out::after,
.twvar-opt.is-missing::after {
	content: "";
	position: absolute;
	left: 8%;
	right: 8%;
	top: 50%;
	height: 1.5px;
	background: currentColor;
	opacity: .5;
	transform: rotate(-14deg);
}
.twvar-opt.is-out.is-selected,
.twvar-opt.is-missing.is-selected { color: #fff; border-color: var(--twvar-ink); background: var(--twvar-ink); }

/* Kružići boja */
.twvar-opt--color {
	min-width: 0;
	padding: 3px;
	border-radius: 50%;
	border-width: 2px;
}
.twvar-opt__dot {
	display: block;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--twvar-color, #d8d3d6);
	box-shadow: inset 0 0 0 1px rgba(36, 29, 38, .12);
}
.twvar-opt--color.is-light .twvar-opt__dot { box-shadow: inset 0 0 0 1px rgba(36, 29, 38, .3); }
.twvar-opt--color.is-unknown .twvar-opt__dot {
	background:
		linear-gradient(45deg, rgba(0,0,0,.10) 25%, transparent 25% 75%, rgba(0,0,0,.10) 75%) 0 0 / 10px 10px,
		#e8e4e6;
}
.twvar-opt--color.is-selected { background: #fff; border-color: var(--twvar-ink); }
.twvar-opt--color.is-out,
.twvar-opt--color.is-missing { opacity: .45; background: #fff; border-color: var(--twvar-line); }
.twvar-opt--color.is-out::after,
.twvar-opt--color.is-missing::after {
	left: 2px;
	right: 2px;
	transform: rotate(-45deg);
	background: rgba(36, 29, 38, .8);
	opacity: 1;
}

.twvar-select__hint {
	margin: 12px 0 0;
	padding: 9px 13px;
	border-radius: 10px;
	background: #fff4f6;
	color: #b03050;
	font-size: 13.5px;
	font-weight: 600;
}

.twvar-select__reset {
	margin-top: 12px;
	padding: 0;
	border: 0;
	background: none;
	color: #6b636f;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}
.twvar-select__reset:hover { color: var(--twvar-accent); }

/* ---------- SKU + QR odabrane varijacije ---------- */

/* Suptilno: bez okvira i bijele kartice, sitniji QR, prigusen tekst.
   Ovo je pomocna informacija za trgovinu, ne dio kupovnog toka. */
.twvar-sku {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0 22px;
	padding: 0;
	border: 0;
	background: none;
}
.twvar-sku[hidden] { display: none; }
.twvar-sku__code {
	font-size: 12.5px; color: #8b8391; text-transform: uppercase; letter-spacing: .04em;
}
.twvar-sku__code strong {
	font-size: 12.5px; color: #6b636f; font-weight: 600; letter-spacing: .02em;
}
.twvar-sku__qr { flex: none; line-height: 0; opacity: .6; transition: opacity .15s ease; }
.twvar-sku:hover .twvar-sku__qr { opacity: 1; }
.twvar-sku__qr img,
.twvar-sku__qr canvas { display: block; width: 52px; height: 52px; }
