/*
Theme Name:        The Buy Brief
Description:       Output-only theme for The Buy Brief. All data and logic live in the buybrief-core plugin.
Version:           0.2.9
Requires at least: 6.5
Requires PHP:      8.2
Author:            The Buy Brief
Text Domain:       buybrief
*/

/* ==========================================================================
   Editorial Layout & Responsive Sidebar
   ========================================================================== */

.bb-layout--sidebar {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2.25rem;
	align-items: start;
}

@media (min-width: 64rem) {
	.bb-layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 21.5rem;
		gap: 2.75rem;
	}
	.bb-layout--sidebar > aside.bb-sidebar,
	.bb-layout--sidebar > .bb-sidebar,
	.bb-layout--sidebar > .bb-sidebar-wrapper {
		position: sticky;
		top: 5.5rem;
	}
}

/* Ensure main content fills the editorial column */
.bb-layout--sidebar .bb-content > *,
.bb-layout--sidebar .bb-main-content > * {
	max-width: 100% !important;
}

/* ==========================================================================
   Researched-by Byline Alignment & Wrap Protection
   ========================================================================== */

.bb-hubhead .bb-researched,
.bb-researched {
	max-width: 100% !important;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.65rem;
	margin: 0.85rem 0 0.75rem 0;
	font-size: 0.875rem;
	color: #475569;
	line-height: 1.5;
}

.bb-researched__item {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
}

.bb-researched__item:not(:last-child)::after {
	content: "·";
	margin-left: 0.65rem;
	color: #94a3b8;
	font-weight: bold;
}

.bb-researched__badge {
	font-weight: 750;
	color: #0f172a;
	background: #d4ff33;
	padding: 0.2rem 0.55rem;
	border-radius: 4px;
	letter-spacing: -0.01em;
	display: inline-block;
}

.bb-researched__text a {
	color: inherit;
	text-decoration: underline;
}

/* ==========================================================================
   Article Body Typography & Justified / Readable Flow
   ========================================================================== */

.bb-content,
.bb-article-body,
.bb-prose {
	font-family: var(--bb-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	color: #1e293b;
	font-size: 1.0625rem;
	line-height: 1.75;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.bb-content p,
.bb-article-body p,
.bb-prose p {
	margin-top: 0;
	margin-bottom: 1.35rem;
	text-align: justify;
	text-justify: inter-word;
	hyphens: auto;
	letter-spacing: -0.01em;
}

.bb-content .lead,
.bb-content .bb-lead-paragraph,
.bb-article-body .bb-lead-paragraph {
	font-size: 1.1875rem;
	line-height: 1.8;
	color: #0f172a;
	font-weight: 450;
	margin-bottom: 1.5rem;
	text-align: justify;
	text-justify: inter-word;
}

.bb-content h2,
.bb-article-body h2,
.bb-prose h2 {
	font-size: 1.625rem;
	line-height: 1.3;
	font-weight: 750;
	color: #0f172a;
	margin-top: 2.5rem;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid #f1f5f9;
	text-align: left;
}

.bb-content h3,
.bb-article-body h3,
.bb-prose h3 {
	font-size: 1.25rem;
	line-height: 1.35;
	font-weight: 650;
	color: #1e293b;
	margin-top: 1.85rem;
	margin-bottom: 0.75rem;
	text-align: left;
}

.bb-content ul,
.bb-content ol,
.bb-article-body ul,
.bb-article-body ol,
.bb-prose ul,
.bb-prose ol {
	padding-left: 1.5rem;
	margin-top: 0;
	margin-bottom: 1.35rem;
	text-align: left;
}

.bb-content li,
.bb-article-body li,
.bb-prose li {
	margin-bottom: 0.5rem;
	line-height: 1.7;
	text-align: left;
}

/* Responsive Editorial Tables */
.bb-content table,
.bb-article-body table,
.bb-comparison-table {
	width: 100% !important;
	border-collapse: collapse;
	margin: 2rem 0;
	font-size: 0.9375rem;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.bb-content table th,
.bb-article-body table th {
	background: #0f172a;
	color: #ffffff;
	font-weight: 600;
	padding: 12px 16px;
	text-align: left;
	border: 1px solid #334155;
}

.bb-content table td,
.bb-article-body table td {
	padding: 12px 16px;
	border: 1px solid #e2e8f0;
	vertical-align: top;
	line-height: 1.55;
}

.bb-content table tr:nth-child(even),
.bb-article-body table tr:nth-child(even) {
	background: #f8fafc;
}

/* Callout Boxes */
.bb-callout,
.bb-key-takeaways {
	background: #f8fafc;
	border-left: 4px solid #3b82f6 !important;
	padding: 1.35rem 1.6rem !important;
	margin: 2rem 0 !important;
	border-radius: 0 10px 10px 0 !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.bb-callout p,
.bb-key-takeaways p {
	text-align: justify;
	text-justify: inter-word;
	margin-bottom: 0.75rem;
}

.bb-callout p:last-child,
.bb-key-takeaways p:last-child {
	margin-bottom: 0;
}

.bb-callout h3,
.bb-key-takeaways h3 {
	margin-top: 0 !important;
	margin-bottom: 0.85rem !important;
	font-size: 1.15rem !important;
	color: #0f172a !important;
	font-weight: 700;
	text-align: left;
}

.bb-callout ul,
.bb-callout ol,
.bb-key-takeaways ul,
.bb-key-takeaways ol {
	padding-left: 1.5rem;
	margin: 0.5rem 0;
	text-align: left;
}

.bb-callout li,
.bb-key-takeaways li {
	margin-bottom: 0.4rem;
	line-height: 1.6;
	text-align: left;
}

/* ==========================================================================
   Sidebar: Suggested in Category & Interactive Widgets
   ========================================================================== */

.bb-sidebar-wrapper {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.bb-sidebar-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 1.35rem;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
	transition: box-shadow 0.2s ease;
}

.bb-sidebar-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.bb-sidebar-eyebrow {
	display: inline-block;
	text-transform: uppercase;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: #64748b;
	margin-bottom: 0.35rem;
}

.bb-sidebar-title {
	font-size: 1.15rem;
	font-weight: 750;
	color: #0f172a;
	margin: 0 0 0.5rem 0;
	line-height: 1.3;
}

.bb-sidebar-heading {
	display: flex;
	align-items: center;
	font-size: 1rem;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 1rem 0;
	padding-bottom: 0.6rem;
	border-bottom: 1.5px solid #f1f5f9;
}

.bb-sidebar-desc {
	font-size: 0.875rem;
	color: #475569;
	line-height: 1.55;
	margin: 0 0 1rem 0;
}

.bb-sidebar-link-btn {
	display: inline-flex;
	align-items: center;
	font-size: 0.875rem;
	font-weight: 650;
	color: #2563eb;
	text-decoration: none;
	transition: color 0.15s ease;
}

.bb-sidebar-link-btn:hover {
	color: #1d4ed8;
	text-decoration: underline;
}

/* Related Items List */
.bb-sidebar-related-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.bb-sidebar-related-item {
	padding-bottom: 0.85rem;
	border-bottom: 1px solid #f1f5f9;
}

.bb-sidebar-related-item:last-child {
	padding-bottom: 0;
	border-bottom: none;
}

.bb-sidebar-item-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.35rem;
}

.bb-sidebar-badge {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 2px 7px;
	border-radius: 4px;
}

.badge-comparison {
	background: #eff6ff;
	color: #2563eb;
	border: 1px solid #bfdbfe;
}

.badge-guide {
	background: #f0fdf4;
	color: #16a34a;
	border: 1px solid #bbf7d0;
}

.badge-review {
	background: #fffbeb;
	color: #d97706;
	border: 1px solid #fde68a;
}

.badge-research {
	background: #fdf2f8;
	color: #db2777;
	border: 1px solid #fbcfe8;
}

.badge-best {
	background: #fefce8;
	color: #ca8a04;
	border: 1px solid #fef08a;
}

.badge-tool {
	background: #faf5ff;
	color: #9333ea;
	border: 1px solid #e9d5ff;
}

.bb-sidebar-date {
	font-size: 0.75rem;
	color: #94a3b8;
}

.bb-sidebar-item-title {
	display: block;
	font-size: 0.9125rem;
	font-weight: 600;
	line-height: 1.45;
	color: #1e293b;
	text-decoration: none;
	transition: color 0.15s ease;
}

.bb-sidebar-item-title:hover {
	color: #2563eb;
}

/* Interactive Tool Card */
.bb-sidebar-card--tool {
	background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
	color: #ffffff;
	border: 1px solid #334155;
}

.bb-sidebar-tool-title {
	font-size: 1.05rem;
	font-weight: 750;
	color: #ffffff;
	margin: 0.65rem 0 0.4rem 0;
}

.bb-sidebar-tool-desc {
	font-size: 0.85rem;
	color: #cbd5e1;
	line-height: 1.5;
	margin-bottom: 1rem;
}

.bb-sidebar-tool-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 9px 16px;
	background: #3b82f6;
	color: #ffffff;
	font-size: 0.875rem;
	font-weight: 650;
	text-decoration: none;
	border-radius: 6px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	transition: background 0.15s ease, transform 0.15s ease;
}

.bb-sidebar-tool-btn:hover {
	background: #2563eb;
	color: #ffffff;
	transform: translateY(-1px);
}

/* Editorial Trust Card */
.bb-sidebar-card--trust {
	background: #f8fafc;
	border: 1px dashed #cbd5e1;
}

.bb-sidebar-trust-title {
	font-size: 0.95rem;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 0.5rem 0;
	display: flex;
	align-items: center;
}

.bb-sidebar-trust-desc {
	font-size: 0.8125rem;
	color: #64748b;
	line-height: 1.55;
	margin-bottom: 0.75rem;
}

.bb-sidebar-trust-link {
	font-size: 0.8125rem;
	font-weight: 650;
	color: #0f172a;
	text-decoration: none;
}

.bb-sidebar-trust-link:hover {
	text-decoration: underline;
}

/* ==========================================================================
   Widescreen UI Responsive Optimization
   ========================================================================== */

/* Expand main container on wide viewports (1280px, 1440px, 1680px+) */
@media (min-width: 80rem) { /* 1280px */
	:root {
		--bb-container: 82rem; /* 1312px */
	}
	.bb-layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 22rem;
		gap: 3rem;
	}
}

@media (min-width: 90rem) { /* 1440px */
	:root {
		--bb-container: 88rem; /* 1408px */
	}
	.bb-layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 23.5rem;
		gap: 3.5rem;
	}
}

@media (min-width: 105rem) { /* 1680px */
	:root {
		--bb-container: 94rem; /* 1504px */
	}
	.bb-layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 25rem;
		gap: 4rem;
	}
}

/* Ensure wide-screen article content, calculators and tables scale proportionally */
.bb-layout--sidebar .bb-content > *,
.bb-layout--sidebar .bb-main-content > *,
.bb-layout--sidebar .bb-prose > * {
	max-width: 100% !important;
}

/* Full width table wrappers for seamless wide view */
.bb-table-wrap {
	width: 100% !important;
	overflow-x: auto;
	margin: 2rem 0;
	border-radius: 10px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* Calculators inside editorial columns */
.bb-main-content .bb-calculator {
	width: 100%;
}

