/**
 * Nightmind — base styles and components.
 *
 * Mobile-first: the unprefixed rules describe the phone layout (the primary
 * target — a tired user in bed at 2:47am), and every media query is min-width.
 * Depends on assets/css/tokens.css for all values; no hard-coded colours.
 *
 * Contents
 *   1. Reset & document
 *   2. Typography
 *   3. Layout
 *   4. Links & buttons
 *   5. Cards
 *   6. YMYL blocks (disclaimer, seek help)
 *   7. Site header & footer
 *   8. Bottom Navigation + "More" sheet
 *   9. Sticky CTA
 *  10. Blocks & utilities
 *  11. Breakpoints
 */

/* ─────────────────────────────────────────────────────────────────────────
   1. Reset & document
   ───────────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
	box-sizing: border-box;
}

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Anchor targets clear the fixed header. */
	scroll-padding-top: var(--space-10);
}

body {
	min-height: 100vh;
	min-height: 100dvh;
	background-color: var(--bg-primary);
	color: var(--text-primary);
	font-family: var(--font-body);
	font-size: var(--text-body);
	font-weight: var(--weight-body);
	line-height: var(--leading-body);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
	/* Fixed chrome never covers the last line of content. */
	padding-bottom: calc(var(--bottom-nav-space) + var(--sticky-cta-space) + var(--safe-bottom));
	transition: padding-bottom var(--duration-base) var(--ease-out);
}

body.has-bottom-nav {
	--bottom-nav-space: var(--bottom-nav-height);
}

body.sticky-cta-visible {
	--sticky-cta-space: var(--sticky-cta-height);
}

/* The "More" sheet locks the page behind it. */
body.is-menu-open {
	overflow: hidden;
}

/* Class-based display rules must not defeat the hidden attribute. */
[hidden] {
	display: none !important;
}

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

svg.nm-icon {
	flex: none;
	width: var(--icon-md);
	height: var(--icon-md);
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

button {
	background: none;
	border: 0;
	cursor: pointer;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--accent-hover);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

::selection {
	background: var(--accent-muted);
	color: var(--text-primary);
}

hr,
.wp-block-separator {
	height: 1px;
	margin-block: var(--section-gap);
	border: 0;
	background: var(--border);
}

/* ─────────────────────────────────────────────────────────────────────────
   2. Typography
   ───────────────────────────────────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-heading);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-heading);
	letter-spacing: var(--tracking-heading);
	color: var(--text-primary);
	text-wrap: balance;
}

h1 {
	font-size: var(--text-h1);
	font-weight: var(--weight-bold);
}

h2 {
	font-size: var(--text-h2);
}

h3 {
	font-size: var(--text-h3);
}

h4,
h5,
h6 {
	font-size: var(--text-body);
}

p,
li,
dd,
blockquote,
figcaption {
	max-width: var(--measure);
	text-wrap: pretty;
}

.nm-prose > * + * {
	margin-top: var(--space-5);
}

.nm-prose > * + :is(h2, h3) {
	margin-top: var(--space-8);
}

.nm-prose :is(ul, ol) {
	padding-left: var(--space-5);
	display: grid;
	gap: var(--space-2);
}

.nm-prose li::marker {
	color: var(--accent);
}

.nm-prose blockquote {
	padding-left: var(--space-4);
	border-left: 2px solid var(--accent-muted);
	color: var(--text-secondary);
}

.nm-lead {
	font-size: calc(var(--text-body) + 1px);
	color: var(--text-secondary);
}

.nm-small,
small,
figcaption {
	font-size: var(--text-small);
	color: var(--text-secondary);
	line-height: var(--leading-tight);
}

.nm-eyebrow {
	font-size: var(--text-small);
	font-weight: var(--weight-medium);
	letter-spacing: var(--tracking-label);
	color: var(--text-muted);
	text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────────
   3. Layout
   ───────────────────────────────────────────────────────────────────────── */

.nm-container {
	width: 100%;
	max-width: calc(var(--content-width) + var(--screen-padding) * 2);
	margin-inline: auto;
	padding-inline: var(--screen-padding);
}

.nm-container--wide {
	max-width: calc(var(--wide-width) + var(--screen-padding) * 2);
}

.site-main {
	/* Anchor for the Sticky CTA scroll sentinel. */
	position: relative;
	display: block;
	padding-block: var(--space-6) var(--section-gap);
}

.nm-section + .nm-section {
	margin-top: var(--section-gap);
}

.nm-section__title {
	margin-bottom: var(--space-4);
}

.nm-stack {
	display: grid;
	gap: var(--card-gap);
}

/* Horizontal card rail — the familiar mobile pattern for recommendations. */
.nm-rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(15rem, 78%);
	gap: var(--card-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-bottom: var(--space-2);
	margin-inline: calc(var(--screen-padding) * -1);
	padding-inline: var(--screen-padding);
}

.nm-rail::-webkit-scrollbar {
	display: none;
}

.nm-rail > * {
	scroll-snap-align: start;
}

.nm-skip-link {
	position: absolute;
	left: -9999px;
	z-index: var(--z-modal);
	padding: var(--space-3) var(--space-4);
	background: var(--bg-elevated);
	color: var(--text-primary);
	border-radius: var(--radius-button);
}

.nm-skip-link:focus {
	left: var(--space-4);
	top: var(--space-4);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   4. Links & buttons
   ───────────────────────────────────────────────────────────────────────── */

a {
	color: var(--accent-hover);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
	color: var(--text-primary);
}

.nm-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	min-height: var(--button-height);
	padding: var(--space-3) var(--space-6);
	border-radius: var(--radius-button);
	font-family: var(--font-heading);
	font-size: var(--text-body);
	font-weight: var(--weight-semibold);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition:
		background-color var(--duration-base) var(--ease-out),
		color var(--duration-base) var(--ease-out),
		border-color var(--duration-base) var(--ease-out);
}

.nm-button--primary {
	background-color: var(--accent);
	color: var(--text-on-accent);
}

.nm-button--primary:hover,
.nm-button--primary:focus-visible {
	background-color: var(--accent-hover);
	color: var(--text-on-accent);
}

.nm-button--secondary {
	background-color: var(--bg-elevated);
	color: var(--text-primary);
	border: 1px solid var(--border);
}

.nm-button--secondary:hover {
	background-color: var(--bg-secondary);
	color: var(--text-primary);
	border-color: var(--border-strong);
}

.nm-button--quiet {
	min-height: var(--tap-target);
	padding-inline: var(--space-4);
	color: var(--text-secondary);
}

.nm-button--full {
	display: flex;
	width: 100%;
}

.nm-button[aria-disabled="true"] {
	opacity: 0.5;
	pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   5. Cards
   ───────────────────────────────────────────────────────────────────────── */

.nm-card {
	position: relative;
	display: flex;
	gap: var(--space-4);
	align-items: center;
	min-height: var(--card-min-height);
	padding: var(--space-4);
	background-color: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
	transition:
		background-color var(--duration-base) var(--ease-out),
		border-color var(--duration-base) var(--ease-out);
}

.nm-card:hover,
.nm-card:focus-within {
	background-color: var(--bg-elevated);
	border-color: var(--border-strong);
}

/* Whole card is one tap target: the link is stretched over it. */
.nm-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.nm-card__link {
	color: var(--text-primary);
	text-decoration: none;
}

.nm-card__icon {
	display: grid;
	place-items: center;
	width: var(--icon-card);
	height: var(--icon-card);
	border-radius: var(--radius-sm);
	background-color: var(--accent-muted);
	color: var(--accent-hover);
}

.nm-card__body {
	flex: 1 1 auto;
	min-width: 0;
	display: grid;
	gap: var(--space-1);
}

.nm-card__title {
	font-family: var(--font-heading);
	font-size: var(--text-h3);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-tight);
}

.nm-card__excerpt {
	font-size: var(--text-small);
	color: var(--text-secondary);
	line-height: var(--leading-tight);
	/* Keep every card the same height in a scanning list. */
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.nm-card__chevron {
	color: var(--text-muted);
	transition: transform var(--duration-base) var(--ease-out);
}

.nm-card:hover .nm-card__chevron {
	transform: translateX(2px);
	color: var(--accent-hover);
}

/* Stacked variant for tool/product rails. */
.nm-card--stacked {
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-3);
}

/* ─────────────────────────────────────────────────────────────────────────
   6. YMYL blocks
   ───────────────────────────────────────────────────────────────────────── */

.nm-disclaimer {
	display: flex;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	background-color: var(--bg-disclaimer);
	border-left: 3px solid var(--warning);
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	font-size: var(--text-small);
	line-height: var(--leading-tight);
}

.nm-disclaimer__icon {
	color: var(--warning);
	width: var(--icon-sm);
	height: var(--icon-sm);
}

.nm-disclaimer p {
	max-width: none;
}

.nm-disclaimer a {
	color: var(--text-primary);
}

.nm-disclaimer--full {
	font-size: var(--text-body);
	line-height: var(--leading-body);
	padding: var(--space-5);
}

.nm-seek-help {
	display: grid;
	gap: var(--space-3);
	padding: var(--space-5);
	background-color: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
}

.nm-seek-help__head {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	color: var(--success);
}

.nm-seek-help__title {
	font-size: var(--text-h3);
	color: var(--text-primary);
}

.nm-seek-help p {
	color: var(--text-secondary);
	font-size: var(--text-small);
}

/* ─────────────────────────────────────────────────────────────────────────
   7. Site header & footer
   ───────────────────────────────────────────────────────────────────────── */

.site-header {
	border-bottom: 1px solid var(--border);
	background-color: var(--bg-primary);
}

/* Inner row: branding left, burger right (see header.php). */
.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	padding-block: var(--space-3);
	padding-top: calc(var(--space-3) + var(--safe-top));
}

.site-branding {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	min-height: var(--tap-target);
}

.site-title {
	font-family: var(--font-heading);
	font-size: var(--text-h3);
	font-weight: var(--weight-bold);
	letter-spacing: var(--tracking-heading);
}

.site-title a {
	color: var(--text-primary);
	text-decoration: none;
}

.custom-logo {
	max-height: var(--space-8);
	width: auto;
}

/* Primary menu is desktop-only: phones use the Bottom Navigation. */
.nm-primary-nav {
	display: none;
}

.nm-primary-nav ul {
	display: flex;
	gap: var(--space-5);
	list-style: none;
	margin: 0;
	padding: 0;
}

.nm-primary-nav a {
	color: var(--text-secondary);
	text-decoration: none;
	font-size: var(--text-small);
	font-weight: var(--weight-medium);
}

.nm-primary-nav .current-menu-item > a,
.nm-primary-nav a:hover {
	color: var(--text-primary);
}

.site-footer {
	margin-top: var(--section-gap);
	padding-block: var(--space-8);
	border-top: 1px solid var(--border);
	background-color: var(--bg-secondary);
	color: var(--text-secondary);
	font-size: var(--text-small);
}

.site-footer__inner {
	display: grid;
	gap: var(--space-5);
}

.nm-footer-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3) var(--space-5);
	list-style: none;
	margin: 0;
	padding: 0;
}

.nm-footer-nav a {
	display: inline-flex;
	align-items: center;
	min-height: var(--space-8);
	color: var(--text-secondary);
	text-decoration: none;
}

.nm-footer-nav a:hover {
	color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────────────
   8. Bottom Navigation + "More" sheet
   ───────────────────────────────────────────────────────────────────────── */

.nm-bottom-nav {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: var(--z-bottom-nav);
	background-color: var(--bg-secondary);
	border-top: 1px solid var(--border);
	padding-bottom: var(--safe-bottom);
	/* No shadow: nothing should glow in a dark room. */
}

.nm-bottom-nav__list {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	align-items: stretch;
	list-style: none;
	margin: 0;
	padding: 0;
	max-width: var(--wide-width);
	margin-inline: auto;
}

.nm-bottom-nav__item {
	display: flex;
}

.nm-bottom-nav__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	flex: 1;
	min-height: var(--bottom-nav-height);
	padding: var(--space-1) 2px;
	color: var(--text-secondary);
	text-decoration: none;
	font-size: var(--text-label);
	font-weight: var(--weight-medium);
	letter-spacing: var(--tracking-label);
	line-height: 1.2;
	text-align: center;
	transition: color var(--duration-fast) var(--ease-out);
	-webkit-tap-highlight-color: transparent;
}

.nm-bottom-nav__link:hover {
	color: var(--text-primary);
}

.nm-bottom-nav__link.is-active,
.nm-bottom-nav__link[aria-current="page"] {
	color: var(--accent-hover);
}

.nm-bottom-nav__label {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Centre item (Journal): slightly larger, gently tinted — never shouting. */
.nm-bottom-nav__item--center .nm-bottom-nav__link {
	color: var(--text-primary);
}

.nm-bottom-nav__item--center .nm-icon {
	width: var(--icon-lg);
	height: var(--icon-lg);
	padding: 2px;
	border-radius: var(--radius-pill);
	background-color: var(--accent-muted);
	color: var(--accent-hover);
	box-sizing: content-box;
}

/* Very small phones (iPhone SE): icons only. */
@media (max-width: 22.5em) {
	.nm-bottom-nav__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}
}

.nm-more-sheet {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: var(--z-sheet);
	max-height: 70vh;
	overflow-y: auto;
	padding: var(--space-5) var(--screen-padding);
	padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-5));
	background-color: var(--bg-elevated);
	border-top: 1px solid var(--border);
	border-radius: var(--radius-card) var(--radius-card) 0 0;
	box-shadow: var(--shadow-sheet);
	transform: translateY(100%);
	visibility: hidden;
	transition:
		transform var(--duration-slow) var(--ease-out),
		visibility 0s linear var(--duration-slow);
}

.nm-more-sheet.is-open {
	transform: translateY(0);
	visibility: visible;
	transition-delay: 0s;
}

.nm-more-sheet ul {
	display: grid;
	gap: var(--space-1);
	list-style: none;
	margin: 0;
	padding: 0;
}

.nm-more-sheet a {
	display: flex;
	align-items: center;
	min-height: var(--tap-target);
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--text-primary);
	text-decoration: none;
}

.nm-more-sheet a:hover {
	background-color: var(--bg-secondary);
}

.nm-more-sheet__backdrop {
	position: fixed;
	inset: 0;
	z-index: calc(var(--z-sheet) - 1);
	background-color: var(--overlay);
	opacity: 0;
	visibility: hidden;
	transition:
		opacity var(--duration-base) var(--ease-out),
		visibility 0s linear var(--duration-base);
}

.nm-more-sheet__backdrop.is-open {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

/* ─────────────────────────────────────────────────────────────────────────
   9. Sticky CTA
   ───────────────────────────────────────────────────────────────────────── */

.nm-sticky-cta {
	position: fixed;
	inset-inline: 0;
	/* Sits directly on top of the Bottom Navigation. */
	bottom: calc(var(--bottom-nav-space) + var(--safe-bottom));
	z-index: var(--z-sticky-cta);
	display: flex;
	align-items: stretch;
	min-height: var(--sticky-cta-height);
	background-color: var(--accent);
	color: var(--text-on-accent);
	/* Hidden until the scroll threshold is crossed. */
	transform: translateY(100%);
	opacity: 0;
	visibility: hidden;
	transition:
		transform var(--duration-slow) var(--ease-out),
		opacity var(--duration-slow) var(--ease-out),
		visibility 0s linear var(--duration-slow);
}

.nm-sticky-cta.is-visible {
	transform: translateY(0);
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

/* Suppressed (but not dismissed) while the "More" sheet is open. */
.nm-sticky-cta.is-suppressed {
	transform: translateY(100%);
	opacity: 0;
	visibility: hidden;
}

.nm-sticky-cta__link {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	gap: var(--space-2);
	padding: var(--space-2) var(--space-4);
	font-family: var(--font-heading);
	font-size: var(--text-body);
	font-weight: var(--weight-semibold);
	color: var(--text-on-accent);
	text-decoration: none;
	text-align: center;
}

.nm-sticky-cta__link:hover {
	background-color: var(--accent-hover);
	color: var(--text-on-accent);
}

.nm-sticky-cta__close {
	display: grid;
	place-items: center;
	flex: none;
	width: var(--tap-target);
	color: var(--text-on-accent);
	opacity: 0.85;
	transition: opacity var(--duration-fast) var(--ease-out);
}

.nm-sticky-cta__close:hover {
	opacity: 1;
}

/* Invisible scroll marker injected by sticky-cta.js at the reveal threshold. */
.nm-cta-sentinel {
	position: absolute;
	left: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   10. Blocks & utilities
   ───────────────────────────────────────────────────────────────────────── */

.entry-content > * {
	margin-block: var(--space-5);
}

.entry-content > .alignwide {
	max-width: var(--wide-width);
	margin-inline: auto;
}

.entry-content > .alignfull {
	max-width: none;
	margin-inline: calc(var(--screen-padding) * -1);
}

.wp-block-image img {
	border-radius: var(--radius-card);
}

.wp-block-button__link {
	min-height: var(--button-height);
	display: inline-flex;
	align-items: center;
	border-radius: var(--radius-button);
}

.entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2) var(--space-4);
	color: var(--text-muted);
	font-size: var(--text-small);
}

.nm-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────
   11. Breakpoints
   ───────────────────────────────────────────────────────────────────────── */

/* Tablet — 768px */
@media (min-width: 48em) {
	.site-main {
		padding-block: var(--space-8) var(--section-gap);
	}

	.nm-stack--2col {
		grid-template-columns: repeat(2, 1fr);
	}

	.nm-rail {
		grid-auto-columns: minmax(16rem, 42%);
	}

	.nm-sticky-cta {
		inset-inline: auto;
		right: var(--space-5);
		left: auto;
		bottom: calc(var(--bottom-nav-space) + var(--safe-bottom) + var(--space-4));
		max-width: 26rem;
		border-radius: var(--radius-button);
		box-shadow: var(--shadow-card);
		overflow: hidden;
	}
}

/* Desktop — 1024px: the header menu replaces the Bottom Navigation. */
@media (min-width: 64em) {
	body.has-bottom-nav {
		--bottom-nav-space: 0px;
	}

	.nm-bottom-nav,
	.nm-more-sheet,
	.nm-more-sheet__backdrop {
		display: none;
	}

	.nm-primary-nav {
		display: block;
	}

	.nm-stack--3col {
		grid-template-columns: repeat(3, 1fr);
	}

	.site-footer__inner {
		grid-template-columns: 1fr auto;
		align-items: center;
	}

	.nm-has-sidebar .nm-container--wide {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 17rem;
		gap: var(--space-10);
		align-items: start;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}


/* ─────────────────────────────────────────────────────────────────────────
   12. Page shell (wrapper, header drawer, footer legal)
   ───────────────────────────────────────────────────────────────────────── */

/* Sticky footer: content grows, footer stays at the bottom on short pages. */
.site-wrapper {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.site-wrapper > .site-footer {
	margin-top: auto;
}

.site-wrapper > .site-main {
	flex: 1 0 auto;
}

/* Burger: the only header control on phones, full 48px tap target. */
.site-header__burger,
.nm-drawer__close {
	display: inline-grid;
	place-items: center;
	width: var(--tap-target);
	height: var(--tap-target);
	margin-right: calc(var(--space-2) * -1);
	border: 0;
	border-radius: var(--radius-button);
	background: transparent;
	color: var(--text-primary);
	cursor: pointer;
	transition: background-color var(--duration-fast) var(--ease-out);
}

.site-header__burger:hover,
.nm-drawer__close:hover {
	background-color: var(--bg-elevated);
}

.nm-drawer__backdrop {
	position: fixed;
	inset: 0;
	z-index: calc(var(--z-sheet) - 1);
	background-color: var(--overlay);
	opacity: 0;
	transition: opacity var(--duration-base) var(--ease-out);
}

.nm-drawer__backdrop.is-open {
	opacity: 1;
}

/* Slide-in panel from the right; never full-screen, so the page stays visible. */
.nm-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: var(--z-sheet);
	display: grid;
	align-content: start;
	gap: var(--space-4);
	width: min(20rem, 86vw);
	padding: var(--space-4) var(--space-5);
	padding-top: calc(var(--space-4) + var(--safe-top));
	padding-bottom: calc(var(--space-6) + var(--safe-bottom));
	overflow-y: auto;
	overscroll-behavior: contain;
	background-color: var(--bg-secondary);
	border-left: 1px solid var(--border);
	transform: translateX(100%);
	transition: transform var(--duration-base) var(--ease-out);
}

.nm-drawer.is-open {
	transform: translateX(0);
}

.nm-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
}

.nm-drawer__list {
	display: grid;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nm-drawer__list a {
	display: flex;
	align-items: center;
	min-height: var(--tap-target);
	padding-inline: var(--space-3);
	border-radius: var(--radius-button);
	color: var(--text-primary);
	text-decoration: none;
	font-size: var(--text-body);
}

.nm-drawer__list a:hover,
.nm-drawer__list .current-menu-item > a {
	background-color: var(--bg-elevated);
}

/* Footer legal column. */
.site-footer__legal {
	display: grid;
	gap: var(--space-3);
}

.site-footer__disclaimer {
	max-width: var(--measure);
	color: var(--text-muted);
}

.site-footer__copy {
	margin: 0;
	color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────
   13. Forms (search form in the drawer / More sheet)
   ───────────────────────────────────────────────────────────────────────── */

.search-form {
	display: flex;
	gap: var(--space-2);
}

.search-field,
input[type="search"],
input[type="text"],
input[type="email"],
textarea {
	flex: 1 1 auto;
	min-width: 0;
	min-height: var(--tap-target);
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-button);
	background-color: var(--bg-primary);
	color: var(--text-primary);
	font-family: var(--font-body);
	font-size: var(--text-body);
}

.search-form .search-submit,
input[type="submit"] {
	min-height: var(--tap-target);
	padding-inline: var(--space-4);
	border: 0;
	border-radius: var(--radius-button);
	background-color: var(--bg-elevated);
	color: var(--text-primary);
	font-weight: var(--weight-medium);
	cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────────────
   14. YMYL block details
   ───────────────────────────────────────────────────────────────────────── */

.nm-disclaimer__text {
	margin: 0;
}

.nm-disclaimer__link {
	display: inline-flex;
	align-items: center;
	min-height: var(--space-8);
	color: var(--text-primary);
	font-weight: var(--weight-medium);
}

.nm-seek-help__text {
	margin: 0;
}

.nm-seek-help__actions {
	display: grid;
	gap: var(--space-2);
}

/* ─────────────────────────────────────────────────────────────────────────
   15. Hero, page heads, media
   ───────────────────────────────────────────────────────────────────────── */

.nm-hero {
	display: grid;
	gap: var(--space-4);
	padding-block: var(--space-6) var(--section-gap);
}

.nm-hero__title {
	font-family: var(--font-heading);
	font-size: var(--text-h1);
	font-weight: var(--weight-bold);
	line-height: var(--leading-heading);
	letter-spacing: var(--tracking-heading);
	text-wrap: balance;
}

.nm-hero__subtitle {
	max-width: var(--measure);
	margin: 0;
	color: var(--text-secondary);
	font-size: var(--text-body);
	line-height: var(--leading-body);
}

.nm-page-head {
	display: grid;
	gap: var(--space-3);
	margin-bottom: var(--section-gap);
}

.nm-page-head__title {
	font-family: var(--font-heading);
	font-size: var(--text-h1);
	font-weight: var(--weight-bold);
	line-height: var(--leading-heading);
	letter-spacing: var(--tracking-heading);
	text-wrap: balance;
}

.nm-page-head__media {
	margin: var(--space-2) 0 0;
}

.nm-media,
.nm-page-head__media img,
.nm-product__cover img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--radius-card);
}

.nm-page-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--section-gap);
	color: var(--text-secondary);
	font-size: var(--text-small);
}

.nm-page-links a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--tap-target-sm);
	min-height: var(--tap-target-sm);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	text-decoration: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   16. Card variants (compact problem cards, tool cards)
   ───────────────────────────────────────────────────────────────────────── */

.nm-card--compact {
	min-height: var(--tap-target);
	padding: var(--space-3) var(--space-4);
}

.nm-card--compact .nm-card__title {
	font-size: var(--text-body);
}

/* Tool cards own their action button, so they are columns, not link rows. */
.nm-card--tool {
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-3);
	height: 100%;
	min-height: 0;
}

.nm-card__media {
	overflow: hidden;
	aspect-ratio: 3 / 2;
	border-radius: var(--radius-sm);
	background-color: var(--bg-elevated);
}

.nm-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nm-card__price {
	margin: var(--space-1) 0 0;
	color: var(--text-primary);
	font-weight: var(--weight-semibold);
}

.nm-card--tool .nm-button {
	margin-top: auto;
}

/* ─────────────────────────────────────────────────────────────────────────
   17. Problem card content (feels like, techniques)
   ───────────────────────────────────────────────────────────────────────── */

.nm-feels,
.nm-feature-list,
.nm-proscons__list,
.nm-toc__list,
.nm-steps {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nm-feels {
	display: grid;
	gap: var(--card-gap);
}

.nm-feels__item {
	display: grid;
	gap: var(--space-1);
	padding: var(--space-4);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-feels__title {
	font-size: var(--text-body);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

.nm-feels__text {
	margin: 0;
	color: var(--text-secondary);
}

/* Numbered techniques — the number comes from a CSS counter, so the markup
   stays a plain ordered list for screen readers. */
.nm-steps {
	display: grid;
	gap: var(--card-gap);
	counter-reset: nm-step;
}

.nm-steps__item {
	position: relative;
	counter-increment: nm-step;
	padding: var(--space-4);
	padding-left: calc(var(--space-10) + var(--space-3));
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-steps__item::before {
	content: counter(nm-step);
	position: absolute;
	top: var(--space-4);
	left: var(--space-4);
	display: grid;
	place-items: center;
	width: var(--icon-lg);
	height: var(--icon-lg);
	border-radius: var(--radius-pill);
	background-color: var(--accent-muted);
	color: var(--accent-hover);
	font-size: var(--text-small);
	font-weight: var(--weight-semibold);
}

.nm-steps__title {
	margin-bottom: var(--space-1);
	font-size: var(--text-body);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

.nm-steps__text {
	margin: 0;
	color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   18. Pillar table of contents & hub CTA
   ───────────────────────────────────────────────────────────────────────── */

.nm-toc {
	margin-bottom: var(--section-gap);
	padding: var(--space-4) var(--space-5);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-toc__title {
	color: var(--text-muted);
	font-size: var(--text-small);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
}

.nm-toc__list {
	display: grid;
	gap: var(--space-1);
	margin-top: var(--space-3);
}

.nm-toc__list a {
	display: flex;
	align-items: center;
	/* Comfortable target inside a dense list, without the full 48px button. */
	min-height: var(--tap-target-sm);
	color: var(--text-secondary);
	text-decoration: none;
	transition: color var(--duration-fast) var(--ease-out);
}

.nm-toc__list a:hover,
.nm-toc__list a:focus-visible {
	color: var(--accent-hover);
}

.nm-hub-cta {
	display: grid;
	gap: var(--space-3);
	padding: var(--space-5);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-hub-cta__text {
	margin: 0;
	color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   19. Product page
   ───────────────────────────────────────────────────────────────────────── */

.nm-badge {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	min-height: var(--icon-lg);
	margin: 0;
	padding-inline: var(--space-3);
	border-radius: var(--radius-pill);
	background-color: var(--accent-muted);
	color: var(--accent-hover);
	font-size: var(--text-small);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
}

.nm-product__cover {
	margin: 0 0 var(--section-gap);
}

.nm-feature-list {
	display: grid;
	gap: var(--space-3);
}

.nm-feature-list__item {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
}

.nm-feature-list__item p {
	margin: 0;
	color: var(--text-secondary);
}

.nm-feature-list__icon {
	flex: none;
	margin-top: 3px;
	width: var(--icon-sm);
	height: var(--icon-sm);
	color: var(--success);
}

.nm-feature-list__title {
	font-size: var(--text-body);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

/* Buy block: the page's single action, always visible in the flow (this
   template intentionally has no Sticky CTA). */
.nm-buy {
	display: grid;
	gap: var(--space-3);
	padding: var(--space-5);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-buy__price {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
	font-family: var(--font-heading);
	font-size: var(--text-h2);
	font-weight: var(--weight-bold);
	color: var(--text-primary);
}

.nm-buy__promise {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
	margin: 0;
	color: var(--text-secondary);
	font-size: var(--text-small);
}

.nm-buy__icon {
	flex: none;
	width: var(--icon-sm);
	height: var(--icon-sm);
	color: var(--accent-hover);
}

/* ─────────────────────────────────────────────────────────────────────────
   20. Tool review
   ───────────────────────────────────────────────────────────────────────── */

.nm-verdict {
	margin: 0;
	padding-left: var(--space-4);
	border-left: 3px solid var(--accent);
	font-size: var(--text-h3);
	line-height: var(--leading-tight);
	color: var(--text-primary);
}

.nm-rating {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
}

.nm-rating__stars {
	display: inline-flex;
	gap: 2px;
	color: var(--text-tertiary);
}

.nm-rating__star {
	width: var(--icon-xs);
	height: var(--icon-xs);
}

.nm-rating__star.is-filled {
	color: var(--warning);
}

.nm-rating__value {
	color: var(--text-secondary);
	font-size: var(--text-small);
}

.nm-proscons {
	display: grid;
	gap: var(--card-gap);
}

.nm-proscons__col {
	padding: var(--space-4);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-proscons__title {
	margin-bottom: var(--space-3);
	font-size: var(--text-body);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

.nm-proscons__list {
	display: grid;
	gap: var(--space-2);
}

.nm-proscons__item {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
	color: var(--text-secondary);
}

.nm-proscons__icon {
	flex: none;
	margin-top: 3px;
	width: var(--icon-xs);
	height: var(--icon-xs);
}

.nm-proscons__col--pros {
	border-color: var(--success-muted);
}

.nm-proscons__col--cons {
	border-color: var(--negative-muted);
}

.nm-proscons__col--pros .nm-proscons__icon {
	color: var(--success);
}

.nm-proscons__col--cons .nm-proscons__icon {
	/* Muted rose, not alarm red — see --negative in tokens.css. */
	color: var(--negative);
}

.nm-spec-list__items {
	display: grid;
	gap: 0;
	margin: 0;
}

.nm-spec-list__row {
	display: grid;
	gap: var(--space-1);
	padding-block: var(--space-3);
	border-top: 1px solid var(--border);
}

.nm-spec-list__term {
	color: var(--text-muted);
	font-size: var(--text-small);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
}

.nm-spec-list__value {
	margin: 0;
	color: var(--text-primary);
}

/* Affiliate disclosure sits directly above the button — never in the footer. */
.nm-affiliate {
	display: grid;
	gap: var(--space-3);
}

/*
 * FTC asks for "clear and conspicuous". Grey 12px type is neither, so the
 * disclosure gets the same boxed treatment as the medical disclaimer — warm,
 * quiet, impossible to miss — and sits immediately above the buy button.
 */
.nm-affiliate-disclosure {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	max-width: var(--measure);
	margin: 0;
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--warning-muted);
	border-radius: var(--radius-card);
	background-color: var(--bg-disclaimer);
	color: var(--text-secondary);
	font-size: var(--text-small);
	line-height: 1.55;
}

.nm-affiliate-disclosure__icon {
	flex: none;
	margin-top: 2px;
	width: var(--icon-xs);
	height: var(--icon-xs);
	color: var(--warning);
}

.nm-affiliate-disclosure__label {
	color: var(--text-primary);
	font-weight: var(--weight-semibold);
}

.nm-button__icon {
	flex: none;
	width: var(--icon-xs);
	height: var(--icon-xs);
}

/* ─────────────────────────────────────────────────────────────────────────
   21. Remaining chrome details & sidebar
   ───────────────────────────────────────────────────────────────────────── */

.nm-more-sheet__grabber {
	display: block;
	width: var(--space-10);
	height: var(--space-1);
	margin: 0 auto var(--space-4);
	border-radius: var(--radius-pill);
	background-color: var(--border-strong);
}

.nm-more-sheet__list {
	display: grid;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nm-sticky-cta__arrow {
	flex: none;
	width: var(--icon-xs);
	height: var(--icon-xs);
}

.nm-sidebar {
	display: grid;
	gap: var(--section-gap);
}

.nm-widget {
	padding: var(--space-5);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

.nm-widget__title {
	margin-bottom: var(--space-3);
	font-size: var(--text-h3);
}

/* ─────────────────────────────────────────────────────────────────────────
   22. Stage 2 breakpoints
   ───────────────────────────────────────────────────────────────────────── */

/* Tablet — 768px */
@media (min-width: 48em) {
	.nm-proscons {
		grid-template-columns: repeat(2, 1fr);
	}

	.nm-spec-list__row {
		grid-template-columns: 11rem minmax(0, 1fr);
		gap: var(--space-4);
		align-items: baseline;
	}

	.nm-seek-help__actions {
		display: flex;
		flex-wrap: wrap;
	}

	.nm-seek-help__actions .nm-button {
		flex: 1 1 14rem;
	}

	.nm-hero {
		padding-block: var(--space-10) var(--section-gap);
	}
}

/* Desktop — 1024px: the inline menu replaces the burger and its drawer. */
@media (min-width: 64em) {
	.site-header__burger,
	.nm-drawer,
	.nm-drawer__backdrop {
		display: none;
	}
}

/* ─────────────────────────────────────────────────────────────────────────
   23. Stage 3 — component polish
   Every value comes from tokens.css; no literal colours or sizes.
   ───────────────────────────────────────────────────────────────────────── */

/* ── E-E-A-T byline (author + published / updated) ───────────────────────── */

.nm-entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-3);
	margin-top: var(--space-3);
	margin-bottom: 0;
	color: var(--text-muted);
	font-size: var(--text-label);
	letter-spacing: var(--tracking-label);
	line-height: var(--leading-tight);
}

.nm-entry-meta__author {
	color: var(--text-secondary);
}

/* ── Disclaimer: compact variant + route to support ──────────────────────── */

.nm-disclaimer--compact {
	padding: var(--space-2) var(--space-3);
	gap: var(--space-2);
}

.nm-disclaimer--compact .nm-disclaimer__icon {
	width: var(--icon-xs);
	height: var(--icon-xs);
}

.nm-disclaimer__text > :last-child {
	margin-bottom: 0;
}

.nm-disclaimer__link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	/* Keeps a 48px hit area without inflating the box visually. */
	min-height: var(--tap-target);
	margin-top: var(--space-1);
	color: var(--accent-hover);
	font-weight: var(--weight-medium);
	text-decoration: none;
}

.nm-disclaimer__link:hover {
	text-decoration: underline;
}

.nm-disclaimer__chevron {
	/* Same small-glyph size as every other inline icon in the theme. */
	width: var(--icon-xs);
	height: var(--icon-xs);
}

/* ── Problem cards in grids ──────────────────────────────────────────────── */

.nm-card--problem {
	/* 72–88px per the wireframe: a thumb-sized row that cannot be missed. */
	min-height: var(--card-min-height);
}

.nm-card--problem .nm-card__chevron {
	flex: none;
}

/* Horizontal rails are focusable regions so they can be scrolled by keyboard. */
.nm-rail:focus-visible {
	outline: 2px solid var(--accent-hover);
	outline-offset: var(--space-1);
	border-radius: var(--radius-sm);
}

/* "See all …" link under a grid. */
.nm-section__more {
	margin-top: var(--card-gap);
}

/* ── Disclaimer in the content flow ─────────────────────────── */

/*
 * The disclaimer is deliberately not a `.nm-section`, so it breaks the
 * `.nm-section + .nm-section` rhythm on every template that prints it between
 * the page head and the first section. Restore the gap on both sides.
 */
.nm-disclaimer + .nm-section,
.nm-disclaimer + .nm-toc,
.nm-disclaimer + .nm-disclaimer,
.nm-disclaimer + .nm-page-head__media,
.nm-section + .nm-disclaimer,
.nm-toc + .nm-disclaimer {
	margin-top: var(--section-gap);
}

/* ── "More" sheet header ─────────────────────────────────────────────────── */

.nm-more-sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	margin-bottom: var(--space-3);
}

.nm-more-sheet__title {
	margin: 0;
	font-family: var(--font-heading);
	font-size: var(--text-h3);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

.nm-more-sheet__close {
	display: grid;
	place-items: center;
	flex: none;
	width: var(--tap-target);
	height: var(--tap-target);
	margin-right: calc(var(--space-2) * -1);
	border-radius: var(--radius-pill);
	color: var(--text-secondary);
	transition: color var(--duration-fast) var(--ease-out);
}

.nm-more-sheet__close:hover {
	color: var(--text-primary);
}

/* ── Sticky CTA ──────────────────────────────────────────────────────────── */

.nm-sticky-cta__text {
	/* One line, never wrapping the bar into two rows on small phones. */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nm-sticky-cta__close {
	min-height: var(--tap-target);
}

/* ── Home hero ───────────────────────────────────────────────────────────── */

.nm-hero__cta {
	margin-top: var(--space-5);
}


/* ─────────────────────────────────────────────────────────────────────────
   24. Stage 4 — final polish
   Templates finished in this stage (Pillar, Tool Review) plus the shared
   details that had to wait until every component existed. Values come from
   tokens.css only; no literal colours, sizes or durations below.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Reading measure ─────────────────────────────────────────────────────
   The container caps the page at --content-width (42rem ≈ 672px) and prose
   blocks additionally cap at --measure (66ch), so a line never runs past the
   65–68 characters the design system asks for — on any viewport. */

.nm-prose > :is(p, ul, ol, blockquote, dl),
.nm-lead,
.nm-verdict {
	max-width: var(--measure);
}

/* ── Pillar hero ─────────────────────────────────────────────────────────
   Reserved aspect ratio: the LCP image can load late without shifting the
   article underneath it. */

.nm-pillar__hero {
	margin: 0 0 var(--section-gap);
}

.nm-pillar__hero img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: var(--radius-card);
	background-color: var(--bg-secondary);
}

/* ── Pillar clusters ─────────────────────────────────────────────────────
   Cluster cards are the same component as a problem card, so the hub and the
   pillar page read as one system. Only the rhythm needs a nudge. */

.nm-pillar .nm-stack--2col {
	gap: var(--card-gap);
}

/* ── Tool review ─────────────────────────────────────────────────────────── */

.nm-verdict {
	margin-top: var(--space-3);
	font-family: var(--font-heading);
	font-size: calc(var(--text-body) + 1px);
	font-weight: var(--weight-medium);
	line-height: var(--leading-body);
	color: var(--text-primary);
}

.nm-proscons__item {
	line-height: var(--leading-body);
}

/* Screen-reader-only label stays readable when the disclosure wraps. */
.nm-affiliate-disclosure__label {
	margin-right: var(--space-1);
}

/* ── Calm empty state (search, archives) ─────────────────────────────────
   No red, no "error", always one obvious next action — the UX rules of the
   project forbid alarm colours anywhere on the site. */

.nm-archive .nm-section__title + .nm-lead {
	margin-top: var(--space-3);
}

.nm-archive .nm-button {
	margin-top: var(--space-5);
}

/* ── Breakpoints for the components added in this stage ──────────────────── */

/* Tablet — 768px */
@media (min-width: 48em) {
	.nm-pillar__hero img {
		aspect-ratio: 21 / 9;
	}

	.nm-affiliate-disclosure {
		padding: var(--space-4) var(--space-5);
	}

	.nm-archive .nm-button--full {
		display: inline-flex;
		width: auto;
		min-width: 16rem;
	}
}

/* Desktop — 1024px */
@media (min-width: 64em) {
	/*
	 * Two columns of links instead of one long list. Deliberately not sticky:
	 * an in-flow block with a background would let the article scroll behind
	 * it, and a floating panel is exactly the kind of movement this design
	 * system avoids.
	 */
	.nm-toc__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--space-6);
	}
}

/* Small phones — 360px and below: keep the two-column lists stacked. */
@media (max-width: 22.5em) {
	.nm-proscons__col {
		padding: var(--space-3);
	}

	.nm-affiliate-disclosure {
		padding: var(--space-3);
	}
}
