/*
 * Design System - AELITA
 * components/news-single.css - single news (blog post) reading page.
 *
 * Layout from the Stitch "news page" design, rendered with the AELITA tokens:
 * an editorial header (category/brand badges, the single H1, the publication
 * date + reading time), a wide cover image, the article body as prose, a sticky
 * share sidebar and a related-news section (the card grid itself is owned by
 * news-card.css / news-archive.css and reused unchanged).
 *
 * Every selector is scoped to .a-news-single, so nothing here can reach any
 * other template. The legacy main.css loads after the design system and keeps
 * its own .services / .news-date / .pages_nav rules; those classes are no
 * longer used by single.php, and every remaining collision is won on
 * specificity (a two-class descendant beats a single legacy class) without
 * !important. The only !important is the focus ring, which must beat the
 * theme-wide `*:focus { outline: none !important }`.
 *
 * Consumes tokens.css / base.css / layout.css only: no new colors, sharp radii
 * (--radius 0), one red accent. Loaded on blog post singles only.
 */

/* -------------------------------------------------------------------- */
/* Page shell + keyboard focus                                           */
/* -------------------------------------------------------------------- */
.a-news-single {
	background-color: var(--bg);
}

/* main.css ships `*:focus { outline: none !important }`; restore focus
 * visibility on this surface (same approach as the news archive). */
.a-news-single :focus-visible {
	outline: 2px solid var(--focus-ring) !important;
	outline-offset: 2px;
}

/* Bootstrap 3 underlines every `a:hover`/`a:focus`. These component links are
 * underline-free at rest, so they stay underline-free on interaction (their
 * affordance is the colour / border shift). Article prose links are excluded
 * and keep their underline. */
.a-news-single__badge-link:hover,
.a-news-single__badge-link:focus,
.a-news-single__all:hover,
.a-news-single__all:focus,
.a-news-single__tag:hover,
.a-news-single__tag:focus,
.a-news-single__related-card:hover,
.a-news-single__related-card:focus {
	text-decoration: none;
}

/* -------------------------------------------------------------------- */
/* Editorial header                                                      */
/* -------------------------------------------------------------------- */
.a-news-single__hero {
	padding-block: clamp(var(--space-6), 4vw, var(--space-7));
	background-color: var(--bg);
	border-bottom: var(--border-w) solid var(--border);
}

.a-news-single__badges {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.a-news-single__badge {
	display: inline-flex;
	align-items: center;
	padding: var(--space-1) var(--space-3);
	font-size: var(--fs-caption);
	font-weight: var(--fw-semibold);
	line-height: 1.5;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.a-news-single__badge--category {
	background-color: var(--c-ink-800);
	color: var(--c-white);
}

.a-news-single__badge--brand {
	background-color: var(--bg-muted);
	color: var(--text-primary);
}

.a-news-single__badge-link {
	color: inherit;
	text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
	.a-news-single__badge--category:hover .a-news-single__badge-link {
		color: var(--c-red-500);
	}
}

.a-news-single__title {
	max-width: 60ch;
	margin: var(--space-4) 0 0;
	font-family: var(--font-display-strong);
	font-size: var(--fs-display);
	font-weight: var(--fw-bold);
	line-height: var(--lh-display);
	letter-spacing: -0.01em;
	text-transform: none;
	color: var(--text-primary);
	text-wrap: balance;
}

.a-news-single__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-5);
	margin-top: var(--space-5);
	padding-top: var(--space-4);
	border-top: var(--border-w) solid var(--border);
	font-size: var(--fs-small);
	color: var(--text-secondary);
	font-variant-numeric: tabular-nums;
}

.a-news-single__meta-item {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}

.a-news-single__meta-icon {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	color: var(--c-ink-300);
}

/* -------------------------------------------------------------------- */
/* Body grid (article + sticky sidebar)                                  */
/* -------------------------------------------------------------------- */
.a-news-single__body {
	padding-block: clamp(var(--space-6), 5vw, var(--space-8));
}

.a-news-single__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-7);
	align-items: start;
}

/* Two-column reading layout only from the design-system xl breakpoint: below
 * it the article runs as a single, measure-capped column with a full-width
 * cover (the classic editorial fallback). */
@media (min-width: 1200px) {
	.a-news-single__grid {
		grid-template-columns: minmax(0, 1fr) 400px;
		gap: clamp(var(--space-6), 5vw, var(--space-8));
	}
}

.a-news-single__main {
	min-width: 0;
}

/* -------------------------------------------------------------------- */
/* Cover image                                                           */
/* -------------------------------------------------------------------- */
.a-news-single__cover {
	margin: 0 0 var(--space-7);
}

.a-news-single__cover-img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	background-color: var(--bg-muted);
}

.a-news-single__cover-caption {
	margin-top: var(--space-3);
	font-size: var(--fs-small);
	line-height: 1.5;
	color: var(--text-secondary);
}

/* -------------------------------------------------------------------- */
/* Article prose (authored content, kept readable for every legacy shape) */
/* -------------------------------------------------------------------- */
.a-news-single__content {
	max-width: 72ch;
	font-size: 18px;
	line-height: 1.7;
	color: var(--text-primary);
	overflow-wrap: break-word;
}

/* In the two-column layout the column itself is the measure, so the cover and
 * the prose share one width and align edge to edge. */
@media (min-width: 1200px) {
	.a-news-single__content {
		max-width: none;
	}
}

.a-news-single__content > *:first-child {
	margin-top: 0;
}

.a-news-single__content > *:last-child {
	margin-bottom: 0;
}

/* Paragraphs */
.a-news-single__content p {
	margin: 0 0 1.25em;
}

/* Empty paragraphs (and the lone <!--more--> anchor paragraph the editor
 * leaves behind) would only open a blank gap. */
.a-news-single__content p:empty,
.a-news-single__content p:has(> span[id^="more-"]:only-child) {
	display: none;
}

.a-news-single__content strong,
.a-news-single__content b {
	font-weight: var(--fw-semibold);
	color: var(--text-primary);
}

/* Headings: the theme forces uppercase + a fixed scale globally; restore the
 * editorial (sentence-case) hierarchy inside the article only. */
.a-news-single__content h2,
.a-news-single__content h3,
.a-news-single__content h4 {
	font-family: var(--font-display-strong);
	font-weight: var(--fw-bold);
	line-height: var(--lh-heading);
	letter-spacing: -0.01em;
	text-transform: none;
	color: var(--text-primary);
	text-wrap: balance;
}

.a-news-single__content h2 {
	margin: 1.6em 0 0.6em;
	font-size: var(--fs-h3); /* 24px */
}

.a-news-single__content h3 {
	/* 20px: closest step between the H2 and the body size; token debt. */
	margin: 1.5em 0 0.5em;
	font-size: 20px;
}

.a-news-single__content h4 {
	margin: 1.4em 0 0.5em;
	font-size: var(--fs-h4); /* 18px */
}

/* The editor (and old imports) leave stray empty headings that would otherwise
 * open a large blank gap. */
.a-news-single__content h2:empty,
.a-news-single__content h3:empty,
.a-news-single__content h4:empty {
	display: none;
}

/* Lists */
.a-news-single__content ul,
.a-news-single__content ol {
	margin: 0 0 1.25em;
	padding-left: 1.3em;
}

.a-news-single__content li {
	margin: 0 0 0.5em;
}

.a-news-single__content li::marker {
	color: var(--c-ink-300);
}

/* Links */
.a-news-single__content a {
	color: var(--link);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
	.a-news-single__content a:hover {
		color: var(--link-hover);
	}
}

/* In-article images */
.a-news-single__content img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: var(--space-5) auto;
}

.a-news-single__content figure {
	margin: var(--space-6) 0;
}

.a-news-single__content figcaption,
.a-news-single__content .wp-caption-text {
	margin-top: var(--space-2);
	font-size: var(--fs-small);
	line-height: 1.5;
	color: var(--text-secondary);
	text-align: center;
}

.a-news-single__content .wp-caption {
	max-width: 100%;
}

/* Shortcode gallery ([gallery] -> .gal-slider, initialised by main.js):
 * reserve the first frame before Slick runs so the raw stack never flashes. */
.a-news-single__content .gal-slider {
	margin: var(--space-6) 0;
}

.a-news-single__content .gal-slider:not(.slick-initialized) > div:not(:first-child) {
	display: none;
}

.a-news-single__content .gal-slider img {
	margin: 0;
}

.a-news-single__content .gal-slider a {
	display: block;
}

/* Embeds (YouTube and friends): keep the authored ratio, never overflow. */
.a-news-single__content iframe,
.a-news-single__content video,
.a-news-single__content embed,
.a-news-single__content object {
	display: block;
	max-width: 100%;
	margin-inline: auto;
}

.a-news-single__content iframe {
	border: 0;
}

/* Video embeds fill the column and keep a 16:9 frame at every width; other
 * iframes keep their authored size. */
.a-news-single__content iframe[src*="youtube.com"],
.a-news-single__content iframe[src*="youtu.be"],
.a-news-single__content iframe[src*="vimeo.com"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

/* Tables (legacy price/spec tables keep their inline alignment). */
.a-news-single__content table {
	width: 100%;
	max-width: 100%;
	margin: 0 0 var(--space-5);
	border-collapse: collapse;
	font-size: var(--fs-small);
}

.a-news-single__content th,
.a-news-single__content td {
	padding: var(--space-2) var(--space-3);
	border: var(--border-w) solid var(--border);
	vertical-align: top;
	overflow-wrap: break-word;
}

.a-news-single__content th p,
.a-news-single__content td p {
	margin: 0;
}

/* Quotes: a tinted panel instead of an accent side border. */
.a-news-single__content blockquote {
	margin: var(--space-6) 0;
	padding: var(--space-5);
	background-color: var(--bg-muted);
	color: var(--text-primary);
	font-style: italic;
}

.a-news-single__content blockquote > *:first-child {
	margin-top: 0;
}

.a-news-single__content blockquote > *:last-child {
	margin-bottom: 0;
}

/* WordPress editor alignment classes (floats collapse to full width on
 * phones so a floated image can never overflow the column). */
.a-news-single__content .alignleft {
	float: left;
	max-width: 50%;
	margin: var(--space-2) var(--space-5) var(--space-4) 0;
}

.a-news-single__content .alignright {
	float: right;
	max-width: 50%;
	margin: var(--space-2) 0 var(--space-4) var(--space-5);
}

.a-news-single__content .aligncenter {
	display: block;
	float: none;
	margin-inline: auto;
}

@media (max-width: 767px) {
	.a-news-single__content .alignleft,
	.a-news-single__content .alignright {
		float: none;
		max-width: 100%;
		margin-inline: auto;
	}
}

/* -------------------------------------------------------------------- */
/* Tags                                                                  */
/* -------------------------------------------------------------------- */
.a-news-single__tags {
	margin-top: var(--space-7);
	padding-top: var(--space-5);
	border-top: var(--border-w) solid var(--border);
}

.a-news-single__tags-title {
	margin: 0 0 var(--space-3);
	font-family: var(--font-display);
	font-size: var(--fs-caption);
	font-weight: var(--fw-semibold);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-secondary);
}

.a-news-single__tags-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.a-news-single__tag {
	display: inline-flex;
	align-items: center;
	padding: var(--space-1) var(--space-3);
	background-color: var(--bg-muted);
	color: var(--text-primary);
	font-size: var(--fs-small);
	text-decoration: none;
	transition: background-color var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
	.a-news-single__tag:hover {
		background-color: var(--c-ink-100);
	}
}

/* -------------------------------------------------------------------- */
/* Sidebar                                                               */
/* -------------------------------------------------------------------- */
.a-news-single__aside {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	min-width: 0;
}

@media (min-width: 1200px) {
	.a-news-single__aside {
		position: sticky;
		/* Clear the reveal-sticky header (~60px tall once pinned) with a gap. */
		top: calc(var(--space-8) + var(--space-5));
	}
}

.a-news-single__panel {
	padding: var(--space-5);
	background-color: var(--bg);
	border: var(--border-w) solid var(--border);
}

.a-news-single__panel-title {
	margin: 0 0 var(--space-4);
	font-family: var(--font-display);
	font-size: var(--fs-h4); /* 18px */
	font-weight: var(--fw-semibold);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-secondary);
}

/* The share component (share-buttons.php) is restyled as a 4-up button row.
 * main.css gives `.social-share ul { overflow: hidden }`, which clips the top
 * 1px border of the first row of buttons; overflow is reset to visible so the
 * full frame is drawn. */
.a-news-single__panel .social-share ul {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow: visible;
}

.a-news-single__panel .social-share li {
	display: flex;
	margin: 0;
}

.a-news-single__panel .social-share a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	border: var(--border-w) solid var(--c-ink-100);
	transition:
		border-color var(--dur-press) var(--ease-out),
		background-color var(--dur-press) var(--ease-out);
}

.a-news-single__panel .social-share img {
	display: block;
	width: 22px;
	height: 22px;
}

@media (hover: hover) and (pointer: fine) {
	.a-news-single__panel .social-share a:hover {
		background-color: var(--bg-muted);
		border-color: var(--c-ink-300);
	}
}

.a-news-single__all {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	border: var(--border-w) solid var(--border);
	font-family: var(--font-display);
	font-size: var(--fs-small);
	font-weight: var(--fw-semibold);
	color: var(--text-primary);
	text-decoration: none;
	transition:
		border-color var(--dur-press) var(--ease-out),
		color var(--dur-press) var(--ease-out);
}

.a-news-single__all-arrow {
	transition: transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
	.a-news-single__all:hover {
		border-color: var(--c-ink-300);
		color: var(--link-hover);
	}

	.a-news-single__all:hover .a-news-single__all-arrow {
		transform: translateX(3px);
	}
}

/* -------------------------------------------------------------------- */
/* Sidebar: related news (brand-scoped, compact list)                    */
/* -------------------------------------------------------------------- */
/* Sits in the sidebar under the share panel and the "all news" link, so it
 * reuses the panel chrome and the panel title. */
.a-news-single__related-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	margin: 0;
	padding: 0;
	list-style: none;
}

.a-news-single__related-card {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	gap: var(--space-3);
	align-items: start;
	color: inherit;
	text-decoration: none;
}

.a-news-single__related-media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background-color: var(--bg-muted);
}

.a-news-single__related-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--dur-overlay) var(--ease-out);
}

.a-news-single__related-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-width: 0;
}

.a-news-single__related-date {
	font-size: var(--fs-caption);
	color: var(--text-secondary);
	font-variant-numeric: tabular-nums;
}

.a-news-single__related-title {
	font-family: var(--font-display);
	font-size: var(--fs-small);
	font-weight: var(--fw-semibold);
	line-height: 1.35;
	color: var(--text-primary);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
	.a-news-single__related-card:hover .a-news-single__related-img {
		transform: scale(1.04);
	}

	.a-news-single__related-card:hover .a-news-single__related-title {
		color: var(--link-hover);
	}
}

/* -------------------------------------------------------------------- */
/* Reduced motion                                                       */
/* -------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.a-news-single__tag,
	.a-news-single__all,
	.a-news-single__all-arrow,
	.a-news-single__related-img,
	.a-news-single__panel .social-share a {
		transition-duration: 0.01ms;
	}

	.a-news-single__all:hover .a-news-single__all-arrow {
		transform: none;
	}

	.a-news-single__related-card:hover .a-news-single__related-img {
		transform: none;
	}
}
