/*
 * Bob Gunn Knowledge Base. Scoped to .bgkb so no shared theme component changes.
 * Tokens are the incumbent Enfold colour sets (avia_options_enfold_child), not new colours:
 *   heading #222222 (main heading), body #333333 (body colour), muted #666666 (main text),
 *   line #e1e1e1 (main border), surface #f8f8f8 (header bg2), accent #a81010 (alternate primary),
 *   brand #eb282e (main primary), dark #222222 (footer bg).
 * The brand red #eb282e is only 4.0:1 on white, so it is used for rules and borders, never for text;
 * text links and buttons use the alternate primary #a81010 (7.6:1 with white).
 */
.bgkb {
	--bgkb-heading: #222222;
	--bgkb-text: #333333;
	--bgkb-muted: #666666;
	--bgkb-line: #e1e1e1;
	--bgkb-surface: #f8f8f8;
	--bgkb-accent: #a81010;
	--bgkb-brand: #eb282e;
	--bgkb-dark: #222222;
	--bgkb-on-dark: #ffffff;
	--bgkb-on-dark-muted: #dddddd;
	--bgkb-radius: 3px;
	--bgkb-measure: 68ch;
	--bgkb-sticky-top: 24px;
	color: var(--bgkb-text);
	font-size: 1rem;
	line-height: 1.65;
}

.admin-bar .bgkb { --bgkb-sticky-top: 56px; }
.bgkb-wrap { padding: 24px 0 56px; }
.bgkb-container { max-width: 1210px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
.container.bgkb-container { padding-left: 16px; padding-right: 16px; }

.bgkb *, .bgkb *::before, .bgkb *::after { box-sizing: border-box; }
.bgkb h1, .bgkb h2, .bgkb h3 { color: var(--bgkb-heading); }
.bgkb a { color: var(--bgkb-accent); text-underline-offset: 2px; }
.bgkb a:focus-visible, .bgkb summary:focus-visible, .bgkb .bgkb-table:focus-visible {
	outline: 3px solid var(--bgkb-accent);
	outline-offset: 2px;
}

/* Breadcrumb */
.bgkb-crumbs ol { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 0.875rem; color: var(--bgkb-muted); }
.bgkb-crumbs li { margin: 0; }
.bgkb-crumbs li + li::before { content: "/"; margin: 0 8px; color: var(--bgkb-muted); }
.bgkb-crumbs a { color: var(--bgkb-muted); }
.bgkb-crumbs [aria-current] { color: var(--bgkb-text); }

.bgkb-notice { border: 1px solid var(--bgkb-brand); border-radius: var(--bgkb-radius); background: var(--bgkb-surface); padding: 12px 16px; margin: 0 0 20px; font-size: 0.9375rem; }

/* Article header */
.bgkb-article__title { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.2; margin: 0 0 12px; max-width: 24ch; }
.bgkb-article__meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 28px; font-size: 0.875rem; color: var(--bgkb-muted); }

/* Layout: body column, sticky contents rail from 1024px */
.bgkb-article__layout { display: block; }
.bgkb-article__body { min-width: 0; max-width: var(--bgkb-measure); }

@media (min-width: 1024px) {
	.bgkb-article__layout { display: grid; grid-template-columns: minmax(0, var(--bgkb-measure)) 260px; gap: 56px; align-items: start; }
	.bgkb-toc { order: 2; position: sticky; top: var(--bgkb-sticky-top); max-height: calc(100vh - 48px); overflow: auto; }
	.bgkb-article__body { order: 1; }
}

/* Contents */
.bgkb-toc { margin: 0 0 28px; border: 1px solid var(--bgkb-line); border-radius: var(--bgkb-radius); background: var(--bgkb-surface); }
.bgkb-toc__title { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--bgkb-heading); min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.bgkb-toc__title::-webkit-details-marker { display: none; }
/* Drawn chevron: points down when closed, up when open. */
.bgkb-toc__title::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--bgkb-accent); border-bottom: 2px solid var(--bgkb-accent); transform: rotate(45deg) translateY(-2px); transition: transform 150ms ease-out; flex: none; }
.bgkb-toc__details[open] > .bgkb-toc__title::after { transform: rotate(-135deg) translateY(-2px); }
.bgkb-toc__list { margin: 0; padding: 0 16px 14px 34px; font-size: 0.9375rem; line-height: 1.45; list-style: decimal; }
.bgkb-toc__list li { margin: 0 0 8px; }
.bgkb-toc__list a { color: var(--bgkb-text); text-decoration: none; display: block; padding: 2px 0; }
.bgkb-toc__list a:hover, .bgkb-toc__list a[aria-current="true"] { color: var(--bgkb-accent); text-decoration: underline; }
.bgkb-toc__list a[aria-current="true"] { font-weight: 700; }

/* Prose */
.bgkb-prose { font-size: 1.0625rem; }
.bgkb-prose h2 { font-size: 1.5rem; line-height: 1.3; margin: 2.2em 0 0.6em; scroll-margin-top: 96px; }
.bgkb-prose h2:first-child { margin-top: 0; }
.bgkb-prose h3 { font-size: 1.1875rem; line-height: 1.35; margin: 1.8em 0 0.5em; }
.bgkb-prose p, .bgkb-prose ul, .bgkb-prose ol { margin: 0 0 1.1em; }
.bgkb-prose li { margin-bottom: 0.4em; }

/* Tables scroll inside their own region, never the page */
.bgkb-table { overflow-x: auto; margin: 0 0 1.6em; border: 1px solid var(--bgkb-line); border-radius: var(--bgkb-radius);
	background: linear-gradient(to right, #ffffff 30%, rgba(255, 255, 255, 0)) left / 24px 100% no-repeat local,
		linear-gradient(to left, #ffffff 30%, rgba(255, 255, 255, 0)) right / 24px 100% no-repeat local,
		linear-gradient(to right, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) left / 10px 100% no-repeat scroll,
		linear-gradient(to left, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) right / 10px 100% no-repeat scroll; }
.bgkb-table table { width: 100%; min-width: 560px; border-collapse: collapse; margin: 0; font-size: 0.9375rem; line-height: 1.5; background: transparent; }
.bgkb-table caption { text-align: left; font-weight: 700; padding: 12px 14px 4px; color: var(--bgkb-heading); }
.bgkb-table th, .bgkb-table td { text-align: left; vertical-align: top; padding: 10px 14px; border-top: 1px solid var(--bgkb-line); }
.bgkb-table thead th { background: var(--bgkb-surface); color: var(--bgkb-heading); }

/* CTA card: the one bold element on the article */
.bgkb-cta { display: grid; gap: 16px; margin: 2em 0; padding: 20px; border: 1px solid var(--bgkb-line); border-top: 3px solid var(--bgkb-brand); border-radius: var(--bgkb-radius); background: #ffffff; }
.bgkb-cta__heading { font-size: 1.375rem; line-height: 1.25; margin: 0 0 6px; font-weight: 700; color: var(--bgkb-heading); }
.bgkb-cta--mid .bgkb-cta__heading { font-size: 1.125rem; }
.bgkb-cta__lead { margin: 0 0 8px; }
.bgkb-cta__price { margin: 0 0 8px; font-size: 1.25rem; font-weight: 700; color: var(--bgkb-heading); }
.bgkb-cta__price-label { font-size: 0.875rem; font-weight: 400; color: var(--bgkb-muted); }
.bgkb-cta__notes { margin: 0; padding-left: 18px; font-size: 0.875rem; color: var(--bgkb-muted); }
.bgkb-cta__notes li { margin: 0 0 2px; }
.bgkb-cta__action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.bgkb .bgkb-cta__button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 22px; border-radius: var(--bgkb-radius); background: var(--bgkb-accent); color: #ffffff; font-weight: 700; text-decoration: none; line-height: 1.2; text-align: center; transition: transform 120ms ease-out, opacity 120ms ease-out; }
.bgkb .bgkb-cta__button:hover { opacity: 0.92; color: #ffffff; }
.bgkb .bgkb-cta__button:active { transform: translateY(1px); }
.bgkb-cta__secondary, .bgkb-cta__fine { margin: 0; font-size: 0.875rem; }
.bgkb-cta__secondary a { display: inline-block; padding: 8px 0; }
.bgkb-cta__fine { color: var(--bgkb-muted); }
.bgkb-cta--mid { background: var(--bgkb-surface); padding: 16px 18px; }
@media (min-width: 640px) {
	.bgkb-cta { grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); align-items: center; gap: 24px; padding: 24px 28px; }
	.bgkb-cta__action { align-items: stretch; min-width: 220px; }
	/* The mid card sits inside the 68ch column: stack it so the text keeps a readable width. */
	.bgkb-cta--mid, .bgkb-article .bgkb-cta { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	.bgkb-cta--mid .bgkb-cta__action, .bgkb-article .bgkb-cta__action { align-items: flex-start; min-width: 0; }
}

/* FAQ */
.bgkb-faq { margin: 2.5em 0 0; }
.bgkb-faq h2, .bgkb-sources h2, .bgkb-related h2 { font-size: 1.5rem; margin: 0 0 14px; }
.bgkb-faq__item { border-top: 1px solid var(--bgkb-line); }
.bgkb-faq__item:last-child { border-bottom: 1px solid var(--bgkb-line); }
.bgkb-faq__item summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; padding: 12px 0; }
.bgkb-faq__item summary::-webkit-details-marker { display: none; }
/* Drawn plus: two 2px bars; the vertical bar folds away when open to leave a minus. */
.bgkb-faq__item summary::before, .bgkb-faq__item summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 14px; height: 2px; background: var(--bgkb-accent); transition: transform 150ms ease-out; }
.bgkb-faq__item summary::after { transform: rotate(90deg); }
.bgkb-faq__item[open] summary::after { transform: rotate(0deg); }
.bgkb-faq__item summary { position: relative; padding-right: 32px; }
.bgkb-faq__q { font-size: 1.0625rem; margin: 0; line-height: 1.4; font-weight: 700; }
.bgkb-faq__a p { margin: 0 0 16px; }

/* Sources: visible, dated */
.bgkb-sources { margin: 2.5em 0 0; font-size: 0.9375rem; line-height: 1.5; }
.bgkb-sources ol { padding-left: 22px; margin: 0; }
.bgkb-sources li { margin: 0 0 10px; overflow-wrap: anywhere; }
.bgkb-sources__pub, .bgkb-sources__date { color: var(--bgkb-muted); }

/* Cards: archive and related */
.bgkb-related { margin: 2.5em 0 0; }
.bgkb-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
/* Archive: a ruled list per topic (question, excerpt, meta), denser to scan than a card grid. */
.bgkb-archive .bgkb-cards { gap: 0; }
/* One right edge on the archive: list, group rules and booking band share 880px. */
.bgkb-archive .bgkb-group, .bgkb-archive .bgkb-band { max-width: 880px; }
.bgkb-archive .bgkb-card__link { border: 0; border-bottom: 1px solid var(--bgkb-line); border-radius: 0; padding: 16px 0; }
.bgkb-archive .bgkb-group__title { border-bottom: 3px solid var(--bgkb-brand); }
.bgkb-card { margin: 0; }
.bgkb-card__link { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 18px 20px; border: 1px solid var(--bgkb-line); border-top: 3px solid var(--bgkb-brand); border-radius: var(--bgkb-radius); background: #ffffff; text-decoration: none; color: var(--bgkb-text); }
.bgkb .bgkb-card__link:hover .bgkb-card__title { color: var(--bgkb-accent); text-decoration: underline; }
.bgkb-card__title { font-size: 1.125rem; line-height: 1.35; margin: 0; }
.bgkb-card__excerpt { font-size: 0.9375rem; line-height: 1.5; }
.bgkb-card__meta { margin-top: auto; font-size: 0.8125rem; color: var(--bgkb-muted); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.bgkb-card__status { padding: 1px 8px; border: 1px solid var(--bgkb-muted); border-radius: 99px; color: var(--bgkb-text); }

/* Archive */
.bgkb-archive__header { max-width: var(--bgkb-measure); margin: 0 0 32px; }
.bgkb-archive__header h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.2; margin: 0 0 12px; }
.bgkb-archive__lead { font-size: 1.125rem; margin: 0; }
.bgkb-group { margin: 0 0 40px; }
.bgkb-group__title { font-size: 1.375rem; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--bgkb-line); }
.bgkb-empty { padding: 20px; background: var(--bgkb-surface); border-radius: var(--bgkb-radius); margin: 0 0 32px; }

/* Booking band */
.bgkb-band { margin: 48px 0 0; background: var(--bgkb-dark); color: var(--bgkb-on-dark-muted); border-top: 4px solid var(--bgkb-brand); border-radius: var(--bgkb-radius); }
.bgkb-band__inner { padding: 28px 20px; }
.bgkb .bgkb-band__title { color: var(--bgkb-on-dark); font-size: 1.5rem; margin: 0 0 6px; }
.bgkb-band__lead { margin: 0 0 18px; }
.bgkb-band__list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
@media (min-width: 720px) { .bgkb-band__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } .bgkb-band__inner { padding: 36px 40px; } }
.bgkb-band__item { margin: 0; }
.bgkb .bgkb-band__item a { display: flex; flex-direction: column; gap: 4px; min-height: 48px; height: 100%; padding: 14px 16px; background: #ffffff; color: var(--bgkb-heading); border-radius: var(--bgkb-radius); text-decoration: none; }
.bgkb .bgkb-band__item a:hover .bgkb-band__name { color: var(--bgkb-accent); text-decoration: underline; }
.bgkb-band__name { font-weight: 700; line-height: 1.3; }
.bgkb-band__price { font-size: 0.9375rem; color: var(--bgkb-muted); }
.bgkb-band__fine { font-size: 0.875rem; margin: 0 0 12px; }
.bgkb-band__other { margin: 0; }
.bgkb .bgkb-band__other a { color: var(--bgkb-on-dark); font-weight: 700; display: inline-block; padding: 10px 0; }
.bgkb .bgkb-band :focus-visible { outline-color: var(--bgkb-on-dark); }

/* Existing blog posts: end card sits inside the theme's post content */
.bgkb-post-end { margin-top: 2em; }

/*
 * Link colours against the theme. Enfold's ".main_color a" (and equivalents in other themes) loads
 * after this file with equal specificity and paints every link in the brand red, which fails AA on
 * white. The doubled class lifts these rules above it without !important.
 */
.bgkb.bgkb a { color: var(--bgkb-accent); }
.bgkb.bgkb .bgkb-crumbs a { color: var(--bgkb-muted); }
.bgkb.bgkb .bgkb-toc__list a { color: var(--bgkb-text); }
.bgkb.bgkb .bgkb-toc__list a:hover, .bgkb.bgkb .bgkb-toc__list a[aria-current="true"] { color: var(--bgkb-accent); }
.bgkb.bgkb .bgkb-card__link { color: var(--bgkb-text); }
.bgkb.bgkb .bgkb-cta__button, .bgkb.bgkb .bgkb-cta__button:hover { color: #ffffff; }
.bgkb.bgkb .bgkb-band__item a { color: var(--bgkb-heading); }
.bgkb.bgkb .bgkb-band__other a { color: var(--bgkb-on-dark); }
/* Emphasis: Enfold paints strong/b in the brand red (4.0:1), which also reads as a link. */
.bgkb.bgkb .bgkb-prose strong, .bgkb.bgkb .bgkb-prose b { color: var(--bgkb-heading); }
/* Borders: Enfold's .main_color border-color would grey out the brand rules. */
.bgkb.bgkb .bgkb-cta, .bgkb.bgkb .bgkb-band { border-color: var(--bgkb-line); border-top-color: var(--bgkb-brand); }
.bgkb.bgkb .bgkb-card__link { border-color: var(--bgkb-line); border-top-color: var(--bgkb-brand); }
.bgkb.bgkb.bgkb-archive .bgkb-card__link { border-top-color: transparent; }
.bgkb.bgkb.bgkb-archive .bgkb-group__title { border-bottom-color: var(--bgkb-brand); }
.bgkb.bgkb .bgkb-notice { border-color: var(--bgkb-brand); }
/* Tables: undo Enfold's zebra fade, uppercase headers and smaller cells. */
.bgkb.bgkb .bgkb-table th, .bgkb.bgkb .bgkb-table td { color: var(--bgkb-text); font-size: 0.9375rem; background-color: transparent; border-color: var(--bgkb-line); }
.bgkb.bgkb .bgkb-table thead th { text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--bgkb-heading); background: var(--bgkb-surface); }
/* Lists: Enfold resets list markers inside content areas. */
.bgkb.bgkb .bgkb-prose ul { list-style: disc; padding-left: 1.4em; margin-left: 0; }
.bgkb.bgkb .bgkb-prose ol { list-style: decimal; padding-left: 1.6em; margin-left: 0; }
.bgkb.bgkb .bgkb-prose li { display: list-item; }
.bgkb.bgkb .bgkb-cta__notes { list-style: disc; padding-left: 18px; }
.bgkb.bgkb .bgkb-cta__notes li { display: list-item; }

@media (prefers-reduced-motion: reduce) {
	.bgkb *, .bgkb *::before, .bgkb *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
	.bgkb-toc, .bgkb-cta, .bgkb-band, .bgkb-related, .bgkb-crumbs, .bgkb-notice { display: none !important; }
	.bgkb-article__layout { display: block; }
	.bgkb-faq__item { break-inside: avoid; }
	.bgkb-faq__item .bgkb-faq__a { display: block; }
	.bgkb-sources a::after { content: " (" attr(href) ")"; font-size: 0.8125rem; }
	.bgkb-table, .bgkb-table table { overflow: visible; break-inside: avoid; }
}

/* Page builders (Breakdance's ".breakdance h2" etc.) size h1 to h3 globally; keep the plugin's own scale. */
.bgkb.bgkb .bgkb-article__title, .bgkb.bgkb .bgkb-archive__header h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.2; }
.bgkb.bgkb .bgkb-cta__heading { font-size: 1.375rem; line-height: 1.25; }
.bgkb.bgkb .bgkb-cta--mid .bgkb-cta__heading { font-size: 1.125rem; }
.bgkb.bgkb .bgkb-faq h2, .bgkb.bgkb .bgkb-sources h2, .bgkb.bgkb .bgkb-related h2, .bgkb.bgkb .bgkb-band__title { font-size: 1.5rem; line-height: 1.25; }
.bgkb.bgkb .bgkb-faq__q { font-size: 1.0625rem; line-height: 1.4; }
.bgkb.bgkb .bgkb-card__title { font-size: 1.125rem; line-height: 1.35; }
.bgkb.bgkb .bgkb-group__title { font-size: 1.375rem; line-height: 1.3; }

/* Centre the knowledge base inside wide page containers (themes without their own content width). */
.bgkb-archive { max-width: 880px; margin-left: auto; margin-right: auto; }
@media (min-width: 1024px) {
	.bgkb-article { max-width: calc(var(--bgkb-measure) + 56px + 260px); margin-left: auto; margin-right: auto; }
}
