/* ============================================================================
   nqc-article — the single blog post

   The posts came across from the old site via a WordPress export: 35 of them,
   2010 to 2022, 71 to 837 words. All but one were written in the classic
   editor, so a post body is arbitrary HTML rather than blocks — measured across
   the set: 119 inline <img>, 96 links, 32 <p>, 28 <strong>, 23 <span>, 5 <hr>,
   5 <figure>, 3 <em>, 2 <iframe> and barely any structure (2 h2, 2 h3, 1 ul).

   So this stylesheet does two jobs: it dresses the core post blocks in the
   template as a hero band, and it sets arbitrary classic-editor markup at the
   design's measure without needing any of it to be rewritten.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   The three bands butt together.

   theme.json publishes `:root :where(.is-layout-flow) > * { margin-block-start:
   var(--wp--preset--spacing--medium) }` — 32px — at (0,1,0), the same weight as
   .nqc-block's own `margin: 0`, so which one wins comes down to print order.
   Here the theme won and a white hairline showed between every band. Two
   classes takes it to (0,2,0) and settles it.
   -------------------------------------------------------------------------- */
.nqc-article > .nqc-article__hero,
.nqc-article > .nqc-article__body,
.nqc-article > .nqc-article__more {
	margin-block: 0;
}

/* ---- the hero band ------------------------------------------------------- */
.nqc-article__hero {
	position: relative;
	min-height: 520px;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 0 var(--nqc-gutter) 56px;
	overflow: hidden;
	isolation: isolate;
	background-color: var(--nqc-navy);
}

/* The featured image fills the band. Every imported post has one. */
.nqc-article__hero .wp-block-post-featured-image {
	position: absolute;
	inset: 0;
	margin: 0;
	z-index: 0;
}

.nqc-article__hero .wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 50%;
}

/* The same directional scrim the page heroes use, so a title can sit on any
   photograph in the archive without being checked one by one. */
.nqc-article__hero::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(
		180deg,
		rgba(20, 28, 40, .16) 0%,
		rgba(20, 28, 40, .46) 46%,
		rgba(20, 28, 40, .80) 78%,
		rgba(20, 28, 40, .90) 100%
	);
	pointer-events: none;
}

.nqc-article__head {
	align-items: center;
	text-align: center;
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	gap: 14px;
	align-items: flex-start;
}

/* Category and date on one line, in the eyebrow treatment. */
/*
   A text shadow as well as the scrim. Every page hero on this site sits on a
   photograph chosen for it; these 35 sit on whatever the post was published
   with, and a few are bright exactly where the type lands.
*/
.nqc-article__meta,
.nqc-article__title {
	text-shadow: 0 1px 18px rgba(20, 28, 40, .55);
}

.nqc-article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 10px;
	font: 400 14px/100% var(--nqc-sans);
	letter-spacing: 4px;
	text-transform: uppercase;
	color: var(--nqc-gold);
}

.nqc-article__meta a {
	color: inherit;
	text-decoration: none;
}

.nqc-article__meta a:hover,
.nqc-article__meta a:focus-visible {
	color: #fff;
}

/* The separator between the categories and the date. */
.nqc-article__meta .nqc-article__date::before {
	content: "\00b7";
	margin-right: 10px;
	color: rgba(255, 255, 255, .55);
}

.nqc-article__title {
	margin: 0;
	max-width: 900px;
	font: 600 56px/62px var(--nqc-serif);
	color: #fff;
	text-wrap: balance;
}

/*
   The ornament the rest of the site sets under a heading: a gold rule broken
   by a diamond. Drawn rather than marked up — the hero is a block template, so
   there is no PHP here to call the site's nqc_orn() helper.
*/
.nqc-article__orn {
	position: relative;
	width: 170px;
	height: 7px;
	margin: 4px auto 0;
	background:
		linear-gradient(var(--nqc-gold), var(--nqc-gold)) left center / 70px 1px no-repeat,
		linear-gradient(var(--nqc-gold), var(--nqc-gold)) right center / 70px 1px no-repeat;
}

.nqc-article__orn::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 7px;
	height: 7px;
	transform: translate(-50%, -50%) rotate(45deg);
	background: var(--nqc-gold);
}

/* ---- the body ------------------------------------------------------------ */
/*
   The grain, so the article and the card strip below it are two grounds rather
   than one field of cream. Same texture and same 90% paper wash as the form
   panels carry; the URL is handed in as --nqc-grain by nqc_article_styles(),
   because the layout is a block template and has no PHP of its own.
*/
.nqc-article__body {
	position: relative;
	background-color: var(--nqc-paper);
	background-image:
		linear-gradient(rgba(251, 247, 239, .9), rgba(251, 247, 239, .9)),
		var(--nqc-grain, none);
	background-repeat: repeat, repeat;
	background-size: auto, 1800px auto;
	background-position: top center, top center;
	padding: 80px var(--nqc-gutter);
}

/*
   ONE COLUMN. THE COLUMN IS THE MEASURE. IT IS CENTRED. NOTHING INSIDE IT IS.

   Four passes to get here, so it is worth writing down.

     1. A 720px measure centred in an otherwise empty band — the article read
        as a narrow strap floating in the middle of the page.
     2. Widened to the full 1200px rail. Aligned with everything, unreadable:
        1200px is about 110 characters a line.
     3. Each element centred on the rail separately, which put a portrait
        photograph in the middle of its own paragraph with a void either side.
     4. An 820px measure inside a 1000px column. Symmetric on paper, and not
        in the eye: the text ran 220 to 1040 inside a rail of 120 to 1320, so
        100px of margin on the left answered 280px on the right and the whole
        article looked shoved to one side.

   So the column IS the measure — 820px, about 78 characters, centred on the
   rail. Everything in it is flush left against that one edge, photographs
   included, and the margins either side are equal because there is only one
   width in play. A picture is as wide as it is, up to the column; it never
   breaks out of it, and it never sits in the middle of its own paragraph.
*/
.nqc-article__body > .wp-block-post-content,
.nqc-article__body .entry-content {
	width: 100%;
	max-width: 820px;
	margin-inline: auto;
}

/*
   The .entry-content prefix is not decoration: the overflow guard further down
   is `.nqc-article__body .entry-content > *  { max-width: 100% }` at (0,2,0),
   and a bare `.nqc-article__body p` is (0,1,1) — it lost, and every paragraph
   ran the full 1200px rail. Prefixed, this is (0,2,1) and holds.
*/
.nqc-article__body .entry-content p,
.nqc-article__body .entry-content ul,
.nqc-article__body .entry-content ol,
.nqc-article__body .entry-content h1,
.nqc-article__body .entry-content h2,
.nqc-article__body .entry-content h3,
.nqc-article__body .entry-content h4,
.nqc-article__body .entry-content blockquote,
.nqc-article__body .entry-content table,
.nqc-article__body > .wp-block-post-content p,
.nqc-article__body > .wp-block-post-content ul,
.nqc-article__body > .wp-block-post-content ol,
.nqc-article__body > .wp-block-post-content blockquote {
	max-width: 820px;
	margin-inline: 0;
}

.nqc-article__body p {
	margin: 0 0 24px;
	font: 400 18px/32px var(--nqc-sans);
	color: var(--nqc-body);
}

.nqc-article__body p:last-child { margin-bottom: 0; }

/*
   A <br> cannot be given space: display:block on it does not create height in
   Chrome, which was the first thing tried here. The paragraph breaks are fixed
   in the CONTENT instead — see nqc_repair_imported_paragraphs() — so by the
   time it reaches this stylesheet a paragraph is a real <p>.
*/

.nqc-article__body strong,
.nqc-article__body b {
	font-weight: 600;
	color: var(--nqc-ink);
}

.nqc-article__body em,
.nqc-article__body i { font-style: italic; }

/*
   The classic editor left a lot of inline colour and size on <span>. Neutralise
   it so a 2011 post does not arrive in a different typeface to a 2022 one.
*/
.nqc-article__body span {
	font-family: inherit !important;
	font-size: inherit !important;
	color: inherit !important;
	background: none !important;
	line-height: inherit !important;
}

/* ---- headings ------------------------------------------------------------ */
.nqc-article__body h1,
.nqc-article__body h2,
.nqc-article__body h3,
.nqc-article__body h4 {
	margin: 44px 0 16px;
	font-family: var(--nqc-serif);
	font-weight: 600;
	color: var(--nqc-ink);
	text-wrap: balance;
}

.nqc-article__body h1,
.nqc-article__body h2 { font-size: 34px; line-height: 42px; }
.nqc-article__body h3 { font-size: 26px; line-height: 34px; }
.nqc-article__body h4 { font-size: 21px; line-height: 30px; }

/* ---- lists --------------------------------------------------------------- */
.nqc-article__body ul,
.nqc-article__body ol {
	margin: 0 0 24px;
	padding-left: 22px;
}

.nqc-article__body li {
	margin-bottom: 8px;
	font: 400 18px/32px var(--nqc-sans);
	color: var(--nqc-body);
}

.nqc-article__body ul { list-style: none; padding-left: 0; }

.nqc-article__body ul > li {
	position: relative;
	padding-left: 26px;
}

/* The quatrefoil the rest of the site marks a list with. */
.nqc-article__body ul > li::before {
	content: "\2726";
	position: absolute;
	left: 0;
	top: 1px;
	font-size: 12px;
	color: var(--nqc-gold-dk);
}

/* ---- images -------------------------------------------------------------- */
/*
   Three per post on average, at whatever width the classic editor pasted them,
   and often floated. They are un-floated to the measure and mounted the way
   the site mounts a photograph.
*/
/*
   1000px, flush left with the text, never upscaled.

   The classic editor wrote the author's chosen display size into the markup —
   76 different hard-coded sizes across the 120 inline images, several of them
   300px or less. nqc_article_rebuild_images() throws those away and re-renders
   each tag from the Media Library with a full srcset.

   `width: auto` is what defeats the old markup: an <img> with a width ATTRIBUTE
   keeps that width until CSS says otherwise, and max-width alone only ever
   makes an image smaller. Nine images whose files never made it into the export
   cannot be rebuilt, so they fall back to the 1000px ceiling and render at
   their natural size.
*/
.nqc-article__body img {
	display: block;
	width: auto;
	/*
	   --nqc-imgw is that image's own ceiling, set per tag by
	   nqc_article_rebuild_img(): min(1000px, the file's real width). It is
	   stated as a property rather than left to `width: auto` because an <img>
	   with w-descriptors takes its layout width from `sizes`, not from the
	   file — which is how a 240px snapshot came out at 980px. The 1000px
	   fallback covers the nine images whose files never made the export.
	*/
	max-width: min(100%, var(--nqc-imgw, 1000px));
	height: auto;
	margin: 32px 0;
	float: none !important;
	background: #fff;
	padding: 10px;
	box-shadow: 0 14px 32px rgba(28, 38, 52, .12);
}

/*
   core's [caption] shortcode writes an inline max-width onto its wrapper from
   the shortcode's own width attribute — which the rebuilder corrects, but the
   !important here also covers the nine images it cannot rebuild. width:
   fit-content keeps the box on the photograph rather than on the rail, so the
   caption underneath is the width of the picture it belongs to.
*/
.nqc-article__body figure,
.nqc-article__body .wp-caption {
	margin: 32px 0;
	width: fit-content;
	max-width: min(100%, 1020px) !important;
	margin-inline: 0 !important;
}

.nqc-article__body figure img,
.nqc-article__body .wp-caption img { margin: 0; }

.nqc-article__body figcaption,
.nqc-article__body .wp-caption-text {
	margin: 12px 0 0;
	max-width: 1000px;
	font: 400 15px/24px var(--nqc-sans);
	color: var(--nqc-body-3);
	text-align: left;
}

/* ---- rules --------------------------------------------------------------- */
/* Five posts separate sections with an <hr>; drawn as the site's ornament. */
.nqc-article__body hr {
	width: 70px;
	height: 1px;
	margin: 44px 0;
	border: 0;
	background: var(--nqc-gold);
}

/* ---- embeds -------------------------------------------------------------- */
/* Two posts embed a video. Kept 16:9 and inside the measure. */
.nqc-article__body iframe,
.nqc-article__body video,
.nqc-article__body embed,
.nqc-article__body object {
	display: block;
	width: 100%;
	max-width: 1000px;
	aspect-ratio: 16 / 9;
	height: auto;
	margin: 32px 0;
	border: 0;
	background: var(--nqc-navy);
}

.nqc-article__body .wp-block-embed { margin: 32px 0; }

/* ---- blockquote ---------------------------------------------------------- */
.nqc-article__body blockquote {
	margin: 36px 0;
	padding-left: 26px;
	border-left: 2px solid var(--nqc-gold);
}

.nqc-article__body blockquote p {
	font: 500 italic 22px/34px var(--nqc-serif);
	color: var(--nqc-ink);
}

/* ---- tables -------------------------------------------------------------- */
.nqc-article__body table {
	width: 100%;
	margin: 32px 0;
	border-collapse: collapse;
	font: 400 16px/26px var(--nqc-sans);
}

.nqc-article__body th,
.nqc-article__body td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--nqc-rule-2);
	text-align: left;
}

/* Any wide thing stays inside the rail rather than widening the page. */
.nqc-article__body .entry-content > *,
.nqc-article__body > .wp-block-post-content > * { max-width: 100%; }

/* ---- the closing strip --------------------------------------------------- */
/*
   The article used to end on a default WordPress outline button, which read as
   unfinished. It closes on the site's own card deck instead — three more posts
   on the grain, so the page has somewhere to go.
*/
.nqc-article__more {
	background-color: var(--nqc-sand);
	border-top: 1px solid var(--nqc-rule-2);
	padding-block: 64px 76px;
}

.nqc-article__back {
	margin: 44px 0 0;
	text-align: center;
}

.nqc-article__back a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font: 400 14px/100% var(--nqc-sans);
	letter-spacing: 3px;
	text-transform: uppercase;
	color: var(--nqc-brick);
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
	text-underline-offset: 4px;
	transition: color .3s ease, text-decoration-color .3s ease;
}

.nqc-article__back a:hover,
.nqc-article__back a:focus-visible {
	color: var(--nqc-ink);
	text-decoration-color: currentColor;
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 1200px) {
	.nqc-article__title { font-size: 44px; line-height: 50px; }
}

@media (max-width: 900px) {
	.nqc-article__hero { min-height: 420px; padding-bottom: 40px; }

	.nqc-article__title { font-size: 34px; line-height: 40px; }

	/* Leading, so a wrapped eyebrow does not set two rows on top of each
	   other — the same note the other blocks carry. */
	.nqc-article__meta { line-height: 20px; }

	.nqc-article__body { padding-top: 52px; padding-bottom: 64px; }

	.nqc-article__body p,
	.nqc-article__body li { font-size: 17px; line-height: 30px; }

	.nqc-article__body h1,
	.nqc-article__body h2 { font-size: 28px; line-height: 36px; }
	.nqc-article__body h3 { font-size: 23px; line-height: 31px; }
}

@media (max-width: 600px) {
	.nqc-article__hero { min-height: 340px; }

	.nqc-article__title { font-size: 29px; line-height: 35px; }

	/* 14px is the site's floor — never below it, whatever the comp says. */
	.nqc-article__meta { font-size: 14px; letter-spacing: 2px; }

	.nqc-article__body img { padding: 6px; margin: 24px 0; }
}
