/* Patey Dispatches: front-end styles.
   Two brand colours drive everything: --pdm-primary (the band, buttons, headings) and
   --pdm-accent (small text on the dark band). The plugin sets both from its settings on
   each .pdm wrapper; every other shade is mixed from them. Pick a fairly dark main colour
   so white text on it stays readable. */
.pdm {
	--pdm-primary: var(--pdm-aubergine, var(--pdm-brand, #3d052a));
	--pdm-accent: #a9d0e2;
	--pdm-primary-deep: color-mix(in srgb, var(--pdm-primary) 70%, #000);
	--pdm-primary-deeper: color-mix(in srgb, var(--pdm-primary) 45%, #000);
	--pdm-plum: color-mix(in srgb, var(--pdm-primary) 82%, #fff);
	--pdm-blush: color-mix(in srgb, var(--pdm-primary) 5%, #fff);
	--pdm-mist: color-mix(in srgb, var(--pdm-primary) 4%, #fff);
	--pdm-line: color-mix(in srgb, var(--pdm-primary) 12%, #fff);
	--pdm-line-strong: color-mix(in srgb, var(--pdm-primary) 22%, #fff);
	--pdm-ink: color-mix(in srgb, var(--pdm-primary) 30%, #151515);
	--pdm-body: color-mix(in srgb, var(--pdm-primary) 30%, #3d3d3d);
	--pdm-muted: color-mix(in srgb, var(--pdm-primary) 30%, #555);
	--pdm-on-dark: color-mix(in srgb, var(--pdm-primary) 10%, #fff);
	--pdm-on-dark-soft: color-mix(in srgb, var(--pdm-primary) 16%, #fff);
	--pdm-sky: var(--pdm-accent);
	--pdm-slate: color-mix(in srgb, var(--pdm-primary) 45%, #4b5563);
	--pdm-shadow: color-mix(in srgb, var(--pdm-primary) 10%, transparent);
	--pdm-shadow-strong: color-mix(in srgb, var(--pdm-primary) 16%, transparent);
	--pdm-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
	--pdm-gutter: clamp(16px, 5vw, 80px);
	color: var(--pdm-ink);
	line-height: 1.5;
	/* Layout responds to the width the section is given, not the window,
	   so it also works inside a narrow theme column. */
	container: pdm / inline-size;
}
.pdm *, .pdm *::before, .pdm *::after { box-sizing: border-box; }

/* Themes such as Divi add padding to headings and paragraphs; reset inside the section. */
.pdm h2, .pdm h3, .pdm p, .pdm ul, .pdm li, .pdm figure { margin: 0; padding: 0; }
.pdm ul { list-style: none; }
.pdm img { max-width: 100%; }

.pdm-inner { max-width: 1440px; margin: 0 auto; padding: 0 var(--pdm-gutter); }
.pdm-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.pdm a:focus-visible {
	outline: 3px solid var(--pdm-sky);
	outline-offset: 3px;
}
.pdm-earlier a:focus-visible,
.pdm-team a:focus-visible { outline-color: var(--pdm-plum); }

/* ---------- Featured band ---------- */
.pdm-hero { background: var(--pdm-primary); padding: clamp(20px, 2.5vw, 32px) 0 clamp(24px, 3vw, 40px); }
.pdm-hero .pdm-inner { padding: 0 clamp(14px, 3.4vw, 48px); }
.pdm-hero-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 24px;
	margin-bottom: clamp(14px, 1.4vw, 20px);
}
.pdm .pdm-section-title {
	font-family: var(--pdm-serif);
	font-weight: 500;
	font-size: clamp(24px, 2.4vw, 30px);
	line-height: 1.2;
	color: #fff;
}
.pdm .pdm-tagline { font-size: 15px; color: var(--pdm-on-dark-soft); }

.pdm-hero-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
}
@container pdm (min-width: 900px) {
	.pdm-hero-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
	.pdm-hero-grid--team-only { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
}

/* No side panel: the featured article spans the full width, artwork beside the text on wide screens. */
.pdm .pdm-hero-grid.pdm-hero-grid--solo { grid-template-columns: minmax(0, 1fr); max-width: none; }
@container pdm (min-width: 900px) {
	.pdm .pdm-hero-grid--solo .pdm-feature { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; }
	.pdm .pdm-hero-grid--solo .pdm-feature-media { align-self: stretch; aspect-ratio: auto; min-height: 320px; }
	.pdm .pdm-hero-grid--solo .pdm-feature-media.pdm-media--whole { min-height: 0; align-self: center; }
}

.pdm-feature {
	background: var(--pdm-primary-deep);
	border-radius: 6px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
/* The frame is always 16:9; artwork of any shape is cropped to it around the chosen focal point. */
.pdm-feature-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--pdm-primary-deeper); }
.pdm .pdm-feature-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
/* Artwork that already shows the headline: keep the whole image at its own shape (no cropping). */
.pdm .pdm-media--whole { aspect-ratio: auto; display: flex; align-items: center; }
.pdm .pdm-media--whole::before { content: none; }
.pdm .pdm-media--whole .pdm-feature-img { position: static; width: 100%; height: auto; object-fit: contain; }
.pdm-flag {
	position: absolute;
	left: 0;
	top: clamp(12px, 2vw, 24px);
	background: var(--pdm-primary);
	color: #fff;
	font-size: clamp(11px, 1vw, 13px);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 6px 14px;
}
.pdm-feature-body {
	padding: clamp(18px, 2vw, 24px) clamp(18px, 2.4vw, 32px) clamp(20px, 2.2vw, 28px);
	display: flex;
	flex-direction: column;
	gap: clamp(10px, 1vw, 14px);
}
.pdm .pdm-meta { font-size: 14px; font-weight: 600; color: var(--pdm-sky); letter-spacing: 0.02em; }
.pdm .pdm-feature-title {
	font-family: var(--pdm-serif);
	font-weight: 600;
	font-size: clamp(26px, 2.7vw, 38px);
	line-height: 1.2;
	color: #fff;
	overflow-wrap: normal;
	hyphens: manual;
	text-wrap: balance;
}
.pdm .pdm-feature-intro { font-size: clamp(16px, 1.25vw, 18px); line-height: 1.6; color: var(--pdm-on-dark); max-width: 46em; }

/* ---------- Buttons ---------- */
.pdm .pdm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	padding: 12px 24px;
	border-radius: 4px;
	font-weight: 700;
	font-size: 16px;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color .15s ease, color .15s ease;
}
.pdm .pdm-btn--light { align-self: flex-start; margin-top: 4px; background: #fff; color: var(--pdm-primary); }
.pdm .pdm-btn--light:hover { background: var(--pdm-blush); color: var(--pdm-plum); }
.pdm .pdm-btn--dark { background: var(--pdm-primary); color: #fff; font-size: 17px; min-height: 54px; }
.pdm .pdm-btn--dark:hover { background: var(--pdm-plum); color: #fff; }
.pdm .pdm-btn--block { display: flex; width: 100%; }
@container pdm (max-width: 600px) {
	.pdm .pdm-btn--light { align-self: stretch; }
}

/* ---------- Team panel ---------- */
.pdm-team {
	background: var(--pdm-blush);
	border-radius: 6px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.pdm-team-photo-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 1 / 1; background: var(--pdm-blush); }
.pdm .pdm-team-photo { position: absolute; inset: 0 auto auto 0; width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
@container pdm (min-width: 900px) {
	/* Keep the existing desktop panel height, with a clipped photo viewport. */
	.pdm-team-photo-frame { flex: 1 1 auto; aspect-ratio: auto; min-height: 320px; height: 0; }
}
.pdm-team-body { padding: clamp(22px, 2.2vw, 28px) clamp(18px, 2.4vw, 32px) clamp(24px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 18px; }
.pdm .pdm-people { display: flex; flex-direction: column; gap: 12px; }
.pdm .pdm-people li { display: flex; flex-direction: column; gap: 2px; }
.pdm-person-name { font-family: var(--pdm-serif); font-size: clamp(20px, 1.6vw, 22px); font-weight: 600; color: var(--pdm-primary); line-height: 1.25; }
.pdm-person-role { font-size: 15px; color: var(--pdm-muted); }
.pdm .pdm-team-blurb { font-size: 15px; line-height: 1.55; color: var(--pdm-body); }

/* ---------- Earlier articles ---------- */
.pdm-earlier { background: var(--pdm-mist); padding: clamp(32px, 4.5vw, 64px) 0 clamp(36px, 5.5vw, 80px); }
.pdm-earlier-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 24px;
	margin-bottom: clamp(20px, 2.2vw, 32px);
}
.pdm .pdm-earlier-title { font-family: var(--pdm-serif); font-weight: 600; font-size: clamp(24px, 2.4vw, 30px); color: var(--pdm-primary); line-height: 1.2; }
.pdm .pdm-viewall { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; font-size: 16px; color: var(--pdm-primary); }
.pdm .pdm-viewall:hover { color: var(--pdm-plum); }

.pdm .pdm-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: clamp(16px, 2vw, 28px);
}
.pdm .pdm-card {
	position: relative;
	background: #fff;
	border-radius: 6px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 1px 2px var(--pdm-shadow);
	transition: box-shadow .15s ease;
}
.pdm .pdm-card:hover { box-shadow: 0 6px 18px var(--pdm-shadow-strong); }
.pdm .pdm-card-img { width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; display: block; }
.pdm-card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.pdm .pdm-card-date { font-size: 13px; font-weight: 600; color: var(--pdm-slate); }
.pdm .pdm-card-title { font-family: var(--pdm-serif); font-size: clamp(18px, 1.4vw, 20px); line-height: 1.3; font-weight: 600; }
.pdm .pdm-card-title a { color: var(--pdm-ink); text-decoration: none; }
.pdm .pdm-card-title a:hover { color: var(--pdm-plum); text-decoration: underline; }
/* Whole card is clickable through the title link. */
.pdm .pdm-card-title a::after { content: ""; position: absolute; inset: 0; }

/* ---------- All-articles page ([patey_dispatches_archive]) ---------- */
.pdm-archive { display: flex; flex-direction: column; gap: clamp(24px, 3vw, 40px); padding: clamp(8px, 2vw, 24px) 0 clamp(32px, 4vw, 56px); }
.pdm-archive-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px 32px;
	padding-bottom: clamp(16px, 2vw, 24px);
	border-bottom: 1px solid var(--pdm-line);
}
.pdm .pdm-archive-title { font-family: var(--pdm-serif); font-weight: 600; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; color: var(--pdm-primary); }
.pdm .pdm-archive-tagline { margin-top: 6px; font-size: 16px; color: var(--pdm-muted); }
.pdm .pdm-archive-empty { font-size: 17px; color: var(--pdm-muted); }

/* Page 1 of the all-articles page reuses the homepage feature section; round it to sit within the page. */
.pdm-archive .pdm-hero { border-radius: 6px; }
.pdm .pdm-subscribe { margin-left: 12px; color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.pdm .pdm-subscribe:hover { color: var(--pdm-sky); }

.pdm .pdm-cards--archive { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pdm .pdm-cards--archive .pdm-card { background: #fff; outline: 1px solid var(--pdm-line); }
.pdm .pdm-card-intro { font-size: 15px; line-height: 1.55; color: var(--pdm-body); }

/* Explicit column choices. The containing section, rather than the viewport, determines fit. */
.pdm .pdm-cards.pdm-cards--columns-1,
.pdm .pdm-cards.pdm-cards--columns-2,
.pdm .pdm-cards.pdm-cards--columns-3,
.pdm .pdm-cards.pdm-cards--columns-4 { grid-template-columns: minmax(0, 1fr); }
@container pdm (min-width: 601px) {
	.pdm .pdm-cards.pdm-cards--columns-2,
	.pdm .pdm-cards.pdm-cards--columns-3,
	.pdm .pdm-cards.pdm-cards--columns-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container pdm (min-width: 900px) {
	.pdm .pdm-cards.pdm-cards--columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container pdm (min-width: 1100px) {
	.pdm .pdm-cards.pdm-cards--columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Phones: the 12 smaller articles become compact rows (thumbnail beside the title). */
@container pdm (max-width: 600px) {
	.pdm .pdm-cards--archive { display: flex; flex-direction: column; gap: 0; }
	.pdm .pdm-cards--archive .pdm-card {
		display: grid;
		grid-template-columns: 120px minmax(0, 1fr);
		gap: 14px;
		align-items: start;
		padding: 14px 0;
		background: transparent;
		outline: 0;
		box-shadow: none;
		border-radius: 0;
		border-bottom: 1px solid var(--pdm-line);
	}
	.pdm .pdm-cards--archive .pdm-card:hover { box-shadow: none; }
	.pdm .pdm-cards--archive .pdm-card-img { border-radius: 4px; }
	.pdm .pdm-cards--archive .pdm-card-body { padding: 0; gap: 4px; }
	.pdm .pdm-cards--archive .pdm-card-title { font-size: 17px; }
	.pdm .pdm-cards--archive .pdm-card-intro { display: none; }
}

.pdm-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pdm-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 14px;
	border-radius: 4px;
	border: 1px solid var(--pdm-line-strong);
	color: var(--pdm-primary);
	text-decoration: none;
	font-weight: 600;
	background: #fff;
}
.pdm-pagination a.page-numbers:hover { background: var(--pdm-blush); }
.pdm-pagination .page-numbers.current { background: var(--pdm-primary); border-color: var(--pdm-primary); color: #fff; }
.pdm-pagination .page-numbers.dots { border-color: transparent; background: transparent; }

@media (prefers-reduced-motion: reduce) {
	.pdm .pdm-btn, .pdm .pdm-card { transition: none; }
}
