/**
 * NSL+ — Content Modal
 * -----------------------------------------------------------------------------
 * Styles for the accessible content modal. Brand values are taken from the
 * live theme: Work Sans (body), SUSE (headings), #162B47 (ink).
 *
 * @package nsl
 */

:root {
	--nsl-modal-ink: #162b47;
	--nsl-modal-accent: #e6007e;
	--nsl-modal-surface: #ffffff;
	--nsl-modal-border: rgba( 22, 43, 71, 0.12 );
	--nsl-modal-overlay: rgba( 22, 43, 71, 0.72 );
	--nsl-modal-radius: 14px;
	--nsl-modal-max-width: 1040px;
}

/* Page scroll lock (iOS-safe) ------------------------------------------------ */

body.nsl-modal-open {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
	overflow: hidden;
}

/* Shell ---------------------------------------------------------------------- */

.nsl-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
}

.nsl-modal[hidden] {
	display: none;
}

.nsl-modal__overlay {
	position: absolute;
	inset: 0;
	background: var( --nsl-modal-overlay );
	opacity: 0;
	transition: opacity 0.2s ease;
	cursor: pointer;
}

.nsl-modal.is-open .nsl-modal__overlay {
	opacity: 1;
}

/* Dialog --------------------------------------------------------------------- */

.nsl-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: var( --nsl-modal-max-width );
	max-height: 100%;
	background: var( --nsl-modal-surface );
	color: var( --nsl-modal-ink );
	border-radius: var( --nsl-modal-radius );
	box-shadow: 0 24px 60px rgba( 22, 43, 71, 0.28 );
	overflow: hidden;
	opacity: 0;
	transform: translateY( 16px ) scale( 0.99 );
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.nsl-modal.is-open .nsl-modal__dialog {
	opacity: 1;
	transform: none;
}

/* Header --------------------------------------------------------------------- */

.nsl-modal__header {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 24px 28px 18px;
	border-bottom: 1px solid var( --nsl-modal-border );
	flex: 0 0 auto;
}

.nsl-modal__title {
	margin: 0;
	font-family: SUSE, "Work Sans", sans-serif;
	font-size: clamp( 22px, 3vw, 32px );
	font-weight: 500;
	line-height: 1.2;
	color: var( --nsl-modal-ink );
	flex: 1 1 auto;
}

.nsl-modal__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: -6px -6px 0 0;
	padding: 0;
	border: 1px solid var( --nsl-modal-border );
	border-radius: 50%;
	background: transparent;
	color: var( --nsl-modal-ink );
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nsl-modal__close:hover,
.nsl-modal__close:focus-visible {
	background: var( --nsl-modal-ink );
	border-color: var( --nsl-modal-ink );
	color: #fff;
}

/* Body ----------------------------------------------------------------------- */

.nsl-modal__body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding: 24px 28px 28px;
	font-family: "Work Sans", sans-serif;
	font-size: 18px;
	line-height: 1.62;
}

.nsl-modal__body:focus {
	outline: none;
}

.nsl-modal__status {
	margin: 0;
	padding: 32px 0;
	text-align: center;
	opacity: 0.7;
}

.nsl-modal__spinner {
	display: inline-block;
	width: 26px;
	height: 26px;
	border: 2px solid var( --nsl-modal-border );
	border-top-color: var( --nsl-modal-accent );
	border-radius: 50%;
	animation: nsl-modal-spin 0.7s linear infinite;
}

@keyframes nsl-modal-spin {
	to {
		transform: rotate( 360deg );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.nsl-modal__spinner {
		animation-duration: 2s;
	}
}

.nsl-modal__status--error {
	opacity: 1;
	color: var( --nsl-modal-accent );
}

/* Injected content ------------------------------------------------------------
   The wrapper carries the theme's own `.general-content-wrap` class, so the
   theme's spacing and colours are inherited as-is.

   Every rule here is scoped to `.nsl-modal .nsl-modal__content` — two classes,
   deliberately — so it reliably outweighs theme selectors like
   `.general-content-wrap ul li` without needing !important. Nothing here can
   affect the page itself.                                                  */

.nsl-modal .nsl-modal__content > *:first-child {
	margin-top: 0;
}

.nsl-modal .nsl-modal__content > *:last-child {
	margin-bottom: 0;
}

/* Scale.
   The theme sizes body copy at 32px for an 1860px-wide container, which is far
   too large in a dialog. */

.nsl-modal .nsl-modal__content p,
.nsl-modal .nsl-modal__content li,
.nsl-modal .nsl-modal__content td,
.nsl-modal .nsl-modal__content th {
	font-family: "Work Sans", sans-serif;
	font-size: 18px;
	font-weight: 400;
	line-height: 1.62;
}

/* Section headings are marked up as <ol><li><strong>, with the number coming
   from a CSS counter on the <li>. The <strong> must stay inline so the number
   and the heading text share a line, exactly as they do on the page. */

.nsl-modal .nsl-modal__content ol > li,
.nsl-modal .nsl-modal__content ol > li > strong,
.nsl-modal .nsl-modal__content h2,
.nsl-modal .nsl-modal__content h3 {
	font-family: SUSE, "Work Sans", sans-serif;
	font-size: 26px;
	font-weight: 600;
	line-height: 1.25;
	color: var( --nsl-modal-ink );
}

.nsl-modal .nsl-modal__content ol > li > strong {
	display: inline;
}

/* The theme indents every <li> for its bullet; heading rows have none. */
.nsl-modal .nsl-modal__content ol,
.nsl-modal .nsl-modal__content ol > li {
	padding-left: 0;
	list-style: none;
}

.nsl-modal .nsl-modal__content ol {
	margin-top: 34px;
}

.nsl-modal .nsl-modal__content > ol:first-child {
	margin-top: 0;
}

/* Bullets.
   The theme draws its bullet as an absolutely-positioned pseudo-element with a
   hard-coded `top: 28px`, tuned for its 32px type. At modal scale that drops
   the bullet to the bottom of the line. Rather than guess a new offset — which
   would drift with any font-size change — the modal uses a native list marker,
   which the browser aligns to the first line automatically. The theme bullet is
   the same ink colour, so this is visually identical. */

.nsl-modal .nsl-modal__content ul {
	list-style: disc outside;
	padding-left: 18px;
}

.nsl-modal .nsl-modal__content ul > li {
	list-style: disc outside;
	position: static;
	padding-left: 0;
}

.nsl-modal .nsl-modal__content ul > li::before {
	content: none;
}

.nsl-modal .nsl-modal__content ul > li::marker {
	color: var( --nsl-modal-ink );
	font-size: 0.6em;
}

/* Long words, email addresses and URLs must not push the dialog sideways. */

.nsl-modal .nsl-modal__content {
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.nsl-modal .nsl-modal__content a {
	color: var( --nsl-modal-ink );
	text-decoration: underline;
	text-underline-offset: 3px;
	overflow-wrap: anywhere;
}

.nsl-modal .nsl-modal__content a:hover,
.nsl-modal .nsl-modal__content a:focus-visible {
	color: var( --nsl-modal-accent );
}

/* Media and embeds stay inside the dialog. */

.nsl-modal .nsl-modal__content img,
.nsl-modal .nsl-modal__content video,
.nsl-modal .nsl-modal__content iframe,
.nsl-modal .nsl-modal__content svg {
	max-width: 100%;
	height: auto;
}

/* Wide tables scroll in their own container rather than the page. */

.nsl-modal .nsl-modal__content table {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* Visually-hidden label fallback --------------------------------------------- */

.nsl-modal .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
	white-space: nowrap;
	border: 0;
}

/* Focus visibility ----------------------------------------------------------- */

.nsl-modal :focus-visible {
	outline: 2px solid var( --nsl-modal-accent );
	outline-offset: 2px;
}

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

@media ( max-width: 640px ) {
	.nsl-modal {
		padding: 0;
	}

	.nsl-modal__dialog {
		max-width: none;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}

	.nsl-modal__header {
		padding: 18px 20px 14px;
	}

	.nsl-modal__body {
		padding: 20px;
		font-size: 17px;
	}

	.nsl-modal .nsl-modal__content p,
	.nsl-modal .nsl-modal__content li,
	.nsl-modal .nsl-modal__content td,
	.nsl-modal .nsl-modal__content th {
		font-size: 17px;
	}

	.nsl-modal .nsl-modal__content ol > li,
	.nsl-modal .nsl-modal__content ol > li > strong,
	.nsl-modal .nsl-modal__content h2,
	.nsl-modal .nsl-modal__content h3 {
		font-size: 21px;
	}

	.nsl-modal__header {
		gap: 10px;
	}

	.nsl-modal__title {
		font-size: 20px;
	}

}

/* Very narrow screens --------------------------------------------------------- */

@media ( max-width: 380px ) {
	.nsl-modal__header {
		padding: 14px 16px 12px;
	}

	.nsl-modal__body {
		padding: 16px;
	}
}

/* WP admin bar --------------------------------------------------------------- */

.admin-bar .nsl-modal {
	top: 32px;
}

@media screen and ( max-width: 782px ) {
	.admin-bar .nsl-modal {
		top: 46px;
	}
}

/* Motion preferences --------------------------------------------------------- */

@media ( prefers-reduced-motion: reduce ) {
	.nsl-modal__overlay,
	.nsl-modal__dialog {
		transition: none;
	}
}

/* Print: never print the modal chrome ---------------------------------------- */

@media print {
	.nsl-modal {
		display: none !important;
	}
}
