/*
 * Default page template.
 *
 * Styles editor output for pages built in the block/classic editor. Colours come from
 * the ACF theme settings exposed as CSS custom properties in header.php, so changing
 * the palette in wp-admin still works. The literal values are fallbacks only, for when
 * a variable is unset.
 */

.page-default {
	--pd-accent: var(--button_main_background, #f69104);
	--pd-card: var(--card_item_background, #006cd1);
	--pd-text: var(--color_text_default, #ffffff);
	--pd-muted: rgba(255, 255, 255, 0.72);
	--pd-line: rgba(255, 255, 255, 0.14);
	--pd-surface: rgba(255, 255, 255, 0.05);
	--pd-radius: 12px;

	padding: 24px 0 64px;
	color: var(--pd-text);
}

/* ---------- Two-column layout ---------- */

.page-default__layout {
	max-width: 1180px;
	margin: 0 auto;
}

/* Article left, sticky contents right. Single column until there is room for both. */
@media (min-width: 1080px) {
	.page-default--has-toc .page-default__layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 300px;
		gap: 48px;
		align-items: start;
	}
}

.page-default .article {
	max-width: 820px;
	min-width: 0;
}

.page-default:not(.page-default--has-toc) .article {
	margin: 0 auto;
}

.page-default__sidebar {
	position: sticky;
	/* The site header is sticky and ~162px tall, so anything less hides the box under it. */
	top: 178px;
	min-width: 0;
}

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

.page-default .article__head {
	padding-bottom: 20px;
	margin-bottom: 28px;
	border-bottom: 1px solid var(--pd-line);
}

.page-default .article__title {
	margin: 0 0 12px;
	font-size: clamp(1.65rem, 4vw, 2.5rem);
	line-height: 1.15;
	font-weight: 700;
	text-transform: none;
}

.page-default .article__standfirst {
	margin: 0 0 14px;
	font-size: clamp(1rem, 2vw, 1.2rem);
	line-height: 1.55;
	color: var(--pd-muted);
}

.page-default .article__updated {
	margin: 0;
	font-size: 0.84rem;
	color: var(--pd-muted);
}

/* ---------- Meta row (date · author · views · reading time · 18+) ---------- */

.page-default .article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 20px;
	margin-bottom: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--pd-line);
	font-size: 0.88rem;
	color: var(--pd-text);
}

.page-default .article__meta-item {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	white-space: nowrap;
}

.page-default .article__meta-item .icon {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	color: var(--pd-accent);
}

.page-default .article__meta time,
.page-default .article__meta span {
	color: inherit;
}

.page-default .article__age {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	padding: 3px 9px;
	border: 1px solid var(--pd-accent);
	border-radius: 999px;
	color: var(--pd-accent);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.03em;
}

/* ---------- Body typography ---------- */

.page-default .article__body {
	font-size: 1.02rem;
	line-height: 1.72;
}

/*
 * Flow spacing. The reset has to be a separate rule of equal specificity that comes
 * first, so the "+ *" rule wins for every child after the first. A `p { margin: 0 }`
 * rule further down used to out-specify this one and collapse all paragraph spacing.
 */
.page-default .article__body > * {
	margin-top: 0;
	margin-bottom: 0;
}

.page-default .article__body > * + * {
	margin-top: 1.15em;
}

.page-default .article__body h2 {
	margin: 2.2em 0 0.6em;
	font-size: clamp(1.35rem, 2.6vw, 1.75rem);
	line-height: 1.25;
	font-weight: 600;
	text-transform: none;
	color: var(--pd-text);
}

.page-default .article__body h2::after {
	content: '';
	display: block;
	width: 46px;
	height: 3px;
	margin-top: 10px;
	border-radius: 2px;
	background: var(--pd-accent);
}

.page-default .article__body h3 {
	margin: 1.7em 0 0.5em;
	font-size: clamp(1.12rem, 2vw, 1.3rem);
	font-weight: 600;
	color: var(--pd-text);
}

.page-default .article__body h4 {
	margin: 1.4em 0 0.4em;
	font-size: 1.03rem;
	font-weight: 600;
	color: var(--pd-muted);
}

.page-default .article__body a {
	color: var(--pd-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

.page-default .article__body a:hover {
	text-decoration-thickness: 2px;
}

.page-default .article__body strong {
	color: #fff;
	font-weight: 600;
}

.page-default .article__body ul,
.page-default .article__body ol {
	padding-left: 1.35em;
}

.page-default .article__body li + li {
	margin-top: 0.5em;
}

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

.page-default .article__body ul > li {
	position: relative;
	padding-left: 1.5em;
}

.page-default .article__body ul > li::before {
	content: '';
	position: absolute;
	left: 0.35em;
	top: 0.62em;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--pd-accent);
}

.page-default .article__body blockquote {
	margin: 1.6em 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--pd-accent);
	font-size: 1.06rem;
	color: var(--pd-muted);
}

.page-default .article__body blockquote p {
	margin: 0;
}

.page-default .article__body img {
	max-width: 100%;
	height: auto;
	border-radius: var(--pd-radius);
}

.page-default .article__body figure {
	margin: 1.6em 0;
}

.page-default .article__body figcaption {
	margin-top: 8px;
	font-size: 0.85rem;
	color: var(--pd-muted);
}

/* ---------- Tables ---------- */

/* Wide tables must scroll inside their own box, never the page body. */
.page-default .article__body .table-scroll,
.page-default .article__body figure.wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 1.7em 0;
}

.page-default .article__body table {
	width: 100%;
	min-width: 460px;
	border-collapse: collapse;
	font-size: 0.94rem;
	background: var(--pd-surface);
	border-radius: var(--pd-radius);
	overflow: hidden;
}

.page-default .article__body th,
.page-default .article__body td {
	padding: 11px 14px;
	text-align: left;
	border-bottom: 1px solid var(--pd-line);
}

.page-default .article__body th {
	background: rgba(0, 0, 0, 0.25);
	font-weight: 600;
	font-size: 0.83rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--pd-muted);
}

.page-default .article__body tr:last-child td {
	border-bottom: 0;
}

/* ---------- Notices ---------- */

.page-default .notice {
	margin: 26px 0;
	padding: 16px 18px;
	border-radius: var(--pd-radius);
	background: var(--pd-surface);
	border-left: 3px solid var(--pd-accent);
	font-size: 0.93rem;
	line-height: 1.6;
	color: var(--pd-muted);
}

.page-default .notice strong {
	color: #fff;
}

.page-default .notice a {
	color: var(--pd-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.page-default .notice--help {
	margin-top: 44px;
	border-left-color: #4ade80;
}

.page-default .notice--help h2 {
	margin: 0 0 8px;
	font-size: 1.1rem;
	font-weight: 600;
	text-transform: none;
	color: #fff;
}

.page-default .notice--help h2::after {
	display: none;
}

/* ---------- Table of contents ---------- */

.page-default .toc {
	padding: 18px 20px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	/* Long contents lists scroll inside the box rather than outgrowing the viewport. */
	max-height: calc(100vh - 210px);
	overflow-y: auto;
}

.page-default .toc__title {
	margin: 0 0 12px;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--pd-muted);
}

.page-default .toc ul {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9rem;
	line-height: 1.45;
}

.page-default .toc li {
	position: relative;
	padding-left: 14px;
}

.page-default .toc li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.55em;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--pd-muted);
}

.page-default .toc li + li {
	margin-top: 9px;
}

.page-default .toc a {
	color: var(--pd-text);
	text-decoration: none;
}

.page-default .toc a:hover {
	color: var(--pd-accent);
}

/* Below the two-column breakpoint the contents box sits above the article. */
@media (max-width: 1079px) {
	.page-default__sidebar {
		position: static;
		order: -1;
		margin-bottom: 26px;
	}

	.page-default--has-toc .page-default__layout {
		display: flex;
		flex-direction: column;
	}

	.page-default .toc {
		max-height: none;
	}
}

/* ---------- Call to action ---------- */

.page-default .article__body .cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin: 2em 0;
	padding: 20px 22px;
	border-radius: var(--pd-radius);
	background: linear-gradient(135deg, var(--pd-card), rgba(0, 14, 163, 0.9));
}

.page-default .article__body .cta__text {
	flex: 1 1 260px;
	font-size: 1.02rem;
	font-weight: 600;
	color: #fff;
}

.page-default .article__body .cta__note {
	display: block;
	margin-top: 4px;
	font-size: 0.8rem;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.72);
}

/* ---------- Accordion (FAQ) ---------- */

.page-default .faq {
	margin: 2.2em 0;
}

.page-default .faq > div {
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	background: var(--pd-surface);
}

.page-default .faq > div + div {
	margin-top: 10px;
}

.page-default .faq h3 {
	margin: 0;
	font-size: 1rem;
}

.page-default .faq .accordion__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 15px 18px;
	background: none;
	border: 0;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}

.page-default .faq .accordion__trigger .icon {
	flex: 0 0 auto;
	transition: transform 0.25s ease;
}

.page-default .faq .accordion__trigger[aria-expanded='true'] .icon {
	transform: rotate(180deg);
}

.page-default .faq .description {
	padding: 0 18px 16px;
	font-size: 0.96rem;
	line-height: 1.65;
	color: var(--pd-muted);
}

.page-default .faq .description > *:first-child {
	margin-top: 0;
}

/* ---------- Breadcrumbs ---------- */

.page-default .breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 auto 20px;
	padding: 0;
	/* Matches .page-default__layout so the trail lines up with the article column. */
	max-width: 1180px;
	list-style: none;
	font-size: 0.85rem;
	color: var(--pd-muted);
}

.page-default .breadcrumb a {
	color: var(--pd-muted);
	text-decoration: none;
}

.page-default .breadcrumb a:hover {
	color: var(--pd-accent);
	text-decoration: underline;
}

/* ---------- Small screens ---------- */

@media (max-width: 767px) {
	.page-default {
		padding: 16px 0 48px;
	}

	.page-default .article__body {
		font-size: 1rem;
	}

	.page-default .article__body .cta {
		padding: 16px;
	}

	.page-default .notice {
		padding: 14px 15px;
	}
}

/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
	.page-default .faq .accordion__trigger .icon {
		transition: none;
	}
}

/* ---------- Author: avatar, byline, bio box, archive ---------- */

.author-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var(--avatar-size, 56px);
	height: var(--avatar-size, 56px);
	border-radius: 50%;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.16);
}

.author-avatar__img,
.author-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Initials stand in for a portrait — see pp_author_avatar(). */
.author-avatar--initials {
	background: linear-gradient(145deg, rgba(246, 145, 4, 0.9), rgba(246, 145, 4, 0.6));
	color: #0a0a0a;
	font-size: calc(var(--avatar-size, 56px) * 0.38);
	font-weight: 700;
	letter-spacing: 0.02em;
}

.page-default .article__author {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-color: rgba(255, 255, 255, 0.35);
}

.page-default .article__author:hover {
	color: var(--pd-accent);
	text-decoration-color: currentColor;
}

/* Bio box at the foot of an article */

.author-box {
	margin: 40px 0 0;
	padding: 16px 18px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
}

.author-box__head {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	justify-content: space-between;
}

.author-box__head > .author-avatar {
	order: -1;
}

/* Avatar + name group sits together; the profile link is pushed to the far end. */
.author-box__id {
	flex: 1 1 220px;
}

.author-box__link {
	flex: 0 0 auto;
	padding: 9px 16px;
	border: 1px solid var(--pd-line);
	border-radius: 999px;
	color: var(--pd-text);
	font-size: 0.86rem;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 0.25s ease, color 0.25s ease;
}

.author-box__link:hover {
	border-color: var(--pd-accent);
	color: var(--pd-accent);
}

.author-box__kicker {
	margin: 0 0 2px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--pd-muted);
}

.author-box__name {
	margin: 0;
	font-size: 1.08rem;
	font-weight: 600;
	color: #fff;
}

.author-box__name a {
	color: inherit;
	text-decoration: none;
}

.author-box__name a:hover {
	color: var(--pd-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.author-box__meta {
	margin: 3px 0 0;
	font-size: 0.85rem;
	color: var(--pd-muted);
}

/* Author archive */

.author-page .article {
	max-width: 820px;
	margin: 0 auto;
}

.author-hero {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	gap: 8px 18px;
	padding-bottom: 24px;
	margin-bottom: 32px;
	border-bottom: 1px solid var(--pd-line);
}

.author-hero__kicker {
	margin: 0 0 4px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--pd-muted);
}

.author-hero__name {
	margin: 0;
	font-size: clamp(1.5rem, 3.4vw, 2.1rem);
	line-height: 1.15;
	font-weight: 700;
	text-transform: none;
}

.author-hero__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin: 6px 0 0;
	font-size: 0.9rem;
	color: var(--pd-muted);
}

.author-hero__bio {
	grid-column: 1 / -1;
	margin-top: 18px;
	font-size: 1rem;
	line-height: 1.72;
	color: var(--pd-muted);
}

.author-hero__bio p {
	margin: 0 0 1em;
}

.author-hero__bio p:last-child {
	margin-bottom: 0;
}

@media (max-width: 600px) {
	.author-hero {
		grid-template-columns: 1fr;
	}
}

.author-works h2 {
	margin: 0 0 18px;
	font-size: 1.2rem;
	font-weight: 600;
	text-transform: none;
	color: #fff;
}

.author-works__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.author-works__link {
	display: block;
	padding: 16px 18px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	text-decoration: none;
	transition: border-color 0.25s ease, background 0.25s ease;
}

@media (any-hover: hover) {
	.author-works__link:hover {
		background: rgba(255, 255, 255, 0.08);
		border-color: rgba(246, 145, 4, 0.42);
	}
}

.author-works__title {
	display: block;
	font-size: 1.02rem;
	font-weight: 600;
	color: #fff;
	line-height: 1.35;
}

.author-works__excerpt {
	display: block;
	margin-top: 6px;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--pd-muted);
}

.author-works__date {
	display: block;
	margin-top: 8px;
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.5);
}

.author-works__pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 26px 0 0;
	padding: 0;
	list-style: none;
}

.author-works__pagination a,
.author-works__pagination .current {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	min-height: 38px;
	padding: 0 10px;
	border: 1px solid var(--pd-line);
	border-radius: 8px;
	color: var(--pd-text);
	text-decoration: none;
	font-size: 0.9rem;
}

.author-works__pagination .current {
	background: var(--pd-accent);
	border-color: var(--pd-accent);
	color: #0a0a0a;
	font-weight: 700;
}

/* ---------- Blog: archive cards, categories, related posts ---------- */

.archive-hero {
	max-width: 820px;
	margin: 0 auto 34px;
	padding-bottom: 22px;
	border-bottom: 1px solid var(--pd-line);
}

.archive-hero__title {
	margin: 0 0 10px;
	font-size: clamp(1.7rem, 4vw, 2.4rem);
	font-weight: 700;
	text-transform: none;
}

.archive-hero__intro {
	margin: 0;
	font-size: 1.02rem;
	line-height: 1.6;
	color: var(--pd-muted);
}

.archive-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 16px;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
}

.card {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 20px 22px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	transition: border-color 0.25s ease, background 0.25s ease;
}

@media (any-hover: hover) {
	.card:hover {
		background: rgba(255, 255, 255, 0.08);
		border-color: rgba(246, 145, 4, 0.42);
	}
}

.card__link {
	text-decoration: none;
	color: inherit;
}

.card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 0.8rem;
	color: rgba(255, 255, 255, 0.5);
}

.card__title {
	margin: 8px 0 0;
	font-size: 1.1rem;
	line-height: 1.35;
	font-weight: 600;
	text-transform: none;
	color: #fff;
}

.card__title::after {
	display: none;
}

.card__excerpt {
	display: block;
	margin-top: 10px;
	font-size: 0.92rem;
	line-height: 1.6;
	color: var(--pd-muted);
}

.card__cats {
	margin: 14px 0 0;
}

/* Category chips */

.article__cats,
.card__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.article__cat {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border: 1px solid var(--pd-line);
	border-radius: 999px;
	font-size: 0.78rem;
	color: var(--pd-muted);
	text-decoration: none;
}

.article__cat:hover {
	border-color: var(--pd-accent);
	color: var(--pd-accent);
}

.page-default .article__cats {
	margin: 0 0 12px;
}

/* Related posts */

.related {
	margin-top: 40px;
	padding-top: 26px;
	border-top: 1px solid var(--pd-line);
}

.related__title {
	margin: 0 0 16px;
	font-size: 1.15rem;
	font-weight: 600;
	text-transform: none;
	color: #fff;
}

.related__title::after {
	display: none;
}

.related__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.related__link {
	display: block;
	padding: 14px 16px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	text-decoration: none;
	transition: border-color 0.25s ease, background 0.25s ease;
}

@media (any-hover: hover) {
	.related__link:hover {
		background: rgba(255, 255, 255, 0.08);
		border-color: rgba(246, 145, 4, 0.42);
	}
}

.related__name {
	display: block;
	font-size: 0.98rem;
	font-weight: 600;
	line-height: 1.35;
	color: #fff;
}

.related__excerpt {
	display: block;
	margin-top: 5px;
	font-size: 0.87rem;
	line-height: 1.5;
	color: var(--pd-muted);
}
