/**
 * Content pages (block-editor body, bbt_page_context() === 'content').
 * Covers the migrated Elementor pages: FAQs, Before you buy, Shipping
 * Information, General Terms & Conditions, Rewards & Points Guide,
 * Promotions, Privacy Policy, Why it's safe, Loyalty and Rewards, plus any
 * future plain content page. Tokens only, from main.css.
 *
 * @package BB_Theme
 */

/* Headings inside page body copy. */
.bb-content__body h2,
.bb-content__body h3,
.bb-content__body h4 {
	font-family: var( --bb-font-display );
	line-height: 1.25;
}
.bb-content__body h2 { font-size: 1.5rem; margin-top: 2em; }
.bb-content__body h3 { font-size: 1.1875rem; margin-top: 1.75em; }
.bb-content__body h4 { font-size: 1.0625rem; margin-top: 1.5em; }
.bb-content__body > :first-child { margin-top: 0; }

/* Lists: main.css removes list-style from any classed <ul>/<ol>, so restore
   bullets/numbers and indent for the block-generated wp-block-list markup. */
.bb-content__body ul,
.bb-content__body ol {
	margin: 0;
	padding-left: 1.25em;
}
.bb-content__body ul { list-style: disc; }
.bb-content__body ol { list-style: decimal; }
.bb-content__body ul ul,
.bb-content__body ol ul { list-style: circle; margin-top: .25em; }
.bb-content__body li { margin: 0 0 .4em; }
.bb-content__body li:last-child { margin-bottom: 0; }

/* FAQ-style accordions (core/details). */
.bb-content__body details {
	border-bottom: 1px solid var( --bb-border );
	padding: 14px 0;
}
.bb-content__body details:first-of-type { border-top: 1px solid var( --bb-border ); }
.bb-content__body summary {
	cursor: pointer;
	font-weight: 600;
	list-style: none;
	padding-right: 28px;
	position: relative;
}
.bb-content__body summary::-webkit-details-marker { display: none; }
.bb-content__body summary::after {
	content: "+";
	position: absolute;
	right: 4px;
	top: 0;
	font-weight: 400;
	color: var( --bb-muted );
}
.bb-content__body details[open] summary::after { content: "\2212"; }
.bb-content__body details > :last-child { margin-top: 10px; }

/* Callout box (converted Elementor "alert" widgets). */
.bb-content__body .bb-callout {
	background: var( --bb-pale-yellow );
	border: 1px solid var( --bb-soft-yellow );
	border-radius: var( --bb-r-small );
	padding: 14px 16px;
}
.bb-content__body .bb-callout p { margin: 0; }

/* Tables, if a migrated page ever includes one. */
.bb-content__body table {
	width: 100%;
	border-collapse: collapse;
	font-size: .9375rem;
}
.bb-content__body th,
.bb-content__body td {
	border: 1px solid var( --bb-border );
	padding: 8px 10px;
	text-align: left;
}

/* Buttons placed in page body copy (core/buttons). */
.bb-content__body .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var( --bb-touch );
	padding: 0 20px;
	border-radius: var( --bb-r-control );
	background: var( --bb-yellow );
	color: var( --bb-ink );
	font-weight: 700;
	text-decoration: none;
}

/* Native WooCommerce [products] shortcode output (used as the Promotions
   page's product-grid fallback) laid out like the rest of the site's grids. */
.bb-content__body ul.products {
	display: grid;
	grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	gap: 16px;
	margin: 1.5em 0 0;
	padding: 0;
	list-style: none;
}

@media ( max-width: 767px ) {
	.bb-content__body ul.products { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); gap: 12px; }
	.bb-content__body h2 { font-size: 1.3125rem; }
}

/* FAQ live filter box (FAQs page; inc/pages/content.php adds it automatically
   whenever a page has 5+ <details> accordions). */
.bb-content__faqsearch { max-width: 480px; margin: 0 0 24px; }
.bb-content__faqsearch input { font-size: 1rem; }
.bb-content__faqempty { margin-top: 12px; color: var( --bb-muted ); }

/* "On this page" anchor nav (long pages: Shipping Information, General
   Terms & Conditions — inc/pages/content.php adds it automatically from the
   page's own real headings, 3+ of them, when the page isn't FAQ-style). */
.bb-content__layout { display: grid; grid-template-columns: minmax( 0, 1fr ) 240px; gap: clamp( 24px, 3vw, 48px ); align-items: start; }
.bb-content__layout .bb-content__body { max-width: none; }
.bb-content__toc { order: 2; position: sticky; top: 16px; padding: 18px 20px; border: 1px solid var( --bb-border ); border-radius: var( --bb-r-tile ); background: var( --bb-surface ); }
.bb-content__toclabel { margin: 0 0 10px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var( --bb-muted ); }
.bb-content__toc ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.bb-content__toc a { display: block; padding: 4px 0; font-size: .875rem; line-height: 1.4; color: var( --bb-ink ); text-decoration: none; }
.bb-content__toc a:hover { text-decoration: underline; }
.bb-content__tocitem--h3 a { padding-left: 12px; color: var( --bb-body ); font-size: .8125rem; }
.bb-content__tocitem--h4 a { padding-left: 22px; color: var( --bb-muted ); font-size: .8125rem; }

@media ( max-width: 900px ) {
	.bb-content__layout { grid-template-columns: 1fr; }
	.bb-content__toc { order: -1; position: static; }
}

/* Scrollspy (assets/js/toc.js): active section, scrollable sticky TOC,
   phone sticky "On this page: [section]" bar. --bb-toc-header is the height
   of a sticky site header, if any (0 today). */
.bb-content__body :is( h2, h3, h4 )[id] { scroll-margin-top: calc( var( --bb-toc-header, 0px ) + 16px ); }
.bb-content__body :is( h2, h3, h4 )[id]:focus { outline: none; }
.bb-content__body :is( h2, h3, h4 )[id]:focus-visible { outline: 2px solid var( --bb-ink ); outline-offset: 4px; }
.bb-content__tocbar { display: none; }
.bb-content__tocitem { position: relative; }
.bb-content__toc a[aria-current="location"] { font-weight: 700; color: var( --bb-ink ); }
.bb-content__tocitem.is-active::before { content: ""; position: absolute; left: -20px; top: 4px; bottom: 4px; width: 3px; border-radius: 0 3px 3px 0; background: var( --bb-yellow ); }

@media ( min-width: 901px ) {
	.bb-content__toc.is-enhanced { top: calc( var( --bb-toc-header, 0px ) + 16px ); max-height: calc( 100vh - var( --bb-toc-header, 0px ) - 32px ); display: flex; flex-direction: column; }
	.bb-content__toc.is-enhanced ul { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; margin-left: -20px; padding-left: 20px; }
}

@media ( max-width: 900px ) {
	.bb-content__body :is( h2, h3, h4 )[id] { scroll-margin-top: calc( var( --bb-toc-header, 0px ) + 72px ); }
	.bb-content__toc.is-enhanced { position: sticky; top: var( --bb-toc-header, 0px ); z-index: 30; padding: 0; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; background: var( --bb-surface ); box-shadow: 0 2px 8px rgba( 0, 0, 0, .06 ); }
	.bb-content__toc.is-enhanced .bb-content__toclabel { display: none; }
	.bb-content__toc.is-enhanced .bb-content__tocbar { display: flex; align-items: center; gap: 6px; width: 100%; min-height: var( --bb-touch, 44px ); padding: 10px 16px; border: 0; background: transparent; color: var( --bb-ink ); font: inherit; font-size: .875rem; text-align: left; cursor: pointer; }
	.bb-content__tocbarlabel { flex: none; color: var( --bb-muted ); font-weight: 600; }
	.bb-content__tocbarcurrent { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
	.bb-content__tocbaricon { flex: none; transition: transform .2s ease; }
	.bb-content__toc.is-open .bb-content__tocbaricon { transform: rotate( 180deg ); }
	.bb-content__toc.is-enhanced ul { display: none; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 12px 36px; border-top: 1px solid var( --bb-border ); }
	.bb-content__toc.is-enhanced.is-open ul { display: grid; }
	.bb-content__toc.is-enhanced .bb-content__tocitem.is-active::before { left: -16px; }
}
@media ( prefers-reduced-motion: reduce ) {
	.bb-content__tocbaricon { transition: none; }
}

/* "The short version" TL;DR box on policy pages (Privacy, Returns & Refunds,
   General Terms & Conditions, Shipping Information): .bb-callout.bb-tldr. */
.bb-content__body .bb-tldr { margin: 0 0 32px; padding: 18px 20px 16px; border-left: 4px solid var( --bb-yellow ); }
.bb-content__body .bb-tldr > p:first-child { margin: 0 0 8px; font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase; color: var( --bb-ink ); }
.bb-content__body .bb-tldr ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.bb-content__body .bb-tldr li { line-height: 1.5; }
