/*
Theme Name: Josif Pavlov
Theme URI: https://josifpavlov.com
Author: Josif Pavlov
Description: A minimalist, reading-first block theme for josifpavlov.com — a light, restrained journal site. Near-white background, a single pine-teal accent used sparingly, self-hosted serif typography, no third-party requests.
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 8.0
Version: 0.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: josif-pavlov
*/

/* Match the home page mockup's box model: padding and border count toward
   width instead of adding to it. Without this, any `width: 100%` element
   with padding (the mobile hero/garden/intro overrides in home.css, for
   example) overflows its container by the padding amount. */
*, *::before, *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ *
 *  Self-hosted fonts. No Google Fonts, no external calls.
 *  Young Serif  — headings (single weight 400)
 *  Source Serif 4 — body (variable weight 200–900, roman + italic)
 * ------------------------------------------------------------------ */

@font-face {
	font-family: "Young Serif";
	src: url("./assets/fonts/young-serif-latin.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Young Serif";
	src: url("./assets/fonts/young-serif-latin-ext.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02AF, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Source Serif 4";
	src: url("./assets/fonts/source-serif-4-latin.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Source Serif 4";
	src: url("./assets/fonts/source-serif-4-latin-ext.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02AF, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Source Serif 4";
	src: url("./assets/fonts/source-serif-4-latin-italic.woff2") format("woff2");
	font-weight: 200 900;
	font-style: italic;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Source Serif 4";
	src: url("./assets/fonts/source-serif-4-latin-ext-italic.woff2") format("woff2");
	font-weight: 200 900;
	font-style: italic;
	font-display: swap;
	unicode-range: U+0100-02AF, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Caveat — handwriting style, used only for the small hand-sketched note by
   the "Creative Brainstorming" CTA on the home page. Latin subset only: it's
   a three-word English decoration, not body content needing full coverage. */
@font-face {
	font-family: "Caveat";
	src: url("./assets/fonts/caveat-latin.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

/* ------------------------------------------------------------------ *
 *  Front-end polish. Structure, spacing and the base palette live in
 *  theme.json; this file only adds what theme.json can't express:
 *  @font-face (above), :hover / :focus states, and dark mode.
 * ------------------------------------------------------------------ */

/* No automatic dark mode: the site has one fixed light design (matching the
   home page video mockup), regardless of the visitor's OS/browser theme. */

/* Links — green, with a restrained underline that thickens on hover.
   :where() keeps specificity at 0 so per-block overrides still win. */
:where(a:not(.wp-element-button)) {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: text-decoration-thickness 90ms ease, text-decoration-color 90ms ease;
}
:where(a:not(.wp-element-button)):hover {
	text-decoration-thickness: 3px;
}

/* Visible keyboard focus everywhere */
:where(a, button, input, textarea, select, .wp-block-button__link):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
	border-radius: 1px;
}

/* Text selection in a soft green wash */
::selection {
	background-color: color-mix(in srgb, var(--wp--preset--color--primary) 22%, transparent);
}

/* Headings: even, no orphans. Body: no ragged single words. */
h1, h2, h3,
.wp-block-post-title,
.wp-block-heading {
	text-wrap: balance;
}
.wp-block-post-content p,
.entry-content p {
	text-wrap: pretty;
}

/* Quotes and pull quotes — walnut, italic, a hairline spine */
.wp-block-quote {
	border-left: 2px solid var(--wp--preset--color--secondary);
	padding-left: 1.25em;
	font-style: italic;
	color: var(--wp--preset--color--secondary);
}
.wp-block-quote cite {
	font-style: normal;
	color: var(--wp--preset--color--muted);
}
.wp-block-pullquote {
	border: none;
	border-top: 1px solid var(--wp--preset--color--hairline);
	border-bottom: 1px solid var(--wp--preset--color--hairline);
	font-style: italic;
	color: var(--wp--preset--color--secondary);
}

/* Captions — small, muted */
figcaption,
.wp-element-caption {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--x-small);
	font-style: italic;
}

/* Site header — name left, nav centre, room reserved for search/newsletter
   right (added later). Matches the home page mockup exactly. */
.jp-site-header {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	padding: 0.85rem clamp(1rem, 4vw, 2rem);
	background: var(--wp--preset--color--base);
	border-bottom: 1px solid var(--wp--preset--color--hairline);
}
.jp-brand {
	justify-self: start;
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
}
.jp-brand img { height: 1.9rem; width: auto; display: block; }
.jp-brand span {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.15rem;
	letter-spacing: -0.005em;
}
.jp-site-nav {
	justify-self: center;
	display: flex;
	flex-wrap: wrap;
	gap: clamp(0.85rem, 2.2vw, 1.9rem);
}
/* Invisible to layout outside the mobile breakpoint below — the wrapper
   only matters for the grid-rows collapse animation on narrow screens. */
.jp-site-nav-inner {
	display: contents;
}
.jp-site-nav a {
	display: inline-block;
	padding: 0.5rem 0.15rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.98rem;
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
}
.jp-header-actions {
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 0.6rem;
}
.jp-nav-toggle {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}
.jp-nav-toggle-line {
	display: block;
	width: 1.35rem;
	height: 2px;
	background: var(--wp--preset--color--contrast);
	transition: transform 0.2s ease, opacity 0.2s ease;
}
.jp-nav-toggle[aria-expanded="true"] .jp-nav-toggle-line:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.jp-nav-toggle[aria-expanded="true"] .jp-nav-toggle-line:nth-child(2) {
	opacity: 0;
}
.jp-nav-toggle[aria-expanded="true"] .jp-nav-toggle-line:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}
.jp-header-search {
	display: flex;
	align-items: center;
	gap: 0.3rem;
}
.jp-header-search input {
	font: inherit;
	font-size: 0.9rem;
	padding: 0.3rem 0.55rem;
	width: 8.5rem;
	border: 1px solid var(--wp--preset--color--hairline);
	border-radius: 4px;
	background: #fff;
	color: var(--wp--preset--color--contrast);
}
.jp-header-search button {
	display: inline-flex;
	padding: 0.25rem;
	border: 0;
	background: none;
	color: var(--wp--preset--color--muted);
	cursor: pointer;
}
.jp-newsletter-btn {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.9rem;
	padding: 0.42rem 0.85rem;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	text-decoration: none;
	border-radius: 4px;
	white-space: nowrap;
}

@media (max-width: 780px) {
	.jp-site-header {
		grid-template-columns: 1fr auto;
		row-gap: 0;
	}
	.jp-nav-toggle {
		display: flex;
	}
	.jp-site-nav {
		grid-column: 1 / -1;
		justify-self: stretch;
		display: grid;
		grid-template-rows: 0fr;
		transition: grid-template-rows 0.25s ease;
	}
	.jp-site-nav.is-open {
		grid-template-rows: 1fr;
	}
	/* The grid-rows trick needs a single sizeable grid item; this wrapper
	   is that item (min-height: 0 lets it shrink below its content size,
	   overflow: hidden clips it while the track is 0fr). Stacks the links
	   in a column instead of the desktop flex row. */
	.jp-site-nav-inner {
		display: flex;
		flex-direction: column;
		overflow: hidden;
		min-height: 0;
	}
	.jp-site-nav.is-open .jp-site-nav-inner {
		padding: 0.6rem 0 0.4rem;
	}
	.jp-site-nav a {
		display: block;
		padding: 0.85rem 0.25rem;
		text-align: center;
		border-top: 1px solid var(--wp--preset--color--hairline);
	}
	.jp-header-search input { display: none; }
}

/* Nav: current page marked with a subtle underline, not a colour shift */
.jp-site-nav a[aria-current="page"] {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
}

/* Post-meta line under essay titles */
.essay-meta {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}
.essay-meta a { color: inherit; }

/* Give list markers the muted tone so prose stays calm */
.wp-block-post-content :where(ul, ol) { padding-left: 1.3em; }
.wp-block-post-content :where(ul, ol)::marker,
.wp-block-post-content li::marker { color: var(--wp--preset--color--muted); }

/* Unmarked list — used by the "Start here" pattern */
.wp-block-list.is-style-none {
	list-style: none;
	padding-left: 0;
}
.wp-block-list.is-style-none > li {
	margin-bottom: 0.4em;
}

/* Prev / next essay navigation */
.wp-block-post-navigation-link {
	color: var(--wp--preset--color--muted);
}
.wp-block-post-navigation-link .post-navigation-link__label {
	display: block;
	font-size: var(--wp--preset--font-size--x-small);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* Search field — match the earthy palette */
.wp-block-search__input {
	border: 1px solid var(--wp--preset--color--hairline);
	background: color-mix(in srgb, var(--wp--preset--color--base) 100%, var(--wp--preset--color--secondary) 4%);
	color: var(--wp--preset--color--contrast);
	border-radius: 3px;
	padding: 0.6em 0.8em;
}
.wp-block-search__button {
	border-radius: 3px;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
