/* ==========================================================================
   Curious Monkey — custom.css
   theme.json owns color + type tokens. This file only handles the bits
   block supports can't express: the hand-drawn underline accent, hero
   layout rhythm, and the illustration frame.
   ========================================================================== */

/* --- Hand-drawn underline accent -----------------------------------------
   Apply the "cm-accent" class to a word/phrase inside a heading
   (select the text in the editor → Advanced → Additional CSS class(es)
   → cm-accent) to get the coral squiggle seen under "Bananas" / "Ideas".
*/
.cm-accent {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-style: wavy;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
	text-decoration-skip-ink: none;
}

/* Italic emphasis inside display headings, matching the reference. */
.wp-block-heading em,
h1 em,
h2 em {
	font-style: italic;
	font-weight: 400;
}

/* --- Hero section --------------------------------------------------------- */
.cm-hero {
	text-align: center;
	padding-block: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
}

.cm-hero h1 {
	font-size: clamp(2rem, 4.5vw, 3.5rem);
	max-width: 20ch;
	margin-inline: auto;
}

.cm-hero p {
	color: var(--wp--preset--color--ink-muted);
	max-width: 46ch;
	margin-inline: auto;
	font-size: 1.0625rem;
}

/* --- Signature illustration frame ------------------------------------------
   The hand-illustrated explorer-monkey banner. Rounded corners + a hairline
   border so the artwork reads as a deliberately placed "plate", not a
   stretched hero photo.
*/
.cm-illustration {
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--line);
}

.cm-illustration img {
	display: block;
	width: 100%;
	height: auto;
}

/* --- Header ----------------------------------------------------------------
   Simple wordmark left, single nav link right, hairline rule beneath —
   matches the reference exactly rather than a heavier default nav bar.
*/
.cm-site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-block: 1.25rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.cm-site-header .wp-block-site-title a {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	font-size: 1.25rem;
	text-decoration: none;
}

.cm-site-header nav a {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.9375rem;
	text-decoration: none;
	color: var(--wp--preset--color--ink-muted);
}

.cm-site-header nav a:hover {
	color: var(--wp--preset--color--ink);
}

/* --- Post cards (used on archive / blog index listing) --------------------- */
.cm-post-card {
	border-top: 1px solid var(--wp--preset--color--line);
	padding-block: 1.75rem;
}

.cm-post-card h2 a {
	font-family: var(--wp--preset--font-family--display);
	text-decoration: none;
}

.cm-post-card .cm-meta {
	color: var(--wp--preset--color--ink-muted);
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* --- Homepage card grid ----------------------------------------------------
   This is the actual content of the homepage now — no illustrated hero
   between the visitor and the latest posts, just the intro strip above it.
*/
.cm-card-grid {
	display: grid !important;
	grid-template-columns: repeat(3, 1fr);
	gap: 2rem 1.75rem;
}

@media (max-width: 782px) {
	.cm-card-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.cm-card-grid {
		grid-template-columns: 1fr;
	}
}

.cm-card {
	display: flex;
	flex-direction: column;
}

.cm-card .wp-block-post-featured-image {
	margin: 0 0 0.875rem;
}

.cm-card .wp-block-post-featured-image img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

/* Posts without a featured image still need the card to align in the grid. */
.cm-card:has(> :first-child:not(.wp-block-post-featured-image)) {
	padding-top: 0;
}

.cm-card-meta {
	align-items: center;
}

.cm-badge {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.cm-badge a {
	background: color-mix(in srgb, var(--wp--preset--color--accent) 35%, transparent);
	color: var(--wp--preset--color--ink);
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	text-decoration: none;
}

.cm-date {
	color: var(--wp--preset--color--ink-muted);
	font-size: 0.8125rem;
}

.cm-card h3 a {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.1875rem;
	line-height: 1.35;
	text-decoration: none;
}

.cm-card h3 a:hover {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
}

.cm-card-excerpt {
	color: var(--wp--preset--color--ink-muted);
	font-size: 0.9375rem;
	line-height: 1.55;
}

/* --- Recent posts carousel -------------------------------------------------
   A horizontally scrolling, slowly auto-advancing strip. carousel.js
   drives the auto-play/pause/buttons; this file only handles layout.
   No auto-play at all when prefers-reduced-motion is set (see carousel.js).
*/
.cm-carousel-controls {
	align-items: baseline;
	margin-bottom: 1rem;
}

.cm-carousel-controls h2 {
	margin: 0;
}

.cm-carousel-prev,
.cm-carousel-next {
	width: 36px;
	height: 36px;
	border-radius: 999px;
	border: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	margin-inline-start: 0.5rem;
}

.cm-carousel-prev:hover,
.cm-carousel-next:hover {
	border-color: var(--wp--preset--color--accent-deep);
}

.cm-carousel-track {
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.cm-carousel-track::-webkit-scrollbar {
	display: none;
}

.cm-carousel-track .wp-block-post-template {
	display: flex;
	gap: 1.75rem;
	list-style: none;
	margin: 0;
	padding: 0 0.25rem 0.5rem;
}

.cm-carousel-track .wp-block-post-template > li {
	flex: 0 0 280px;
	scroll-snap-align: start;
}

@media (max-width: 560px) {
	.cm-carousel-track .wp-block-post-template > li {
		flex-basis: 240px;
	}
}

/* --- Visitor light/dark toggle ---------------------------------------------
   Overrides the same CSS custom properties theme.json generates, scoped
   to html[data-cm-theme="dark"]. This is independent from the site
   owner's Style Variation choice (Appearance → Editor → Styles) — it
   only changes the palette, never the fonts or layout.
*/
html[data-cm-theme="dark"] {
	--wp--preset--color--background: #15140F;
	--wp--preset--color--surface: #201F19;
	--wp--preset--color--ink: #F3EFE6;
	--wp--preset--color--ink-muted: #A6A196;
	--wp--preset--color--accent: #E88C82;
	--wp--preset--color--accent-deep: #F2A69C;
	--wp--preset--color--line: #333026;
}

.cm-skin-toggle {
	width: 36px;
	height: 36px;
	border-radius: 999px;
	border: 1px solid var(--wp--preset--color--line);
	background: transparent;
	color: var(--wp--preset--color--ink);
	font-size: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex: none;
}

/* ==========================================================================
   Newspaper header — utility bar, ticker, wordmark row, nav
   ========================================================================== */

.cm-topbar {
	background: var(--wp--preset--color--ink);
	color: color-mix( in srgb, var(--wp--preset--color--background) 70%, transparent );
}

.cm-topbar-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.6rem clamp(1.25rem, 5vw, 3rem);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
}

.cm-topbar-tagline {
	font-style: italic;
	color: color-mix( in srgb, var(--wp--preset--color--background) 55%, transparent );
	display: none;
}

@media (min-width: 700px) {
	.cm-topbar-tagline {
		display: inline;
	}
}

.cm-topbar-social a {
	color: inherit;
	text-decoration: none;
	margin-inline-start: 0.6rem;
	opacity: 0.8;
}

.cm-topbar-social a:hover {
	opacity: 1;
}

.cm-ticker {
	background: color-mix( in srgb, var(--wp--preset--color--ink) 92%, var(--wp--preset--color--accent) );
	color: var(--wp--preset--color--background);
	border-bottom: 1px solid color-mix( in srgb, var(--wp--preset--color--ink) 70%, transparent );
}

.cm-ticker-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.55rem clamp(1.25rem, 5vw, 3rem);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
	overflow-x: auto;
	scrollbar-width: none;
}

.cm-ticker-row::-webkit-scrollbar {
	display: none;
}

.cm-ticker-label {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	flex: none;
	color: var(--wp--preset--color--accent);
}

.cm-ticker-dot {
	width: 6px;
	height: 6px;
	border-radius: 999px;
	background: var(--wp--preset--color--accent);
	display: inline-block;
}

.cm-ticker-items {
	white-space: nowrap;
}

.cm-ticker-items a {
	color: inherit;
	text-decoration: none;
}

.cm-ticker-items a:hover {
	text-decoration: underline;
}

.cm-ticker-sep {
	margin-inline: 0.6rem;
	opacity: 0.5;
}

.cm-main-header {
	padding: 1.5rem clamp(1.25rem, 5vw, 3rem);
	gap: 1rem;
}

.cm-search {
	color: var(--wp--preset--color--ink);
	display: inline-flex;
	flex: none;
}

.cm-wordmark.wp-block-site-title a {
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-weight: 600;
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	letter-spacing: 0.01em;
	text-decoration: none;
	text-align: center;
}

.cm-header-actions {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	flex: none;
}

.cm-subscribe {
	background: var(--wp--preset--color--accent-deep);
	color: #fff;
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
	font-size: 0.875rem;
	padding: 0.55rem 1.1rem;
	border-radius: 999px;
	text-decoration: none;
	white-space: nowrap;
}

.cm-subscribe:hover {
	opacity: 0.9;
}

.cm-nav-row {
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
	padding: 0.75rem clamp(1.25rem, 5vw, 3rem);
}

.cm-nav-row .wp-block-navigation-item a {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-decoration: none;
	color: var(--wp--preset--color--ink);
}

/* ==========================================================================
   Homepage magazine layout — category list / feature / latest list
   ========================================================================== */

.cm-magazine {
	display: grid;
	grid-template-columns: 1fr 2fr 1fr;
	gap: clamp(1.5rem, 4vw, 3rem);
	padding-block: clamp(2rem, 5vw, 3.5rem);
	align-items: start;
}

@media (max-width: 900px) {
	.cm-magazine {
		grid-template-columns: 1fr;
	}
	.cm-magazine-feature {
		order: -1;
	}
}

.cm-col-heading {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--wp--preset--color--ink-muted);
	margin: 0 0 1.25rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.cm-side-item {
	padding-block: 1.1rem;
	border-top: 1px solid var(--wp--preset--color--line);
}

.cm-side-item:first-of-type {
	border-top: none;
	padding-top: 0;
}

.cm-side-item h3 {
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-size: 1.0625rem;
	line-height: 1.35;
	margin: 0.3rem 0 0.35rem;
}

.cm-side-item h3 a {
	text-decoration: none;
	color: var(--wp--preset--color--ink);
}

.cm-side-item h3 a:hover {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
}

.cm-empty {
	color: var(--wp--preset--color--ink-muted);
	font-size: 0.9375rem;
}

.cm-magazine-feature {
	text-align: center;
}

.cm-feature-frame {
	display: block;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--line);
	margin-bottom: 1.25rem;
}

.cm-feature-frame img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.cm-feature-badge {
	display: inline-block;
	margin-bottom: 0.5rem;
}

.cm-feature-title {
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-size: clamp(1.5rem, 3.4vw, 2.25rem);
	line-height: 1.25;
	margin: 0 0 0.85rem;
}

.cm-feature-title a {
	text-decoration: none;
	color: var(--wp--preset--color--ink);
}

.cm-feature-excerpt {
	color: var(--wp--preset--color--ink-muted);
	font-size: 1rem;
	max-width: 42ch;
	margin: 0 auto 1rem;
}

.cm-feature-byline {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
	color: var(--wp--preset--color--ink-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* --- Reduced motion --------------------------------------------------------
   Nothing animates by default in this theme (kept deliberately quiet
   per the reference), but this is here in case hover transitions are
   added later.
*/
@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
		animation: none !important;
	}

	.cm-carousel-track {
		scroll-behavior: auto;
	}
}
