/* News Reader — BBC/CNN style single article layout
   Mobile-first: base rules target phones, larger screens are added
   via min-width media queries. This is deliberate — the two bugs we're
   fixing (huge gaps on mobile, broken in-text images) are mobile bugs,
   so mobile is the default we design for, not an afterthought. */

:root {
	--lnr-accent: #c8102e;
	--lnr-text: #1a1a1a;
	--lnr-muted: #6b6b6b;
	--lnr-border: #e2e2e2;
	--lnr-max: 700px;
	--lnr-wide: 1000px;
	--lnr-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.lnr-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	background: transparent;
	z-index: 9999;
}
.lnr-progress span {
	display: block;
	height: 100%;
	width: 0%;
	background: var(--lnr-accent);
	transition: width 0.1s linear;
}

.lnr-article {
	max-width: var(--lnr-max);
	margin: 0 auto;
	padding: 16px 16px 8px;
	color: var(--lnr-text);
	font-family: var(--lnr-sans);
	line-height: 1.6;
}

/* ---- Header ---- */
.lnr-header {
	font-family: var(--lnr-sans);
}

.lnr-kicker {
	display: inline-block;
	color: #fff;
	background: var(--lnr-accent);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 3px 10px;
	border-radius: 3px;
	text-decoration: none;
	margin-bottom: 10px;
}

.lnr-title {
	font-size: 26px;
	line-height: 1.25;
	font-weight: 800;
	margin: 0 0 8px;
}

.lnr-subtitle {
	font-size: 17px;
	line-height: 1.4;
	color: var(--lnr-muted);
	margin: 0 0 12px;
}

.lnr-byline {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-top: 1px solid var(--lnr-border);
	border-bottom: 1px solid var(--lnr-border);
	margin-bottom: 12px;
}

.lnr-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
}

.lnr-byline-text {
	display: flex;
	flex-direction: column;
	font-size: 13px;
	line-height: 1.4;
}

.lnr-author {
	font-weight: 700;
}
.lnr-author a {
	color: var(--lnr-text);
	text-decoration: none;
}

.lnr-meta-sep {
	color: var(--lnr-muted);
}

/* ---- Share bar ---- */
.lnr-share-bar {
	display: flex;
	gap: 8px;
	margin: 0 0 14px;
	font-family: var(--lnr-sans);
}

.lnr-share {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #f2f2f2;
	color: var(--lnr-text);
	text-decoration: none;
	font-size: 14px;
	border: none;
	cursor: pointer;
}
.lnr-share:hover {
	background: var(--lnr-accent);
	color: #fff;
}

/* ---- Hero image ---- */
.lnr-hero {
	margin: 0 -16px 4px;
}

.lnr-hero-img {
	width: 100%;
	height: auto;
	display: block;
}

.lnr-hero-credit {
	font-size: 12px;
	color: var(--lnr-muted);
	font-family: var(--lnr-sans);
	padding: 6px 16px 0;
	font-style: italic;
}

/* ---- Body copy ---- */
.lnr-body {
	font-size: 18px;
	line-height: 1.7;
	margin-top: 18px;
}

.lnr-body > p {
	margin: 0 0 1em;
}

.lnr-body > h2,
.lnr-body > h3 {
	font-family: var(--lnr-sans);
	font-weight: 800;
	line-height: 1.3;
	margin: 1.4em 0 0.6em;
}
.lnr-body > h2 { font-size: 22px; }
.lnr-body > h3 { font-size: 19px; }

.lnr-dropcap > p:first-of-type::first-letter {
	float: left;
	font-size: 3.4em;
	line-height: 0.85;
	font-weight: 800;
	padding: 4px 8px 0 0;
	color: var(--lnr-accent);
}

.lnr-body blockquote {
	margin: 1.4em 0;
	padding: 0 0 0 16px;
	border-left: 4px solid var(--lnr-accent);
	font-style: italic;
	font-size: 1.15em;
	color: #333;
}

.lnr-body a {
	color: var(--lnr-accent);
}

/* ---- In-text images: the actual mobile fix ----
   Every content image gets wrapped in <figure class="lnr-figure"> by
   the content filter. Bleeding it edge-to-edge on phones (negative
   margin matching the article's own padding) is what stops the
   "image not displaying well" problem — no more images constrained
   by a leftover inline width from the editor, no more lopsided gaps.
   !important is deliberate here: this plugin exists specifically to
   override whatever the active theme's own (possibly broken) image
   CSS is doing, so a theme rule loaded after ours with equal or
   higher specificity must not be able to win. */
.lnr-body .lnr-figure {
	margin: 1.4em -16px;
}

.lnr-body img,
.lnr-body .lnr-figure img,
.lnr-body img.lnr-content-img {
	display: block !important;
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
}

.lnr-body .lnr-figure figcaption,
.lnr-body .wp-caption-text {
	font-size: 13px;
	color: var(--lnr-muted);
	font-family: var(--lnr-sans);
	text-align: center;
	padding: 6px 16px 0;
	font-style: italic;
}

/* ---- Photo galleries (classic [gallery] shortcode AND the Gutenberg
   Gallery block) — a sequence of images that would otherwise stack one
   per row with a huge empty gap next to each, exactly like a broken
   theme renders them. Force a real responsive grid instead. */
.lnr-body .gallery,
.lnr-body .wp-block-gallery,
.lnr-body .lnr-gallery {
	display: grid !important;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	margin: 1.4em 0;
}
.lnr-body .gallery-columns-1 { grid-template-columns: 1fr; }
.lnr-body .gallery .gallery-item,
.lnr-body .wp-block-gallery .wp-block-image,
.lnr-body .lnr-gallery figure {
	margin: 0 !important;
	width: auto !important;
}
.lnr-body .gallery img,
.lnr-body .wp-block-gallery img {
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	object-fit: cover;
	aspect-ratio: 1 / 1;
}
.lnr-body .gallery .gallery-caption,
.lnr-body .wp-block-gallery figcaption {
	font-size: 12px;
	color: var(--lnr-muted);
	padding: 4px 0 0;
}

/* CNN's signature mid-article "Related Article" callout box, output by
   the [lnr_related id="123"] shortcode when an editor drops it into the body. */
.lnr-inline-related {
	display: block;
	margin: 1.4em 0;
	padding: 12px 16px;
	background: #f7f7f7;
	border-left: 4px solid var(--lnr-accent);
	font-family: var(--lnr-sans);
	font-size: 15px;
	line-height: 1.4;
}
.lnr-inline-related-label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--lnr-accent);
	margin-bottom: 4px;
}
.lnr-inline-related a {
	font-weight: 700;
	color: var(--lnr-text);
	text-decoration: none;
}
.lnr-inline-related a:hover {
	text-decoration: underline;
}

.lnr-protected form.post-password-form {
	font-family: var(--lnr-sans);
	margin-top: 12px;
}
.lnr-protected form.post-password-form p {
	margin: 0 0 10px;
}
.lnr-protected form.post-password-form input[type="password"] {
	padding: 8px 10px;
	border: 1px solid var(--lnr-border);
	border-radius: 4px;
	margin: 0 8px;
}
.lnr-protected form.post-password-form input[type="submit"] {
	padding: 8px 16px;
	background: var(--lnr-accent);
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.lnr-body iframe,
.lnr-body video,
.lnr-body .wp-embed-responsive .wp-block-embed__wrapper {
	max-width: 100%;
}

/* Video/embeds: force a responsive 16:9 box so they never overflow. */
.lnr-body .wp-block-embed__wrapper {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	overflow: hidden;
}
.lnr-body .wp-block-embed__wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* ---- Tags ---- */
.lnr-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 24px 0;
	font-family: var(--lnr-sans);
}
.lnr-tag {
	font-size: 12px;
	background: #f2f2f2;
	color: var(--lnr-text);
	padding: 5px 12px;
	border-radius: 14px;
	text-decoration: none;
}
.lnr-tag:hover {
	background: var(--lnr-accent);
	color: #fff;
}

/* ---- Author bio ---- */
.lnr-author-box {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	background: #f9f9f9;
	border-radius: 8px;
	padding: 16px;
	margin: 24px 0;
	font-family: var(--lnr-sans);
}
.lnr-avatar-lg {
	width: 60px;
	height: 60px;
}
.lnr-author-box h3 {
	margin: 0 0 6px;
	font-size: 16px;
}
.lnr-author-box p {
	margin: 0;
	font-size: 14px;
	color: var(--lnr-muted);
}

/* ---- Prev/next ---- */
.lnr-prev-next {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	border-top: 1px solid var(--lnr-border);
	padding: 16px 0;
	margin-top: 16px;
	font-family: var(--lnr-sans);
	font-size: 14px;
}
.lnr-prev-next a {
	color: var(--lnr-text);
	text-decoration: none;
	font-weight: 600;
}
.lnr-nav-next { text-align: right; }

/* ---- Related articles ---- */
.lnr-related {
	margin: 24px 0;
	font-family: var(--lnr-sans);
}
.lnr-related h2 {
	font-size: 18px;
	margin: 0 0 12px;
}
.lnr-related-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}
.lnr-related-card {
	text-decoration: none;
	color: var(--lnr-text);
}
.lnr-related-thumb {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	border-radius: 6px;
	margin-bottom: 8px;
}
.lnr-related-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.lnr-related-title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
}

.lnr-comments {
	max-width: var(--lnr-max);
	margin: 0 auto;
	padding: 0 16px 32px;
}

/* =========================================================
   Tablet / desktop — the article can breathe more here, and
   in-text images no longer need edge-to-edge bleed since the
   viewport itself provides margin.
   ========================================================= */
@media (min-width: 700px) {
	.lnr-article {
		padding: 32px 0 16px;
	}
	.lnr-title {
		font-size: 36px;
	}
	.lnr-subtitle {
		font-size: 19px;
	}
	.lnr-body {
		font-size: 19px;
	}
	.lnr-hero {
		margin: 0 0 6px;
		border-radius: 6px;
		overflow: hidden;
	}
	/* CNN/BBC both keep in-article images the same width as the text
	   column on desktop — no breakout. Edge-to-edge bleed is a phone-only
	   treatment, so past this breakpoint we just reset to normal flow. */
	.lnr-body .lnr-figure {
		margin: 1.6em 0;
	}
	.lnr-body .lnr-figure img,
	.lnr-body img.lnr-content-img {
		border-radius: 4px;
	}
	.lnr-related-grid {
		grid-template-columns: repeat(3, 1fr);
	}
	.lnr-share-bar {
		position: sticky;
		top: 20px;
	}

	/* Galleries get more breathing room as columns free up — capped at 4
	   even if the editor declared more, so thumbnails stay legible. */
	.lnr-body .gallery,
	.lnr-body .wp-block-gallery,
	.lnr-body .lnr-gallery {
		gap: 12px;
	}
	.lnr-body .gallery-columns-3,
	.lnr-body .gallery-columns-4,
	.lnr-body .gallery-columns-5,
	.lnr-body .gallery-columns-6,
	.lnr-body .gallery-columns-7,
	.lnr-body .gallery-columns-8,
	.lnr-body .gallery-columns-9 {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 900px) {
	.lnr-body .gallery-columns-4,
	.lnr-body .gallery-columns-5,
	.lnr-body .gallery-columns-6,
	.lnr-body .gallery-columns-7,
	.lnr-body .gallery-columns-8,
	.lnr-body .gallery-columns-9,
	.lnr-body .wp-block-gallery {
		grid-template-columns: repeat(4, 1fr);
	}
}
