/* Brentwood FAQ Accordion — a text card with a question list beside a large
 * image; clicking a question expands its answer in a panel below the image.
 * Mirrors brentwood.ca/admissions/financial-information. The accent colour comes
 * from --bw-faq-primary on the wrapper. The panel expand/collapse animation is
 * the grid-template-rows 0fr↔1fr technique used by bw/table-accordion. */

.bw-faq,
.bw-faq * {
	box-sizing: border-box;
}

/* ── two-column layout ─────────────────────────────────────────────────────── */
.bw-faq {
	container-type: inline-size;
}

.bw-faq__row {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 0;
}

.bw-faq__col--text {
	position: relative;
	z-index: 2;
	flex: 0 0 38%;
	max-width: 38%;
	display: flex;             /* let the card fill the column height reliably */
	flex-direction: column;
}

.bw-faq__col--media {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

/* image on the left: mirror the column order. */
.bw-faq--img-left .bw-faq__row { flex-direction: row-reverse; }

/* ── text card ─────────────────────────────────────────────────────────────── */
.bw-faq__card {
	position: relative;
	z-index: 2;
	flex: 1;                   /* fill the column → same height as the image */
	margin: 0;
	padding: var(--bw-faq-pad, 28px);
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
/* Square the edge that meets the image so the curve divider can bridge it. */
.bw-faq--img-right .bw-faq__card {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}
.bw-faq--img-left .bw-faq__card {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

/* The intro is user InnerBlocks (heading + paragraph) — keep theme styling, just
 * trim the first/last margins so it sits neatly inside the card. */
.bw-faq__intro > :first-child { margin-top: 0; }
.bw-faq__intro > :last-child  { margin-bottom: 0; }

/* ── question list ─────────────────────────────────────────────────────────── */
.bw-faq__list {
	list-style: disc;
	margin: 1.1rem 0 0;
	padding-left: 1.25rem;
}
.bw-faq__list-item {
	margin: 0 0 0.5rem;
	color: var(--bw-faq-primary, #cc0000);
}
.bw-faq__list-item:last-child { margin-bottom: 0; }

.bw-faq__trigger,
.bw-faq__link {
	color: var(--bw-faq-primary, #cc0000);
	text-decoration: none;
	cursor: pointer;
}
.bw-faq__trigger:hover,
.bw-faq__trigger:focus-visible,
.bw-faq__link:hover,
.bw-faq__link:focus-visible {
	text-decoration: underline;
}

/* ── image + curve divider ─────────────────────────────────────────────────── */
.bw-faq__image-wrap {
	position: relative;
	flex: 1 1 auto;            /* fill the column height → card matches image height */
	min-height: 0;
	overflow: hidden;
	box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.2);
}
/* round only the outer corners (the curve handles the edge facing the card). */
.bw-faq--img-right .bw-faq__image-wrap {
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px;
}
.bw-faq--img-left .bw-faq__image-wrap {
	border-top-left-radius: 6px;
	border-bottom-left-radius: 6px;
}
.bw-faq__image {
	display: block;
	width: 100%;
	height: 100%;
	max-height: 640px;
	object-fit: cover;
}

/* Curve divider — a white ellipse bulging the card colour into the image, the
 * same geometry as the bw/curve block (fixed 8rem width, 150% height, ~1rem
 * bleed). It lives over the image and is clipped to the image bounds. */
.bw-faq__curve {
	position: absolute;
	inset: 0;
	overflow: hidden;
	z-index: 2;
	pointer-events: none;
}
.bw-faq__curve-shape {
	position: absolute;
	top: -25%;                 /* (100% - 150%) / 2 — vertically centred */
	width: 8rem;
	height: 150%;
	border-radius: 100%;
	background: #fff;
}
/* near edge sits ~1rem past the seam into the image; the rest is clipped away. */
.bw-faq__curve--right .bw-faq__curve-shape { left: calc(1rem - 8rem); right: auto; }
.bw-faq__curve--left  .bw-faq__curve-shape { right: calc(1rem - 8rem); left: auto; }

/* ── answer panels (a separate unit below the row) ─────────────────────────── */
/* The panels sit outside the card+image row, aligned under the image column, so
 * opening an answer never stretches the text card. Width = 100% − text column.
 * Closed = a 0fr grid row (collapsed); open = 1fr. Animating grid-template-rows
 * gives a smooth expand/collapse without measuring the content. */
.bw-faq__panels {
	width: 62%;
	margin-left: auto;          /* image on the right → panels align right */
}
.bw-faq--img-left .bw-faq__panels {
	margin-left: 0;
	margin-right: auto;         /* image on the left → panels align left */
}
.bw-faq__panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.3s ease, margin-top 0.3s ease;
	scroll-margin-top: 100px;
}
.bw-faq__panel.is-open {
	grid-template-rows: 1fr;
	margin-top: 1.25rem;
}
/* The clip is the element the grid collapses + overflow-clips. Its small top/right
 * padding leaves room for the × that's nudged half outside the card corner, so the
 * × isn't clipped when the panel is open. */
.bw-faq__panel-clip {
	overflow: hidden;
	min-height: 0;
	padding-top: 0.6rem;
	padding-right: 0.6rem;
	opacity: 0;
	transition: opacity 0.25s ease;
}
.bw-faq__panel.is-open .bw-faq__panel-clip {
	opacity: 1;
}
.bw-faq__panel-inner {
	position: relative;
	padding: 1.5rem;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* A collapsed panel must not leak its × — absolutely-positioned children can
 * escape the 0fr / overflow:hidden clip. Hide the × until the panel is open. */
.bw-faq__panel:not(.is-open) .bw-faq__close {
	display: none;
}

.bw-faq__panel-body {
	color: #374151;
	line-height: 1.6;
}
.bw-faq__panel-body > :first-child { margin-top: 0; }
.bw-faq__panel-body > :last-child  { margin-bottom: 0; }
.bw-faq__panel-body a {
	color: var(--bw-faq-primary, #cc0000);
}

/* Round × close button at the card's top-right corner, nudged half outside —
 * matches the modal pop-up close (bw-tm__close / bw-tl__close). */
.bw-faq__close {
	position: absolute;
	top: -0.5rem;
	right: -0.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 9999px;
	background: #f3f4f6;
	color: #374151;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}
.bw-faq__close:hover,
.bw-faq__close:focus {
	background: #e5e7eb;
	color: #1f2937;
	outline: none;
}
.bw-faq__close svg {
	display: block;
	width: 1rem;
	height: 1rem;
}

/* ── tablet: even 50 / 50 split (still side by side) ───────────────────────── */
@container (min-width: 701px) and (max-width: 1024px) {
	.bw-faq__col--text {
		flex: 0 0 50%;
		max-width: 50%;
	}
	/* Tablet: the answer panel spans the full block width (not just the image column). */
	.bw-faq__panels,
	.bw-faq--img-left .bw-faq__panels { width: 100%; margin: 0; }
}

/* ── mobile: stack with the IMAGE on top, then the text section ─────────────── */
@container (max-width: 700px) {
	.bw-faq__row,
	.bw-faq--img-left .bw-faq__row {
		flex-direction: column-reverse;   /* DOM is text → image; reverse puts image on top */
	}
	.bw-faq__col--text,
	.bw-faq--img-left .bw-faq__col--text {
		flex-basis: auto;
		max-width: 100%;
		margin: 0;
	}
	/* Stacked: no curve bridge; full radius on both the card and the image. */
	.bw-faq__curve { display: none; }
	.bw-faq__card { border-radius: 8px; margin-top: 1rem; }   /* gap below the image above it */
	.bw-faq__image-wrap { border-radius: 6px; }
	.bw-faq__image { max-height: 360px; }
	.bw-faq__panels,
	.bw-faq--img-left .bw-faq__panels { width: 100%; margin: 0; }
}

/* Fallback for browsers without container queries (keys off the viewport). */
@supports not (container-type: inline-size) {
	/* tablet: even 50 / 50 split */
	@media (min-width: 783px) and (max-width: 1024px) {
		.bw-faq__col--text {
			flex: 0 0 50%;
			max-width: 50%;
		}
		.bw-faq__panels,
		.bw-faq--img-left .bw-faq__panels { width: 100%; margin: 0; }
	}
	/* mobile: stack with the image on top */
	@media (max-width: 782px) {
		.bw-faq__row,
		.bw-faq--img-left .bw-faq__row {
			flex-direction: column-reverse;
		}
		.bw-faq__col--text,
		.bw-faq--img-left .bw-faq__col--text {
			flex-basis: auto;
			max-width: 100%;
			margin: 0;
		}
		.bw-faq__curve { display: none; }
		.bw-faq__card { border-radius: 8px; margin-top: 1rem; }
		.bw-faq__image-wrap { border-radius: 6px; }
		.bw-faq__image { max-height: 360px; }
		.bw-faq__panels,
		.bw-faq--img-left .bw-faq__panels { width: 100%; margin: 0; }
	}
}

/* ── editor chrome ─────────────────────────────────────────────────────────── */
.bw-faq-editor__hint {
	margin: 0 0 8px;
	font-size: 12px;
	color: #757575;
}

/* Two-column editor that mirrors the front end: text card beside the image. */
.bw-faq-editor__row {
	display: flex;
	align-items: stretch;
	gap: 0;
}
.bw-faq-editor__row--img-left {
	flex-direction: row-reverse;
}
.bw-faq-editor__col--text {
	position: relative;
	z-index: 2;
	flex: 0 0 42%;
	max-width: 42%;
}
/* Revealed layout has no image — let the text card use the full editor width. */
.bw-faq-editor__row--reveal .bw-faq-editor__col--text {
	flex: 1 1 auto;
	max-width: none;
}
.bw-faq-editor__col--media {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.bw-faq-editor__card {
	width: 100%;
	margin: 1rem 0;
	padding: 1.25rem 1.25rem 1.5rem;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
.bw-faq-editor__image-btn {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 320px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}
.bw-faq-editor__image-btn img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 320px;
	max-height: 560px;
	object-fit: cover;
	border-radius: 6px;
	box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.2);
}
.bw-faq-editor__image-placeholder {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 320px;
	border: 1px dashed #c3c4c7 !important;
	border-radius: 6px;
	background: #fbfbfc;
}
.bw-faq-editor__image-actions {
	margin-top: 4px;
	text-align: center;
}

/* Narrow editor canvas: stack the two columns. */
@media (max-width: 960px) {
	.bw-faq-editor__row,
	.bw-faq-editor__row--img-left {
		flex-direction: column;
	}
	.bw-faq-editor__col--text,
	.bw-faq-editor__row--img-left .bw-faq-editor__col--text {
		flex-basis: auto;
		max-width: 100%;
		margin: 0;
	}
}
.bw-faq-editor__tag {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #757575;
}

.bw-faq-text-editor,
.bw-faq-item-editor {
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	margin-bottom: 12px;
	background: #fff;
}
.bw-faq-text-editor {
	padding: 10px 12px 12px;
}

.bw-faq-item-editor__bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-bottom: 1px solid #f0f0f0;
	background: #f6f7f7;
	border-top-left-radius: 6px;
	border-top-right-radius: 6px;
}
.bw-faq-item-editor__body {
	padding: 10px 12px 12px;
}
.bw-faq-item-editor__body-label {
	margin: 0 0 6px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #9a9a9a;
}

/* ── revealed-panel variant (bw-faq--reveal) ──────────────────────────────────
 * A single-column FAQ like the live course-selection "Frequently Asked
 * Questions" panel: a heading row with a × close, then each question (uppercase
 * heading) + its answer, separated by hairline rules. Hidden until a link to its
 * anchor is clicked (view.js reveals + scrolls; the × hides it + clears the hash). */
.bw-faq--reveal.is-hidden { display: none; }

.bw-faq--reveal {
	display: block;
	max-width: 720px;
	margin-inline: auto;
	padding: var(--bw-faq-pad, 28px);
	background: transparent;
	scroll-margin-top: 90px;
}

.bw-faq__reveal-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	border-bottom: 4px solid #e2e2e2;
	padding-bottom: 0.75rem;
	margin-bottom: 0.25rem;
}
.bw-faq__reveal-head .bw-faq__intro { flex: 1 1 auto; min-width: 0; }
.bw-faq__reveal-head .bw-faq__intro > :first-child { margin-top: 0; }
.bw-faq__reveal-head .bw-faq__intro > :last-child  { margin-bottom: 0; }
.bw-faq__reveal-spacer { flex: 1 1 auto; }

/* The × sits inside the head row (not nudged outside like the panel close). */
.bw-faq__reveal-close {
	position: static;
	flex: 0 0 auto;
}

.bw-faq__qa {
	border-top: 3px solid #e2e2e2;
	padding: 1.25rem 0;
}
.bw-faq__reveal-body > .bw-faq__qa:first-child { border-top: 0; }

.bw-faq__q {
	margin: 0 0 0.6rem;
	font-family: "Oswald", "Open Sans", sans-serif;
	font-weight: 400;
	font-size: 1.15rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #4b5563;
}
.bw-faq__a > :first-child { margin-top: 0; }
.bw-faq__a > :last-child  { margin-bottom: 0; }
.bw-faq__a a { color: var(--bw-faq-primary, #cc0000); }

@media (max-width: 600px) {
	.bw-faq--reveal { padding: 1.25rem; }
}
