/* =========================================================
   Broadband Analyst – shared template styles
   Loaded on BBA deals pages and the BBA homepage.
   ========================================================= */

/* Let our full-width hero escape GeneratePress's container on these pages only */
body.bba-template #page,
body.bba-template .site.grid-container,
body.bba-template #content,
body.bba-template .site-content {
	max-width: none !important;
	width: 100% !important;
	padding: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
body.bba-template #content,
body.bba-template .site-content {
	display: block !important;
}

.bba-wrap {
	/* Palette built around the site header navy (#0b2a45) */
	--bba-blue: #0f3557;
	--bba-mid: #1f6fb2;    /* card accents */
	--bba-navy: #0b2a45;   /* headings, table headers */
	--bba-text: #111b27;   /* body text */
	--bba-orange: #ffb400; /* buttons (amber) */
	--bba-orange-hover: #e6a200;
	--bba-grey: #eef2f6;   /* page background */
	--bba-cyan: #c0f2ff;   /* reward badges */
	--bba-line: #cfd8e3;
	--bba-panel-border: #afc2d2;
	--bba-link: #0a58a0;
	--bba-tint: #eaf2fa;
	font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
	color: var(--bba-text);
	background: var(--bba-grey);
	/* Keep overflow from third-party blocks inside the template. */
	overflow-x: clip;
	overflow-wrap: anywhere;
}
.bba-wrap *,
.bba-wrap *::before,
.bba-wrap *::after { box-sizing: border-box; }

.bba-container {
	max-width: 1240px;
	margin: 0 auto;
	padding-left: 24px;
	padding-right: 24px;
}

/* ---------- Hero ---------- */
.bba-hero {
	background-color: var(--bba-navy);
	/* Base64 keeps WP Rocket from rewriting the SVG’s internal gradient URLs. */
	background-image:
		linear-gradient(180deg, var(--bba-navy), rgba(11, 42, 69, 0) 34%),
		url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCAxMjAwIDQ0MCcgcHJlc2VydmVBc3BlY3RSYXRpbz0nbm9uZSc+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSdoJyBjeD0nLjgyJyBjeT0nLjc5Jy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wNyAwIDI4NiAxMTIgNDY4IDcwJy8+PHBhdGggc3Ryb2tlLXdpZHRoPScyLjQnIGQ9J00xMCA0MzJjMzUwIDIwIDQ5MC0yNTAgNzQyLTI1MCAyMDcgMCAyODYgMTEyIDQ2OCA3MCcvPjxwYXRoIHN0cm9rZS13aWR0aD0nMS4zJyBvcGFjaXR5PScuNzInIGQ9J00zNSA0NTRjMzMzLTQgNDc3LTI1MiA3MTctMjUyIDIwMSAwIDI4OSAxMDMgNDY4IDYyJy8+PHBhdGggc3Ryb2tlLXdpZHRoPScxLjEnIG9wYWNpdHk9Jy41NicgZD0nTTM4IDQ3M2MzMzQtMTQgNDc1LTI1MyA3MTItMjUzIDIwNSAwIDI5MyA5NCA0NzEgNTUnLz48cGF0aCBzdHJva2Utd2lkdGg9JzEuNicgb3BhY2l0eT0nLjU1JyBkPSdNMjcwIDQ3MGMyNjUtNTAgNDM4LTI1OCA2MDktMjg1IDE0NC0yMyAyMTQgMjUgMzQ1IDgnLz48L2c+PGcgZmlsbD0nbm9uZScgc3Ryb2tlPSd1cmwoI3MpJz48cGF0aCBzdHJva2Utd2lkdGg9JzYnIG9wYWNpdHk9Jy4zJyBkPSdNMTY0IDEyM2MyODQtMTA4IDQzMyAzMSA2MDUgMTYwIDE0OSAxMTEgMjg2IDE2MyA0NTcgMTMzJy8+PHBhdGggc3Ryb2tlLXdpZHRoPScxLjUnIGQ9J00xNjQgMTIzYzI4NC0xMDggNDMzIDMxIDYwNSAxNjAgMTQ5IDExMSAyODYgMTYzIDQ1NyAxMzMnLz48cGF0aCBzdHJva2Utd2lkdGg9JzEuMScgb3BhY2l0eT0nLjYyJyBkPSdNMTgwIDE0M2MyNjctOTggNDEzIDM0IDU3OSAxNTggMTQ1IDEwOSAyODUgMTU4IDQ2NSAxMjknLz48L2c+PC9zdmc+");
	background-repeat: no-repeat;
	background-position: top, right center;
	background-size: 100% 100%, max(640px, 72%) 100%;
	padding: 16px 0 22px;
}
/* Reset the site-wide Rank Math breadcrumb bar inside the hero */
.bba-hero .bba-breadcrumbs nav.rank-math-breadcrumb {
	background: none;
	border: 0;
	padding: 0;
	position: static;
	left: auto;
	width: auto;
	margin: 0 0 10px;
	font-size: 19px;
}
.bba-hero .bba-breadcrumbs nav.rank-math-breadcrumb p {
	max-width: none;
	margin: 0;
	padding: 0;
}
.bba-hero .bba-breadcrumbs,
.bba-hero .bba-breadcrumbs nav.rank-math-breadcrumb,
.bba-hero .bba-breadcrumbs nav.rank-math-breadcrumb p,
.bba-hero .bba-breadcrumbs a,
.bba-hero .bba-breadcrumbs span,
.bba-hero .bba-breadcrumbs .separator,
.bba-hero .bba-breadcrumbs .last {
	color: #d6e5f1;
	font-weight: 400;
	text-decoration: none;
}
.bba-hero .bba-breadcrumbs a:hover { text-decoration: underline; }

/* Headings use the template font, not the site-wide heading font */
.bba-wrap h1,
.bba-wrap h2,
.bba-wrap h3,
.bba-wrap h4,
.bba-wrap summary {
	font-family: inherit;
	letter-spacing: normal;
}

.bba-hero__title {
	margin: 0 0 5px;
	font-size: 44px;
	line-height: 1.15;
	font-weight: 800;
	color: #ffffff;
	max-width: 820px;
}
.bba-hero__updated {
	margin: 0 0 28px;
	font-size: 16px;
	font-weight: 400;
	color: #d6e5f1;
}

/* ---------- Postcode box ---------- */
.bba-postcode {
	background: #102f4b;
	box-shadow: inset 0 0 0 1px #49647d;
	border-radius: 14px;
	padding: 28px 30px;
	max-width: 700px;
}
.bba-postcode__label {
	display: block;
	font-size: 19px;
	font-weight: 700;
	color: #ffffff;
	margin: 0 0 16px;
}
.bba-postcode__row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
.bba-postcode__field {
	display: flex;
	flex: 1 1 320px;
	min-width: 0;
	border-radius: 10px;
	overflow: hidden;
	background: #f4f8fc;
}
.bba-postcode__pin {
	flex: none;
	width: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #c7dff1;
}
.bba-postcode__pin circle { fill: #c7dff1; }
.bba-wrap .bba-postcode__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 18px;
	padding: 18px 16px;
	color: var(--bba-navy);
	text-transform: uppercase;
}
.bba-wrap .bba-postcode__input::placeholder { text-transform: none; color: #3e586f; }
.bba-wrap .bba-postcode__input:focus { outline: 2px solid var(--bba-navy); outline-offset: -2px; }
.bba-hero .bba-postcode__note { display: none; }

/* ---------- Buttons ---------- */
.bba-wrap .bba-btn,
.bba-wrap .wp-block-button.is-style-bba-orange .wp-block-button__link {
	background: var(--bba-orange);
	color: var(--bba-navy);
	border: 0;
	border-radius: 10px;
	font: inherit;
	font-size: 17px;
	font-weight: 700;
	padding: 0 26px;
	min-height: 58px;
	cursor: pointer;
	text-decoration: none;
}
.bba-wrap .bba-btn:hover,
.bba-wrap .bba-btn:focus { background: var(--bba-orange-hover); color: var(--bba-navy); }

/* ---------- Layout ---------- */
.bba-layout {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
	align-items: flex-start;
	padding-top: 20px;
	padding-bottom: 64px;
}
.bba-main {
	flex: 999 1 560px;
	min-width: 0;
}
.bba-sidebar {
	flex: 1 1 300px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ---------- Content ---------- */
.bba-wrap :is(.bba-card, .bba-checklist, .bba-widget, .wp-block-group, .wp-block-columns, .wp-block-column),
.bba-main .entry-content > * {
	min-width: 0;
	max-width: 100%;
}
.bba-wrap :is(img, video, iframe, embed, object, svg, canvas) { max-width: 100%; }
.bba-wrap :is(img, video) { height: auto; }
.bba-wrap :is(.wp-block-table, .bba-glance, pre),
.bba-wrap .bba-card:has(> table:not(.bt-deals)) {
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
}

.bba-main .entry-content {
	display: flex;
	flex-direction: column;
	gap: 28px;
	font-size: 17px;
	line-height: 1.7;
	color: var(--bba-text);
}
.bba-main .entry-content > * { margin-top: 0; margin-bottom: 0; }
.bba-main .entry-content > p:empty { display: none; }
.bba-main a { color: var(--bba-link); }
.bba-main a:hover { color: var(--bba-navy); }
.bba-main h2 {
	margin: 0;
	font-size: 28px;
	line-height: 1.3;
	font-weight: 800;
	color: var(--bba-navy);
}
.bba-main h3 {
	margin: 0;
	font-size: 21px;
	line-height: 1.35;
	font-weight: 800;
	color: var(--bba-navy);
}

/* White section card */
.bba-card {
	background: #ffffff;
	border: 1px solid var(--bba-panel-border);
	border-radius: 14px;
	padding: 28px 28px;
}
.bba-card > * { margin-top: 0; margin-bottom: 0; }
.bba-card > * + * { margin-top: 14px; }
.bba-card ul,
.bba-card ol { padding-left: 22px; }

/* Best picks grid */
.bba-picks {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
	gap: 16px;
}
.bba-pick {
	min-width: 0;
	background: #ffffff;
	border-radius: 14px;
	padding: 26px 28px;
	border-top: 5px solid var(--bba-mid);
	font-size: 16px;
	line-height: 1.65;
}
.bba-pick > * { margin-top: 0; margin-bottom: 0; }
.bba-pick > * + * { margin-top: 10px; }
.bba-main .bba-pick__label {
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--bba-link);
}
.bba-pick__link a { font-weight: 700; }

/* At a glance table */
.bba-glance { margin: 0; }
.bba-glance table {
	width: 100%;
	border-collapse: collapse;
	font-size: 16px;
	line-height: 1.5;
}
.bba-wrap .bba-glance th,
.bba-wrap .bba-glance td {
	border: 0;
	border-bottom: 1px solid var(--bba-line);
	padding: 12px 16px;
	text-align: left;
	vertical-align: top;
}
.bba-wrap .bba-glance thead th {
	background: var(--bba-navy);
	color: #ffffff;
	font-weight: 700;
	border-bottom: 0;
}
.bba-wrap .bba-glance thead { border-bottom: 0; }
.bba-wrap .bba-glance tbody td:first-child { font-weight: 700; width: 34%; }
.bba-wrap .bba-glance tbody tr:nth-child(even) { background: #f4f7fb; }

/* Checklist box */
.bba-checklist {
	background: var(--bba-tint);
	border-radius: 10px;
	padding: 18px 22px;
}
.bba-checklist > * { margin-top: 0; margin-bottom: 0; }
.bba-checklist > * + * { margin-top: 8px; }
.bba-checklist ul { padding-left: 22px; }

/* FAQ */
.bba-faq details {
	border-bottom: 1px solid var(--bba-line);
	padding: 16px 0;
	margin: 0;
}
.bba-faq details:last-child { border-bottom: 0; }
.bba-faq summary {
	font-size: 18px;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
	display: flex;
	justify-content: space-between;
	gap: 16px;
}
.bba-faq summary::-webkit-details-marker { display: none; }
.bba-faq summary::after { content: '+'; color: var(--bba-link); font-weight: 800; }
.bba-faq details[open] summary::after { content: '\2013'; }
.bba-faq details > :not(summary) { margin: 10px 0 0; font-size: 16px; line-height: 1.65; }

/* ---------- Deals plugin (broadband-pricing-tables) – colours only ---------- */
.bba-wrap .bap-pricing { font-family: inherit; color: var(--bba-text); }
.bba-wrap .bap-pricing .bap-plan-name { color: var(--bba-navy); font-weight: 700; }
.bba-wrap .bap-pricing .bap-reward-badge {
	background: var(--bba-cyan);
	color: var(--bba-navy);
	font-weight: 700;
	border-radius: 6px;
}
.bba-wrap .bap-pricing .bap-get-deal {
	background: var(--bba-orange);
	color: var(--bba-navy);
	border-color: var(--bba-orange);
	font-weight: 700;
	border-radius: 8px;
}
.bba-wrap .bap-pricing .bap-get-deal:hover,
.bba-wrap .bap-pricing .bap-get-deal:focus { background: var(--bba-orange-hover); color: var(--bba-navy); }
.bba-wrap .bap-pricing .bap-expand { color: var(--bba-link); }

/* ---------- Sidebar ---------- */
.bba-widget {
	color: var(--bba-text);
	background: #ffffff;
	border: 1px solid var(--bba-panel-border);
	border-radius: 14px;
	padding: 22px 24px;
	font-size: 15px;
	line-height: 1.5;
}
.bba-widget__title {
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 800;
	color: var(--bba-navy);
}
.bba-widget a { color: var(--bba-link); }
.bba-widget ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bba-toc ol {
	margin: 0;
	padding: 0 6px 0 20px;
	font-size: 15px;
	line-height: 1.45;
	max-height: 300px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}
.bba-toc li { margin: 0 0 7px; }
.bba-toc li:last-child { margin-bottom: 0; }
@media (max-width: 900px) {
	.bba-toc ol { max-height: 220px; }
}

/* Featured deal box: wrap a Custom HTML widget's content in <div class="bba-featured"> */
.bba-featured {
	background: var(--bba-navy);
	color: #ffffff;
	border-radius: 14px;
	padding: 24px;
	margin: -22px -24px;
}
.bba-featured__kicker { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--bba-cyan); }
.bba-featured__name { margin: 0 0 12px; font-size: 20px; font-weight: 800; }
.bba-featured table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 0 0 16px; }
.bba-featured td { padding: 6px 0; border: 0; border-bottom: 1px solid #2a4a68; color: #ffffff; }
.bba-featured tr:last-child td { border-bottom: 0; }
.bba-featured td:last-child { text-align: right; font-weight: 700; }
.bba-featured .bba-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	font-size: 16px;
	border-radius: 8px;
}

/* ---------- Phones ---------- */
@media (max-width: 720px) {
	.bba-hero__title { font-size: 30px; }
	.bba-card { padding: 20px 14px; }
	.bba-container { padding-left: 12px; padding-right: 12px; }
	.bba-postcode { padding: 22px 18px; }
	.bba-main h2 { font-size: 24px; }
	.bba-wrap .bba-glance :is(th, td) { padding-inline: 10px; }
}

/* ---------- Related pages (auto) ---------- */
.bba-related .bba-related__group {
	margin: 16px 0 8px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--bba-navy);
}
.bba-related .bba-widget__title + .bba-related__group { margin-top: 4px; }
.bba-related ul { gap: 8px; }
.bba-related li { line-height: 1.4; }

/* Per-page featured deal box */
.bba-page-box > :first-child { margin-top: 0; }
.bba-page-box > :last-child { margin-bottom: 0; }

/* ---------- Automatic layout (unconverted pages) ---------- */
.bba-auto-hidden { display: none; }
.bba-auto-card { overflow-x: auto; }
.bba-auto-card img { max-width: 100%; height: auto; }
.bba-card .wp-block-columns { margin-bottom: 0; }

/* Pricing tables in card layout (small screens, or any screen where the table's own box is under 780px wide):
   "More details" first, "Get deal" below it; with the details open, the button moves beneath them. */
.bba-wrap .bap-pricing .bba-deal-cta { display: none; }

@media (max-width: 1024px) {
	.bba-wrap .bap-pricing .bap-col-price { display: flex; flex-direction: column; align-items: center; }
	.bba-wrap .bap-pricing .bap-col-price .bap-expand { order: 2; margin-top: 10px; }
	.bba-wrap .bap-pricing .bap-col-price .bap-get-deal { order: 3; margin-top: 12px; }
	.bba-wrap .bap-pricing .bap-plan-row:has(+ .bap-detail-row:not([hidden])) .bap-get-deal { display: none; }
	.bba-wrap .bap-pricing .bba-deal-cta { display: block; padding: 14px 14px 18px; border-top: 1px solid #c7cbd0; text-align: center; }
	.bba-wrap .bap-pricing .bba-deal-cta .bap-get-deal { margin-top: 0; }
}
@container bap (max-width: 780px) {
	.bba-wrap .bap-pricing .bap-col-price { display: flex; flex-direction: column; align-items: center; }
	.bba-wrap .bap-pricing .bap-col-price .bap-expand { order: 2; margin-top: 10px; }
	.bba-wrap .bap-pricing .bap-col-price .bap-get-deal { order: 3; margin-top: 12px; }
	.bba-wrap .bap-pricing .bap-plan-row:has(+ .bap-detail-row:not([hidden])) .bap-get-deal { display: none; }
	.bba-wrap .bap-pricing .bba-deal-cta { display: block; padding: 14px 14px 18px; border-top: 1px solid #c7cbd0; text-align: center; }
	.bba-wrap .bap-pricing .bba-deal-cta .bap-get-deal { margin-top: 0; }
}

/* Page-scope wrapper kept by the auto layout (a styled div holding the whole article) */
.bba-main .entry-content .bba-auto-wrap {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

/* Wider room for tables: remove the extra boxes (background and padding) that old pages put around a pricing or deals table.
   The pricing plugin shows its full-width row layout when its own box is 780px or wider. */
.bba-card > [class*="gb-element-"]:has(> .bap-pricing),
.bba-card > [class*="gb-element-"]:has(> table),
.bba-card > .wp-block-group:has(> .bap-pricing),
.bba-card > .wp-block-group:has(> .wp-block-group__inner-container > .bap-pricing),
.bba-card > div:has(> .bap-pricing) {
	background: none;
	padding: 0;
	margin-left: 0;
	margin-right: 0;
	border: 0;
	box-shadow: none;
}
.bba-card .bap-pricing { width: 100%; min-width: 0; max-width: 100%; }

/* Pick cards inside a white section card: light blue so they stand out */
.bba-card .bba-pick {
	background: var(--bba-tint);
	padding: 20px 22px;
}
.bba-card .bba-pick h3 { font-size: 20px; margin: 0; }
.bba-card .bba-pick h4 { font-size: 16px; margin: 14px 0 0; color: var(--bba-navy); }
.bba-card .bba-pick h4 + p { margin-top: 2px; }
.bba-card .bba-checklist h3 { font-size: 20px; margin: 0 0 6px; }

/* Buttons placed inside a section card */
.bba-card .wp-block-button__link {
	background: var(--bba-orange);
	color: var(--bba-navy);
	font-weight: 700;
	border-radius: 8px;
	padding: 12px 24px;
	text-decoration: none;
}
.bba-card .wp-block-button__link:hover,
.bba-card .wp-block-button__link:focus { background: var(--bba-orange-hover); color: var(--bba-navy); }
