/* Listing Manager — Blog (templates/blog-home.php, templates/single-post.php)
   The blog home grid and the article layout. Loads after global.css, tiles.css and archive.css;
   every colour comes from the tokens in global.css, so light and dark both follow. */

/* ------------------------------------------------------------------
 * Blog home: intro and the card grid (3 columns, 2 on tablets, 1 on phones)
 * ------------------------------------------------------------------ */

.lm-archive-intro {
	max-width: 62ch;
	margin: 8px 0 0;
	font-size: 16px;
	line-height: 1.6;
	color: var( --lm-muted );
}

.lm-blog-grid {
	display: grid;
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	gap: 28px 24px;
}

.lm-blog-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	background: var( --lm-panel );
	border: 1px solid var( --lm-line );
	border-radius: var( --lm-radius );
	box-shadow: var( --lm-shadow-sm );
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.lm-blog-card:hover,
.lm-blog-card:focus-within {
	border-color: var( --lm-blue );
	transform: translateY( -2px );
}

.lm-blog-card-media {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var( --lm-panel2 );
}

.lm-blog-card-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* No featured image: the logo gradient, kept quiet. */
.lm-blog-card-ph {
	display: block;
	width: 100%;
	height: 100%;
	background: var( --lm-grad );
	opacity: 0.35;
}

.lm-blog-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 16px 18px 18px;
}

.lm-blog-card-title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	overflow-wrap: anywhere;
}

.lm-blog-card-title a {
	color: var( --lm-ink );
	text-decoration: none;
}

.lm-blog-card-title a:hover {
	color: var( --lm-link );
}

.lm-blog-card-title a:focus-visible {
	outline: 3px solid var( --lm-focus );
	outline-offset: 2px;
	border-radius: 4px;
}

.lm-blog-card-excerpt {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: 14.5px;
	line-height: 1.55;
	color: var( --lm-muted );
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.lm-blog-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 8px;
	margin: auto 0 0;
	padding-top: 6px;
	font-size: 13px;
	color: var( --lm-muted );
}

@media ( max-width: 900px ) {
	.lm-blog-grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

@media ( max-width: 600px ) {
	.lm-blog-grid {
		grid-template-columns: minmax( 0, 1fr );
		gap: 20px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.lm-blog-card,
	.lm-blog-card:hover,
	.lm-blog-card:focus-within {
		transform: none;
		transition: none;
	}
}

/* ------------------------------------------------------------------
 * Article: header, featured image, text column (~720px)
 * ------------------------------------------------------------------ */

.lm-blog-article {
	max-width: 960px;
	margin: 0 auto;
}

.lm-blog-head,
.lm-prose {
	max-width: 720px;
	margin-right: auto;
	margin-left: auto;
}

.lm-blog-title {
	margin: 6px 0 12px;
	font-size: clamp( 26px, 4.4vw, 40px );
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var( --lm-ink );
	overflow-wrap: anywhere;
}

.lm-blog-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 10px;
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: var( --lm-muted );
}

.lm-blog-meta a {
	font-weight: 600;
	color: var( --lm-link );
	text-decoration: none;
}

.lm-blog-meta a:hover {
	text-decoration: underline;
}

.lm-blog-hero {
	margin: 24px 0 28px;
}

.lm-blog-hero img {
	display: block;
	width: 100%;
	height: auto;
	background: var( --lm-panel2 );
	border-radius: var( --lm-radius );
}

/* ------------------------------------------------------------------
 * Table of contents (3+ H2 headings): open on desktop, closed on phones (inline script)
 * ------------------------------------------------------------------ */

.lm-toc {
	margin: 0 0 28px;
	background: var( --lm-panel );
	border: 1px solid var( --lm-line );
	border-radius: var( --lm-radius );
}

.lm-toc summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: var( --lm-tap );
	padding: 0 16px;
	font-size: 15px;
	font-weight: 700;
	color: var( --lm-ink );
	cursor: pointer;
	list-style: none;
}

.lm-toc summary::-webkit-details-marker {
	display: none;
}

.lm-toc summary::after {
	flex: none;
	width: 8px;
	height: 8px;
	margin-right: 4px;
	content: '';
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate( 45deg ) translate( -2px, -2px );
	transition: transform 0.15s ease;
}

.lm-toc details[open] > summary::after {
	transform: rotate( -135deg ) translate( -2px, -2px );
}

.lm-toc summary:focus-visible {
	outline: 3px solid var( --lm-focus );
	outline-offset: -3px;
	border-radius: var( --lm-radius );
}

.lm-toc ol {
	margin: 0;
	padding: 0 16px 14px 38px;
	font-size: 15px;
	line-height: 1.5;
}

.lm-toc li {
	margin: 0;
	padding: 5px 0;
}

.lm-toc a {
	color: var( --lm-link );
	text-decoration: none;
}

.lm-toc a:hover {
	text-decoration: underline;
}

/* Headings jumped to from the contents sit below the sticky header. */
.lm-prose h2[id],
.lm-prose h3[id] {
	scroll-margin-top: 84px;
}

/* ------------------------------------------------------------------
 * Typography: headings, lists, tables, code, images, embeds
 * ------------------------------------------------------------------ */

.lm-prose {
	font-size: 17px;
	line-height: 1.75;
	color: var( --lm-ink );
	overflow-wrap: break-word;
}

.lm-prose > :first-child {
	margin-top: 0;
}

.lm-prose p,
.lm-prose ul,
.lm-prose ol,
.lm-prose blockquote,
.lm-prose pre,
.lm-prose figure,
.lm-prose .lm-table-wrap {
	margin: 0 0 1.25em;
}

.lm-prose h2,
.lm-prose h3,
.lm-prose h4 {
	margin: 1.9em 0 0.6em;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var( --lm-ink );
}

.lm-prose h2 {
	font-size: 28px;
}

.lm-prose h3 {
	font-size: 22px;
}

.lm-prose h4 {
	font-size: 18px;
}

.lm-prose a {
	color: var( --lm-link );
	text-decoration: underline;
	text-underline-offset: 2px;
}

.lm-prose a:hover {
	text-decoration-thickness: 2px;
}

.lm-prose ul,
.lm-prose ol {
	padding-left: 1.5em;
}

.lm-prose li {
	margin: 0.35em 0;
}

.lm-prose li > ul,
.lm-prose li > ol {
	margin: 0.35em 0 0;
}

.lm-prose strong {
	font-weight: 700;
}

.lm-prose blockquote {
	padding: 4px 0 4px 18px;
	color: var( --lm-muted );
	border-left: 4px solid var( --lm-blue );
}

.lm-prose blockquote p:last-child {
	margin-bottom: 0;
}

.lm-prose hr {
	margin: 2em 0;
	border: 0;
	border-top: 1px solid var( --lm-line );
}

.lm-prose img,
.lm-prose video {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 10px;
}

.lm-prose figure {
	max-width: 100%;
}

.lm-prose figcaption {
	margin-top: 8px;
	font-size: 14px;
	line-height: 1.5;
	color: var( --lm-muted );
	text-align: center;
}

.lm-prose .alignleft,
.lm-prose .alignright,
.lm-prose .aligncenter {
	float: none;
	margin-right: auto;
	margin-left: auto;
}

/* Tables scroll sideways inside their box instead of widening the page. */
.lm-table-wrap {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.lm-prose table {
	width: 100%;
	min-width: 480px;
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
	border-collapse: collapse;
}

.lm-prose th,
.lm-prose td {
	padding: 10px 14px;
	text-align: left;
	vertical-align: top;
	border: 1px solid var( --lm-line );
}

.lm-prose th {
	font-weight: 700;
	background: var( --lm-panel2 );
}

.lm-prose tbody tr:nth-child( even ) td {
	background: var( --lm-panel );
}

.lm-prose code,
.lm-prose kbd {
	padding: 0.15em 0.4em;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.88em;
	background: var( --lm-panel2 );
	border-radius: 6px;
}

.lm-prose pre {
	padding: 14px 16px;
	overflow-x: auto;
	font-size: 14px;
	line-height: 1.6;
	background: var( --lm-panel2 );
	border: 1px solid var( --lm-line );
	border-radius: 10px;
	-webkit-overflow-scrolling: touch;
}

.lm-prose pre code {
	padding: 0;
	font-size: inherit;
	background: none;
	border-radius: 0;
}

/* Embeds keep their shape at any width. */
.lm-prose iframe,
.lm-prose embed,
.lm-prose object {
	max-width: 100%;
	border: 0;
	border-radius: 10px;
}

.lm-prose iframe[src*='youtube'],
.lm-prose iframe[src*='youtu.be'],
.lm-prose iframe[src*='vimeo'],
.lm-prose .wp-block-embed__wrapper iframe,
.lm-prose .wp-has-aspect-ratio iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

/* ------------------------------------------------------------------
 * After the text: author box, related apps, more articles
 * ------------------------------------------------------------------ */

.lm-blog-after {
	max-width: 720px;
	margin: 40px auto 0;
}

.lm-blog-section {
	margin: 44px auto 0;
}

.lm-blog-section > h2 {
	margin: 0 0 14px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var( --lm-ink );
}

.lm-blog-related-apps {
	max-width: 720px;
}

.lm-blog-apps {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 96px, 1fr ) );
	gap: 16px 12px;
}

@media ( max-width: 600px ) {
	.lm-prose {
		font-size: 16.5px;
	}

	.lm-prose h2 {
		font-size: 24px;
	}

	.lm-prose h3 {
		font-size: 20px;
	}

	.lm-blog-hero {
		margin: 18px 0 22px;
	}

	.lm-blog-hero img {
		border-radius: 10px;
	}

	.lm-blog-section {
		margin-top: 36px;
	}
}
