/*
 * Hearts and picture arrows (inc/cards.php, assets/js/favourites.js, assets/js/cards.js), and the favourites parts
 * (inc/favourites.php): the sign-in panel, the "Your favourites" row and the favourites page. The round buttons are
 * white circles with a light grey line and a black icon; a saved product's heart is filled red. They need their
 * scripts, so they only show once those run (.cc-favourites-on for hearts, .cc-cards for arrows).
 */
.cc-round-button {
	display: none;
	align-items: center;
	justify-content: center;
	width: var(--cc-round-button);
	height: var(--cc-round-button);
	padding: 0;
	border: var(--cc-line) solid var(--cc-grey-200);
	border-radius: 50%;
	background: var(--cc-white);
	color: var(--cc-ink);
	cursor: pointer;
}

.cc-favourites-on .cc-fav {
	display: inline-flex;
}

/* The heart looks 40px but takes presses over 44px, a comfortable touch target (measured from inside its line, so the
   line is taken off). The product page's heart is 44px itself. */
.cc-fav {
	position: relative;
}

.cc-fav::before {
	content: "";
	position: absolute;
	inset: calc((var(--cc-round-button) - var(--cc-control-height)) / 2 - var(--cc-line));
	border-radius: 50%;
}

/* A saved product's heart is filled in the SALE pill's red, so it is plain to see (owner, 2026-10-18); 4.8:1 on its
   white circle. The header's heart is a link, not one of these, and stays black. */
.cc-fav[aria-pressed="true"] {
	color: var(--cc-badge);
}

.cc-fav[aria-pressed="true"] .cc-fav__shape {
	fill: currentColor;
}

/*
 * On a card: a layer the size of the (square) picture, laid over it but outside the card's link. Only its buttons
 * take clicks; everywhere else the click reaches the link underneath. Nothing in it takes up room, so the card keeps
 * its height.
 */
.woocommerce ul.products li.product {
	position: relative;
}

.cc-card-tools {
	position: absolute;
	inset: 0 0 auto;
	aspect-ratio: 1 / 1;
	pointer-events: none;
}

.cc-card-tools > .cc-round-button {
	position: absolute;
	pointer-events: auto;
}

.cc-card-tools > .cc-fav {
	right: var(--cc-space-2);
	bottom: var(--cc-space-2);
}

.cc-card-arrow {
	top: 50%;
	transform: translateY(-50%);
}

.cc-card-arrow--prev {
	left: var(--cc-space-2);
}

.cc-card-arrow--next {
	right: var(--cc-space-2);
}

/* Arrows only where there is a mouse to point with, never on touch screens; they fade in while the card is pointed at
   or holds keyboard focus. */
@media (hover: hover) and (pointer: fine) {
	/* (Inside this block: touch screens keep :hover after a tap.) */
	.cc-round-button:hover {
		border-color: var(--cc-ink);
	}

	.cc-cards .cc-card-arrow {
		display: flex;
		opacity: 0;
		transition: opacity 0.2s ease;
	}

	.woocommerce ul.products li.product:is(:hover, :focus-within) .cc-card-arrow {
		opacity: 1;
	}
}

/* The pictures could not be fetched (assets/js/cards.js): no arrows on this page */
html.cc-no-pictures .cc-card-arrow {
	display: none;
}

/* Product page: the price, and the heart at the end of its line (a full-size touch target) */
.cc-price-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--cc-space-4);
	margin: 0 0 var(--cc-space-5);
}

.woocommerce div.product .cc-price-row p.price {
	margin: 0;
}

.cc-fav--product {
	flex: none;
	width: var(--cc-control-height);
	height: var(--cc-control-height);
}

/* The favourites page */
.cc-favourites__empty {
	padding: var(--cc-space-7) 0;
	text-align: center;
}

.cc-favourites__empty-title {
	margin: 0 0 var(--cc-space-2);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-size-h3);
	font-weight: 600;
}

.cc-favourites__empty .cc-button {
	margin-top: var(--cc-space-4);
}

.cc-favourites__all {
	margin: var(--cc-space-6) 0 0;
	text-align: center;
}

/* Log in and Create account, side by side; one above the other when there is no room */
.cc-sign-in-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cc-space-3);
}

.cc-sign-in-links .cc-button {
	flex: 1 1 10rem;
}

.cc-favourites__sign-in {
	max-width: 26rem;
}

.cc-favourites__moving {
	margin: var(--cc-space-4) 0 0;
	color: var(--cc-grey-600);
}

/* The sign-in panel a heart opens for shoppers who are not signed in: a white box in the middle of a shaded page.
   The whole box is its inner part, so a press on the dialog element itself is a press on the shade. */
.cc-panel {
	width: min(26rem, calc(100% - 2 * var(--cc-gutter)));
	max-width: none;
	padding: 0;
	border: var(--cc-line) solid var(--cc-ink);
	border-radius: var(--cc-radius);
	background: var(--cc-white);
	color: var(--cc-ink);
}

.cc-panel::backdrop {
	background: var(--cc-ink);
	opacity: 0.5;
}

.cc-panel__body {
	position: relative;
	padding: var(--cc-space-6) var(--cc-space-5) var(--cc-space-5);
}

.cc-panel__title {
	margin: 0 var(--cc-space-6) var(--cc-space-3) 0;
	font-size: var(--cc-size-h3);
}

.cc-panel__body p {
	margin: 0 0 var(--cc-space-5);
}

.cc-panel__close {
	position: absolute;
	top: var(--cc-space-2);
	right: var(--cc-space-2);
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--cc-control-height);
	height: var(--cc-control-height);
	padding: 0;
	border: 0;
	background: none;
	color: var(--cc-ink);
	cursor: pointer;
}

/* "Couldn't save that…": over the top of the page for a few seconds, so nothing moves. Empty, it takes no room but
   stays on the page, so screen readers hear it when words arrive. */
.cc-toast {
	position: fixed;
	top: var(--cc-space-4);
	left: 50%;
	z-index: 60;
	width: max-content;
	max-width: calc(100% - 2 * var(--cc-gutter));
	margin: 0;
	padding: var(--cc-space-3) var(--cc-space-4);
	border-radius: var(--cc-radius);
	background: var(--cc-ink);
	color: var(--cc-white);
	font-size: var(--cc-size-small);
	transform: translateX(-50%);
}

.cc-toast:empty {
	padding: 0;
}

/* "Your favourites" on the home and shop pages: under 1024px one row that scrolls sideways, like the shop's category
   pictures, so eight cards don't push the page down; the last card in view is cut off at the edge, which shows there
   is more. Four to a row from 1024px. A little room above and below keeps the cards' focus outline in view. */
@media (max-width: 1023px) {
	.cc-section--favourites .woocommerce ul.products {
		grid-auto-columns: 42%;
		grid-auto-flow: column;
		grid-template-columns: none;
		margin: 0 calc(-1 * var(--cc-gutter));
		padding: var(--cc-space-1) var(--cc-gutter);
		overflow-x: auto;
		scroll-padding-inline: var(--cc-gutter);
		scroll-snap-type: x proximity;
		scrollbar-width: none;
	}

	.cc-section--favourites .woocommerce ul.products li.product {
		scroll-snap-align: start;
	}
}

@media (min-width: 720px) and (max-width: 1023px) {
	.cc-section--favourites .woocommerce ul.products {
		grid-auto-columns: 28%;
	}
}
