/*
 * aieo-popup-offer.css — the offer pop-up (11.3.14; the designer's "offer pop-up").
 *
 * A pop-up that shows an offer: the panel block (aieo/popup-panel) with the class `aieo-pop-offer`, seeded by the
 * pattern "Popup — an offer" (includes/dmm/blocks/patterns/popup-offer.php). The offer's own parts are the three
 * merge tags the server fills (AIEO_Popup_Offer::tag_values()): its sentence, a set's circles, when it ends.
 *
 * ── Three rules ──────────────────────────────────────────────────────────────
 *
 * 1. Every colour is the theme's (contract C2: var(--wp--preset--color--<slug>)), with a system colour or
 *    currentColor behind it for a theme that has no such slug. No colour is written here: the shop's accent is the
 *    button and the first circle, whatever the shop's accent is.
 *
 * 2. Queued only for a pop-up whose content holds one of the three tags (AIEO_Popup_Offer::queue_sheet()), in the
 *    head, before the content. A page without such a pop-up loads nothing of this.
 *
 * 3. The shell (the scrim, the box, the close button, the focus and the keyboard) is the pop-up's own
 *    (assets/css/aieo-popup.css, assets/js/aieo-popup.js). This sheet styles what is inside the panel and nothing
 *    of the shell, but the close cross's place and colour in this pop-up (11.3.16, F8: off its picture). The
 *    breakpoint is the panel's: 768px.
 *
 * Source file: served as aieo-popup-offer.min.css once `npm run build` has run.
 */

/* The panel on the theme's surface: the panel block's own look is a dark one with colours typed in its sidebar. */
.aieo-popup-panel.aieo-pop-offer {
	background: var(--wp--preset--color--bg, var(--wp--preset--color--base, Canvas));
	color: var(--wp--preset--color--fg, CanvasText);
}

.aieo-popup-panel.aieo-pop-offer .aieo-popup-panel__media {
	background: var(--wp--preset--color--subtle, color-mix(in srgb, CanvasText 6%, Canvas));
}

.aieo-popup-panel.aieo-pop-offer :focus-visible {
	outline: 2px solid var(--wp--preset--color--fg, CanvasText);
	outline-offset: 2px;
}

.aieo-popup-panel.aieo-pop-offer .aieo-popup-panel__body {
	justify-content: center;
	gap: var(--wp--preset--spacing--4, 1rem);
	padding: var(--wp--preset--spacing--9, 3rem) var(--wp--preset--spacing--8, 2.5rem);
}

/* Its children are spaced by the body's gap alone: the theme's own block margins would add to it. */
.aieo-popup-panel.aieo-pop-offer .aieo-popup-panel__body > * {
	margin-block: 0;
}

.aieo-pop-offer .aieo-pop-offer__title {
	color: inherit;
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: var(--wp--preset--font-size--3xl, 2.25rem);
	line-height: 1.05;
	text-wrap: balance;
}

.aieo-pop-offer .aieo-pop-offer__line {
	font-size: var(--wp--preset--font-size--md, 1rem);
	line-height: 1.6;
}

/* A set's circles: the units paid, then the ones given. A picture of the sentence above them. */
.aieo-pop-offer .aieo-pop-offer__set {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--2, .5rem);
}

.aieo-pop-offer .aieo-pop-offer__unit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	inline-size: 2.5rem;
	block-size: 2.5rem;
	border: 1px solid var(--wp--preset--color--line, color-mix(in srgb, currentColor 16%, transparent));
	overflow: hidden;
	border-radius: 50%;
	background: var(--wp--preset--color--accent, CanvasText);
}

/* A paid circle with the offer's product in it (11.3.16): the picture fills the circle. */
.aieo-pop-offer .aieo-pop-offer__unit > img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.aieo-pop-offer .aieo-pop-offer__unit:nth-child(even) {
	background: var(--wp--preset--color--accent-2, color-mix(in srgb, currentColor 30%, transparent));
}

/* A unit that is given: an open circle that says what it is ("Free", "-50%"). */
.aieo-pop-offer .aieo-pop-offer__unit.is-given {
	border: 1.5px solid currentColor;
	background: transparent;
	font-size: var(--wp--preset--font-size--xs, .75rem);
	font-weight: 700;
	line-height: 1;
	text-transform: uppercase;
}

/* When it ends: a clock (Lucide's, as a mask in the text's colour) and the sentence. */
.aieo-pop-offer .aieo-pop-offer__until {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--2, .5rem);
	color: var(--wp--preset--color--muted, color-mix(in srgb, currentColor 65%, transparent));
	font-size: var(--wp--preset--font-size--sm, .875rem);
}

.aieo-pop-offer .aieo-pop-offer__until::before {
	--aieo-pop-offer-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
	content: "";
	flex: none;
	inline-size: 1em;
	block-size: 1em;
	background: currentColor;
	-webkit-mask: var(--aieo-pop-offer-clock) center / contain no-repeat;
	mask: var(--aieo-pop-offer-clock) center / contain no-repeat;
}

/* The two actions on one line: the main button, then "Not now". */
.aieo-pop-offer .aieo-pop-offer__acts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--4, 1rem) var(--wp--preset--spacing--6, 1.5rem);
}

.aieo-pop-offer .aieo-pop-offer__cta .wp-block-button__link {
	display: inline-block;
	min-block-size: 2.75rem;
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--3, .75rem) var(--wp--preset--spacing--6, 1.5rem);
	border-radius: var(--wp--custom--rooster--shape--button, 0);
	background: var(--wp--preset--color--accent, CanvasText);
	color: var(--wp--preset--color--on-accent, var(--wp--preset--color--base, Canvas));
	font-size: var(--wp--preset--font-size--md, 1rem);
	font-weight: 700;
	line-height: 1.25;
	text-decoration: none;
}

.aieo-pop-offer .aieo-pop-offer__cta .wp-block-button__link:hover {
	background: var(--wp--preset--color--contrast, CanvasText);
	color: var(--wp--preset--color--bg, var(--wp--preset--color--base, Canvas));
}

.aieo-pop-offer .aieo-pop-offer__later a {
	display: inline-block;
	padding-block: var(--wp--preset--spacing--2, .5rem);
	color: inherit;
	font-size: var(--wp--preset--font-size--sm, .875rem);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: .2em;
}

.aieo-pop-offer .aieo-pop-offer__fine {
	color: var(--wp--preset--color--muted, color-mix(in srgb, currentColor 65%, transparent));
	font-size: var(--wp--preset--font-size--xs, .75rem);
}

/* ── The close cross off its picture (11.3.16, F8, the designer's pop-up): in the panel's corner, outside the image ──
 * The shell pins the cross to the box's top-right corner. The picture holds that corner on a phone (it leads there)
 * and on a desktop where the merchant puts it on the right or on top: there it starts 52px lower, so the corner is the
 * panel's own surface. The cross is drawn there in the text token, its target 44px, without the shadow it needed over
 * a photograph. With the picture on the left (the pattern's), the corner is the words' already: their padding keeps
 * them clear of it. */
.aieo-pop .aieo-pop__box:has(.aieo-pop-offer) .aieo-pop__close {
	top: 4px;
	right: 4px;
	width: 44px;
	height: 44px;
	color: var(--wp--preset--color--fg, CanvasText);
	opacity: 1;
}

.aieo-pop .aieo-pop__box:has(.aieo-pop-offer) .aieo-pop__close svg {
	filter: none;
}

.aieo-popup-panel.aieo-pop-offer.aieo-popup-panel--right .aieo-popup-panel__media,
.aieo-popup-panel.aieo-pop-offer.aieo-popup-panel--top .aieo-popup-panel__media {
	margin-block-start: 52px;
}

/* ── Phone: the picture above (the panel's own stacking), the button as wide as the box ── */
@media (max-width: 767px) {
	.aieo-popup-panel.aieo-pop-offer .aieo-popup-panel__media {
		margin-block-start: 52px; /* the cross's corner above the picture (F8) */
	}

	.aieo-popup-panel.aieo-pop-offer .aieo-popup-panel__body {
		padding: var(--wp--preset--spacing--6, 1.5rem);
	}

	.aieo-pop-offer .aieo-pop-offer__title {
		font-size: var(--wp--preset--font-size--2xl, 1.75rem);
	}

	.aieo-pop-offer .aieo-pop-offer__acts {
		flex-direction: column;
		align-items: stretch;
		gap: var(--wp--preset--spacing--2, .5rem);
	}

	.aieo-pop-offer .aieo-pop-offer__acts .wp-block-buttons,
	.aieo-pop-offer .aieo-pop-offer__cta {
		inline-size: 100%;
	}

	.aieo-pop-offer .aieo-pop-offer__cta .wp-block-button__link {
		display: block;
		text-align: center;
	}

	.aieo-pop-offer .aieo-pop-offer__later {
		text-align: center;
	}
}
