/*
Theme Name: Kovshenin
Description: A custom block theme scaffolded by Studio Code.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 7.2
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: kovshenin
Tags: full-site-editing, block-patterns, block-styles, wide-blocks, accessibility-ready, style-variations
*/

/* WordPress inserts a margin-block-start equal to the block gap (24px unless
   theme.json sets styles.spacing.blockGap) between the template's top-level
   sections (header part, main, footer part) — a gap that exists even when no
   markup asks for it. Zero it so sections butt edge-to-edge and own their
   vertical rhythm via padding; this does not affect block gaps inside nested
   layouts. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* With that gap gone, main carries its own vertical padding so templates this
   theme does not author (WooCommerce shop, product, cart…) still clear the
   header and footer. A descendant selector, not a child one: WooCommerce wraps
   the single-product main in an extra group. Templates built from full-bleed
   sections opt out with is-flush and let the sections own the rhythm. */
.wp-site-blocks main {
	padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--70);
}
.wp-site-blocks main.is-flush {
	padding-block: 0;
}

:root {
	--kk-ink: var(--wp--preset--color--primary);
	--kk-grey: var(--wp--preset--color--secondary);
	--kk-faint: var(--wp--preset--color--muted);
	--kk-rule: var(--wp--preset--color--rule);
	--kk-ease: color .15s, text-decoration-color .15s, opacity .15s;
}

/* Light and dark. The system setting decides (color-scheme: light dark);
   the footer toggle pins one with data-theme on <html>. Every colour is
   defined once as light-dark(light, dark). :root:root outranks the :root
   palette WordPress prints in its global styles. */
:root:root {
	color-scheme: light dark;
	--wp--preset--color--primary: light-dark(#1a1a1a, #ededed);
	--wp--preset--color--background: light-dark(#ffffff, #151515);
	--wp--preset--color--text: light-dark(#222222, #d4d4d4);
	--wp--preset--color--secondary: light-dark(#777777, #9b9b9b);
	--wp--preset--color--muted: light-dark(#aaaaaa, #6f6f6f);
	--wp--preset--color--rule: light-dark(#eeeeee, #2a2a2a);
	--wp--preset--color--surface: light-dark(#f7f6f3, #1f1f1e);
	--kk-row: light-dark(#f0f0f0, #242424);
	--kk-soft: light-dark(#555, #b4b4b4);
	--kk-more: light-dark(#888, #8c8c8c);
	--kk-dim: light-dark(#999, #7d7d7d);
	--kk-underline: light-dark(#ccc, #4a4a4a);
	--kk-code: light-dark(#f5f4f1, #232322);
	--kk-img: light-dark(1, .92);
}
:root:root[data-theme="light"] { color-scheme: light; }
:root:root[data-theme="dark"] { color-scheme: dark; }

.prose img { opacity: var(--kk-img); }
/* Old posts hard-code dark text (<span style="color: #333333">): let it
   follow the theme in dark mode. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .prose :is(span, font, p, strong, em, b, i)[style*="color"] { color: inherit !important; }
}
:root[data-theme="dark"] .prose :is(span, font, p, strong, em, b, i)[style*="color"] { color: inherit !important; }

/* Footer light/dark toggle: a half-filled circle set like a capital O —
   cap-height, sitting on the text baseline. The padding is a larger hit
   area that negative margins keep out of the line. */
.kk-theme-toggle {
	display: inline-block; padding: 6px; margin: -6px -6px -6px 1px;
	border: 0; background: none; color: inherit; line-height: 0;
	vertical-align: -1px; cursor: pointer; transition: var(--kk-ease);
}
.kk-theme-toggle:hover, .kk-theme-toggle:focus-visible { color: var(--kk-ink); }
.kk-theme-toggle svg { display: block; width: 11px; height: 11px; }

/* === frame: sticky sidebar + main column === */
.site-frame {
	display: grid;
	grid-template-columns: 320px minmax(0, 1fr);
	max-width: 1120px;
	min-height: 100vh;
	margin: 0 auto;
}
.site-frame > * { margin-block-start: 0; }
.site-sidebar {
	position: sticky;
	top: 0;
	align-self: start;
	padding: 64px 40px;
}
.wp-site-blocks main.site-main {
	display: flex;
	flex-direction: column;
	padding: 64px 40px 40px;
	border-left: 1px solid var(--kk-rule);
	min-width: 0;
}
.site-main > * { margin-block: 0; }
.site-footer { margin-top: auto !important; padding-top: 80px; }
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--kk-ink); }

/* === sidebar === */
.site-sidebar__inner > * { margin-block: 0; }
.site-sidebar .wp-block-site-logo img { border-radius: 50%; }
.site-sidebar .wp-block-site-title { margin-top: 22px; line-height: 1.15; font-weight: 500; letter-spacing: -.01em; }
.site-sidebar .wp-block-site-title a { color: inherit; }
.site-sidebar .wp-block-site-tagline { margin-top: 8px; }
.site-sidebar .wp-block-social-links { margin-top: 26px; gap: 10px; flex-direction: column; align-items: flex-start; }
.site-sidebar .wp-block-social-links .wp-social-link { font-size: 15px; color: var(--kk-soft); }
.site-sidebar .wp-block-social-links .wp-block-social-link-anchor { padding: 0; gap: 10px; color: inherit; transition: var(--kk-ease); }
.site-sidebar .wp-block-social-links .wp-block-social-link-anchor svg { width: 15px; height: 15px; opacity: .75; }
.site-sidebar .wp-block-social-links .wp-social-link span.wp-block-social-link-label:not(.screen-reader-text) { margin: 0; font-size: 15px; line-height: 1.6; }
.site-sidebar .wp-block-social-links .wp-social-link { height: auto; }
.site-sidebar .wp-social-link:hover { transform: none; color: var(--kk-ink); }
.site-sidebar .wp-social-link:hover svg { opacity: 1; }
.site-sidebar .wp-social-link-mail { color: var(--kk-ink); font-weight: 500; }

/* === headers === */
.entry-title { max-width: 24ch; text-wrap: balance; }
.entry-meta { margin-top: 12px !important; }
.lede { margin-top: 14px !important; max-width: 52ch; }

/* === front page === */
.intro { max-width: 38ch; line-height: 1.55; text-wrap: pretty; }
.intro a, .prose a { text-decoration: underline; text-decoration-color: var(--kk-underline); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: var(--kk-ease); }
.intro a:hover, .prose a:hover { color: inherit; text-decoration-color: var(--kk-ink); }
.home-section { margin-top: var(--wp--preset--spacing--lg) !important; }
.home-section > * { margin-block: 0; }
.is-style-label {
	margin-bottom: 10px !important;
	font-family: var(--wp--preset--font-family--instrument-sans);
	font-size: var(--wp--preset--font-size--label) !important;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--kk-faint);
}
.is-style-more { margin-top: 14px !important; }
.is-style-more a { color: var(--kk-more); transition: var(--kk-ease); }
.is-style-more a:hover { color: var(--kk-ink); }
.linkedin { margin-top: 12px !important; }
.linkedin a { position: relative; padding-left: 23px; }
.linkedin a::before,
.linkedin a::after { content: ""; position: absolute; top: 50%; opacity: .85; }
.linkedin a::before { left: 0; width: 16px; height: 16px; margin-top: -8px; box-sizing: border-box; border: 1px solid currentColor; border-radius: 4px; }
.linkedin a::after { left: 3px; width: 10px; height: 10px; margin-top: -5px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.98 3.5a2.48 2.48 0 1 1 0 4.96 2.48 2.48 0 0 1 0-4.96ZM2.86 9.75h4.24V21H2.86V9.75Zm6.9 0h4.06v1.54h.06c.57-1.07 1.95-2.2 4.01-2.2 4.29 0 5.08 2.82 5.08 6.49V21h-4.23v-4.88c0-1.16-.02-2.66-1.62-2.66-1.63 0-1.88 1.27-1.88 2.58V21H9.76V9.75Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.98 3.5a2.48 2.48 0 1 1 0 4.96 2.48 2.48 0 0 1 0-4.96ZM2.86 9.75h4.24V21H2.86V9.75Zm6.9 0h4.06v1.54h.06c.57-1.07 1.95-2.2 4.01-2.2 4.29 0 5.08 2.82 5.08 6.49V21h-4.23v-4.88c0-1.16-.02-2.66-1.62-2.66-1.63 0-1.88 1.27-1.88 2.58V21H9.76V9.75Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.note { margin-top: 26px !important; max-width: 60ch; text-wrap: pretty; }

/* === rows === */
.is-style-row {
	display: flex;
	flex-wrap: nowrap;
	justify-content: space-between;
	align-items: center;
	gap: 24px;
	padding: 10px 0;
	border-top: 1px solid var(--kk-row);
}
.is-style-row > * { margin: 0; }
.is-style-row > :last-child { white-space: nowrap; }
.is-style-row a { color: inherit; transition: var(--kk-ease); }
.is-style-row a:hover { color: var(--kk-grey); }
.is-style-row .wp-block-post-date { color: var(--kk-faint); }
.is-style-row:not(:has(+ .is-style-row)),
.wp-block-post-template > li:last-child .is-style-row,
.wp-block-post-template > li:has(+ li > .is-style-year) .is-style-row { border-bottom: 1px solid var(--kk-row); }
.wp-block-post-template { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; max-width: 100%; }
.wp-block-post-title { box-sizing: border-box; word-break: break-word; }
.wp-block-post-template > li { margin-block-start: 0 !important; }
.wp-block-post-template .is-style-row:not(:has(+ .is-style-row)) { border-bottom: 0; }
.wp-block-post-template > li:last-child .is-style-row,
.wp-block-post-template > li:has(+ li > .is-style-year) .is-style-row { border-bottom: 1px solid var(--kk-row); }
.wp-block-group.job { display: grid; grid-template-columns: 1fr auto 92px; column-gap: 24px; row-gap: 2px; align-items: baseline; }
.job > :nth-child(2), .job > :nth-child(3) { text-align: right; }
.job > :nth-child(2) { white-space: normal; color: var(--kk-dim); }

/* === archive === */
.post-list { margin-top: 40px !important; }
.home-section .post-list { margin-top: 0 !important; }
.is-style-year { margin: 44px 0 10px; font-size: var(--wp--preset--font-size--label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--kk-faint); }
.wp-block-post-template > li:first-child .is-style-year { margin-top: 0; }

/* === long-form text === */
.prose { margin-top: 40px !important; color: var(--wp--preset--color--text); }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3 { margin-top: 64px; }
.prose h3 { margin-top: 48px; }
.prose h2 + *, .prose h3 + * { margin-top: 28px !important; }
.prose .wp-block-code, .prose pre { margin-block: 1.4em; overflow-x: auto; }
.prose code { font: 14.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--kk-code); padding: .1em .35em; border-radius: 4px; }
.prose pre code { background: none; padding: 0; font: inherit; }
.prose figure { margin-block: 1.6em; }
.prose img { border-radius: 8px; height: auto; }
.prose .wp-block-image img { border: 1px solid var(--kk-rule); }
.prose figcaption, .prose .wp-element-caption { margin-top: 10px; font: 13px/1.5 var(--wp--preset--font-family--instrument-sans); color: var(--kk-dim); text-align: left; }
.prose strong { font-weight: 600; }

/* === previous / next === */
.adjacent { margin-top: 64px !important; max-width: 640px; }
.adjacent > * { margin: 0; }
.adjacent .post-navigation-link-next,
.adjacent .post-navigation-link-previous { padding: 10px 0; border-top: 1px solid var(--kk-row); }
.adjacent { border-bottom: 1px solid var(--kk-row); }
.adjacent > :not(:has(a)) { display: none; }
.adjacent:not(:has(a)) { display: none; }
.adjacent a { display: flex; justify-content: space-between; gap: 24px; color: inherit; }
.adjacent a:hover { color: var(--kk-grey); }
.adjacent .post-navigation-link__label { order: 2; min-width: 80px; text-align: right; color: var(--kk-faint); }

/* === responsive === */
@media (max-width: 760px) {
	.site-frame { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
	.site-sidebar { position: static; padding: 40px 24px 0; }
	.wp-site-blocks main.site-main { border: 0; padding: 32px 24px; }
	.intro { font-size: 20px !important; }
	.wp-block-group.talk { flex-direction: column; align-items: flex-start; gap: 2px; }
	.talk > :last-child { white-space: normal; }
	.wp-block-group.job { grid-template-columns: 1fr auto; }
	.job > :nth-child(1) { grid-column: 1; }
	.job > :nth-child(3) { grid-column: 2; grid-row: 1; }
	.job > :nth-child(2) { grid-column: 1; grid-row: 2; text-align: left; }
	.entry-title { font-size: 28px !important; }
	.prose { font-size: 18px !important; }
	body:not(.home) .site-sidebar { border-bottom: 1px solid var(--kk-rule); padding: 20px 24px; }
	body:not(.home) .site-sidebar__inner { display: flex; align-items: center; gap: 12px; }
	body:not(.home) .site-sidebar .wp-block-site-logo img { width: 36px; height: 36px; }
	body:not(.home) .site-sidebar .wp-block-site-title { font-size: 19px !important; margin-top: 0; }
	body:not(.home) .site-sidebar .wp-block-site-tagline,
	body:not(.home) .site-sidebar .wp-block-social-links { display: none; }
	body:not(.home) .wp-site-blocks main.site-main { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
