/**
 * Curio base styles: design tokens and shared primitives.
 * Component styles live next to each block in /blocks/<name>/style.css.
 */

/* -------------------------------------------------------------
 * Fonts. The site font "Curio" (theme.json) is two fonts in one family:
 * regular-weight text uses Merriweather and bold text (600+) uses
 * Figtree Extra Bold (a free stand-in for Verywell Health's FS Albert
 * Extra Bold), the same split Verywell uses.
 * "Curio Fallback" mirrors that split with system fonts while the web
 * fonts load (or if they fail), so headings stay sans-serif.
 *
 * The metric overrides make the fallback take the same room as the web
 * font, so text doesn't reflow when it arrives. Computed from the woff2
 * files (fontTools: unitsPerEm, hhea ascender/descender, advance widths
 * weighted by English letter frequency incl. space) against published
 * Georgia and Arial Bold (= Helvetica Bold) metrics:
 *   Merriweather 400: upm 1000, asc 984, desc 273, gap 0, avg width .499 em
 *   Georgia:          avg width ~.444 em  -> size-adjust .499/.444 = 112.5%
 *   Figtree 800:      upm 1000, asc 950, desc 250, gap 0, avg width .4745 em
 *   Arial Bold:       avg width ~.484 em  -> size-adjust .4745/.484 = 98%
 *   ascent/descent-override = web font metric / size-adjust.
 * Tuned for Georgia and Arial Bold; the other local() faces only
 * approximate them.
 * ----------------------------------------------------------- */
@font-face {
	font-family: "Curio Fallback";
	font-weight: 100 500;
	src: local("Georgia"), local("Noto Serif"), local("DejaVu Serif");
	size-adjust: 112.5%;
	ascent-override: 87.5%;
	descent-override: 24.3%;
	line-gap-override: 0%;
}

@font-face {
	font-family: "Curio Fallback";
	font-weight: 600 900;
	src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), local("Roboto Bold"), local("Roboto-Bold");
	size-adjust: 98%;
	ascent-override: 96.9%;
	descent-override: 25.5%;
	line-gap-override: 0%;
}

/* Merriweather defaults to old-style numbers (2026 dips below the line);
   lining numbers keep dates and counts even. Applies with tabular-nums too. */
body {
	font-feature-settings: "lnum" 1;
}

/* -------------------------------------------------------------
 * Tokens (aliases of theme.json presets; change colors in theme.json
 * or Appearance → Editor → Styles and everything follows).
 * ----------------------------------------------------------- */
:root {
	--c-primary: var(--wp--preset--color--primary);
	--c-primary-dark: var(--wp--preset--color--primary-dark);
	--c-secondary: var(--wp--preset--color--secondary);
	--c-accent: var(--wp--preset--color--accent);
	--c-text: var(--wp--preset--color--text);
	--c-black: var(--wp--preset--color--black);
	--c-gray-mid: var(--wp--preset--color--gray-mid);
	--c-gray-light: var(--wp--preset--color--gray-light);
	--c-white: var(--wp--preset--color--white);
	--c-rule: color-mix(in srgb, var(--c-text) 20%, transparent);

	/* Color roles (Navy scheme). Change the values in theme.json. */
	--c-heading: var(--wp--preset--color--heading);   /* headlines and story titles */
	--c-link: var(--wp--preset--color--primary);      /* links in text, author names, footnote numbers */
	--c-navy: var(--wp--preset--color--primary-dark); /* header, footer */
	--c-label: var(--wp--preset--color--secondary);   /* category names and small labels */
	--c-tag: var(--wp--preset--color--accent);        /* category tags, buttons, accent borders */
	--c-tag-text: var(--wp--preset--color--primary-dark);
	--c-header: var(--c-navy);
	--c-header-text: var(--c-white);

	--f-primary: var(--wp--preset--font-family--primary);
	--f-secondary: var(--wp--preset--font-family--secondary);
	/* Long-form text where bold should stay serif (article body): Merriweather. */
	--f-text: var(--wp--preset--font-family--secondary);
	--f-mono: var(--wp--preset--font-family--monospace);

	--radius-button: 6px;

	/* Shared type sizes for repeated card parts. Blocks use these instead of
	   their own values so like things match everywhere. */
	--fs-tag: 0.75rem;          /* amber category tags (12px), every width */
	--fs-byline: 0.75rem;       /* "By Name" on cards and lists: 12px phone/tablet, 14px desktop */
	--lh-byline: 1.3;
	--fs-credit: 0.75rem;       /* image credits */
	--fs-section-heading: 1.5rem; /* homepage section headings: 24px, 34px desktop */
	--lh-section-heading: 1.25;
	--lh-deck: 1.45;            /* card summaries */
	/* Sticky header: above ad creatives (z-index 10+) and the theme's z-20
	   popups (Cite panel, footnotes), below network interstitials. */
	--header-z: 10000;

	/* Grid: 8 columns on small screens, 12 from 64rem (1024px). */
	--grid-max: 90rem;
	--grid-cols: 8;
	--grid-gap: 0.5rem;
	--grid-edge: 0.75rem;
	--content-max: calc(min(100vw, var(--grid-max)) - var(--grid-edge) * 2);
	--col-w: calc((var(--content-max) - var(--grid-gap) * (var(--grid-cols) - 1)) / var(--grid-cols));
	/* Viewport space outside the content area on each side (for full-bleed tricks). */
	--viewport-edge: var(--grid-edge);

	/* Rich text column widths. */
	--block-max-width: min(100%, 42.5rem);
	--block-wide-max-width: min(100%, 55.625rem);
	--block-rhythm: 1.75rem;
}

@media (min-width: 64rem) {
	:root {
		--fs-byline: 0.875rem;
		--fs-section-heading: 2.125rem;
		--grid-cols: 12;
		--grid-gap: 1.25rem;
		--grid-edge: 1.875rem;
		--viewport-edge: calc((100vw - min(100vw, var(--grid-max)) + var(--grid-edge) * 2) / 2);
	}
}

/*
 * Width of N grid columns (including the gaps between them):
 *   width: calc(var(--col-w) * N + var(--grid-gap) * (N - 1));
 */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-top: 90px;
}

body {
	margin: 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

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

img {
	display: block;
}

figure {
	margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol {
	margin: 0;
}

ul,
ol {
	padding: 0;
}

button {
	font: inherit;
	color: inherit;
	cursor: pointer;
}

a {
	color: var(--c-primary);
	text-decoration: none;
}

a:hover,
a:focus-visible {
	text-decoration: underline;
}

:focus-visible {
	outline: 2px solid var(--c-primary);
	outline-offset: 2px;
}

/* On the navy footer the blue ring is too faint (2.1:1): use white. */
.curio-site-footer :focus-visible {
	outline-color: var(--c-white);
}

/* Remove WordPress's default gap between top-level template blocks. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* -------------------------------------------------------------
 * Accessibility helpers
 * ----------------------------------------------------------- */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background: var(--c-white);
	clip: auto !important;
	clip-path: none;
	color: var(--c-primary);
	display: block;
	font-size: 1rem;
	font-weight: 700;
	height: auto;
	left: 5px;
	padding: 15px 23px 14px;
	top: 5px;
	width: auto;
	z-index: 100000;
}

.skip-link:not(:focus) {
	position: absolute;
	left: -9999px;
}

/* -------------------------------------------------------------
 * Layout
 * ----------------------------------------------------------- */
.curio-container {
	width: var(--content-max);
	margin-inline: auto;
}

/* -------------------------------------------------------------
 * Primitives shared by components
 * ----------------------------------------------------------- */

/* Eyebrow: small uppercase topic label. */
.curio-eyebrow {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.075em;
	text-transform: uppercase;
	color: var(--c-secondary);
}

/* Byline: "By Name • Date". */
.curio-byline {
	font-size: var(--fs-byline);
	font-weight: 300;
	line-height: var(--lh-byline);
	color: var(--c-text);
}

/* Author names in story-card bylines: same color as the byline text, underlined on hover.
   (The article page byline has its own style in blocks/article-byline.) */
:is(.curio-byline, .curio-meta__by, .curio-pages-meta__by, .curio-byline__authors) a {
	color: inherit;
	text-decoration: none;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

:is(.curio-byline, .curio-meta__by, .curio-pages-meta__by, .curio-byline__authors) a:is(:hover, :focus-visible) {
	text-decoration: underline;
}

/* Button (e.g. "More Stories"). */
.curio-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 20px;
	border: 0;
	border-radius: var(--radius-button);
	background-color: var(--c-tag);
	color: var(--c-tag-text);
	font-family: var(--f-primary);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.075em;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.curio-button:hover,
.curio-button:focus-visible {
	background-color: var(--c-navy);
	color: var(--c-white);
	text-decoration: none;
}

.curio-button--accent {
	background-color: var(--c-tag);
}

/* Inline SVG icons inherit color. */
.curio-icon {
	display: inline-block;
	width: 1em;
	height: 1em;
	fill: currentColor;
	vertical-align: middle;
	flex-shrink: 0;
}

.curio-icon[data-stroke] {
	fill: none;
	stroke: currentColor;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* Placeholder text wordmark (replace by uploading a logo in Curio Settings). */
.curio-logo--text {
	display: inline-flex;
	align-items: baseline;
	gap: 0.08em;
	font-family: var(--f-primary);
	font-size: 56px;
	line-height: 1;
	letter-spacing: -0.045em;
	color: var(--c-primary-dark);
	white-space: nowrap;
}

/* Drawn wordmark (SVG): sized by the same font-size as the text wordmark. */
.curio-logo.curio-logo--svg {
	display: inline-flex;
	align-items: center;
	width: auto;
	max-width: 100%;
	gap: 0;
	letter-spacing: 0;
	line-height: 0;
}

.curio-logo--svg svg {
	display: block;
	width: auto;
	max-width: 100%;
	height: 1em;
}

.curio-logo__light {
	font-weight: 300;
}

.curio-logo__bold {
	font-weight: 900;
}

.curio-logo--light {
	color: var(--c-white);
}

.curio-logo--mark.curio-logo--text .curio-logo__mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1em;
	height: 1em;
	border-radius: 4px;
	background: var(--c-primary-dark);
	color: var(--c-white);
	font-weight: 900;
	font-size: 0.8em;
	letter-spacing: 0;
}

/* ---------------------------------------------------------------
 * Previous / Next pager: two rounded buttons, "Page N" between.
 * Shared by archive rivers and search results (curio_archive_prevnext_html).
 * ------------------------------------------------------------- */
.curio-pager {
	display: flex;
	flex-wrap: wrap; /* Large text: wrap instead of pushing "Previous" off-screen. */
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 1.75rem;
	padding-top: 1.75rem;
	border-top: 1px solid var(--c-rule);
	font-variant-numeric: tabular-nums;
}

.curio-pager__link {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	min-height: 2.875rem;
	padding: 0 1.25rem;
	border: 1.5px solid var(--c-primary);
	max-width: 100%;
	border-radius: 999px;
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1;
	color: var(--c-primary);
	transition: background-color 0.15s, color 0.15s;
}

.curio-pager__link:is(:hover, :focus-visible) {
	background-color: var(--c-primary);
	color: var(--c-white, #fff);
	text-decoration: none;
}

.curio-pager__link .curio-icon {
	width: 0.875rem;
	height: 0.875rem;
	stroke-width: 3;
}

.curio-pager__current {
	font-size: 0.875rem;
	font-weight: 600;
	white-space: nowrap;
	color: color-mix(in srgb, var(--c-text) 70%, transparent);
}

@media (min-width: 48rem) {
	.curio-pager {
		gap: 1.125rem;
		margin-top: 2.25rem;
	}

	.curio-pager__link {
		padding: 0 1.5rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.curio-pager__link {
		transition: none;
	}
}

/* ---------------------------------------------------------------
 * Category tags: the category name above a story is a small amber
 * tag with navy text (cards, article header, lists).
 * ------------------------------------------------------------- */
:is(
	.curio-eyebrow,
	.curio-fa-lead__eyebrow, .curio-fa-card__eyebrow,
	.curio-af-lead__eyebrow, .curio-af-card__eyebrow,
	.curio-sta-card__eyebrow, .curio-fm-lead__eyebrow, .curio-fm-item__eyebrow,
	.curio-river-item__eyebrow, .curio-text-item__eyebrow,
	.curio-article-header__eyebrow, .curio-topic-feature__eyebrow, .curio-topic-feature-item__eyebrow,
	.curio-index-item__label, .curio-related__topic, .curio-topics-river__term
):where(:not(:empty)) {
	display: inline-block;
	width: fit-content;
	padding: 0.2em 0.45em 0.1em;
	font-family: var(--f-primary);
	font-size: var(--fs-tag);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.075em;
	text-transform: uppercase;
	border-radius: 2px;
	background-color: var(--c-tag);
	color: var(--c-tag-text);
}

:is(.curio-topics-river__term) a {
	color: inherit;
}

/*
 * Tap targets: each tag link gets a hit area at least 24px tall without a
 * bigger box. It grows upward (onto the image or space above the tag) and
 * only 2px down, and tags above a headline keep about 6px clear of it (the
 * story-list tags already sit 4px clear), so a tap aimed at the headline
 * still opens the story.
 */
:where(
	a.curio-eyebrow,
	a.curio-fa-lead__eyebrow, a.curio-fa-card__eyebrow,
	a.curio-af-lead__eyebrow, a.curio-af-card__eyebrow,
	a.curio-sta-card__eyebrow, a.curio-fm-lead__eyebrow, a.curio-fm-item__eyebrow,
	a.curio-river-item__eyebrow, a.curio-text-item__eyebrow,
	a.curio-article-header__eyebrow, a.curio-topic-feature__eyebrow, a.curio-topic-feature-item__eyebrow,
	a.curio-index-item__label
) {
	position: relative;
}

:is(
	.curio-eyebrow,
	.curio-fa-lead__eyebrow, .curio-fa-card__eyebrow,
	.curio-af-lead__eyebrow, .curio-af-card__eyebrow,
	.curio-sta-card__eyebrow, .curio-fm-lead__eyebrow, .curio-fm-item__eyebrow,
	.curio-river-item__eyebrow, .curio-text-item__eyebrow,
	.curio-article-header__eyebrow, .curio-topic-feature__eyebrow, .curio-topic-feature-item__eyebrow
):is(a)::after {
	content: "";
	position: absolute;
	top: min(0px, calc(100% - 22px));
	right: -2px;
	bottom: -2px;
	left: -2px;
}

:is(
	.curio-fa-lead__eyebrow, .curio-fa-card__eyebrow,
	.curio-af-lead__eyebrow, .curio-af-card__eyebrow,
	.curio-sta-card__eyebrow, .curio-fm-lead__eyebrow, .curio-fm-item__eyebrow,
	.curio-river-item__eyebrow,
	.curio-topic-feature__eyebrow, .curio-topic-feature-item__eyebrow
):is(a):where(:not(:empty)) {
	margin-bottom: 0.375rem;
}

/* The author-page label sits under its headline: grow downward instead. */
a.curio-index-item__label::after {
	content: "";
	position: absolute;
	top: -2px;
	right: -2px;
	bottom: min(0px, calc(100% - 22px));
	left: -2px;
}

a.curio-index-item__label:where(:not(:empty)) {
	margin-top: 0.375rem;
}



/* Clickable category tags: underline on hover/focus, the same everywhere. */
:is(
	.curio-eyebrow,
	.curio-fa-lead__eyebrow, .curio-fa-card__eyebrow,
	.curio-af-lead__eyebrow, .curio-af-card__eyebrow,
	.curio-sta-card__eyebrow, .curio-fm-lead__eyebrow, .curio-fm-item__eyebrow,
	.curio-river-item__eyebrow, .curio-text-item__eyebrow,
	.curio-article-header__eyebrow, .curio-topic-feature__eyebrow, .curio-topic-feature-item__eyebrow,
	.curio-index-item__label, .curio-related__topic, .curio-topics-river__term
):is(a, :has(> a)):is(:hover, :focus-visible, :focus-within) {
	text-decoration: underline;
}

/* Short pages: the footer sits at the bottom of the window, not mid-screen. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.wp-site-blocks > main,
.wp-site-blocks > .site-main {
	flex: 1 0 auto;
}
