/*
Theme Name: Stillness
Theme URI: https://talkingtosource.com
Author: Talking To Source
Description: A quiet, spacious block theme for writing on non-duality, awareness and self-inquiry. Warm paper tones, generous silence, a hand-brushed ensō motif, a mobile-first layout with a sidebar, and "Dusk" and "Sage" style variations.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: stillness
Tags: blog, one-column, two-columns, right-sidebar, block-patterns, full-site-editing, style-variations, custom-colors, wide-blocks
*/

/* Fonts: Cormorant Garamond & Jost, SIL Open Font License 1.1 (see assets/fonts/OFL.txt) */

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--wp--preset--color--accent-soft); color: var(--wp--preset--color--contrast); }

a { text-underline-offset: 0.22em; text-decoration-thickness: 1px; transition: color var(--wp--custom--transition); }
:where(.wp-element-button, .wp-block-button__link) { transition: background-color var(--wp--custom--transition), color var(--wp--custom--transition); }
:focus-visible { outline: 1px solid var(--wp--preset--color--accent); outline-offset: 4px; }

/* ---------- Ensō motif ---------- */
.stillness-enso {
	display: block;
	aspect-ratio: 1;
	color: var(--wp--preset--color--accent);
	background: currentColor;
	-webkit-mask: url("assets/images/enso.svg") center / contain no-repeat;
	        mask: url("assets/images/enso.svg") center / contain no-repeat;
}
.stillness-mark { width: 30px; flex: 0 0 30px; opacity: .9; }

/* Hero */
.stillness-hero { position: relative; overflow: hidden; isolation: isolate; }
.stillness-hero > .stillness-enso {
	position: absolute;
	z-index: -1;
	top: 50%; left: 50%;
	width: min(78vw, 640px);
	opacity: .16;
	transform: translate(-50%, -50%) rotate(0deg);
	animation: stillness-breathe 14s ease-in-out infinite;
}
@keyframes stillness-breathe {
	0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: .13; }
	50%      { transform: translate(-50%, -50%) scale(1.045) rotate(4deg); opacity: .2; }
}
.stillness-hero .wp-block-buttons { margin-top: var(--wp--preset--spacing--40); }

.stillness-eyebrow {
	font-family: var(--wp--preset--font-family--body);
	font-size: .72rem !important;
	letter-spacing: .32em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

/* A single quiet dot used as a divider */
.stillness-dot {
	width: 5px; height: 5px; margin-inline: auto !important;
	border-radius: 50%;
	background: var(--wp--preset--color--accent);
	opacity: .8;
}

/* ---------- Header ---------- */
/* Note: no backdrop-filter/transform/filter on the header — those would trap
   the fixed-position mobile menu overlay inside the header's box. */
.stillness-header { position: relative; z-index: 20; }
.stillness-header .wp-block-site-title { line-height: 1.2; }
.stillness-header .wp-block-navigation a:hover { color: var(--wp--preset--color--accent); }

/* Hamburger + close buttons */
.stillness-header .wp-block-navigation__responsive-container-open,
.stillness-header .wp-block-navigation__responsive-container-close {
	color: var(--wp--preset--color--contrast);
	padding: 10px;
	margin: -10px;
	border-radius: 999px;
}
.stillness-header .wp-block-navigation__responsive-container-open svg,
.stillness-header .wp-block-navigation__responsive-container-close svg { width: 28px; height: 28px; }

/* Full-screen mobile overlay */
.stillness-header .wp-block-navigation__responsive-container.is-menu-open {
	position: fixed;
	inset: 0;
	z-index: 100000;
	box-sizing: border-box;
	width: auto;
	height: auto;
	max-width: 100vw;
	overflow-x: hidden;
	overflow-y: auto;
	background: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--contrast) !important;
	padding: calc(var(--wp--preset--spacing--30) + 4px) var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
}
.stillness-header .wp-block-navigation__responsive-container.is-menu-open::before {
	content: "";
	position: absolute;
	right: -18vw; bottom: -12vw;
	width: 90vw; aspect-ratio: 1;
	background: var(--wp--preset--color--accent);
	-webkit-mask: url("assets/images/enso.svg") center / contain no-repeat;
	        mask: url("assets/images/enso.svg") center / contain no-repeat;
	opacity: .08;
	pointer-events: none;
}
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--preset--spacing--50);
	align-items: center;
	justify-content: center;
	min-height: 70%;
}
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list {
	flex-direction: column;
	align-items: center !important;
	justify-content: center;
	gap: 1.4rem;
	text-align: center;
}
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-pages-list__item {
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.8rem, 8vw, 2.4rem);
	font-weight: 300;
	letter-spacing: 0;
	text-transform: none;
	line-height: 1.2;
	justify-content: center;
	max-width: 100%;
	white-space: normal;
	overflow-wrap: anywhere;
}
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content { padding: .2em 0; text-align: center; }
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list { width: 100%; }
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close { top: 0; right: 0; z-index: 2; }
.stillness-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	padding: .6rem 0 0 !important;
	font-size: 1.2rem;
	align-items: center;
}
.stillness-header .wp-block-navigation__responsive-dialog { position: relative; z-index: 1; box-sizing: border-box; width: 100%; max-width: 100%; }

/* Keep the open menu from scrolling the page behind it */
html.has-modal-open { overflow: hidden; }

/* ---------- Layout with sidebar (mobile first) ---------- */
/* Phones: one column, the sidebar drops below the content.
   Wide screens (62em+): content left, sticky sidebar right. */
.stillness-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--50);
}
.stillness-layout > * { margin-block: 0 !important; min-width: 0; }
.stillness-layout .stillness-dot { margin-inline: 0 !important; }
.stillness-main { overflow-x: clip; }

.stillness-sidebar {
	padding-top: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--wp--preset--color--mist);
	font-size: 1rem;
	line-height: 1.6;
}
.stillness-widget > * + * { margin-block-start: .9rem; }
.stillness-widget .stillness-eyebrow { margin-block-end: .2rem; }
body.search .stillness-widget--search { display: none; }

.stillness-about-text {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.35rem;
	line-height: 1.4;
	font-style: italic;
}
.stillness-more { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.stillness-more a { text-decoration: none; }
.stillness-more a:hover { text-decoration: underline; }

/* Compact "latest writings" rows */
.stillness-mini-list .wp-block-post-template { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.stillness-mini-list .wp-block-post { margin: 0; border-top: 1px solid var(--wp--preset--color--mist); padding-block: 1rem; }
.stillness-mini-list .wp-block-post:first-child { border-top: 0; padding-top: .2rem; }
.stillness-mini { align-items: flex-start; }
.stillness-mini .wp-block-post-featured-image { flex: 0 0 76px; width: 76px; margin: 0; }
.stillness-mini .wp-block-post-featured-image img { width: 76px; height: 76px; object-fit: cover; border-radius: 2px; }
.stillness-mini .wp-block-post-date { font-size: .7rem; }
.stillness-mini .wp-block-post-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.2rem;
	line-height: 1.25;
	font-weight: 400;
	overflow-wrap: anywhere;
}
.stillness-mini .wp-block-post-title a { text-decoration: none; transition: color var(--wp--custom--transition); }
.stillness-mini .wp-block-post-title a:hover { color: var(--wp--preset--color--accent); }

/* Topics (categories) */
.stillness-topics { list-style: none; margin: 0; padding: 0; }
.stillness-topics li { border-top: 1px solid var(--wp--preset--color--mist); margin: 0; }
.stillness-topics li:last-child { border-bottom: 1px solid var(--wp--preset--color--mist); }
.stillness-topics a { display: inline-block; padding: .7rem 0; text-decoration: none; }
.stillness-topics a:hover { color: var(--wp--preset--color--accent); }

/* Themes (tag cloud) as quiet chips */
.wp-block-tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.wp-block-tag-cloud a {
	font-size: .8rem !important;
	padding: .4em .9em;
	border: 1px solid var(--wp--preset--color--mist);
	border-radius: 999px;
	text-decoration: none;
	line-height: 1.2;
	transition: color var(--wp--custom--transition), border-color var(--wp--custom--transition);
}
.wp-block-tag-cloud a:hover { color: var(--wp--preset--color--accent); border-color: var(--wp--preset--color--accent); }

/* Previous / next */
.stillness-postnav { gap: 1.5rem; }
.stillness-postnav > * { flex: 1 1 14rem; min-width: 0; }
.stillness-postnav .post-navigation-link-next { text-align: right; }
.stillness-postnav a { text-decoration: none; }

/* Long titles and chapter links never push the page sideways on a phone */
.stillness-primary { min-width: 0; }
.stillness-primary .wp-block-post-title,
.stillness-primary .wp-block-post-content { overflow-wrap: break-word; }
.stillness-primary .wp-block-embed { margin-inline: 0; }
.stillness-primary .wp-block-embed iframe { max-width: 100%; }

@media (min-width: 62em) {
	.stillness-layout {
		grid-template-columns: minmax(0, 1fr) 19rem;
		gap: clamp(3rem, 5vw, 5rem);
		align-items: start;
	}
	.stillness-sidebar {
		position: sticky;
		top: 2rem;
		padding: 0 0 0 2.25rem;
		border-top: 0;
		border-left: 1px solid var(--wp--preset--color--mist);
	}
	.admin-bar .stillness-sidebar { top: calc(2rem + 32px); }
}

/* ---------- Writing list ---------- */
.stillness-list .wp-block-post { border-top: 1px solid var(--wp--preset--color--mist); padding-block: var(--wp--preset--spacing--40); }
.stillness-list .wp-block-post:last-child { border-bottom: 1px solid var(--wp--preset--color--mist); }
.stillness-list .wp-block-post-title a { transition: color var(--wp--custom--transition); }
.stillness-list .wp-block-post:hover .wp-block-post-title a { color: var(--wp--preset--color--accent); }
.stillness-list .wp-block-post-excerpt__more-link { font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; }

/* ---------- Single article ---------- */
.wp-block-post-content blockquote.wp-block-quote { text-align: center; margin-block: var(--wp--preset--spacing--50); }
.wp-block-post-content blockquote.wp-block-quote::before {
	content: ""; display: block; width: 36px; height: 36px; margin: 0 auto 1.2rem;
	background: var(--wp--preset--color--accent);
	-webkit-mask: url("assets/images/enso.svg") center / contain no-repeat;
	        mask: url("assets/images/enso.svg") center / contain no-repeat;
	opacity: .8;
}
hr.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { width: 64px; margin-inline: auto; }
.wp-block-separator.is-style-dots::before { color: var(--wp--preset--color--accent); letter-spacing: 1.4em; }

/* Classic-editor content (the site uses Classic Editor) */
.wp-block-post-content > blockquote:not(.wp-block-quote) {
	font-family: var(--wp--preset--font-family--display);
	font-style: italic; font-size: var(--wp--preset--font-size--large);
	line-height: 1.45; text-align: center; border: 0; margin-block: var(--wp--preset--spacing--50);
}
.wp-block-post-content img.aligncenter { display: block; margin-inline: auto; }

/* ---------- Footer ---------- */
.stillness-footer-mark { width: 54px; margin-inline: auto !important; opacity: .75; }
.stillness-footer .wp-block-separator { border-top: 1px solid var(--wp--preset--color--mist); background: none; opacity: 1; }
.stillness-footer a { text-decoration: none; }
.stillness-footer a:hover { text-decoration: underline; }

/* Search field */
.wp-block-search__input { border: 1px solid var(--wp--preset--color--mist); background: transparent; border-radius: 999px; padding: .7em 1.2em; color: inherit; }
.wp-block-search__button { margin-left: .5rem; }

/* ---------- Gentle reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
	.stillness-fade { animation: stillness-fade 1.6s cubic-bezier(.22,.61,.36,1) both; }
	.stillness-fade-2 { animation-delay: .35s; }
	.stillness-fade-3 { animation-delay: .7s; }
	@keyframes stillness-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.stillness-hero > .stillness-enso { animation: none; }
}
