/* ── Article layout ──────────────────────────────────────────────────────────
   Long-form reading pages. Loaded after pico.min.css and site.css.
   Keeps the product chrome; replaces the landing-page rhythm with an
   editorial column that happens to sit on containd.app.
   ────────────────────────────────────────────────────────────────────────── */

:root {
	/* Text column sized to land near 68 characters per line at 18.5px, which is
	   the middle of the measured range: jvns.ca 55, Stripe blog 69. Wide figures
	   add one step (~1.3x) and never exceed the 1100px site container. */
	--article-measure: 33rem;
	--article-wide: 40rem;
	--article-ink: #1d274d;
	--article-ink-soft: rgba(29, 39, 77, 0.66);
	--article-rule: rgba(29, 39, 77, 0.14);
	--article-paper: #fbfaf7;
	--article-accent: #ff832e;
}

body.article-page {
	background: var(--article-paper);
	color: var(--article-ink);
	font-family: "Source Sans 3", system-ui, sans-serif;
	/* pico's root scales 16px → 21px with viewport, so pin reading text in px */
	font-size: clamp(16.5px, 0.55vw + 13.6px, 18.5px);
	line-height: 1.72;
	-webkit-font-smoothing: antialiased;
}

body.article-page h1,
body.article-page h2,
body.article-page h3 {
	font-family: Quicksand, system-ui, sans-serif;
	letter-spacing: -0.021em;
	color: var(--article-ink);
	font-weight: 700;
}

/* pico renders every <article> as a grey card (background, 20px padding,
   radius, shadow). On a reading page that paints a full-page grey slab behind
   the text column. Reset it before any article styling applies. */

body.article-page article {
	background: transparent;
	padding: 0;
	margin: 0;
	border-radius: 0;
	box-shadow: none;
}

/* Progress rail ------------------------------------------------------------ */

.article-progress {
	position: fixed;
	inset: 0 auto auto 0;
	height: 3px;
	width: 0;
	background: var(--article-accent);
	z-index: 60;
	transition: width 90ms linear;
}

/* Masthead ---------------------------------------------------------------- */

.article-head {
	max-width: var(--article-measure);
	margin: 0 auto;
	padding: 3.4rem 1.25rem 0;
}

.article-kicker {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 1.05rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	text-transform: uppercase;
	color: #2a5b84;
}

.article-kicker::before {
	content: "";
	width: 1.6rem;
	height: 2px;
	background: var(--article-accent);
	flex: none;
}

.article-head h1 {
	margin: 0 0 1rem;
	font-size: clamp(31px, 2.6vw + 20px, 53px);
	line-height: 1.1;
}

.article-deck {
	margin: 0 0 1.6rem;
	font-size: clamp(17.5px, 0.75vw + 14px, 21px);
	line-height: 1.55;
	color: var(--article-ink-soft);
	max-width: 34rem;
}

.article-byline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.85rem;
	margin: 0;
	padding: 0.9rem 0 1.5rem;
	border-bottom: 1px solid var(--article-rule);
	font-size: 0.86rem;
	color: var(--article-ink-soft);
}

.article-byline .dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.55;
}

/* Body -------------------------------------------------------------------- */

.article-body {
	max-width: var(--article-measure);
	margin: 0 auto;
	padding: 0 1.25rem 3rem;
}

.article-body > * {
	margin-block: 0;
}

.article-body > * + * {
	margin-top: 1.15rem;
}

.article-body > p:first-of-type {
	margin-top: 2rem;
	font-size: 1.055em;
	line-height: 1.66;
	color: #23305c;
}

.article-body h2 {
	margin-top: 2.6rem;
	margin-bottom: 0.25rem;
	font-size: clamp(22px, 0.9vw + 15px, 27px);
	line-height: 1.24;
}

.article-body h2 + p {
	margin-top: 0.55rem;
}

.article-body h3 {
	margin-top: 1.9rem;
	font-size: 1.12rem;
	letter-spacing: -0.01em;
}

.article-body a {
	color: #2a5b84;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	text-decoration-color: rgba(42, 91, 132, 0.35);
}

.article-body a:hover,
.article-body a:focus-visible {
	color: #16324a;
	text-decoration-color: currentColor;
}

.article-body strong {
	font-weight: 700;
	color: #16203f;
}

.article-body ul,
.article-body ol {
	padding-left: 1.15rem;
}

.article-body li + li {
	margin-top: 0.45rem;
}

.article-body li::marker {
	color: #2a5b84;
}

.article-body code {
	font-size: 0.9em;
	background: rgba(29, 39, 77, 0.06);
	border-radius: 4px;
	padding: 0.1em 0.34em;
}

/* Pull quote -------------------------------------------------------------- */

.article-body blockquote {
	margin: 2.1rem 0;
	padding: 0 0 0 1.15rem;
	border-left: 3px solid var(--article-accent);
	font-family: Quicksand, system-ui, sans-serif;
	font-size: 1.22rem;
	line-height: 1.45;
	font-weight: 600;
	color: #16203f;
}

.article-body blockquote p {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

.article-body blockquote footer {
	margin-top: 0.6rem;
	font-family: "Source Sans 3", system-ui, sans-serif;
	font-size: 0.85rem;
	font-weight: 400;
	color: var(--article-ink-soft);
}

/* Figures ------------------------------------------------------------------
   Pick the tier from the asset's aspect ratio, not by taste:

     ratio >= 1.4   landscape   -> .article-figure--wide    ~1.3x the text column
     ratio 1.0-1.4  landscape   -> .article-figure          the text column
     ratio < 1.0    tall        -> .article-figure--portrait  capped by HEIGHT

   Vertical assets are sized by height, with width left auto. Constraining a
   9:16 screenshot to a pixel width is what turns a phone screen into a
   1000px tower in the middle of a paragraph. `tools/check_figures.py` verifies
   the tier matches the file's real dimensions.
   ------------------------------------------------------------------------- */

.article-figure {
	margin: 2.1rem 0;
}

.article-figure img,
.article-figure .article-video {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
	border: 1px solid var(--article-rule);
	background: #fff;
}

.article-figure--wide {
	width: var(--article-wide);
	max-width: calc(100vw - 2.5rem);
	margin-left: 50%;
	transform: translateX(-50%);
}

/* Tall screenshots: the height decides, the width follows. */
.article-figure--portrait {
	text-align: center;
}

.article-figure--portrait img {
	width: auto;
	max-width: min(100%, 20rem);
	max-height: clamp(320px, 50vh, 600px);
	margin-inline: auto;
}

/* Small inline graphics (icons, thumbnails, single UI crops). */
.article-figure--narrow {
	max-width: 18rem;
	margin-inline: auto;
}

.article-figure--narrow img {
	width: 100%;
	margin-inline: auto;
}

.article-figure figcaption {
	margin-top: 0.65rem;
	font-size: 0.83rem;
	line-height: 1.5;
	color: var(--article-ink-soft);
}

.article-figure--narrow figcaption,
.article-figure--portrait figcaption {
	max-width: 27rem;
	margin-inline: auto;
	text-align: left;
}

@media (max-width: 720px) {
	.article-figure--portrait img {
		max-width: min(100%, 82vw);
		max-height: 62vh;
	}
}

/* Hero video --------------------------------------------------------------
   The project brief puts the use-case video directly below the headline as the
   visual anchor, so it is the one figure that sits outside .article-body and
   runs at the text column width rather than edge-to-edge.

   Measured, not assumed: at 1440x900 the headline block ends at 591px, so a
   610x343 player starting at 630px finishes at 973px and pushes the first
   paragraph to 1071px. Both sit below the fold on a 900px-tall viewport. The
   video is the anchor; it is not above the fold on desktop. Only at 390x844
   does the player and the first paragraph both fit (video ends 691, text 789).
   If above-the-fold video is required on desktop, the headline block has to get
   shorter; that is a content decision, not a CSS one.
   ------------------------------------------------------------------------- */

.article-hero-video {
	max-width: var(--article-measure);
	margin: 1.9rem auto 0;
	padding: 0 1.25rem;
}

/* A page whose video is not on YouTube yet. The poster says what the video
   is; the note says it is not up. This agent never encodes or hosts a stand-in,
   so this is the correct state, not a gap to engineer around. */
.video-placeholder {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 10px;
	border: 1px solid var(--article-rule);
	background: var(--article-surface, #e0e1dd);
}
.video-placeholder img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.62;
	filter: saturate(0.85);
}
.video-placeholder-note {
	position: absolute;
	inset: auto 0 0;
	margin: 0;
	padding: 2.2rem 1rem 0.85rem;
	background: linear-gradient(transparent, rgba(10, 14, 30, 0.92));
	color: #fff;
	font-size: 0.86rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.article-hero-video figcaption {
	margin-top: 0.65rem;
	font-size: 0.83rem;
	line-height: 1.5;
	color: var(--article-ink-soft);
}

/* Video embed ------------------------------------------------------------- */

.article-video {
	position: relative;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #1d274d;
	padding: 0;
}

.article-video .home-hero-video-facade {
	display: block;
	width: 100%;
	height: 100%;
}

.article-video .home-hero-video-facade img,
.article-video iframe {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 0;
}

.article-video .home-hero-video-label {
	position: absolute;
	inset: auto 0 0;
	padding: 2rem 0.9rem 0.75rem;
	background: linear-gradient(transparent, rgba(10, 14, 30, 0.8));
	color: #fffef9;
	font-size: 0.85rem;
	font-weight: 600;
}

/* CTA block --------------------------------------------------------------- */

.article-cta {
	margin: 2.8rem 0;
	padding: 1.4rem 1.5rem;
	border: 1px solid var(--article-rule);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 1px 0 rgba(29, 39, 77, 0.03);
}

.article-cta h3 {
	margin: 0 0 0.4rem;
	font-size: 1.15rem;
}

.article-cta p {
	margin: 0;
	font-size: 0.95rem;
	color: var(--article-ink-soft);
}

.article-cta .store-download-badges {
	margin-top: 1rem;
	gap: 0.75rem;
}

.article-cta .store-download-badges img {
	height: 42px;
	width: auto;
}

/* Author note ------------------------------------------------------------- */

.article-author {
	display: flex;
	gap: 0.95rem;
	align-items: flex-start;
	max-width: var(--article-measure);
	margin: 3rem auto 0;
	padding: 1.4rem 1.25rem;
	border-top: 1px solid var(--article-rule);
	font-size: 0.92rem;
	color: var(--article-ink-soft);
}

.article-author img {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	flex: none;
	object-fit: contain;
	background: #1d274d;
	padding: 6px;
}

.article-author p {
	margin: 0;
}

.article-author strong {
	color: var(--article-ink);
}

/* Tail sections reuse the site's article conventions ---------------------- */

.article-tail {
	max-width: var(--article-wide);
	margin: 3rem auto 0;
	padding: 0 1.25rem 3rem;
}

@media (max-width: 720px) {
	.article-head {
		padding-top: 2.4rem;
	}

	.article-body > p:first-of-type {
		font-size: 1.03em;
	}

	.article-figure--wide {
		width: 100%;
		margin-left: 0;
		transform: none;
	}
}

/* Local video ------------------------------------------------------------
   The hero player is a plain <video> because the source clip is self-hosted
   (the YouTube cut is not published yet). Same 16:9 box as the embed facade,
   so swapping in a YouTube id later changes nothing about the layout.
   ------------------------------------------------------------------------- */

.article-video-local {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	background: #1d274d;
	border: 0;
	object-fit: contain;
}

/* Figure lightbox -------------------------------------------------------
   Click a figure to see it at full size on a dark backdrop. Built without a
   library: one overlay, dismissed by click, Escape, or the close button, with
   focus kept inside while open. */
.figure-lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(0.5rem, 3vw, 2.5rem);
	background: rgba(8, 12, 20, 0.93);
	opacity: 0;
	transition: opacity 140ms ease-out;
}
.figure-lightbox[hidden] {
	display: none;
}
.figure-lightbox.is-open {
	opacity: 1;
}
.figure-lightbox img {
	max-width: 100%;
	max-height: calc(100vh - 2 * clamp(0.5rem, 3vw, 2.5rem));
	width: auto;
	height: auto;
	border-radius: 8px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
	background: #fff;
	cursor: zoom-out;
}
.figure-lightbox figcaption {
	position: absolute;
	left: 50%;
	bottom: clamp(0.5rem, 2vw, 1.25rem);
	transform: translateX(-50%);
	max-width: min(70ch, calc(100vw - 3rem));
	margin: 0;
	padding: 0.45rem 0.75rem;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.6);
	color: #e6e9ee;
	font-size: 0.82rem;
	line-height: 1.45;
	text-align: center;
}
.figure-lightbox-close {
	position: absolute;
	top: clamp(0.5rem, 2vw, 1rem);
	right: clamp(0.5rem, 2vw, 1rem);
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
}
.figure-lightbox-close:hover,
.figure-lightbox-close:focus-visible {
	background: rgba(255, 255, 255, 0.18);
}
/* A zoom affordance, but only where the lightbox script has run. This
   stylesheet is shared, so an unconditional cursor would promise a zoom on
   pages that do not load the script. */
.has-lightbox .article-figure img {
	cursor: zoom-in;
}
@media (prefers-reduced-motion: reduce) {
	.figure-lightbox {
		transition: none;
	}
}


/* Canvas embeds -----------------------------------------------------------
   containd.space share canvases, framed so a reader can pan and zoom the
   actual list without leaving the article. The wrapper crops nothing and is
   locked to the embed's own 4:3 manifest aspect via aspect-ratio, so the pane
   never shifts when data loads. */
.article-cse {
	margin: 2.1rem 0;
	border: 1px solid var(--article-rule);
	border-radius: 12px;
	overflow: hidden;
	background: #e0e1dd; /* the viewer's own page background */
}
.article-cse .cse-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	max-height: min(75vh, 560px);
}
/* When the aspect-ratio would exceed the max height, keep the frame at the
   height cap and centre the narrower iframe inside it. */
@supports (aspect-ratio: 4 / 3) {
	.article-cse .cse-frame iframe {
		position: absolute;
		inset: 50% auto auto 50%;
		transform: translate(-50%, -50%);
		width: min(100%, calc(min(75vh, 560px) * 4 / 3));
		height: min(100%, min(75vh, 560px) * 3 / 4);
		border: 0;
	}
}
.article-cse figcaption {
	padding: 0.65rem 0.9rem 0.75rem;
	font-size: 0.83rem;
	line-height: 1.5;
	color: #4b5563;
	border-top: 1px solid var(--article-rule);
	background: #fff;
}
.article-cse figcaption .cse-link {
	color: var(--blue);
	text-decoration: none;
	font-weight: 600;
}
.article-cse figcaption .cse-link:hover {
	text-decoration: underline;
}
.print-only-note {
	display: none;
}
@media print {
	.article-cse .cse-frame {
		display: none;
	}
	.print-only-note {
		display: block;
		margin: 0.65rem 0.9rem 0.75rem;
		font-size: 0.83rem;
		color: #4b5563;
	}
}

/* Link-card variant: for shares that are public but not embeddable. Renders
   as a compact card, not a frame, and needs no third-party iframe. */
.article-cse--link { max-width: 26rem; margin-inline: auto; }
.article-cse--link .cse-card { position: relative; display: block; }
.article-cse--link .cse-card img { display: block; width: 100%; height: auto; }
.article-cse--link .cse-card-hint {
	position: absolute;
	left: 50%;
	bottom: 0.75rem;
	transform: translateX(-50%);
	padding: 0.4rem 0.8rem;
	border-radius: 999px;
	background: rgba(29, 39, 77, 0.85);
	color: #fff;
	font-size: 0.82rem;
	white-space: nowrap;
}


/* Video facade ------------------------------------------------------------
   A local poster with a play button. The YouTube iframe is only created on
   click, so the page loads no third-party player or cookie up front. */
.video-facade {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 10px;
	border: 1px solid var(--article-rule);
	background: #1d274d;
	cursor: pointer;
}
.video-facade img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.video-facade .video-play {
	position: absolute;
	inset: 50% auto auto 50%;
	transform: translate(-50%, -50%);
	width: 4.4rem;
	height: 4.4rem;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 131, 46, 0.95);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
	transition: transform 120ms ease-out, background-color 120ms ease-out;
}
.video-facade .video-play svg {
	width: 1.9rem;
	height: 1.9rem;
	fill: currentColor;
	margin-left: 0.18rem; /* optically centre the triangle */
}
.video-facade:hover .video-play,
.video-facade .video-play:focus-visible {
	background: var(--accent, #ff832e);
	transform: translate(-50%, -50%) scale(1.06);
}
/* Top-right: the site cookie notice is fixed to the bottom of the viewport at
   z-index 80 and covers a bottom-anchored badge on first load. */
.video-facade .video-meta {
	position: absolute;
	right: 0.75rem;
	top: 0.75rem;
	padding: 0.25rem 0.6rem;
	border-radius: 999px;
	background: rgba(29, 39, 77, 0.82);
	color: #fff;
	font-size: 0.78rem;
	letter-spacing: 0.01em;
}
.video-facade .video-embed,
.video-facade iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
@media (prefers-reduced-motion: reduce) {
	.video-facade .video-play { transition: none; }
}
