/*
 * GCC FAQ Section — block styles
 *
 * All visual values are driven by CSS custom properties so a theme can
 * override anything without touching plugin files:
 *
 *   .gcc-faq-section {
 *     --gcc-faq-accent: #your-brand-color;
 *   }
 *
 * Radius scale
 * ────────────
 * Follows an Apple-style concentric radius approach: outer containers use
 * larger radii, inner elements use proportionally smaller ones so that the
 * visual "gap" between nested corners appears consistent.
 *
 *   --gcc-faq-radius-xl   outer containers (TOC box, stacked layout)   20px
 *   --gcc-faq-radius-lg   summary block                                14px
 *   --gcc-faq-radius-md   images, inline elements                       8px
 *
 * Layout
 * ──────
 * Default (content width / no alignment)
 *   TOC stacks above FAQ items in a rounded box.
 *
 * Wide / full alignment (.gcc-faq-section--wide)
 *   CSS Grid: sticky TOC in a left column, items in the main column.
 *   Grid collapses to single-column below 900 px.
 */

/* ── Custom properties ───────────────────────────────────────────────────── */
.gcc-faq-section {

	/* Colours — intentionally neutral; override with brand colours in theme */
	--gcc-faq-accent:          #1a1a1a;   /* links, active TOC — near-black */
	--gcc-faq-accent-hover:    #000000;
	--gcc-faq-text:            inherit;
	--gcc-faq-muted:           #6b6b6b;   /* secondary text */
	--gcc-faq-border:          #e4e4e4;   /* separators */
	--gcc-faq-summary-bg:      #f5f5f7;   /* Apple-style light grey */
	--gcc-faq-toc-bg:          #f5f5f7;
	--gcc-faq-number-color:    #aaaaaa;

	/* Radius scale */
	--gcc-faq-radius-xl:       20px;
	--gcc-faq-radius-lg:       14px;
	--gcc-faq-radius-md:       8px;

	/* Typography */
	--gcc-faq-question-size:   1.15rem;
	--gcc-faq-summary-size:    1rem;
	--gcc-faq-toc-size:        0.875rem;

	/* Spacing */
	--gcc-faq-item-spacing:    2.5rem;    /* vertical gap between items */
	--gcc-faq-inner-gap:       1rem;      /* gap between question header and body */
	--gcc-faq-toc-width:       260px;
	--gcc-faq-toc-col-gap:     3rem;
	--gcc-faq-toc-sticky-top:  2rem;

	/* Misc */
	--gcc-faq-transition:      0.15s ease;

	color: var(--gcc-faq-text);
}

/* ── Wide layout: two-column grid with sticky TOC ────────────────────────── */
.gcc-faq-section--wide .gcc-faq-section__inner {
	display: grid;
	grid-template-columns: var(--gcc-faq-toc-width) 1fr;
	gap: var(--gcc-faq-toc-col-gap);
	align-items: start;
}

/* ── Table of contents ───────────────────────────────────────────────────── */
.gcc-faq-toc {
	font-size: var(--gcc-faq-toc-size);
}

/* Sticky only in the wide layout */
.gcc-faq-section--wide .gcc-faq-toc {
	position: sticky;
	top: var(--gcc-faq-toc-sticky-top);
	max-height: calc(100vh - var(--gcc-faq-toc-sticky-top) - 2rem);
	overflow-y: auto;
	-webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
	mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

.gcc-faq-toc__heading {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	font-size: 0.7rem;
	color: var(--gcc-faq-muted);
	margin: 0 0 0.75rem;
}

.gcc-faq-toc__list {
	list-style: decimal;
	padding-left: 1.4em;
	margin: 0;
}

.gcc-faq-toc__item {
	margin: 0 0 0.45em;
	line-height: 1.4;
}

.gcc-faq-toc__link {
	color: var(--gcc-faq-accent);
	text-decoration: none;
	transition: color var(--gcc-faq-transition);
}

.gcc-faq-toc__link:hover,
.gcc-faq-toc__link:focus-visible {
	color: var(--gcc-faq-accent-hover);
	text-decoration: underline;
}

/* Active state set by script.js via IntersectionObserver */
.gcc-faq-toc__link--active {
	font-weight: 600;
	color: var(--gcc-faq-accent-hover);
}

/*
 * Stacked TOC (default / narrow layout).
 * Outermost container → uses radius-xl.
 */
.gcc-faq-section:not(.gcc-faq-section--wide) .gcc-faq-toc {
	margin-bottom: var(--gcc-faq-item-spacing);
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--gcc-faq-border);
	border-radius: var(--gcc-faq-radius-xl);
	background: var(--gcc-faq-toc-bg);
}

/* ── Intro text ──────────────────────────────────────────────────────────── */
.gcc-faq-section__intro {
	margin-bottom: var(--gcc-faq-item-spacing);
	color: var(--gcc-faq-muted);
}

.gcc-faq-section__intro p        { margin: 0 0 0.75em; }
.gcc-faq-section__intro p:last-child { margin-bottom: 0; }

/* ── FAQ items ───────────────────────────────────────────────────────────── */
.gcc-faq-item {
	padding-bottom: var(--gcc-faq-item-spacing);
	margin-bottom: var(--gcc-faq-item-spacing);
	border-bottom: 1px solid var(--gcc-faq-border);
}

.gcc-faq-item:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

/* ── Item header: number + question h3 ───────────────────────────────────── */
.gcc-faq-item__header {
	display: flex;
	align-items: baseline;
	gap: 0.5em;
	margin-bottom: var(--gcc-faq-inner-gap);
}

.gcc-faq-item__number {
	font-size: var(--gcc-faq-question-size);
	color: var(--gcc-faq-number-color);
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

.gcc-faq-item__question {
	font-size: var(--gcc-faq-question-size);
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
}

/*
 * ── Summary answer ───────────────────────────────────────────────────────────
 *
 * Fully rounded on all four corners — no border-left.
 * Uses radius-lg: sits inside the item (no wrapping card container),
 * so lg is the correct concentric tier.
 *
 * Background-only distinction is consistent with Apple's approach:
 * elevated surface colour rather than an outline or accent border.
 */
.gcc-faq-item__summary {
	font-size: var(--gcc-faq-summary-size);
	font-weight: 600;
	line-height: 1.5;
	margin: 0 0 var(--gcc-faq-inner-gap);
	padding: 0.85em 1.1em;
	background: var(--gcc-faq-summary-bg);
	border-radius: var(--gcc-faq-radius-lg);
}

/* ── Full answer (WYSIWYG output) ────────────────────────────────────────── */
.gcc-faq-item__answer {
	line-height: 1.7;
}

.gcc-faq-item__answer > *:first-child { margin-top: 0; }
.gcc-faq-item__answer > *:last-child  { margin-bottom: 0; }

.gcc-faq-item__answer p  { margin: 0 0 1em; }

.gcc-faq-item__answer ul,
.gcc-faq-item__answer ol {
	padding-left: 1.5em;
	margin: 0 0 1em;
}

.gcc-faq-item__answer li { margin-bottom: 0.35em; }

.gcc-faq-item__answer a       { color: var(--gcc-faq-accent); }
.gcc-faq-item__answer a:hover { color: var(--gcc-faq-accent-hover); }

/*
 * Images — use radius-md.
 * Innermost visual element → smallest radius tier.
 */
.gcc-faq-item__answer img {
	max-width: 100%;
	height: auto;
	border-radius: var(--gcc-faq-radius-md);
}

/* WordPress core image alignment — targets both <img> and <figure> wrappers */
.gcc-faq-item__answer .alignleft,
.gcc-faq-item__answer figure.alignleft {
	float: left;
	margin: 0.25em 1.5em 1em 0;
}

.gcc-faq-item__answer .alignright,
.gcc-faq-item__answer figure.alignright {
	float: right;
	margin: 0.25em 0 1em 1.5em;
}

.gcc-faq-item__answer .aligncenter,
.gcc-faq-item__answer figure.aligncenter {
	display: block;
	clear: both;
	margin-left: auto;
	margin-right: auto;
}

.gcc-faq-item__answer figure        { margin: 0; }
.gcc-faq-item__answer figure img    { display: block; }

/* Clearfix so the item body fully contains floated images */
.gcc-faq-item__answer::after {
	content: "";
	display: table;
	clear: both;
}

/* ── Responsive: collapse wide grid on small screens ────────────────────── */
@media (max-width: 900px) {
	.gcc-faq-section--wide .gcc-faq-section__inner {
		grid-template-columns: 1fr;
	}

	.gcc-faq-section--wide .gcc-faq-toc {
		position: static;
		max-height: none;
		-webkit-mask-image: none;
		mask-image: none;
		margin-bottom: var(--gcc-faq-item-spacing);
		padding: 1.25rem 1.5rem;
		border: 1px solid var(--gcc-faq-border);
		border-radius: var(--gcc-faq-radius-xl);
		background: var(--gcc-faq-toc-bg);
	}
}

/* ── Accessibility: disable mask-fade for reduced-motion preference ───────── */
@media (prefers-reduced-motion: reduce) {
	.gcc-faq-section--wide .gcc-faq-toc {
		-webkit-mask-image: none;
		mask-image: none;
	}
}
