/* ======================================================================
   page-section.content-sections
   ----------------------------------------------------------------------
   Two variations share the same markup:

     .accordion  stacked items, each with a toggle heading
     .tabs       button row (.sections-nav) switches items; below 768px
                 the nav is hidden and it behaves like the accordion

   Closed panels get hidden="until-found" from script.js. Never put
   display:none on .item-panel[hidden] — that would break find-in-page
   and #anchor navigation into closed panels.
   ====================================================================== */

.page-section.content-sections .section-wrap {
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.page-section.content-sections .sections-wrap {
	padding-bottom: var(--padding-content);
}

/* Before script.js has run, keep closed panels out of sight (no FOUC).
   Without JS (.no-js) every panel is simply visible. */
.js .page-section.content-sections:not(.is-ready) .item:not(.is-open) .item-panel {
	display: none;
}


/* ----------------------------------------------------------------------
   Items (accordion look — also the mobile look for tabs)
   ---------------------------------------------------------------------- */

.page-section.content-sections .item {
	margin: 0;
	border-bottom: solid 1px var(--ctx-border);
	scroll-margin-top: calc(var(--header-height) + 16px);
}

.page-section.content-sections .item:first-child {
	border-top: solid 1px var(--ctx-border);
}

.page-section.content-sections .item-title {
	margin: 0;
}

.page-section.content-sections .item-toggle {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	width: 100%;
	margin: 0;
	padding: 0.75em 0;
	border: 0;
	background: transparent;
	font: inherit;
	line-height: inherit;
	text-align: left;
	color: var(--ctx-fg-heading);
	cursor: pointer;
	transition: color .15s;
}

.page-section.content-sections .item-toggle:hover,
.page-section.content-sections .item.is-open .item-toggle {
	color: var(--ctx-fg-heading-em);
}

.page-section.content-sections .item-toggle:focus-visible {
	outline: 2px solid var(--ctx-fg-heading-em);
	outline-offset: 4px;
}

/* Chevron — currentColor + mask-image (Phosphor "caret-down") */
.page-section.content-sections .item-toggle-icon {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") no-repeat center center;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") no-repeat center center;
	-webkit-mask-size: 28px 28px;
	mask-size: 28px 28px;
	transition: transform .25s;
}

.page-section.content-sections .item.is-open .item-toggle-icon {
	transform: rotate(180deg);
}

.page-section.content-sections .item-panel {
	color: var(--ctx-fg);
}

.page-section.content-sections .item-panel-inner {
	padding: 0.25em 0 1em 0;
}

.page-section.content-sections .item-panel-inner > :last-child {
	margin-bottom: 0;
}


/* ----------------------------------------------------------------------
   Tabs nav — hidden below 768px (accordion behaviour takes over)
   ---------------------------------------------------------------------- */

.page-section.content-sections .sections-nav {
	display: none;
}


@media screen and (min-width: 768px) {

	.page-section.content-sections.tabs .sections-nav {
		display: flex;
		flex-wrap: wrap;
		gap: var(--gap-chips);
		margin: 0 0 var(--padding-content) 0;
	}

	.page-section.content-sections.tabs.nav-sticky .sections-nav {
		position: sticky;
		top: var(--header-height);
		z-index: 5;
		padding: 12px 0;
		background: var(--ctx-bg);
	}

	.page-section.content-sections .sections-nav-item {
		margin: 0;
		padding: 8px 16px;
		border: solid 2px var(--ctx-btn-primary-border);
		background: var(--ctx-btn-primary-bg);
		color: var(--ctx-btn-primary-text);
		font: inherit;
		font-size: 0.8125rem;   /* 13px — matches a.btn */
		font-weight: 600;
		line-height: 20px;
		cursor: pointer;
		transition: background .15s, border-color .15s;
	}

	.page-section.content-sections .sections-nav-item:hover {
		background: color-mix(in srgb, var(--ctx-btn-primary-bg) 85%, white);
		border-color: color-mix(in srgb, var(--ctx-btn-primary-border) 85%, white);
	}

	.page-section.content-sections .sections-nav-item:focus-visible {
		box-shadow: 0 0 0 2px #fff inset;
	}

	.page-section.content-sections .sections-nav-item.is-active {
		background: var(--ctx-accent);
		border-color: var(--ctx-accent);
		color: var(--ctx-accent-fg);
	}

	/* In tabs mode the nav replaces the toggle headings */
	.page-section.content-sections.tabs .item {
		border: 0;
		scroll-margin-top: calc(var(--header-height) + 80px);
	}

	.page-section.content-sections.tabs .item-title {
		display: none;
	}

	.page-section.content-sections.tabs .item-panel-inner {
		padding: 0;
	}

}


@media screen and (min-width: 1024px) {

	.page-section.content-sections .container {
		display: grid;
		grid-template-columns: repeat(12, 1fr);
		gap: var(--gap-columns);
		align-items: stretch;
	}

	/* Left-aligned by default so the left edge lines up with the first
	   column of standard-content (cols_8_4, cols_6_6, ...).
	   Additional css classes: .centered (old 8-col centered look), .wide */
	.page-section.content-sections .section-wrap { grid-column: 1 / span 8; }

	.page-section.content-sections.centered .section-wrap { grid-column: 3 / span 8; }

	.page-section.content-sections.wide .section-wrap { grid-column: 1 / span 12; }

}
