/* BIL Core — uses the Best Info Lab tokens. No shadows; cards are separated by rules and space. */
:root {
	--bil-ink: #12263A;
	--bil-teal: #0E7C86;
	--bil-mist: #EEF3F7;
	--bil-muted: #4A5D70;
	--bil-amber: #F2A93B;
	--bil-line: #D6E0E8;
	--bil-head: "Bricolage Grotesque", system-ui, sans-serif;
}

/* Post grids: [bil_posts] */
.bil-grid { display: grid; gap: 24px; width: 100%; text-align: left; }
.bil-cols-1 { grid-template-columns: 1fr; }
.bil-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bil-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bil-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) { .bil-cols-3, .bil-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .bil-grid { grid-template-columns: 1fr; } }

.bil-card { display: flex; flex-direction: column; background: #fff; border-top: 3px solid var(--bil-teal); }
.bil-layout-card .bil-card { border: 1px solid var(--bil-line); border-top: 3px solid var(--bil-teal); }
.bil-card-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.bil-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.bil-card-cat { font-size: 13px; font-weight: 600; color: var(--bil-teal); }
.bil-card-title { margin: 0; font-family: var(--bil-head); font-size: 19px; line-height: 1.25; }
.bil-card-title a { color: var(--bil-ink); text-decoration: none; }
.bil-card-title a:hover, .bil-card-title a:focus { color: var(--bil-teal); text-decoration: underline; }
.bil-card-excerpt { margin: 0; color: var(--bil-muted); font-size: 15px; line-height: 1.55; }
.bil-card-date { margin: auto 0 0; color: var(--bil-muted); font-size: 13px; }
.bil-layout-list { gap: 0; }
.bil-layout-list .bil-card { border-top: 0; border-bottom: 1px solid var(--bil-line); background: transparent; }
.bil-layout-list .bil-card-body { padding: 16px 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.bil-layout-list .bil-card-title { flex: 1 1 60%; font-size: 18px; }
.bil-layout-list .bil-card-date { margin: 0; }
/* Optional heading rendered by [bil_posts heading="..."] */
.bil-posts-heading { margin: 8px 0 6px; width: 100%; font-family: var(--bil-head); font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--bil-ink); text-align: left; }
.bil-posts-intro { margin: 0 0 18px; width: 100%; color: var(--bil-muted); text-align: left; }
/* Deals section uses amber accents */
.bil-deals .bil-card { border-top-color: var(--bil-amber); }

.bil-pager { display: flex; gap: 18px; justify-content: center; align-items: center; margin-top: 28px; color: var(--bil-muted); }
.bil-pager a { color: var(--bil-teal); font-weight: 600; }

/* Disclosure, review meta, updated */
.bil-disclosure { margin: 0; padding: 12px 16px; background: var(--bil-mist); border-left: 4px solid var(--bil-amber); color: var(--bil-muted); font-size: 14px; line-height: 1.5; }
.bil-disclosure a { color: var(--bil-ink); }
.bil-review-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 12px 0; border-top: 1px solid var(--bil-line); border-bottom: 1px solid var(--bil-line); color: var(--bil-muted); font-size: 14px; }
.bil-review-meta strong { color: var(--bil-ink); font-weight: 600; }
.bil-review-meta a { color: var(--bil-teal); }
.bil-updated { color: var(--bil-muted); font-size: 14px; }

/* Author box */
.bil-author-box { display: flex; gap: 18px; align-items: flex-start; padding: 22px; background: var(--bil-mist); border-top: 4px solid var(--bil-teal); }
.bil-author-avatar { border-radius: 50%; flex: 0 0 auto; }
.bil-author-name { margin: 0 0 6px; font-family: var(--bil-head); font-weight: 700; font-size: 20px; color: var(--bil-ink); }
.bil-author-bio { margin: 0 0 8px; color: var(--bil-muted); line-height: 1.6; }
.bil-author-links { margin: 0; font-size: 14px; }
.bil-author-links a { color: var(--bil-teal); font-weight: 600; }
@media (max-width: 640px) { .bil-author-box { flex-direction: column; } }

/* Related cluster links and hub nav */
.bil-related { padding: 20px 22px; border: 1px solid var(--bil-line); }
.bil-related-title { margin: 0 0 10px; font-family: var(--bil-head); font-weight: 700; font-size: 20px; color: var(--bil-ink); }
.bil-related ul { margin: 0; padding: 0; list-style: none; }
.bil-related li { padding: 8px 0; border-bottom: 1px solid var(--bil-line); }
.bil-related li:last-child { border-bottom: 0; }
.bil-related-type { display: inline-block; min-width: 120px; color: var(--bil-muted); font-size: 13px; }
.bil-related a { color: var(--bil-ink); font-weight: 600; }
.bil-hub-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.bil-hub-nav a { padding: 8px 14px; border: 1px solid var(--bil-teal); border-radius: 999px; color: var(--bil-teal); font-size: 15px; font-weight: 600; text-decoration: none; }
.bil-hub-nav a:hover, .bil-hub-nav a:focus { background: var(--bil-teal); color: #fff; }

/* Tables used inside text-editor widgets */
.bil-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bil-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; text-align: left; }
.bil-table th, .bil-table td { padding: 12px 14px; border-bottom: 1px solid var(--bil-line); vertical-align: top; }
.bil-table thead th { background: var(--bil-ink); color: #fff; font-weight: 600; }
.bil-table tbody th { color: var(--bil-ink); font-weight: 600; background: var(--bil-mist); }
.bil-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; }
.bil-toc li { margin: 4px 0; }
@media (max-width: 640px) { .bil-toc ol { columns: 1; } }

/* Placeholders and editor-only notes */
.bil-slot { background: #FFF6E5; outline: 1px dashed var(--bil-amber); padding: 0 3px; }
.bil-editor-note { margin: 12px 0; padding: 10px 14px; background: #FFF6E5; border: 1px dashed var(--bil-amber); color: var(--bil-ink); font-size: 13px; }

/* Newsletter: the homepage section (CSS class bil-newsletter-section) hides itself when [bil_newsletter] renders nothing. */
.bil-newsletter-section:not(:has(.bil-newsletter, .bil-editor-note)) { display: none !important; }
.bil-newsletter { width: 100%; max-width: 760px; margin: 0 auto; text-align: center; }
.bil-newsletter-heading { margin: 0 0 10px; font-family: var(--bil-head); font-size: 34px; font-weight: 700; line-height: 1.15; color: var(--bil-ink); }
.bil-newsletter-intro { margin: 0 0 18px; color: var(--bil-muted); font-size: 18px; line-height: 1.6; }
.bil-newsletter-consent { margin: 12px 0 0; color: var(--bil-muted); font-size: 13px; }
.bil-button { display: inline-block; padding: 14px 28px; border-radius: 6px; background: var(--bil-teal); color: #fff; font-weight: 600; text-decoration: none; }
.bil-button:hover, .bil-button:focus { background: var(--bil-ink); color: #fff; }

/* Forms */
.bil-form-fallback { padding: 14px 18px; background: var(--bil-mist); border-left: 4px solid var(--bil-teal); color: var(--bil-ink); }
.bil-form-fallback a { color: var(--bil-teal); font-weight: 600; }

/* Block-pattern panels (block editor articles) */
.bil-panel { padding: 22px; background: var(--bil-mist); border-top: 4px solid var(--bil-teal); }
.bil-panel.is-deal { border-top-color: var(--bil-amber); }
.wp-block-details { border-bottom: 1px solid var(--bil-line); padding: 10px 0; }
.wp-block-details summary { cursor: pointer; font-family: var(--bil-head); font-weight: 600; color: var(--bil-ink); }
@media (max-width: 640px) { .bil-newsletter-heading { font-size: 26px; } }

/* Mobile tables (assets/bil-tables.js adds .auto-stack and the data-label attributes). Settings → BIL Core → "Stack wide tables on phones". */
@media (max-width: 700px) {
	table.auto-stack,
	table.auto-stack tbody,
	table.auto-stack tr,
	table.auto-stack td,
	table.auto-stack tbody th { display: block; width: 100% !important; min-width: 0; box-sizing: border-box; }
	/* The header row stays in the HTML for search engines and screen readers. */
	table.auto-stack thead,
	table.auto-stack tr.auto-stack-head { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; }
	table.auto-stack tr { border: 1px solid #d9dee5; border-radius: 8px; margin-bottom: 14px; overflow: hidden; background: #fff; }
	table.auto-stack td,
	table.auto-stack tbody th,
	table.auto-stack tbody tr:nth-child(even) td {
		display: grid;
		grid-template-columns: 40% 1fr;
		column-gap: 12px;
		padding: 10px 12px;
		border: 0;
		border-bottom: 1px solid #eef0f3;
		background: transparent;
		text-align: left;
		word-break: normal;
		overflow-wrap: break-word;
	}
	table.auto-stack td:last-child { border-bottom: 0; }
	table.auto-stack td::before,
	table.auto-stack tbody th::before { content: attr(data-label); font-weight: 600; color: #374151; }
	table.auto-stack tbody tr .auto-stack-title,
	table.auto-stack tbody tr:nth-child(even) .auto-stack-title { display: block; font-weight: 700; color: #0A1828; background: #f5f7fa; }
	table.auto-stack .auto-stack-title::before { content: none; }
	.wp-block-table:has(table.auto-stack),
	.bil-table-wrap:has(table.auto-stack) { overflow-x: visible; }
}
