/*
 * FAQ list.
 *
 * Same rules as every component stylesheet: design-system `--btx-*` tokens
 * only, a fallback on every var(). See cta-button/style.css for the full note.
 *
 * As in problem-grid, this file is short on colour on purpose. The section's
 * ink is *computed* in PHP against whatever background an editor picked and
 * arrives as `--btxc-faq-*` custom properties. Nothing here names a colour
 * token for type — it names those properties, and the defaults below are what
 * they fall back to when the component renders with no background at all,
 * which is paper.
 *
 * THE RULE BETWEEN QUESTIONS
 *
 * It is drawn by mixing the section's own measured ink down to a fraction of
 * itself rather than by naming a token. A named hairline would be right on
 * paper and invisible on the navy, and this component offers the whole palette
 * as a background — so the rule has to follow the ink the way the quiet type
 * does. Graphic work, judged against the 3:1 floor rather than a reading
 * contrast, which is what lets it go this light.
 */

@layer bertex-components {

	/* ── Shell ─────────────────────────────────────────────────────────── */

	.btxc-faq {
		--btxc-faq-bg: transparent;
		--btxc-faq-ink: var( --btx-color-primary-1, #1a2744 );
		--btxc-faq-quiet: var( --btx-color-primary-1-light-40, #2e4578 );

		box-sizing: border-box;
		padding-block: var( --btx-spacing-xxl, 4.5rem );
		padding-inline: var( --btx-spacing-m, 1.25rem );

		background: var( --btxc-faq-bg );
		color: var( --btxc-faq-ink );
	}

	.btxc-faq__inner {
		box-sizing: border-box;
		max-width: var( --btx-max-width, 1440px );
		margin-inline: auto;

		display: grid;
		gap: var( --btx-spacing-xl, 3rem );
	}

	/*
	 * The heading sits in a narrower column than the questions, because it is
	 * three or four words and they are sentences. A 1fr/1fr split leaves the
	 * heading stranded in white space.
	 */
	.btxc-faq--aside .btxc-faq__inner {
		grid-template-columns: 0.8fr 1.2fr;
		align-items: start;
	}

	.btxc-faq--stacked .btxc-faq__inner {
		grid-template-columns: minmax( 0, 1fr );
		max-width: 56rem;
	}

	/* ── Header ────────────────────────────────────────────────────────── */

	.btxc-faq__header {
		display: flex;
		flex-direction: column;
		gap: var( --btx-spacing-xs, 0.625rem );

		min-width: 0;
	}

	/*
	 * Bare `monospace`, and it is the same deliberate exception the other
	 * components make: the design system publishes a heading family and a body
	 * family and no third, so a mono face cannot come from a token. See the
	 * note in booking-panel/style.css.
	 */
	.btxc-faq__eyebrow {
		margin: 0;

		font-family: monospace;
		font-size: var( --btx-font-body-xs, 0.8125rem );
		font-weight: 500;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var( --btxc-faq-quiet );
	}

	.btxc-faq__heading {
		margin: 0;

		font-family: var( --btx-font-heading-family, inherit );
		font-size: var( --btx-font-heading-xl, 2.5rem );
		font-weight: 700;
		line-height: var( --btx-line-height-heading, 1.06 );
		letter-spacing: -0.02em;
		text-wrap: pretty;
		color: var( --btxc-faq-ink );
	}

	.btxc-faq__intro {
		margin: 0;

		font-size: var( --btx-font-body-m, 1.0625rem );
		line-height: var( --btx-line-height-body, 1.7 );
		color: var( --btxc-faq-quiet );
	}

	/* ── The questions ─────────────────────────────────────────────────── */

	.btxc-faq__list {
		display: flex;
		flex-direction: column;

		min-width: 0;
	}

	/*
	 * A rule above every item and one below the last, so the block reads as a
	 * ruled table rather than a list of boxes. `:last-child` carries the
	 * closing line instead of a wrapper border, which keeps the two rules the
	 * same weight.
	 */
	.btxc-faq__item {
		padding-block: var( --btx-spacing-m, 1.5rem );

		display: flex;
		flex-direction: column;
		gap: var( --btx-spacing-xxs, 0.5rem );

		border-top: 1px solid color-mix( in srgb, var( --btxc-faq-ink ) 18%, transparent );
	}

	.btxc-faq__item:last-child {
		border-bottom: 1px solid color-mix( in srgb, var( --btxc-faq-ink ) 18%, transparent );
	}

	.btxc-faq__question {
		margin: 0;

		font-family: var( --btx-font-heading-family, inherit );
		font-size: var( --btx-font-heading-s, 1.375rem );
		font-weight: 600;
		line-height: var( --btx-line-height-heading, 1.3 );
		text-wrap: pretty;
		color: var( --btxc-faq-ink );
	}

	.btxc-faq__answer {
		display: flex;
		flex-direction: column;
		gap: var( --btx-spacing-xs, 0.625rem );
	}

	.btxc-faq__answer p {
		margin: 0;

		max-width: 60ch;

		font-size: var( --btx-font-body-s, 1rem );
		line-height: var( --btx-line-height-body, 1.7 );
		color: var( --btxc-faq-quiet );
	}

	/* ── Narrow ────────────────────────────────────────────────────────── */

	@media ( width < 48rem ) {
		.btxc-faq {
			padding-block: var( --btx-spacing-xl, 3rem );
		}

		/*
		 * The heading stops being a column and becomes the thing above the
		 * questions, which is what it is on a phone.
		 */
		.btxc-faq--aside .btxc-faq__inner {
			grid-template-columns: minmax( 0, 1fr );
			gap: var( --btx-spacing-lg, 2rem );
		}

		.btxc-faq__heading {
			font-size: var( --btx-font-heading-m, 1.875rem );
		}

		.btxc-faq__question {
			font-size: var( --btx-font-body-lg, 1.1875rem );
		}
	}
}
