/**
 * Nordpaa FAQ – front end.
 *
 * Everything inherits from the theme by default (font, colours).
 * Global settings and per-FAQ overrides only change the custom properties below.
 */

.npfaq {
	--npfaq-accent: currentColor;
	--npfaq-q-color: inherit;
	--npfaq-a-color: inherit;
	--npfaq-border: color-mix(in srgb, currentColor 16%, transparent);
	--npfaq-bg: transparent;
	--npfaq-radius: 0px;
	--npfaq-gap: 0px;
	--npfaq-pad-x: 0px;
	--npfaq-pad-y: 1.25em;
	--npfaq-q-size: 1.125em;
	--npfaq-q-weight: 600;
	--npfaq-font: inherit;
	--npfaq-duration: 300ms;
	--npfaq-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--npfaq-icon-size: 1.125em;
	--npfaq-cta-bg: var(--npfaq-accent);
	--npfaq-cta-color: #fff;
	--npfaq-cta-radius: 6px;
	--npfaq-scroll-offset: 80px;

	font-family: var(--npfaq-font);
	box-sizing: border-box;
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.npfaq {
		--npfaq-border: rgba(128, 128, 128, 0.32);
	}
}

.npfaq *,
.npfaq *::before,
.npfaq *::after {
	box-sizing: inherit;
}

/* ---------------------------------------------------------------
 * Style variants
 * ------------------------------------------------------------- */

.npfaq--boxed {
	--npfaq-radius: 12px;
	--npfaq-gap: 0.75rem;
	--npfaq-pad-x: 1.25em;
	--npfaq-pad-y: 1.1em;
}

.npfaq--minimal {
	--npfaq-pad-y: 0.875em;
}

.npfaq-list {
	display: flex;
	flex-direction: column;
	gap: var(--npfaq-gap);
}

.npfaq--divided .npfaq-list {
	border-bottom: 1px solid var(--npfaq-border);
}

.npfaq--divided .npfaq-item {
	border-top: 1px solid var(--npfaq-border);
}

.npfaq--boxed .npfaq-item {
	border: 1px solid var(--npfaq-border);
	border-radius: var(--npfaq-radius);
	overflow: hidden;
}

/* Two columns – rows read left to right, each column item opens on its own. */
@media (min-width: 701px) {
	.npfaq--cols-2 .npfaq-list {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-items: start;
		column-gap: max(var(--npfaq-gap), 2.5rem);
	}

	.npfaq--cols-2.npfaq--boxed .npfaq-list {
		column-gap: max(var(--npfaq-gap), 1rem);
	}

	.npfaq--cols-2.npfaq--divided .npfaq-list {
		border-bottom: 0;
	}

	.npfaq--cols-2.npfaq--divided .npfaq-item {
		border-bottom: 1px solid var(--npfaq-border);
	}

	.npfaq--cols-2.npfaq--divided .npfaq-item:not(:nth-child(-n + 2)) {
		border-top: 0;
	}
}

.npfaq-item {
	margin: 0;
	background: var(--npfaq-bg);
	scroll-margin-top: var(--npfaq-scroll-offset);
}

.npfaq-item[hidden] {
	display: none;
}

/* ---------------------------------------------------------------
 * Question (button) – reset theme button styles
 * ------------------------------------------------------------- */

.npfaq .npfaq-heading {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	line-height: inherit;
}

.npfaq .npfaq-heading::before,
.npfaq .npfaq-heading::after {
	content: none;
}

.npfaq .npfaq-trigger {
	-webkit-appearance: none;
	appearance: none;
	display: flex;
	align-items: flex-start;
	gap: 1em;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: var(--npfaq-pad-y) var(--npfaq-pad-x);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	color: var(--npfaq-q-color);
	font: inherit;
	font-family: inherit;
	font-size: var(--npfaq-q-size);
	font-weight: var(--npfaq-q-weight);
	line-height: 1.35;
	letter-spacing: inherit;
	text-align: start;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.npfaq .npfaq-trigger:hover,
.npfaq .npfaq-trigger:focus,
.npfaq .npfaq-trigger:active {
	background: transparent;
	color: var(--npfaq-q-color);
	box-shadow: none;
}

.npfaq .npfaq-trigger:focus {
	outline: none;
}

.npfaq .npfaq-trigger:focus-visible {
	outline: 2px solid var(--npfaq-accent);
	outline-offset: 4px;
	border-radius: 2px;
}

.npfaq--boxed .npfaq-trigger:focus-visible {
	outline-offset: -3px;
	border-radius: calc(var(--npfaq-radius) - 2px);
}

.npfaq-question {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
}

@media (hover: hover) {
	.npfaq .npfaq-trigger:hover .npfaq-question {
		text-decoration-line: underline;
	}
}

/* ---------------------------------------------------------------
 * Icons
 * ------------------------------------------------------------- */

.npfaq-icon {
	position: relative;
	flex: 0 0 auto;
	width: var(--npfaq-icon-size);
	height: var(--npfaq-icon-size);
	/* Centre on the first line of the question. */
	margin-top: calc((1.35em - var(--npfaq-icon-size)) / 2);
	color: var(--npfaq-accent);
}

.npfaq--icon-left .npfaq-icon {
	order: -1;
}

.npfaq--icon-none .npfaq-icon {
	display: none;
}

.npfaq--icon-plus .npfaq-icon::before,
.npfaq--icon-plus .npfaq-icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 70%;
	height: 1.5px;
	border-radius: 1px;
	background: currentColor;
	transform: translate(-50%, -50%);
	transition: transform var(--npfaq-duration) var(--npfaq-ease);
}

.npfaq--icon-plus .npfaq-icon::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.npfaq--icon-plus .npfaq-item.is-open .npfaq-icon::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

.npfaq--icon-chevron .npfaq-icon::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 45%;
	height: 45%;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: translate(-50%, -70%) rotate(45deg);
	transition: transform var(--npfaq-duration) var(--npfaq-ease);
}

.npfaq--icon-chevron .npfaq-item.is-open .npfaq-icon::before {
	transform: translate(-50%, -30%) rotate(225deg);
}

/* ---------------------------------------------------------------
 * Panel – animated height via grid rows (no JS measuring)
 * ------------------------------------------------------------- */

.npfaq-panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows var(--npfaq-duration) var(--npfaq-ease);
}

.npfaq-panel[hidden]:not([hidden="until-found"]) {
	display: none;
}

.npfaq-item.is-open > .npfaq-panel {
	grid-template-rows: 1fr;
}

.npfaq-panel-inner {
	min-height: 0;
	overflow: hidden;
}

.npfaq-answer {
	padding: 0 var(--npfaq-pad-x) var(--npfaq-pad-y);
	color: var(--npfaq-a-color);
	opacity: 0;
	transition: opacity var(--npfaq-duration) var(--npfaq-ease);
}

.npfaq-item.is-open .npfaq-answer {
	opacity: 1;
}

/* Align answers with the question text when the icon sits on the left. */
.npfaq--icon-left:not(.npfaq--icon-none) .npfaq-answer {
	padding-inline-start: calc(var(--npfaq-pad-x) + var(--npfaq-q-size) * 2.125);
}

.npfaq-item.is-instant > .npfaq-panel,
.npfaq-item.is-instant .npfaq-answer,
.npfaq-item.is-instant .npfaq-icon::before,
.npfaq-item.is-instant .npfaq-icon::after {
	transition: none;
}

/* ---------------------------------------------------------------
 * Answer content – keep theme typography, normalise rhythm
 * ------------------------------------------------------------- */

.npfaq .npfaq-answer > * {
	margin-top: 0;
	margin-bottom: 0;
}

.npfaq .npfaq-answer > * + * {
	margin-top: 1em;
}

.npfaq .npfaq-answer > :is(h2, h3, h4, h5, h6) {
	line-height: 1.3;
	margin-bottom: 0;
}

.npfaq .npfaq-answer > * + :is(h2, h3, h4, h5, h6) {
	margin-top: 1.5em;
}

.npfaq .npfaq-answer > :is(h2, h3, h4, h5, h6) + * {
	margin-top: 0.5em;
}

.npfaq .npfaq-answer > :is(h2, h3):not([class*="-font-size"]) {
	font-size: 1.25em;
}

.npfaq .npfaq-answer > h4:not([class*="-font-size"]) {
	font-size: 1.125em;
}

.npfaq .npfaq-answer > :is(h5, h6):not([class*="-font-size"]) {
	font-size: 1em;
}

.npfaq .npfaq-answer > :is(ul, ol) {
	padding-inline-start: 1.25em;
}

.npfaq .npfaq-answer > * + .npfaq-el,
.npfaq .npfaq-answer > .npfaq-el + * {
	margin-top: 1.5em;
}

.npfaq .npfaq-answer figure.wp-block-image {
	margin-left: 0;
	margin-right: 0;
}

.npfaq .npfaq-answer img {
	max-width: 100%;
	height: auto;
}

.npfaq .npfaq-answer a:not(.npfaq-cta-button) {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

/* ---------------------------------------------------------------
 * Call to action
 * ------------------------------------------------------------- */

.npfaq-cta--center {
	text-align: center;
}

.npfaq-cta--right {
	text-align: right;
}

/*
 * The button's own `color` is the fill colour and the background uses
 * currentColor – so an inherited accent (the default) resolves against the
 * surrounding text colour, not against the button's white label.
 */
.npfaq .npfaq-cta-button {
	display: inline-flex;
	align-items: center;
	gap: 0.55em;
	min-height: 44px;
	padding: 0.7em 1.25em;
	border: 1.5px solid currentColor;
	border-radius: var(--npfaq-cta-radius);
	background: currentColor;
	color: var(--npfaq-cta-bg);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.npfaq .npfaq-cta-button--primary > * {
	color: var(--npfaq-cta-color);
}

.npfaq .npfaq-cta-button:hover,
.npfaq .npfaq-cta-button:focus {
	background: color-mix(in srgb, currentColor 84%, #000);
	border-color: color-mix(in srgb, currentColor 84%, #000);
	color: var(--npfaq-cta-bg);
	text-decoration: none;
}

.npfaq .npfaq-cta-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.npfaq .npfaq-cta-button--secondary {
	background: transparent;
}

.npfaq .npfaq-cta-button--secondary:hover,
.npfaq .npfaq-cta-button--secondary:focus {
	background: color-mix(in srgb, currentColor 8%, transparent);
	border-color: currentColor;
}

.npfaq .npfaq-cta-button--link {
	min-height: 0;
	padding: 0.25em 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--npfaq-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.25em;
}

.npfaq .npfaq-cta-button--link:hover,
.npfaq .npfaq-cta-button--link:focus {
	background: none;
	border: 0;
	color: var(--npfaq-accent);
	text-decoration: underline;
}

.npfaq-cta-arrow {
	display: none;
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
	transition: transform 0.2s ease;
}

.npfaq-cta-button--link .npfaq-cta-arrow {
	display: block;
}

.npfaq-cta-button--link:hover .npfaq-cta-arrow {
	transform: translateX(3px);
}

/* ---------------------------------------------------------------
 * Statistics
 * ------------------------------------------------------------- */

.npfaq-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
	gap: 1.25em 1.5em;
}

.npfaq-stats--cols-1 { grid-template-columns: minmax(0, 1fr); }
.npfaq-stats--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.npfaq-stats--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.npfaq-stats--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.npfaq-stat {
	min-width: 0;
	padding-top: 0.75em;
	border-top: 1px solid var(--npfaq-border);
}

.npfaq-stat-value {
	color: var(--npfaq-accent);
	font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
	line-height: 1.1;
	white-space: nowrap;
}

.npfaq-stat-affix {
	font-size: 0.7em;
	letter-spacing: 0;
	margin: 0 0.05em;
}

.npfaq-stat-label {
	margin-top: 0.4em;
	font-size: 0.875em;
	line-height: 1.4;
	opacity: 0.75;
}

/* ---------------------------------------------------------------
 * Quote
 * ------------------------------------------------------------- */

.npfaq .npfaq-quote {
	margin: 0;
	padding: 0.25em 0 0.25em 1.25em;
	border-left: 2px solid var(--npfaq-accent);
}

.npfaq .npfaq-quote-text {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font-size: 1.125em;
	font-style: normal;
	line-height: 1.5;
	quotes: none;
}

.npfaq .npfaq-quote-text::before,
.npfaq .npfaq-quote-text::after {
	content: none;
}

.npfaq .npfaq-quote-text p {
	margin: 0;
	padding: 0;
	font-size: inherit;
}

.npfaq-quote-cite {
	display: flex;
	align-items: center;
	gap: 0.75em;
	margin-top: 0.875em;
	font-size: 0.875em;
	font-style: normal;
	line-height: 1.35;
}

.npfaq .npfaq-quote-avatar {
	flex: 0 0 auto;
	width: 2.75em;
	height: 2.75em;
	border-radius: 50%;
	object-fit: cover;
	margin: 0;
}

.npfaq-quote-name {
	display: block;
	font-weight: 600;
}

.npfaq-quote-role {
	display: block;
	opacity: 0.7;
}

/* ---------------------------------------------------------------
 * Search
 * ------------------------------------------------------------- */

.npfaq-search {
	position: relative;
	margin-bottom: 1.25em;
}

.npfaq-search-icon {
	position: absolute;
	top: 50%;
	left: 0.9em;
	width: 1.15em;
	height: 1.15em;
	opacity: 0.55;
	transform: translateY(-50%);
	pointer-events: none;
}

.npfaq .npfaq-search-input {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	max-width: none;
	min-height: 48px;
	margin: 0;
	padding: 0.7em 1em 0.7em 2.6em;
	border: 1px solid var(--npfaq-border);
	border-radius: max(var(--npfaq-radius), 6px);
	box-shadow: none;
	background: transparent;
	color: inherit;
	font: inherit;
	/* 16px minimum stops iOS from zooming on focus. */
	font-size: max(16px, 1em);
	line-height: 1.4;
}

.npfaq .npfaq-search-input::placeholder {
	color: inherit;
	opacity: 0.55;
}

.npfaq .npfaq-search-input:focus {
	border-color: var(--npfaq-accent);
	outline: 2px solid color-mix(in srgb, var(--npfaq-accent) 25%, transparent);
	outline-offset: 0;
}

.npfaq-empty {
	margin: 1em 0 0;
	opacity: 0.75;
}

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

.npfaq-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.npfaq-notice {
	padding: 0.75em 1em;
	border-left: 3px solid #d63638;
	background: rgba(214, 54, 56, 0.06);
}

/* ---------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------- */

@media (max-width: 600px) {
	.npfaq {
		--npfaq-q-size: 1.0625em;
		--npfaq-pad-y: 1.1em;
	}

	.npfaq--boxed {
		--npfaq-pad-x: 1em;
		--npfaq-pad-y: 1em;
	}

	.npfaq .npfaq-trigger {
		gap: 0.75em;
	}

	.npfaq-stats--cols-3,
	.npfaq-stats--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.npfaq .npfaq-cta-button:not(.npfaq-cta-button--link) {
		justify-content: center;
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.npfaq-panel,
	.npfaq-answer,
	.npfaq-icon::before,
	.npfaq-icon::after,
	.npfaq-cta-arrow {
		transition: none !important;
	}
}

@media print {
	.npfaq-panel,
	.npfaq-panel[hidden] {
		display: block !important;
		content-visibility: visible !important;
	}

	.npfaq-answer {
		opacity: 1 !important;
	}

	.npfaq-icon,
	.npfaq-search {
		display: none !important;
	}
}
