/* =========================================================================
 * FAQ page — page-specific styles (page ID 47)
 *
 * Loaded only on that one page via bsc_enqueue_page_styles() in
 * functions.php, so nothing here can affect any other page of the site.
 *
 * Every selector is scoped to either:
 *   - body.mg-faq-page  (the body class added on this page only), or
 *   - .mg-faq*          (the FAQ component classes used nowhere else)
 *
 * Layout uses CSS grid. To change the number of columns, edit the single
 * `grid-template-columns` value in `.mg-faq` below — no PHP or HTML change
 * is needed, and the repeated <section class="mg-faq__col"> markup stays
 * valid for any column count.
 * ========================================================================= */

/* Widen the content area on this page only. The parent theme wraps pages in
 * `.content.narrow` (max-width:900px), which cannot hold four columns side by
 * side. !important is required here to win over the parent theme's rule. */
body.mg-faq-page .wrap.content.narrow,
body.mg-faq-page .content.narrow,
body.mg-faq-page .content.narrow article,
body.mg-faq-page main#main {
	max-width: 1720px !important;
}
body.mg-faq-page .wrap {
	max-width: 1780px !important;
}

/* Hide the page title: the four section headings already introduce the
 * content, so a duplicate heading would only add noise. */
body.mg-faq-page .page-title {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * Grid
 * ---------------------------------------------------------------------- */
.mg-faq {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	gap: 26px !important;
	align-items: start;
	margin: 8px 0 0;
	direction: rtl;
	text-align: right;
}

.mg-faq * {
	text-align: right;
}

.mg-faq__col {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * Section heading (icon + title)
 * ---------------------------------------------------------------------- */
.mg-faq__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	margin: 0 0 28px;
}

.mg-faq__icon {
	display: block;
	width: 64px;
	height: 64px;
	color: #0a0a0a;
}

.mg-faq__icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.mg-faq__title {
	margin: 0;
	font-size: 21px;
	font-weight: 500;
	line-height: 1.6;
	color: #0a0a0a;
	text-align: center;
}

/* -------------------------------------------------------------------------
 * Accordion — native <details>/<summary>, no JavaScript required
 * ---------------------------------------------------------------------- */
.mg-faq__list {
	display: flex;
	flex-direction: column;
	border: 1px solid #e9e9e9;
	background: #fff;
}

.mg-faq__item {
	border-bottom: 1px solid #e9e9e9;
}

.mg-faq__item:last-child {
	border-bottom: 0;
}

.mg-faq__q {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 18px 16px;
	cursor: pointer;
	list-style: none;
	font-size: 17px;
	font-weight: 500;
	line-height: 1.9;
	color: #0a0a0a;
}

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

.mg-faq__q {
	transition: color .22s ease;
}

.mg-faq__q:hover {
	background: #fafafa;
	color: #6b4423;
}

.mg-faq__q:hover .mg-faq__plus::before,
.mg-faq__q:hover .mg-faq__plus::after {
	background: #6b4423;
}

/* Keep the plus marker in step with the text colour on hover. */
.mg-faq__plus::before,
.mg-faq__plus::after {
	transition: background-color .22s ease, opacity .2s ease;
}

/* Plus marker drawn with two pseudo-elements; the vertical bar hides when
 * the item is open, which turns the plus into a minus. */
.mg-faq__plus {
	flex: 0 0 auto;
	position: relative;
	width: 13px;
	height: 13px;
	margin-top: .72em;
}

.mg-faq__plus::before,
.mg-faq__plus::after {
	content: "";
	position: absolute;
	background: #0a0a0a;
}

.mg-faq__plus::before {
	top: 50%;
	left: 0;
	width: 100%;
	height: 1.5px;
	transform: translateY(-50%);
}

.mg-faq__plus::after {
	left: 50%;
	top: 0;
	height: 100%;
	width: 1.5px;
	transform: translateX(-50%);
}

.mg-faq__item[open] .mg-faq__plus::after {
	opacity: 0;
}

/* Smooth opening without touching the markup.
 *
 * Two layers, so every browser gets a graceful result:
 *  1) ::details-content animates the real height (Chrome 131+). The panel
 *     grows from zero height, so it reads as sliding out from under the
 *     question rather than popping into place.
 *  2) The panel also fades and slides down slightly. Browsers without
 *     ::details-content still get this softer motion instead of a hard snap.
 */
/* interpolate-size is what makes block-size animate to/from `auto`.
 * Without it the property jumps and the panel pops open instantly. */
.mg-faq {
	interpolate-size: allow-keywords;
}

.mg-faq__item::details-content {
	block-size: 0;
	overflow: hidden;
	transition: block-size .34s cubic-bezier(.22,.61,.36,1),
	            content-visibility .34s allow-discrete,
	            opacity .34s ease,
	            transform .34s cubic-bezier(.22,.61,.36,1);
	opacity: 0;
	transform: translateY(-10px);
}

.mg-faq__item[open]::details-content {
	block-size: auto;
	opacity: 1;
	transform: translateY(0);
}

@supports not selector(::details-content) {
	.mg-faq__item[open] .mg-faq__a {
		animation: mg-faq-fallback .3s ease both;
	}

	@keyframes mg-faq-fallback {
		from {
			opacity: 0;
			transform: translateY(-8px);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}
}

.mg-faq__a {
	padding: 0 38px 18px 16px;
	font-size: 15.5px;
	line-height: 1.95;
	color: #2b2b2b;
}



@media (prefers-reduced-motion: reduce) {
	.mg-faq__a,
	.mg-faq__item[open] {
		animation: none;
	}
	.mg-faq__q {
		transition: none;
	}
}

.mg-faq__a p {
	margin: 0 0 8px;
}

.mg-faq__a p:last-child {
	margin-bottom: 0;
}

.mg-faq__rule {
	margin: clamp(30px, 4vw, 56px) auto 0;
	border: 0;
	border-top: 1px solid #e9e9e9;
}

/* -------------------------------------------------------------------------
 * Responsive layout
 *
 * Most shoppers arrive on a phone, so this is the primary experience, not an
 * afterthought. Keeping four columns at narrow widths forced a sideways
 * scroll and wrapped every question over 5-7 lines, so we switch to a single
 * column instead — each block reads full width, in document order.
 *
 *   4 columns  desktop (>1200px)
 *   2 columns  tablet / small laptop (<=1200px)
 *   1 column   phone (<=760px)
 * ---------------------------------------------------------------------- */
@media (max-width: 1200px) {
	.mg-faq {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 22px !important;
	}

	/* Two columns do not need the page-wide width override any more. */
	body.mg-faq-page .wrap.content.narrow,
	body.mg-faq-page .content.narrow,
	body.mg-faq-page .content.narrow article,
	body.mg-faq-page main#main {
		max-width: 1120px !important;
	}
	body.mg-faq-page .wrap {
		max-width: 1180px !important;
	}
}

@media (max-width: 760px) {
	.mg-faq {
		grid-template-columns: 1fr !important;
		gap: 30px !important;
	}

	body.mg-faq-page .wrap.content.narrow,
	body.mg-faq-page .content.narrow,
	body.mg-faq-page .content.narrow article,
	body.mg-faq-page main#main,
	body.mg-faq-page .wrap {
		max-width: none !important;
	}

	/* Touch-friendly type and spacing: no tiny text, no cramped tap targets. */
	.mg-faq__icon {
		width: 54px;
		height: 54px;
	}
	.mg-faq__title {
		font-size: 19px;
	}
	.mg-faq__head {
		gap: 14px;
		margin-bottom: 18px;
	}
	.mg-faq__q {
		font-size: 15.5px;
		padding: 16px 14px;
		line-height: 1.85;
		gap: 10px;
	}
	.mg-faq__a {
		font-size: 14.5px;
		padding: 0 34px 16px 14px;
		line-height: 1.95;
	}
	.mg-faq__a ul {
		padding-right: 18px;
	}
}

/* Very small phones (iPhone SE and similar). */
@media (max-width: 380px) {
	.mg-faq__q {
		font-size: 14.5px;
		padding: 14px 12px;
	}
	.mg-faq__a {
		font-size: 13.8px;
		padding: 0 30px 14px 12px;
	}
	.mg-faq__title {
		font-size: 18px;
	}
}
