/**
 * Nectar Advanced Gating - visitor-facing gate.
 *
 * Styled to the approved reference comps: a square-cornered white panel on a
 * dark scrim, a serif display heading, outlined selects and an outlined primary
 * button, with the decline route as a plain text link beside it.
 *
 * Two font stacks are exposed as custom properties so the site can point the
 * gate at the theme's brand fonts without editing this file:
 *
 *   :root {
 *     --nectar-gating-font-display: 'Your Serif', Georgia, serif;
 *     --nectar-gating-font-body: 'Your Sans', system-ui, sans-serif;
 *   }
 *
 * Section 13 governs presentation; Section 12 governs the focus-visible,
 * aria-disabled and reduced-motion behaviour below.
 */

.nectar-gating-overlay {
	--nectar-gating-font-display: Georgia, 'Times New Roman', Times, serif;
	--nectar-gating-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
	--nectar-gating-ink: #1a1a1a;
	--nectar-gating-muted: #5a5a5a;
	--nectar-gating-line: #1a1a1a;
	--nectar-gating-rule: #d8d8d8;
	--nectar-gating-error: #b32e3e;
	--nectar-gating-focus: #1a1a1a;

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	/* Consent banners sit at the top of the integer range on purpose - the
	 WebToffee banner measured on staging uses 9999999. An eligibility gate that
	 another modal can paint over is not a gate, so this sits above them and is
	 deliberately not a round number anyone else is likely to pick. */
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 24px;
	background: rgba(0, 0, 0, 0.78);
	font-family: var(--nectar-gating-font-body);
	overflow: hidden;
	overscroll-behavior: contain;
}

.nectar-gating-overlay *,
.nectar-gating-overlay *::before,
.nectar-gating-overlay *::after {
	box-sizing: border-box;
}

.nectar-gating-popup {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 640px;
	max-height: calc(100dvh - 48px);
	background: #fff;
	color: var(--nectar-gating-ink);
	border-radius: 0;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
	text-align: left;
}

/* The panel itself is not a scroll container. Each step owns its own scroller,
   which is what the scroll-to-end requirement is measured against. */
.nectar-gating-popup:focus {
	outline: none;
}

.nectar-gating-header {
	flex: 0 0 auto;
	padding: 44px 48px 0;
}

.nectar-gating-title {
	margin: 0;
	font-family: var(--nectar-gating-font-display);
	font-size: 34px;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--nectar-gating-ink);
	text-transform: none;
}

/* Steps 2 and 3 render their own heading from the terms library, so the panel
   title is taken out of view while remaining available as the dialog's
   accessible name. */
.nectar-gating-header.is-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------------
   Steps
   --------------------------------------------------------------------------- */

.nectar-gating-step {
	display: none;
	min-height: 0;
}

.nectar-gating-step.is-active {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.nectar-gating-step:focus {
	outline: none;
}

.nectar-gating-scroller {
	flex: 1 1 auto;
	min-height: 0;
	padding: 28px 48px 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
}

.nectar-gating-footer {
	flex: 0 0 auto;
	padding: 16px 48px 44px;
	background: #fff;
}

/* ---------------------------------------------------------------------------
   Fields
   --------------------------------------------------------------------------- */

.nectar-gating-field {
	margin: 0 0 26px;
}

.nectar-gating-label {
	display: block;
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--nectar-gating-ink);
}

.nectar-gating-select {
	display: block;
	width: 100%;
	margin: 0;
	padding: 13px 44px 13px 14px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	color: var(--nectar-gating-ink);
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='none' stroke='%231a1a1a' stroke-width='1.4' d='M1 1l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	border: 1px solid var(--nectar-gating-line);
	border-radius: 0;
	box-shadow: none;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

/* The attestation note under a select that failed validation carries the error
   colour too. Requested explicitly, overriding the earlier decision to leave
   certification wording in its resting colour. */
.nectar-gating-overlay .nectar-gating-note.is-error {
	color: var(--nectar-gating-error);
}

/* The select that failed validation is outlined, so the failure is identified on
   the control and not only in the sentence above the button. */
.nectar-gating-overlay .nectar-gating-select[aria-invalid='true'] {
	border-color: var(--nectar-gating-error);
	box-shadow: inset 0 0 0 1px var(--nectar-gating-error);
}

.nectar-gating-select::-ms-expand {
	display: none;
}

.nectar-gating-note {
	margin: 10px 0 0;
	font-size: 12px;
	line-height: 1.55;
	color: var(--nectar-gating-muted);
}

/* ---------------------------------------------------------------------------
   Attestation statement
   --------------------------------------------------------------------------- */

.nectar-gating-statement:not(:empty) {
	margin: 0 0 8px;
	padding: 18px 0 0;
	border-top: 1px solid var(--nectar-gating-rule);
}

.nectar-gating-statement-preamble,
.nectar-gating-statement-option {
	margin: 0 0 12px;
}

.nectar-gating-statement .nectar-gating-text {
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   Terms and terminal notices
   --------------------------------------------------------------------------- */

/* The terms fill the height the panel has available rather than a fixed slice of
   the viewport, so a long notice is read in the largest region the screen
   allows. The minimum keeps a short notice from collapsing to a sliver. */
.nectar-gating-terms,
.nectar-gating-message {
	min-height: 200px;
	font-size: 13px;
	line-height: 1.65;
	color: var(--nectar-gating-ink);
}

.nectar-gating-terms:focus-visible,
.nectar-gating-terms:focus {
	outline: 2px solid var(--nectar-gating-focus);
	outline-offset: -2px;
}

.nectar-gating-terms .nectar-gating-heading,
.nectar-gating-message .nectar-gating-heading {
	margin: 0 0 20px;
	font-family: var(--nectar-gating-font-display);
	font-size: 28px;
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: -0.01em;
}

/* Run-in clause lead-ins, matching the reference comp: bold italic, body sized,
   sitting tight above the clause they introduce. */
.nectar-gating-terms .nectar-gating-clause,
.nectar-gating-message .nectar-gating-clause {
	margin: 18px 0 6px;
	font-size: 13px;
	font-weight: 700;
	font-style: italic;
	line-height: 1.5;
}

.nectar-gating-terms .nectar-gating-text,
.nectar-gating-message .nectar-gating-text {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.65;
}

.nectar-gating-text-alt {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.65;
	color: var(--nectar-gating-muted);
}

/* ---------------------------------------------------------------------------
   Hint, errors and the agreement toggle
   --------------------------------------------------------------------------- */

.nectar-gating-hint {
	margin: 0 0 12px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--nectar-gating-muted);
}

.nectar-gating-hint.is-empty {
	display: none;
}

/* A refused submission promotes the existing hint rather than printing the same
   sentence again in the error region below it. */
.nectar-gating-hint.is-error {
	font-weight: 700;
	color: var(--nectar-gating-error);
}

.nectar-gating-error:empty {
	display: none;
}

.nectar-gating-error {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--nectar-gating-error);
}

.nectar-gating-optin {
	margin: 0 0 22px;
}

/* A hairline above the terms footer, so it is clear the text above it is a
   scrolling region that continues past the cut. */
#nectar-gating-step-2 .nectar-gating-footer {
	border-top: 1px solid var(--nectar-gating-rule);
}

/* Scoped to the overlay so a theme rule on the bare `label` element cannot
   recolour the attestation. Salient styles form labels globally. */
.nectar-gating-overlay .nectar-gating-optin-label,
.nectar-gating-overlay .nectar-gating-label,
.nectar-gating-overlay .nectar-gating-title,
.nectar-gating-overlay .nectar-gating-heading,
.nectar-gating-overlay .nectar-gating-clause,
.nectar-gating-overlay .nectar-gating-text {
	color: var(--nectar-gating-ink);
}

.nectar-gating-overlay .nectar-gating-note,
.nectar-gating-overlay .nectar-gating-hint,
.nectar-gating-overlay .nectar-gating-text-alt {
	color: var(--nectar-gating-muted);
}

.nectar-gating-overlay .nectar-gating-hint.is-error,
.nectar-gating-overlay .nectar-gating-error {
	color: var(--nectar-gating-error);
}

.nectar-gating-overlay .nectar-gating-link,
.nectar-gating-overlay .nectar-gating-button {
	color: var(--nectar-gating-ink);
}

.nectar-gating-overlay .nectar-gating-button[aria-disabled='true'] {
	color: var(--nectar-gating-muted);
}

.nectar-gating-overlay .nectar-gating-button:hover,
.nectar-gating-overlay .nectar-gating-button:focus {
	color: #fff;
}

.nectar-gating-overlay .nectar-gating-button[aria-disabled='true']:hover,
.nectar-gating-overlay .nectar-gating-button[aria-disabled='true']:focus {
	color: var(--nectar-gating-muted);
	background: #fff;
}

.nectar-gating-optin-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--nectar-gating-ink);
	cursor: pointer;
}

.nectar-gating-optin-label input[type='checkbox'] {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin: 1px 0 0;
	accent-color: var(--nectar-gating-ink);
}

/* The control that failed validation is outlined, so the failure is not carried
   by the colour of the sentence above it alone. */
.nectar-gating-optin-label input[aria-invalid='true'] {
	outline: 2px solid var(--nectar-gating-error);
	outline-offset: 2px;
}

.nectar-gating-optin-label input[aria-disabled='true'] {
	cursor: not-allowed;
	opacity: 0.45;
}

/* ---------------------------------------------------------------------------
   Actions
   --------------------------------------------------------------------------- */

.nectar-gating-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px 28px;
}

.nectar-gating-button {
	display: inline-block;
	min-width: 106px;
	padding: 13px 22px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	color: var(--nectar-gating-ink);
	background: #fff;
	border: 1px solid var(--nectar-gating-line);
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.nectar-gating-button:hover,
.nectar-gating-button:focus {
	color: #fff;
	background: var(--nectar-gating-ink);
}

/* Unavailable controls keep aria-disabled rather than the disabled attribute,
   so they remain focusable and can state why they are unavailable. */
.nectar-gating-button[aria-disabled='true'] {
	color: var(--nectar-gating-muted);
	background: #fff;
	border-color: var(--nectar-gating-rule);
	cursor: not-allowed;
}

.nectar-gating-button[aria-disabled='true']:hover {
	color: var(--nectar-gating-muted);
	background: #fff;
}

.nectar-gating-link {
	padding: 0;
	font-family: inherit;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--nectar-gating-ink);
	background: none;
	border: 0;
	border-radius: 0;
	text-decoration: none;
	cursor: pointer;
}

.nectar-gating-link:hover,
.nectar-gating-link:focus {
	text-decoration: underline;
}

/* Visible focus for every interactive control, in a single rule so nothing is
   missed. Section 12. */
.nectar-gating-overlay :focus-visible {
	outline: 2px solid var(--nectar-gating-focus);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   No-scripting notice
   --------------------------------------------------------------------------- */

.nectar-gating-noscript {
	padding: 28px 48px 44px;
	font-size: 14px;
	line-height: 1.6;
}

.nectar-gating-noscript p {
	margin: 0 0 14px;
}

/* ---------------------------------------------------------------------------
   Utilities
   --------------------------------------------------------------------------- */

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

/* ---------------------------------------------------------------------------
   Small screens
   --------------------------------------------------------------------------- */

@media screen and (max-width: 600px) {
	.nectar-gating-overlay {
		padding: 0;
		align-items: stretch;
	}

	.nectar-gating-popup {
		max-width: none;
		height: 100dvh;
		max-height: 100dvh;
		box-shadow: none;
	}

	.nectar-gating-header {
		padding: 24px 18px 0;
	}

	.nectar-gating-title {
		font-size: 26px;
	}

	.nectar-gating-scroller {
		padding: 18px 18px 8px;
	}

	.nectar-gating-terms,
	.nectar-gating-message {
		min-height: 0;
	}

	.nectar-gating-terms .nectar-gating-heading,
	.nectar-gating-message .nectar-gating-heading {
		font-size: 22px;
	}

	/* The toggle and the primary action stay in view, so a visitor on a phone is
	   never asked to act on a control that is below the fold. Section 13. */
	.nectar-gating-footer {
		position: sticky;
		bottom: 0;
		padding: 14px 18px 20px;
		border-top: 1px solid var(--nectar-gating-rule);
	}

	.nectar-gating-noscript {
		padding: 18px 18px 24px;
	}

	.nectar-gating-actions {
		gap: 12px 20px;
	}

	.nectar-gating-button {
		flex: 1 1 auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nectar-gating-overlay *,
	.nectar-gating-overlay *::before,
	.nectar-gating-overlay *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

@media (forced-colors: active) {
	.nectar-gating-popup {
		border: 1px solid CanvasText;
	}

	.nectar-gating-button {
		border: 1px solid ButtonText;
	}
}
