/* Loose Leaf theme styles. Colors, type sizes and spacing live in theme.json. */

/* Headings use Archivo's wide setting. */
h1,
h2,
h3,
h4 {
	font-stretch: 112%;
}

/* Two-tone focus ring: the light inner ring shows on dark panels, the dark outer ring on light ones. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: 3px solid var(--wp--preset--color--ink);
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--wp--preset--color--paper);
}

/* Links on dark panels */
.has-ink-background-color a:where(:not(.wp-element-button)):hover {
	color: var(--wp--preset--color--amber);
}

/* Current page in the main menu */
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--sage);
	text-decoration-thickness: 2px;
	text-underline-offset: 8px;
}

/* Headings that link to another page: an arrow marks the link, and the underline appears on hover */
.is-style-arrow a {
	text-decoration: none;
}

.is-style-arrow a:hover {
	text-decoration: underline;
	text-decoration-thickness: 0.06em;
	text-underline-offset: 0.12em;
}

/* The word joiner keeps the arrow on the same line as the last word. */
.is-style-arrow a::after {
	content: "\2060";
	padding-inline-start: 0.55em;
	margin-inline-start: 0.2em;
	background-color: currentColor;
	-webkit-mask: url(../images/arrow.svg) right center / 0.55em 0.55em no-repeat;
	mask: url(../images/arrow.svg) right center / 0.55em 0.55em no-repeat;
}

/* Section labels, numbered automatically: (01), (02) ... */
body {
	counter-reset: looseleaf-section;
}

.is-style-label,
.is-style-tag {
	font-size: var(--wp--preset--font-size--label);
	font-stretch: 75%;
	font-weight: 600;
	letter-spacing: 0.03em;
	line-height: 1.4;
}

.is-style-label {
	counter-increment: looseleaf-section;
	color: var(--wp--preset--color--sage-dark);
}

/* The second declaration hides the number from screen readers where supported; other browsers keep the first. */
.is-style-label::before {
	content: "(" counter(looseleaf-section, decimal-leading-zero) ") ";
	content: "(" counter(looseleaf-section, decimal-leading-zero) ") " / "";
}

.has-ink-background-color .is-style-label,
.has-ink-background-color .is-style-tag {
	color: var(--wp--preset--color--sage);
}

/* Hero and page headers. The leaf sits on its own layer so it can fade behind the text on small screens. */
.is-style-hero-leaf,
.is-style-leaf-small {
	position: relative;
	isolation: isolate;
}

.is-style-hero-leaf::before,
.is-style-leaf-small::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background: url(../images/hero-leaf.webp) no-repeat right bottom / min(640px, 48vw) auto;
	pointer-events: none;
}

/* Inner pages use a smaller leaf than the homepage hero. */
.is-style-leaf-small::before {
	background-position: right -40px bottom -120px;
	background-size: min(440px, 32vw) auto;
}

/* Short lines for big titles, with room for an 11-letter word such as "Measurement". */
.hero-title {
	max-width: 11.5ch;
}

.hero-lead {
	max-width: 30em;
}

.hero-badge {
	position: absolute;
	right: clamp(24px, 5vw, 64px);
	bottom: -64px;
	z-index: 2;
	margin: 0;
}

.editor-styles-wrapper .hero-badge {
	position: static;
}

.wp-block-button.is-style-badge .wp-block-button__link {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 128px;
	height: 128px;
	padding: 20px;
	border-radius: 50%;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
}

.wp-block-button.is-style-badge .wp-block-button__link::before {
	content: "";
	position: absolute;
	inset: 7px;
	border: 2px dashed var(--wp--preset--color--ink);
	border-radius: 50%;
	animation: looseleaf-spin 20s linear infinite;
}

@keyframes looseleaf-spin {
	to {
		transform: rotate(360deg);
	}
}

/* CTA test: the theme script shows the "Test variant B" button instead of the default on half of page loads. */
.wp-block-button.is-style-variant-b {
	display: none;
}

[data-cta-variant="b"] > .wp-block-button {
	display: none;
}

[data-cta-variant="b"] > .is-style-variant-b {
	display: block;
}

.editor-styles-wrapper .wp-block-button.is-style-variant-b {
	display: block;
	outline: 2px dashed var(--wp--preset--color--sage);
	outline-offset: 4px;
}

/* Problem list */
.is-style-lined {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--statement);
	font-stretch: 105%;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.is-style-lined li {
	margin: 0;
	padding: 22px 0;
	border-top: 1px solid var(--wp--preset--color--sage);
}

.is-style-lined li:last-child {
	border-bottom: 1px solid var(--wp--preset--color--sage);
}

.is-style-lined strong {
	font-weight: 800;
}

ol.is-style-lined li {
	position: relative;
	padding-left: 3.25rem;
}

/* Outlined step numbers; the second declaration keeps them out of screen readers, which announce list positions already. */
ol.is-style-lined li::before {
	content: counter(list-item);
	content: counter(list-item) / "";
	position: absolute;
	top: 18px;
	left: 0;
	font-size: 2.5rem;
	font-stretch: 112%;
	font-weight: 800;
	line-height: 1;
	color: transparent;
	-webkit-text-stroke: 1.5px var(--wp--preset--color--ink);
}

/* Short items in two columns, such as a list of skills */
.is-style-lined-columns {
	margin: 0;
	padding: 0;
	list-style: none;
	columns: 2 260px;
	column-gap: 48px;
	font-stretch: 105%;
	font-weight: 600;
	line-height: 1.3;
}

.is-style-lined-columns li {
	break-inside: avoid;
	padding: 18px 0;
	border-top: 1px solid var(--wp--preset--color--sage);
}

/* Statement */
.is-style-reveal {
	margin-top: 0;
	font-size: clamp(1.25rem, 1.8vw, 1.6rem);
	line-height: 1.5;
}

.is-style-reveal .looseleaf-word {
	color: var(--wp--preset--color--sage-dark);
	transition: color 0.25s;
}

.is-style-reveal .looseleaf-word.is-lit {
	color: inherit;
}

/* Service rows */
.is-style-rule-top {
	padding-top: 36px;
	padding-bottom: 36px;
	border-top: 2px solid var(--wp--preset--color--ink);
}

.is-style-rule-top:last-child {
	border-bottom: 2px solid var(--wp--preset--color--ink);
}

.is-style-rule-top + .is-style-rule-top {
	margin-block-start: 0;
}

.is-style-rule-top .wp-block-columns {
	align-items: baseline;
	margin: 0;
}

.is-style-ruled > .wp-block-column {
	padding-top: 24px;
	border-top: 2px solid var(--wp--preset--color--ink);
}

/* Work cards and panels */
.is-style-cut-corner {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	clip-path: polygon(0 0, calc(100% - 72px) 0, 100% 72px, 100% 100%, 0 100%);
}

.is-style-diagonal-top {
	clip-path: polygon(0 96px, 100% 0, 100% 100%, 0 100%);
}

.is-style-leaf-texture {
	background-image: url(../images/leaf-texture.webp);
	background-size: 160px;
}

/* Approach */
.is-style-step-number {
	margin-bottom: 0;
	font-size: 7.5rem;
	font-stretch: 112%;
	font-weight: 800;
	line-height: 0.9;
	color: transparent;
	-webkit-text-stroke: 2px var(--wp--preset--color--ink);
}

/* Contact form */
.contact-form {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.contact-form p {
	margin: 0;
}

.contact-form__row {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}

.contact-form__row > * {
	flex: 1 1 220px;
	min-width: 0;
}

.contact-form__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.contact-form label {
	font-size: 1rem;
	font-weight: 600;
}

.contact-form__optional {
	font-weight: 400;
	color: var(--wp--preset--color--sage-dark);
}

.contact-form input,
.contact-form textarea {
	padding: 14px 16px;
	border: 1.5px solid var(--wp--preset--color--sage-dark);
	border-radius: 12px;
	background-color: var(--wp--preset--color--paper);
	color: inherit;
	font: inherit;
}

.contact-form textarea {
	resize: vertical;
}

.contact-form__note {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--sage-dark);
}

.contact-form__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 24px;
}

.contact-form button {
	border: 0;
	cursor: pointer;
}

.contact-form button[aria-disabled="true"] {
	opacity: 0.6;
	cursor: progress;
}

/* Spam trap: kept off screen for people, filled in by bots. */
.contact-form__trap {
	position: absolute;
	left: -9999px;
}

/* Bot check: holds the compact Turnstile widget's height so the form doesn't shift when it loads.
   Without JavaScript there's no widget, so no space is held. */
@media (scripting: enabled) {
	.contact-form__check {
		min-height: 140px;
	}
}

/* Results of a form sent without JavaScript: the server redirects back to one of these by its ID. */
.contact-form__notice {
	display: none;
	margin: 0 0 24px;
	padding: 14px 16px;
	border-radius: 12px;
	background-color: var(--wp--preset--color--mist);
	font-weight: 600;
	scroll-margin-top: 24px;
}

.contact-form__notice:target {
	display: block;
}

.contact-form__status {
	font-weight: 600;
}

/* Blog: topic links beside ruled rows of posts */
.blog-topics {
	margin: 0;
	padding: 0;
	list-style: none;
}

.blog-topics li + li {
	margin-top: 8px;
}

.blog-topics .current-cat > a {
	font-weight: 700;
	text-decoration: none;
}

.blog-rows > li {
	padding-block: 36px;
	border-top: 2px solid var(--wp--preset--color--ink);
}

.blog-rows > li:last-child {
	border-bottom: 2px solid var(--wp--preset--color--ink);
}

/* Topic, date and byline items. Spacing alone separates them, so a wrapped line never starts with punctuation. */
.post-meta {
	gap: 0.25em 1.25em;
}

.post-trail {
	gap: 0.4em;
}

.post-header .post-meta {
	color: var(--wp--preset--color--sage);
	font-size: var(--wp--preset--font-size--small);
}

.post-header .post-meta a {
	color: var(--wp--preset--color--paper);
}

.wp-block-post-title {
	text-wrap: balance;
}

.post-header .wp-block-post-title {
	max-width: 22ch;
}

/* Blog posts: headings sized for long-form reading, wherever they sit, and room between sections */
.post-body .wp-block-post-content h2 {
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.15;
}

.post-body .wp-block-post-content h3 {
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.3;
}

.post-body .wp-block-post-content > * + * {
	margin-block-start: 1.25em;
}

.post-body .wp-block-post-content > h2 {
	margin-block-start: var(--wp--preset--spacing--50);
}

.post-body .wp-block-post-content > h3 {
	margin-block-start: var(--wp--preset--spacing--40);
}

.post-body .wp-block-post-content > :is(h2, h3) + * {
	margin-block-start: 0.6em;
}

.post-body figcaption {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--sage-dark);
}

.post-body :not(pre) > code {
	padding: 0.1em 0.3em;
	border-radius: 0.25em;
	background-color: var(--wp--preset--color--mist);
	font-size: 0.9em;
}

.post-body .wp-block-quote {
	padding-inline-start: 1.25em;
	border-inline-start: 4px solid var(--wp--preset--color--sage);
	font-size: var(--wp--preset--font-size--lead);
}

/* Tables: rules between rows instead of a grid. Columns size to their content (overriding the
   editor's fixed-width default), so on a small screen a wide table scrolls sideways in its frame
   instead of splitting words. */
.post-body .wp-block-table table {
	table-layout: auto;
	border-collapse: collapse;
}

.post-body .wp-block-table :is(th, td) {
	word-break: normal;
	padding: 12px 16px 12px 0;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--sage);
	text-align: start;
	vertical-align: top;
}

.post-body .wp-block-table thead th {
	border-bottom: 2px solid var(--wp--preset--color--ink);
}

/* FAQ: each question opens in place, and the answer is in the page either way */
.post-body .wp-block-details {
	padding-block: 20px;
	border-top: 2px solid var(--wp--preset--color--ink);
}

.post-body .wp-block-details:not(:has(+ .wp-block-details)) {
	border-bottom: 2px solid var(--wp--preset--color--ink);
}

.post-body .wp-block-details + .wp-block-details {
	margin-block-start: 0;
}

.post-body .wp-block-details summary {
	font-weight: 700;
	cursor: pointer;
}

.post-body .wp-block-details > summary + * {
	margin-block-start: 0.75em;
}

.is-style-takeaways {
	padding: var(--wp--preset--spacing--40);
	border-radius: 28px;
	background-color: var(--wp--preset--color--mist);
}

.is-style-callout {
	padding-inline-start: 1.25em;
	border-inline-start: 4px solid var(--wp--preset--color--amber);
}

.post-topic-nav {
	gap: var(--wp--preset--spacing--30);
}

/* Below laptop widths the leaf reaches under the header text, so it fades back. */
@media (max-width: 1023px) {
	.is-style-hero-leaf::before,
	.is-style-leaf-small::before {
		opacity: 0.15;
	}
}

@media (max-width: 781px) {
	.is-style-hero-leaf::before {
		background-size: 300px auto;
	}

	.is-style-leaf-small::before {
		background-position: right -40px bottom -80px;
		background-size: 200px auto;
	}

	.hero-badge {
		bottom: -52px;
	}

	.wp-block-button.is-style-badge .wp-block-button__link {
		width: 104px;
		height: 104px;
		padding: 14px;
		font-size: 0.75rem;
	}

	.is-style-diagonal-top {
		clip-path: polygon(0 48px, 100% 0, 100% 100%, 0 100%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-button.is-style-badge .wp-block-button__link::before {
		animation: none;
	}

	.is-style-reveal .looseleaf-word {
		transition: none;
	}
}
