/*
 * A single Journal article (the "jl-post" group in templates/single.html).
 *
 * Every part is a core block fed by the post being read: its category and
 * date (Post Terms, Post Date), the title (Post Title, the page's H1), the
 * reading time and author (Time to Read, Post Author Name), the lead image
 * (Featured Image, with its Media Library caption added by inc/journal.php),
 * the article itself (Post Content) and a short note on the author (Avatar,
 * Post Author Name, Post Author Biography from the author's Profile).
 *
 * The article is set in one 645px reading column in the left third of a
 * twelve-column grid, the rest left empty. Images aligned "wide" reach
 * further, "full" across the grid. Everything a writer can add in the editor
 * is styled here: paragraphs, headings, lists, links, quotes, images with
 * captions, separators, tables and the "Note" paragraph style.
 *
 * Colours, fonts and edge spacing come from the theme. The reveal only runs
 * once the script is running (html.jl-js).
 */

.jl-post.jl-post {
	--ps-pad: 48px;
	--ps-gap: 24px;
	--ps-inner: clamp(72px, 10vh, 112px);
	--ps-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	margin-block: 0;
	padding: 120px var(--ps-pad) 0;
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* WordPress spaces out a Group's children; every part here sets its own spacing. */
.jl-post.jl-post > *,
.jl-post .jl-post__opener > *,
.jl-post .jl-post__byline > *,
.jl-post .jl-post__body > *,
.jl-post .jl-post__content > *,
.jl-post .jl-author > *,
.jl-post .jl-author__text > * {
	margin-block: 0;
}

/* ---------- Category, title and byline ---------- */

.jl-post .jl-post__title {
	max-width: 1100px;
	margin-top: 28px;
	font-size: clamp(3rem, 6vw, 5.75rem);
	letter-spacing: -0.03em;
	line-height: 1.02;
	text-wrap: balance;
}

.jl-post .jl-post__byline {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 10px;
	margin-top: 32px;
	color: var(--wp--preset--color--accent-4);
	font-size: 1rem;
	line-height: 1.5;
}

.jl-post .jl-post__byline .wp-block-post-time-to-read::after {
	content: "·";
	margin-left: 10px;
}

/* "By" and the name read as one phrase. */
.jl-post .jl-post__byline .jl-post__by + * {
	margin-left: -5px;
}

/* ---------- Lead image ---------- */

.jl-post .jl-post__lead {
	margin-top: var(--ps-inner);
}

.jl-post .jl-post__lead img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 2 / 1;
	object-fit: cover;
	background: color-mix(in srgb, var(--wp--preset--color--accent-1) 30%, var(--wp--preset--color--accent-5));
}

.jl-post figcaption,
.jl-post .wp-element-caption {
	margin: 14px 0 0;
	color: var(--wp--preset--color--accent-4);
	font-size: 0.875rem;
	line-height: 1.45;
	text-align: left;
}

/* ---------- The article ---------- */

.jl-post .jl-post__body {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	column-gap: var(--ps-gap);
	padding-top: var(--ps-inner);
}

.jl-post .jl-post__content {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	column-gap: var(--ps-gap);
	row-gap: 24px;
}

.jl-post .jl-post__content > * {
	grid-column: 3 / span 6;
	min-width: 0;
	max-width: 645px;
}

.jl-post .jl-post__content > .alignwide {
	grid-column: 2 / span 10;
	max-width: none;
}

.jl-post .jl-post__content > .alignfull {
	grid-column: 1 / -1;
	max-width: none;
}

.jl-post .jl-post__content p,
.jl-post .jl-post__content li {
	font-size: 1.125rem;
	line-height: 1.65;
	text-wrap: pretty;
}

.jl-post .jl-post__content ul,
.jl-post .jl-post__content ol {
	margin: 0;
	padding-left: 1.25em;
}

.jl-post .jl-post__content ol {
	padding-left: 1.4em;
}

.jl-post .jl-post__content li {
	padding-left: 6px;
	line-height: 1.6;
}

.jl-post .jl-post__content li + li {
	margin-top: 10px;
}

.jl-post .jl-post__content h2 {
	margin-top: 32px;
	font-size: 2.25rem;
	letter-spacing: -0.02em;
	line-height: 1.1;
	text-wrap: balance;
}

.jl-post .jl-post__content h3 {
	margin-top: 16px;
	font-size: 1.5rem;
	letter-spacing: -0.015em;
	line-height: 1.2;
}

.jl-post .jl-post__content h4 {
	margin-top: 8px;
	font-size: 1.25rem;
	line-height: 1.25;
}

.jl-post .jl-post__content a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 4px;
	transition: color 0.3s;
}

.jl-post .jl-post__content a:hover {
	color: var(--wp--preset--color--accent-3);
}

/* Quotes: a hairline on the left and Fraunces, no box. */
.jl-post .jl-post__content .wp-block-quote,
.jl-post .jl-post__content .wp-block-pullquote {
	margin-block: 24px;
	padding: 4px 0 4px 28px;
	border: 0;
	border-left: 1px solid var(--wp--preset--color--contrast);
	text-align: left;
}

.jl-post .jl-post__content .wp-block-pullquote blockquote {
	margin: 0;
}

.jl-post .jl-post__content .wp-block-quote p,
.jl-post .jl-post__content .wp-block-pullquote p {
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: 1.75rem;
	letter-spacing: -0.015em;
	line-height: 1.25;
	text-wrap: balance;
}

.jl-post .jl-post__content .wp-block-quote p + p {
	margin-top: 0.6em;
}

.jl-post .jl-post__content .wp-block-quote cite,
.jl-post .jl-post__content .wp-block-pullquote cite {
	display: block;
	margin-top: 14px;
	color: var(--wp--preset--color--accent-4);
	font-size: 0.72rem;
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

/* Images inside the article: square corners, the caption on the left. */
.jl-post .jl-post__content .wp-block-image {
	margin-block: 24px;
}

.jl-post .jl-post__content .wp-block-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 0;
}

.jl-post .jl-post__content .wp-block-image figcaption {
	margin-top: 12px;
}

.jl-post .jl-post__content .wp-block-separator {
	width: 100%;
	margin-block: 24px;
	border: 0;
	border-top: 1px solid var(--jl-line);
}

.jl-post .jl-post__content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 1rem;
}

.jl-post .jl-post__content th,
.jl-post .jl-post__content td {
	padding: 12px 12px 12px 0;
	border: 0;
	border-top: 1px solid var(--jl-line);
	text-align: left;
	vertical-align: top;
}

.jl-post .jl-post__content th {
	color: var(--wp--preset--color--accent-4);
	font-weight: 400;
}

/* The "Note" paragraph style: a small muted line, for disclaimers. */
.jl-post .jl-post__content .is-style-note,
.is-style-note {
	color: var(--wp--preset--color--accent-4);
	font-size: 0.875rem;
	line-height: 1.55;
}

.jl-post .jl-post__content .is-style-note {
	margin-top: 16px;
	font-size: 0.875rem;
}

/* ---------- About the author ---------- */

.jl-post .jl-author {
	display: grid;
	grid-column: 3 / span 6;
	grid-template-columns: 88px minmax(0, 1fr);
	column-gap: 24px;
	align-items: start;
	max-width: 645px;
	margin-top: 80px;
	padding-top: 32px;
	border-top: 1px solid var(--jl-line);
}

/* Without a photo, the words take the whole width. */
.jl-post .jl-author:not(:has(.wp-block-avatar)) {
	grid-template-columns: minmax(0, 1fr);
}

.jl-post .jl-author .wp-block-avatar img {
	display: block;
	width: 88px;
	height: 88px;
	border-radius: 0;
	object-fit: cover;
	background: color-mix(in srgb, var(--wp--preset--color--accent-1) 30%, var(--wp--preset--color--accent-5));
}

.jl-post .jl-author__name {
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: 1.375rem;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.jl-post .jl-author__bio {
	max-width: 480px;
	margin-top: 8px;
	color: var(--wp--preset--color--accent-4);
	font-size: 1rem;
	line-height: 1.5;
	text-wrap: pretty;
}

.jl-post .jl-author .jl-arrow {
	margin-top: 8px;
	font-size: 1rem;
	line-height: 2.75;
}

/* ---------- Motion (front only, once the script is running) ---------- */

.jl-js .jl-post .jl-post__title:not(.is-split):not(.is-done) {
	opacity: 0;
}

.jl-post .jl-post__title .jl-word {
	display: inline-block;
	opacity: 0;
	transform: translateY(0.45em);
	transition: opacity 0.9s ease var(--d, 0ms), transform 1s var(--ps-ease) var(--d, 0ms);
}

.jl-post .jl-post__title.is-in .jl-word {
	opacity: 1;
	transform: none;
}

.jl-js .jl-post .jl-post__opener > .jl-meta,
.jl-js .jl-post .jl-post__byline,
.jl-js .jl-post .jl-post__lead {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.9s var(--ps-ease) var(--d, 0ms), transform 0.9s var(--ps-ease) var(--d, 0ms);
}

.jl-js .jl-post.is-in .jl-post__opener > .jl-meta,
.jl-js .jl-post.is-in .jl-post__byline,
.jl-js .jl-post .jl-post__lead.is-in {
	opacity: 1;
	transform: none;
}

.jl-js .jl-post .jl-post__byline {
	--d: 300ms;
}

/* ---------- Tablet: the reading column across the page ---------- */
@media (max-width: 1099px) {
	.jl-post.jl-post {
		--ps-pad: 40px;
		--ps-gap: 20px;
	}

	.jl-post .jl-post__content > *,
	.jl-post .jl-post__content > .alignwide,
	.jl-post .jl-author {
		grid-column: 1 / -1;
	}
}

/* ---------- Mobile ---------- */
@media (max-width: 699px) {
	.jl-post.jl-post {
		--ps-pad: 24px;
		--ps-gap: 12px;
		padding-top: 88px;
	}

	.jl-post .jl-post__title {
		margin-top: 20px;
		font-size: 2.5rem;
	}

	.jl-post .jl-post__byline {
		margin-top: 20px;
	}

	/* The lead image reaches both screen edges. */
	.jl-post .jl-post__lead {
		margin: 48px calc(-1 * var(--ps-pad)) 0;
	}

	.jl-post .jl-post__lead img {
		aspect-ratio: 4 / 3;
	}

	.jl-post .jl-post__lead figcaption {
		padding: 0 var(--ps-pad);
	}

	.jl-post .jl-post__body {
		padding-top: 56px;
	}

	.jl-post .jl-post__content {
		row-gap: 20px;
	}

	.jl-post .jl-post__content p,
	.jl-post .jl-post__content li {
		font-size: 1.0625rem;
	}

	.jl-post .jl-post__content h2 {
		margin-top: 28px;
		font-size: 1.75rem;
	}

	.jl-post .jl-post__content h3 {
		font-size: 1.3125rem;
	}

	.jl-post .jl-post__content .wp-block-quote,
	.jl-post .jl-post__content .wp-block-pullquote {
		margin-block: 16px;
		padding-left: 20px;
	}

	.jl-post .jl-post__content .wp-block-quote p,
	.jl-post .jl-post__content .wp-block-pullquote p {
		font-size: 1.375rem;
	}

	.jl-post .jl-post__content > .alignfull {
		margin-inline: calc(-1 * var(--ps-pad));
	}

	.jl-post .jl-author {
		grid-template-columns: 64px minmax(0, 1fr);
		column-gap: 16px;
	}

	.jl-post .jl-author .wp-block-avatar img {
		width: 64px;
		height: 64px;
	}
}

/* Set by the script if it could not prepare the section: everything shows at rest. */
.jl-post.is-plain .jl-post__title,
.jl-post.is-plain .jl-word,
.jl-post.is-plain .jl-post__opener > *,
.jl-post.is-plain .jl-post__lead {
	opacity: 1 !important;
	transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.jl-js .jl-post .jl-post__title,
	.jl-js .jl-post .jl-post__opener > *,
	.jl-js .jl-post .jl-post__lead {
		opacity: 1;
		transform: none;
	}

	.jl-post.jl-post * {
		transition: none !important;
	}
}
