/*
Theme Name: Candlelit
Description: A dark, reading-first block theme for Magic Emily.
Author: Emily
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 7.4
Text Domain: candlelit
License: GNU General Public License v2 or later
WPVibe: yes
Update URI: false
*/

:root { color-scheme: dark; }

::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

a { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Header and navigation: comfortable tap targets */
.candlelit-nav .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}
.candlelit-nav .current-menu-item > .wp-block-navigation-item__content,
.candlelit-nav .wp-block-navigation-item__content[aria-current] {
	color: var(--wp--preset--color--contrast);
}

/* Front page */
.candlelit-hero .candlelit-flame { display: block; margin: 0 auto; }

/* Emily's artwork behind the header and headline (decorative) */
.candlelit-art-top {
	background-color: #151515;
	background-image:
		linear-gradient(180deg, rgba(21, 21, 21, 0.35) 0%, rgba(21, 21, 21, 0.55) 55%, var(--wp--preset--color--base) 100%),
		url("/wp-content/uploads/2026/10/magic-emily-cosmic-800.webp");
	background-size: cover;
	background-position: center top;
	background-repeat: no-repeat;
}
@media (min-width: 801px) {
	.candlelit-art-top {
		background-image:
			linear-gradient(180deg, rgba(21, 21, 21, 0.35) 0%, rgba(21, 21, 21, 0.55) 55%, var(--wp--preset--color--base) 100%),
			url("/wp-content/uploads/2026/10/magic-emily-cosmic-1600.webp");
	}
}
/* Solid dark band behind the header so the menu stays readable over the art */
.candlelit-art-top > header > .wp-block-group {
	background: rgba(26, 23, 20, 0.94);
	border-bottom-color: var(--wp--preset--color--border) !important;
}
.candlelit-art-top .candlelit-nav .wp-block-navigation-item__content { color: var(--wp--preset--color--contrast); }
.candlelit-art-top .candlelit-nav .wp-block-navigation-item__content:hover { color: var(--wp--preset--color--accent-2); }
.candlelit-art-top .candlelit-hero {
	background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(21, 21, 21, 0.82) 0%, rgba(21, 21, 21, 0.55) 60%, rgba(21, 21, 21, 0) 100%);
	text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
@media (max-width: 600px) {
	.candlelit-art-top .candlelit-hero {
		background: radial-gradient(ellipse 90% 60% at 50% 50%, rgba(21, 21, 21, 0.85) 0%, rgba(21, 21, 21, 0.6) 65%, rgba(21, 21, 21, 0.2) 100%);
	}
}
.candlelit-front-main > .wp-block-query.alignwide:first-child {
	position: relative;
	margin-top: -2.5rem;
}
.candlelit-feature .wp-block-post-title a,
.candlelit-essay-item .wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}
.candlelit-feature .wp-block-post-title a:hover,
.candlelit-essay-item .wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent-2);
}
.candlelit-feature .wp-block-post-excerpt__more-text { display: none; }
.candlelit-read-more {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-weight: 600;
	text-decoration: underline;
}
.candlelit-rule-heading {
	display: flex;
	align-items: center;
	gap: 1rem;
}
.candlelit-rule-heading::before,
.candlelit-rule-heading::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--wp--preset--color--border);
}

/* Essay list (archives, search) */
.candlelit-essay-list { list-style: none; padding: 0; }
.candlelit-essay-item .wp-block-post-excerpt__more-text { display: none; }
.candlelit-essay-item .wp-block-post-excerpt__excerpt { margin: 0; }

/* Single essay */
.candlelit-article-header .wp-block-post-terms { text-align: center; }
.candlelit-byline .wp-block-post-author-name { color: var(--wp--preset--color--contrast); }
.candlelit-byline > * + *::before {
	content: "·";
	margin-right: 0.75rem;
	color: var(--wp--preset--color--muted);
}

.candlelit-prose > * + h2 { margin-top: 3rem; }
.candlelit-prose > * + h3 { margin-top: 2.25rem; }
.candlelit-prose h2, .candlelit-prose h3 { scroll-margin-top: 1.5rem; }
.candlelit-prose strong { color: var(--wp--preset--color--contrast); }
.candlelit-prose :where(ul, ol) { padding-left: 1.5rem; }
.candlelit-prose li + li { margin-top: 0.6rem; }
.candlelit-prose li::marker { color: var(--wp--preset--color--accent); }
.candlelit-prose hr { margin-block: 3rem; }
.candlelit-prose img { height: auto; border-radius: 4px; }
.candlelit-prose figure { max-width: 100%; }
.candlelit-prose svg { max-width: 100%; height: auto; }
.candlelit-prose table { display: block; overflow-x: auto; }

/* Candle marker: "start reading here", above the first paragraph of every essay (decorative only) */
.single-post .candlelit-prose > p:first-of-type::before {
	content: "";
	display: block;
	height: 30px;
	margin-bottom: 1.75rem;
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 40'%3E%3Cpath d='M14 2c4 6 6 10 6 14a6 6 0 0 1-12 0c0-4 2-8 6-14z' fill='%23D9925B'/%3E%3Crect x='11' y='24' width='6' height='14' rx='1' fill='%23B8AC97' fill-opacity='0.5'/%3E%3C/svg%3E") center / 21px 30px no-repeat,
		linear-gradient(var(--wp--preset--color--border), var(--wp--preset--color--border)) left center / calc(50% - 2rem) 1px no-repeat,
		linear-gradient(var(--wp--preset--color--border), var(--wp--preset--color--border)) right center / calc(50% - 2rem) 1px no-repeat;
}

/* "In this essay" contents box (added automatically to longer essays) */
/* Collapsed by default: readers go straight into the essay and open it only if they need it. */
.candlelit-toc {
	margin-block: 0 2.5rem;
	padding: 0.75rem 1.5rem;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 6px;
}
.candlelit-toc summary {
	cursor: pointer;
	list-style: none;
	min-height: 44px;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-size: 1.125rem;
	color: var(--wp--preset--color--muted);
}
.candlelit-toc summary::-webkit-details-marker { display: none; }
.candlelit-toc summary::before {
	content: "";
	width: 0.45rem;
	height: 0.45rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.2s ease;
	flex: none;
}
.candlelit-toc[open] summary::before { transform: rotate(45deg); }
.candlelit-toc summary:hover { color: var(--wp--preset--color--contrast); }
.candlelit-toc[open] { padding-bottom: 1.25rem; }
.candlelit-toc summary::before { order: 0; }
.candlelit-toc ol { margin: 0.25rem 0 0; padding-left: 1.4rem; font-size: 1.0625rem; line-height: 1.8; }
.candlelit-toc li + li { margin-top: 0.15rem; }
.candlelit-toc a { color: var(--wp--preset--color--contrast); text-decoration-color: var(--wp--preset--color--border); }
.candlelit-toc a:hover { color: var(--wp--preset--color--accent-2); }

/* Sources section at the end of an essay */
.candlelit-prose .candlelit-sources-heading {
	margin-top: 3.5rem;
	padding-top: 2rem;
	border-top: 1px solid var(--wp--preset--color--border);
	font-weight: 400;
	font-style: italic;
	font-size: 1.5rem;
	color: var(--wp--preset--color--muted);
}
.candlelit-prose .candlelit-sources-heading + :where(ul, ol) {
	font-size: 1rem;
	line-height: 1.6;
	color: var(--wp--preset--color--muted);
	overflow-wrap: anywhere;
}
.candlelit-prose .candlelit-sources-heading + :where(ul, ol) li + li { margin-top: 0.4rem; }

/* Callout box: Group block → Styles → Callout */
.wp-block-group.is-style-callout {
	padding: 1.75rem;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 6px;
}
.wp-block-group.is-style-callout > :where(h2, h3, h4):first-child {
	margin-top: 0;
	color: var(--wp--preset--color--sage);
}

/* Previous / next essay */
.candlelit-pager {
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 6px;
	font-size: 0.9375rem;
	color: var(--wp--preset--color--muted);
}
.candlelit-pager a {
	display: block;
	margin-top: 0.25rem;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}
.candlelit-pager a:hover { color: var(--wp--preset--color--accent-2); }

/* Footer easter egg: tap the little candle */
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.candlelit-egg {
	display: inline-flex;
	align-items: center;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.candlelit-egg summary {
	list-style: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	color: #8A6A4F;
	transition: color 0.3s ease;
}
.candlelit-egg summary::-webkit-details-marker { display: none; }
.candlelit-egg summary:hover,
.candlelit-egg summary:focus-visible,
.candlelit-egg[open] summary { color: var(--wp--preset--color--accent); }
.candlelit-egg[open] summary svg { filter: drop-shadow(0 0 4px rgba(217, 146, 91, 0.6)); }
.candlelit-egg__credit { font-style: italic; }
@media (prefers-reduced-motion: no-preference) {
	.candlelit-egg[open] .candlelit-egg__credit { animation: candlelit-fade 0.6s ease both; }
	.candlelit-egg summary:hover .candlelit-egg__flame { animation: candlelit-flicker 1.2s ease-in-out infinite; transform-origin: 50% 90%; transform-box: fill-box; }
}
@keyframes candlelit-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes candlelit-flicker {
	0%, 100% { transform: scale(1, 1); }
	40% { transform: scale(0.94, 1.06); }
	70% { transform: scale(1.04, 0.97); }
}

/* Search form */
.wp-block-search__input {
	min-height: 48px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	border: 1px solid #4A4238;
	border-radius: 4px;
	padding-inline: 1rem;
	font: inherit;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto !important; }
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

/* Recipe card (used by the "Recipe Card" pattern) */
.recipe-card {
	background: #2b2420;
	border: 1.5px solid #e8a87c;
	border-radius: 18px;
	padding: clamp(20px, 4vw, 32px);
	margin-block: 2rem;
}
.recipe-card,
.recipe-card p,
.recipe-card li { color: #efe6da !important; }
.recipe-card h3,
.recipe-card strong { color: #f6c9a4 !important; }
.recipe-card h3 {
	font-size: 1.25rem;
	font-weight: 600;
	margin: 1.75rem 0 0.75rem;
}
.recipe-card > *:first-child { margin-top: 0; }
.recipe-card .recipe-pills,
.recipe-card .recipe-chips {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.recipe-card .recipe-pills li {
	border: 1px solid #e8a87c;
	color: #f6c9a4 !important;
	border-radius: 999px;
	padding: 4px 14px;
	font-size: 0.9rem;
	margin: 0;
}
.recipe-card .recipe-chips li {
	background: #3a2f29;
	border-radius: 999px;
	padding: 5px 14px;
	font-size: 0.9rem;
	margin: 0;
}
.recipe-card .recipe-ingredients {
	list-style: none;
	padding: 0;
	margin: 0;
}
.recipe-card .recipe-ingredients li {
	padding: 9px 0;
	margin: 0;
	border-bottom: 1px dashed #4a3d35;
}
.recipe-card .recipe-ingredients li strong {
	display: inline-block;
	min-width: 8.5em;
	margin-left: 0.4em;
}
.recipe-card .recipe-steps {
	list-style: none;
	padding: 0;
	margin: 0;
	counter-reset: recipe-step;
}
.recipe-card .recipe-steps li {
	counter-increment: recipe-step;
	position: relative;
	padding-left: 46px;
	margin: 0 0 16px;
	line-height: 1.6;
}
.recipe-card .recipe-steps li::before {
	content: counter(recipe-step);
	position: absolute;
	left: 0;
	top: 0.15em;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #e8a87c;
	color: #2b2420;
	font-weight: 600;
	font-size: 0.9rem;
	display: flex;
	align-items: center;
	justify-content: center;
}
.recipe-card .recipe-tip {
	border: 1.5px dashed #e8a87c;
	border-radius: 12px;
	padding: 14px 18px;
	margin-top: 1.5rem;
}
@media (max-width: 480px) {
	.recipe-card .recipe-ingredients li strong { min-width: 0; }
}
