/**
 * EU Withdrawal and Legal Guarantee Compliance — harmonised legal guarantee notice.
 *
 * The notice has to stay legible at the default display size, so the image is
 * capped at a width where its small print still reads and never stretched. In
 * a narrow column (the Storefront order review is around 279px) even that is
 * too small, which is what the popover mode is for.
 */

.ayudawp-euw-guarantee {
	margin: 1em 0;
}

.ayudawp-euw-guarantee__notice {
	margin: 0;
	max-width: 640px;
}

.ayudawp-euw-guarantee__notice img {
	display: block;
	width: 100%;
	height: auto;
	/* The official file is a 1654px-wide page; without this it would be blown up
	   on wide screens and go blurry. */
	max-width: 640px;
}

.ayudawp-euw-guarantee__notice figcaption,
.ayudawp-euw-guarantee__note {
	font-size: 0.875em;
	line-height: 1.5;
	margin: 0.5em 0 0;
}

/* Disclosure mode.
 *
 * The display and list style are what the browser gives a <summary> by
 * default, written out because themes that ship an old HTML5 reset set
 * `details, summary { display: block }` (WoodMart's base.css does), which
 * takes the disclosure triangle away and leaves a line of bold text that does
 * not look like something to click. Two classes deep, so it wins over a reset
 * written against bare element names. */
.ayudawp-euw-guarantee .ayudawp-euw-guarantee__disclosure > summary {
	display: list-item;
	list-style: disclosure-closed inside;
	cursor: pointer;
	font-weight: 600;
}

.ayudawp-euw-guarantee .ayudawp-euw-guarantee__disclosure[open] > summary {
	list-style-type: disclosure-open;
	margin-bottom: 0.75em;
}

/* Popover mode.
 *
 * Without native popover support the `popover` attribute is ignored and the
 * <div> renders as a plain block, so the notice is still shown in full and the
 * shop keeps complying: the button is hidden instead, because it would do
 * nothing. Both controls only appear where the popover actually works. */
.ayudawp-euw-guarantee__open,
.ayudawp-euw-guarantee__close {
	display: none;
}

@supports selector(:popover-open) {

	.ayudawp-euw-guarantee__open {
		display: inline-block;
		cursor: pointer;
	}

	.ayudawp-euw-guarantee__close {
		display: block;
		margin-block: 0 1em;
		margin-inline: auto 0;
		cursor: pointer;
	}

	/* The browser centres an open popover with `position: fixed`, `inset: 0`
	 * and `margin: auto`. The Eric Meyer reset that WoodMart and Divi ship
	 * (`html, body, div, … { margin: 0 }`) overrides that margin, and the
	 * notice opens stuck to the top left corner instead, so the three are
	 * written out here. */
	.ayudawp-euw-guarantee .ayudawp-euw-guarantee__popover {
		position: fixed;
		inset: 0;
		margin: auto;
		width: min(92vw, 820px);
		max-height: 92vh;
		overflow: auto;
		padding: 1em;
		border: 0;
		border-radius: 4px;
		background: #fff;
		color: #2c3338;
	}

	.ayudawp-euw-guarantee__popover::backdrop {
		background: rgba(0, 0, 0, 0.6);
	}

	/* Inside the popover there is room for the notice at its full size. */
	.ayudawp-euw-guarantee__popover .ayudawp-euw-guarantee__notice,
	.ayudawp-euw-guarantee__popover .ayudawp-euw-guarantee__notice img {
		max-width: none;
	}
}
