/*
 * Close My Store: banner and dialog notice.
 *
 * A background and the text on it are always chosen as a pair. The banner
 * takes the theme's own pair (theme.json contrast and base). The dialog
 * button sits on a fixed white surface and takes a fixed pair, because a
 * theme has no text colour that is meant to go on its primary colour. The
 * plugin's settings override either pair by setting the custom properties
 * on :root; when only one colour of a pair is chosen there, the other is
 * set to black or white for it.
 */
:root {
	--btcs-bar-bg: var(--btcs-banner-bg, var(--wp--preset--color--contrast, #1d2327));
	--btcs-bar-text: var(--btcs-banner-text, var(--wp--preset--color--base, #fff));
	--btcs-btn-bg: var(--btcs-button-bg, #1d2327);
	--btcs-btn-text: var(--btcs-button-text, #fff);
}

/* Banner */

.btcs-bar {
	align-items: center;
	background: var(--btcs-bar-bg);
	box-sizing: border-box;
	color: var(--btcs-bar-text);
	display: flex;
	gap: 12px;
	justify-content: center;
	padding: 12px 16px;
	width: 100%;
	z-index: 99990;
}

.btcs-bar--sticky {
	position: sticky;
	top: 0;
}

/* Sit below the WordPress toolbar for signed-in users. */
.admin-bar .btcs-bar--sticky {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/*
 * In a short window (a phone on its side, or a page zoomed to 400%) a bar
 * that stays in view would take up too much of it, so it scrolls away with
 * the page. Elsewhere the script reserves the bar's height, so an element
 * the browser scrolls to on focus is not left underneath it.
 */
@media (max-height: 480px) {
	.btcs-bar--sticky {
		position: static;
	}
}

.btcs-bar__text {
	color: inherit;
	font-size: 1rem;
	line-height: 1.5;
	margin: 0;
	text-align: center;
}

.btcs-bar a,
.btcs-bar a:hover,
.btcs-bar a:focus {
	color: inherit;
	text-decoration: underline;
}

.btcs-bar__close {
	background: none;
	border: 1px solid currentcolor;
	border-radius: 4px;
	color: inherit;
	cursor: pointer;
	flex: none;
	font-size: 1.25rem;
	height: 32px;
	line-height: 1;
	padding: 0;
	width: 32px;
}

.btcs-bar__close:focus-visible {
	outline: 3px solid currentcolor;
	outline-offset: 2px;
}

/* Dialog notice */

.btcs-box {
	background: #fff;
	border: 0;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	box-sizing: border-box;
	color: #333;
	max-width: 32rem;
	padding: 2rem 1.75rem 1.75rem;
	text-align: center;
	width: calc(100% - 2rem);
}

.btcs-box::backdrop {
	background: rgba(0, 0, 0, 0.45);
}

.btcs-box__icon {
	border: 4px solid var(--btcs-btn-bg);
	border-radius: 50%;
	height: 72px;
	margin: 0 auto 1.25rem;
	position: relative;
	width: 72px;
}

/* A clock face drawn with two hands. */
.btcs-box__icon::before,
.btcs-box__icon::after {
	background: var(--btcs-btn-bg);
	border-radius: 2px;
	bottom: 50%;
	content: "";
	left: 50%;
	margin-left: -2px;
	position: absolute;
	transform-origin: bottom center;
	width: 4px;
}

.btcs-box__icon::before {
	height: 22px;
}

.btcs-box__icon::after {
	height: 16px;
	transform: rotate(90deg);
}

.btcs-box__title {
	color: #222;
	font-size: 1.6rem;
	line-height: 1.3;
	margin: 0 0 0.75rem;
}

.btcs-box__text {
	color: #444;
	font-size: 1.05rem;
	line-height: 1.6;
	margin: 0 0 1.5rem;
}

/* The dialog's surface is fixed, so a link takes the dialog's text colour, not the theme's link colour. */
.btcs-box a,
.btcs-box a:hover,
.btcs-box a:focus {
	color: inherit;
	text-decoration: underline;
}

.btcs-box__button {
	background: var(--btcs-btn-bg);
	border: 0;
	border-radius: 6px;
	color: var(--btcs-btn-text);
	cursor: pointer;
	font-size: 1rem;
	font-weight: 600;
	min-height: 44px;
	min-width: 120px;
	padding: 0.6rem 1.5rem;
}

/* A fixed dark ring: it is drawn on the white dialog, where the button's own text colour may not show. */
.btcs-box__button:focus-visible {
	outline: 3px solid #1d2327;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
	.btcs-box[open] {
		animation: btcs-box-in 0.2s ease-out;
	}
}

@keyframes btcs-box-in {
	from {
		opacity: 0;
		transform: scale(0.94);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* What changed, for screen readers: filled in by the script when it corrects the page. Not shown. */

.btcs-live {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Inline notice */

.btcs-inline {
	margin: 0 0 1em;
}

/*
 * While closed, hide express pay buttons, which some gateways print without
 * asking WooCommerce whether the product can be bought. A page a cache served
 * from before the closure also gets its add-to-cart buttons hidden until the
 * cache is rebuilt. This is cosmetic: the server refuses the order either way.
 */
.btcs-closed .wc-block-components-express-payment,
.btcs-closed .wc-block-components-express-payment-continue-rule,
.btcs-closed #wc-stripe-payment-request-wrapper,
.btcs-closed #wc-stripe-payment-request-button-separator,
.btcs-closed #wc-stripe-express-checkout-element,
.btcs-closed #wcpay-express-checkout-wrapper,
.btcs-closed .wcpay-payment-request-wrapper,
.btcs-stale-closed form.cart,
.btcs-stale-closed .add_to_cart_button,
.btcs-stale-closed .wc-block-components-product-button {
	display: none !important;
}
