/* =============================================================
   APH THEME — main.css
   Component styles that supplement theme.json tokens.
   All colour/spacing values reference CSS custom properties
   generated by WordPress from theme.json.
   ============================================================= */

/* ── Reset / base ─────────────────────────────────────────── */
*,
*::before,
*::after {
	box-sizing: border-box;
}

img,
video {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

/* ── Header ───────────────────────────────────────────────── */
.aph-site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--wp--preset--color--surface);
}

.aph-header-inner {
	max-width: 1280px;
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--5);
}

.aph-site-title a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
	font-weight: 700;
}

.aph-primary-nav .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--5);
}

.aph-primary-nav a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
	font-weight: 500;
	font-size: 0.875rem;
	transition: color var(--wp--custom--transition);
}

.aph-primary-nav a:hover,
.aph-primary-nav a:focus-visible {
	color: var(--wp--preset--color--green);
}

.aph-header-search .wp-block-search__input {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--default);
	padding: 6px 12px;
	font-size: 0.875rem;
	background: var(--wp--preset--color--background);
}

.aph-header-search .wp-block-search__button {
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
	border: none;
	border-radius: var(--wp--custom--radius--default);
	padding: 6px 14px;
	cursor: pointer;
	transition: background var(--wp--custom--transition);
}

.aph-header-search .wp-block-search__button:hover {
	background: var(--wp--preset--color--green);
}

/* ── Article cards ────────────────────────────────────────── */
.aph-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--default);
	overflow: hidden;
	transition: box-shadow var(--wp--custom--transition), transform var(--wp--custom--transition);
}

.aph-card:hover {
	box-shadow: var(--wp--preset--shadow--md);
	transform: translateY(-2px);
}

.aph-card .wp-block-post-title a,
.aph-card h3 a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
	transition: color var(--wp--custom--transition);
}

.aph-card .wp-block-post-title a:hover,
.aph-card h3 a:hover {
	color: var(--wp--preset--color--green);
}

.aph-card-body {
	flex: 1;
	padding: var(--wp--preset--spacing--4) var(--wp--preset--spacing--5) var(--wp--preset--spacing--5) !important;
	gap: var(--wp--preset--spacing--3) !important;
}

.aph-card .wp-block-post-title {
	overflow-wrap: break-word;
	word-break: break-word;
	hyphens: auto;
}

.aph-card-body .wp-block-post-excerpt p {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.aph-card--sm > .wp-block-group,
.aph-card--data > .wp-block-group {
	padding: var(--wp--preset--spacing--4) var(--wp--preset--spacing--5) !important;
	gap: var(--wp--preset--spacing--3) !important;
}

.aph-card .wp-block-post-featured-image img {
	width: 100%;
	object-fit: cover;
	transition: transform 300ms ease;
}

.aph-card:hover .wp-block-post-featured-image img {
	transform: scale(1.02);
}

/* ── Category pills ───────────────────────────────────────── */
.wp-block-post-terms a {
	text-decoration: none;
	color: var(--wp--preset--color--green);
	font-weight: 600;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	transition: color var(--wp--custom--transition);
}

.wp-block-post-terms a:hover {
	color: var(--wp--preset--color--navy);
}

/* ── Article page ─────────────────────────────────────────── */
.aph-article-content {
	max-width: 760px;
	margin-inline: auto;
}

.aph-article-content p,
.aph-article-content li {
	line-height: 1.75;
	color: var(--wp--preset--color--text);
}

.aph-article-content h2 {
	font-family: var(--wp--preset--font-family--source-serif-4);
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--wp--preset--color--navy);
	margin-top: var(--wp--preset--spacing--7);
	margin-bottom: var(--wp--preset--spacing--4);
}

.aph-article-content h3 {
	font-family: var(--wp--preset--font-family--source-serif-4);
	font-size: 1.375rem;
	font-weight: 600;
	color: var(--wp--preset--color--navy);
	margin-top: var(--wp--preset--spacing--6);
	margin-bottom: var(--wp--preset--spacing--3);
}

.aph-article-content a {
	color: var(--wp--preset--color--navy);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.aph-article-content a:hover {
	color: var(--wp--preset--color--green);
}

/* ── Tables ───────────────────────────────────────────────── */
.wp-block-table table,
.aph-article-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--default);
	overflow: hidden;
}

.wp-block-table thead,
.aph-article-content thead {
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
}

.wp-block-table th,
.aph-article-content th {
	padding: 10px 16px;
	text-align: left;
	font-weight: 600;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wp-block-table td,
.aph-article-content td {
	padding: 10px 16px;
	border-bottom: 1px solid var(--wp--preset--color--border);
	color: var(--wp--preset--color--text);
}

.wp-block-table tbody tr:nth-child(even),
.aph-article-content tbody tr:nth-child(even) {
	background: var(--wp--preset--color--background);
}

.wp-block-table tbody tr:last-child td,
.aph-article-content tbody tr:last-child td {
	border-bottom: none;
}

/* ── Category card tiles (homepage §03) ────────────────────── */
.aph-category-card {
	text-align: center;
	transition: box-shadow var(--wp--custom--transition), transform var(--wp--custom--transition);
}

.aph-category-card:hover {
	box-shadow: var(--wp--preset--shadow--md);
	transform: translateY(-3px);
}

.aph-category-card a {
	text-decoration: none;
}

/* ── Homepage sections ─────────────────────────────────────── */
.aph-home-hero {
	background-color: #0B1F33;
	color: #F7F8FA;
}

.aph-home-hero .wp-block-post-date,
.aph-hero-article .wp-block-post-date {
	color: #8FA3B1 !important;
}

/* Hero article card: title link must be white on dark navy background */
.aph-hero-article .wp-block-post-title a {
	color: #FFFFFF !important;
	text-decoration: none;
}

.aph-hero-article .wp-block-post-title a:hover,
.aph-hero-article .wp-block-post-title a:focus-visible {
	color: var(--wp--preset--color--green) !important;
}

.aph-home-hero .wp-block-buttons {
	margin-top: var(--wp--preset--spacing--5);
	margin-bottom: var(--wp--preset--spacing--4);
}

.aph-home-newsletter {
	background-color: #0B1F33;
	color: #F7F8FA;
}

.aph-featured-card .wp-block-post-featured-image {
	flex-shrink: 0;
}

.aph-featured-card .wp-block-post-featured-image img {
	object-fit: cover;
	width: 100%;
	height: 100%;
}

/* ── Newsletter placeholder ─────────────────────────────────── */
.aph-newsletter--pending .wp-block-paragraph:last-child {
	opacity: 0.5;
}

/* ── Ad slots (ad-ready, invisible until AdSense activated) ─── */
.aph-ad-slot {
	display: var(--wp--custom--ad-slot--display, none);
	min-height: 90px;
	text-align: center;
	overflow: hidden;
	/* Reserve space for CLS prevention once ads activate */
}

.aph-ad-slot--leaderboard { min-height: 90px; }
.aph-ad-slot--rectangle   { min-height: 250px; }
.aph-ad-slot--inline      { min-height: 200px; margin-block: var(--wp--preset--spacing--6); }
.aph-ad-slot--sidebar     { min-height: 600px; }

/* ── Archive hero ──────────────────────────────────────────── */
.aph-archive-hero {
	background-color: #0B1F33;
	overflow: hidden;
}

.aph-archive-title {
	color: var(--wp--preset--color--surface) !important;
}

/* ── Breadcrumbs ──────────────────────────────────────────── */
.aph-breadcrumbs {
	font-size: 0.75rem;
}

.aph-breadcrumbs a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
}

.aph-breadcrumbs a:hover {
	color: var(--wp--preset--color--green);
}

/* ── Reading time ─────────────────────────────────────────── */
.aph-reading-time {
	font-size: 0.8rem;
	color: var(--wp--preset--color--text-secondary);
}

/* ── Footer ────────────────────────────────────────────────── */
.aph-site-footer {
	color: var(--wp--preset--color--background);
}

.aph-footer-heading {
	color: var(--wp--preset--color--green) !important;
	margin-bottom: var(--wp--preset--spacing--3) !important;
}

.aph-site-footer a {
	color: var(--wp--preset--color--background);
	text-decoration: none;
	opacity: 0.85;
	transition: opacity var(--wp--custom--transition);
}

.aph-site-footer a:hover {
	opacity: 1;
	color: var(--wp--preset--color--green);
}

/* ── Pagination ───────────────────────────────────────────── */
.wp-block-query-pagination {
	display: flex;
	gap: var(--wp--preset--spacing--2);
	justify-content: center;
	flex-wrap: wrap;
}

.wp-block-query-pagination-numbers .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding-inline: 8px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--default);
	text-decoration: none;
	font-size: 0.875rem;
	color: var(--wp--preset--color--navy);
	transition: all var(--wp--custom--transition);
}

.wp-block-query-pagination-numbers .page-numbers.current,
.wp-block-query-pagination-numbers .page-numbers:hover {
	background: var(--wp--preset--color--navy);
	border-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
}

/* ── Search results ───────────────────────────────────────── */
.aph-search-result .wp-block-post-featured-image {
	flex-shrink: 0;
}

/* ── 404 page ─────────────────────────────────────────────── */
.aph-404 {
	text-align: center;
}

/* ── Blockquote / Pullquote ───────────────────────────────── */
.wp-block-quote {
	border-left: 3px solid var(--wp--preset--color--green);
	padding-left: var(--wp--preset--spacing--5);
	margin-left: 0;
}

.wp-block-quote p {
	font-family: var(--wp--preset--font-family--source-serif-4);
	font-style: italic;
	font-size: 1.1rem;
	color: var(--wp--preset--color--navy);
}

.wp-block-pullquote {
	border-top: 4px solid var(--wp--preset--color--yellow);
	border-bottom: 4px solid var(--wp--preset--color--yellow);
	padding-block: var(--wp--preset--spacing--5);
	text-align: center;
}

/* ── Focus visible (WCAG 2.2 AA) ─────────────────────────── */
:focus-visible {
	outline: 3px solid var(--wp--preset--color--green);
	outline-offset: 3px;
}

/* ── Skip link ────────────────────────────────────────────── */
.skip-link {
	position: absolute;
	top: -100%;
	left: var(--wp--preset--spacing--4);
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
	padding: 8px 16px;
	border-radius: 0 0 var(--wp--custom--radius--default) var(--wp--custom--radius--default);
	font-size: 0.875rem;
	text-decoration: none;
	z-index: 999;
}

.skip-link:focus {
	top: 0;
}

/* ── Responsive breakpoints ───────────────────────────────── */
@media (max-width: 768px) {
	.aph-featured-card.wp-block-group {
		flex-direction: column !important;
	}

	.aph-featured-card .wp-block-post-featured-image {
		width: 100% !important;
		border-radius: 12px 12px 0 0 !important;
	}

	.aph-featured-card .wp-block-group {
		padding-left: var(--wp--preset--spacing--4) !important;
	}

	.aph-card--wide.wp-block-group {
		flex-direction: column !important;
	}

	.aph-card--wide .wp-block-post-featured-image {
		width: 100% !important;
		border-radius: 8px 8px 0 0 !important;
	}

	.aph-home-hero {
		padding-block: var(--wp--preset--spacing--6) !important;
	}

	[class*="wp-container-core-post-template-is-layout-"] {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 480px) {
	.aph-header-inner .wp-block-search {
		display: none;
	}

	[class*="wp-container-core-post-template-is-layout-"] {
		grid-template-columns: 1fr !important;
	}
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
	.aph-site-header,
	.aph-site-footer,
	.aph-ad-slot,
	.wp-block-query-pagination {
		display: none !important;
	}
}
