/**
 * Cart opening position demo.
 *
 * A port of the hero section in `RenoCart Landing Page.dc.html`. The design
 * held every value in an inline style bound to component state; the values are
 * unchanged here, they are just addressed by class and by the root's
 * `data-position` attribute instead.
 */

/* Keyframes, verbatim from the design ------------------------------------- */

@keyframes rcop-fade {

	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes rcop-fade-up {

	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes rcop-scale-in {

	from { opacity: 0; transform: scale(0.96); }
	to { opacity: 1; transform: scale(1); }
}

@keyframes rcop-slide-in {

	from { transform: translateX(100%); }
	to { transform: translateX(0); }
}

@keyframes rcop-slide-in-left {

	from { transform: translateX(-100%); }
	to { transform: translateX(0); }
}

@keyframes rcop-settle {

	from { opacity: 0; transform: translateY(8px) scale(0.985); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rcop-drift-one {

	from { transform: translate3d(0, 0, 0) scale(1); }
	to { transform: translate3d(42px, 28px, 0) scale(1.12); }
}

@keyframes rcop-drift-two {

	from { transform: translate3d(0, 0, 0) scale(0.97) rotate(0deg); }
	to { transform: translate3d(34px, -26px, 0) scale(1.1) rotate(-7deg); }
}

/* Root -------------------------------------------------------------------- */

.rcop {
	position: relative;
	margin-top: 72px;
	animation: rcop-fade 600ms ease-out 260ms both;
}

/*
 * Deliberately no box-sizing reset. The design has none, and its inline
 * sizes assume content-box -- the browser chrome's URL bar, for one, is
 * `max-width: 300px` plus `0 12px` padding, which is 324px wide there and
 * only 300px under border-box.
 */

/* Background blurs -------------------------------------------------------- */

.rcop__decor {
	position: absolute;
	pointer-events: none;
	border-radius: 999px;
}

.rcop__decor--one {
	left: 10%;
	right: 10%;
	top: 4%;
	height: 68%;
	filter: blur(78px);
	background:
		radial-gradient(ellipse at 28% 42%, rgba(99, 102, 241, 0.3) 0%, rgba(99, 102, 241, 0) 68%),
		radial-gradient(ellipse at 74% 52%, rgba(165, 180, 252, 0.4) 0%, rgba(165, 180, 252, 0) 66%);
	animation: rcop-drift-one 24s ease-in-out -6s infinite alternate;
}

.rcop__decor--two {
	left: -4%;
	bottom: -6%;
	width: 58%;
	height: 56%;
	filter: blur(86px);
	background:
		radial-gradient(ellipse at 38% 62%, rgba(79, 70, 229, 0.26) 0%, rgba(79, 70, 229, 0) 70%),
		radial-gradient(ellipse at 68% 34%, rgba(129, 140, 248, 0.22) 0%, rgba(129, 140, 248, 0) 72%);
	animation: rcop-drift-two 27s ease-in-out -13s infinite alternate;
}

/* Segmented control ------------------------------------------------------- */

/*
 * The design draws the control twice and swaps at its `narrow = w < 860`:
 * floating over the mock-up above that, in flow above it below. Shared
 * properties first, then what each variant changes.
 */
.rcop__control {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.86);
	backdrop-filter: blur(14px) saturate(160%);
	-webkit-backdrop-filter: blur(14px) saturate(160%);
	animation: rcop-fade-up 500ms cubic-bezier(0.22, 0.8, 0.28, 1) 700ms both;
}

.rcop__control--wide {
	position: absolute;
	z-index: 3;
	top: -42px;
	right: 43px;
	box-shadow:
		inset 0 0 0 1px rgba(15, 17, 23, 0.07),
		0 14px 34px -14px rgba(30, 32, 68, 0.34);
}

.rcop__control--narrow {
	align-items: center;
	margin-bottom: 16px;
	box-shadow:
		inset 0 0 0 1px rgba(15, 17, 23, 0.07),
		0 10px 26px -14px rgba(30, 32, 68, 0.28);
}

.rcop__control--narrow .rcop__segments {
	justify-content: center;
	width: 100%;
}

.rcop__control-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #6b7280;
}

.rcop__segments {
	display: flex;
	align-items: center;
	gap: 3px;
	padding: 3px;
	border-radius: 999px;
	background: #f4f4f7;
}

.rcop__segment {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 28px;
	margin: 0;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #6b7280;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.01em;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: inset 0 0 0 1px transparent;
	transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.rcop__segment[aria-checked="true"] {
	background: #fff;
	color: #0f1117;
	font-weight: 600;
	box-shadow:
		inset 0 0 0 1px #e0e1e7,
		0 1px 3px rgba(15, 17, 23, 0.08);
}

/* Glass frame and browser ------------------------------------------------- */

.rcop__glass {
	position: relative;
	padding: clamp(12px, 2.4vw, 22px) clamp(12px, 2.4vw, 22px) 0;
	border-radius: 22px 22px 0 0;
	background: linear-gradient(160deg, rgba(238, 242, 255, 0.62) 0%, rgba(224, 231, 255, 0.34) 100%);
	backdrop-filter: blur(24px) saturate(180%);
	-webkit-backdrop-filter: blur(24px) saturate(180%);
	box-shadow:
		inset 0 0 0 1.5px rgba(255, 255, 255, 0.85),
		inset 0 1.5px 0 rgba(255, 255, 255, 1),
		inset 0 0 48px rgba(255, 255, 255, 0.28),
		0 0 0 1px rgba(129, 140, 248, 0.34),
		0 18px 48px -22px rgba(49, 46, 129, 0.38);
	overflow: hidden;
}

.rcop__browser {
	position: relative;
	border-radius: 12px 12px 0 0;
	background: #fff;
	box-shadow:
		0 34px 70px -28px rgba(30, 32, 68, 0.42),
		inset 0 0 0 1px rgba(15, 17, 23, 0.07);
	overflow: hidden;
	animation: rcop-scale-in 700ms cubic-bezier(0.22, 0.8, 0.28, 1) 300ms both;
}

.rcop__chrome {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	padding: 12px 14px;
	border-top: 1px solid #c7d2fe;
	border-right: 1px solid #c7d2fe;
	border-bottom: 1px solid #e8e8ed;
	border-left: 1px solid #c7d2fe;
	border-radius: 12px 12px 0 0;
	background: #f4f4f7;
}

.rcop__dots {
	display: flex;
	flex-shrink: 0;
	gap: 6px;
}

.rcop__dots span {
	width: 9px;
	height: 9px;
	border-radius: 999px;
	background: #d8d9e0;
}

.rcop__url {
	display: flex;
	flex: 1 1 120px;
	align-items: center;
	min-width: 0;
	max-width: 300px;
	height: 24px;
	padding: 0 12px;
	border-radius: 999px;
	background: #fff;
	box-shadow: inset 0 0 0 1px #e8e8ed;
	color: #6b7280;
	font-size: 12px;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.rcop__viewport {
	position: relative;
	min-height: clamp(560px, 62vh, 680px);
	overflow: hidden;
}

/* Store behind the cart --------------------------------------------------- */

.rcop__store-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	padding: 20px clamp(16px, 4vw, 28px);
	animation: rcop-fade 500ms ease-out 460ms both;
}

.rcop__store-name {
	color: #0f1117;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.12em;
}

.rcop__store-nav {
	display: flex;
	align-items: center;
	gap: 22px;
	color: #3f4451;
	font-size: 13px;
}

.rcop__store-cart {
	position: relative;
	display: flex;
	color: #0f1117;
}

.rcop__store-cart svg {
	display: block;
	flex-shrink: 0;
}

.rcop__store-badge {
	position: absolute;
	top: -5px;
	right: -6px;
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 15px;
	height: 15px;
	border-radius: 999px;
	background: #141618;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
}

.rcop__store-heading {
	padding: 26px clamp(16px, 4vw, 28px) 20px;
	color: #0f1117;
	font-size: 22px;
	line-height: 1.25;
	font-weight: 600;
	letter-spacing: -0.01em;
	animation: rcop-fade 500ms ease-out 520ms both;
}

.rcop__products {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(46%, 150px), 1fr));
	gap: clamp(14px, 2vw, 22px);
	padding: 0 clamp(16px, 4vw, 28px) clamp(24px, 4vw, 44px);
	animation: rcop-fade 600ms ease-out 560ms both;
}

.rcop__product {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.rcop__product-media {
	position: relative;
	aspect-ratio: 4 / 5;
	border-radius: 8px;
	overflow: hidden;
}

.rcop__product-media img,
.rcop__line-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The gradients sit under each photo, exactly as the design had them. */
.rcop__media--throw { background: linear-gradient(150deg, #e8e1d4 0%, #d9cfbd 100%); }
.rcop__media--mug { background: linear-gradient(150deg, #6e7681 0%, #565d66 100%); }
.rcop__media--apron { background: linear-gradient(150deg, #b7c2a8 0%, #9ba98c 100%); }
.rcop__media--board { background: linear-gradient(150deg, #c9a47a 0%, #ae8657 100%); }

.rcop__product-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.rcop__product-name {
	color: #0f1117;
	font-size: 13px;
}

.rcop__product-price {
	flex-shrink: 0;
	color: #0f1117;
	font-size: 13px;
	font-weight: 600;
}

.rcop__swatches {
	display: flex;
	gap: 5px;
}

.rcop__swatch {
	width: 13px;
	height: 13px;
	border-radius: 999px;
	background: var(--rcop-swatch);
	box-shadow: inset 0 0 0 1px rgba(15, 17, 23, 0.16);
}

.rcop__swatch.is-selected {
	box-shadow: 0 0 0 1px #fff, 0 0 0 2px #0f1117;
}

.rcop__product-button {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 32px;
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px #d8d9e0;
	color: #0f1117;
	font-size: 12px;
	font-weight: 600;
}

.rcop__scrim {
	position: absolute;
	inset: 0;
	background: rgba(15, 17, 23, 0.28);
	animation: rcop-fade 400ms ease-out 880ms both;
}

/* The cart, and the three positions --------------------------------------- */

.rcop__cart-wrap {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
}

.rcop__cart {
	display: flex;
	flex-direction: column;
	width: min(390px, 100%);
	min-width: 0;
	background: #fff;
	overflow: hidden;
}

.rcop[data-position="center"] .rcop__cart-wrap {
	justify-content: center;
	padding: 20px;
}

.rcop[data-position="center"] .rcop__cart {
	max-height: 100%;
	border-radius: 16px;
	box-shadow: 0 30px 70px -20px rgba(15, 17, 23, 0.45);
	animation: rcop-scale-in 560ms cubic-bezier(0.22, 0.8, 0.28, 1) 900ms both;
}

.rcop[data-position="left"] .rcop__cart-wrap {
	justify-content: flex-start;
	padding: 0;
}

.rcop[data-position="left"] .rcop__cart {
	height: 100%;
	border-radius: 0;
	box-shadow: 24px 0 56px -18px rgba(15, 17, 23, 0.34);
	animation: rcop-slide-in-left 620ms cubic-bezier(0.22, 0.8, 0.28, 1) 900ms both;
}

.rcop[data-position="right"] .rcop__cart-wrap {
	justify-content: flex-end;
	padding: 0;
}

.rcop[data-position="right"] .rcop__cart {
	height: 100%;
	border-radius: 0;
	box-shadow: -24px 0 56px -18px rgba(15, 17, 23, 0.34);
	animation: rcop-slide-in 620ms cubic-bezier(0.22, 0.8, 0.28, 1) 900ms both;
}

/*
 * Once the visitor has driven the control the 900ms entrance delay would read
 * as a stall, so the move replays the same slide immediately and faster --
 * the design's `heroTouched` branch.
 */
.rcop.is-touched[data-position="center"] .rcop__cart {
	animation: rcop-scale-in 340ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.rcop.is-touched[data-position="left"] .rcop__cart {
	animation: rcop-slide-in-left 420ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.rcop.is-touched[data-position="right"] .rcop__cart {
	animation: rcop-slide-in 420ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

/* Cart contents ----------------------------------------------------------- */

.rcop__cart-head {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid #e8e8ed;
	animation: rcop-fade-up 380ms cubic-bezier(0.22, 0.8, 0.28, 1) 1120ms both;
}

.rcop__cart-title {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #0f1117;
	font-size: 16px;
	font-weight: 600;
}

.rcop__cart-title svg {
	display: block;
	flex-shrink: 0;
}

.rcop__cart-close {
	display: flex;
	align-items: center;
	color: #6b7280;
}

.rcop__cart-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

.rcop__cart-rule {
	height: 1px;
	margin: 0 20px;
	background: #eef0f2;
}

.rcop__line {
	display: flex;
	gap: 14px;
	padding: 18px 20px;
	animation: rcop-fade-up 400ms cubic-bezier(0.22, 0.8, 0.28, 1) 1260ms both;
}

.rcop__line + .rcop__cart-rule + .rcop__line {
	animation-delay: 1340ms;
}

.rcop__line-media {
	position: relative;
	flex-shrink: 0;
}

.rcop__line-thumb {
	width: 58px;
	height: 58px;
	border-radius: 8px;
	overflow: hidden;
}

.rcop__line-remove {
	position: absolute;
	top: -6px;
	left: -6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 999px;
	background: #f3f4f6;
	color: #6b7280;
	font-size: 12px;
	line-height: 1;
	box-shadow: 0 0 0 2px #fff;
}

.rcop__line-detail {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.rcop__line-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.rcop__line-name {
	color: #0f1117;
	font-size: 14px;
	font-weight: 600;
}

.rcop__line-prices {
	display: flex;
	flex-shrink: 0;
	align-items: baseline;
	gap: 7px;
}

.rcop__line-was {
	color: #d94f2b;
	font-size: 12px;
	text-decoration: line-through;
}

.rcop__line-now {
	color: #0f1117;
	font-size: 14px;
	font-weight: 700;
}

.rcop__line-variant {
	color: #6b7280;
	font-size: 12px;
}

.rcop__line-saving {
	flex-shrink: 0;
	color: #2f8f4e;
	font-size: 12px;
	font-weight: 600;
}

.rcop__line-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
}

.rcop__stepper {
	display: flex;
	align-items: center;
	height: 30px;
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px #e8e8ed;
}

.rcop__stepper span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	color: #6b7280;
	font-size: 14px;
}

.rcop__stepper .rcop__stepper-value {
	width: 26px;
	color: #0f1117;
	font-size: 13px;
	font-weight: 600;
}

.rcop__low-stock {
	display: inline-flex;
	align-items: center;
	height: 24px;
	padding: 0 9px;
	border-radius: 4px;
	background: #fef3c7;
	color: #b45309;
	font-size: 12px;
	font-weight: 600;
}

.rcop__coupon {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-top: 1px solid #e8e8ed;
	color: #0f1117;
	font-size: 14px;
	font-weight: 600;
	animation: rcop-fade-up 380ms cubic-bezier(0.22, 0.8, 0.28, 1) 1420ms both;
}

.rcop__coupon-chevron {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #0f1117;
}

.rcop__summary {
	display: flex;
	flex-shrink: 0;
	flex-direction: column;
	gap: 12px;
	padding: 18px 20px 20px;
	border-top: 1px solid #e8e8ed;
}

.rcop__subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	color: #0f1117;
	font-size: 16px;
	font-weight: 700;
	animation: rcop-fade-up 380ms cubic-bezier(0.22, 0.8, 0.28, 1) 1500ms both;
}

.rcop__subtotal-value {
	font-size: 18px;
	letter-spacing: -0.01em;
}

.rcop__note {
	color: #6b7280;
	font-size: 12px;
	line-height: 1.5;
}

.rcop__checkout {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 46px;
	border-radius: 8px;
	background: #141618;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	animation: rcop-settle 440ms cubic-bezier(0.22, 0.8, 0.28, 1) 1560ms both;
}

.rcop__secondary {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	animation: rcop-fade 400ms ease-out 1700ms both;
}

.rcop__secondary div {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 42px;
	border-radius: 8px;
	background: #f3f4f6;
	color: #0f1117;
	font-size: 13px;
	font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {

	.rcop *,
	.rcop *::before,
	.rcop *::after {
		animation: none !important;
	}
}

/* The switch ---------------------------------------------------------------
 *
 * One breakpoint, at the design's own `narrow = w < 860`.
 */

.rcop__control--wide {
	display: none;
}

@media (min-width: 860px) {

	.rcop__control--wide {
		display: flex;
	}

	.rcop__control--narrow {
		display: none;
	}
}

/* The design stops the drifting blurs below 900px. */
@media (max-width: 900px) {

	.rcop__decor {
		animation: none;
	}
}
