/*
 * Naxonify Blog — listing (home.php) and single post (single.php).
 * Loaded only on those templates, after main.css. Uses main.css design tokens.
 * Every selector is prefixed .nx-blog to avoid clashes with existing styles.
 * Breakpoints match main.css: 640 / 768 / 1024 / 1280.
 */

/* ---------- Shared ---------- */
.nx-blog {
	display: block;
	color: var(--navy-950);
}

.nx-blog-badge {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	padding: 4px 10px;
	border-radius: var(--radius-pill);
	background: var(--blue-50);
	color: var(--blue-700);
	font-size: 11px;
	line-height: 16px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.nx-blog-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	color: var(--text-muted);
	font-size: 14px;
	line-height: 20px;
}

.nx-blog-meta__sep {
	color: var(--border-strong);
}

.nx-blog-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nx-blog-placeholder {
	display: flex;
	align-items: flex-end;
	width: 100%;
	height: 100%;
	padding: var(--space-4);
	background:
		radial-gradient(120% 90% at 100% 0%, rgba(8, 104, 247, .55) 0%, rgba(8, 104, 247, 0) 60%),
		linear-gradient(135deg, var(--navy-900) 0%, var(--navy-950) 100%);
	color: var(--text-on-dark-muted);
	font-size: 12px;
	line-height: 16px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.nx-blog-section__title {
	margin: 0 0 var(--space-6);
	font-size: 24px;
	line-height: 32px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

/* ---------- Listing: hero ---------- */
.nx-blog-hero {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	background: var(--navy-950);
	color: var(--text-on-dark);
}

.nx-blog-hero::before {
	content: "";
	position: absolute;
	inset: -40% -20% auto auto;
	width: 70%;
	aspect-ratio: 1;
	z-index: -1;
	background: radial-gradient(circle, rgba(8, 104, 247, .35) 0%, rgba(8, 104, 247, 0) 65%);
	pointer-events: none;
}

.nx-blog-hero__inner {
	display: grid;
	gap: var(--space-4);
	padding-block: var(--space-16);
}

.nx-blog-hero__title {
	max-width: 760px;
	font-size: 36px;
	line-height: 42px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.nx-blog-hero__intro {
	max-width: var(--text-max);
	margin: 0;
	color: var(--text-on-dark-muted);
	font-size: 17px;
	line-height: 28px;
}

/* ---------- Listing: section ---------- */
.nx-blog-section {
	padding-block: var(--space-12) var(--space-16);
}

/* ---------- Listing: featured post ---------- */
.nx-blog-featured {
	position: relative;
	display: grid;
	margin-bottom: var(--space-12);
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-card);
	transition: box-shadow .25s ease, transform .25s ease;
}

.nx-blog-featured:hover {
	box-shadow: var(--shadow-raised);
	transform: translateY(-2px);
}

.nx-blog-featured__media {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--surface-muted);
}

.nx-blog-featured__body {
	display: grid;
	align-content: center;
	gap: var(--space-4);
	padding: var(--space-6);
}

.nx-blog-featured__labels {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.nx-blog-featured__flag {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: var(--radius-pill);
	background: var(--navy-950);
	color: var(--text-on-dark);
	font-size: 11px;
	line-height: 16px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.nx-blog-featured__title {
	font-size: 24px;
	line-height: 32px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.nx-blog-featured__excerpt {
	margin: 0;
	color: var(--text-muted);
}

.nx-blog-featured__more {
	color: var(--blue-600);
	font-weight: 700;
	font-size: 15px;
}

/* ---------- Listing: cards (1 / 2 / 3 columns) ---------- */
.nx-blog-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-6);
}

.nx-blog-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-card);
	transition: box-shadow .25s ease, transform .25s ease;
}

.nx-blog-card:hover {
	box-shadow: var(--shadow-raised);
	transform: translateY(-3px);
}

.nx-blog-card__media {
	aspect-ratio: 16 / 9; /* matches 16:9 featured images, so nothing is cropped */
	overflow: hidden;
	background: var(--surface-muted);
}

.nx-blog-card__media .nx-blog-img,
.nx-blog-featured__media .nx-blog-img {
	transition: transform .4s ease;
}

.nx-blog-card:hover .nx-blog-img,
.nx-blog-featured:hover .nx-blog-img {
	transform: scale(1.03);
}

.nx-blog-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-6);
}

.nx-blog-card__title {
	font-size: 19px;
	line-height: 27px;
	font-weight: 700;
}

.nx-blog-card__link {
	color: inherit;
	text-decoration: none;
}

/* Whole card is clickable through the title link. */
.nx-blog-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.nx-blog-card__link:hover,
.nx-blog-card__link:focus-visible {
	color: var(--blue-700);
}

.nx-blog-card__link:focus-visible {
	outline: none;
}

.nx-blog-card:focus-within,
.nx-blog-featured:focus-within {
	outline: 2px solid var(--focus-ring);
	outline-offset: 2px;
}

.nx-blog-card__excerpt {
	margin: 0;
	color: var(--text-muted);
	font-size: 15px;
	line-height: 24px;
}

.nx-blog-card .nx-blog-meta {
	margin-top: auto;
	padding-top: var(--space-2);
}

/* ---------- Listing: pagination & empty ---------- */
.nx-blog-pagination {
	margin-top: var(--space-12);
}

.nx-blog-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-2);
}

.nx-blog-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	background: var(--surface);
	color: var(--navy-950);
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
}

.nx-blog-pagination a.page-numbers:hover {
	border-color: var(--blue-600);
	color: var(--blue-700);
}

.nx-blog-pagination .page-numbers.current {
	border-color: var(--blue-600);
	background: var(--blue-600);
	color: var(--text-on-dark);
}

.nx-blog-pagination .page-numbers.dots {
	border-color: transparent;
	background: transparent;
}

.nx-blog-empty {
	max-width: var(--text-max);
	margin-inline: auto;
	padding: var(--space-12) var(--space-6);
	border: 1px dashed var(--border-strong);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
	text-align: center;
}

.nx-blog-empty__title {
	margin-bottom: var(--space-2);
	font-size: 22px;
	line-height: 30px;
}

.nx-blog-empty p {
	margin: 0;
	color: var(--text-muted);
}

/* ---------- Single: header ---------- */
.nx-blog-article__header {
	background: var(--surface-muted);
	border-bottom: 1px solid var(--border);
}

.nx-blog-article__header-inner {
	display: grid;
	justify-items: start;
	gap: var(--space-4);
	padding-block: var(--space-12);
}

.nx-blog-article__header-inner > * {
	max-width: 860px;
}

.nx-blog-back {
	color: var(--text-muted);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.nx-blog-back:hover {
	color: var(--blue-700);
}

.nx-blog-article__title {
	font-size: 32px;
	line-height: 40px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.nx-blog-article__lede {
	margin: 0;
	color: var(--text-muted);
	font-size: 18px;
	line-height: 29px;
}

.nx-blog-article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	color: var(--text-muted);
	font-size: 14px;
	line-height: 22px;
}

.nx-blog-article__meta strong {
	color: var(--navy-950);
	font-weight: 700;
}

/* ---------- Single: featured image ---------- */
.nx-blog-article__hero {
	margin: var(--space-8) 0 0;
}

/* Whole image, never cropped or enlarged; shrinks to fit narrower screens. */
.nx-blog-article__img {
	width: auto;
	max-width: 100%;
	height: auto;
	margin-inline: auto;
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
}

.nx-blog-article__caption {
	margin-top: var(--space-2);
	color: var(--text-muted);
	font-size: 13px;
	line-height: 20px;
	text-align: center;
}

/* ---------- Single: layout (stacked → content + sidebar) ---------- */
.nx-blog-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-12);
	padding-block: var(--space-12) var(--space-16);
}

.nx-blog-article__main {
	min-width: 0;
	max-width: 760px;
}

/* ---------- Single: article content ---------- */
.nx-blog-content {
	color: var(--navy-800);
	font-size: 17px;
	line-height: 30px;
	overflow-wrap: break-word;
}

.nx-blog-content > * {
	margin-top: 0;
	margin-bottom: var(--space-6);
}

.nx-blog-content > :last-child {
	margin-bottom: 0;
}

.nx-blog-content h2,
.nx-blog-content h3,
.nx-blog-content h4 {
	color: var(--navy-950);
	font-weight: 700;
	scroll-margin-top: calc(var(--header-h) + 24px);
}

.nx-blog-content h2 {
	margin-top: var(--space-12);
	margin-bottom: var(--space-4);
	font-size: 26px;
	line-height: 34px;
	letter-spacing: -0.01em;
}

.nx-blog-content h3 {
	margin-top: var(--space-8);
	margin-bottom: var(--space-3);
	font-size: 21px;
	line-height: 29px;
}

.nx-blog-content h4 {
	margin-top: var(--space-6);
	margin-bottom: var(--space-2);
	font-size: 18px;
	line-height: 26px;
}

.nx-blog-content a {
	color: var(--blue-600);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.nx-blog-content a:hover {
	color: var(--blue-700);
}

.nx-blog-content ul,
.nx-blog-content ol {
	padding-left: 1.4em;
}

.nx-blog-content li + li {
	margin-top: var(--space-2);
}

.nx-blog-content li::marker {
	color: var(--blue-600);
}

.nx-blog-content blockquote {
	margin-inline: 0;
	padding: var(--space-4) var(--space-6);
	border-left: 4px solid var(--blue-600);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	background: var(--blue-50);
	color: var(--navy-950);
	font-size: 18px;
	line-height: 30px;
}

.nx-blog-content blockquote > :last-child {
	margin-bottom: 0;
}

.nx-blog-content img,
.nx-blog-content video,
.nx-blog-content iframe {
	max-width: 100%;
	border-radius: var(--radius-md);
}

.nx-blog-content figure {
	margin-inline: 0;
}

.nx-blog-content figcaption {
	margin-top: var(--space-2);
	color: var(--text-muted);
	font-size: 13px;
	line-height: 20px;
	text-align: center;
}

.nx-blog-content .alignwide,
.nx-blog-content .alignfull {
	width: 100%;
	max-width: 100%;
	margin-inline: 0;
}

.nx-blog-content .aligncenter {
	margin-inline: auto;
}

.nx-blog-content table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 24px;
}

.nx-blog-content th,
.nx-blog-content td {
	padding: 10px 12px;
	border: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
}

.nx-blog-content th {
	background: var(--surface-muted);
	color: var(--navy-950);
}

.nx-blog-content code {
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	font-size: .9em;
}

.nx-blog-content pre {
	overflow-x: auto;
	padding: var(--space-4);
	border-radius: var(--radius-md);
	background: var(--navy-950);
	color: var(--text-on-dark);
	font-size: 14px;
	line-height: 22px;
}

.nx-blog-content pre code {
	padding: 0;
	background: none;
}

.nx-blog-content hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin-block: var(--space-12);
}

.nx-blog-page-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--space-8);
	font-weight: 600;
}

/* ---------- Single: tags ---------- */
.nx-blog-tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
	margin-top: var(--space-12);
	padding-top: var(--space-6);
	border-top: 1px solid var(--border);
}

.nx-blog-tags__label {
	font-size: 14px;
	font-weight: 700;
}

.nx-blog-tags__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nx-blog-tags__item {
	padding: 4px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	color: var(--text-muted);
	font-size: 13px;
	line-height: 20px;
}

/* ---------- Single: sidebar ---------- */
.nx-blog-sidebar__inner {
	display: grid;
	gap: var(--space-6);
}

.nx-blog-widget {
	padding: var(--space-6);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-card);
}

.nx-blog-widget__title {
	margin-bottom: var(--space-4);
	font-size: 13px;
	line-height: 20px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.nx-blog-share {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nx-blog-share__link {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	color: var(--navy-950);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color .2s ease, color .2s ease;
}

.nx-blog-share__link:hover {
	border-color: var(--blue-600);
	color: var(--blue-700);
}

.nx-blog-recent {
	display: grid;
	gap: var(--space-4);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nx-blog-recent__link {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	align-items: center;
	gap: var(--space-3);
	color: inherit;
	text-decoration: none;
}

.nx-blog-recent__thumb {
	display: block;
	width: 72px;
	height: 72px;
	overflow: hidden;
	border-radius: var(--radius-md);
	background: var(--surface-muted);
}

.nx-blog-recent__thumb .nx-blog-placeholder {
	padding: 0;
	font-size: 0;
}

.nx-blog-recent__text {
	display: grid;
	gap: 2px;
}

.nx-blog-recent__title {
	font-size: 15px;
	line-height: 21px;
	font-weight: 700;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.nx-blog-recent__link:hover .nx-blog-recent__title {
	color: var(--blue-700);
}

.nx-blog-recent__date {
	color: var(--text-muted);
	font-size: 13px;
	line-height: 18px;
}

.nx-blog-cta {
	border-color: var(--navy-900);
	background:
		radial-gradient(110% 80% at 100% 0%, rgba(8, 104, 247, .45) 0%, rgba(8, 104, 247, 0) 60%),
		var(--navy-950);
	color: var(--text-on-dark);
}

.nx-blog-cta__title {
	font-size: 22px;
	line-height: 30px;
	font-weight: 700;
}

.nx-blog-cta__text {
	margin: var(--space-2) 0 var(--space-6);
	color: var(--text-on-dark-muted);
	font-size: 15px;
	line-height: 24px;
}

.nx-blog-cta__btn {
	width: 100%;
}

/* ---------- Single: related ---------- */
.nx-blog-related {
	padding-block: var(--space-16);
	background: var(--surface-muted);
	border-top: 1px solid var(--border);
}

/* ---------- ≥640px: 2-column cards, tablet sidebar ---------- */
@media (min-width: 640px) {
	.nx-blog-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.nx-blog-sidebar__inner {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.nx-blog-cta {
		grid-column: 1 / -1;
	}

	.nx-blog-cta__btn {
		width: auto;
	}
}

/* ---------- ≥768px: tablet ---------- */
@media (min-width: 768px) {
	.nx-blog-hero__inner {
		padding-block: 88px;
	}

	.nx-blog-hero__title {
		font-size: 48px;
		line-height: 56px;
	}

	.nx-blog-hero__intro {
		font-size: 18px;
		line-height: 30px;
	}

	.nx-blog-section__title {
		font-size: 28px;
		line-height: 36px;
	}

	.nx-blog-featured__body {
		padding: var(--space-8);
	}

	.nx-blog-featured__title {
		font-size: 28px;
		line-height: 36px;
	}

	.nx-blog-article__header-inner {
		padding-block: var(--space-16);
	}

	.nx-blog-article__title {
		font-size: 42px;
		line-height: 50px;
	}

	.nx-blog-content {
		font-size: 18px;
		line-height: 32px;
	}

	.nx-blog-content h2 {
		font-size: 30px;
		line-height: 38px;
	}

	.nx-blog-content h3 {
		font-size: 23px;
		line-height: 31px;
	}
}

/* ---------- ≥1024px: desktop (3-column cards, side sidebar) ---------- */
@media (min-width: 1024px) {
	.nx-blog-hero__inner {
		padding-block: 112px 104px;
	}

	.nx-blog-hero__title {
		font-size: 60px;
		line-height: 64px;
	}

	.nx-blog-section {
		padding-block: var(--space-16) var(--space-24);
	}

	.nx-blog-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--space-8);
	}

	/* Side-by-side from desktop up; the image keeps its 16:9 shape (no cropping). */
	.nx-blog-featured {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
		align-items: center;
	}

	.nx-blog-featured__media {
		margin: var(--space-6) 0 var(--space-6) var(--space-6);
		border-radius: var(--radius-md);
	}

	.nx-blog-featured__body {
		padding: var(--space-12);
	}

	.nx-blog-featured__title {
		font-size: 32px;
		line-height: 40px;
	}

	.nx-blog-article__title {
		font-size: 50px;
		line-height: 58px;
	}

	.nx-blog-layout {
		grid-template-columns: minmax(0, 1fr) 320px;
		gap: var(--space-16);
		padding-block: var(--space-16) var(--space-24);
	}

	/* Inner fills the column so the CTA can stay in view while reading. */
	.nx-blog-sidebar__inner {
		height: 100%;
		align-content: start;
		grid-template-columns: minmax(0, 1fr);
	}

	.nx-blog-cta {
		position: sticky;
		top: calc(var(--header-h) + var(--space-6));
	}

	.nx-blog-cta__btn {
		width: 100%;
	}

	.nx-blog-related {
		padding-block: var(--space-24);
	}
}

/* ---------- ≥1280px ---------- */
@media (min-width: 1280px) {
	.nx-blog-layout {
		grid-template-columns: minmax(0, 1fr) 340px;
		gap: 80px;
	}
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.nx-blog-card,
	.nx-blog-featured,
	.nx-blog-img,
	.nx-blog-share__link {
		transition: none;
	}

	.nx-blog-card:hover,
	.nx-blog-featured:hover,
	.nx-blog-card:hover .nx-blog-img,
	.nx-blog-featured:hover .nx-blog-img {
		transform: none;
	}
}
