/*
 * Blog: listing (index.php, template-parts/card.php) and single posts (single.php, template-parts/blog/*).
 * Loaded on blog views only (inc/blog.php), after style.css and pages.css.
 */

/* Elementor's kit styles every heading, link and label on the page; restate the design in the blog. */
:is(.post-single, .post-cta, .related, .blog-list, .blog-hero) :is(h1, h2, h3, h4, h5, h6, label, summary) {
	font-family: inherit;
	text-transform: none;
	font-style: normal;
}

/* Posts built with Elementor: its kit sets a grey page and its own fonts on widgets. */
body.single-post { background: var(--surface); }
.post-content :is(.elementor-widget-text-editor, .elementor-widget-container) { font: inherit; color: inherit; }
.post-content :is(.e-con, .elementor-section, .elementor-element) { --padding-top: 0px; --padding-bottom: 0px; --padding-left: 0px; --padding-right: 0px; padding: 0; }
.post-content :is(.elementor-widget-container, .elementor-text-editor) > * + * { margin-top: 1.1em; }

/* The kit also strips padding, radius and font from every <button>. */
.post-single .share-copy,
.post-cta .dx-form button.btn { font-family: inherit; font-weight: 600; line-height: 1.2; border-radius: 999px; }
.post-single .share-copy { padding: 0 14px; border: 1.5px solid var(--line); font-size: 14px; }
.post-cta .dx-form button.btn { padding: 0 22px; font-size: 15px; }

/* ---------- Breadcrumbs ---------- */
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; }
.crumbs li + li::before { content: "/"; margin: 0 8px; color: #b4bdb8; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--deep); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); }
.crumbs li:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }

/* ---------- Listing ---------- */
.blog-hero .wrap { gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips a {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 16px;
	border: 1.5px solid var(--line);
	border-radius: 999px;
	background: #fff;
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
	transition: border-color .2s, color .2s;
}
.chips a:hover { border-color: var(--deep); color: var(--deep); }
.chips a[aria-current] { border-color: var(--deep); background: var(--deep); color: #fff; }

.post-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 28px 24px; }
.card { position: relative; grid-template-rows: auto 1fr; }
.card:hover { box-shadow: var(--shadow); }
.card:focus-within { box-shadow: 0 0 0 2px var(--deep); }
.card-img { overflow: hidden; background: var(--tint); }
.card-img { display: grid; place-items: center; }
/* Featured images are banners with text in them (3:2 to 2.4:1): show them whole. */
.card-img img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; transition: transform .4s; }
.card:hover .card-img img { transform: scale(1.03); }
.card-body { gap: 10px; grid-template-rows: auto auto 1fr auto; }
.card-cat { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--green-dark); }
.post-grid .card-title,
.card-title { font-size: 19px; line-height: 1.3; font-weight: 800; letter-spacing: -.015em; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable, one link for screen readers */
.card-title a:focus-visible { outline: 0; }
.card:hover .card-title a { color: var(--deep); }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 0; padding-top: 6px; }
.card-meta span::before { content: "·"; margin: 0 8px; }

.card-featured { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: none; }
.card-featured .card-img img { height: 100%; max-height: 420px; }
.card-featured .card-body { align-content: center; padding: 36px 40px; }
.post-grid .card-featured .card-title { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.2; }
.card-featured .card-text { font-size: 16px; }

/* ---------- Single post ---------- */
.read-progress {
	position: fixed;
	inset: 0 0 auto;
	z-index: 1003;
	height: 3px;
	background: var(--grad);
	transform: scaleX(0);
	transform-origin: 0 50%;
	pointer-events: none;
}
/* Below the admin bar, like the header (style.css). */
.admin-bar .read-progress { top: 32px; }
@media (max-width: 782px) { .admin-bar .read-progress { top: 46px; } }
@media (max-width: 600px) { .admin-bar .read-progress { top: 0; } }
/* Scroll-driven, no JavaScript: fills as the article body scrolls past. Browsers without support show no bar. */
@supports (animation-timeline: view()) {
	body:has(.post-body) { timeline-scope: --post; }
	.post-body { view-timeline: --post block; }
	.read-progress { animation: dx-read linear both; animation-timeline: --post; animation-range: contain 0% contain 100%; }
}
@keyframes dx-read { to { transform: scaleX(1); } }

.post-head { padding: 40px 0 36px; }
.post-head .wrap { display: grid; gap: 14px; justify-items: start; }
.post-head .kicker a { color: inherit; text-decoration: none; }
.post-head h1 { max-width: 22ch; font-size: clamp(32px, 3.6vw, 48px); line-height: 1.1; font-weight: 800; letter-spacing: -.03em; color: var(--ink); text-wrap: balance; }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; font-size: 14.5px; color: var(--muted); }
.post-byline > span + span:not(:nth-child(2))::before { content: "·"; margin: 0 10px; }
.post-byline b { color: var(--ink); font-weight: 600; }
.post-avatar {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	margin-right: 10px;
	border-radius: 50%;
	background: var(--grad);
	color: #fff;
	font-size: 15px;
	font-weight: 800;
}

/*
 * Main column + sticky sidebar. Phones: one column in DOM order (image, share, intro, contents, article).
 * Desktop: the sidebar spans every row of the right column and sticks below the header.
 */
.post-layout {
	display: grid;
	grid-template-columns: minmax(0, 760px);
	justify-content: center;
	column-gap: 56px;
	padding: 32px 0 72px;
}
.post-layout > * + * { margin-top: 28px; }
@media (min-width: 1081px) {
	/* Up to 6 items in the main column. The last, flexible row keeps the tall sidebar from stretching those rows. */
	.post-layout { grid-template-columns: minmax(0, 760px) 300px; grid-template-rows: repeat(6, auto) 1fr; justify-content: space-between; }
	.post-layout > :not(.post-aside) { grid-column: 1; }
	.post-aside { grid-column: 2; grid-row: 1 / -1; margin-top: 0; align-self: start; position: sticky; top: calc(var(--hdr) + 24px); }
	.admin-bar .post-aside { top: calc(var(--hdr) + 56px); }
	.post-layout > .post-hero + * { margin-top: 20px; }
}

.post-hero img { width: 100%; border-radius: 20px; background: var(--tint); }

/* Share bar */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share-label { margin-right: 4px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border: 1.5px solid var(--line);
	border-radius: 999px;
	background: #fff;
	color: var(--ink);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color .2s, color .2s;
}
.share-btn svg { fill: currentColor; }
.share-btn:hover { border-color: var(--deep); color: var(--deep); }
.share-copy.done { border-color: var(--green); color: var(--green-dark); }

/* Table of contents */
.post-aside { display: grid; gap: 20px; }
.toc details { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.toc summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--green-dark);
	cursor: pointer;
	list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; width: 8px; height: 8px; margin-top: -4px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s; }
.toc details[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.toc ol { counter-reset: toc; }
.toc details > ol { position: relative; padding: 0 12px 14px; }
.toc li { counter-increment: toc; }
.toc a {
	display: grid;
	grid-template-columns: 26px 1fr;
	padding: 7px 8px;
	border-radius: 8px;
	font-size: 14.5px;
	line-height: 1.4;
	color: var(--text);
	text-decoration: none;
}
.toc a::before { content: counter(toc) "."; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc a:hover { background: var(--tint); color: var(--deep); }
.toc a[aria-current] { background: #e9f3f6; color: var(--deep); font-weight: 600; }
.toc li ol { display: none; } /* phones: top level only */
@media (min-width: 1081px) {
	.toc details > ol { max-height: calc(100vh - var(--hdr) - 260px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
	.toc li ol { display: block; padding-left: 26px; }
	.toc li ol a { grid-template-columns: 1fr; padding: 5px 8px; font-size: 13.5px; color: var(--muted); }
	.toc li ol a::before { content: none; }
}

.aside-cta { display: grid; gap: 8px; justify-items: start; padding: 22px; border-radius: var(--radius); background: var(--tint); }
.aside-cta b { font-size: 17px; color: var(--ink); }
.aside-cta p { font-size: 14.5px; color: var(--muted); }
.aside-cta .btn { margin-top: 6px; }
@media (max-width: 1080px) {
	.aside-cta { display: none; } /* the enquiry block after the post covers phones */
	.no-toc .post-aside { display: none; }
}

/* Quick answer (the post's excerpt, when one is written) */
.quick-answer { padding: 22px 24px; border-left: 4px solid var(--green); border-radius: 0 var(--radius) var(--radius) 0; background: var(--tint); font-size: 17px; line-height: 1.65; color: var(--ink); }
.quick-answer h2 { margin-bottom: 6px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--green-dark); }

/* Article text. Older posts set justified text and fixed table sizes inline; keep the reading column even. */
.post-content { max-width: none; font-size: 17.5px; line-height: 1.75; }
.post-content [style*="justify"] { text-align: left !important; }
.post-content :is(h1, h2) { font-size: clamp(24px, 2.5vw, 30px); line-height: 1.25; font-weight: 800; letter-spacing: -.02em; margin-top: 1.8em; color: var(--ink); }
.post-content h3 { font-size: 21px; line-height: 1.3; font-weight: 800; margin-top: 1.5em; color: var(--ink); }
.post-content :is(h2, h3, h4) strong { font-weight: inherit; }
.post-content > :first-child { margin-top: 0; }
.post-content :is(h1, h2, h3, h4)[id] { scroll-margin-top: calc(var(--hdr) + 20px); }
.post-content p:empty { display: none; }
.post-content li > p { margin: 0; }
.post-content a { text-decoration-thickness: 1px; }
.post-content img { height: auto; margin-inline: auto; border-radius: 14px; }
.post-content blockquote { padding: 16px 20px; border-left: 4px solid var(--amber-fill); border-radius: 0 12px 12px 0; background: #fff8eb; font-size: 16.5px; color: var(--ink); }
.post-content .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.post-content table { width: 100% !important; height: auto !important; margin: 0; font-size: 15.5px; }
.post-content :is(th, td) { padding: 12px 16px; vertical-align: top; height: auto !important; }
.post-content th,
.post-content tr:first-child td:has(> strong:only-child) { background: var(--tint); color: var(--ink); font-weight: 600; }
.post-content tr:last-child > * { border-bottom: 0; }
.post-content :is(code, kbd) { padding: 2px 6px; border-radius: 6px; background: var(--tint); font-size: .9em; }
.post-content pre code { padding: 0; background: none; }

/* After the article */
.post-foot { display: grid; gap: 24px; padding-top: 28px; border-top: 1px solid var(--line); }
.post-tags { margin: 0; align-items: center; }
.post-tags span { margin-right: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.author-box { display: flex; gap: 16px; padding: 22px; border-radius: var(--radius); background: var(--tint); }
.author-box .post-avatar { width: 52px; height: 52px; margin: 0; font-size: 20px; }
.author-box > div { display: grid; gap: 6px; }
.author-name { color: var(--muted); }
.author-name b { color: var(--ink); }
.author-box p:not(.author-name) { font-size: 15px; color: var(--muted); }
.post-foot .comments { margin-top: 24px; }

/* Enquiry block */
.post-cta { padding: 8px 0 72px; }
.post-cta-in {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
	gap: 40px;
	align-items: center;
	padding: 48px;
	border-radius: 28px;
	background: radial-gradient(600px 300px at 100% 0, #26bca355, #26bca300 70%), linear-gradient(120deg, #0d4e69, #126587);
	color: #d7e9f0;
}
.post-cta-copy { display: grid; gap: 14px; justify-items: start; }
.post-cta .kicker { color: #bfe8d6; }
.post-cta h2 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -.03em; color: #fff; }
.post-cta .btn-row { margin-top: 6px; }
.post-cta .btn-row a.btn-secondary { background: transparent; color: #fff; border-color: #ffffff80; }
.post-cta .btn-row a.btn-secondary:hover { background: #ffffff1a; }
.post-cta-call { font-size: 15px; }
.post-cta-call a { color: #fff; font-weight: 600; }

/* Related posts */
.related { padding: 0 0 88px; }
.related h2 { margin-bottom: 28px; font-size: clamp(26px, 2.6vw, 34px); line-height: 1.2; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.related .card-title { font-size: 18px; }

@media (max-width: 900px) {
	.card-featured { grid-template-columns: minmax(0, 1fr); }
	.card-featured .card-body { padding: 22px 22px 26px; }
	.post-cta-in { grid-template-columns: minmax(0, 1fr); padding: 32px 22px; }
}
@media (max-width: 760px) {
	.chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: none; }
	.post-head { padding: 24px 0 28px; }
	.post-byline > span:nth-child(2) { flex-basis: calc(100% - 46px); }
	.post-byline > span + span:nth-child(3)::before { content: none; }
	.post-byline > span:nth-child(3) { margin-left: 46px; }
	.post-layout { padding-top: 20px; }
	.post-layout > * + * { margin-top: 22px; }
	.post-content { font-size: 17px; line-height: 1.7; }
	.share-label { display: none; }
	.share-copy-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* still names the button */
	.post-single .share-copy { padding: 0 10px; }
	.post-cta { padding-bottom: 56px; }
	.post-cta-in { margin-inline: calc(-1 * var(--gutter) + 8px); border-radius: 22px; }
	.related { padding-bottom: 56px; }
}

@media print {
	.hdr, .ftr, .read-progress, .share, .post-aside, .post-cta, .related, .crumbs, .qlwapp__container, .elementor-popup-modal { display: none !important; }
	.post-head { padding: 0 0 12px; background: none; }
	.post-layout { display: block; padding: 0; }
	.post-content { font-size: 12pt; }
	.post-content a::after { content: " (" attr(href) ")"; font-size: .8em; color: var(--muted); }
}
