/*
 * Fatalii Cart Companion — the cart box.
 *
 * The box borrows the shop's own typeface, text colour and buttons, and adds only what it needs to
 * read as one clear offer: a headline, how far the order is from free shipping, and a row of
 * product cards. Lines and surfaces are mixed from the theme's own text colour, so the box sits
 * right on a light or a dark theme without knowing which one it is.
 */

.fcc-box {
	--fcc-accent: #3f8048;
	--fcc-accent-ink: #2d5c34;
	--fcc-accent-soft: #eaf2ea;
	--fcc-heat: #b3302a;
	--fcc-line: rgba(0, 0, 0, 0.14);
	--fcc-line-soft: rgba(0, 0, 0, 0.08);
	--fcc-muted: rgba(0, 0, 0, 0.62);
	--fcc-surface: rgba(0, 0, 0, 0.02);
	--fcc-chip: rgba(0, 0, 0, 0.05);
	--fcc-gap: 1em;
	--fcc-card: #fff;
	container-type: inline-size;
	clear: both;
	margin: 0 0 2.5em;
	padding: 1.25em 1.35em 1.4em;
	border: 1px solid var(--fcc-line-soft);
	border-radius: 18px;
	background: var(--fcc-surface);
}

/* Canvas is the page's own paper colour, so the cards stay white on a light theme and dark on a
   dark one, whatever the shop's palette is. */
@supports (background: Canvas) {
	.fcc-box {
		--fcc-card: Canvas;
	}
}

/* Mixing from currentColor keeps every line and surface readable on a dark theme too. */
@supports (color: color-mix(in srgb, currentColor 10%, transparent)) {
	.fcc-box {
		--fcc-line: color-mix(in srgb, currentColor 18%, transparent);
		--fcc-line-soft: color-mix(in srgb, currentColor 10%, transparent);
		--fcc-muted: color-mix(in srgb, currentColor 68%, transparent);
		--fcc-surface: color-mix(in srgb, currentColor 2.5%, transparent);
		--fcc-chip: color-mix(in srgb, currentColor 7%, transparent);
	}
}

/* The grid below would otherwise beat the browser's own rule for the hidden attribute, which would
   show every batch at once. */
.fcc-box [hidden] {
	display: none !important;
}

/* --------------------------------------------------------------------- *
 * Head: the promise and how far the cart is from it
 * --------------------------------------------------------------------- */

.fcc-head {
	display: flex;
	flex-direction: column;
	gap: 0.7em;
	margin: 0 0 1.25em;
	padding-bottom: 1.1em;
	border-bottom: 1px solid var(--fcc-line-soft);
}

.fcc-message {
	margin: 0;
	font-size: 1.05em;
	font-weight: 600;
	line-height: 1.4;
	text-wrap: balance;
}

.fcc-progress {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
}

.fcc-progress-track {
	height: 9px;
	border-radius: 99px;
	background: var(--fcc-chip);
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
	overflow: hidden;
}

.fcc-progress-fill {
	height: 100%;
	border-radius: 99px;
	background: linear-gradient(180deg, color-mix(in srgb, var(--fcc-accent) 82%, white), var(--fcc-accent));
	transition: width 0.4s ease;
}

.fcc-progress-labels {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	font-size: 0.8em;
	line-height: 1.3;
	color: var(--fcc-muted);
	font-variant-numeric: tabular-nums;
}

/* The one button that finishes what the progress bar started. */
.fcc-box .fcc-closer {
	display: block;
	float: none;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0.3em 0 0;
	padding: 0.7em 1em;
	border: 0;
	border-radius: 999px;
	background: var(--fcc-accent);
	background-image: none;
	color: #fff;
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
	text-shadow: none;
	box-shadow: 0 8px 18px -10px var(--fcc-accent);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fcc-box .fcc-closer:hover {
	transform: translateY(-1px);
	box-shadow: 0 12px 22px -10px var(--fcc-accent);
}

.fcc-box .fcc-closer.is-added::after {
	content: " ✓";
}

/* --------------------------------------------------------------------- *
 * The cards
 * --------------------------------------------------------------------- */

/* Two roomy cards side by side in a narrow cart column, and the whole batch on one line as soon as
   there is room for it — never three with a fourth left alone underneath. --fcc-cols is how many
   cards that list holds, written into the markup. */
.fcc-items {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--fcc-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

@container (min-width: 620px) {
	.fcc-items {
		grid-template-columns: repeat(var(--fcc-cols, 4), minmax(0, 1fr));
	}
}

.fcc-items + .fcc-items {
	margin-top: var(--fcc-gap);
}

.fcc-item {
	display: flex;
	flex-direction: column;
	gap: 0.55em;
	margin: 0;
	padding: 0.8em 0.8em 0.9em;
	background: var(--fcc-card);
	border: 1px solid var(--fcc-line-soft);
	border-radius: 14px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 18px -10px rgba(0, 0, 0, 0.22);
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.fcc-item:hover {
	transform: translateY(-3px);
	border-color: var(--fcc-line);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 16px 30px -14px rgba(0, 0, 0, 0.32);
}

.fcc-link {
	display: flex;
	flex-direction: column;
	gap: 0.55em;
	color: inherit;
	text-decoration: none;
}

/* Product photos are square in the shop, so the picture is a square too: nothing gets cropped into a
   strip or stretched (Jukka, 2026-09-22). The image itself comes from srcset at a sharp size. */
.fcc-media {
	display: block;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 1;
	border-radius: 11px;
	background: var(--fcc-chip);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
	overflow: hidden;
}

.fcc-image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: cover;
}

.fcc-name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	font-weight: 600;
	line-height: 1.3;
}

.fcc-link:hover .fcc-name {
	text-decoration: underline;
}

.fcc-reason {
	align-self: flex-start;
	max-width: 100%;
	padding: 0.25em 0.7em;
	border-radius: 99px;
	background: var(--fcc-chip);
	color: var(--fcc-muted);
	font-size: 0.78em;
	font-weight: 500;
	line-height: 1.5;
}

.fcc-reason-gap,
.fcc-reason-fertilizer,
.fcc-reason-labels {
	background: var(--fcc-accent-soft);
	color: var(--fcc-accent-ink);
}

.fcc-notes {
	display: flex;
	flex-direction: column;
	gap: 0.35em;
}

.fcc-note {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	overflow: hidden;
	font-size: 0.82em;
	line-height: 1.4;
	color: var(--fcc-muted);
}

/* The product's own words, filling the space a card without notes or sizes would leave empty. The
   clamp is the second cut: the text already arrives shortened, ending in an ellipsis. */
.fcc-desc {
	-webkit-line-clamp: 6;
}

/* The note that says the order changes to a parcel: worth reading before adding. */
.fcc-note-ship {
	padding-left: 0.6em;
	border-left: 2px solid var(--fcc-line);
}

/* Size choices behave as one control, so they look like one. */
.fcc-sizes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
	gap: 4px;
}

.fcc-size {
	padding: 0.4em 0.3em;
	border: 1px solid var(--fcc-line);
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.76em;
	line-height: 1.3;
	text-align: center;
	cursor: pointer;
}

.fcc-size.is-on {
	background: var(--fcc-accent-soft);
	border-color: var(--fcc-accent);
	box-shadow: inset 0 0 0 1px var(--fcc-accent);
	color: var(--fcc-accent-ink);
}

.fcc-size-price {
	display: block;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.fcc-save {
	display: block;
	color: var(--fcc-accent);
}

/* Price and heat, the two things a customer compares, sit on one line under the details. */
.fcc-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6em;
	padding-top: 0.15em;
}

.fcc-price {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.fcc-price del {
	margin-right: 0.35em;
	font-weight: 400;
	color: var(--fcc-muted);
}

.fcc-heat {
	display: flex;
	gap: 3px;
	flex: none;
}

.fcc-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--fcc-line);
}

.fcc-dot.is-on {
	background: var(--fcc-heat);
}

.fcc-box .fcc-add {
	display: block;
	float: none;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: auto 0 0;
	padding: 0.55em 0.9em;
	border: 1.5px solid var(--fcc-accent);
	border-radius: 999px;
	background: transparent;
	background-image: none;
	box-shadow: none;
	color: var(--fcc-accent-ink);
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
	text-shadow: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.fcc-box .fcc-add:hover,
.fcc-box .fcc-add:focus {
	background: var(--fcc-accent);
	color: #fff;
}

.fcc-box .fcc-add.is-added {
	background: var(--fcc-accent);
	border-color: var(--fcc-accent);
	color: #fff;
}

.fcc-add.is-busy {
	opacity: 0.6;
	pointer-events: none;
}

.fcc-add.is-added {
	pointer-events: none;
}

.fcc-add.is-added::after {
	content: " ✓";
}

/* --------------------------------------------------------------------- *
 * Under the cards
 * --------------------------------------------------------------------- */

.fcc-actions {
	display: flex;
	flex-direction: column;
	gap: 0.6em;
	margin-top: 1.35em;
}

.fcc-box .fcc-more-button,
.fcc-box .fcc-less-button,
.fcc-box .fcc-random {
	display: block;
	float: none;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
	border-radius: 99px;
	cursor: pointer;
}

.fcc-box .fcc-less-button {
	background: transparent;
	color: var(--fcc-muted);
	font-size: 0.9em;
}

.fcc-box .fcc-random {
	background: var(--fcc-accent-soft);
	color: var(--fcc-accent-ink);
	border: 1px solid var(--fcc-accent);
}

.fcc-random.is-busy {
	opacity: 0.6;
	pointer-events: none;
}

/* "or" with a hairline either side: two paths, one of them enough. */
.fcc-or {
	display: flex;
	align-items: center;
	gap: 0.75em;
	margin: 0;
	color: var(--fcc-muted);
	font-size: 0.72em;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.fcc-or::before,
.fcc-or::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--fcc-line-soft);
}

.fcc-link:focus-visible,
.fcc-add:focus-visible,
.fcc-size:focus-visible,
.fcc-more-button:focus-visible,
.fcc-random:focus-visible {
	outline: 2px solid var(--fcc-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.fcc-item,
	.fcc-progress-fill {
		transition: none;
	}
}

@media (max-width: 480px) {
	.fcc-box {
		padding: 1em 1em 1.2em;
	}

	.fcc-items {
		gap: 0.8em;
	}
}

/* --------------------------------------------------------------------- *
 * Administrators only: what the engine decided
 * --------------------------------------------------------------------- */

.fcc-debug {
	margin: 0 0 2em;
	padding: 0.75em 1em;
	font-size: 0.85em;
	background: #fffbe6;
	border: 1px dashed #d4b106;
	color: #333;
}

.fcc-debug summary {
	cursor: pointer;
	font-weight: 600;
}

.fcc-debug-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
}

.fcc-debug-table th,
.fcc-debug-table td {
	padding: 0.2em 0.4em;
	border: 1px solid rgba(0, 0, 0, 0.1);
	text-align: left;
}
