/*
Theme Name:   Paris2Tokyo
Theme URI:    https://www.paris2tokyo.com/
Author:       Paris2Tokyo
Description:  Custom editorial theme for the Paris2Tokyo travel podcast network. Sticky header, 80% content width, fully responsive, and built for search and AI-answer-engine discoverability. Data model and structured data live in the companion Paris2Tokyo Core plugin so this theme can be replaced without losing SEO.
Version:      1.0.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
License:      GPL-2.0-or-later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  paris2tokyo
Tags:         podcast, travel, custom-menu, featured-images, translation-ready
*/

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
	--ink:          #0B1A2F;
	--ink-soft:     #1B2E4A;
	--ink-muted:    #5A6B82;
	--gold:         #D6A84E;
	--gold-deep:    #B98C34;
	--coral:        #E86A54;
	--coral-deep:   #C9503C;
	--paper:        #F7F4EE;
	--paper-warm:   #FBF9F5;
	--white:        #FFFFFF;
	--line:         rgba(11, 26, 47, 0.12);
	--line-strong:  rgba(11, 26, 47, 0.22);

	--bg:           var(--paper);
	--surface:      var(--white);
	--text:         var(--ink);
	--text-muted:   var(--ink-muted);

	/* Text that sits ON a dark surface (pills, players, the skip link).
	   This MUST NOT be --paper: the dark theme redefines --paper to a dark navy
	   for use as a background, which silently turned every "colour: var(--paper)"
	   into dark-on-dark and made the active filter chip invisible. Keeping a
	   dedicated always-light token makes that class of bug impossible. */
	--on-ink:       #F7F4EE;

	/* Header needs its own surface. Deriving it from --bg made the bar
	   indistinguishable from the page behind it. */
	--header-bg:    #F1ECE3;
	--header-line:  rgba(11, 26, 47, 0.14);

	/* The brief: content occupies ~80% of the page width.
	   The cap was 1360px, which quietly broke the brief on any monitor wider
	   than 1700px — a 1920px screen got 1360px (71%), not 1536px (80%), leaving
	   180px of dead margin each side. Raised to 1900px so 80% is honoured on
	   every realistic display and the cap only engages on ultrawide panels. */
	--content-width: min(80%, 1900px);
	/* Was 72ch, which left roughly a third of the 80% wrap empty on a large
	   monitor and forced text to wrap early. Long-form pages now pair this
	   measure with a sidebar (see .p2t-longform) so the width is used rather
	   than merely filled with over-long lines. */
	--reading-width: 90ch;

	--header-h:     80px;

	--radius:       14px;
	--radius-lg:    22px;
	--radius-pill:  999px;

	--shadow-sm:    0 1px 2px rgba(11, 26, 47, 0.06), 0 2px 8px rgba(11, 26, 47, 0.04);
	--shadow-md:    0 4px 12px rgba(11, 26, 47, 0.08), 0 12px 32px rgba(11, 26, 47, 0.07);
	--shadow-lg:    0 12px 28px rgba(11, 26, 47, 0.12), 0 28px 64px rgba(11, 26, 47, 0.10);

	/* Montserrat everywhere, per brief. One family for both roles keeps the page
	   visually unified; weight and size carry the hierarchy instead of a second
	   typeface. */
	--font-sans:    "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-display: "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

	--ease:         cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg:          #0A1524;
		--surface:     #10203A;
		--text:        #EDF1F7;
		--text-muted:  #9FB0C7;
		--line:        rgba(237, 241, 247, 0.14);
		--line-strong: rgba(237, 241, 247, 0.26);
		--header-bg:   #122135;
		--header-line: rgba(237, 241, 247, 0.16);
	}
}

:root[data-theme="dark"] {
	--bg:          #0A1524;
	--surface:     #10203A;
	--text:        #EDF1F7;
	--text-muted:  #9FB0C7;
	--line:        rgba(237, 241, 247, 0.14);
	--line-strong: rgba(237, 241, 247, 0.26);
	--header-bg:   #122135;
	--header-line: rgba(237, 241, 247, 0.16);
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/*
 * The `hidden` attribute must actually hide things.
 *
 * `element.hidden = true` relies on the USER-AGENT rule `[hidden]{display:none}`,
 * and any author declaration beats a UA one — so a component rule as ordinary as
 * `.p2t-card { display: flex }` silently defeats it. That is what made the region
 * filter appear broken: the JS was hiding the right cards and the counter was
 * correct, but every card kept rendering because .p2t-card sets display:flex.
 *
 * Declaring it once here, with !important, makes `hidden` authoritative for every
 * element on the site regardless of what any component sets later.
 */
[hidden] { display: none !important; }

html {
	-webkit-text-size-adjust: 100%;
	/* Offsets in-page anchor targets so the sticky header never covers a heading
	   the user just jumped to — the classic sticky-nav bug. */
	scroll-padding-top: calc(var(--header-h) + 24px);
}

@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 1.0625rem;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;

	/* `clip`, NOT `hidden`. overflow-x:hidden makes <body> a scroll container,
	   which (a) breaks position:sticky — the header would stick to body's
	   scrollport instead of the viewport — and (b) moves scrolling off the
	   document element, so window.scrollY freezes at 0 and the .is-stuck
	   observer never fires. `clip` suppresses overflow without creating a
	   scroll container, so both keep working. Verified in-browser. */
	overflow-x: clip;
}

img, svg, video, canvas, audio, iframe, embed, object { display: block; max-width: 100%; }
img, video { height: auto; }

a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--coral); }

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-weight: 600;
	line-height: 1.18;
	letter-spacing: -0.015em;
	margin: 0 0 0.5em;
	text-wrap: balance; /* stops orphan words in headings on wide screens */
}

h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.7vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem); }

p { margin: 0 0 1.15em; text-wrap: pretty; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--coral);
	outline-offset: 3px;
	border-radius: 4px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

.skip-link {
	position: absolute; left: -9999px; top: 0; z-index: 1000;
	background: var(--ink); color: var(--on-ink);
	padding: 12px 20px; border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   Layout — the 80% rule
   ========================================================================== */

.p2t-wrap {
	width: var(--content-width);
	margin-inline: auto;
}

/* Below tablet, 80% wastes too much of a small screen: gutters become a few
   millimetres of thumb space. Widen the content and use fixed padding instead. */
@media (max-width: 900px) {
	:root { --content-width: 92%; }
}
@media (max-width: 560px) {
	:root { --content-width: 100%; --header-h: 68px; }
	.p2t-wrap { padding-inline: 18px; }
}

.p2t-narrow { max-width: var(--reading-width); }

.p2t-section { padding-block: clamp(3rem, 6vw, 6rem); }
.p2t-section--tight { padding-block: clamp(2rem, 4vw, 3.5rem); }

/* ==========================================================================
   Sticky header
   ========================================================================== */

.p2t-header {
	position: sticky;
	top: 0;
	z-index: 100;
	/* Its own surface, not a tint of --bg. Deriving the header from the page
	   background made the bar melt into the page. */
	background: color-mix(in srgb, var(--header-bg) 92%, transparent);
	backdrop-filter: saturate(180%) blur(16px);
	-webkit-backdrop-filter: saturate(180%) blur(16px);
	border-bottom: 1px solid var(--header-line);
	transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
	            background-color 0.25s var(--ease);
}

/* Only show the divider/shadow once the page has actually scrolled, so the
   header sits flush at rest instead of drawing a permanent line under itself. */
.p2t-header.is-stuck {
	box-shadow: var(--shadow-md);
	background: var(--header-bg);
}

/* Fallback for browsers without backdrop-filter: an almost-opaque bar, because
   a translucent header over scrolling text is unreadable without the blur. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.p2t-header { background: var(--header-bg); }
}

.p2t-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	height: var(--header-h);
}

.p2t-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; flex-shrink: 0; }
.p2t-brand img { height: clamp(32px, 3.4vw, 42px); width: auto; }
.p2t-brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.p2t-brand__name {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.38rem;
	letter-spacing: -0.02em;
	color: var(--text);
}

/* Emblem variant swap. The navy+red mark is shown on light grounds; the
   cream+red recolour on dark ones. Default is the light-ground mark, with the
   dark-ground one revealed by the same two signals the palette uses, so the
   theme toggle flips the logo in step with everything else. */
.p2t-brand__mark--on-dark { display: none; }

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .p2t-brand__mark--on-light { display: none; }
	:root:not([data-theme="light"]) .p2t-brand__mark--on-dark  { display: block; }
}
:root[data-theme="dark"] .p2t-brand__mark--on-light { display: none; }
:root[data-theme="dark"] .p2t-brand__mark--on-dark  { display: block; }
:root[data-theme="light"] .p2t-brand__mark--on-light { display: block; }
:root[data-theme="light"] .p2t-brand__mark--on-dark  { display: none; }

.p2t-nav { display: flex; align-items: center; gap: 4px; }
.p2t-nav ul { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.p2t-nav a {
	display: block;
	padding: 11px 18px;
	border-radius: var(--radius-pill);
	font-size: 1.06rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--text);
	white-space: nowrap;
	transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.p2t-nav a:hover { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.p2t-nav .current-menu-item > a,
.p2t-nav .current_page_item > a,
.p2t-nav [aria-current="page"] {
	background: color-mix(in srgb, var(--coral) 14%, transparent);
	color: var(--coral-deep);
	font-weight: 600;
}

.p2t-header__actions { display: flex; align-items: center; gap: 10px; }

.p2t-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 12px 24px;
	border-radius: var(--radius-pill);
	border: 1px solid transparent;
	font-size: 1.02rem; font-weight: 600;
	text-decoration: none; cursor: pointer;
	transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease),
	            background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.p2t-btn--primary { background: var(--coral); color: #fff; box-shadow: var(--shadow-sm); }
.p2t-btn--primary:hover { background: var(--coral-deep); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.p2t-btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.p2t-btn--ghost:hover { border-color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.p2t-btn--sm { padding: 9px 18px; font-size: 0.94rem; }

/* Hamburger — hidden until the breakpoint where the nav can no longer fit. */
.p2t-burger {
	display: none;
	width: 42px; height: 42px;
	align-items: center; justify-content: center;
	background: transparent; border: 1px solid var(--line-strong);
	border-radius: 12px; cursor: pointer; color: var(--text);
	padding: 0;
}
.p2t-burger span {
	display: block; position: relative;
	width: 18px; height: 2px; background: currentColor; border-radius: 2px;
	transition: transform 0.25s var(--ease), background-color 0.15s var(--ease);
}
.p2t-burger span::before,
.p2t-burger span::after {
	content: ""; position: absolute; left: 0;
	width: 18px; height: 2px; background: currentColor; border-radius: 2px;
	transition: transform 0.25s var(--ease), top 0.2s var(--ease);
}
.p2t-burger span::before { top: -6px; }
.p2t-burger span::after  { top: 6px; }
.p2t-burger[aria-expanded="true"] span { background: transparent; }
.p2t-burger[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.p2t-burger[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

@media (max-width: 1024px) {
	.p2t-burger { display: inline-flex; }
	.p2t-nav {
		position: fixed;
		inset: var(--header-h) 0 auto 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		background: var(--surface);
		border-bottom: 1px solid var(--line);
		box-shadow: var(--shadow-lg);
		padding: 12px 0 20px;
		max-height: calc(100dvh - var(--header-h));
		overflow-y: auto;
		/* Animate from clipped rather than display:none so the transition runs and
		   the menu is removed from the tab order when closed. */
		clip-path: inset(0 0 100% 0);
		visibility: hidden;
		transition: clip-path 0.3s var(--ease), visibility 0s linear 0.3s;
	}
	.p2t-nav.is-open {
		clip-path: inset(0 0 0 0);
		visibility: visible;
		transition: clip-path 0.3s var(--ease), visibility 0s;
	}
	.p2t-nav ul { flex-direction: column; align-items: stretch; gap: 0; width: var(--content-width); margin-inline: auto; }
	.p2t-nav a { padding: 14px 16px; border-radius: 10px; font-size: 1.02rem; }
	.p2t-header__actions .p2t-btn--primary { display: none; }
	.p2t-nav .p2t-nav__cta { width: var(--content-width); margin: 14px auto 0; }
	.p2t-nav .p2t-nav__cta .p2t-btn { width: 100%; }
}

@media (min-width: 1025px) {
	.p2t-nav__cta { display: none; }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.p2t-hero { position: relative; padding-block: clamp(3rem, 7vw, 6.5rem); overflow: hidden; }
.p2t-hero::before {
	content: ""; position: absolute; inset: -30% -10% auto -10%; height: 140%;
	background:
		radial-gradient(48% 55% at 18% 20%, color-mix(in srgb, var(--gold) 26%, transparent), transparent 70%),
		radial-gradient(42% 50% at 82% 12%, color-mix(in srgb, var(--coral) 22%, transparent), transparent 70%);
	pointer-events: none; z-index: 0;
}
.p2t-hero > * { position: relative; z-index: 1; }
.p2t-hero__eyebrow {
	display: inline-flex; align-items: center; gap: 8px;
	font-size: 0.76rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
	color: var(--coral-deep);
	background: color-mix(in srgb, var(--coral) 12%, transparent);
	padding: 7px 14px; border-radius: var(--radius-pill); margin-bottom: 20px;
}
.p2t-hero__lede { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem); color: var(--text-muted); max-width: 60ch; }
.p2t-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* ==========================================================================
   Cards & grids
   ========================================================================== */

.p2t-grid { display: grid; gap: clamp(16px, 2vw, 28px); }

/*
 * NOTE: auto-FILL, never auto-FIT, on any grid that gets filtered.
 *
 * auto-fit collapses empty tracks to zero and then lets `1fr` share the space
 * among the survivors — so filtering 100 cards down to 3 inflates each one to a
 * third of the row, and a single result becomes a full-width slab. auto-fill
 * keeps the empty tracks, so a card is the same size whether one or a hundred
 * are showing.
 *
 * The show grid goes further and uses explicit column counts identical to the
 * featured grid, so a card is exactly the same size on the homepage and on the
 * archive, filtered or not. Consistency here is worth more than squeezing in an
 * extra column at an odd width.
 */
.p2t-grid--shows    { grid-template-columns: repeat(6, minmax(0, 1fr)); }  /* >1700px only */
.p2t-grid--episodes { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.p2t-grid--3        { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }

@media (max-width: 1700px) { .p2t-grid--shows { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1400px) { .p2t-grid--shows { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .p2t-grid--shows { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 780px)  { .p2t-grid--shows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .p2t-grid--shows { grid-template-columns: 1fr; } }

/* Cards in a row must be the same height regardless of copy length, and the
   artwork must not grow with the card — both are what made filtered results
   look like a different component. */
.p2t-grid--shows > .p2t-card,
.p2t-grid--featured > .p2t-card { height: 100%; }

.p2t-card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	overflow: hidden;
	display: flex; flex-direction: column;
	text-decoration: none; color: inherit;
	transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.p2t-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
@media (prefers-reduced-motion: reduce) { .p2t-card:hover { transform: none; } }

.p2t-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	/* Hard ceiling so a wide card cannot render a giant empty square while
	   artwork is still pending. */
	max-height: 320px;
	background: var(--ink-soft);
	overflow: hidden;
}
.p2t-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.p2t-card:hover .p2t-card__media img { transform: scale(1.04); }
.p2t-card__flag {
	position: absolute; top: 12px; left: 12px;
	background: rgba(11, 26, 47, 0.78); color: #fff;
	font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
	padding: 5px 10px; border-radius: var(--radius-pill);
	backdrop-filter: blur(6px);
}
.p2t-card__body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.p2t-card__title {
	font-family: var(--font-display);
	font-size: 1.14rem;
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	/* Two lines, always. "Bosnia and Herzegovina Travel Podcast with Amina
	   Begović" wraps to three while "Japan Travel Podcast with Yuki Tanaka"
	   takes two, which made neighbouring cards different heights. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(2 * 1.3em);
}
.p2t-card__meta { font-size: 0.83rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.p2t-card__excerpt {
	font-size: 0.93rem;
	color: var(--text-muted);
	margin: 0;
	/* Clamp to four lines so a long description cannot make one card in a
	   row noticeably taller than its neighbours. */
	display: -webkit-box;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.p2t-card--episode .p2t-card__media { aspect-ratio: 16 / 9; }

/* ==========================================================================
   Audio player
   ========================================================================== */

.p2t-player {
	background: var(--ink);
	color: var(--on-ink);
	border-radius: var(--radius-lg);
	padding: clamp(18px, 2.4vw, 26px);
	display: flex; flex-direction: column; gap: 14px;
	box-shadow: var(--shadow-md);
}
.p2t-player__top { display: flex; align-items: center; gap: 16px; }
.p2t-player__cover { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.p2t-player__meta { min-width: 0; }
.p2t-player__title { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 2px; color: #fff; }
.p2t-player__sub { font-size: 0.84rem; color: rgba(247, 244, 238, 0.66); margin: 0; }
.p2t-player audio { width: 100%; }

.p2t-subscribe { display: flex; flex-wrap: wrap; gap: 10px; }
.p2t-subscribe a {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 9px 16px; border-radius: var(--radius-pill);
	border: 1px solid var(--line-strong);
	font-size: 0.86rem; font-weight: 600; text-decoration: none;
	background: var(--surface);
	transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.p2t-subscribe a:hover { border-color: var(--coral); transform: translateY(-1px); }

/* ==========================================================================
   Article / transcript
   ========================================================================== */

.p2t-article { max-width: var(--reading-width); }
.p2t-article h2 { margin-top: 1.8em; }
.p2t-article h3 { margin-top: 1.5em; }
.p2t-article ul, .p2t-article ol { padding-left: 1.3em; margin-bottom: 1.2em; }
.p2t-article li { margin-bottom: 0.45em; }
.p2t-article blockquote {
	margin: 1.6em 0; padding: 4px 0 4px 22px;
	border-left: 3px solid var(--gold);
	font-family: var(--font-display); font-size: 1.12rem; font-style: italic; color: var(--text-muted);
}
.p2t-article img { border-radius: var(--radius); margin-block: 1.6em; }
.p2t-article table { width: 100%; border-collapse: collapse; margin-block: 1.6em; font-size: 0.94rem; }
.p2t-article th, .p2t-article td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.p2t-article th { font-weight: 700; background: color-mix(in srgb, var(--gold) 10%, transparent); }

/* Any wide element scrolls inside itself rather than forcing the page sideways. */
.p2t-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.p2t-article > table { display: block; overflow-x: auto; }

.p2t-transcript { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-top: 40px; }
.p2t-transcript > summary {
	cursor: pointer; padding: 18px 22px; font-weight: 700;
	font-family: var(--font-display); font-size: 1.1rem;
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	list-style: none;
}
.p2t-transcript > summary::-webkit-details-marker { display: none; }
.p2t-transcript > summary::after { content: "＋"; color: var(--coral); font-size: 1.2rem; }
.p2t-transcript[open] > summary::after { content: "－"; }
.p2t-transcript__body { padding: 0 22px 24px; max-width: var(--reading-width); }
.p2t-transcript__body p { font-size: 0.98rem; }

/* ==========================================================================
   Footer
   ========================================================================== */

.p2t-footer { background: var(--ink); color: rgba(247, 244, 238, 0.8); margin-top: clamp(3rem, 6vw, 6rem); }
.p2t-footer a { color: rgba(247, 244, 238, 0.8); text-decoration: none; }
.p2t-footer a:hover { color: var(--gold); text-decoration: underline; }
.p2t-footer__grid {
	display: grid; gap: 32px;
	grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
	padding-block: clamp(2.5rem, 5vw, 4rem);
}
.p2t-footer__title {
	font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase;
	color: var(--gold); font-weight: 700; margin-bottom: 14px;
}
.p2t-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 0.93rem; }
.p2t-footer__bottom {
	border-top: 1px solid rgba(247, 244, 238, 0.14);
	padding-block: 22px;
	display: flex; flex-wrap: wrap; gap: 12px 24px;
	align-items: center; justify-content: space-between;
	font-size: 0.85rem; color: rgba(247, 244, 238, 0.55);
}

/* ==========================================================================
   Utilities & misc
   ========================================================================== */

.p2t-section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.p2t-section__head p { color: var(--text-muted); margin: 6px 0 0; max-width: 62ch; }
.p2t-eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 8px; }

.p2t-breadcrumbs { font-size: 0.84rem; color: var(--text-muted); padding-block: 18px 0; }
.p2t-breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.p2t-breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.p2t-breadcrumbs a { text-decoration: none; }
.p2t-breadcrumbs a:hover { color: var(--coral); }

.p2t-pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 48px; }
.p2t-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 42px; height: 42px; padding: 0 12px;
	border: 1px solid var(--line); border-radius: 12px;
	text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.p2t-pagination .page-numbers:hover { border-color: var(--text); }
.p2t-pagination .current { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.p2t-search { display: flex; gap: 8px; }
.p2t-search input[type="search"] {
	flex: 1; min-width: 0;
	padding: 12px 18px; border-radius: var(--radius-pill);
	border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
	font: inherit; font-size: 0.96rem;
}
.p2t-search input[type="search"]:focus { border-color: var(--coral); }

.p2t-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* Region filter chips on the podcasts index. */
.p2t-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.p2t-chip {
	padding: 8px 16px; border-radius: var(--radius-pill);
	border: 1px solid var(--line-strong); background: var(--surface);
	font-size: 0.87rem; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
	transition: all 0.18s var(--ease);
}
.p2t-chip:hover { border-color: var(--text); }
.p2t-chip.is-active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* Print: strip chrome so an episode page prints as a clean transcript. */
@media print {
	.p2t-header, .p2t-footer, .p2t-player, .p2t-subscribe, .p2t-pagination, .skip-link { display: none !important; }
	body { background: #fff; color: #000; }
	:root { --content-width: 100%; }
	.p2t-transcript { border: none; }
	.p2t-transcript__body { padding: 0; }
}

/* ==========================================================================
   Show page — hero, stat tiles, country file
   ========================================================================== */

.p2t-showhead {
	display: grid;
	gap: clamp(24px, 4vw, 52px);
	grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
	align-items: start;
}
@media (max-width: 820px) {
	.p2t-showhead { grid-template-columns: 1fr; }
	.p2t-showhead__art { max-width: 320px; }
}

.p2t-showhead__art img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
}
.p2t-showhead__placeholder {
	width: 100%;
	aspect-ratio: 1;
	border-radius: var(--radius-lg);
	background: linear-gradient(140deg, var(--ink-soft), var(--ink));
	display: grid;
	place-items: center;
	box-shadow: var(--shadow-md);
}
.p2t-showhead__placeholder span {
	font-family: var(--font-display);
	font-size: clamp(3rem, 8vw, 5rem);
	font-weight: 700;
	color: var(--gold);
	letter-spacing: 0.04em;
}

.p2t-showhead__host { color: var(--text-muted); margin-bottom: 18px; }
.p2t-showhead__intro { max-width: none; }
.p2t-listen { margin-top: 26px; }

/* Stat tiles. auto-FILL for the same reason as the show grid: a country
   missing several indicators would otherwise get wide stretched tiles that
   look like a different design from a country with the full set. */
.p2t-stats {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
}
.p2t-stat {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px 18px;
}
.p2t-stat__label {
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin-bottom: 6px;
}
.p2t-stat__value {
	font-family: var(--font-display);
	font-size: 1.02rem;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere; /* long Factbook strings must not widen the grid */
}

.p2t-depth > details { margin-bottom: 12px; }

.p2t-fact { padding-block: 14px; border-top: 1px solid var(--line); }
.p2t-fact:first-child { border-top: 0; padding-top: 0; }
.p2t-fact__label {
	font-family: var(--font-sans);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--gold-deep);
	margin: 0 0 8px;
}
/* No measure cap: these sit inside an already-bounded panel, and capping
   them again wrapped text at ~640px inside a 1100px container. */
.p2t-fact p { margin: 0 0 0.7em; }
.p2t-fact p:last-child { margin-bottom: 0; }

/* Factbook "label: value" pairs. Two columns on wide screens, stacked on narrow,
   with the label column bounded so a long label cannot squeeze the value out. */
.p2t-facts { display: grid; grid-template-columns: minmax(120px, 210px) 1fr; gap: 6px 20px; margin: 0; }
.p2t-facts dt { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
.p2t-facts dd { margin: 0; font-size: 0.95rem; overflow-wrap: anywhere; }
@media (max-width: 620px) {
	.p2t-facts { grid-template-columns: 1fr; gap: 2px 0; }
	.p2t-facts dt { margin-top: 10px; }
}

.p2t-source {
	margin-top: 22px;
	font-size: 0.84rem;
	color: var(--text-muted);
	max-width: 78ch;
}

/* ==========================================================================
   Long-form layout — content + sticky contents rail
   --------------------------------------------------------------------------
   A single 78ch column inside an 80%-wide wrap leaves roughly a third of a
   large screen empty, and shortens every line so text wraps far earlier than
   it needs to. Rather than stretching prose to 140 characters (unreadable),
   the leftover column carries a sticky table of contents, which fills the
   space with something useful and makes long legal pages navigable.
   ========================================================================== */

.p2t-longform {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: clamp(32px, 5vw, 72px);
	align-items: start;
}
.p2t-longform > .p2t-article { max-width: none; }

@media (max-width: 1024px) {
	.p2t-longform { grid-template-columns: 1fr; }
	.p2t-toc { position: static; order: -1; }
}

.p2t-toc {
	position: sticky;
	top: calc(var(--header-h) + 24px);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 22px 24px;
	font-size: 0.95rem;
}
.p2t-toc__title {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--gold-deep);
	margin-bottom: 12px;
}
.p2t-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; counter-reset: toc; }
.p2t-toc li { counter-increment: toc; }
.p2t-toc a {
	text-decoration: none;
	color: var(--text-muted);
	display: block;
	line-height: 1.4;
	transition: color 0.15s var(--ease);
}
.p2t-toc a::before {
	content: counter(toc) ". ";
	color: var(--coral);
	font-weight: 700;
}
.p2t-toc a:hover, .p2t-toc a.is-current { color: var(--text); }

/* ==========================================================================
   Hero — fill the right-hand void with the network figures
   ========================================================================== */

.p2t-hero__grid {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
	gap: clamp(28px, 5vw, 72px);
	align-items: center;
}
@media (max-width: 940px) {
	.p2t-hero__grid { grid-template-columns: 1fr; }
}

.p2t-hero__lede { max-width: 56ch; }

.p2t-figures {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}
.p2t-figure {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 22px 20px;
}
.p2t-figure__n {
	font-family: var(--font-display);
	font-size: clamp(1.9rem, 1.2rem + 2vw, 2.9rem);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
	color: var(--coral);
}
.p2t-figure__l {
	margin-top: 8px;
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--text-muted);
	line-height: 1.35;
}

/* FAQ in two columns so it does not run as a thin ribbon down the page. */
.p2t-faq {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
	gap: 14px;
	align-items: start;
}
.p2t-faq > details { margin: 0; }

/* Section intros were capped at 62ch inside a much wider container. */
.p2t-section__head p { max-width: 92ch; }

/* Result bar on the podcasts index. */
.p2t-resultbar {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 22px;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--text-muted);
}
.p2t-resultbar__reset {
	color: var(--coral);
	text-decoration: none;
	font-weight: 700;
}
.p2t-resultbar__reset:hover { text-decoration: underline; }

/* Chips are <a>, so give them button affordance for keyboard users. */
.p2t-chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* Year badge on a stat tile — provenance without a footnote. */
.p2t-stat__label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.p2t-stat__year {
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--coral);
	background: color-mix(in srgb, var(--coral) 14%, transparent);
	padding: 2px 7px;
	border-radius: var(--radius-pill);
}

/* ==========================================================================
   Featured grid — 5 across on desktop, stepping down by device
   --------------------------------------------------------------------------
   Explicit column counts rather than auto-fit: the brief is five per row, and
   auto-fit would give whatever happens to fit (six on a wide monitor, four on a
   slightly narrower one) rather than a stable, designed rhythm of 5 + 5.
   ========================================================================== */

.p2t-grid--featured { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1500px) { .p2t-grid--featured { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1150px) { .p2t-grid--featured { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .p2t-grid--featured { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .p2t-grid--featured { grid-template-columns: 1fr; } }

/* No type overrides here on purpose. Shrinking the font in this grid made
   featured cards 439px tall against 458px on the archive — the same component
   rendering at two sizes, which is exactly the inconsistency we are removing.
   One card, one size, everywhere. */

/* Section head can now hold more than one control. */
.p2t-headactions { display: flex; gap: 8px; flex-wrap: wrap; }
.p2t-btn[disabled] { opacity: 0.55; cursor: default; }

/* Nested Factbook rows ("agricultural land: arable land") read as children. */
.p2t-facts dt.is-nested {
	padding-left: 16px;
	font-weight: 500;
	opacity: 0.85;
}
.p2t-facts dt.is-nested::before {
	content: "└ ";
	opacity: 0.5;
}
