/**
 * Melonleaf AI — design system.
 *
 * Single shared stylesheet loaded on BOTH the front end and inside the block
 * editor (via enqueue_block_assets) so editor previews match production.
 *
 * Sections:
 *   1. Font face
 *   2. Design tokens (:root)
 *   3. Base / reset
 *   4. Layout primitives
 *   5. Buttons
 *   6. Site header + nav
 *   7. Blocks: hero, feature grid/card, process, CTA
 *   8. FAQ accordion
 *   9. Contact form
 *  10. Site footer
 *  11. Motion / reduced-motion
 */

/* 1. Font face ---------------------------------------------------------- */
@font-face {
	font-family: "Inter var";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("../fonts/inter-var-latin.woff2") format("woff2");
}

/* 2. Design tokens ------------------------------------------------------ */
:root {
	--ml-ink: #0e1b2a;
	--ml-ink-soft: #33415c;
	--ml-muted: #5b6779;
	--ml-line: #e3e8ef;
	--ml-surface: #ffffff;
	--ml-surface-alt: #f6f9fc;
	--ml-surface-dark: #0b1524;
	--ml-brand: #12a565;
	--ml-brand-strong: #0e8a54;
	--ml-brand-tint: #e6f7ef;
	--ml-accent: #1769ff;
	--ml-on-dark: #eaf1fb;
	--ml-on-dark-muted: #9fb2cc;

	--ml-font: "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	/* Fluid type scale (clamp: min, preferred, max). */
	--ml-fs-eyebrow: 0.8125rem;
	--ml-fs-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
	--ml-fs-lead: clamp(1.125rem, 1.05rem + 0.5vw, 1.375rem);
	--ml-fs-h3: clamp(1.125rem, 1.02rem + 0.5vw, 1.375rem);
	--ml-fs-h2: clamp(1.6rem, 1.25rem + 1.7vw, 2.5rem);
	--ml-fs-h1: clamp(2.1rem, 1.55rem + 2.8vw, 3.75rem);

	/* Spacing scale. */
	--ml-space-2xs: 0.5rem;
	--ml-space-xs: 0.75rem;
	--ml-space-sm: 1rem;
	--ml-space-md: 1.5rem;
	--ml-space-lg: 2.5rem;
	--ml-space-xl: 4rem;
	--ml-space-2xl: 6rem;

	--ml-radius: 14px;
	--ml-radius-sm: 10px;
	--ml-radius-pill: 999px;
	--ml-shadow-sm: 0 1px 2px rgba(14, 27, 42, 0.06), 0 1px 3px rgba(14, 27, 42, 0.08);
	--ml-shadow-md: 0 6px 24px rgba(14, 27, 42, 0.08);
	--ml-container: 1180px;
	--ml-container-narrow: 820px;
}

/* 3. Base / reset ------------------------------------------------------- */
.melonleaf-page * {
	box-sizing: border-box;
}

.melonleaf-page {
	margin: 0;
	font-family: var(--ml-font);
	font-size: var(--ml-fs-body);
	line-height: 1.6;
	color: var(--ml-ink);
	background: var(--ml-surface);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

.melonleaf-page img {
	max-width: 100%;
	height: auto;
	display: block;
}

.melonleaf-page a {
	color: var(--ml-brand-strong);
}

.melonleaf-page h1,
.melonleaf-page h2,
.melonleaf-page h3 {
	line-height: 1.15;
	color: var(--ml-ink);
	margin: 0 0 var(--ml-space-sm);
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.melonleaf-page h1 {
	font-size: var(--ml-fs-h1);
	font-weight: 800;
}

.melonleaf-page h2 {
	font-size: var(--ml-fs-h2);
	font-weight: 700;
}

.melonleaf-page h3 {
	font-size: var(--ml-fs-h3);
	font-weight: 650;
}

.melonleaf-page p {
	margin: 0 0 var(--ml-space-sm);
}

/* Accessible skip link + visually-hidden helper. */
.ml-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 1000;
	background: var(--ml-ink);
	color: #fff;
	padding: 0.75rem 1rem;
	border-radius: 0 0 var(--ml-radius-sm) 0;
}
.ml-skip-link:focus {
	left: 0;
}

.ml-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Visible focus everywhere. */
.melonleaf-page :focus-visible {
	outline: 3px solid var(--ml-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* 4. Layout primitives -------------------------------------------------- */
.ml-container {
	width: 100%;
	max-width: var(--ml-container);
	margin-inline: auto;
	padding-inline: clamp(1rem, 0.5rem + 2vw, 2rem);
}

.ml-section {
	padding-block: clamp(3rem, 2rem + 4vw, var(--ml-space-2xl));
}

.ml-section--alt {
	background: var(--ml-surface-alt);
}

.ml-section--dark {
	background: var(--ml-surface-dark);
	color: var(--ml-on-dark);
}
.ml-section--dark h2,
.ml-section--dark h3 {
	color: #fff;
}

.ml-section__head {
	max-width: var(--ml-container-narrow);
	margin: 0 auto clamp(2rem, 1rem + 3vw, 3.5rem);
	text-align: center;
}

.ml-eyebrow {
	display: inline-block;
	font-size: var(--ml-fs-eyebrow);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ml-brand-strong);
	margin: 0 0 var(--ml-space-2xs);
}
.ml-section--dark .ml-eyebrow {
	color: #4fd39b;
}

.ml-section__lead {
	font-size: var(--ml-fs-lead);
	color: var(--ml-muted);
	margin: 0;
}
.ml-section--dark .ml-section__lead {
	color: var(--ml-on-dark-muted);
}

/* 5. Buttons ------------------------------------------------------------ */
.ml-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 44px;
	padding: 0.75rem 1.5rem;
	border-radius: var(--ml-radius-pill);
	font-weight: 650;
	font-size: 1rem;
	line-height: 1.2;
	text-decoration: none;
	border: 2px solid transparent;
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.ml-btn--primary {
	background: var(--ml-brand);
	color: #fff !important;
	box-shadow: var(--ml-shadow-sm);
}
.ml-btn--primary:hover {
	background: var(--ml-brand-strong);
	transform: translateY(-1px);
}
.ml-btn--secondary {
	background: transparent;
	color: var(--ml-ink);
	border-color: var(--ml-line);
}
.ml-section--dark .ml-btn--secondary {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.35);
}
.ml-btn--secondary:hover {
	border-color: var(--ml-brand);
	color: var(--ml-brand-strong);
}
.ml-section--dark .ml-btn--secondary:hover {
	color: #fff;
	border-color: #fff;
}

/* 6. Site header + nav -------------------------------------------------- */
.ml-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: saturate(1.4) blur(8px);
	border-bottom: 1px solid var(--ml-line);
}
.ml-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ml-space-md);
	min-height: 64px;
}
.ml-brand {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	font-weight: 800;
	font-size: 1.15rem;
	color: var(--ml-ink);
	text-decoration: none;
}
.ml-brand svg {
	width: 26px;
	height: 26px;
	color: var(--ml-brand);
}
.ml-nav {
	display: flex;
	align-items: center;
	gap: var(--ml-space-md);
}
.ml-nav__list {
	display: flex;
	align-items: center;
	gap: clamp(0.75rem, 0.3rem + 1vw, 1.5rem);
	list-style: none;
	margin: 0;
	padding: 0;
}
.ml-nav__list a {
	color: var(--ml-ink-soft);
	text-decoration: none;
	font-weight: 550;
	font-size: 0.95rem;
	padding: 0.5rem 0.25rem;
}
.ml-nav__list a:hover {
	color: var(--ml-brand-strong);
}
.ml-nav__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: transparent;
	border: 1px solid var(--ml-line);
	border-radius: var(--ml-radius-sm);
	color: var(--ml-ink);
	cursor: pointer;
}
.ml-nav__toggle svg {
	width: 22px;
	height: 22px;
}

@media (max-width: 860px) {
	.ml-nav__toggle {
		display: inline-flex;
	}
	.ml-nav {
		position: fixed;
		inset: 64px 0 auto 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		background: var(--ml-surface);
		border-bottom: 1px solid var(--ml-line);
		box-shadow: var(--ml-shadow-md);
		padding: var(--ml-space-sm);
		transform: translateY(-8px);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	}
	.ml-nav.is-open {
		transform: translateY(0);
		opacity: 1;
		visibility: visible;
	}
	.ml-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}
	.ml-nav__list a {
		display: block;
		padding: 0.85rem 0.5rem;
		border-bottom: 1px solid var(--ml-line);
		font-size: 1.05rem;
	}
	.ml-nav .ml-btn {
		margin-top: var(--ml-space-xs);
	}
}

/* 7. Hero block --------------------------------------------------------- */
.ml-hero {
	background: linear-gradient(180deg, var(--ml-brand-tint) 0%, var(--ml-surface) 60%);
	padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem);
}
.ml-hero__grid {
	display: grid;
	grid-template-columns: 1.05fr 0.95fr;
	gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
	align-items: center;
}
.ml-hero__lead {
	font-size: var(--ml-fs-lead);
	color: var(--ml-ink-soft);
	max-width: 40ch;
}
.ml-hero__ctas {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ml-space-sm);
	margin-top: var(--ml-space-md);
}
.ml-hero__media img {
	width: 100%;
	border-radius: var(--ml-radius);
	box-shadow: var(--ml-shadow-md);
	aspect-ratio: 14 / 9;
	object-fit: cover;
}
.ml-hero__trust {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ml-space-md);
	margin-top: var(--ml-space-lg);
	padding-top: var(--ml-space-md);
	border-top: 1px solid var(--ml-line);
	list-style: none;
	padding-inline: 0;
}
.ml-hero__trust li {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--ml-ink-soft);
}
.ml-hero__trust svg {
	width: 20px;
	height: 20px;
	color: var(--ml-brand);
	flex: none;
}

@media (max-width: 860px) {
	.ml-hero__grid {
		grid-template-columns: 1fr;
	}
	.ml-hero__media {
		order: -1;
	}
}

/* 8. Feature grid + cards ---------------------------------------------- */
.ml-feature-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
	gap: clamp(1rem, 0.5rem + 1.5vw, 1.75rem);
}
.ml-feature-grid[data-columns="2"] {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}
.ml-card {
	background: var(--ml-surface);
	border: 1px solid var(--ml-line);
	border-radius: var(--ml-radius);
	padding: clamp(1.25rem, 1rem + 1vw, 1.85rem);
	box-shadow: var(--ml-shadow-sm);
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
	height: 100%;
}
.ml-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--ml-shadow-md);
	border-color: #d3f0e2;
}
.ml-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: var(--ml-brand-tint);
	color: var(--ml-brand-strong);
	margin-bottom: var(--ml-space-sm);
}
.ml-card__icon svg {
	width: 26px;
	height: 26px;
}
.ml-card__title {
	font-size: var(--ml-fs-h3);
	margin: 0 0 0.4rem;
}
.ml-card__desc {
	color: var(--ml-muted);
	margin: 0;
	font-size: 1rem;
}
.ml-section--dark .ml-card {
	background: rgba(255, 255, 255, 0.04);
	border-color: rgba(255, 255, 255, 0.12);
	box-shadow: none;
}
.ml-section--dark .ml-card__desc {
	color: var(--ml-on-dark-muted);
}
.ml-section--dark .ml-card__icon {
	background: rgba(79, 211, 155, 0.15);
	color: #4fd39b;
}

/* 9. Process / timeline ------------------------------------------------- */
.ml-process {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: var(--ml-space-md);
	list-style: none;
	margin: 0;
	padding: 0;
}
.ml-process__step {
	position: relative;
	padding-top: var(--ml-space-lg);
}
.ml-process__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--ml-radius-pill);
	background: var(--ml-brand);
	color: #fff;
	font-weight: 800;
	font-size: 1.1rem;
	margin-bottom: var(--ml-space-xs);
}
.ml-process__step::before {
	content: "";
	position: absolute;
	top: calc(var(--ml-space-lg) + 22px);
	left: 44px;
	right: -12px;
	height: 2px;
	background: linear-gradient(90deg, var(--ml-brand) 0%, var(--ml-line) 100%);
}
.ml-process__step:last-child::before {
	display: none;
}
.ml-process__title {
	font-size: 1.05rem;
	margin: 0 0 0.35rem;
}
.ml-process__desc {
	color: var(--ml-muted);
	font-size: 0.95rem;
	margin: 0;
}

@media (max-width: 900px) {
	.ml-process {
		grid-template-columns: 1fr;
		gap: 0;
	}
	.ml-process__step {
		padding-top: var(--ml-space-sm);
		padding-left: 60px;
		padding-bottom: var(--ml-space-md);
	}
	.ml-process__num {
		position: absolute;
		left: 0;
		top: var(--ml-space-sm);
		margin: 0;
	}
	.ml-process__step::before {
		top: calc(var(--ml-space-sm) + 44px);
		left: 21px;
		right: auto;
		bottom: -6px;
		width: 2px;
		height: auto;
		background: linear-gradient(180deg, var(--ml-brand) 0%, var(--ml-line) 100%);
	}
}

/* 10. CTA block --------------------------------------------------------- */
.ml-cta {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	background: radial-gradient(1200px 400px at 50% -20%, rgba(18, 165, 101, 0.25), transparent), var(--ml-surface-dark);
	color: var(--ml-on-dark);
	border-radius: var(--ml-radius);
	padding: clamp(2rem, 1.5rem + 3vw, 3.75rem);
}
.ml-cta h2 {
	color: #fff;
	margin-bottom: var(--ml-space-xs);
}
.ml-cta__sub {
	color: var(--ml-on-dark-muted);
	font-size: var(--ml-fs-lead);
	max-width: 52ch;
	margin: 0 auto var(--ml-space-md);
	text-align: center;
}

/* 11. FAQ accordion ----------------------------------------------------- */
.ml-faq {
	max-width: var(--ml-container-narrow);
	margin-inline: auto;
	display: grid;
	gap: var(--ml-space-xs);
}
.ml-faq__item {
	border: 1px solid var(--ml-line);
	border-radius: var(--ml-radius-sm);
	background: var(--ml-surface);
	overflow: hidden;
}
.ml-faq__item[open] {
	border-color: #cdeede;
	box-shadow: var(--ml-shadow-sm);
}
.ml-faq__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ml-space-sm);
	padding: 1.1rem 1.25rem;
	font-weight: 650;
	font-size: 1.05rem;
	cursor: pointer;
	list-style: none;
	color: var(--ml-ink);
}
.ml-faq__summary::-webkit-details-marker {
	display: none;
}
.ml-faq__icon {
	flex: none;
	width: 22px;
	height: 22px;
	color: var(--ml-brand-strong);
	transition: transform 0.2s ease;
}
.ml-faq__item[open] .ml-faq__icon {
	transform: rotate(180deg);
}
.ml-faq__answer {
	padding: 0 1.25rem 1.25rem;
	color: var(--ml-ink-soft);
}
.ml-faq__answer > :last-child {
	margin-bottom: 0;
}

/* 12. Contact form ------------------------------------------------------ */
.ml-contact {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
	align-items: start;
}
.ml-contact__aside ul {
	list-style: none;
	margin: var(--ml-space-md) 0 0;
	padding: 0;
	display: grid;
	gap: var(--ml-space-sm);
}
.ml-contact__aside li {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
	color: var(--ml-ink-soft);
}
.ml-contact__aside svg {
	width: 22px;
	height: 22px;
	color: var(--ml-brand);
	flex: none;
	margin-top: 2px;
}
.ml-form {
	background: var(--ml-surface);
	border: 1px solid var(--ml-line);
	border-radius: var(--ml-radius);
	padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
	box-shadow: var(--ml-shadow-sm);
	display: grid;
	gap: var(--ml-space-sm);
}
.ml-field {
	display: grid;
	gap: 0.35rem;
}
.ml-field label {
	font-weight: 600;
	font-size: 0.95rem;
}
.ml-field .ml-req {
	color: #c0392b;
}
.ml-field input,
.ml-field textarea {
	font: inherit;
	color: var(--ml-ink);
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--ml-line);
	border-radius: var(--ml-radius-sm);
	background: #fff;
	min-height: 44px;
	width: 100%;
}
.ml-field textarea {
	min-height: 120px;
	resize: vertical;
}
.ml-field input:focus,
.ml-field textarea:focus {
	border-color: var(--ml-brand);
	outline: 3px solid rgba(18, 165, 101, 0.25);
	outline-offset: 0;
}
.ml-field input[aria-invalid="true"],
.ml-field textarea[aria-invalid="true"] {
	border-color: #c0392b;
}
.ml-field__error {
	color: #c0392b;
	font-size: 0.85rem;
	min-height: 1em;
}
/* Honeypot: hidden from humans, present for bots. */
.ml-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.ml-form__status {
	border-radius: var(--ml-radius-sm);
	padding: 0.85rem 1rem;
	font-weight: 550;
	display: none;
}
.ml-form__status.is-visible {
	display: block;
}
.ml-form__status.is-success {
	background: var(--ml-brand-tint);
	color: var(--ml-brand-strong);
	border: 1px solid #bde9d3;
}
.ml-form__status.is-error {
	background: #fdecea;
	color: #b93d31;
	border: 1px solid #f5c6c0;
}
.ml-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--ml-space-sm);
}

@media (max-width: 860px) {
	.ml-contact,
	.ml-form__row {
		grid-template-columns: 1fr;
	}
}

/* 13. Site footer ------------------------------------------------------- */
.ml-footer {
	background: var(--ml-surface-dark);
	color: var(--ml-on-dark-muted);
	padding-block: var(--ml-space-lg);
	font-size: 0.9rem;
}
.ml-footer__inner {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ml-space-md);
	justify-content: space-between;
	align-items: center;
}
.ml-footer a {
	color: var(--ml-on-dark);
}

/* 14. Editor-only tweaks ------------------------------------------------ */
/* Match the front-end font + base colour inside the editor canvas so the
   preview is faithful (block classes already pull from the shared tokens). */
.editor-styles-wrapper {
	font-family: var(--ml-font);
	color: var(--ml-ink);
}
.editor-styles-wrapper .ml-section {
	padding-block: 2.5rem;
}

/* 15. Motion ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.melonleaf-page *,
	.melonleaf-page *::before,
	.melonleaf-page *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}
