/* Unistar Palette — tokens taken from Figma "Unistar Ink LP" (frame 212:179 / mobile 243:151). */
.unistar-palette {
	color-scheme: only light;
	--up-ink: #000;
	--up-paper: #fff;
	--up-line: #d9d9d9;
	--up-accent: #885dee;
	--up-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--up-mono: "Reddit Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	--up-card-w: 383px;
	--up-swatch-gap-x: 8px;
	--up-swatch-gap-y: 11px;

	box-sizing: border-box;
	max-width: 1281px;
	margin-inline: auto;
	color: var(--up-ink);
	font-family: var(--up-font);
}
.unistar-palette *,
.unistar-palette *::before,
.unistar-palette *::after { box-sizing: inherit; }

.unistar-palette .up-sr {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header */
.unistar-palette .up-header { text-align: center; margin: 0 auto 48px; max-width: 820px; }
.unistar-palette .up-eyebrow {
	margin: 0 0 12px;
	font-family: var(--up-mono);
	font-size: clamp(14px, 1.4vw, 20px);
	letter-spacing: 0.29em;
	text-transform: uppercase;
	color: var(--up-accent);
}
.unistar-palette .up-title {
	margin: 0 0 24px;
	font-family: var(--up-font);
	font-weight: 700;
	font-size: clamp(44px, 6.25vw, 90px);
	line-height: 1;
	color: var(--up-ink);
}
.unistar-palette .up-subtitle {
	margin: 0;
	font-size: clamp(15px, 1.95vw, 28px);
	line-height: 1.5;
}

/* Filters */
.unistar-palette .up-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: space-between;
	margin-bottom: 58px;
}
.unistar-palette .up-filter {
	appearance: none;
	margin: 0;
	padding: 3px 30px;
	min-height: 48px;
	border: 1px solid var(--up-line);
	border-radius: 999px;
	background: var(--up-paper);
	color: var(--up-ink);
	font: 600 16px/42px var(--up-font);
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .15s, color .15s, border-color .15s;
}
.unistar-palette .up-filter:hover { border-color: var(--up-ink); }
.unistar-palette .up-filter[aria-pressed="true"] {
	background: var(--up-ink);
	border-color: var(--up-ink);
	color: var(--up-paper);
	filter: drop-shadow(4px 1px 3px rgba(0, 0, 0, .14));
}

/* Body: grid + card */
.unistar-palette .up-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--up-card-w);
	gap: clamp(32px, 10.4vw, 150px);
	align-items: start;
}

.unistar-palette .up-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
	gap: var(--up-swatch-gap-y) var(--up-swatch-gap-x);
}
.unistar-palette .up-grid > li { margin: 0; padding: 0; }
.unistar-palette .up-grid > li[hidden] { display: none; }
.unistar-palette .up-swatch {
	display: block;
	width: 100%;
	aspect-ratio: 55 / 54;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 5px;
	background: var(--up-c, #ccc);
	cursor: pointer;
	position: relative;
	-webkit-tap-highlight-color: transparent;
	/* Keeps very light colours (white, cream) visible on the white page. */
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
	transition: transform .15s ease;
}
.unistar-palette .up-swatch:hover { transform: scale(1.06); }
.unistar-palette .up-grid .up-swatch,
.unistar-palette .up-grid .up-swatch:hover,
.unistar-palette .up-grid .up-swatch:focus,
.unistar-palette .up-grid .up-swatch:active {
	/* Theme button styles (border, hover/focus background) must not recolour a swatch. */
	background: var(--up-c, #ccc) !important;
	border: 0 !important;
	color: inherit;
}
/* Selected colour: 1px black frame with a 2px white gap, visible on dark colours too.
   Drawn with box-shadow, so it never changes the swatch size or the grid. */
.unistar-palette .up-grid .up-swatch[aria-pressed="true"] {
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--up-ink) !important;
	outline: none;
	z-index: 1;
}
.unistar-palette .up-swatch:focus-visible,
.unistar-palette .up-filter:focus-visible,
.unistar-palette .up-btn:focus-visible {
	outline: 3px solid var(--up-accent);
	outline-offset: 3px;
}

.unistar-palette .up-count {
	margin: 16px 0 0;
	font-size: 13px;
	color: #555;
}

/* Card */
.unistar-palette .up-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 52px;
	position: sticky;
	top: 24px;
}
.unistar-palette .up-card-box {
	width: 100%;
	background: var(--up-paper);
	border: 1px solid var(--up-line);
	border-radius: 28px;
	box-shadow: 11px 11px 10.8px 5px rgba(0, 0, 0, .05);
	overflow: hidden;
	text-align: center;
}
.unistar-palette .up-card-text { padding: 22px 20px 0; }
.unistar-palette .up-brand,
.unistar-palette .up-name {
	margin: 0;
	font-family: var(--up-mono);
	letter-spacing: 0.29em;
	text-transform: uppercase;
	line-height: 1.4;
}
.unistar-palette .up-brand { font-size: 18px; font-weight: 400; }
.unistar-palette .up-name { font-size: 20px; font-weight: 700; min-height: 1.4em; }
.unistar-palette .up-bottle { position: relative; aspect-ratio: 1 / 1; overflow: hidden; }
/* Bottles are stacked so a new one can fade in over the old one (see show() in palette.js). */
.unistar-palette .up-img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center bottom;
	transition: opacity .32s ease, transform .32s cubic-bezier(.2, .7, .3, 1);
	will-change: opacity, transform;
}
.unistar-palette .up-img.is-entering { opacity: 0; transform: translateY(10px) scale(.97); }
.unistar-palette .up-img.is-leaving { opacity: 0; transform: scale(.99); }

.unistar-palette .up-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 3px 30px;
	border-radius: 999px;
	background: var(--up-ink);
	color: var(--up-paper);
	font: 600 20px/42px var(--up-font);
	text-decoration: none;
	transition: opacity .15s;
}
.unistar-palette .up-btn:hover { color: var(--up-paper); opacity: .85; }
.unistar-palette .up-btn[hidden],
.unistar-palette .up-img[hidden] { display: none; }

/* Tablet */
@media (max-width: 1024px) {
	.unistar-palette { --up-card-w: 300px; }
	.unistar-palette .up-filters { justify-content: flex-start; gap: 10px; }
}

/* Mobile — follows the mobile frame: filters scroll sideways, compact card below the grid */
@media (max-width: 767px) {
	.unistar-palette { --up-swatch-gap-x: 6px; --up-swatch-gap-y: 6px; }
	.unistar-palette .up-header { margin-bottom: 24px; text-align: left; }
	.unistar-palette .up-eyebrow { letter-spacing: .12em; font-size: 12px; margin-bottom: 8px; }
	.unistar-palette .up-title { font-size: 44px; margin-bottom: 10px; }
	.unistar-palette .up-subtitle { font-size: 14px; }

	.unistar-palette .up-filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 8px;
		margin: 0 -16px 20px;
		padding: 0 16px 4px;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.unistar-palette .up-filters::-webkit-scrollbar { display: none; }
	.unistar-palette .up-filter { font-size: 13px; line-height: 1; min-height: 37px; padding: 0 16px; }

	.unistar-palette .up-body { grid-template-columns: 1fr; gap: 20px; }
	.unistar-palette .up-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.unistar-palette .up-swatch { border-radius: 7px; }
	.unistar-palette .up-swatch:hover { transform: none; }

	/* Bar that sticks to the bottom of the screen while the grid is scrolled, so the chosen
	   colour and the shop button stay visible after every tap. Layout: bottle on the left,
	   colour name with the button underneath on the right (~140px tall). */
	.unistar-palette .up-card {
		position: sticky;
		top: auto;
		bottom: 12px;
		z-index: 5;
		display: grid;
		grid-template-columns: 104px minmax(0, 1fr);
		grid-template-rows: auto auto;
		column-gap: 14px;
		row-gap: 10px;
		align-items: center;
		padding: 14px 16px 14px 12px;
		background: var(--up-paper);
		border: 1px solid var(--up-line);
		border-radius: 20px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
	}
	/* The inner box only groups elements on desktop; here its children join the card grid. */
	.unistar-palette .up-card-box { display: contents; }
	.unistar-palette .up-bottle { grid-column: 1; grid-row: 1 / span 2; width: 104px; }
	.unistar-palette .up-card-text { grid-column: 2; grid-row: 1; align-self: end; padding: 0; min-width: 0; text-align: left; }
	.unistar-palette .up-brand { font-size: 11px; letter-spacing: .14em; }
	.unistar-palette .up-name {
		font-size: 17px;
		letter-spacing: .1em;
		line-height: 1.25;
		overflow-wrap: anywhere;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}
	.unistar-palette .up-btn { grid-column: 2; grid-row: 2; justify-self: start; align-self: start; font-size: 15px; line-height: 44px; padding: 0 22px; }
}

/* Very narrow phones (e.g. 320px): keep the label on one line */
@media (max-width: 359px) {
	.unistar-palette .up-card { grid-template-columns: 96px minmax(0, 1fr); column-gap: 12px; }
	.unistar-palette .up-bottle { width: 96px; }
	.unistar-palette .up-brand { font-size: 10px; letter-spacing: .06em; }
	.unistar-palette .up-name { font-size: 15px; letter-spacing: .06em; }
}

@media (prefers-reduced-motion: reduce) {
	.unistar-palette * { transition: none !important; }
}
