/* =========================================================================
   NP Packaging - blog.css

   Blog archive and article styles. Loaded only on blog views (see
   np_is_blog_context() in inc/blog.php) so WooCommerce pages never pay for
   it. Everything here builds on the tokens already defined in main.css:
   --np-yellow, --np-grey-*, --np-radius-*, --np-border, --np-text-*.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Blog hero
   ------------------------------------------------------------------------- */
.np-blog-hero {
	max-width: 760px;
	margin-bottom: 28px;
}

.np-blog-hero__title {
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0 0 12px;
}

.np-blog-hero__title::after {
	content: "";
	display: block;
	width: 56px;
	height: 4px;
	margin-top: 14px;
	background: var(--np-yellow);
	border-radius: var(--np-radius-s);
}

.np-blog-hero__intro {
	margin: 0;
	font-size: 1rem;
	line-height: 1.65;
	color: var(--np-grey-600);
}

/* -------------------------------------------------------------------------
   2. Category navigation
   ------------------------------------------------------------------------- */
.np-blog-cats {
	margin-bottom: 32px;
	border-bottom: var(--np-border);
	padding-bottom: 16px;
}

.np-blog-cats__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.np-blog-cats__link {
	display: inline-flex;
	align-items: center;
	padding: 7px 14px;
	border: var(--np-border);
	border-radius: 999px;
	font-size: var(--np-text-s);
	font-weight: 600;
	text-decoration: none;
	color: var(--np-ink);
	background: var(--np-white);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.np-blog-cats__link:hover {
	border-color: var(--np-black);
}

.np-blog-cats__link.is-active {
	background: var(--np-yellow);
	border-color: var(--np-yellow);
	color: var(--np-black);
}

/* -------------------------------------------------------------------------
   3. Featured article
   ------------------------------------------------------------------------- */
.np-featured {
	display: grid;
	gap: 0;
	border: var(--np-border);
	border-radius: var(--np-radius-m);
	overflow: hidden;
	background: var(--np-white);
	margin-bottom: 44px;
}

.np-featured__media {
	display: block;
}

.np-featured__media img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.np-featured__body {
	padding: clamp(18px, 3vw, 30px);
	display: flex;
	flex-direction: column;
	gap: 10px;
	justify-content: center;
}

.np-featured__eyebrow {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	font-size: var(--np-text-xs);
}

.np-featured__flag {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: var(--np-radius-s);
	background: var(--np-yellow);
	color: var(--np-black);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.np-featured__cat {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--np-grey-600);
	text-decoration: none;
}

.np-featured__cat:hover {
	color: var(--np-black);
}

.np-featured__title {
	font-size: clamp(1.35rem, 2.6vw, 1.85rem);
	line-height: 1.2;
	letter-spacing: -0.01em;
	margin: 0;
}

.np-featured__title a {
	text-decoration: none;
}

.np-featured__title a:hover {
	text-decoration: underline;
	text-decoration-color: var(--np-yellow);
	text-decoration-thickness: 2px;
}

.np-featured__excerpt {
	margin: 0;
	font-size: var(--np-text-s);
	line-height: 1.65;
	color: var(--np-grey-600);
}

.np-featured__meta {
	margin: 0;
	font-size: var(--np-text-xs);
	color: var(--np-grey-600);
}

.np-featured__cta {
	align-self: start;
	margin-top: 6px;
}

@media (min-width: 768px) {
	.np-featured {
		grid-template-columns: 1.1fr 1fr;
		align-items: stretch;
	}

	.np-featured__media img {
		height: 100%;
		aspect-ratio: auto;
		min-height: 320px;
	}
}

/* -------------------------------------------------------------------------
   4. Latest articles grid
   ------------------------------------------------------------------------- */
.np-blog-latest__title,
.np-related__title {
	font-size: 1.25rem;
	letter-spacing: -0.01em;
	margin: 0 0 20px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--np-yellow);
	display: inline-block;
}

/*
 * 1 column on mobile, 2 on tablet, 3 on desktop. Explicit column counts
 * rather than auto-fill so the grid matches the brief exactly at every
 * breakpoint and cards never overflow their track.
 */
.np-blog .np-post-grid {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
	.np-blog .np-post-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.np-blog .np-post-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	/* The single-post column is narrower, so related posts stay at 3 up
	   only when there is room. */
	.np-blog .np-post-grid--related {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 20px;
	}
}

.np-post-card__cat {
	margin: 0;
	font-size: var(--np-text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--np-grey-600);
}

.np-post-card__cat a {
	text-decoration: none;
}

.np-post-card__cat a:hover {
	color: var(--np-black);
}

.np-post-card__meta {
	margin-top: 2px;
}

/* -------------------------------------------------------------------------
   5. Article layout, table of contents
   ------------------------------------------------------------------------- */
.np-toc {
	border: var(--np-border);
	border-radius: var(--np-radius-m);
	background: var(--np-grey-50);
	padding: 14px 16px;
	margin-bottom: 28px;
	font-size: var(--np-text-s);
}

.np-toc__summary {
	cursor: pointer;
	font-weight: 700;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.np-toc__summary::-webkit-details-marker {
	display: none;
}

.np-toc__summary::after {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transform-origin: center;
	transition: transform 0.15s ease;
	flex: none;
}

.np-toc[open] .np-toc__summary::after {
	transform: rotate(-135deg);
}

.np-toc__nav {
	margin-top: 12px;
}

.np-toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 7px;
}

.np-toc__item--h3 {
	padding-left: 14px;
}

.np-toc__list a {
	text-decoration: none;
	color: var(--np-grey-600);
	line-height: 1.4;
}

.np-toc__list a:hover {
	color: var(--np-black);
	text-decoration: underline;
	text-decoration-color: var(--np-yellow-dark);
	text-decoration-thickness: 2px;
}

/*
 * Desktop: the contents box moves into the sidebar column above the widgets
 * using grid placement, so there is only ever one copy in the markup.
 * The article column keeps its full width.
 */
@media (min-width: 1024px) {
	.np-blog-layout--single {
		align-items: start;
	}

	.np-blog-layout--toc .np-toc {
		grid-column: 2;
		grid-row: 1;
		position: sticky;
		top: 24px;
		max-height: calc(100vh - 60px);
		overflow-y: auto;
		margin-bottom: 24px;
	}

	.np-blog-layout--toc .np-blog-layout__main {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.np-blog-layout--toc .np-blog-layout__sidebar {
		grid-column: 2;
		grid-row: 2;
	}
}

/* -------------------------------------------------------------------------
   6. Article typography
   ------------------------------------------------------------------------- */
.np-entry__cat {
	margin: 0 0 10px;
	font-size: var(--np-text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.np-entry__cat a {
	text-decoration: none;
	color: var(--np-grey-600);
}

.np-entry__cat a:hover {
	color: var(--np-black);
}

.np-entry__title {
	font-size: clamp(1.75rem, 4vw, 2.4rem);
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin-bottom: 0.4em;
}

.np-entry__updated::before {
	content: "\00b7";
	margin-inline: 8px;
}

.np-entry__thumb figcaption {
	margin-top: 8px;
	font-size: var(--np-text-xs);
	color: var(--np-grey-600);
}

/* Long-form reading measure. Wider than the default prose block because the
   article column is the main content of the page, and capped so lines stay
   comfortable. */
.np-prose--article {
	max-width: 74ch;
	font-size: 1.0625rem;
	line-height: 1.75;
}

.np-prose--article h2 {
	font-size: clamp(1.3rem, 2.4vw, 1.6rem);
	line-height: 1.25;
	margin: 1.9em 0 0.5em;
	scroll-margin-top: 24px;
}

.np-prose--article h3 {
	font-size: clamp(1.1rem, 2vw, 1.25rem);
	line-height: 1.3;
	margin: 1.6em 0 0.4em;
	scroll-margin-top: 24px;
}

.np-prose--article h4 {
	font-size: 1.05rem;
	margin: 1.4em 0 0.4em;
}

.np-prose--article li {
	margin-bottom: 0.4em;
}

.np-prose--article blockquote {
	margin: 1.6em 0;
	padding: 16px 20px;
	border-left: 4px solid var(--np-yellow);
	background: var(--np-grey-50);
	border-radius: 0 var(--np-radius-m) var(--np-radius-m) 0;
	color: var(--np-ink);
	font-size: 1.05rem;
}

.np-prose--article blockquote p:last-child {
	margin-bottom: 0;
}

.np-prose--article figure {
	margin: 1.8em 0;
}

.np-prose--article figcaption {
	margin-top: 8px;
	font-size: var(--np-text-xs);
	color: var(--np-grey-600);
}

/* Tables scroll rather than overflow on small screens. */
.np-prose--article table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.6em 0;
	font-size: var(--np-text-s);
	display: block;
	overflow-x: auto;
}

.np-prose--article th,
.np-prose--article td {
	border: var(--np-border);
	padding: 10px 12px;
	text-align: left;
	vertical-align: top;
}

.np-prose--article thead th {
	background: var(--np-grey-50);
	font-weight: 700;
}

.np-prose--article tbody tr:nth-child(even) {
	background: var(--np-grey-50);
}

@media (min-width: 640px) {
	.np-prose--article table {
		display: table;
	}
}

/* -------------------------------------------------------------------------
   7. Call to action
   ------------------------------------------------------------------------- */
.np-blog-cta {
	margin-top: 44px;
	padding: clamp(22px, 4vw, 34px);
	border: var(--np-border);
	border-left: 4px solid var(--np-yellow);
	border-radius: var(--np-radius-m);
	background: var(--np-yellow-soft);
	display: grid;
	gap: 10px;
	justify-items: start;
}

.np-blog-cta__title {
	font-size: clamp(1.2rem, 2.4vw, 1.5rem);
	line-height: 1.25;
	margin: 0;
}

.np-blog-cta__text {
	margin: 0;
	font-size: var(--np-text-s);
	line-height: 1.65;
	color: var(--np-grey-600);
	max-width: 60ch;
}

.np-blog-cta .np-btn {
	margin-top: 6px;
}

/* -------------------------------------------------------------------------
   8. Previous / next and related
   ------------------------------------------------------------------------- */
.np-post-nav {
	display: grid;
	gap: 14px;
	margin-block: 40px;
	padding-block: 24px;
	border-top: var(--np-border);
	border-bottom: var(--np-border);
	font-weight: 400;
}

.np-post-nav a {
	display: grid;
	gap: 4px;
	text-decoration: none;
}

.np-post-nav__label {
	font-size: var(--np-text-xs);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--np-grey-600);
	font-weight: 700;
}

.np-post-nav__title {
	font-size: var(--np-text-s);
	font-weight: 600;
	line-height: 1.35;
}

.np-post-nav a:hover .np-post-nav__title {
	text-decoration: underline;
	text-decoration-color: var(--np-yellow);
	text-decoration-thickness: 2px;
}

@media (min-width: 640px) {
	.np-post-nav {
		grid-template-columns: 1fr 1fr;
		gap: 24px;
	}

	.np-post-nav__next {
		text-align: right;
	}
}

.np-related {
	margin-top: 8px;
}

/* -------------------------------------------------------------------------
   9. Sidebar widgets
   ------------------------------------------------------------------------- */
.np-widget__posts {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: grid;
	gap: 14px;
}

.np-widget__posts a {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	text-decoration: none;
}

.np-widget__thumb {
	flex: none;
	width: 64px;
	border-radius: var(--np-radius-s);
	overflow: hidden;
}

.np-widget__thumb img {
	width: 64px;
	height: 64px;
	object-fit: cover;
}

.np-widget__copy {
	display: grid;
	gap: 3px;
	min-width: 0;
}

.np-widget__post-title {
	font-size: var(--np-text-s);
	font-weight: 600;
	line-height: 1.35;
}

.np-widget__posts a:hover .np-widget__post-title {
	text-decoration: underline;
	text-decoration-color: var(--np-yellow);
	text-decoration-thickness: 2px;
}

.np-widget__posts time {
	font-size: var(--np-text-xs);
	color: var(--np-grey-600);
}

.np-widget--cats ul {
	margin: 12px 0 0;
	padding: 0;
}

.np-widget--cats li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block: 7px;
	border-bottom: var(--np-border);
	font-size: var(--np-text-s);
}

.np-widget--cats li:last-child {
	border-bottom: 0;
}

.np-widget--cats a {
	text-decoration: none;
}

.np-widget--cats a:hover {
	text-decoration: underline;
	text-decoration-color: var(--np-yellow);
	text-decoration-thickness: 2px;
}

.np-widget__count {
	flex: none;
	font-size: var(--np-text-xs);
	color: var(--np-grey-600);
	background: var(--np-grey-50);
	border: var(--np-border);
	border-radius: 999px;
	padding: 1px 9px;
}

/* -------------------------------------------------------------------------
   10. Safety nets
   ------------------------------------------------------------------------- */
/* Nothing in the blog layout may force the page wider than the viewport. */
.np-blog-layout,
.np-blog-layout__main,
.np-blog-layout__sidebar {
	min-width: 0;
}

.np-blog-layout__main img,
.np-blog-layout__sidebar img {
	max-width: 100%;
	height: auto;
}

.np-prose--article pre {
	overflow-x: auto;
	background: var(--np-grey-50);
	border: var(--np-border);
	border-radius: var(--np-radius-m);
	padding: 14px 16px;
	font-size: var(--np-text-s);
}

.np-prose--article :is(iframe, video, embed, object) {
	max-width: 100%;
}
