/* Shared editorial news cards, archives and articles, frontend and Gutenberg.
 * Legacy news classes remain valid for previously saved blocks.
 * The established shell in layout.css owns horizontal padding on wide sections.
 */
.ubc-editorial {
	--ubc-editorial-title: var(--ubc-type-title);
	--ubc-editorial-section: var(--ubc-type-section);
	--ubc-editorial-card-title: var(--ubc-type-card);
	--ubc-editorial-gap: clamp(1.25rem, 2.5vw, 2rem);
	--ubc-editorial-link: var(--ubc-purple-ink);
	color: var(--ubc-ink);
	font-size: 1rem;
	line-height: 1.6;
}

.ubc-editorial :is(h1, h2, h3) {
	font-family: var(--ubc-display);
	font-weight: 400;
	letter-spacing: 0;
	text-wrap: pretty;
	hyphens: none;
	overflow-wrap: anywhere;
}

.ubc-editorial a {
	text-underline-offset: 0.25em;
	text-decoration-thickness: 1px;
	transition: color 160ms ease;
}

.ubc-editorial a:focus-visible {
	outline: 2px solid var(--ubc-editorial-link);
	outline-offset: 4px;
}

.ubc-editorial-masthead {
	background: var(--ubc-paper);
	margin-block: 0;
	padding-block: clamp(2rem, 4vw, 3.5rem) 0;
}

.ubc-editorial-masthead h1,
.ubc-editorial-article-header h1 {
	font-size: var(--ubc-editorial-title);
	line-height: 1.06;
	margin: 0;
	max-width: 32ch;
}

.ubc-editorial-intro,
.ubc-editorial-standfirst {
	font-family: var(--ubc-body);
	font-size: clamp(1.125rem, 1.6vw, 1.25rem);
	line-height: 1.6;
	margin-block: 1rem 0;
	max-width: 68ch;
}

.ubc-editorial-intro p { margin: 0; }

.ubc-editorial-topics {
	border-bottom: 1px solid var(--ubc-line);
	gap: 0.25rem 1.5rem;
	margin-top: 1.5rem;
	padding-bottom: 0.75rem;
}

.ubc-editorial-topics p { margin: 0; }
.ubc-editorial-topics a {
	align-items: center;
	border-bottom: 2px solid transparent;
	color: var(--ubc-muted);
	display: inline-flex;
	font-family: var(--ubc-body);
	font-size: 1rem;
	min-height: 44px;
	text-decoration: none;
}
.ubc-editorial-topics a:is(:hover, :focus-visible, [aria-current="page"]) {
	border-bottom-color: var(--ubc-editorial-link);
	color: var(--ubc-ink);
}
.ubc-editorial-topics a[aria-current="page"] { font-weight: 600; }

.ubc-editorial-archive { margin-block-start: 0; padding-block: 2rem clamp(3rem, 6vw, 5rem); }
.ubc-editorial-latest { padding: clamp(3rem, 6vw, 5rem) var(--ubc-shell-gutter); }
.ubc-editorial-section-heading { gap: 1rem; margin-bottom: 1.75rem; }
.ubc-editorial-section-heading :is(h2, p) { margin: 0; }
.ubc-editorial-section-heading h2,
.ubc-editorial-related > .alignwide > h2 { font-size: var(--ubc-editorial-section); line-height: 1.08; }
.ubc-editorial-section-heading a { color: var(--ubc-ink); font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }

.ubc-editorial .ubc-editorial-query { width: 100%; max-width: none; margin-top: 0; }
.ubc-editorial .ubc-editorial-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2.5rem var(--ubc-editorial-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}
.ubc-editorial-grid > li { min-width: 0; margin: 0; }
.ubc-editorial-card {
	background: var(--ubc-surface);
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
}
.ubc-editorial-image {
	aspect-ratio: 16 / 10;
	margin: 0;
	overflow: hidden;
	background: var(--ubc-black);
}
.ubc-editorial-image a { display: block; width: 100%; height: 100%; }
.ubc-editorial-image img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 240ms ease-out; }
.ubc-editorial-image-fallback a { color: var(--ubc-on-dark); display: flex; align-items: center; justify-content: center; font-family: var(--ubc-display); font-size: 2rem; text-decoration: none; }
.ubc-editorial-image a:focus-visible { outline-color: var(--ubc-blue); outline-offset: -5px; }

.ubc-editorial-card-copy {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0;
	margin: 0;
	padding: 1.25rem;
}
.ubc-editorial-meta {
	color: var(--ubc-muted);
	font-family: var(--ubc-body);
	font-size: 0.875rem;
	gap: 0.25rem 0.75rem;
	line-height: 1.5;
	margin: 0;
}
.ubc-editorial-meta a { color: inherit; text-decoration: none; font-weight: 600; }
.ubc-editorial-meta a:hover { text-decoration: underline; }
.ubc-editorial-meta .wp-block-post-terms__separator { white-space: pre; }
.ubc-editorial .ubc-editorial-card-title {
	font-size: var(--ubc-editorial-card-title);
	line-height: 1.12;
	margin: 0.75rem 0;
}
.ubc-editorial-card-title a { color: var(--ubc-ink); text-decoration: none; }
.ubc-editorial-card-title a:is(:hover, :focus-visible) { color: var(--ubc-editorial-link); text-decoration: underline; }
.ubc-editorial-excerpt { display: flex; flex: 1; flex-direction: column; margin: 0; font-size: 1rem; line-height: 1.6; }
.ubc-editorial-excerpt .wp-block-post-excerpt__excerpt { margin: 0 0 1.25rem; }
.ubc-editorial-excerpt .wp-block-post-excerpt__more-text { margin: auto 0 0; }
.ubc-editorial-excerpt .wp-block-post-excerpt__more-link { display: inline-flex; min-height: 44px; align-items: center; color: var(--ubc-ink); font-family: var(--ubc-body); font-weight: 600; }
.ubc-editorial-excerpt .wp-block-post-excerpt__more-link:hover { color: var(--ubc-editorial-link); }

.ubc-editorial-pagination { border-top: 1px solid var(--ubc-line); gap: 1rem; margin-top: 2.5rem; padding-top: 1.25rem; font-size: 1rem; }
.ubc-editorial-pagination :is(a, .page-numbers) { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--ubc-ink); }
.ubc-editorial-pagination .current { background: var(--ubc-ink); color: var(--ubc-paper); border-radius: var(--ubc-radius); }
.ubc-editorial-pagination a:hover { color: var(--ubc-editorial-link); }

.ubc-editorial-article { background: var(--ubc-paper); margin-block-start: 0; }
.ubc-editorial > .alignwide {
	width: 100%;
	max-width: var(--ubc-shell-size) !important;
	margin-inline: auto !important;
	padding-inline: var(--ubc-shell-gutter) !important;
}
.ubc-editorial-article-header { padding-block: clamp(2rem, 4vw, 3rem) 2rem; margin: 0; }
.ubc-editorial-back { margin: 0 0 1.25rem; font-family: var(--ubc-body); font-size: 0.875rem; }
.ubc-editorial-back a { color: var(--ubc-muted); display: inline-flex; min-height: 44px; align-items: center; }
.ubc-editorial-article-header .ubc-editorial-meta { margin-top: 1rem; }
.ubc-editorial-standfirst .wp-block-post-excerpt__excerpt { margin: 0; }
.ubc-editorial-featured-image { margin-block: 0; }
.ubc-editorial-featured-image img { display: block; width: 100%; height: auto; max-height: 680px; object-fit: contain; object-position: left center; }
.ubc-editorial-body { padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem); }
.ubc-editorial-content { font-family: var(--ubc-body); font-size: 1.125rem; line-height: 1.72; }
.ubc-editorial-content > :not(.alignwide):not(.alignfull) { max-width: 68ch; margin-inline: 0 auto; }
.ubc-editorial-content > * + * { margin-block-start: 1.25rem; }
.ubc-editorial-content > :first-child { margin-top: 0; }
.ubc-editorial-content :is(h2, h3) { line-height: 1.15; margin-block: 2.5rem 1rem; }
.ubc-editorial-content h2 { font-size: 2rem; }
.ubc-editorial-content h3 { font-size: 1.75rem; }
.ubc-editorial-content a { color: var(--ubc-editorial-link); }
.ubc-editorial-content :is(img, video, iframe) { max-width: 100%; }
.ubc-editorial-content img { height: auto; }
.ubc-editorial-content :is(figure, .wp-caption) { width: auto; }
/* Historical Classic-block captions keep their chosen width but never exceed
 * the reading column. Apply the same containment inside Gutenberg. */
:is(.ubc-editorial-content, .editor-styles-wrapper .wp-block-freeform) .wp-caption {
	max-width: min(100%, 68ch);
}
:is(.ubc-editorial-content, .editor-styles-wrapper .wp-block-freeform) .wp-block-table {
	max-width: min(100%, 68ch);
	overflow-x: auto;
}
:is(.ubc-editorial-content, .editor-styles-wrapper .wp-block-freeform) .wp-block-table:focus-visible {
	outline: 2px solid var(--ubc-purple-ink);
	outline-offset: 4px;
}
/* Classic imports also contain bare tables, not just core/table figures.
 * Keep the original cells and widths; scroll the table, never the document.
 * The render filter supplies an explicit table role and keyboard access. */
:is(.ubc-editorial-content, .editor-styles-wrapper .wp-block-freeform) table:not(.wp-block-table table) {
	display: block;
	width: 100% !important;
	max-width: 100%;
	overflow-x: auto;
}
.ubc-legacy-table:focus-visible,
[data-ubc-scroll-region]:focus-visible {
	outline: 2px solid var(--ubc-purple-ink);
	outline-offset: 4px;
}
.ubc-editorial-content :is(figcaption, .wp-caption-text) { color: var(--ubc-muted); font-size: 0.875rem; line-height: 1.5; }
.ubc-editorial-content :is(blockquote, .wp-block-quote),
.is-style-ubc-editorial-quote {
	border: 0;
	border-block: 1px solid var(--ubc-line);
	font-family: var(--ubc-body);
	font-size: clamp(1.25rem, 2vw, 1.5rem);
	line-height: 1.55;
	margin-block: 2rem;
	padding: 1.5rem 0;
}
.is-style-ubc-editorial-quote > p { font-size: inherit; line-height: inherit; }
.is-style-ubc-editorial-quote cite { display: block; color: var(--ubc-muted); font-size: 1rem; font-style: normal; margin-top: 1rem; }
.ubc-editorial-content .gallery { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ubc-editorial-content .gallery :is(.gallery-item, .gallery-item-wrapper, .gallery-icon) { margin: 0; width: auto !important; }
.ubc-editorial-content .gallery img { width: 100%; height: auto; display: block; }
.ubc-editorial-content .gallery br { display: none; }
.ubc-editorial-body > .ubc-editorial-back { margin: 2.5rem 0 0; border-top: 1px solid var(--ubc-line); padding-top: 1rem; }
.ubc-editorial-related { padding-block: 2.5rem clamp(3rem, 6vw, 5rem); border-top: 1px solid var(--ubc-line); margin: 0; }
.ubc-editorial-related > .alignwide > h2 { margin: 0 0 1.75rem; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.ubc-editorial-card:hover .ubc-editorial-image img { transform: scale(1.025); }
}
@media (prefers-color-scheme: dark) {
	.ubc-editorial { --ubc-editorial-link: var(--ubc-blue); }
}
@media (max-width: 1000px) {
	.ubc-editorial .ubc-editorial-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.ubc-editorial .ubc-editorial-grid { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
	.ubc-editorial-topics { gap: 0.25rem 1.25rem; margin-top: 1rem; }
	.ubc-editorial-masthead { padding-top: 1.75rem; }
	.ubc-editorial-archive { padding-top: 1.5rem; }
	.ubc-editorial-card-copy { padding: 1.25rem; }
	.ubc-editorial-article-header { padding-top: 1.5rem; }
	.ubc-editorial-featured-image img { max-height: none; }
	.ubc-editorial-pagination { justify-content: center; }
	.ubc-editorial-pagination .wp-block-query-pagination-numbers { order: -1; text-align: center; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.ubc-editorial *, .ubc-editorial *::before, .ubc-editorial *::after { transition: none !important; animation: none !important; }
}
