/**
 * GVA — generic content: single posts, generic Pages, and the Field Notes
 * index. Namespaced under `.entry`, `.entry-content`, `.field-notes` and
 * `.field-note-card`; never redefines a main.css primitive. Never loaded on
 * the front page.
 *
 * Enqueued as `gva-content` from inc/enqueue.php, after `gva-main`.
 */

:root {
	/* A comfortable reading measure for long-form editorial content. */
	--content-measure: 68ch;
}

/* ==========================================================================
   1. Page shell — shared vertical rhythm and top clearance
   The fixed header height is already reserved by `.site-main` (site-header.css);
   these are the internal page paddings only.
   ========================================================================== */

.entry,
.field-notes {
	padding-block: clamp(48px, 8vw, 96px);
	background: var(--bone);
}

.entry__inner,
.field-notes__inner {
	display: flow-root;
}

/* ==========================================================================
   2. Field Notes index — header, lead, grid, empty state
   ========================================================================== */

/* ---- Header ------------------------------------------------------------ */

.field-notes__header {
	max-width: var(--content-measure);
	margin-bottom: clamp(40px, 6vw, 72px);
}

/* Same mono eyebrow idiom as the front page's `.eyebrow`, restated here
   because front-page.css never ships on this template. */
.field-notes__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 22px;
	color: var(--red);
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 1.4;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.field-notes__eyebrow::before {
	width: 38px;
	height: 1.5px;
	background: currentColor;
	content: "";
}

.field-notes__title {
	font-size: clamp(34px, 5vw, 56px);
	line-height: 1.08;
	letter-spacing: -0.03em;
	overflow-wrap: break-word;
}

.field-notes__intro {
	margin-top: 20px;
	color: #4a4a4a;
}

/* Continuation pages state where the reader is; page one never shows it. */
.field-notes__position {
	margin: 24px 0 0;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

/* ---- Lead note --------------------------------------------------------- */

.field-notes__lead {
	margin-bottom: clamp(28px, 4vw, 44px);
}

/* ---- Grid -------------------------------------------------------------- */

.field-notes__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 24px;
}

/* A hairline separates the lead from the notes that follow it. Only when both
   are present — a single note leaves nothing to rule off. */
.field-notes__lead + .field-notes__grid {
	padding-top: clamp(28px, 4vw, 44px);
	border-top: 1px solid var(--line);
}

/* ---- Empty index ------------------------------------------------------- */

.field-notes__empty {
	max-width: var(--content-measure);
	padding: clamp(32px, 5vw, 56px);
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--white);
}

.field-notes__empty-title {
	margin: 0;
	font-size: clamp(20px, 2.4vw, 26px);
	font-weight: 700;
	letter-spacing: -0.015em;
}

.field-notes__empty-text {
	margin: 12px 0 0;
	max-width: 46ch;
	color: #4a4a4a;
	font-size: 16px;
	line-height: 1.6;
}

.field-notes__empty-action {
	margin: 28px 0 0;
}

/* ---- Card — visually consistent with the front page's `.note` teasers ---- */

.field-note-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--white);
}

.field-note-card__cover {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-bottom: 1px solid var(--line);
	background: #f2f1ef;
}

.field-note-card__media {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	filter: grayscale(1) contrast(1.06) brightness(0.94);
}

.field-note-card__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-image:
		linear-gradient(rgba(18, 18, 18, 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(18, 18, 18, 0.05) 1px, transparent 1px);
	background-size: 22px 22px;
}

.field-note-card__placeholder-icon {
	width: 15%;
	min-width: 32px;
	max-width: 46px;
	height: auto;
	color: var(--text-muted);
	opacity: 0.55;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.field-note-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	padding: 22px;
}

.field-note-card__title {
	margin: 0;
	font-size: 18px;
	line-height: 1.28;
	letter-spacing: -0.01em;
	/* A long unbroken title must wrap rather than widen the card. */
	overflow-wrap: break-word;
}

.field-note-card__title a {
	color: inherit;
}

.field-note-card__title a:hover {
	color: var(--red);
}

.field-note-card__excerpt {
	margin: 0;
	color: #4a4a4a;
	font-size: 14px;
	line-height: 1.5;
}

.field-note-card__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: auto 0 0;
	padding: 0;
	list-style: none;
}

.field-note-card__terms li {
	padding: 3px 7px;
	border: 1px solid var(--line);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.06em;
}

/* ---- Lead variant — same component, stronger hierarchy ----------------- */

.field-note-card--lead .field-note-card__body {
	gap: 16px;
	padding: clamp(24px, 3vw, 40px);
}

.field-note-card--lead .field-note-card__title {
	font-size: clamp(24px, 3.2vw, 34px);
	line-height: 1.14;
	letter-spacing: -0.02em;
}

.field-note-card--lead .field-note-card__excerpt {
	font-size: 16px;
	line-height: 1.6;
}

/* A lead with no featured image drops the cover entirely (see
   template-parts/post-card.php) and reads as a typographic lead: an accent
   rule instead of a picture, and a wider measure for the excerpt. */
.field-note-card--coverless {
	border-left: 3px solid var(--red);
}

.field-note-card--coverless .field-note-card__excerpt {
	max-width: 62ch;
}

/* Above the split the lead becomes two columns: cover beside body. The cover
   has only absolutely positioned children, so it takes its height from the
   body's row and needs a floor of its own for a short note. */
@media (min-width: 860px) {
	.field-note-card--lead:not(.field-note-card--coverless) {
		display: grid;
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	}

	.field-note-card--lead .field-note-card__cover {
		aspect-ratio: auto;
		min-height: 300px;
		height: 100%;
		border-right: 1px solid var(--line);
		border-bottom: 0;
	}

	.field-note-card--lead .field-note-card__body {
		justify-content: center;
	}

	/* Vertically centred body: the terms must not be pushed to the bottom. */
	.field-note-card--lead .field-note-card__terms {
		margin-top: 4px;
	}
}

/* ==========================================================================
   3. Entry header — single post and generic Page
   ========================================================================== */

.entry-article {
	max-width: var(--content-measure);
	margin-inline: auto;
}

.entry-header {
	margin-bottom: clamp(28px, 4vw, 40px);
}

/* The article's category line and the index's eyebrow are the same idiom —
   mono, uppercase, behind the design's 38px red rule — so arriving at an
   article from the index does not read as a different site. `inline-block`
   rather than a flex container because the category list is links separated by
   real text nodes, which flex `gap` would space wrongly. */
.entry-header__cats {
	margin: 0 0 16px;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.entry-header__cats::before {
	display: inline-block;
	width: 38px;
	height: 1.5px;
	margin-right: 12px;
	vertical-align: middle;
	background: var(--red);
	content: "";
}

.entry-title {
	font-size: clamp(30px, 4.4vw, 46px);
	line-height: 1.14;
	letter-spacing: -0.03em;
	overflow-wrap: break-word;
}

.entry-meta {
	margin: 18px 0 0;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.entry-meta__sep {
	margin: 0 8px;
	opacity: 0.6;
}

/* Field Notes index card reuses `.entry-meta`; drop the top margin there. */
.field-note-card__body .entry-meta {
	margin-top: 0;
}

.entry-featured {
	max-width: var(--content-measure);
	margin: 0 auto clamp(28px, 4vw, 40px);
}

.entry-featured img {
	width: 100%;
	border-radius: 10px;
}

/* ==========================================================================
   4. Entry content — the long-form typography shared by post and Page
   Everything is scoped to `.entry-content` so nothing here leaks to the
   front page or the site chrome.
   ========================================================================== */

.entry-content {
	max-width: var(--content-measure);
	margin-inline: auto;
	font-size: 1.0625rem;
	line-height: 1.7;
	color: #2b2b2b;
	overflow-wrap: break-word;
}

.entry-content > * {
	margin-block: 0 1.4em;
}

.entry-content > :last-child {
	margin-bottom: 0;
}

.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
	margin-top: 1.8em;
	line-height: 1.25;
	color: var(--text);
}

.entry-content h2 {
	font-size: 1.6em;
}

.entry-content h3 {
	font-size: 1.3em;
}

.entry-content h4 {
	font-size: 1.1em;
}

.entry-content h5,
.entry-content h6 {
	font-size: 1em;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.entry-content p {
	margin-block: 0 1.4em;
}

/* In-content links are underlined for scannability — main.css leaves site-chrome
   links undecorated, which reads wrong inside a paragraph of prose. */
.entry-content a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
	text-decoration-thickness: 1px;
}

.entry-content a:hover {
	text-decoration-thickness: 2px;
}

.entry-content ul,
.entry-content ol {
	padding-left: 1.4em;
}

.entry-content li {
	margin-bottom: 0.5em;
}

.entry-content li > ul,
.entry-content li > ol {
	margin-top: 0.5em;
	margin-bottom: 0;
}

.entry-content blockquote {
	margin-inline: 0;
	padding: 0.2em 0 0.2em 1.1em;
	border-left: 3px solid var(--red);
	color: #4a4a4a;
	font-size: 1.1em;
}

.entry-content blockquote cite {
	display: block;
	margin-top: 0.6em;
	color: var(--text-muted);
	font-size: 0.8em;
	font-style: normal;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.entry-content img {
	height: auto;
	border-radius: 8px;
}

.entry-content figure {
	margin-inline: 0;
}

.entry-content figcaption,
.entry-content .wp-caption-text {
	margin-top: 0.6em;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.8em;
	line-height: 1.5;
	text-align: center;
}

/* Standard block-editor / classic-editor alignments. */
.entry-content .aligncenter {
	margin-inline: auto;
}

.entry-content .alignleft {
	float: left;
	margin: 0.2em 1.4em 1.2em 0;
	max-width: 50%;
}

.entry-content .alignright {
	float: right;
	margin: 0.2em 0 1.2em 1.4em;
	max-width: 50%;
}

/* `.alignwide` / `.alignfull` cannot break out of the reading measure without a
   wider layout wrapper, which this generic template deliberately does not have.
   They are capped at the measure and simply read as full-width blocks. */
.entry-content .alignwide,
.entry-content .alignfull {
	max-width: 100%;
}

/* Tables — the `display: block` + `overflow-x: auto` idiom keeps a wide table
   from forcing horizontal page scroll while still laying out as a table. */
.entry-content table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 0.95em;
}

.entry-content th,
.entry-content td {
	padding: 0.55em 0.9em;
	border: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

.entry-content thead th {
	background: var(--grey-sec);
	font-weight: 700;
}

.entry-content figure.wp-block-table {
	overflow-x: auto;
}

.entry-content figure.wp-block-table > table {
	display: table;
	width: 100%;
}

/* Code — inline and blocks. */
.entry-content code,
.entry-content kbd,
.entry-content samp {
	padding: 0.15em 0.4em;
	border-radius: 4px;
	background: var(--grey-sec);
	font-family: var(--font-mono);
	font-size: 0.88em;
}

.entry-content pre {
	max-width: 100%;
	padding: 1.1em 1.3em;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--black);
	color: var(--bone);
	font-family: var(--font-mono);
	font-size: 0.88em;
	line-height: 1.6;
	-webkit-overflow-scrolling: touch;
}

.entry-content pre code {
	padding: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font-size: 1em;
}

.entry-content hr {
	height: 1px;
	border: 0;
	background: var(--line);
}

.entry-content dl dt {
	font-weight: 700;
}

.entry-content dl dd {
	margin: 0 0 1em;
}

/* Paged post/Page navigation from wp_link_pages(). */
.entry-content__pages {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-top: 1.4em;
	font-family: var(--font-mono);
	font-size: 0.85em;
}

.entry-content__pages a,
.entry-content__pages > span > span {
	display: inline-flex;
	min-width: 2em;
	padding: 0.3em 0.5em;
	border: 1px solid var(--line);
	justify-content: center;
	text-decoration: none;
}

/* ==========================================================================
   5. Entry footer — tags
   ========================================================================== */

.entry-footer {
	max-width: var(--content-measure);
	margin: clamp(32px, 5vw, 48px) auto 0;
}

.entry-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.entry-tags a {
	display: inline-block;
	padding: 4px 10px;
	border: 1px solid var(--line);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.05em;
	text-decoration: none;
}

.entry-tags a:hover {
	border-color: var(--black);
	color: var(--text);
}

/* ==========================================================================
   6. Pagination — Field Notes index and archive fallback
   Native `the_posts_pagination()` markup, restyled. Core's `aria-current`
   and heading are kept; current page is also visually distinct.
   ========================================================================== */

.field-notes .pagination,
.entry--index .pagination {
	margin-top: clamp(48px, 7vw, 80px);
	padding-top: clamp(28px, 4vw, 40px);
	border-top: 1px solid var(--line);
}

.field-notes .nav-links,
.entry--index .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: center;
}

.field-notes .page-numbers,
.entry--index .page-numbers {
	display: inline-flex;
	min-width: 44px;
	min-height: 44px;
	padding: 0 12px;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 1px solid var(--line);
	background: var(--white);
	color: var(--text);
	font-family: var(--font-mono);
	font-size: 13px;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.field-notes a.page-numbers:hover,
.entry--index a.page-numbers:hover {
	border-color: var(--black);
	color: var(--text);
}

/* Current page: filled, and the only item that is not a link — understandable
   from weight and shape as well as colour. */
.field-notes .page-numbers.current,
.entry--index .page-numbers.current {
	background: var(--black);
	border-color: var(--black);
	color: var(--white);
	font-weight: 700;
}

.field-notes .page-numbers.dots,
.entry--index .page-numbers.dots {
	min-width: 0;
	padding: 0 4px;
	border-color: transparent;
	background: none;
	color: var(--text-muted);
}

/* Previous / next carry a label and a directional arrow. */
.field-notes .page-numbers.prev,
.field-notes .page-numbers.next,
.entry--index .page-numbers.prev,
.entry--index .page-numbers.next {
	text-transform: uppercase;
	letter-spacing: 0.1em;
	font-size: 11px;
}

.page-numbers__arrow {
	color: var(--red);
}

/* The labels are the affordance on a phone; the arrows alone would not be. */
@media (max-width: 420px) {
	.field-notes .page-numbers,
	.entry--index .page-numbers {
		min-width: 40px;
		padding: 0 8px;
	}
}

/* ==========================================================================
   7. Previous / next post navigation — single.php (the_post_navigation)
   ========================================================================== */

.post-navigation {
	max-width: var(--content-measure);
	margin: clamp(40px, 6vw, 64px) auto 0;
}

.post-navigation .nav-links {
	display: grid;
	gap: 16px;
}

@media (min-width: 640px) {
	.post-navigation .nav-links {
		grid-template-columns: 1fr 1fr;
	}

	.post-navigation .nav-next {
		text-align: right;
	}
}

.post-navigation a {
	display: block;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--white);
	color: inherit;
	text-decoration: none;
}

.post-navigation a:hover {
	border-color: var(--black);
}

.post-navigation__dir {
	display: block;
	margin-bottom: 6px;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.post-navigation__title {
	font-weight: 700;
	line-height: 1.3;
}

/* ==========================================================================
   8. Narrow viewports
   ========================================================================== */

@media (max-width: 560px) {
	.field-notes__grid {
		grid-template-columns: 1fr;
	}

	.field-note-card__body {
		padding: 20px;
	}

	.entry-content .alignleft,
	.entry-content .alignright {
		float: none;
		margin-inline: 0;
		max-width: 100%;
	}
}
