/*
 * FAQ list + FAQ question
 * Rounded cards with a light blue (Base / Two) question bar, matching the
 * light blue boxes elsewhere on the site. An open answer sits on white below
 * the bar and the chevron fills in.
 */
.riverside-faq {
	--riverside-faq-accent: var(--wp--preset--color--accent, #006fba);
	--riverside-faq-tint: var(--wp--preset--color--base-2, #f0f6f9);
	--riverside-faq-tint-hover: #e6f0f5;
	--riverside-faq-surface: #fff;
	--riverside-faq-icon-bg: #fff;
	--riverside-faq-border: #dbe6ee;
	--riverside-faq-gap: 8px;
}

/* On a light blue section the bar would disappear, so swap tint and white */
.has-base-2-background-color .riverside-faq {
	--riverside-faq-tint: #fff;
	--riverside-faq-tint-hover: #f7fafc;
	--riverside-faq-icon-bg: var(--wp--preset--color--base-2, #f0f6f9);
}

/*
 * Glass style (Styles panel → "Glass"): for FAQs over a photo, e.g. inside a
 * dark Cover. Translucent white bars and answers with white text and a light
 * blur, so the photo shows through but the text stays readable.
 */
.riverside-faq.is-style-glass {
	--riverside-faq-accent: #fff;
	--riverside-faq-tint: rgba(255, 255, 255, 0.2);
	--riverside-faq-tint-hover: rgba(255, 255, 255, 0.28);
	--riverside-faq-surface: rgba(255, 255, 255, 0.12);
	--riverside-faq-icon-bg: rgba(255, 255, 255, 0.22);
	--riverside-faq-border: rgba(255, 255, 255, 0.3);
}

.is-style-glass .riverside-faq__item {
	border-color: rgba(255, 255, 255, 0.16);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.is-style-glass .riverside-faq__q,
.is-style-glass .riverside-faq__a,
.is-style-glass .riverside-faq__toolbar {
	color: #fff;
}

/* Open chevron: solid white with a blue arrow (the default fills it blue) */
.is-style-glass .riverside-faq__item[open] .riverside-faq__icon,
.is-style-glass .riverside-faq__item.is-open .riverside-faq__icon {
	background: #fff;
	color: var(--wp--preset--color--accent, #006fba);
}

.is-style-glass .riverside-faq__a a:not(.wp-element-button) {
	color: #fff;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.is-style-glass .riverside-faq__q:focus-visible {
	outline-color: #fff;
}

/*
 * Always fill the parent (column, group, …). Beats the content width of
 * constrained groups and content-sizing in flex/row groups and stacks.
 */
.wp-block-riverside-faq.riverside-faq {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	flex: 1 1 100%;
	align-self: stretch;
	justify-self: stretch;
	min-width: 0;
}

/* Toolbar: count + Expand all */
.riverside-faq__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin-bottom: 24px;
	font-size: 14px;
	color: var(--wp--preset--color--contrast-2, #636363);
}

.riverside-faq__toggle-all {
	min-height: 44px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var(--riverside-faq-accent);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* Two independent columns */
.riverside-faq__cols {
	display: flex;
	gap: var(--riverside-faq-gap);
	align-items: flex-start;
}

.riverside-faq__col {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--riverside-faq-gap);
}

@media (max-width: 860px) {
	.riverside-faq__cols {
		flex-direction: column;
		align-items: stretch;
	}

	/* Cells join one list and `order` puts them back in sequence */
	.riverside-faq__col {
		display: contents;
	}

	/* Cells are now the flex items: let wide content (tables) scroll
	   inside the answer instead of stretching the whole page */
	.riverside-faq__cell {
		min-width: 0;
	}
}

/* Card */
.riverside-faq__item {
	margin: 0;
	background: var(--riverside-faq-surface);
	border: 1px solid var(--riverside-faq-tint);
	border-radius: 1em;
	overflow: hidden;
	transition: border-color 0.2s;
}

.riverside-faq__item[open],
.riverside-faq__item.is-open {
	border-color: var(--riverside-faq-border);
}

/* Question bar */
.riverside-faq__q {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 22px;
	background: var(--riverside-faq-tint);
	color: var(--wp--preset--color--contrast, #111);
	cursor: pointer;
	list-style: none;
	transition: background-color 0.2s;
}

.riverside-faq__item:not([open]):not(.is-open) .riverside-faq__q:hover {
	background: var(--riverside-faq-tint-hover);
}

/* Space between the bar and the answer */
.riverside-faq__item[open] .riverside-faq__q,
.riverside-faq__item.is-open .riverside-faq__q {
	margin-bottom: 20px;
}

.riverside-faq__q::-webkit-details-marker {
	display: none;
}

.riverside-faq__q::marker {
	content: "";
}

.riverside-faq__q:hover,
.riverside-faq__item[open] .riverside-faq__q,
.riverside-faq__item.is-open .riverside-faq__q {
	color: var(--riverside-faq-accent);
}

.riverside-faq__q:focus-visible {
	/* Drawn inside the bar, since the card clips anything outside it */
	outline: 3px solid var(--wp--preset--color--accent-2, #378fca);
	outline-offset: -3px;
}

.riverside-faq .riverside-faq__title {
	margin: 0;
	padding: 0;
	color: inherit;
	font-family: inherit;
	font-size: 17px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0;
}

/* Chevron */
.riverside-faq__icon {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--riverside-faq-icon-bg);
	color: var(--riverside-faq-accent);
	transition: transform 0.25s, background-color 0.2s, color 0.2s;
	/* Centre on the first text line (1.4 × font size) without adding height to the card */
	margin: calc((1.4em - 32px) / 2) 0;
	font-size: 17px;
}

.riverside-faq__item[open] .riverside-faq__icon,
.riverside-faq__item.is-open .riverside-faq__icon {
	transform: rotate(180deg);
	background: var(--riverside-faq-accent);
	color: #fff;
}

/* Answer */
.riverside-faq__a {
	padding: 0 22px 22px;
	color: #3d3d3d;
	font-size: 16px;
	line-height: 1.65;
}

.riverside-faq__a>* {
	margin-top: 0;
	margin-bottom: 12px;
}

.riverside-faq__a> :last-child {
	margin-bottom: 0;
}

/*
 * Layout blocks inside an answer (columns, groups, rows): keep the card's
 * bottom padding even and stop wide/full alignment escaping the card.
 */
.riverside-faq__a :is(.wp-block-column, .wp-block-group)> :last-child {
	margin-bottom: 0;
}

.riverside-faq__a>.alignwide,
.riverside-faq__a>.alignfull {
	width: auto;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

.riverside-faq__a .wp-block-table {
	overflow-x: auto;
}

/* Text links only; buttons keep their own colours */
.riverside-faq__a a:not(.wp-element-button) {
	color: var(--riverside-faq-accent);
}

.riverside-faq__a li {
	line-height: 1.65;
}

/* Hidden by the FAQ search block */
.riverside-faq__cell[hidden],
.riverside-faq[hidden] {
	display: none;
}

@media (max-width: 720px) {
	.riverside-faq__q {
		padding: 18px 16px;
	}

	.riverside-faq__item[open] .riverside-faq__q,
	.riverside-faq__item.is-open .riverside-faq__q {
		margin-bottom: 18px;
	}

	.riverside-faq .riverside-faq__title,
	.riverside-faq__icon {
		font-size: 16px;
	}

	.riverside-faq__a {
		padding: 0 16px 18px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.riverside-faq__item,
	.riverside-faq__q,
	.riverside-faq__icon {
		transition: none;
	}
}