/**
 * HiToP Selbstcheck Overlay — styles
 *
 * Figma reference: Canvas 1182:2799 (3085:1103 Step1, 3085:1147 Step2,
 * 3085:1169 Step3, 3085:1222 Abschluss, 3085:1255 Mobile Step1).
 *
 * Design tokens inherited from the theme where sensible; internal styles use
 * specificity instead of !important.
 */

/* ------------------------------------------------------------------
 * Design tokens (local, aligned with theme)
 * ---------------------------------------------------------------- */
.hitop-sc {
	--sc-primary: #D83F27;
	--sc-primary-hover: #AB1700;
	--sc-anthracite: #2C2C2C;
	--sc-light-anthracite: #959595;
	--sc-grey: #D9D9D9;
	--sc-light-grey: #F5F5F5;
	--sc-white: #FFFFFF;
	--sc-ink: #1E1E1E;
	--sc-info-bar-bg: #D9D9D9;
	/* Figma: #D83F27 at 10% opacity over white, pre-composed as solid so the
	 * overlay fully obscures page content (which would otherwise bleed through). */
	--sc-overlay-bg: #FBECE8;

	--sc-radius-pill: 34px;
	--sc-radius-input: 8px;
	--sc-header-offset-desktop: 144px; /* 52px info-bar + 92px header */
	--sc-header-offset-mobile: 80px;

	--sc-z-panel: 9998;
	--sc-transition: 0.35s cubic-bezier(0.22, 1, 0.36, 1);

	--sc-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ------------------------------------------------------------------
 * Page lock when open
 * ---------------------------------------------------------------- */
html.hitop-sc-locked,
html.hitop-sc-locked body {
	overflow: hidden;
}

/* ------------------------------------------------------------------
 * Root container: fixed full-viewport, but inert until .is-open.
 * ---------------------------------------------------------------- */
.hitop-sc {
	position: fixed;
	inset: 0;
	z-index: var(--sc-z-panel);
	pointer-events: none;
	font-family: var(--sc-font);
	color: var(--sc-anthracite);
}

.hitop-sc.is-open {
	pointer-events: auto;
}

/* Hidden open-host — never visible */
.hitop-sc__open-host {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	background: transparent;
	clip: rect(0 0 0 0);
	overflow: hidden;
	pointer-events: none;
}

/* ------------------------------------------------------------------
 * Backdrop — deckt den Bereich BEHIND dem Header mit pastel-BG damit
 * gescrollte Page nicht durchblitzt. Der Header selbst steht via sticky
 * z-index darueber.
 * ---------------------------------------------------------------- */
.hitop-sc__backdrop {
	position: absolute;
	inset: 0;
	background: var(--sc-overlay-bg);
	opacity: 0;
	transition: opacity var(--sc-transition);
	pointer-events: none;
}

.hitop-sc.is-open .hitop-sc__backdrop {
	opacity: 1;
	pointer-events: auto;
}

/* ------------------------------------------------------------------
 * Panel — slides down from above the header (z-index lower than header)
 * ---------------------------------------------------------------- */
.hitop-sc__panel {
	position: absolute;
	left: 0;
	right: 0;
	top: var(--sc-header-offset-desktop);
	bottom: 0;
	background: var(--sc-overlay-bg);
	backdrop-filter: blur(0.5px);
	transform: translateY(-110%);
	transition: transform var(--sc-transition);
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
	box-shadow: 0 12px 30px -10px rgba(44, 44, 44, 0.25);
}

.hitop-sc.is-open .hitop-sc__panel {
	transform: translateY(0);
}

/* The panel sits behind the site header by keeping top offset; if the host
 * theme makes its header sticky we keep this default. When the site has NO
 * sticky header, the overlay still correctly starts below the header height.
 */

/* ------------------------------------------------------------------
 * Info-bar duplicate (above the overlay content area) — Figma shows the
 * info-bar persistent at viewport top (not inside the overlay). We keep it
 * hidden inside the overlay on desktop because the site-level info-bar
 * already shows there, and render it visible on mobile only.
 * ---------------------------------------------------------------- */
.hitop-sc__info-bar {
	display: none;
	background: var(--sc-info-bar-bg);
	color: var(--sc-ink);
	font-size: 12px;
	line-height: 1;
	padding: 20px 24px;
	text-align: center;
	font-weight: 400;
}

/* ------------------------------------------------------------------
 * Content container
 * ---------------------------------------------------------------- */
.hitop-sc__content {
	flex: 1;
	padding: 100px clamp(24px, 6vw, 96px) 80px;
}

.hitop-sc__inner {
	max-width: 1328px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 48px;
}

/* Top row: titles + step indicator + close */
.hitop-sc__top {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 32px;
	align-items: flex-start;
}

.hitop-sc__titles {
	max-width: 659px;
}

.hitop-sc__title {
	font-family: var(--sc-font);
	font-weight: 300;
	font-size: 32px;
	line-height: 48px;
	color: var(--sc-anthracite);
	margin: 0 0 18px;
}

.hitop-sc__subtitle {
	font-weight: 300;
	font-size: 22px;
	line-height: 35.2px;
	color: var(--sc-anthracite);
	margin: 0;
}

.hitop-sc__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 16px;
}

.hitop-sc__close {
	background: transparent;
	border: 0;
	padding: 0;
	cursor: pointer;
	display: inline-flex;
	transition: transform 0.2s ease;
}

.hitop-sc__close:hover {
	transform: scale(1.08);
}

.hitop-sc__step-indicator {
	font-weight: 400;
	font-size: 22px;
	line-height: 33px;
	color: var(--sc-anthracite);
	margin: 0;
}

.hitop-sc__step-indicator strong {
	font-weight: 900;
}

/* Error banner */
.hitop-sc__error {
	background: rgba(216, 63, 39, 0.12);
	border: 1px solid var(--sc-primary);
	color: var(--sc-primary);
	border-radius: 8px;
	padding: 14px 20px;
	font-size: 16px;
	font-weight: 500;
}

.hitop-sc__error[hidden] {
	display: none;
}

/* ------------------------------------------------------------------
 * Step sections
 * ---------------------------------------------------------------- */
.hitop-sc__step {
	display: flex;
	flex-direction: column;
	gap: 40px;
}

.hitop-sc__step[hidden] {
	display: none;
}

.hitop-sc__qblock {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.hitop-sc__qlabel {
	font-weight: 900;
	font-size: 22px;
	line-height: 33px;
	color: var(--sc-anthracite);
	margin: 0;
}

/* ------------------------------------------------------------------
 * Pills (answer buttons) — Figma: white bg, 1px anthracite border, radius 34.
 * Active: 2px orange border + orange text + bold.
 * ---------------------------------------------------------------- */
.hitop-sc__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 16px;
}

.hitop-sc__pill {
	--pill-border-width: 1px;
	background: var(--sc-white);
	color: var(--sc-anthracite);
	border: var(--pill-border-width) solid var(--sc-anthracite);
	border-radius: var(--sc-radius-pill);
	padding: 9px 30px;
	font-family: var(--sc-font);
	font-weight: 400;
	font-size: 16px;
	line-height: 16px;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease,
		font-weight 0.2s ease, background-color 0.2s ease;
	min-height: 35px;
	text-transform: none;
}

.hitop-sc__pill:hover {
	border-color: var(--sc-primary);
	color: var(--sc-primary);
}

.hitop-sc__pill.is-active {
	--pill-border-width: 2px;
	padding: 8px 29px; /* compensate for 2px border to keep size stable */
	border-color: var(--sc-primary);
	color: var(--sc-primary);
	font-weight: 700;
}

/* ------------------------------------------------------------------
 * Hint row "Mehrfachauswahl möglich" (below answers on step 2)
 * ---------------------------------------------------------------- */
.hitop-sc__hint {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 500;
	font-size: 16px;
	line-height: 19.2px;
	color: var(--sc-anthracite);
	margin: 0;
}

.hitop-sc__hint svg {
	flex-shrink: 0;
}

/* ------------------------------------------------------------------
 * Inputs (name + email)
 * ---------------------------------------------------------------- */
.hitop-sc__input {
	width: 100%;
	max-width: 640px;
	background: transparent;
	border: 1px solid var(--sc-anthracite);
	border-radius: var(--sc-radius-input);
	padding: 18px 24px;
	font-family: var(--sc-font);
	font-size: 16px;
	line-height: 1.2;
	color: var(--sc-anthracite);
}

.hitop-sc__input::placeholder {
	color: var(--sc-light-anthracite);
}

.hitop-sc__input:focus {
	outline: none;
	border-color: var(--sc-primary);
	box-shadow: 0 0 0 3px rgba(216, 63, 39, 0.15);
}

/* ------------------------------------------------------------------
 * Consent checkbox (custom, Figma red checkmark)
 * ---------------------------------------------------------------- */
.hitop-sc__consent {
	max-width: 800px;
}

.hitop-sc__consent-label {
	display: grid;
	grid-template-columns: 20px 1fr;
	gap: 12px;
	align-items: flex-start;
	cursor: pointer;
	font-size: 14px;
	line-height: 20px;
	color: var(--sc-anthracite);
}

.hitop-sc__consent-checkbox {
	position: absolute;
	opacity: 0;
	width: 20px;
	height: 20px;
	margin: 0;
}

.hitop-sc__consent-box {
	width: 20px;
	height: 20px;
	border: 1px solid var(--sc-anthracite);
	border-radius: 4px;
	background: var(--sc-white);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 2px;
}

.hitop-sc__consent-box svg {
	opacity: 0;
	transition: opacity 0.15s ease;
}

.hitop-sc__consent-checkbox:checked + .hitop-sc__consent-box svg {
	opacity: 1;
}

.hitop-sc__consent-checkbox:focus-visible + .hitop-sc__consent-box {
	outline: 2px solid var(--sc-primary);
	outline-offset: 2px;
}

.hitop-sc__consent-text a {
	color: var(--sc-primary);
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * Navigation buttons (Zurück / Weiter)
 * Figma: inactive "Weiter" is light grey (#F5F5F5) pill with white text;
 * active is orange pill white text. Radius 34, 122x60 desktop.
 * ---------------------------------------------------------------- */
.hitop-sc__nav {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	margin-top: 40px;
	padding-top: 12px;
}

.hitop-sc__back {
	background: transparent;
	border: 1px solid var(--sc-light-anthracite);
	color: var(--sc-anthracite);
	border-radius: var(--sc-radius-pill);
	padding: 18px 36px;
	font-family: var(--sc-font);
	font-weight: 500;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	min-width: 122px;
	text-align: center;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hitop-sc__back:hover {
	background: var(--sc-anthracite);
	color: var(--sc-white);
	border-color: var(--sc-anthracite);
}

.hitop-sc__back[hidden] {
	display: none;
}

.hitop-sc__next {
	background: var(--sc-light-grey);
	color: var(--sc-white);
	border: 0;
	border-radius: var(--sc-radius-pill);
	padding: 18px 36px;
	font-family: var(--sc-font);
	font-weight: 700;
	font-size: 16px;
	line-height: 1;
	cursor: not-allowed;
	min-width: 122px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	transition: background 0.2s ease;
}

.hitop-sc__next.is-enabled {
	background: var(--sc-primary);
	cursor: pointer;
}

.hitop-sc__next.is-enabled:hover {
	background: var(--sc-primary-hover);
}

.hitop-sc__next[disabled] {
	opacity: 1;
}

/* ------------------------------------------------------------------
 * Done screen (Abschluss)
 * ---------------------------------------------------------------- */
.hitop-sc__step--done {
	max-width: 900px;
}

.hitop-sc__done-headline {
	font-weight: 300;
	font-size: 32px;
	line-height: 40px;
	color: var(--sc-anthracite);
	margin: 0 0 20px;
}

.hitop-sc__done-lead {
	font-weight: 300;
	font-size: 18px;
	line-height: 28px;
	color: var(--sc-anthracite);
	margin: 0 0 32px;
}

.hitop-sc__done-list {
	list-style: disc;
	padding-left: 20px;
	margin: 0 0 40px;
	font-size: 18px;
	line-height: 32px;
	color: var(--sc-anthracite);
}

.hitop-sc__cta-primary {
	display: inline-flex;
	background: var(--sc-white);
	border: 2px solid var(--sc-primary);
	color: var(--sc-primary);
	border-radius: var(--sc-radius-pill);
	padding: 14px 40px;
	font-family: var(--sc-font);
	font-weight: 700;
	font-size: 16px;
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
	margin-bottom: 28px;
}

.hitop-sc__cta-primary:hover {
	background: var(--sc-primary);
	color: var(--sc-white);
}

.hitop-sc__done-links {
	list-style: none;
	padding: 0;
	margin: 0 0 24px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.hitop-sc__done-links a {
	color: var(--sc-anthracite);
	text-decoration: underline;
	font-size: 16px;
}

.hitop-sc__done-links a:hover {
	color: var(--sc-primary);
}

.hitop-sc__done-links li[hidden] {
	display: none;
}

.hitop-sc__restart {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: transparent;
	border: 0;
	color: var(--sc-light-anthracite);
	padding: 8px 0;
	font-family: var(--sc-font);
	font-weight: 500;
	font-size: 14px;
	cursor: pointer;
	margin-top: 40px;
}

.hitop-sc__restart:hover {
	color: var(--sc-primary);
}

/* ------------------------------------------------------------------
 * External trigger button — default styling so [hitop_selbstcheck_trigger]
 * renders as a primary pill CTA when the user uses the shortcode/block.
 * ---------------------------------------------------------------- */
.hitop-sc-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--sc-primary, #D83F27);
	color: #ffffff;
	border: 0;
	border-radius: 34px;
	padding: 14px 40px;
	font-family: 'Inter', sans-serif;
	font-weight: 700;
	font-size: 16px;
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s ease;
}

.hitop-sc-trigger:hover,
.hitop-sc-trigger:focus-visible {
	background: #AB1700;
	color: #ffffff;
	outline: none;
}

/* ------------------------------------------------------------------
 * Mobile (< 768px) — Figma 3085:1255 / 3085:1292 / 3085:1329
 * ---------------------------------------------------------------- */
@media (max-width: 767px) {
	.hitop-sc__panel {
		top: var(--sc-header-offset-mobile);
	}

	.hitop-sc__info-bar {
		display: block;
	}

	.hitop-sc__content {
		padding: 28px 20px 60px;
	}

	.hitop-sc__inner {
		gap: 24px;
	}

	.hitop-sc__top {
		display: flex;
		flex-direction: column;
		gap: 20px;
	}

	.hitop-sc__meta {
		order: -1;
		flex-direction: row-reverse;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		gap: 8px;
	}

	.hitop-sc__title {
		font-size: 24px;
		line-height: 30px;
	}

	.hitop-sc__subtitle {
		font-size: 16px;
		line-height: 24px;
	}

	.hitop-sc__qlabel {
		font-size: 18px;
		line-height: 26px;
	}

	.hitop-sc__pill {
		padding: 10px 22px;
		font-size: 14px;
	}

	.hitop-sc__pills {
		gap: 10px 10px;
	}

	.hitop-sc__step {
		gap: 30px;
	}

	.hitop-sc__nav {
		margin-top: 20px;
	}

	.hitop-sc__next,
	.hitop-sc__back {
		padding: 16px 32px;
		min-width: 0;
	}

	.hitop-sc__done-headline {
		font-size: 22px;
		line-height: 30px;
	}

	.hitop-sc__done-lead {
		font-size: 16px;
		line-height: 24px;
	}
}

/* Reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.hitop-sc__panel,
	.hitop-sc__backdrop,
	.hitop-sc__pill,
	.hitop-sc__next,
	.hitop-sc__back {
		transition: none;
	}
}
