/* ==========================================================================
   Kirsten Book — base styles
   Colors/fonts come from theme.json as CSS variables:
   --wp--preset--color--{white|blush-light|blush|rose|rose-deep|grey|charcoal|black}
   --wp--preset--font-family--{heading|script|body}
   ========================================================================== */

:root {
	--kb-gutter: clamp(1.25rem, 4vw, 2rem);
	--kb-section-y: clamp(3.5rem, 9vw, 6.5rem);
	--kb-radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; height: auto; display: block; }

/* Accessibility --------------------------------------------------------- */
.skip-link {
	position: absolute; left: 1rem; top: -100px; z-index: 1000;
	background: var(--wp--preset--color--black); color: #fff;
	padding: .75rem 1.25rem; border-radius: 999px;
}
.skip-link:focus { top: 1rem; }
:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--rose-deep);
	outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Layout helpers -------------------------------------------------------- */
.kb-container {
	width: 100%;
	max-width: calc(var(--wp--style--global--wide-size, 1200px) + var(--kb-gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--kb-gutter);
}
.kb-container--narrow { max-width: calc(820px + var(--kb-gutter) * 2); }

/* Page content: plain blocks are centered at reading width,
   our sections (.kb-section) and full-width blocks go edge to edge. */
.entry-content > * {
	max-width: calc(var(--wp--style--global--content-size, 760px) + var(--kb-gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--kb-gutter);
}
.entry-content > .alignwide { max-width: calc(var(--wp--style--global--wide-size, 1200px) + var(--kb-gutter) * 2); }
.entry-content > .alignfull,
.entry-content > .kb-section { max-width: none; }
.entry-content > :where(p, ul, ol, h2, h3, h4, .wp-block-image):first-child { margin-top: var(--kb-section-y); }

/* Sections (every pattern's outer Group) ------------------------------ */
.kb-section {
	padding-block: var(--kb-section-y);
	padding-inline: var(--kb-gutter);
	margin-block: 0;
}
.entry-content > .kb-section + .kb-section { margin-top: 0; }

/* Intro Band ------------------------------------------------------------- */
.kb-intro-band { text-align: center; }
.kb-intro-band h2 { max-width: 22ch; margin-inline: auto; }
.kb-intro-band p  { max-width: 58ch; margin-inline: auto; font-size: 1.125rem; }
.kb-intro-band .kb-intro-band__lines p { margin-bottom: .35rem; }
.kb-intro-band .kb-intro-band__close {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--rose-deep);
	margin-top: 1.75rem;
}
.kb-intro-band .wp-block-buttons { margin-top: 2rem; }

/* Block styles (sidebar "Styles") --------------------------------------- */
.wp-block-image.is-style-tilted-frame img {
	border: 10px solid var(--wp--preset--color--white);
	box-shadow: 0 18px 40px rgba(47, 47, 47, .14);
	transform: rotate(3deg);
}
.wp-block-image.is-style-circle img {
	aspect-ratio: 1; object-fit: cover; border-radius: 50%;
	border: 6px solid var(--wp--preset--color--white);
}

/* Typography details ---------------------------------------------------- */
h1, h2, h3, h4 { text-wrap: balance; margin-block: 0 .5em; }
p { margin-block: 0 1.1em; text-wrap: pretty; }
.has-script-font-family { font-weight: 400; line-height: 1; }

/* Buttons: outline variation */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--black);
	box-shadow: inset 0 0 0 1.5px currentColor;
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
}

/* ==========================================================================
   Header
   ========================================================================== */
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

/* Top bar */
.kb-topbar {
	background: var(--wp--preset--color--blush);
	color: var(--wp--preset--color--charcoal);
	font-size: .8125rem;
}
.kb-topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 38px; }
.kb-topbar__note { margin: 0; }
.kb-topbar__links { list-style: none; display: flex; gap: 1.5rem; margin: 0 0 0 auto; padding: 0; }
.kb-topbar a { color: inherit; text-decoration: none; font-weight: 700; }
.kb-topbar a:hover { text-decoration: underline; }

/* Main bar */
.site-header {
	position: sticky; top: 0; z-index: 100;
	background: var(--wp--preset--color--white);
	transition: box-shadow .25s ease;
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }
.site-header.is-scrolled { box-shadow: 0 1px 0 var(--wp--preset--color--blush), 0 10px 30px rgba(47, 47, 47, .06); }

.site-header__inner { display: flex; align-items: center; gap: 2rem; min-height: 88px; }
.site-header__brand { flex-shrink: 0; }
.site-header__brand .custom-logo { max-height: 64px; width: auto; }

.kb-wordmark { display: grid; text-decoration: none; line-height: 1.1; }
.kb-wordmark__name {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.6rem; font-weight: 600; color: var(--wp--preset--color--black);
}
.kb-wordmark__role { font-size: .75rem; color: var(--wp--preset--color--grey); margin-top: .2rem; }

/* Nav (desktop) */
.kb-nav { display: flex; align-items: center; gap: 2rem; margin-left: auto; }
.kb-menu { list-style: none; display: flex; align-items: center; gap: 1.75rem; margin: 0; padding: 0; }
.kb-menu > li { position: relative; }
.kb-menu a {
	display: block; padding-block: .5rem;
	color: var(--wp--preset--color--charcoal); text-decoration: none;
	font-size: .9375rem;
	background: linear-gradient(var(--wp--preset--color--rose), var(--wp--preset--color--rose)) left bottom / 0 2px no-repeat;
	transition: background-size .25s ease;
}
.kb-menu > li > a:hover,
.kb-menu > .current-menu-item > a,
.kb-menu > .current-menu-ancestor > a { background-size: 100% 2px; }

.kb-menu .menu-item-has-children > a { padding-right: 1rem; }
.kb-menu .menu-item-has-children > a::after {
	content: ""; position: absolute; right: 0; top: 50%;
	width: 6px; height: 6px; margin-top: -5px;
	border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
}
.kb-menu .sub-menu {
	list-style: none; margin: 0; padding: .75rem 0;
	position: absolute; top: 100%; left: -1rem; min-width: 250px;
	background: var(--wp--preset--color--white);
	border-top: 2px solid var(--wp--preset--color--rose);
	box-shadow: 0 18px 40px rgba(47, 47, 47, .12);
	opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.kb-menu li:hover > .sub-menu,
.kb-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.kb-menu .sub-menu a { padding: .55rem 1.25rem; background: none; }
.kb-menu .sub-menu a:hover,
.kb-menu .sub-menu .current-menu-item > a { background: var(--wp--preset--color--blush-light); }

/* Menu toggle (mobile only) */
.kb-menu-toggle {
	display: none; margin-left: auto;
	align-items: center; gap: .6rem;
	background: none; border: 0; padding: .5rem; cursor: pointer;
	font: inherit; font-size: .9375rem; color: var(--wp--preset--color--black);
}
.kb-menu-toggle__bars,
.kb-menu-toggle__bars::before,
.kb-menu-toggle__bars::after {
	display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px;
	transition: transform .25s ease, background-color .25s ease;
}
.kb-menu-toggle__bars { position: relative; }
.kb-menu-toggle__bars::before, .kb-menu-toggle__bars::after { content: ""; position: absolute; left: 0; }
.kb-menu-toggle__bars::before { top: -7px; }
.kb-menu-toggle__bars::after  { top: 7px; }
.is-open .kb-menu-toggle__bars { background: transparent; }
.is-open .kb-menu-toggle__bars::before { transform: translateY(7px) rotate(45deg); }
.is-open .kb-menu-toggle__bars::after  { transform: translateY(-7px) rotate(-45deg); }

/* Nav (mobile) */
@media (max-width: 1023px) {
	.site-header__inner { min-height: 72px; }
	.kb-wordmark__name { font-size: 1.35rem; }
	.kb-menu-toggle { display: inline-flex; }

	.kb-nav {
		display: none;
		position: absolute; left: 0; right: 0; top: 100%;
		flex-direction: column; align-items: stretch; gap: 1.5rem;
		padding: 1.5rem var(--kb-gutter) 2rem;
		background: var(--wp--preset--color--white);
		border-top: 1px solid var(--wp--preset--color--blush);
		box-shadow: 0 20px 40px rgba(47, 47, 47, .1);
		max-height: calc(100dvh - 110px); overflow-y: auto;
	}
	.site-header.is-open .kb-nav { display: flex; }

	.kb-menu { flex-direction: column; align-items: stretch; gap: 0; }
	.kb-menu > li { border-bottom: 1px solid var(--wp--preset--color--blush); }
	.kb-menu a { padding-block: .9rem; font-size: 1.0625rem; background: none; }
	.kb-menu .menu-item-has-children > a::after { display: none; }
	.kb-menu .sub-menu {
		position: static; opacity: 1; visibility: visible; transform: none;
		box-shadow: none; border: 0; padding: 0 0 .75rem 1rem; min-width: 0;
	}
	.kb-menu .sub-menu a { padding: .45rem 0; color: var(--wp--preset--color--grey); }
	.kb-nav__cta .wp-block-button__link { display: block; text-align: center; }
	body.kb-nav-open { overflow: hidden; }
}
@media (max-width: 640px) {
	.kb-topbar__note { display: none; }
	.kb-topbar__links { margin-inline: auto; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { margin-top: 0; color: var(--wp--preset--color--white); }
.site-footer__wave { display: block; width: 100%; height: clamp(40px, 6vw, 90px); margin-bottom: -1px; }
.site-footer__wave path { fill: var(--wp--preset--color--charcoal); }
.site-footer__body { background: var(--wp--preset--color--charcoal); padding-block: clamp(2.5rem, 6vw, 4rem) 1.5rem; font-size: .9375rem; }

.site-footer__grid {
	display: grid; gap: 2.5rem;
	grid-template-columns: 1fr 1.1fr 1fr;
	align-items: start;
}
.site-footer__heading {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.5rem; font-weight: 500;
	color: var(--wp--preset--color--blush);
	margin-bottom: 1rem;
}
.site-footer p { color: rgba(255, 255, 255, .85); }
.site-footer a { color: var(--wp--preset--color--white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.site-footer__start .wp-block-button__link { background: var(--wp--preset--color--blush); color: var(--wp--preset--color--black); }
.site-footer__start .wp-block-button__link:hover { background: var(--wp--preset--color--white); text-decoration: none; }

.site-footer__identity { text-align: center; }
.site-footer__name {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 2rem; line-height: 1.1; color: var(--wp--preset--color--white) !important;
	margin-bottom: .25rem;
}
.site-footer__practice { color: var(--wp--preset--color--blush) !important; margin-bottom: 1.25rem; }

.kb-social { list-style: none; display: flex; justify-content: center; gap: .75rem; padding: 0; margin: 1.25rem 0 0; }
.kb-social a {
	display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, .3);
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.kb-social a:hover { background: var(--wp--preset--color--blush); color: var(--wp--preset--color--black); border-color: transparent; }

.site-footer__menu, .site-footer__contact { list-style: none; padding: 0; margin: 0; }
.site-footer__menu li + li, .site-footer__contact li + li { margin-top: .5rem; }
.site-footer__contact { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, .15); }

.site-footer__crisis {
	margin: 2.5rem 0 0; padding: 1rem 1.25rem;
	border: 1px solid rgba(250, 221, 232, .35); border-radius: var(--kb-radius);
	color: var(--wp--preset--color--blush) !important; text-align: center;
}
.site-footer__bottom {
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem;
	margin-top: 1.5rem; padding-top: 1.25rem;
	border-top: 1px solid rgba(255, 255, 255, .15);
	font-size: .8125rem;
}
.site-footer__bottom p { margin: 0; color: rgba(255, 255, 255, .65); }

@media (max-width: 860px) {
	.site-footer__grid { grid-template-columns: 1fr; text-align: center; }
	.site-footer__start .wp-block-button { display: inline-block; }
}

/* Archive / 404 ---------------------------------------------------------- */
.kb-archive, .kb-404 { padding-block: var(--kb-section-y); }
.kb-archive__item { padding-block: 1.5rem; border-bottom: 1px solid var(--wp--preset--color--blush); }
.kb-archive__item h2 a { color: var(--wp--preset--color--black); text-decoration: none; }
.entry--post .entry-header { padding-top: var(--kb-section-y); }
.entry-meta { color: var(--wp--preset--color--grey); font-size: .9rem; }

/* ==========================================================================
   Brand leaf (from the logo). Drawn with a mask so it can take any color.
   ========================================================================== */
.kb-leaf {
	display: inline-block;
	width: 44px; aspect-ratio: 190 / 136;
	background-color: var(--wp--preset--color--rose);
	-webkit-mask: url("../img/leaf-branch.png") center / contain no-repeat;
	        mask: url("../img/leaf-branch.png") center / contain no-repeat;
}
.kb-wordmark { grid-template-columns: auto 1fr; column-gap: .75rem; align-items: center; }
.kb-wordmark__mark { grid-row: span 2; width: 46px; }
.kb-wordmark__name, .kb-wordmark__role { grid-column: 2; }
@media (max-width: 480px) { .kb-wordmark__mark { width: 34px; } }

.site-footer__leaf { width: 56px; background-color: var(--wp--preset--color--blush); margin-bottom: .75rem; }
