/* =========================================================
   threadslabin - FAQ ACCORDION

   The accordion is a component, not a page.

   Its rules used to be prefixed with .custom-page-faqs, which meant it
   only worked on /faqs/. Dropping the same markup on the home page
   produced an unstyled list. Only the page-frame rules below (site-main
   width, page title, intro) are still tied to that body class.
   =========================================================
   threadslabin - FAQ PAGE
   Body class: custom-page-faqs
   Save as:    assets/css/faq.css

   Goes with assets/js/faq.js

   Everything is scoped to .custom-page-faqs, so no rule here
   can reach the shop, blog, contact page or checkout.
   ========================================================= */

/*
 * The component's own tokens.
 *
 * They used to sit on .custom-page-faqs, so the accordion had no colours
 * at all outside that page. Declared on the component instead, they
 * travel with it wherever the markup is used.
 */
.faq-accordion,
.faq-cta {
	--fq-accent: var(--madder, #a8402f);
	--fq-accent-dark: #8c3526;
	--fq-accent-soft: #faf1ef;

	--fq-ink: var(--ink, #1a1d1a);
	--fq-text: var(--ink-soft, #5d625c);
	--fq-muted: #8a8f89;

	--fq-border: rgba(26, 29, 26, 0.13);
	--fq-border-soft: rgba(26, 29, 26, 0.08);

	--fq-shadow: 0 16px 40px rgba(26, 29, 26, 0.08);
	--fq-shadow-open: 0 18px 44px rgba(26, 29, 26, 0.11);

	--fq-radius: 14px;
	--fq-radius-sm: 9px;
}

/* =========================================================
   1. PAGE FRAME

   page.php wraps every page in .wrap-narrow (680px). An FAQ
   reads well in a narrow column, so this page only widens a
   little rather than going full width like the contact page.
   ========================================================= */

.custom-page-faqs .site-main > .wrap-narrow {
	width: min(100% - 2.5rem, 900px);
}

.custom-page-faqs .site-main {
	padding-top: clamp(2.25rem, 5vw, 3.5rem);
	padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.custom-page-faqs .entry,
.custom-page-faqs .entry-content {
	max-width: none;
}

.custom-page-faqs .entry-thumb { display: none; }

/* =========================================================
   2. PAGE TITLE - ONE LINE ON EVERY SCREEN

   nowrap alone would push the title off the side of a phone,
   so the size is tied to the viewport as well. 6.1vw is the
   largest value at which "Frequently Asked Questions" still
   fits a 320px screen in this typeface; min() caps it so it
   stops growing on desktop.

   If you change the title text, change that number: longer
   text needs a smaller one, shorter text allows a bigger one.
   ========================================================= */

.custom-page-faqs .page-header {
	/* Small gap only: this is the space between the title and the intro
	   paragraph, not the space before the accordion. */
	margin-bottom: 0.9rem;
	text-align: center;
}

.custom-page-faqs .page-title {
	margin: 0;
	font-family: var(--display, system-ui, sans-serif);
	font-size: min(3.75rem, 6.1vw);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.04em;
	color: var(--fq-ink);
	white-space: nowrap;
	/* If a future title is genuinely too long for one line, this keeps
	   it from breaking the layout instead of silently overflowing */
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The intro paragraph, added as a normal block below the title */
.custom-page-faqs .short-description {
	max-width: 60ch;
	/*
	 * No bottom margin. The space before the accordion is set on the
	 * accordion itself, so the page is spaced the same whether or not
	 * this paragraph has been added yet.
	 */
	margin: 0 auto;
	text-align: center;
	font-size: 1.05rem;
	line-height: 1.7;
	color: var(--fq-text);
}

/* =========================================================
   3. GROUP HEADINGS
   ========================================================= */

/*
 * Groups sit inside ONE .faq-accordion. The script looks for every
 * .faq-item under that single root, which is what lets opening a
 * question in one group close an open question in another.
 */
.faq-group + .faq-group {
	margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.faq-group__title {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0 0 1rem;
	font-family: var(--display, system-ui, sans-serif);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--fq-muted);
}

/* A rule that fills whatever space the label leaves */
.faq-group__title::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: var(--fq-border-soft);
}

/* =========================================================
   4. ACCORDION ITEM
   ========================================================= */

.faq-accordion {
	display: block;
	/* The one place the space under the page header is set */
	margin-top: clamp(2.25rem, 5vw, 3.25rem);
}

.faq-group__items {
	display: grid;
	gap: 0.75rem;
}

.faq-item {
	position: relative;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--fq-border);
	border-radius: var(--fq-radius);
	box-shadow: var(--fq-shadow);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-item:hover { border-color: rgba(26, 29, 26, 0.26); }

.faq-item.is-open {
	border-color: var(--fq-ink);
	box-shadow: var(--fq-shadow-open);
}

/* An accent bar down the left edge of whichever item is open */
.faq-item::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 3px;
	background: var(--fq-accent);
	transform: scaleY(0);
	transform-origin: top;
	transition: transform 0.28s ease;
}

.faq-item.is-open::before { transform: scaleY(1); }

/* ---------- The question row ---------- */

.faq-item__heading {
	margin: 0;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
}

.faq-item__q {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	width: 100%;
	margin: 0;
	padding: 1.15rem 1.35rem;
	background: transparent;
	border: 0;
	border-radius: var(--fq-radius);
	text-align: left;
	cursor: pointer;
	color: var(--fq-ink);
	font-family: var(--display, system-ui, sans-serif);
	transition: background-color 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

/*
 * The colour has to be restated here.
 *
 * .faq-item__q is a <button>, and style.css carries a global
 * button:hover rule that sets color: #fff. This rule wins on background
 * but said nothing about colour, so the question text turned white on a
 * near-white row and vanished on hover.
 */
.faq-item__q:hover {
	background: rgba(26, 29, 26, 0.025);
	color: var(--fq-ink);
}

/* A visible ring for keyboard users, not for mouse clicks */
.faq-item__q:focus-visible {
	outline: 2px solid var(--fq-accent);
	outline-offset: -3px;
	background: rgba(26, 29, 26, 0.025);
	color: var(--fq-ink);
}

/* ---------- Number ---------- */

.faq-item__num {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	background: var(--chalk, #f3f2ed);
	border-radius: 9px;
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--fq-muted);
	font-variant-numeric: tabular-nums;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.faq-item.is-open .faq-item__num {
	background: var(--fq-accent);
	color: #fff;
}

/* ---------- Question text ---------- */

.faq-item__text {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 1.02rem;
	font-weight: 700;
	line-height: 1.45;
	letter-spacing: -0.01em;
	transition: color 0.18s ease;
}

.faq-item.is-open .faq-item__text { color: var(--fq-ink); }

/* ---------- Plus that turns into a minus ---------- */

.faq-item__icon {
	flex: 0 0 auto;
	position: relative;
	width: 30px;
	height: 30px;
	border: 1px solid var(--fq-border);
	border-radius: 50%;
	transition: background-color 0.22s ease, border-color 0.22s ease, transform 0.28s ease;
}

.faq-item__icon::before,
.faq-item__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 11px;
	height: 1.8px;
	background: var(--fq-ink);
	border-radius: 2px;
	transform: translate(-50%, -50%);
	transition: transform 0.28s ease, background-color 0.22s ease;
}

/* The upright stroke of the plus */
.faq-item__icon::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.faq-item.is-open .faq-item__icon {
	background: var(--fq-ink);
	border-color: var(--fq-ink);
	transform: rotate(180deg);
}

.faq-item.is-open .faq-item__icon::before,
.faq-item.is-open .faq-item__icon::after {
	background: #fff;
}

/* Collapsing the upright stroke leaves a minus */
.faq-item.is-open .faq-item__icon::after {
	transform: translate(-50%, -50%) rotate(90deg) scaleX(0);
}

/* =========================================================
   5. THE ANSWER PANEL

   Height animates with grid-template-rows 0fr to 1fr. This
   avoids the usual max-height guess, which either clips a
   long answer or leaves a delay on a short one.
   ========================================================= */

.faq-item__a {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.is-open .faq-item__a {
	grid-template-rows: 1fr;
}

.faq-item__inner {
	overflow: hidden;
	min-height: 0;
}

.faq-item__body {
	padding: 0 1.35rem 1.3rem 4.6rem;
	font-size: 0.97rem;
	line-height: 1.75;
	color: var(--fq-text);
}

.faq-item__body > *:first-child { margin-top: 0; }
.faq-item__body > *:last-child { margin-bottom: 0; }

.faq-item__body p { margin: 0 0 0.85rem; }

.faq-item__body ul,
.faq-item__body ol {
	margin: 0 0 0.85rem;
	padding-left: 1.2rem;
}

.faq-item__body li { margin-bottom: 0.4rem; }
.faq-item__body li::marker { color: var(--fq-accent); }

.faq-item__body strong { color: var(--fq-ink); font-weight: 700; }

.faq-item__body a {
	color: var(--fq-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.faq-item__body a:hover { color: var(--fq-accent-dark); }

/* ---------------------------------------------------------
   Without JavaScript the buttons do nothing, so every answer
   is shown. The script adds .is-ready, which hands control
   of the panels over to the accordion.
   --------------------------------------------------------- */

.faq-accordion:not(.is-ready) .faq-item__a {
	grid-template-rows: 1fr;
}

.faq-accordion:not(.is-ready) .faq-item__icon {
	display: none;
}

/* =========================================================
   6. CLOSING CTA
   ========================================================= */

.faq-cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin-top: clamp(2rem, 5vw, 3rem);
	padding: clamp(1.5rem, 3vw, 2.1rem);
	background:
		radial-gradient(circle at 110% 10%, rgba(168, 64, 47, 0.45) 0%, rgba(168, 64, 47, 0) 60%),
		linear-gradient(160deg, #232723 0%, var(--fq-ink) 65%, #141714 100%);
	background-color: var(--fq-ink);
	border-radius: var(--fq-radius);
	color: #fff;
}

.faq-cta__text { min-width: 0; }

.faq-cta__title {
	margin: 0 0 0.35rem;
	font-family: var(--display, system-ui, sans-serif);
	font-size: clamp(1.15rem, 2.2vw, 1.45rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #fff;
}

.faq-cta__sub {
	margin: 0;
	font-size: 0.94rem;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.7);
}

.faq-cta__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.95em 1.9em;
	background: var(--fq-accent);
	border-radius: var(--fq-radius-sm);
	color: #fff;
	font-family: var(--display, system-ui, sans-serif);
	font-size: 0.92rem;
	font-weight: 700;
	text-decoration: none;
	transition: background-color 0.18s ease, transform 0.18s ease, gap 0.18s ease;
}

.faq-cta__btn:hover {
	background: var(--fq-accent-dark);
	transform: translateY(-2px);
	gap: 0.8rem;
	color: #fff;
}

.faq-cta__btn svg { width: 17px; height: 17px; }

/* =========================================================
   7. RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {
	.faq-item__q { padding: 1.05rem 1.15rem; gap: 0.8rem; }
	.faq-item__body { padding-left: 4.2rem; padding-right: 1.15rem; }
}

@media (max-width: 767px) {
	.custom-page-faqs .short-description { font-size: 1rem; }

	.faq-item__text { font-size: 0.98rem; }

	/* The answer lines up under the question rather than under the
	   number, which would leave it in a very narrow column */
	.faq-item__body { padding-left: 1.15rem; }
}

@media (max-width: 560px) {
	.custom-page-faqs .site-main > .wrap-narrow {
		width: min(100% - 1.75rem, 900px);
	}

	.faq-item__q { padding: 0.95rem 1rem; gap: 0.7rem; }

	.faq-item__num {
		width: 28px;
		height: 28px;
		font-size: 0.72rem;
		border-radius: 8px;
	}

	.faq-item__text { font-size: 0.94rem; }

	.faq-item__icon { width: 26px; height: 26px; }
	.faq-item__icon::before,
	.faq-item__icon::after { width: 10px; }

	.faq-item__body {
		padding: 0 1rem 1.1rem;
		font-size: 0.93rem;
	}

	.faq-cta { flex-direction: column; align-items: flex-start; }
	.faq-cta__btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
	/* Below this the number badge costs more room than it earns */
	.faq-item__num { display: none; }
}

/* =========================================================
   8. MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
	.faq-item,
	.faq-item::before,
	.faq-item__a,
	.faq-item__icon,
	.faq-item__icon::before,
	.faq-item__icon::after,
	.faq-item__num,
	.faq-cta__btn {
		transition: none !important;
	}

	.faq-cta__btn:hover { transform: none; }
}