/*
 * Leaffin Authority: block styles, components and legacy-content support.
 * Tokens come from theme.json (--wp--preset--*). Loaded on the front end and in the editor.
 */

:root {
	--leaffin-radius: 12px;
	--leaffin-shadow: 0 1px 2px rgba(18, 38, 27, 0.06), 0 8px 24px rgba(18, 38, 27, 0.06);
}

html {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	* {
		transition: none !important;
		animation: none !important;
	}
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--teal);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------- Page rhythm: no block-gap seams between full-width bands ---------- */

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

main.wp-block-group > .alignfull {
	margin-block-start: 0;
	margin-block-end: 0;
}

/* ---------- Header ---------- */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 50;
}

.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 32px);
}

.leaffin-header {
	background: rgba(255, 255, 255, 0.97);
	border-bottom: 1px solid var(--wp--preset--color--line);
	padding-top: 0.75rem;
	padding-bottom: 0.75rem;
}

.leaffin-header__inner {
	gap: 1.5rem;
}

.leaffin-logo {
	margin: 0;
	line-height: 0;
}

.leaffin-logo img {
	width: 176px;
	max-width: 100%;
	height: auto;
	border-radius: 0;
}

/* ---------- Hero ---------- */

.leaffin-hero {
	padding-top: clamp(2.5rem, 6vw, 5rem);
	padding-bottom: clamp(2.5rem, 6vw, 5rem);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.leaffin-hero h1 {
	font-size: var(--wp--preset--font-size--hero);
	line-height: 1.1;
	margin-top: 0.5rem;
}

.leaffin-hero__lead {
	font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--muted);
	max-width: 36em;
}

.leaffin-hero__visual img {
	width: 100%;
	height: auto;
	border-radius: 20px;
	box-shadow: var(--leaffin-shadow);
}

.leaffin-chips {
	gap: 0.5rem;
}

/* ---------- Stat strip ---------- */

.leaffin-stats {
	padding-top: 1.75rem;
	padding-bottom: 1.75rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.leaffin-stat {
	text-align: center;
}

.leaffin-stat__value {
	font-family: var(--wp--preset--font-family--poppins);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: 1;
	margin: 0;
	color: var(--wp--preset--color--green-dark);
}

.leaffin-stat__label {
	margin: 0.25rem 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

/* ---------- Sections ---------- */

.leaffin-section {
	padding-top: clamp(2.5rem, 5vw, 4rem);
	padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.leaffin-section > h2:first-child,
.leaffin-section__head h2 {
	margin-top: 0;
}

.leaffin-section__intro {
	color: var(--wp--preset--color--muted);
	max-width: 42em;
}

/* ---------- Eyebrow, badge ---------- */

p.is-style-eyebrow {
	font-family: var(--wp--preset--font-family--poppins);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--teal);
	margin-bottom: 0;
}

p.is-style-badge,
.wp-block-post-terms a {
	display: inline-block;
	font-family: var(--wp--preset--font-family--poppins);
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	padding: 0.45rem 0.8rem;
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	color: var(--wp--preset--color--green-dark);
}

p.is-style-badge a {
	text-decoration: none;
	color: inherit;
}

p.is-style-badge:hover,
.wp-block-post-terms a:hover {
	border-color: var(--wp--preset--color--green);
	color: var(--wp--preset--color--teal);
}

.wp-block-post-terms {
	margin: 0;
}

/* ---------- Cards ---------- */

.wp-block-group.is-style-card,
.leaffin-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--leaffin-radius);
	padding: 1.5rem;
	transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.leaffin-card:hover,
.leaffin-card:focus-within {
	box-shadow: var(--leaffin-shadow);
	border-color: var(--wp--preset--color--green);
}

.leaffin-card h3 {
	margin-top: 0.25rem;
}

.leaffin-card p {
	margin-top: 0.5rem;
}

.leaffin-card__link {
	font-family: var(--wp--preset--font-family--poppins);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
}

.leaffin-card__link a {
	text-decoration: none;
}

.leaffin-card__link a::after {
	content: " \2192";
}

.leaffin-card--post {
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.leaffin-card--post .wp-block-post-featured-image {
	margin: 0;
}

.leaffin-card--post .wp-block-post-featured-image img {
	aspect-ratio: 16 / 10;
	object-fit: cover;
	width: 100%;
	border-radius: 0;
}

.leaffin-card__body {
	padding: 1.25rem 1.5rem 1.5rem;
}

.leaffin-card--post h3 {
	font-size: var(--wp--preset--font-size--large);
	margin: 0.5rem 0;
}

.leaffin-card--post .wp-block-post-excerpt {
	font-size: var(--wp--preset--font-size--small);
	margin: 0.5rem 0 0.75rem;
}

.leaffin-card--post .wp-block-post-excerpt__more-link {
	display: none;
}

/* ---------- Dark sections / footer ---------- */

.leaffin-dark,
.leaffin-footer {
	background: var(--wp--preset--color--deep);
	color: #e9f3e4;
}

.leaffin-dark h1,
.leaffin-dark h2,
.leaffin-dark h3,
.leaffin-dark h4,
.leaffin-dark p,
.leaffin-dark li,
.leaffin-footer h2,
.leaffin-footer h3,
.leaffin-footer h4,
.leaffin-footer p,
.leaffin-footer li {
	color: inherit;
}

.leaffin-dark a,
.leaffin-footer a {
	color: #ffffff;
}

.leaffin-dark a:hover,
.leaffin-footer a:hover {
	color: var(--wp--preset--color--mint);
}

.leaffin-footer {
	padding-top: 3rem;
	padding-bottom: 2rem;
	margin-top: 0;
}

.leaffin-footer h3 {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	margin: 0 0 0.75rem;
}

.leaffin-footer ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.leaffin-footer li {
	margin: 0.35rem 0;
	font-size: var(--wp--preset--font-size--small);
}

.leaffin-footer a {
	text-decoration: none;
}

.leaffin-footer a:hover {
	text-decoration: underline;
}

.leaffin-footer__legal {
	border-top: 1px solid rgba(255, 255, 255, 0.18);
	margin-top: 2rem;
	padding-top: 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.85;
}

.leaffin-footer__logo img {
	width: 160px;
	height: auto;
	background: #ffffff;
	padding: 0.5rem 0.75rem;
	border-radius: 10px;
}

.leaffin-newsletter {
	padding: clamp(2rem, 5vw, 3.5rem);
	border-radius: 20px;
	text-align: center;
}

.leaffin-newsletter h2 {
	margin-top: 0;
}

.leaffin-newsletter .wp-block-button__link {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--deep);
}

.leaffin-newsletter .wp-block-button__link:hover {
	background: var(--wp--preset--color--mint);
	color: var(--wp--preset--color--deep);
}

/* ---------- Buttons ---------- */

.wp-block-button.is-style-outline-green .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--green-dark);
	border: 2px solid var(--wp--preset--color--green);
}

.wp-block-button.is-style-outline-green .wp-block-button__link:hover {
	background: var(--wp--preset--color--mint);
	color: var(--wp--preset--color--green-dark);
}

/* ---------- Article ---------- */

.leaffin-article__head {
	padding-top: clamp(2rem, 4vw, 3.5rem);
}

.leaffin-article__head h1 {
	margin-top: 0.75rem;
	font-size: clamp(1.875rem, 4vw, 2.75rem);
}

.leaffin-subtitle {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.55;
	color: var(--wp--preset--color--muted);
}

.leaffin-meta {
	gap: 0.5rem 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.leaffin-meta p,
.leaffin-meta div {
	margin: 0;
}

.leaffin-article .wp-block-post-content > * + h2 {
	padding-top: 0.5rem;
}

.wp-block-post-content figcaption,
.wp-block-image figcaption {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	text-align: left;
	margin-top: 0.5rem;
}

/* Callouts: design principle, learn box, formula, thumb rule, choice rule, troubleshoot, sources */

.wp-block-group.is-style-design-principle,
.wp-block-group.is-style-learn-box,
.wp-block-group.is-style-formula,
.wp-block-group.is-style-thumb-rule,
.wp-block-group.is-style-choice-rule,
.wp-block-group.is-style-troubleshoot,
.wp-block-group.is-style-sources {
	border-radius: var(--leaffin-radius);
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--wp--preset--color--line);
	border-left-width: 5px;
	background: var(--wp--preset--color--surface);
}

.wp-block-group.is-style-design-principle {
	background: var(--wp--preset--color--water);
	border-color: var(--wp--preset--color--teal);
}

.wp-block-group.is-style-design-principle p:not(.leaffin-callout-label) {
	font-family: var(--wp--preset--font-family--poppins);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
	line-height: 1.4;
}

.wp-block-group.is-style-learn-box {
	background: var(--wp--preset--color--mint);
	border-color: var(--wp--preset--color--green);
}

.wp-block-group.is-style-formula {
	border-color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--surface);
}

.wp-block-group.is-style-formula .leaffin-equation {
	font-family: "Cambria Math", "STIX Two Math", Georgia, serif;
	font-size: var(--wp--preset--font-size--large);
	margin: 0.5rem 0;
	overflow-x: auto;
}

.wp-block-group.is-style-thumb-rule {
	background: #fdf6e3;
	border-color: var(--wp--preset--color--amber);
}

.wp-block-group.is-style-choice-rule {
	background: var(--wp--preset--color--mint);
	border-color: var(--wp--preset--color--green-dark);
}

.wp-block-group.is-style-troubleshoot {
	background: #fff4f1;
	border-color: #c4472d;
}

.wp-block-group.is-style-sources {
	background: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--line);
	font-size: var(--wp--preset--font-size--small);
}

.leaffin-callout-label {
	font-family: var(--wp--preset--font-family--poppins);
	font-size: 0.75rem !important;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	margin: 0 0 0.5rem !important;
	color: var(--wp--preset--color--green-dark);
}

.is-style-troubleshoot .leaffin-callout-label {
	color: #a33a24;
}

.is-style-thumb-rule .leaffin-callout-label {
	color: #8a6410;
}

.is-style-design-principle .leaffin-callout-label {
	color: var(--wp--preset--color--teal);
}

.wp-block-group[class*="is-style-"] > :last-child {
	margin-bottom: 0;
}

/* Checklist */

ul.is-style-checklist {
	list-style: none;
	padding-left: 0;
}

ul.is-style-checklist li {
	position: relative;
	padding-left: 1.75rem;
	margin: 0.4rem 0;
}

ul.is-style-checklist li::before {
	content: "\2713";
	position: absolute;
	left: 0;
	top: 0;
	font-weight: 700;
	color: var(--wp--preset--color--green);
}

/* ---------- Tables (block tables and legacy TablePress comparison tables) ---------- */

.wp-block-table,
.tablepress-scroll-wrapper {
	overflow-x: auto;
}

.wp-block-table table,
table.tablepress.tablepress {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	border: 1px solid var(--wp--preset--color--line);
}

.wp-block-table th,
.wp-block-table td,
table.tablepress.tablepress th,
table.tablepress.tablepress td {
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--wp--preset--color--line);
	text-align: left;
	vertical-align: top;
}

.wp-block-table thead th,
table.tablepress.tablepress thead th {
	background: var(--wp--preset--color--deep);
	color: #ffffff;
	font-family: var(--wp--preset--font-family--poppins);
	font-weight: 600;
}

.wp-block-table tbody tr:nth-child(even) td,
table.tablepress.tablepress tbody tr:nth-child(even) td {
	background: var(--wp--preset--color--base);
}

.wp-block-table tbody tr:hover td,
table.tablepress.tablepress tbody tr:hover td {
	background: var(--wp--preset--color--mint);
}

.wp-block-table figcaption {
	font-weight: 600;
}

/* ---------- Pagination, search ---------- */

.wp-block-query-pagination {
	gap: 1rem;
	font-family: var(--wp--preset--font-family--poppins);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-query-pagination a {
	text-decoration: none;
}

.wp-block-search__input {
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	padding: 0.6rem 1rem;
	background: var(--wp--preset--color--surface);
}

.wp-block-search .wp-block-search__button {
	border-radius: 999px;
}

/* ---------- Archive header ---------- */

.leaffin-archive-head {
	padding-top: clamp(2rem, 4vw, 3.5rem);
	padding-bottom: 1.5rem;
}

.leaffin-archive-head h1 {
	margin-top: 0.5rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 781px) {
	.leaffin-header__inner {
		gap: 0.75rem;
	}

	.leaffin-logo img {
		width: 140px;
	}

	.leaffin-stat {
		text-align: left;
	}
}
