/**
 * Survey section styles.
 *
 * Mobile-first: vertical card (Figma frame 546:16026, 420px).
 * Desktop (1024px+): horizontal bar (Figma frame 259:11846, 1326×81).
 *
 * @package Hamechadesh
 */

/* ==========================================================================
   Survey Section — Mobile base (matches Figma mobile frame)
   ========================================================================== */

.hm-survey {
	width: 100%;
	max-width: var(--hm-container-width);
	margin-inline: auto;
	content-visibility: auto;
	contain-intrinsic-size: auto 120px;
}

/* Mobile only (≤767px): inner spacing + collapse spent question steps. */
@media (max-width: 767px) {
	.hm-survey {
		padding: 40px 10px;
	}

	/* Once completed, the inactive question steps still reserve grid height
	   (visibility:hidden) and leave an empty gap above the thank-you state.
	   Drop them from layout entirely — the active "thanks" step stays. */
	.hm-survey.is-complete .hm-survey__step:not(.is-active) {
		display: none;
	}
}

/* ---------- Bar (card container) ---------- */

.hm-survey__bar {
	display: flex;
	flex-direction: column;
	gap: 15px;
	background-color: var(--hm-color-bg-alt);
	border-radius: var(--hm-radius-xl);
	overflow: hidden;
}

/* ---------- Header / Title area ---------- */

.hm-survey__header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	height: 81px;
	padding: 4px 40px;
	overflow: hidden;
	flex-shrink: 0;
}

.hm-survey__header-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hm-survey__header-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.2);
}

.hm-survey__header-inner {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
}

.hm-survey__dot {
	flex-shrink: 0;
}

.hm-survey__title {
	font-family: var(--hm-font-primary);
	font-weight: 900;
	font-size: 32px;
	line-height: normal;
	color: #ffffff;
	white-space: nowrap;
}

/* ---------- Steps container (CSS Grid stack) ---------- */

.hm-survey__steps {
	display: grid;
	min-width: 0;
}

/* ---------- Individual step ---------- */

.hm-survey__step {
	grid-row: 1;
	grid-column: 1;
	display: flex;
	flex-direction: column;
	gap: 15px;
	padding: 20px;
	align-items: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--hm-transition-base), visibility var(--hm-transition-base);
	pointer-events: none;
}

.hm-survey__step.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* ---------- Question (mobile: Black 32px, centered) ---------- */

.hm-survey__question {
	font-family: var(--hm-font-primary);
	font-weight: 900;
	font-size: 32px;
	line-height: 1;
	color: var(--hm-color-text);
	text-align: center;
	text-wrap: balance;
	margin: 0;
	flex-shrink: 0;
}

/* ---------- Controls (options + button) ---------- */

.hm-survey__controls {
	display: flex;
	flex-direction: column;
	gap: 15px;
	width: 100%;
}

/* ---------- Options fieldset ---------- */

.hm-survey__options {
	display: flex;
	flex-direction: column;
	gap: 15px;
	border: none;
	padding: 0;
	margin: 0;
	width: 100%;
}

/* ---------- Single option ---------- */

.hm-survey__option {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	cursor: pointer;
	background-color: var(--hm-color-bg-alt);
	border: 0.5px solid rgba(33, 33, 33, 0.25);
	border-radius: 6px;
	padding: 14px 25px;
	transition: background-color var(--hm-transition-fast),
				color var(--hm-transition-fast),
				border-color var(--hm-transition-fast);
}

.hm-survey__option:hover {
	border-color: var(--hm-color-accent);
}

/* Visually hidden radio input (remains accessible) */
.hm-survey__radio {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* Selected option */
.hm-survey__radio:checked + .hm-survey__option-label {
	color: #ffffff;
}

.hm-survey__option:has(.hm-survey__radio:checked) {
	background-color: var(--hm-color-accent);
	border-color: transparent;
}

/* Focus visible for keyboard navigation */
.hm-survey__option:has(.hm-survey__radio:focus-visible) {
	outline: 2px solid var(--hm-color-accent);
	outline-offset: 2px;
}

/* ---------- Option label text ---------- */

.hm-survey__option-label {
	font-family: var(--hm-font-primary);
	font-weight: 300;
	font-size: 14px;
	line-height: 21px;
	color: var(--hm-color-text);
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color var(--hm-transition-fast);
	pointer-events: none;
}

/* ---------- Submit / Next button ---------- */

.hm-survey__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	background-color: var(--hm-color-accent);
	color: #ffffff;
	border: none;
	border-radius: 6px;
	padding: 14px 25px;
	font-family: var(--hm-font-primary);
	font-weight: 300;
	font-size: 14px;
	line-height: 21px;
	white-space: nowrap;
	cursor: pointer;
	transition: opacity var(--hm-transition-fast);
}

.hm-survey__btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.hm-survey__btn:not(:disabled):hover {
	opacity: 0.9;
}

/* ---------- Thank-you state ---------- */

.hm-survey__step--thanks {
	align-items: center;
	justify-content: center;
	text-align: center;
}

.hm-survey__thanks-msg {
	font-family: var(--hm-font-primary);
	font-weight: 900;
	font-size: 24px;
	line-height: 1.2;
	color: var(--hm-color-text);
	margin: 0;
}

.hm-survey__results-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	background-color: var(--hm-color-accent);
	color: #ffffff;
	border-radius: 6px;
	padding: 14px 25px;
	font-family: var(--hm-font-primary);
	font-weight: 300;
	font-size: 14px;
	line-height: 21px;
	white-space: nowrap;
	transition: opacity var(--hm-transition-fast);
}

.hm-survey__results-link:hover {
	color: #ffffff;
	opacity: 0.9;
}

/* ==========================================================================
   Responsive — Desktop (1024px+)
   Horizontal bar matching Figma desktop frame
   ========================================================================== */

@media (min-width: 1024px) {

	.hm-survey {
		padding-block: 0;
		margin-block-start: var(--hm-space-lg);
	}

	/* Bar: horizontal row */
	.hm-survey__bar {
		flex-direction: row;
		align-items: center;
		gap: 15px;
		padding-inline-end: 20px;
	}

	/* Header: fills bar height, side column */
	.hm-survey__header {
		align-self: stretch;
		height: auto;
		min-width: 180px;
	}

	/* Steps take remaining space */
	.hm-survey__steps {
		flex: 1;
	}

	/* Step: horizontal layout, question on right, controls on left */
	.hm-survey__step {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 20px;
		padding: 16px 0;
	}

	/* Question: Light 20px, right-aligned, 2-line max */
	.hm-survey__question {
		font-weight: 300;
		font-size: 20px;
		line-height: 20px;
		text-align: start;
		text-wrap: balance;
		max-width: 220px;
	}

	/* Controls: horizontal row */
	.hm-survey__controls {
		flex-direction: row;
		align-items: center;
		gap: 10px;
		width: auto;
		min-width: 0;
	}

	/* Options: horizontal row */
	.hm-survey__options {
		flex-direction: row;
		gap: 10px;
		width: auto;
		min-width: 0;
	}

	/* Option: auto width, shrinkable */
	.hm-survey__option {
		width: auto;
		padding: 14px 20px;
		min-width: 0;
	}

	/* Option text: allow wrapping to 2 lines, tight leading */
	.hm-survey__option-label {
		white-space: normal;
		text-wrap: balance;
		line-height: 1.1;
	}

	/* Button: auto width, stretch to match option height */
	.hm-survey__btn {
		width: auto;
		padding: 14px 25px;
		flex-shrink: 0;
		align-self: stretch;
	}

	/* Thank-you: horizontal, centered */
	.hm-survey__step--thanks {
		flex-direction: row;
	}

	.hm-survey__thanks-msg {
		font-weight: 700;
		font-size: 18px;
	}

	.hm-survey__results-link {
		width: auto;
	}
}

/* ==========================================================================
   Responsive — Large Desktop (1350px+)
   ========================================================================== */

@media (min-width: 1350px) {

	.hm-survey__header {
		min-width: 200px;
	}

	.hm-survey__option {
		padding: 14px 25px;
	}
}
