/**
 * Home page, section 7: FAQ.
 * Loaded on the front page only, after home-reviews.css.
 * Fonts and heading sizes come from style.css.
 * Native details/summary: no JavaScript, every answer is in the page HTML.
 */

.vac-faq {
	padding-block: 0 clamp(4rem, 9vw, 7rem);
	background: var(--color-white);
	color: var(--color-dark);
}

/* Light grey on the home page only; the About and Auto Service pages reuse this file with their own rhythm. */
.vac-home .vac-faq {
	background: var(--color-surface-light);
}

.vac-faq__inner {
	width: min(100% - 2 * var(--vac-gutter), 1240px);
	margin-inline: auto;
	padding-top: clamp(4rem, 9vw, 7rem);
}

.vac-faq__heading {
	max-width: 24ch;
	margin: 0 auto;
	text-align: center;
}

/* One centered column; text inside stays left aligned. */
.vac-faq__list {
	max-width: 52rem;
	margin: clamp(2.5rem, 5vw, 3.5rem) auto 0;
}

/* Thin dividers between questions, no boxes. */
.vac-faq__item {
	border-bottom: 1px solid color-mix(in srgb, var(--color-dark) 12%, transparent);
}

.vac-faq__item:first-child {
	border-top: 1px solid color-mix(in srgb, var(--color-dark) 12%, transparent);
}

.vac-faq__question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	min-height: 3rem;
	padding-block: 1.25rem;
	list-style: none;
	cursor: pointer;
}

.vac-faq__question::-webkit-details-marker {
	display: none;
}

.vac-faq__question:focus-visible {
	outline: 3px solid var(--color-dark);
	outline-offset: 4px;
}

.vac-faq__title {
	margin: 0;
	font-family: var(--font-heading);
	font-weight: 700;
	text-wrap: balance;
}

.vac-faq__question:hover .vac-faq__title {
	text-decoration: underline;
	text-decoration-color: var(--color-red);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
}

/* Red plus that turns into a minus when the answer is open. */
.vac-faq__icon {
	position: relative;
	flex: none;
	width: 1.125rem;
	height: 1.125rem;
}

.vac-faq__icon::before,
.vac-faq__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: 100%;
	height: 2px;
	margin-top: -1px;
	background: var(--color-red);
	transition: transform 0.28s ease;
}

.vac-faq__icon::after {
	transform: rotate(90deg);
}

.vac-faq__item[open] .vac-faq__icon::after {
	transform: rotate(90deg) scaleX(0);
}

.vac-faq__answer {
	max-width: 62ch;
	margin: 0;
	padding: 0 2.75rem 1.5rem 0;
	line-height: 1.7;
}

/*
 * Smooth open and close, CSS only. Browsers without ::details-content or
 * interpolate-size skip this block and open the answer instantly.
 * Opening eases out, closing eases in.
 */
@supports (interpolate-size: allow-keywords) and selector(::details-content) {
	.vac-faq__item {
		interpolate-size: allow-keywords;
	}

	.vac-faq__item::details-content {
		block-size: 0;
		overflow: clip;
		opacity: 0;
		transition:
			block-size 0.28s ease-in,
			opacity 0.28s ease-in,
			content-visibility 0.28s ease-in allow-discrete;
	}

	.vac-faq__item[open]::details-content {
		block-size: auto;
		opacity: 1;
		transition-timing-function: ease-out;
	}

	@media (prefers-reduced-motion: reduce) {
		.vac-faq__item::details-content {
			transition: none;
		}
	}
}

/* Kept separate: an unknown pseudo-element would drop this whole rule. */
@media (prefers-reduced-motion: reduce) {
	.vac-faq__icon::before,
	.vac-faq__icon::after {
		transition: none;
	}
}

@media (max-width: 639px) {
	.vac-faq__answer {
		padding-right: 0;
	}
}
