/* articles.css — Blog index (home.php) + single post (single.php) + archives (archive.php)
   Loads after: tokens.css → layout.css → animations.css → components.css
   Enqueued on: is_home() || is_singular('post') || is_archive()

   Base .article-card styles live in home.css (already loaded on front page).
   This file adds: index/archive hero bands, article-body typography,
   related posts section, CTA block, pagination, empty states.
   ──────────────────────────────────────────────────────────────────────── */


/* ══════════════════════════════════════════════════════════
   SHARED: NAVY HERO BANDS
   Used by: articles-archive-hero (home.php) + archive-header-hero (archive.php)
   ══════════════════════════════════════════════════════════ */

.articles-archive-hero,
.archive-header-hero {
	position: relative;
	min-height: clamp(260px, 36vh, 380px);
	display: flex;
	align-items: flex-end;
	background-color: var(--pb-navy);
	overflow: hidden;
}

.articles-archive-hero__overlay,
.archive-header-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(11, 31, 58, 0.50) 0%,
		rgba(11, 31, 58, 0.95) 100%
	);
	z-index: 1;
}

.articles-archive-hero .container,
.archive-header-hero .container {
	position: relative;
	z-index: 2;
	padding-block-start: var(--pb-space-24);
	padding-block-end: var(--pb-space-12);
	width: 100%;
}

.articles-archive-hero__content,
.archive-header-hero__content {
	max-width: 680px;
}

.articles-archive-hero__overline,
.archive-header-hero__overline {
	color: rgba(255, 255, 255, 0.65);
}

.articles-archive-hero__title,
.archive-header-hero__title {
	font-family: var(--pb-font-display);
	font-weight: 900;
	font-size: clamp(1.875rem, 4.5vw, 3.5rem);
	line-height: var(--pb-leading-tight);
	color: var(--pb-white);
	margin: var(--pb-space-3) 0 var(--pb-space-4);
	word-break: break-word;
}

.articles-archive-hero__sub,
.archive-header-hero__desc {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-lg);
	color: rgba(255, 255, 255, 0.72);
	line-height: var(--pb-leading-normal);
	max-width: 58ch;
	margin: 0;
}


/* ══════════════════════════════════════════════════════════
   ARTICLES GRID SECTION (home.php + archive.php)
   ══════════════════════════════════════════════════════════ */

/* Visually-hidden helper — defined here for article pages where service.css is not loaded */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.articles-body {
	background: var(--pb-white);
	padding: var(--pb-space-12) 0 var(--pb-space-16);
}

@media (min-width: 1024px) {
	.articles-body { padding: var(--pb-space-16) 0 var(--pb-space-24); }
}

.articles-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--pb-space-6);
	list-style: none;
	padding: 0;
	margin: 0 0 var(--pb-space-10);
}

@media (min-width: 768px) {
	.articles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
	.articles-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ══════════════════════════════════════════════════════════
   ARTICLE CARD — extensions on top of home.css base
   (home.css owns .article-card base; we add only new elements)
   ══════════════════════════════════════════════════════════ */

.article-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--pb-space-4);
	margin-top: auto;
	padding-top: var(--pb-space-3);
}

.article-card__date {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	color: var(--pb-gray-700); /* gray-500 fails WCAG AA at small text — use 700 (5.74:1) */
	white-space: nowrap;
}

/* Ensure card body flexes to push footer to bottom */
.article-card__body {
	display: flex;
	flex-direction: column;
}

/* Long titles: allow wrap, prevent overflow */
.article-card__title {
	word-break: break-word;
}

/* No-thumb cards: body has slight extra top padding */
.article-card:not(:has(.article-card__thumb)) .article-card__body {
	padding-top: var(--pb-space-6);
}


/* ══════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════ */

.articles-pagination {
	display: flex;
	justify-content: center;
	margin-top: var(--pb-space-10);
}

.articles-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--pb-space-2);
}

.articles-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 var(--pb-space-4);
	border-radius: var(--pb-radius-full);
	border: 1px solid var(--pb-gray-300);
	background: var(--pb-white);
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	font-weight: var(--pb-weight-medium);
	color: var(--pb-gray-700);
	text-decoration: none;
	cursor: pointer;
	line-height: 1;
}

@media (prefers-reduced-motion: no-preference) {
	.articles-pagination .page-numbers {
		transition:
			background-color var(--pb-transition-fast),
			border-color     var(--pb-transition-fast),
			color            var(--pb-transition-fast);
	}
}

.articles-pagination .page-numbers:hover {
	border-color: var(--pb-blue-dark);
	color: var(--pb-blue-dark);
}

.articles-pagination .page-numbers:focus-visible {
	outline: 2px solid var(--pb-blue-dark);
	outline-offset: 3px;
}

.articles-pagination .page-numbers.current {
	background: var(--pb-blue);
	border-color: var(--pb-blue);
	color: var(--pb-white);
	font-weight: var(--pb-weight-semibold);
}

.articles-pagination .page-numbers.dots {
	border: none;
	background: none;
	cursor: default;
}


/* ══════════════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════════════ */

.articles-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--pb-space-6);
	padding: var(--pb-space-16) var(--pb-space-6);
	text-align: center;
}

.articles-empty__message {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-lg);
	color: var(--pb-gray-700);
	margin: 0;
}


/* ══════════════════════════════════════════════════════════
   SINGLE: ARTICLE HERO
   ══════════════════════════════════════════════════════════ */

.article-hero {
	position: relative;
	min-height: clamp(320px, 45vh, 500px);
	display: flex;
	align-items: flex-end;
	background-color: var(--pb-navy);
	overflow: hidden;
}

.article-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		105deg,
		rgba(11, 31, 58, 0.96) 0%,
		rgba(11, 31, 58, 0.72) 60%,
		rgba(11, 31, 58, 0.30) 100%
	);
	z-index: 1;
}

[dir="rtl"] .article-hero__overlay {
	background: linear-gradient(
		-105deg,
		rgba(11, 31, 58, 0.96) 0%,
		rgba(11, 31, 58, 0.72) 60%,
		rgba(11, 31, 58, 0.30) 100%
	);
}

.article-hero .container {
	position: relative;
	z-index: 2;
	padding-block-start: var(--pb-space-24);
	padding-block-end: var(--pb-space-16);
	width: 100%;
}

.article-hero__content {
	max-width: 780px;
}

/* Breadcrumb */
.article-hero__breadcrumb {
	margin-bottom: var(--pb-space-5);
}

.article-hero__breadcrumb-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--pb-space-1);
	list-style: none;
	padding: 0;
	margin: 0;
}

.article-hero__breadcrumb-item:not(:last-child)::after {
	content: '/';
	font-size: var(--pb-text-xs);
	color: rgba(255, 255, 255, 0.38);
	padding: 0 var(--pb-space-2);
}

[dir="rtl"] .article-hero__breadcrumb-item:not(:last-child)::after {
	content: '\\';
}

.article-hero__breadcrumb-link {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-xs);
	font-weight: var(--pb-weight-medium);
	color: rgba(255, 255, 255, 0.62);
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.article-hero__breadcrumb-link:hover {
	color: rgba(255, 255, 255, 0.90);
}

.article-hero__breadcrumb-link:focus-visible {
	outline: 2px solid var(--pb-blue);
	outline-offset: 2px;
	border-radius: 2px;
}

.article-hero__breadcrumb-current {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-xs);
	font-weight: var(--pb-weight-semibold);
	color: rgba(255, 255, 255, 0.88);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	/* Clamp long titles in breadcrumb */
	max-width: 24ch;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Category chip */
.article-hero__category {
	display: inline-flex;
	align-items: center;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.26);
	border-radius: var(--pb-radius-full);
	padding: var(--pb-space-1) var(--pb-space-4);
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-xs);
	font-weight: var(--pb-weight-semibold);
	text-transform: uppercase;
	letter-spacing: 0.10em;
	color: rgba(255, 255, 255, 0.88);
	margin-bottom: var(--pb-space-4);
}

/* Article H1 */
.article-hero__title {
	font-family: var(--pb-font-display);
	font-weight: 900;
	font-size: clamp(1.875rem, 4.5vw, 3.5rem);
	line-height: var(--pb-leading-tight);
	color: var(--pb-white);
	max-width: 22ch;
	word-break: break-word;
	margin: 0 0 var(--pb-space-4);
}

/* Meta row: date · reading time */
.article-hero__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--pb-space-2);
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	color: rgba(255, 255, 255, 0.72);
}

.article-hero__sep {
	opacity: 0.50;
}


/* ══════════════════════════════════════════════════════════
   SINGLE: FEATURED IMAGE
   ══════════════════════════════════════════════════════════ */

.article-featured-img {
	background: var(--pb-gray-100);
}

.article-featured-img .container {
	padding-top: 0;
	padding-bottom: 0;
}

.article-featured-img__figure {
	margin: 0;
	aspect-ratio: 16 / 9;
	overflow: hidden;
}

.article-featured-img__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

@media (min-width: 1024px) {
	.article-featured-img__figure {
		border-radius: 0 0 var(--pb-radius-xl) var(--pb-radius-xl);
	}
}


/* ══════════════════════════════════════════════════════════
   SINGLE: ARTICLE BODY
   ══════════════════════════════════════════════════════════ */

.article-body {
	background: var(--pb-white);
	padding: var(--pb-space-12) 0 var(--pb-space-16);
}

@media (min-width: 1024px) {
	.article-body { padding: var(--pb-space-16) 0 var(--pb-space-24); }
}

.article-body__inner {
	max-width: 680px; /* ~71ch at 16px — within the 65–75ch readable measure window */
	margin-inline: auto;
}

/* ── Long-form body typography ── */

.article-content {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-base);
	line-height: 1.7;
	color: var(--pb-gray-900);
}

.article-content p {
	margin: 0 0 var(--pb-space-6);
}

.article-content p:last-child {
	margin-bottom: 0;
}

.article-content h2 {
	font-family: var(--pb-font-display);
	font-weight: var(--pb-weight-bold);
	font-size: clamp(var(--pb-text-xl), 3vw, var(--pb-text-2xl));
	line-height: var(--pb-leading-snug);
	color: var(--pb-gray-900);
	margin: var(--pb-space-12) 0 var(--pb-space-4);
}

.article-content h3 {
	font-family: var(--pb-font-display);
	font-weight: var(--pb-weight-semibold);
	font-size: clamp(var(--pb-text-lg), 2.5vw, var(--pb-text-xl));
	line-height: var(--pb-leading-snug);
	color: var(--pb-gray-900);
	margin: var(--pb-space-8) 0 var(--pb-space-3);
}

.article-content h4 {
	font-family: var(--pb-font-display);
	font-weight: var(--pb-weight-semibold);
	font-size: var(--pb-text-base);
	color: var(--pb-gray-900);
	margin: var(--pb-space-6) 0 var(--pb-space-2);
}

.article-content ul,
.article-content ol {
	padding-inline-start: var(--pb-space-6);
	margin: 0 0 var(--pb-space-6);
}

.article-content li {
	margin-bottom: var(--pb-space-2);
	line-height: 1.65;
}

/* Blockquote — tinted background, NO side-stripe (banned) */
.article-content blockquote {
	background: var(--pb-blue-lt);
	border-radius: var(--pb-radius-md);
	padding: var(--pb-space-6) var(--pb-space-8);
	margin: var(--pb-space-8) 0;
	font-size: var(--pb-text-lg);
	line-height: 1.65;
	color: var(--pb-gray-900);
}

.article-content blockquote p {
	margin: 0;
}

.article-content blockquote cite {
	display: block;
	margin-top: var(--pb-space-3);
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	font-style: normal;
	font-weight: var(--pb-weight-semibold);
	color: var(--pb-gray-700);
}

/* Links */
.article-content a {
	color: var(--pb-blue-dark);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

.article-content a:hover {
	color: var(--pb-navy);
}

.article-content a:focus-visible {
	outline: 2px solid var(--pb-blue-dark);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Strong */
.article-content strong {
	font-weight: var(--pb-weight-semibold);
	color: var(--pb-gray-900);
}

/* Inline code */
.article-content code {
	font-family: var(--pb-font-mono);
	font-size: 0.9em;
	background: var(--pb-gray-100);
	padding: 2px 6px;
	border-radius: var(--pb-radius-sm);
	color: var(--pb-gray-900);
}

/* Code block */
.article-content pre {
	background: var(--pb-navy);
	color: rgba(255, 255, 255, 0.88);
	padding: var(--pb-space-6);
	border-radius: var(--pb-radius-md);
	overflow-x: auto;
	font-family: var(--pb-font-mono);
	font-size: var(--pb-text-sm);
	line-height: 1.65;
	margin: 0 0 var(--pb-space-6);
}

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

/* Horizontal rule */
.article-content hr {
	border: none;
	border-top: 1px solid var(--pb-gray-200);
	margin: var(--pb-space-10) 0;
}

/* Inline images */
.article-content img {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: var(--pb-radius-md);
	margin: var(--pb-space-8) 0;
}

.article-content figure {
	margin: var(--pb-space-8) 0;
}

.article-content figure img {
	margin: 0;
}

.article-content figcaption {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	color: var(--pb-gray-700);
	text-align: center;
	margin-top: var(--pb-space-2);
	line-height: 1.5;
}

/* Tables */
.article-content table {
	width: 100%;
	border-collapse: collapse;
	margin: var(--pb-space-6) 0;
	font-size: var(--pb-text-sm);
}

.article-content th {
	background: var(--pb-gray-100);
	font-family: var(--pb-font-display);
	font-weight: var(--pb-weight-semibold);
	font-size: var(--pb-text-xs);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--pb-gray-700);
	padding: var(--pb-space-3) var(--pb-space-4);
	text-align: start;
	border-bottom: 2px solid var(--pb-gray-200);
}

.article-content td {
	padding: var(--pb-space-3) var(--pb-space-4);
	border-bottom: 1px solid var(--pb-gray-200);
	color: var(--pb-gray-900);
	vertical-align: top;
}

/* Tags row */
.article-tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--pb-space-2);
	margin-top: var(--pb-space-10);
	padding-top: var(--pb-space-6);
	border-top: 1px solid var(--pb-gray-200);
}

.article-tags__label {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	font-weight: var(--pb-weight-semibold);
	color: var(--pb-gray-700);
}

.article-tags__tag {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0 var(--pb-space-4);
	border-radius: var(--pb-radius-full);
	border: 1px solid var(--pb-gray-300);
	background: var(--pb-white);
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-sm);
	color: var(--pb-gray-700);
	text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
	.article-tags__tag {
		transition: border-color var(--pb-transition-fast), color var(--pb-transition-fast);
	}
}

.article-tags__tag:hover {
	border-color: var(--pb-blue-dark);
	color: var(--pb-blue-dark);
}

.article-tags__tag:focus-visible {
	outline: 2px solid var(--pb-blue-dark);
	outline-offset: 3px;
}


/* ══════════════════════════════════════════════════════════
   SINGLE: RELATED ARTICLES
   ══════════════════════════════════════════════════════════ */

.article-related {
	background: var(--pb-gray-50);
	padding: var(--pb-space-12) 0;
}

@media (min-width: 1024px) {
	.article-related { padding: var(--pb-space-16) 0; }
}

.article-related .section-title {
	margin-bottom: var(--pb-space-8);
}


/* ══════════════════════════════════════════════════════════
   SINGLE: CTA BLOCK (directly above footer — uses --pb-navy-2)
   ══════════════════════════════════════════════════════════ */

.article-cta {
	background: var(--pb-navy-2);
	padding: var(--pb-space-16) 0;
	text-align: center;
}

.article-cta .container {
	max-width: var(--pb-container-narrow);
}

.article-cta__overline {
	display: block;
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-xs);
	font-weight: var(--pb-weight-semibold);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: rgba(255, 255, 255, 0.60);
	margin-bottom: var(--pb-space-3);
}

.article-cta__title {
	font-family: var(--pb-font-display);
	font-weight: 900;
	font-size: clamp(1.75rem, 3.5vw, 2.75rem);
	color: var(--pb-white);
	margin: 0 0 var(--pb-space-4);
	line-height: var(--pb-leading-snug);
}

.article-cta__sub {
	font-family: var(--pb-font-body);
	font-size: var(--pb-text-lg);
	color: rgba(255, 255, 255, 0.72);
	line-height: var(--pb-leading-normal);
	max-width: 52ch;
	margin: 0 auto var(--pb-space-8);
}

.article-cta__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--pb-space-4);
}
