/* Article reading template, linked after articles.css on article pages and the articles hub. */
/* Article reading template: theme tokens (light keeps the colours above, dark has no red). */
@layer site {
	:root {
		--art-bg: rgb(
			245,
			247,
			251
		); /* the hero plates are drawn on this ground (#041324 by night) */
		--art-ink: rgb(23, 53, 85);
		--art-muted: rgb(83, 103, 124);
		--art-rule: rgba(23, 53, 85, 0.145099);
		--art-link: rgb(23, 53, 85);
		--art-wash: rgba(23, 53, 85, 0.039216);
		--art-surface: rgb(255, 255, 255);
		--art-shadow:
			0 6px 24px rgba(13, 57, 70, 0.121569),
			0 1px 3px rgba(13, 57, 70, 0.078432);
		--blue-secondary: rgb(196, 18, 48);
	}
	:root[data-blue-theme="dark"] {
		--art-bg: rgb(4, 19, 36);
		--art-ink: rgb(238, 244, 248);
		--art-muted: rgb(184, 200, 212);
		--art-rule: rgba(238, 244, 248, 0.14902);
		--art-link: rgb(117, 217, 204);
		--art-wash: rgba(89, 201, 189, 0.078432);
		--art-surface: rgb(13, 36, 56);
		--art-shadow:
			0 8px 28px rgba(0, 0, 0, 0.450981), 0 1px 3px rgba(0, 0, 0, 0.34902);
		--blue-secondary: rgb(89, 201, 189);
		color-scheme: dark;
	}
	@media (prefers-reduced-motion: no-preference) {
		html:has(.article-page) {
			scroll-behavior: smooth;
		}
	}
	.article-page,
	.articles-list {
		background: var(--art-bg);
		color: var(--art-ink);
	}
	.article-page :is(header, .footer),
	.articles-list :is(header, .footer) {
		border-color: var(--art-rule);
	}
	:is(.article-page .reading, .articles-list) p,
	.article-page .landing > ul li {
		color: var(--art-muted);
	}
	.article-page .reading > h1,
	.article-page .reading h2,
	.article-page .landing > h3,
	.article-page .landing > .lead,
	.article-page .landing strong,
	.article-page .landing > .answer p {
		color: var(--art-ink);
	}
	.article-page .landing a:not(.back) {
		border-block-end-color: color-mix(
			in srgb,
			var(--art-link) 45%,
			transparent
		);
	}
	.article-page .landing > .answer {
		border-inline-start: 0;
		border-radius: 12px;
		background: var(--art-wash);
	}
	/* The short answer's question repeats the title: kept for screen readers and answer engines only. */
	.article-page .landing > .answer h2 {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
	.article-page .landing > .action a {
		color: var(--art-link);
	}
	:is(.article-page, .articles-list) .preferred-source {
		border-color: color-mix(in srgb, var(--art-ink) 25%, transparent);
	}
	:is(.article-page, .articles-list) :is(a, button):focus-visible {
		outline: 2px solid var(--blue-secondary);
		outline-offset: 4px;
	}
	/* Reading measure and rhythm */
	.article-page .reading > p,
	.article-page .landing > ul,
	.article-page .reading > h2,
	.article-page .landing > h3,
	.article-page .reading > .byline,
	.article-page .reading > .essentials,
	.article-page .reading > .sources {
		max-inline-size: 560px;
		margin-inline: auto;
	}
	.article-page .reading > p,
	.article-page .landing > .answer p {
		font-size: clamp(17px, 4.5vw, 18px);
		line-height: 1.6;
		text-wrap: pretty;
		hanging-punctuation: first allow-end;
	}
	.article-page .landing > ul {
		padding-inline-start: 0;
		list-style: none;
	}
	.article-page .landing > ul li {
		line-height: 1.6;
		margin-block-end: 14px;
		position: relative;
		padding-inline-start: 1.1em;
	}
	.article-page .landing > ul li::before {
		content: "";
		position: absolute;
		inset-inline-start: 0.1em;
		inset-block-start: calc(0.8em - 2.5px);
		inline-size: 5px;
		block-size: 5px;
		border-radius: 50%;
		background: var(--art-ink);
		opacity: 0.55;
	}
	.article-page .reading h2[id] {
		scroll-margin-top: 84px;
	}
	.article-page .reading table {
		display: block;
		overflow-x: auto;
	}
	/* Header theme switch */
	:is(.article-page, .articles-list) header {
		gap: 16px;
	}
	.theme-toggle {
		margin-inline-start: auto;
		display: inline-grid;
		place-items: center;
		inline-size: 44px;
		block-size: 44px;
		padding: 0;
		border: 0;
		background: none;
		color: inherit;
		cursor: pointer;
		border-radius: 50%;
		transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
	}
	.theme-toggle:active {
		transform: scale(0.94);
	}
	.theme-toggle .i-moon,
	:root[data-blue-theme="dark"] .theme-toggle .i-sun {
		display: none;
	}
	:root[data-blue-theme="dark"] .theme-toggle .i-moon {
		display: block;
	}
	/* Particle signature: the band above the title. */
	.article-field {
		block-size: 72px;
		margin-block: 8px -4px;
		margin-inline: auto;
		max-inline-size: 760px;
	}
	/* The hub wave spans the whole centred column, 24 px or more of clear paper over the title's capitals and accents. */
	.articles-list .article-field {
		block-size: 56px;
		max-inline-size: none;
		margin-block: 20px 6px;
		margin-inline: 0;
	}
	.article-field canvas {
		display: block;
		inline-size: 100%;
		block-size: 100%;
	}
	/* Byline under the title */
	.article-page .reading > h1 {
		margin-block-end: 20px;
	}
	.byline {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		margin-block-end: 32px;
		font-size: 15px;
		line-height: 1.4;
		color: var(--art-muted);
	}
	.byline-author {
		display: inline-flex;
		align-items: center;
		gap: 12px;
		min-block-size: 44px;
		border: 0 !important;
	}
	.byline-author img {
		box-shadow: 0 0 0 1px var(--art-rule);
		border-radius: 50%;
		object-fit: cover;
	}
	.byline-author strong {
		display: block;
		color: var(--art-ink);
		font-weight: 600;
	}
	.byline-meta {
		display: flex;
		flex-wrap: wrap;
		gap: 4px 16px;
		margin: 0;
		font-size: 15px !important;
		line-height: 1.4 !important;
		font-variant-numeric: tabular-nums;
	}
	/* Hero picture and section figures: reserved by width and height, so nothing shifts. */
	.article-hero {
		display: block;
		margin-block-end: 32px;
	}
	.article-hero img,
	.article-figure img,
	.article-figure video {
		display: block;
		inline-size: 100%;
		block-size: auto;
		border-radius: 4px;
	}
	/* Particle portrait hero (article-portrait.js): the grains draw over the still picture, which stays
   for reduced motion, no script and the social card; a square on phones so the face reads. */
	.article-portrait {
		position: relative;
	}
	.article-portrait .article-hero {
		margin: 0;
	}
	.article-portrait canvas {
		position: absolute;
		inset: 0;
		inline-size: 100%;
		block-size: 100%;
	}
	.article-portrait.is-live img {
		opacity: 0;
	}
	/* By night the engraving keeps its dark ink on a light plate: light grains would read as a negative. */
	:root[data-blue-theme="dark"] .article-portrait {
		overflow: hidden;
		border-radius: 8px;
		background: rgb(244, 246, 248);
	}
	:is(.article-page .reading, .article-page) p.hero-credit a {
		white-space: nowrap;
	}
	:is(.article-page .reading, .article-page) p.hero-credit {
		margin-block: 16px 32px;
		margin-inline: 0;
		text-wrap: balance;
		font-size: 13px;
		line-height: 1.4;
		color: var(--art-muted);
	}
	@media (max-width: 640px) {
		.article-portrait .article-hero img {
			aspect-ratio: 1;
			object-fit: cover;
			object-position: 50% 50%;
		}
	}
	.article-figure {
		max-inline-size: 760px;
		margin-block: 32px;
		margin-inline: auto;
	}
	.article-figure figcaption {
		margin-block-start: 10px;
		text-wrap: balance;
		font-size: 14px;
		line-height: 1.5;
		color: var(--art-muted);
		text-align: center;
	}
	/* L'essentiel: the answer-first points under the short answer */
	.essentials {
		margin-block-end: 40px;
	}
	.essentials h2 {
		font-size: 17px !important;
		font-weight: 600;
		margin-block: 0 12px !important;
		margin-inline: 0 !important;
		letter-spacing: 0;
	}
	.essentials ul {
		margin: 0;
		padding: 0;
		list-style: none;
		display: grid;
		gap: 10px;
	}
	.essentials li {
		position: relative;
		padding-inline-start: 22px;
		font-size: 17px;
		line-height: 1.55;
		color: var(--art-ink);
	}
	.essentials li::before {
		content: "";
		position: absolute;
		inset-inline-start: 2px;
		inset-block-start: 0.62em;
		inline-size: 7px;
		block-size: 7px;
		border-radius: 50%;
		background: var(--blue-secondary);
	}
	/* Citations and sources */
	.cite {
		font-size: 0.68em;
		font-weight: 600;
		line-height: 0;
	}
	.cite a {
		padding-block: 0;
		padding-inline: 1px;
		border: 0 !important;
		color: var(--blue-secondary);
	}
	.sources {
		margin-block-start: 56px;
		padding-block-start: 24px;
		border-block-start: 1px solid var(--art-rule);
	}
	.sources h2 {
		font-size: 22px !important;
		margin-block: 0 14px !important;
		margin-inline: 0 !important;
	}
	.sources ol {
		margin: 0;
		padding-inline-start: 1.6em;
		font-size: 15px;
		line-height: 1.55;
		color: var(--art-muted);
	}
	.sources li {
		padding-block: 6px;
		padding-inline: 0;
		scroll-margin-top: 84px;
		overflow-wrap: anywhere;
	}
	.src-pub {
		color: var(--art-ink);
		font-weight: 600;
	}
	/* Reading progress */
	.read-progress {
		position: fixed;
		inset-block: 0 auto;
		inset-inline: 0;
		block-size: 3px;
		z-index: 30;
		pointer-events: none;
	}
	.read-progress span {
		display: block;
		block-size: 100%;
		background: var(--blue-secondary);
		transform: scaleX(0);
		transform-origin: 0 50%;
		will-change: transform;
	}
	/* One reading column: title, byline, hero, text and figures share one left edge and one measure. */
	.article-page .reading {
		max-inline-size: 560px;
		margin-block: 0;
		margin-inline: auto;
	}
	.article-page .reading > * {
		margin-inline: 0;
		max-inline-size: none;
	}
	.article-page .reading > h1 {
		font-size: clamp(32px, 4.6vw, 48px);
		line-height: 1.1;
	}
	.article-page .back {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-block-size: 44px;
		border: 0;
	}
	@media (hover: hover) and (pointer: fine) {
		.article-page .back:hover {
			text-decoration: underline;
			text-underline-offset: 4px;
		}
	}
	.article-page .reading > .article-field {
		block-size: 48px;
		margin-block: 0 12px;
		margin-inline: 0;
	}
	.article-page .reading > h1 {
		margin-block-start: 0;
	}
	.article-page main {
		padding-block-start: 32px;
	}
	@media (max-width: 1099px) {
		.article-page main > .back {
			margin-inline-start: max(0px, calc((100% - 560px) / 2));
		}
	}
	@media (max-width: 900px) {
		:is(.article-page, .articles-list) header {
			padding-block: 4px;
			padding-inline: 24px;
			min-block-size: 52px;
			border-block-end: 0;
		}
		.article-page main {
			padding-block-start: 8px;
		}
		.article-page .reading > .article-field {
			block-size: 32px;
			margin-block-end: 4px;
		}
		.byline {
			margin-block-end: 12px;
		}
	}
	@media (max-width: 360px) {
		:is(.article-page, .articles-list) header {
			gap: 4px;
			padding-inline: 16px;
		}
		:is(.article-page, .articles-list) main {
			padding-inline: 16px;
		}
		:is(.article-page, .articles-list) .brand {
			font-size: 16px;
			letter-spacing: 0.18em;
		}
		:is(.article-page, .articles-list) header a:last-child {
			font-size: 12.5px;
			white-space: nowrap;
			max-inline-size: none;
		}
	}
	/* Header: the article in each language, the theme switch, then the offer as the one filled button. */
	.langs {
		display: flex;
		margin-inline-start: auto;
	}
	header .langs a {
		display: grid;
		place-items: center;
		justify-content: center;
		max-inline-size: none;
		min-inline-size: 32px;
		min-block-size: 44px;
		font-size: 13px;
		color: var(--art-muted);
	}
	.langs a[aria-current="page"] {
		color: var(--art-ink);
		font-weight: 600;
	}
	.langs + .theme-toggle {
		margin-inline-start: 0;
	}
	/* The home's primary call to action (blue-buttons.css): the colour's matte 155° drift, a darker hairline, a soft shadow. */
	:is(.article-page, .articles-list) header a.header-cta {
		--btn: var(--blue-secondary);
		--btn-drift: 26%;
		display: inline-flex;
		align-items: center;
		min-block-size: 40px;
		padding-block: 0;
		padding-inline: 18px;
		border-radius: 6px;
		background-color: var(--btn);
		background-image: linear-gradient(
			155deg,
			color-mix(in oklab, var(--btn), white 10%) 0%,
			var(--btn) 55%,
			color-mix(in oklab, var(--btn), rgb(138, 106, 51) var(--btn-drift)) 100%
		);
		border: 1px solid color-mix(in oklab, var(--btn), black 14%);
		box-shadow: 0 1px 2px color-mix(in oklab, var(--btn) 22%, transparent);
		color: rgb(255, 255, 255);
		font-size: 14px;
		font-weight: 500;
	}
	:root[data-blue-theme="dark"]
		:is(.article-page, .articles-list)
		header
		a.header-cta {
		--btn-drift: 10%;
		color: rgb(3, 19, 33);
	}
	@media (max-width: 640px) {
		:is(.article-page, .articles-list) header a.header-cta {
			display: none;
		}
		.theme-toggle {
			margin-inline-end: -12px;
		}
		.article-page .landing > .answer {
			padding: 16px;
		}
		.articles-list .copy {
			padding-inline: 0;
		}
	}
	.read-progress {
		background: color-mix(in srgb, var(--art-ink) 8%, transparent);
	}
	.articles-list main {
		max-inline-size: 944px;
	}
	/* A painting keeps its clean edge and shows whole on phones; only the Leo XIV particle portrait melts into the page ground. */
	.article-portrait .article-hero img,
	.articles-list .art img[src*="leo-xiv-portrait"] {
		mask-image:
			linear-gradient(
				90deg,
				rgba(0, 0, 0, 0),
				rgb(0, 0, 0) 8% 97%,
				rgba(0, 0, 0, 0)
			),
			linear-gradient(rgba(0, 0, 0, 0), rgb(0, 0, 0) 6% 94%, rgba(0, 0, 0, 0));
		mask-composite: intersect;
	}
	:root[data-blue-theme="dark"]
		:is(.article-portrait .article-hero, .articles-list .art)
		img[src*="leo-xiv-portrait"] {
		mask-image: none;
	}
	.articles-list .art {
		background: transparent;
	}
}
