/*
 * Blog listing and blog detail.
 *
 * Ported from HTML/Bloglisting.html and HTML/Blogdetails.html. Loaded only on
 * the Blog Listing page template and on single posts — see ksa_blog_scripts()
 * in inc/ksa-blog.php.
 *
 * The two pages share the .bd-head header, the .bl-meta byline and the initials
 * disc, so they live in one file rather than two that would each carry a copy.
 */

/* ======================================================================
 * Shared — page header (white, above both the listing and the article)
 * ====================================================================== */

.bd-head { border-bottom: 1px solid #E3E6EB; }
.bd-head-in { padding-top: 26px; padding-bottom: 26px; }
.bd-crumb { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; font-size: 12.5px; line-height: 1.55; color: #8A919C; margin-bottom: 18px; }
.bd-crumb a { color: #10469E; }
.bd-crumb a:hover { color: #3B7DD8; }
.bd-crumb-cur { color: #8A919C; max-width: 100%; }
.bd-title { font-size: 38px; line-height: 1.18; font-weight: 800; margin: 0 0 22px; max-width: 40ch; text-wrap: pretty; }

/* Shared — the byline under the featured post and every card. */
.bl-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 12.5px; color: #8A919C; }
.bl-meta > span { white-space: nowrap; }
.bl-auth { display: flex; align-items: center; gap: 8px; }
.bl-auth span { font-weight: 600; color: #3C4654; white-space: nowrap; }
.bl-dot { color: #C9CED6; }

/*
 * Shared — the initials disc. The design drew a photo slot; with no avatar
 * field behind it, it carries the author's initials on the same 46px disc,
 * which is why the flex centring sits alongside the size rules.
 */
.bd-ava {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	flex-shrink: 0;
	border-radius: 50%;
	overflow: hidden;
	background: #E7EEF9;
	color: #10469E;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0.02em;
}

/* ======================================================================
 * Listing — header row
 * ====================================================================== */

/* No article title follows the listing h1, so it closes up. */
.bl-head .bd-title { margin-bottom: 8px; }
.bl-lead { font-size: 16px; line-height: 1.65; color: #58595B; margin: 0; max-width: 62ch; }
.bl-headrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; }

.bl-search { display: flex; align-items: center; gap: 9px; background: #FFFFFF; border: 1px solid #D7DBE2; border-radius: 3px; padding: 0 14px; width: 300px; max-width: 100%; flex-shrink: 0; color: #8A919C; }
.bl-search:focus-within { border-color: #3B7DD8; outline: 2px solid #9CC4F5; outline-offset: 1px; }
.bl-search input { border: none; outline: none; font: inherit; font-size: 13.5px; padding: 11px 0; flex: 1; min-width: 0; background: transparent; color: #111111; }
/* The design drew the magnifier as decoration; it is the submit control here,
   so the button carries no chrome of its own. */
.bl-search button { display: flex; align-items: center; border: none; background: none; padding: 0; cursor: pointer; color: inherit; }
.bl-search button:hover { color: #10469E; }
form.bl-search > svg:first-of-type {
    display: none;
}

/* ======================================================================
 * Listing — featured post
 * ====================================================================== */

.bl-feat-in { padding-top: 32px; padding-bottom: 8px; }
.bl-feat { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 34px; align-items: center; color: #111111; }
.bl-feat:hover { color: #111111; }
.bl-feat-img { aspect-ratio: 16 / 10; border-radius: 5px; overflow: hidden; min-height: 0; background: #E7EAEF; }
.bl-feat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-flag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #FFFFFF; background: #10469E; border-radius: 2px; padding: 5px 10px; margin: 0 0 14px; }
.bl-feat-txt h2 { font-size: 29px; line-height: 1.24; font-weight: 800; margin: 0 0 12px; text-wrap: pretty; }
.bl-feat:hover h2 { color: #10469E; }
.bl-ex { font-size: 15px; line-height: 1.72; color: #58595B; margin: 0 0 18px; max-width: 52ch; }

/* ======================================================================
 * Listing — card grid
 * ====================================================================== */

.bl-grid-in { padding-top: 44px; padding-bottom: 56px; }
.bl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.bl-card { display: flex; flex-direction: column; border: 1px solid #E3E6EB; border-radius: 5px; overflow: hidden; color: #111111; background: #FFFFFF; }
.bl-card:hover { border-color: #3B7DD8; color: #111111; box-shadow: 0 6px 18px rgba(16, 70, 158, 0.10); }
.bl-card-img { aspect-ratio: 16 / 9; background: #E7EAEF; overflow: hidden; min-height: 0; }
.bl-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-card-body { display: flex; flex-direction: column; gap: 9px; padding: 18px 18px 20px; flex: 1; }
.bl-card h2 { font-size: 17px; line-height: 1.4; font-weight: 700; margin: 0; text-wrap: pretty; }
.bl-card:hover h2 { color: #10469E; }
.bl-card p { font-size: 13.5px; line-height: 1.65; color: #58595B; margin: 0; flex: 1; }

/*
 * Search results and the empty state. The design only ever drew a full grid,
 * so these borrow its type scale rather than inventing one.
 */
.bl-results { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.bl-results p { font-size: 15px; color: #58595B; margin: 0; }
.bl-results strong { color: #111111; font-weight: 700; }
.bl-results a { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.bl-empty { border: 1px solid #E3E6EB; border-radius: 5px; padding: 44px 30px; text-align: center; }
.bl-empty h2 { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.bl-empty p { font-size: 14.5px; line-height: 1.65; color: #58595B; margin: 0 auto; max-width: 46ch; }

/* ======================================================================
 * Listing — pagination
 * ====================================================================== */

.bl-pag { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 34px; }
.bl-pg { display: flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; border: 1px solid #D7DBE2; border-radius: 3px; font-size: 13.5px; font-weight: 700; color: #3C4654; }
.bl-pg:hover { border-color: #3B7DD8; color: #10469E; background: #F1F6FD; }
.bl-pg-cur,
.bl-pg-cur:hover { background: #10469E; border-color: #10469E; color: #FFFFFF; }
/* paginate_links() emits the gap as a span — a label, not a target. */
.bl-pag .dots { border-color: transparent; background: none; color: #8A919C; cursor: default; }

/* ======================================================================
 * Detail — article header
 * ====================================================================== */

.bd-meta { display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap; }
.bd-author { display: flex; align-items: center; gap: 12px; }
.bd-auth-txt { display: flex; flex-direction: column; gap: 1px; }
.bd-auth-txt b { font-size: 14px; font-weight: 700; }
.bd-auth-txt span { font-size: 12.5px; color: #8A919C; }
.bd-facts { display: flex; gap: 22px; flex-wrap: wrap; }
.bd-fact { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #58595B; }

.bd-hero .wrap { padding-top: 26px; }
.bd-hero-img { aspect-ratio: 16 / 7; border-radius: 5px; overflow: hidden; background: #E7EAEF; }
.bd-hero-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ======================================================================
 * Detail — body and sidebar
 * ====================================================================== */

.bd-body { display: grid; grid-template-columns: 1fr 280px; gap: 56px; align-items: start; padding-top: 38px; padding-bottom: 52px; }
.bd-art { max-width: 72ch; min-width: 0; }
.bd-art p { font-size: 16px; line-height: 1.8; color: #2E3742; margin: 0 0 18px; text-wrap: pretty; }
.bd-lead { font-size: 18.5px; line-height: 1.72; color: #1B2430; font-weight: 500; margin: 0 0 18px; }
.bd-art h2 { font-size: 23px; font-weight: 700; margin: 34px 0 12px; }
.bd-art h3 { font-size: 19px; font-weight: 700; margin: 26px 0 10px; }
/* Focused by the contents list, so it lands clear of the viewport edge. */
.bd-art h2[id] { scroll-margin-top: 24px; }
.bd-art h2[id]:focus { outline: none; }
.bd-art h2[id]:focus-visible { outline: 2px solid #3B7DD8; outline-offset: 4px; }

/*
 * Post content comes from the editor, so the design's hand-written .bd-quote
 * and .bd-list classes will not be on it. These pairs give a plain blockquote
 * and list the same treatment.
 */
.bd-art blockquote,
.bd-quote { border-left: 3px solid #3B7DD8; padding: 4px 0 4px 22px; margin: 26px 0; }
.bd-art blockquote p,
.bd-quote p { font-size: 19px; line-height: 1.6; font-style: italic; color: #10469E; margin: 0; }
.bd-art blockquote cite { display: block; font-size: 13.5px; font-style: normal; color: #8A919C; margin-top: 10px; }

.bd-art ul,
.bd-art ol,
.bd-list { margin: 0 0 18px; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; }
.bd-art li,
.bd-list li { font-size: 16px; line-height: 1.72; color: #2E3742; }
.bd-art li::marker,
.bd-list li::marker { color: #3B7DD8; }

.bd-art figure { margin: 26px 0; }
.bd-art img { border-radius: 5px; display: block; }
.bd-art figcaption { font-size: 13px; line-height: 1.6; color: #8A919C; margin-top: 9px; }
/* A wide table scrolls inside the column rather than widening the page. */
.bd-art .wp-block-table { overflow-x: auto; margin: 0 0 22px; }
.bd-art table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: 14.5px; }
.bd-art th,
.bd-art td { border: 1px solid #E3E6EB; padding: 10px 12px; text-align: left; }
.bd-art th { background: #F7F8FA; font-weight: 700; }
.bd-art a { text-decoration: underline; text-underline-offset: 2px; }
.bd-art > *:last-child { margin-bottom: 0; }

/* Author bio — shown only when the WordPress profile carries a description. */
/* Quick Summary --------------------------------------------------------- */
.bd-sum { background: #F7FAFE; border: 1px solid #D9E6F8; border-radius: 5px; padding: 20px 24px 22px; margin-bottom: 26px; }
.bd-sum h2 { font-size: 23px; font-weight: 700; margin: 0 0 12px; }
.bd-sum ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px; list-style: disc; }
.bd-sum li { font-size: 14.5px; line-height: 1.65; color: #2E3742; }
.bd-sum li::marker { color: #3B7DD8; }

.bd-bio { display: flex; gap: 18px; align-items: flex-start; background: #F7F8FA; border: 1px solid #E3E6EB; border-radius: 5px; padding: 22px 24px; margin-top: 36px; }
.bd-bio .bd-ava { width: 64px; height: 64px; font-size: 19px; }
.bd-bio b { display: block; font-size: 15.5px; font-weight: 800; }
.bd-bio > div > span { display: block; font-size: 12.5px; color: #8A919C; margin: 2px 0 10px; }
.bd-bio p { font-size: 14px; line-height: 1.7; color: #3C4654; margin: 0; }

/* In-article CTA — copy from Customizer → KSAacoustics Theme → Blog. */
.bd-cta { display: flex; align-items: center; justify-content: space-between; gap: 26px; flex-wrap: wrap; background: #0C3474; border-radius: 5px; padding: 28px 30px; margin-top: 36px; }
.bd-cta h2 { font-size: 21px; font-weight: 700; color: #FFFFFF; margin: 0 0 6px; }
.bd-cta p { font-size: 14px; line-height: 1.6; color: #C9DCF8; margin: 0; max-width: 46ch; }
.bd-cta-btn,
.bd-cta-btn:visited { background: #FFFFFF; color: #0C3474; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; padding: 14px 26px; border-radius: 3px; white-space: nowrap; text-decoration: none; }
.bd-cta-btn:hover,
.bd-cta-btn:focus { background: #DCE9FB; color: #0C3474; }
.bd-cta .bd-cta-btn { text-decoration: none; }

.bd-side { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bd-side-card { border: 1px solid #E3E6EB; border-radius: 5px; padding: 18px 18px 20px; }
.bd-side-card h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #8A919C; margin: 0 0 12px; }
.bd-toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: toc; }
/* Numbered with a counter rather than the <ol> marker: the entries are flex
   rows, which suppresses the native marker, and this keeps the number aligned
   to the first line of a heading that wraps. */
.bd-toc li { counter-increment: toc; display: flex; gap: 9px; }
.bd-toc li::before { content: counter(toc) "."; font-size: 13px; font-weight: 800; color: #3B7DD8; flex-shrink: 0; }
.bd-toc a { font-size: 13.5px; line-height: 1.5; color: #3C4654; }
.bd-toc a:hover { color: #10469E; }
/* Set by assets/js/ksa-blog.js as the reader moves through the article. */
.bd-toc a.is-active { color: #10469E; font-weight: 700; }
.bd-share { display: flex; gap: 10px; }
.bd-share a { width: 38px; height: 38px; border: 1px solid #E3E6EB; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.bd-share a:hover { border-color: #3B7DD8; background: #F1F6FD; }

/* ======================================================================
 * Detail — related articles
 * ====================================================================== */

.bd-rel { background: #F7F8FA; border-top: 1px solid #E3E6EB; }
.bd-rel-in { padding-top: 40px; padding-bottom: 48px; }
.bd-rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 18px; }
.bd-card { background: #FFFFFF; border: 1px solid #E3E6EB; border-radius: 5px; overflow: hidden; padding-bottom: 16px; color: #111111; }
.bd-card:hover { border-color: #3B7DD8; color: #111111; }
.bd-card-img { aspect-ratio: 16 / 9; background: #E7EAEF; }
.bd-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-card h3 { font-size: 15.5px; line-height: 1.45; font-weight: 700; margin: 14px 16px 8px; text-wrap: pretty; }
.bd-card:hover h3 { color: #10469E; }
.bd-card-meta { display: block; font-size: 12.5px; color: #8A919C; margin: 0 16px; }

/* ======================================================================
 * Tablet
 * ====================================================================== */

@media (max-width: 1000px) {
	.bd-body {display: flex;
        flex-wrap: wrap;
        flex-direction: column-reverse;}
	.bl-feat { grid-template-columns: 1fr; gap: 20px; }
	.bl-grid { grid-template-columns: 1fr 1fr; }
	.bd-body { grid-template-columns: 1fr; gap: 32px; }
	.bd-side { position: static; flex-direction: row; flex-wrap: wrap; }
	.bd-side-card { flex: 1; min-width: 240px; }
	.bd-rel-grid { grid-template-columns: 1fr 1fr; }
}

/* ======================================================================
 * Mobile
 * ====================================================================== */

@media (max-width: 640px) {
	.bd-title { font-size: 27px; }
	.bd-crumb { font-size: 12px; gap: 6px; }
	.bl-grid { grid-template-columns: 1fr; }
	.bl-feat-txt h2 { font-size: 22px; }
	.bl-search { width: 100%; }
	.bd-meta { gap: 16px; }
	.bd-facts { gap: 14px 18px; }
	.bd-art p { font-size: 15.5px; }
	.bd-lead { font-size: 17px; }
	.bd-art h2 { font-size: 20px; margin-top: 28px; }
	.bd-hero-img { aspect-ratio: 16 / 10; }
	.bd-cta { padding: 22px; }
	.bd-cta-btn { width: 100%; text-align: center; }
	.bd-bio { flex-direction: column; gap: 12px; padding: 18px; }
	.bd-rel-grid { grid-template-columns: 1fr; }
}
