/*
Theme Name:  Chris Meredith
Theme URI:   https://chrismeredith.us/
Author:      Monkey Attack LLC
Author URI:  https://monkeyattackllc.com/
Description: Personal site theme for chrismeredith.us. Section-based: the C.A. Meredith author section ships first, and further sections register themselves through the theme's section API without a rewrite. Design system "Lyrical Authority" — EB Garamond + Hanken Grotesk, parchment and deep navy with a muted gold accent. Fonts are self-hosted; the theme makes no external requests.
Version:     1.0.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: chrismeredith
Tags:        one-column, custom-menu, editor-style, translation-ready
*/

/* ==========================================================================
   Design tokens
   Values are taken from the Stitch project "Kindle Author Showcase"
   (projects/15334294178278403711), design system "Lyrical Authority".
   Where Stitch did not specify a value it is marked JUDGEMENT.
   ========================================================================== */

:root {
	/* Surfaces */
	--cm-surface:                   #fbf9f8;
	--cm-surface-dim:               #dcd9d9;
	--cm-surface-container-lowest:  #ffffff;
	--cm-surface-container-low:     #f6f3f2;
	--cm-surface-container:         #f0eded;
	--cm-surface-container-high:    #eae8e7;
	--cm-surface-container-highest: #e4e2e1;

	/* Content */
	--cm-on-surface:          #1b1c1c;
	--cm-on-surface-variant:  #44474d;

	/* Brand */
	--cm-primary:            #04162e;
	--cm-primary-container:  #1a2b44;
	--cm-on-primary:         #ffffff;

	/* Accent — Stitch overrideTertiaryColor "Muted Gold" */
	--cm-accent:      #d4af37;
	/* JUDGEMENT: Stitch gives no darker gold for hover/serif-on-light use.
	   #b8952a is the value already in use on the live reference page. */
	--cm-accent-dim:  #b8952a;

	/* Lines */
	--cm-outline:          #75777e;
	--cm-outline-variant:  #c5c6ce;
	/* JUDGEMENT: hairline rules read too heavy at outline-variant on parchment,
	   so section dividers use surface-container-highest. */
	--cm-outline-faint:    #e4e2e1;

	/* Typefaces */
	--cm-font-headline: "EB Garamond", Georgia, "Times New Roman", serif;
	--cm-font-body:     "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	/* Type scale. Stitch fixes the desktop sizes and one mobile size
	   (headline-lg-mobile 32px); the fluid clamps between them are JUDGEMENT. */
	--cm-headline-xl: clamp(2.5rem, 1.6rem + 4.5vw, 4rem);     /* 40 → 64px */
	--cm-headline-lg: clamp(2rem, 1.55rem + 2.25vw, 3rem);     /* 32 → 48px */
	--cm-headline-md: clamp(1.5rem, 1.31rem + 0.94vw, 2rem);   /* 24 → 32px */
	--cm-body-lg:     1.125rem;  /* 18px */
	--cm-body-md:     1rem;      /* 16px */
	--cm-label-sm:    0.8125rem; /* 13px */

	/* Spacing — Stitch spacing scale, 8px rhythm */
	--cm-container-max:  1200px;
	--cm-gutter:         24px;
	--cm-margin-mobile:  20px;
	--cm-stack-sm:       8px;
	--cm-stack-md:       24px;
	--cm-stack-lg:       64px;
	/* JUDGEMENT: Stitch stops at stack-lg. Full-bleed section padding needs a
	   larger step; 96px keeps the 8px rhythm. */
	--cm-stack-xl:       96px;

	/* Shape — Stitch roundness ROUND_FOUR */
	--cm-radius-sm:   2px;
	--cm-radius:      4px;
	--cm-radius-lg:   8px;
	--cm-radius-full: 9999px;

	/* Measure — design system: long-form body copy caps at 650px */
	--cm-measure: 650px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol { margin: 0; padding: 0; }

ul[class], ol[class] { list-style: none; }

html { -webkit-text-size-adjust: 100%; }

body {
	font-family: var(--cm-font-body);
	font-size: var(--cm-body-md);
	line-height: 1.6;
	color: var(--cm-on-surface);
	background-color: var(--cm-surface);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

img, picture, svg { max-width: 100%; display: block; }

a { color: inherit; }

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

/* Accessibility ---------------------------------------------------------- */

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

.skip-link {
	position: absolute;
	top: -100px;
	left: var(--cm-gutter);
	z-index: 100;
	padding: 12px 20px;
	background: var(--cm-primary);
	color: var(--cm-on-primary);
	text-decoration: none;
	border-radius: var(--cm-radius);
}

.skip-link:focus { top: 12px; }

:focus-visible {
	outline: 2px solid var(--cm-accent);
	outline-offset: 3px;
}

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

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.cm-container {
	width: 100%;
	max-width: var(--cm-container-max);
	margin-inline: auto;
	padding-inline: var(--cm-gutter);
}

.cm-site { display: flex; flex-direction: column; min-height: 100vh; }
.cm-site-main { flex: 1 0 auto; }

.cm-section { padding-block: var(--cm-stack-xl); }
.cm-section--tight { padding-block: var(--cm-stack-lg); }
.cm-section--alt { background-color: var(--cm-surface-container-low); }
.cm-section--dark {
	background-color: var(--cm-primary-container);
	color: var(--cm-on-primary);
}

.cm-divider {
	height: 1px;
	border: 0;
	margin: 0;
	background-color: var(--cm-outline-faint);
}

/* ==========================================================================
   Typography roles
   ========================================================================== */

.cm-eyebrow,
.cm-section-label {
	font-family: var(--cm-font-body);
	font-size: var(--cm-label-sm);
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cm-accent-dim);
}

/* On navy the darker gold loses contrast, so the accent runs brighter. */
.cm-section--dark .cm-section-label,
.cm-hero .cm-eyebrow { color: var(--cm-accent); }

.cm-section-title {
	font-family: var(--cm-font-headline);
	font-size: var(--cm-headline-lg);
	font-weight: 500;
	line-height: 1.2;
	color: var(--cm-primary);
	margin-top: 12px;
}

.cm-section--dark .cm-section-title { color: var(--cm-on-primary); }

.cm-section-header { margin-bottom: var(--cm-stack-lg); }

.cm-prose {
	font-size: var(--cm-body-lg);
	line-height: 1.7;
	max-width: var(--cm-measure);
}

.cm-prose p + p { margin-top: var(--cm-stack-md); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.cm-btn {
	display: inline-block;
	padding: 12px 28px;
	font-family: var(--cm-font-body);
	font-size: var(--cm-label-sm);
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	border: 1px solid transparent;
	border-radius: var(--cm-radius);
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
	cursor: pointer;
}

.cm-btn--accent {
	background-color: var(--cm-accent);
	color: var(--cm-primary);
}
.cm-btn--accent:hover { background-color: var(--cm-accent-dim); }

.cm-btn--primary {
	background-color: var(--cm-primary);
	color: var(--cm-on-primary);
}
/* Design system: hover lift is a soft ambient navy shadow, never a hard drop. */
.cm-btn--primary:hover {
	background-color: var(--cm-primary-container);
	box-shadow: 0 4px 16px rgba(4, 22, 46, 0.1);
}

.cm-btn--outline {
	border-color: var(--cm-outline-variant);
	color: var(--cm-on-surface);
	background-color: transparent;
}
.cm-btn--outline:hover {
	border-color: var(--cm-primary);
	color: var(--cm-primary);
}

/* Outline button sitting on navy */
.cm-btn--ghost {
	border-color: rgba(255, 255, 255, 0.35);
	color: rgba(255, 255, 255, 0.85);
	background-color: transparent;
}
.cm-btn--ghost:hover {
	border-color: rgba(255, 255, 255, 0.65);
	color: #ffffff;
}

.cm-btn--sm { padding: 10px 18px; font-size: 12px; }

/* ==========================================================================
   Site header
   ========================================================================== */

.cm-site-header {
	background-color: var(--cm-primary);
	color: var(--cm-on-primary);
}

.cm-site-header .cm-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--cm-stack-md);
	min-height: 72px;
	padding-block: 16px;
	flex-wrap: wrap;
}

.cm-site-branding { display: flex; flex-direction: column; gap: 2px; }

.cm-site-title {
	font-family: var(--cm-font-headline);
	font-size: 1.5rem;
	font-weight: 500;
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.cm-site-title a { text-decoration: none; color: inherit; }

.cm-site-description {
	font-size: var(--cm-label-sm);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.55);
}

/* Design system: top-tier navigation is centred, label-sm, generous tracking. */
.cm-site-nav ul {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--cm-stack-md);
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}

.cm-site-nav a {
	font-size: var(--cm-label-sm);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	color: rgba(255, 255, 255, 0.75);
	padding-block: 6px;
	border-bottom: 1px solid transparent;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.cm-site-nav a:hover,
.cm-site-nav .current-menu-item > a,
.cm-site-nav .cm-nav-current > a {
	color: #ffffff;
	border-bottom-color: var(--cm-accent);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.cm-hero {
	background-color: var(--cm-primary);
	color: var(--cm-on-primary);
	padding-block: var(--cm-stack-xl);
	text-align: center;
}

.cm-hero-inner {
	max-width: 760px;
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* The colour is explicit, not inherited: theme.json sets a navy default on h1
   for editor content, which would otherwise paint this navy-on-navy. */
.cm-hero-title {
	font-family: var(--cm-font-headline);
	font-size: var(--cm-headline-xl);
	font-weight: 500;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--cm-on-primary);
	margin-top: var(--cm-stack-md);
}

.cm-hero-tagline {
	font-size: var(--cm-body-lg);
	line-height: 1.65;
	color: rgba(255, 255, 255, 0.7);
	max-width: 560px;
	margin-top: var(--cm-stack-md);
}

.cm-hero-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 36px;
}

/* ==========================================================================
   About
   ========================================================================== */

.cm-about-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	gap: var(--cm-stack-lg);
	align-items: start;
}

.cm-about-bio { max-width: var(--cm-measure); }

.cm-pull-quote {
	font-family: var(--cm-font-headline);
	font-style: italic;
	font-size: var(--cm-body-lg);
	line-height: 1.5;
	color: var(--cm-on-surface-variant);
	margin-top: var(--cm-stack-md);
	padding-left: 20px;
	border-left: 3px solid var(--cm-accent);
}

.cm-meta-list { margin: 0; }

.cm-meta-item {
	display: flex;
	flex-direction: column;
	gap: var(--cm-stack-sm);
	padding-block: 16px;
	border-bottom: 1px solid var(--cm-outline-faint);
}

.cm-meta-item:first-child { border-top: 1px solid var(--cm-outline-faint); }

.cm-meta-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cm-on-surface-variant);
}

.cm-meta-value {
	font-family: var(--cm-font-headline);
	font-size: 1.0625rem;
	line-height: 1.4;
	color: var(--cm-on-surface);
}

.cm-meta-value a {
	color: var(--cm-primary);
	text-decoration: none;
	border-bottom: 1px solid var(--cm-outline-variant);
	transition: color 0.2s ease, border-color 0.2s ease;
}

.cm-meta-value a:hover {
	color: var(--cm-accent-dim);
	border-bottom-color: var(--cm-accent);
}

/* ==========================================================================
   Book cards
   Design system: flat, 1px border, no shadow at rest; title in EB Garamond;
   cover displays may take the larger 8px radius.
   ========================================================================== */

.cm-books-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 32px;
}

.cm-book-card {
	display: flex;
	flex-direction: column;
	background-color: var(--cm-surface-container-lowest);
	border: 1px solid var(--cm-outline-faint);
	border-radius: var(--cm-radius);
	overflow: hidden;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.cm-book-card:hover {
	border-color: var(--cm-outline-variant);
	box-shadow: 0 6px 24px rgba(4, 22, 46, 0.1);
}

.cm-book-cover {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 320px;
	padding: 24px;
	background-color: var(--cm-primary-container);
	overflow: hidden;
}

.cm-book-cover img {
	height: 100%;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	border-radius: var(--cm-radius-lg);
}

/* Fallback shown when no cover file is present */
.cm-book-cover-placeholder {
	display: flex;
	flex-direction: column;
	justify-content: center;
	text-align: center;
	padding: 20px;
}

.cm-book-cover-placeholder .cm-cover-title {
	font-family: var(--cm-font-headline);
	font-size: 1.375rem;
	line-height: 1.3;
	color: rgba(255, 255, 255, 0.85);
	margin-bottom: var(--cm-stack-sm);
}

.cm-book-cover-placeholder .cm-cover-sub {
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.45);
}

.cm-book-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: var(--cm-stack-md);
	flex: 1;
}

.cm-book-series {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cm-accent-dim);
}

.cm-book-title {
	font-family: var(--cm-font-headline);
	font-size: 1.5rem;
	font-weight: 500;
	line-height: 1.2;
	color: var(--cm-primary);
}

.cm-book-desc {
	font-size: 0.9375rem;
	line-height: 1.65;
	color: var(--cm-on-surface-variant);
	flex: 1;
}

.cm-book-desc p + p { margin-top: 12px; }
.cm-book-desc .cm-book-logline { font-weight: 600; color: var(--cm-on-surface); }

.cm-book-links {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: var(--cm-stack-sm);
}

/* ==========================================================================
   Callout
   ========================================================================== */

.cm-callout {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--cm-stack-md);
	margin-top: var(--cm-stack-lg);
	padding: 32px 36px;
	background-color: var(--cm-primary);
	color: var(--cm-on-primary);
	border-radius: var(--cm-radius);
}

.cm-callout-title { font-size: var(--cm-body-lg); font-weight: 600; line-height: 1.55; }
.cm-callout-text { font-size: 0.875rem; color: rgba(255, 255, 255, 0.7); margin-top: 6px; }

/* ==========================================================================
   Section colophon — a section's own closing attribution line.
   Kept light so it reads as the end of the section, not as a second site
   footer stacked on the real one.
   ========================================================================== */

.cm-section-colophon {
	background-color: var(--cm-surface-container-low);
	border-top: 1px solid var(--cm-outline-faint);
	text-align: center;
	padding-block: var(--cm-stack-md);
	font-size: var(--cm-label-sm);
	letter-spacing: 0.04em;
	color: var(--cm-on-surface-variant);
}

.cm-section-colophon a {
	color: var(--cm-primary);
	text-decoration: none;
	border-bottom: 1px solid var(--cm-outline-variant);
}

.cm-section-colophon a:hover {
	color: var(--cm-accent-dim);
	border-bottom-color: var(--cm-accent);
}

/* ==========================================================================
   Site footer
   ========================================================================== */

.cm-site-footer {
	background-color: var(--cm-primary);
	color: rgba(255, 255, 255, 0.5);
	text-align: center;
	padding-block: var(--cm-stack-md);
	font-size: var(--cm-label-sm);
}

.cm-site-footer a {
	color: var(--cm-accent);
	text-decoration: none;
}

.cm-site-footer a:hover { color: #ffffff; }

.cm-footer-sep { opacity: 0.4; margin-inline: 8px; }

.cm-footer-nav ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--cm-stack-md);
	list-style: none;
	margin: 0 0 var(--cm-stack-md);
	padding: 0;
}

.cm-footer-nav a {
	font-size: var(--cm-label-sm);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.7);
}

.cm-footer-nav a:hover { color: #ffffff; }

/* ==========================================================================
   Editorial / fallback content (posts, pages, 404, archives)
   ========================================================================== */

.cm-entry { max-width: var(--cm-measure); margin-inline: auto; }
.cm-entry + .cm-entry { margin-top: var(--cm-stack-lg); }

.cm-entry-title {
	font-family: var(--cm-font-headline);
	font-size: var(--cm-headline-md);
	font-weight: 500;
	line-height: 1.3;
	color: var(--cm-primary);
}

.cm-entry-title a { text-decoration: none; }
.cm-entry-title a:hover { color: var(--cm-accent-dim); }

.cm-entry-meta {
	font-size: var(--cm-label-sm);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cm-on-surface-variant);
	margin-top: var(--cm-stack-sm);
}

.cm-entry-content { font-size: var(--cm-body-lg); line-height: 1.7; margin-top: var(--cm-stack-md); }
.cm-entry-content > * + * { margin-top: var(--cm-stack-md); }
.cm-entry-content h2 { font-family: var(--cm-font-headline); font-size: var(--cm-headline-md); font-weight: 500; color: var(--cm-primary); }
.cm-entry-content h3 { font-family: var(--cm-font-headline); font-size: 1.5rem; font-weight: 500; color: var(--cm-primary); }
.cm-entry-content a { color: var(--cm-primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--cm-outline-variant); }
.cm-entry-content a:hover { text-decoration-color: var(--cm-accent); }
.cm-entry-content ul, .cm-entry-content ol { padding-left: 1.25em; }
.cm-entry-content li + li { margin-top: var(--cm-stack-sm); }
.cm-entry-content blockquote {
	font-family: var(--cm-font-headline);
	font-style: italic;
	padding-left: 20px;
	border-left: 3px solid var(--cm-accent);
	color: var(--cm-on-surface-variant);
}
.cm-entry-content img { border-radius: var(--cm-radius-lg); }

.cm-pagination { margin-top: var(--cm-stack-lg); text-align: center; font-size: var(--cm-label-sm); letter-spacing: 0.06em; }
.cm-pagination .page-numbers { display: inline-block; padding: 8px 12px; text-decoration: none; }
.cm-pagination .current { color: var(--cm-accent-dim); font-weight: 600; }

/* ==========================================================================
   Responsive
   Stitch supplied DESKTOP only. Every breakpoint below is a judgement call,
   guided by the design system's stated tablet (32px margins) and mobile
   (single column, 20px margins) intent.
   ========================================================================== */

/* Tablet — one column for reading pairs, 32px side margins. */
@media (max-width: 1024px) {
	:root { --cm-gutter: 32px; --cm-stack-xl: 80px; }

	.cm-about-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--cm-stack-lg);
	}

	.cm-about-bio { max-width: none; }
}

/* Narrow tablet — the 320px book card minimum would overflow below this. */
@media (max-width: 720px) {
	.cm-books-grid { grid-template-columns: minmax(0, 1fr); gap: var(--cm-stack-md); }
	.cm-book-cover { height: 280px; }
}

/* Mobile — 20px margins, stacked header, full-width actions. */
@media (max-width: 600px) {
	:root {
		--cm-gutter: var(--cm-margin-mobile);
		--cm-stack-xl: 64px;
		--cm-stack-lg: 40px;
	}

	.cm-site-header .cm-container {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.cm-site-nav ul { justify-content: flex-start; gap: 16px; }

	.cm-hero { text-align: left; }
	.cm-hero-inner { align-items: flex-start; }
	.cm-hero-tagline { margin-inline: 0; }
	.cm-hero-actions { justify-content: stretch; flex-direction: column; align-self: stretch; }
	.cm-hero-actions .cm-btn { text-align: center; }

	.cm-callout { flex-direction: column; align-items: flex-start; padding: var(--cm-stack-md); }
	.cm-callout .cm-btn { align-self: stretch; text-align: center; }

	.cm-book-links { gap: 8px; }
	.cm-book-links .cm-btn { flex: 1 1 auto; text-align: center; }

	.cm-book-cover { height: 240px; padding: 16px; }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
	.cm-site-header, .cm-site-nav, .cm-hero-actions, .cm-book-links, .skip-link { display: none !important; }
	body { background: #fff; color: #000; }
	.cm-hero, .cm-section--dark, .cm-callout, .cm-site-footer { background: #fff !important; color: #000 !important; }
}
