/*
 * Cvit & Co – "Složi svoj poklon paket" builder.
 * The box is a real photo (open: lined with the Cvit & Co paper; closed: lid with satin ribbon),
 * products are photo cut-outs; names are drawn as embroidery on top of them.
 * Colours follow cvit-ux (--cvit-*), with fallbacks for pages without it.
 */

.cvit-box {
	--ribbon: #e9a9c6;
	--ink: var(--cvit-ink, #1f2933);
	--muted: var(--cvit-muted, #5e6770);
	--blue: var(--cvit-blue, #486683);
	--line: var(--cvit-line, #e7dcd4);
	--cream: var(--cvit-cream, #fffaf7);
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: 40px;
	align-items: start;
	margin: 24px 0 48px;
	color: var(--ink);
}

/* ---- Stage: the box ---------------------------------------------------- */

.cvit-box__stage { position: sticky; top: 110px; }
.cvit-box__scene {
	position: relative;
	aspect-ratio: 1500 / 1027;
	max-width: 100%;
}
.cvit-box__open,
.cvit-box__closed {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	border-radius: 4px;
}
.cvit-box__closed {
	z-index: 100;
	opacity: 0;
	transform: translateY(-5%) scale(1.03);
	transition: opacity .45s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
	pointer-events: none;
}
.cvit-box.is-closed .cvit-box__closed { opacity: 1; transform: none; }

.cvit-box__items {
	position: absolute;
	overflow: hidden;
	z-index: 1;
}
.cvit-box__item {
	position: absolute;
	transform: translate(-50%, -50%) rotate(var(--r, 0deg));
	filter: drop-shadow(0 5px 5px rgba(70, 45, 20, .3)) drop-shadow(0 1px 1px rgba(70, 45, 20, .25));
}
.cvit-box__item.is-new { animation: cvit-box-drop .5s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes cvit-box-drop {
	from { opacity: 0; transform: translate(-50%, -80%) rotate(var(--r, 0deg)) scale(1.1); }
	to { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1); }
}

/* Every product drawing is a size container, so names scale with it (cqw). */
.cvit-box__cut,
.cvit-box__tint,
.cvit-box__blanket {
	position: relative;
	width: 100%;
	container-type: inline-size;
}
.cvit-box__cut img,
.cvit-box__tint img {
	display: block;
	width: 100%;
	height: auto;
}

/* Recoloured cut-out: colour layer masked by the photo, photo on top in luminosity. */
.cvit-box__tint { isolation: isolate; }
.cvit-box__tint::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--tint);
	-webkit-mask: var(--mask) center / 100% 100% no-repeat;
	mask: var(--mask) center / 100% 100% no-repeat;
}
.cvit-box__tint img { position: relative; mix-blend-mode: luminosity; }

/* Folded blanket tied with the chosen satin ribbon, a card tucked under it, the name stitched bottom right. */
.cvit-box__fabric {
	position: relative;
	aspect-ratio: 1 / 1.06;
	border-radius: 5% / 5%;
	background: var(--pattern) center / 105% auto;
	box-shadow:
		inset 0 0 0 2.2cqw rgba(255, 248, 238, .38),
		inset -3cqw -4cqw 6cqw rgba(0, 0, 0, .2),
		inset 2cqw 2cqw 4cqw rgba(255, 255, 255, .16);
	overflow: hidden;
}
.cvit-box__fabric::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 51%;
	height: 7%;
	background: linear-gradient(180deg, rgba(0, 0, 0, .14), rgba(0, 0, 0, 0) 70%);
	pointer-events: none;
}
.cvit-box__card {
	position: absolute;
	left: 8%;
	top: 9%;
	width: 42%;
	aspect-ratio: 3 / 2;
	transform: rotate(-9deg);
	background:
		radial-gradient(circle at 92% 12%, rgba(236, 160, 182, .65) 0 6%, transparent 7%),
		radial-gradient(circle at 84% 20%, rgba(236, 160, 182, .45) 0 4%, transparent 5%),
		radial-gradient(circle at 8% 88%, rgba(236, 160, 182, .55) 0 5%, transparent 6%),
		repeating-linear-gradient(180deg, transparent 0 22%, rgba(80, 80, 110, .22) 22% 24%) 14% 34% / 66% 52% no-repeat,
		#fffdf8;
	box-shadow: 0 .6cqw 1.2cqw rgba(0, 0, 0, .22);
}
.cvit-box__band {
	position: absolute;
	z-index: 2;
	box-shadow: 0 .3cqw .8cqw rgba(0, 0, 0, .25);
}
.cvit-box__band.is-v {
	left: 56%; top: -2%; bottom: -2%; width: 10cqw; transform: translateX(-50%);
	background: var(--cvit-ribbon-v) center top / 100% auto repeat-y;
}
.cvit-box__band.is-h {
	top: 40%;
	left: -2%;
	right: -2%;
	height: 10cqw;
	transform: translateY(-50%);
	background: var(--cvit-ribbon-h) left center / auto 100% repeat-x;
}
.is-tie-cross .cvit-box__band.is-h { top: 42%; }

/* Take an item out of the box: × on hover (always shown on touch screens). */
.cvit-box__x {
	position: absolute;
	z-index: 10;
	top: 4%;
	right: 4%;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(31, 41, 51, .82);
	color: #fff;
	font-size: 18px;
	line-height: 28px;
	text-align: center;
	cursor: pointer;
	opacity: 0;
	transform: rotate(calc(var(--r, 0deg) * -1));
	transition: opacity .15s ease;
}
.cvit-box__item { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.cvit-box__item img { -webkit-user-drag: none; pointer-events: none; }
.cvit-box__item.is-dragging {
	cursor: grabbing;
	filter: drop-shadow(0 14px 12px rgba(70, 45, 20, .35)) drop-shadow(0 2px 2px rgba(70, 45, 20, .25));
	transform: translate(-50%, -52%) rotate(var(--r, 0deg)) scale(1.03);
}
.cvit-box.is-closed .cvit-box__item { cursor: default; }
.cvit-box__item:hover .cvit-box__x,
.cvit-box__x:focus-visible { opacity: 1; }
@media (hover: none) {
	.cvit-box__x { opacity: .9; width: 24px; height: 24px; line-height: 24px; font-size: 16px; }
}
.cvit-box.is-closed .cvit-box__x { display: none; }
.cvit-box__bow {
	position: absolute;
	z-index: 4;
	left: 50%;
	top: 40%;
	width: 66cqw;
	max-width: none;
	transform: translate(-50%, -50%) rotate(-2deg);
	filter: drop-shadow(0 .5cqw .7cqw rgba(0, 0, 0, .3));
}
.is-tie-cross .cvit-box__bow { left: 56%; top: 42%; width: 58cqw; transform: translate(-50%, -50%) rotate(-20deg); }

/* Embroidered (or painted) names: thread colour with a fine stitch texture and a little relief. */
.cvit-box__thread {
	position: absolute;
	z-index: 3;
	transform: translate(-50%, -50%) rotate(var(--r, 0deg));
	white-space: nowrap;
	font-size: calc(var(--s) * 1cqw);
	line-height: 1;
	color: var(--c);
	background:
		repeating-linear-gradient(118deg, rgba(255, 255, 255, .22) 0 .045em, rgba(0, 0, 0, .14) .045em .09em),
		var(--c);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	text-shadow: 0 .05em .03em rgba(0, 0, 0, .38), 0 -.02em 0 rgba(255, 255, 255, .3);
	pointer-events: none;
}
.cvit-box__thread.is-type { font-family: "Courier Prime", "Courier New", Courier, monospace; font-weight: 700; letter-spacing: .01em; }
.cvit-box__thread.is-script { font-family: "Dancing Script", "Brush Script MT", cursive; font-weight: 700; }
.cvit-box__thread.is-caps { font-family: "Courier Prime", "Courier New", Courier, monospace; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.cvit-box__thread.is-round { font-family: Pacifico, "Brush Script MT", cursive; letter-spacing: .02em; }
.cvit-box__thread.is-hand { font-family: Sacramento, "Dancing Script", cursive; font-weight: 400; -webkit-text-stroke: .015em var(--c); }
.cvit-box__heart { display: inline-block; margin-left: .04em; font-family: Arial, sans-serif; font-size: .38em; vertical-align: .55em; -webkit-text-stroke: 0; }
.cvit-box__thread.is-hand.is-bold { -webkit-text-stroke: .035em var(--c); }
.cvit-box__thread.is-serif { font-family: Alice, Georgia, "Times New Roman", serif; text-transform: uppercase; letter-spacing: .05em; }
/* Kapa: name embossed on a stitched leather label on the cuff, as on the real hats. */
.cvit-box__thread.is-leather {
	padding: .35em .7em .3em;
	border-radius: .25em;
	background: linear-gradient(180deg, #a87a51, #7c5334);
	-webkit-background-clip: padding-box;
	background-clip: padding-box;
	-webkit-text-fill-color: var(--c);
	outline: .07em dashed rgba(255, 228, 196, .75);
	outline-offset: -.22em;
	text-shadow: 0 -.05em 0 rgba(0, 0, 0, .5), 0 .04em 0 rgba(255, 255, 255, .15);
	box-shadow: 0 .1em .2em rgba(0, 0, 0, .35);
}

.cvit-box__hint {
	margin: 14px 0 6px;
	color: var(--muted);
	text-align: center;
	font-size: 15px;
}
.cvit-box__disclaimer {
	margin: 10px 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--muted);
	text-align: center;
}
.cvit-box__meter {
	position: relative;
	height: 26px;
	border-radius: 13px;
	background: #f1ebe5;
	overflow: hidden;
}
.cvit-box__meter-bar {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: linear-gradient(90deg, #f3c7cf, #e9a5b3);
	transition: width .35s ease;
}
.cvit-box__meter-text {
	position: relative;
	display: block;
	line-height: 26px;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--ink);
}

/* ---- Steps ------------------------------------------------------------- */

.cvit-box__step {
	padding: 0 0 26px;
	margin: 0 0 26px;
	border-bottom: 1px solid var(--line);
}
.cvit-box__step:last-child { border-bottom: 0; margin-bottom: 0; }
.cvit-box__title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 12px;
	font-size: 22px;
	line-height: 1.25;
}
.cvit-box__title span {
	display: inline-grid;
	place-items: center;
	flex: 0 0 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--blue);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
}
.cvit-box__note { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.cvit-box__name {
	width: 100%;
	max-width: 320px;
	padding: 12px 14px;
	border: 1px solid #cfc4bb;
	border-radius: 10px;
	font-size: 18px;
	background: #fff;
}

.cvit-box__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cvit-box__card-item {
	display: grid;
	grid-template-columns: 88px 1fr;
	gap: 10px;
	align-content: start;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: #fff;
}
.cvit-box__card-item.is-in { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.cvit-box__thumb {
	width: 88px;
	height: 88px;
	display: grid;
	place-items: center;
	overflow: hidden;
	border-radius: 10px;
	background: #f6f1ea;
}
.cvit-box__thumb > * { width: 78px; }
.cvit-box__info h3 { margin: 0 0 2px; font-size: 15px; line-height: 1.3; }
.cvit-box__info h3 a { color: var(--ink); text-decoration: none; }
.cvit-box__price { margin: 0; font-size: 14px; font-weight: 600; color: var(--blue); }
.cvit-box__opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cvit-box__opts-label { width: 100%; font-size: 12px; color: var(--muted); }
.cvit-box__opt {
	padding: 6px 10px;
	border: 1px solid #d8cdc4;
	border-radius: 999px;
	background: #fff;
	font-size: 13px;
	line-height: 1.2;
	color: var(--ink);
	cursor: pointer;
}
.cvit-box__opt[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: #fff; }
.cvit-box__withname { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin: 0; font-size: 13px; color: var(--ink); }
.cvit-box__own { grid-column: 1 / -1; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.cvit-box__own input { padding: 8px 10px; border: 1px solid #cfc4bb; border-radius: 8px; font-size: 15px; }
.cvit-box__put {
	grid-column: 1 / -1;
	padding: 9px 12px;
	border: 0;
	border-radius: 10px;
	background: #f6e3e7;
	color: var(--ink);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
}
.cvit-box__put:hover { background: #f0cfd6; }
.cvit-box__put:disabled { opacity: .5; cursor: not-allowed; }

.cvit-box__ribbons { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.cvit-box__ribbon {
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}
.cvit-box__ribbon i {
	display: block;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background:
		linear-gradient(135deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .18)),
		var(--c);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.cvit-box__ribbon[aria-checked="true"] i { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--blue); }
.cvit-box__close, .cvit-box__add { width: 100%; }
.cvit-box__reopen { margin-top: 10px; padding: 0; border: 0; background: none; color: var(--blue); text-decoration: underline; cursor: pointer; font-size: 14px; }

.cvit-box__list { list-style: none; margin: 0 0 12px; padding: 0; }
.cvit-box__list li { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.cvit-box__list small { display: block; color: var(--muted); font-size: 13px; }
.cvit-box__remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0 0 0 8px; }
.cvit-box__total { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.cvit-box__status { margin: 10px 0 0; font-size: 14px; }
.cvit-box__status.is-error { color: var(--cvit-coral-text, #a63e2a); }

/* ---- Small screens: box on top, steps below ---------------------------- */

@media (max-width: 900px) {
	.cvit-box { grid-template-columns: 1fr; gap: 20px; }
	.cvit-box__stage { top: 100px; z-index: 5; padding: 8px 0 10px; background: var(--cream); box-shadow: 0 10px 12px -12px rgba(0, 0, 0, .25); }
	.cvit-box__scene { width: min(100%, 360px); margin: 0 auto; }
	.cvit-box__hint { display: none; }
	.cvit-box__disclaimer { margin-top: 6px; font-size: 11.5px; }
	.cvit-box__meter { height: 22px; }
	.cvit-box__meter-text { line-height: 22px; font-size: 12px; }
	.cvit-box__cards { grid-template-columns: 1fr 1fr; }
	.cvit-box__card-item { grid-template-columns: 1fr; }
	.cvit-box__thumb { width: 100%; height: 96px; }
	.cvit-box__ribbon i { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
	.cvit-box__item, .cvit-box__closed { animation: none; transition: none; }
}
