/*
Theme Name: Kaleta
Theme URI: https://kaletakris.com
Author: Kris Kaleta
Author URI: https://kaletakris.com
Description: A minimal block theme in dark and light. Large keywords carry the page, and detail opens on click. Your existing pages, posts and menus keep working; ready-made layouts are under Patterns › Kaleta.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kaleta
Tags: block-patterns, full-site-editing, one-column, wide-blocks, style-variations, editor-style, accessibility-ready
*/

/* ------------------------------------------------------------------
   Colour modes
   The header button sets data-theme on <html> and remembers it.
   Without a saved choice the palette from Styles applies.
------------------------------------------------------------------- */

html[data-theme="dark"] {
	--wp--preset--color--base: #0F0F0E;
	--wp--preset--color--contrast: #F3F2ED;
	--wp--preset--color--muted: #A6A59F;
	--wp--preset--color--line: #3A3935;
	--wp--preset--color--surface: #1A1A18;
	color-scheme: dark;
}

html[data-theme="light"] {
	--wp--preset--color--base: #F5F4F0;
	--wp--preset--color--contrast: #121211;
	--wp--preset--color--muted: #5F5E59;
	--wp--preset--color--line: #D3D1CA;
	--wp--preset--color--surface: #ECEAE4;
	color-scheme: light;
}

/* ------------------------------------------------------------------
   Base
------------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	transition: background-color 0.3s ease, color 0.3s ease;
}

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

:where(h1, h2, h3, .wp-block-post-title) {
	text-wrap: balance;
}

:where(p, li) {
	text-wrap: pretty;
}

:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

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

.wp-site-blocks > main {
	margin-block-start: 0;
}

/* ------------------------------------------------------------------
   Lines
------------------------------------------------------------------- */

.wp-block-separator,
.wp-block-separator.has-alpha-channel-opacity {
	border: 0;
	border-top: 1px solid var(--wp--preset--color--line);
	height: 0;
	opacity: 1;
}

.wp-block-group.is-style-rule {
	border-top: 1px solid var(--wp--preset--color--line);
	padding-top: var(--wp--preset--spacing--40);
}

/* ------------------------------------------------------------------
   Small labels and lead text
------------------------------------------------------------------- */

.is-style-eyebrow {
	color: var(--wp--preset--color--muted);
	font-size: 0.8125rem;
	letter-spacing: 0.1em;
	line-height: 1.4;
	text-transform: uppercase;
}

.is-layout-constrained > .kk-lede,
.kk-lede {
	max-width: 36rem;
}

/* Numbered keyword links under the hero headline */

.kk-keylinks {
	counter-reset: kk-keylink;
}

.kk-keylinks > p {
	counter-increment: kk-keylink;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	margin: 0;
}

.kk-keylinks > p::before {
	color: var(--wp--preset--color--muted);
	content: counter(kk-keylink, decimal-leading-zero);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	margin-right: 0.625rem;
	vertical-align: 0.2em;
}

.kk-keylinks a {
	display: inline-flex;
	min-height: 44px;
	align-items: center;
	text-decoration: none;
}

.kk-keylinks a:hover {
	text-decoration: underline;
}

/* A list of names set as running type */

.kk-names {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em 1.4em;
	list-style: none;
	margin-left: 0;
	padding-left: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	letter-spacing: -0.01em;
	line-height: 1.25;
}

.kk-names > li {
	margin: 0;
}

/* ------------------------------------------------------------------
   Click to reveal: Details block styles
   "Keyword" is a large numbered row; "Row" is a quieter list row.
------------------------------------------------------------------- */

:where(.wp-block-group, .wp-block-post-content, .wp-block-column):has(> .wp-block-details.is-style-keyword) {
	counter-reset: kk-keyword;
}

.wp-block-details.is-style-keyword {
	border-top: 1px solid var(--wp--preset--color--line);
	counter-increment: kk-keyword;
	margin-block-start: 0;
}

.wp-block-details.is-style-keyword:not(:has(~ .wp-block-details.is-style-keyword)) {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.wp-block-details.is-style-keyword[open] {
	padding-bottom: var(--wp--preset--spacing--50);
}

.wp-block-details.is-style-keyword > summary {
	align-items: baseline;
	cursor: pointer;
	display: flex;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 500;
	gap: clamp(1rem, 2vw, 1.5rem);
	letter-spacing: -0.03em;
	line-height: 1;
	list-style: none;
	padding: clamp(1.25rem, 2.4vw, 1.75rem) 0;
	transition: opacity 0.2s ease;
}

.wp-block-details.is-style-keyword > summary::-webkit-details-marker,
.wp-block-details.is-style-row > summary::-webkit-details-marker {
	display: none;
}

.wp-block-details.is-style-keyword > summary::before {
	color: var(--wp--preset--color--muted);
	content: counter(kk-keyword, decimal-leading-zero);
	flex: 0 0 auto;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
	font-weight: 400;
	letter-spacing: 0.08em;
	min-width: 2rem;
}

.wp-block-details.is-style-keyword > summary::after {
	content: "+";
	flex: 0 0 auto;
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	font-weight: 400;
	line-height: 1;
	margin-left: auto;
}

.wp-block-details.is-style-keyword[open] > summary::after {
	content: "\2212";
}


.wp-block-details.is-style-row {
	border-top: 1px solid var(--wp--preset--color--line);
	margin-block-start: 0;
}

.wp-block-details.is-style-row:not(:has(~ .wp-block-details.is-style-row)) {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.wp-block-details.is-style-row[open] {
	padding-bottom: 1.375rem;
}

.wp-block-details.is-style-row > summary {
	align-items: baseline;
	cursor: pointer;
	display: flex;
	font-size: var(--wp--preset--font-size--medium);
	gap: 1rem;
	list-style: none;
	min-height: 44px;
	padding: 1.125rem 0;
	transition: opacity 0.2s ease;
}

.wp-block-details.is-style-row > summary::after {
	color: var(--wp--preset--color--muted);
	content: "+";
	flex: 0 0 auto;
	margin-left: auto;
}

.wp-block-details.is-style-row[open] > summary::after {
	content: "\2212";
}


.wp-block-details.is-style-row > :not(summary) {
	max-width: 36rem;
	padding-right: 2rem;
}

.wp-block-details.is-style-keyword[open] > :not(summary),
.wp-block-details.is-style-row[open] > :not(summary) {
	animation: kk-reveal 0.35s ease both;
}

@keyframes kk-reveal {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ------------------------------------------------------------------
   Header: colour mode button and mobile menu
------------------------------------------------------------------- */

.kk-mode-toggle {
	appearance: none;
	background: none;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1;
	min-height: 44px;
	padding: 0 1.125rem;
	white-space: nowrap;
}


.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open,
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	letter-spacing: -0.02em;
}

.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--line);
	color: var(--wp--preset--color--contrast);
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	min-height: 44px;
	min-width: 44px;
	justify-content: center;
}

/* ------------------------------------------------------------------
   Blocks
------------------------------------------------------------------- */

.wp-block-post-template {
	margin-top: 0;
}

.wp-block-post-template > li + li {
	margin-block-start: 0;
}

.wp-block-search__input {
	background: transparent;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	color: inherit;
	min-height: 48px;
	padding: 0 1.125rem;
}

.wp-block-search__button {
	border-radius: 999px;
	margin-left: 0.5rem;
}

.wp-block-query-pagination {
	font-size: var(--wp--preset--font-size--small);
}

:where(.wp-block-post-content) img {
	height: auto;
}

/* Previous and next post links */

.wp-block-post-navigation-link a {
	display: inline-flex;
	flex-direction: column;
	gap: 0.375rem;
	text-decoration: none;
}

.post-navigation-link-next a {
	align-items: flex-end;
}

.post-navigation-link__label {
	color: var(--wp--preset--color--muted);
	font-size: 0.8125rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.post-navigation-link__title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.wp-block-post-navigation-link a:hover .post-navigation-link__title {
	text-decoration: underline;
}

/* Quotes in older content written without blocks */

:where(.wp-block-post-content) blockquote:not([class]) {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	letter-spacing: -0.01em;
	line-height: 1.3;
	margin-left: 0;
	margin-right: 0;
	padding: 0;
}

:where(.wp-block-post-content) blockquote:not([class]) cite {
	color: var(--wp--preset--color--muted);
	display: block;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-style: normal;
	letter-spacing: 0;
	margin-top: 0.75rem;
}

/* Hover dimming only where there is a real pointer, so it does not stick after a tap */

@media (hover: hover) {
	.wp-block-details.is-style-keyword > summary:hover,
	.wp-block-details.is-style-row > summary:hover,
	.kk-mode-toggle:hover {
		opacity: 0.7;
	}
}

/* ------------------------------------------------------------------
   Motion preferences
------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	body,
	.wp-block-details > summary {
		transition: none;
	}

	.wp-block-details.is-style-keyword[open] > :not(summary),
	.wp-block-details.is-style-row[open] > :not(summary) {
		animation: none;
	}
}
