/**
 * Harvesta block styles (front end + editor).
 *
 * Design idea: the grower's year. Growers think in months, so the one device is the
 * 12-month season strip: a thin row of twelve cells (J F M A M J J A S O N D) with the
 * current month marked in beet. It appears in the hero ("This week's box") and in the
 * "In season" table, where each crop's months are filled in leaf green. Everything else
 * is quiet: hairline rules, generous space, radii of 3-6px, no shadows, no gradient washes.
 *
 * Rules for humans and AI agents:
 * - Use the design tokens only: var(--wp--preset--color--*), --font-size--*, --spacing--*,
 *   var(--wp--custom--radius--*) and var(--wp--custom--drawing-filter). Never hard-code a colour here.
 * - Beet (accent) marks only the current month and "new this week". Do not use it elsewhere.
 * - Each section below is one block style or one helper class used by the patterns.
 */

/* ---------- Layout ---------- */

.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block-start: 0;
}

/* Full-width sections sit edge to edge (no strip between bands). */
:where(.wp-site-blocks main, .wp-block-post-content) > .alignfull {
	margin-block-start: 0;
	margin-block-end: 0;
}

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

h1,
h2,
h3 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* Section intros are left aligned on the wide grid, with a readable line length. */
.harvesta-intro > * {
	max-width: 42rem;
}

/* Small labels: sentence case, never all caps. */
.harvesta-label {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0;
	color: var(--wp--preset--color--ink-soft);
}

/* Text for screen readers only (the season strips use it to name their months). */
.harvesta-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

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

.harvesta-topbar a {
	color: inherit;
	font-weight: 600;
}

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

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

/* No backdrop-filter on the header: it would trap the mobile menu overlay inside the header. */
.harvesta-header {
	border-bottom: 1px solid var(--wp--preset--color--line);
	background-color: color-mix(in srgb, var(--wp--preset--color--base) 97%, transparent);
}

/* Brand mark in front of the site title (hidden once a logo is set): a sprout on a leaf-green square. */
.harvesta-header .wp-block-site-title a {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
}

.harvesta-header .wp-block-site-title a::before {
	content: "";
	flex: none;
	width: 2.1rem;
	height: 2.1rem;
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--primary);
	background-image: url("../images/icons/sprout.svg");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 64%;
}

.harvesta-header .wp-block-site-logo + .wp-block-site-title a::before {
	display: none;
}

@media (max-width: 781px) {
	.harvesta-header-cta {
		display: none !important;
	}

	/* Keep the sticky header short on phones: show only the phone line. */
	.harvesta-topbar .wp-block-group > p:first-child {
		display: none;
	}

	.harvesta-topbar .wp-block-group {
		justify-content: center !important;
	}
}

.wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--50);
}

/* ---------- Footer ---------- */

.harvesta-footer a {
	color: inherit;
	text-decoration: none;
}

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

.harvesta-muted {
	opacity: 0.74;
}

.harvesta-footer .wp-block-separator {
	opacity: 0.22;
}

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

.harvesta-hero h1 {
	font-size: var(--wp--preset--font-size--display);
	line-height: var(--wp--custom--line-height--display);
	letter-spacing: -0.03em;
	max-width: 12ch;
}

.harvesta-hero .harvesta-lead {
	max-width: 34rem;
}

/* ---------- Block style: Group "Packing slip" ---------- */

.is-style-harvesta-card {
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: var(--wp--custom--radius--md);
	padding: var(--wp--preset--spacing--50);
	box-sizing: border-box;
}

.is-layout-grid > .is-style-harvesta-card {
	height: 100%;
}

/* The box list on the packing slip: item on the left, amount on the right. */
.harvesta-packlist > .wp-block-group {
	padding-block: 0.55rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
	margin-block-start: 0;
	gap: var(--wp--preset--spacing--30);
	align-items: baseline;
}

.harvesta-packlist p {
	margin: 0;
}

.harvesta-packlist > .wp-block-group > p:last-child {
	flex: none;
	color: var(--wp--preset--color--ink-soft);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* "new this week": beet, small, sentence case. */
.harvesta-new {
	display: inline-block;
	margin-inline-start: 0.45em;
	padding: 0 0.4em;
	border: 1px solid currentColor;
	border-radius: var(--wp--custom--radius--sm);
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}

/* ---------- The season strip (the one bold device) ---------- */

/*
 * One paragraph with twelve <span> cells, January to December (built by harvesta_season_strip()).
 * .is-in   = in season (leaf green, letter in base colour)
 * .is-now  = the current month (beet bar under the cell; filled beet in the hero strip)
 */
.harvesta-strip {
	--cell: 1.75rem;
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 2px;
	max-width: 24rem;
	margin: 0;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.harvesta-strip > span[aria-hidden] {
	position: relative;
	display: grid;
	place-items: center;
	height: var(--cell);
	background-color: var(--wp--preset--color--surface-2);
	color: var(--wp--preset--color--ink-soft);
	isolation: isolate;
}

.harvesta-strip > span[aria-hidden]:first-child,
.harvesta-strip > .harvesta-sr + span {
	border-radius: var(--wp--custom--radius--sm) 0 0 var(--wp--custom--radius--sm);
}

.harvesta-strip > span:last-child {
	border-radius: 0 var(--wp--custom--radius--sm) var(--wp--custom--radius--sm) 0;
}

.harvesta-strip > span.is-in {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

/* This month: a beet bar under the cell, so the current month reads as a column down the table. */
.harvesta-strip > span.is-now::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -6px;
	height: 3px;
	background-color: var(--wp--preset--color--accent);
}

/* Hero strip: taller cells, the current month filled with beet. */
.harvesta-strip.is-hero {
	--cell: 2.6rem;
	max-width: none;
	font-size: var(--wp--preset--font-size--small);
}

.harvesta-strip.is-hero > span[aria-hidden] {
	background-color: var(--wp--preset--color--surface);
}

.harvesta-strip.is-hero > span.is-now {
	color: var(--wp--preset--color--base);
}

.harvesta-strip.is-hero > span.is-now::after {
	display: none;
}

.harvesta-strip.is-hero > span.is-now::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background-color: var(--wp--preset--color--accent);
	transform-origin: 50% 100%;
	animation: harvesta-fill 0.38s ease-out;
}

/*
 * The one motion moment: on load the current month fills from the bottom, like a crate being filled.
 * The first and last keyframes are the finished state, so a static capture always shows it filled.
 */
@keyframes harvesta-fill {
	0%,
	100% {
		transform: none;
	}

	8% {
		transform: scaleY(0);
	}
}

/* Legend under the In season table. */
.harvesta-legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-soft);
}

.harvesta-legend span {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.harvesta-legend span::before {
	content: "";
	width: 1rem;
	height: 1rem;
	border-radius: var(--wp--custom--radius--sm);
	background-color: var(--wp--preset--color--primary);
}

.harvesta-legend span.is-now::before {
	height: 3px;
	border-radius: 0;
	background-color: var(--wp--preset--color--accent);
}

/* ---------- In season: one row per crop ---------- */

.harvesta-produce {
	border-bottom: 1px solid var(--wp--preset--color--ink);
}

.harvesta-produce > .wp-block-group {
	display: grid;
	grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr) minmax(15rem, 22rem);
	align-items: center;
	column-gap: var(--wp--preset--spacing--50);
	padding-block: var(--wp--preset--spacing--30) calc(var(--wp--preset--spacing--30) + 4px);
	border-top: 1px solid var(--wp--preset--color--ink);
	margin-block-start: 0 !important;
}

.harvesta-produce > .wp-block-group > * {
	margin: 0 !important;
}

.harvesta-produce h3 {
	font-size: var(--wp--preset--font-size--large);
}

.harvesta-produce .harvesta-strip {
	max-width: none;
}

@media (max-width: 781px) {
	.harvesta-produce > .wp-block-group {
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--wp--preset--spacing--20);
	}
}

/* ---------- How the box works: a week, left to right ---------- */

.harvesta-week > .wp-block-group {
	border-top: 1px solid var(--wp--preset--color--ink);
	padding-top: var(--wp--preset--spacing--40);
}

/* Step number: only for real sequences. */
.harvesta-mark {
	display: inline-grid;
	place-items: center;
	width: 2.2rem;
	height: 2.2rem;
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: var(--wp--custom--radius--sm);
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	line-height: 1;
}

/* ---------- Box sizes: a price board, one row per size ---------- */

.harvesta-boxes {
	border-bottom: 1px solid var(--wp--preset--color--ink);
}

.harvesta-boxes > .wp-block-group {
	display: grid;
	grid-template-columns: minmax(10rem, 1fr) minmax(0, 1.4fr) minmax(8rem, 0.7fr) max-content;
	align-items: center;
	column-gap: var(--wp--preset--spacing--50);
	padding-block: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--wp--preset--color--ink);
	margin-block-start: 0 !important;
}

.harvesta-boxes > .wp-block-group > * {
	margin: 0 !important;
}

.harvesta-boxes h3 {
	font-size: var(--wp--preset--font-size--x-large);
}

.harvesta-boxes h3 + p {
	margin-top: 0.3rem !important;
}

.harvesta-price {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.harvesta-price small {
	display: block;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	color: var(--wp--preset--color--ink-soft);
}

@media (max-width: 781px) {
	.harvesta-boxes > .wp-block-group {
		grid-template-columns: minmax(0, 1fr) max-content;
		row-gap: var(--wp--preset--spacing--20);
	}

	.harvesta-boxes > .wp-block-group > :first-child,
	.harvesta-boxes > .wp-block-group > :nth-child(2) {
		grid-column: 1 / -1;
	}
}

/* ---------- Rows: opening hours, pick-your-own crops ---------- */

.harvesta-rows > .wp-block-group {
	padding-block: 0.65rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
	margin-block-start: 0;
	gap: var(--wp--preset--spacing--30);
}

.harvesta-rows > .wp-block-group:last-child {
	border-bottom: 0;
}

.harvesta-rows p {
	margin: 0;
}

.harvesta-rows > .wp-block-group > p:last-child {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

/* ---------- Open days: dated rows ---------- */

.harvesta-dates > .wp-block-group {
	display: grid;
	grid-template-columns: 9rem minmax(0, 1fr);
	column-gap: var(--wp--preset--spacing--40);
	padding-block: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--wp--preset--color--ink);
	margin-block-start: 0 !important;
}

.harvesta-dates > .wp-block-group > * {
	margin: 0 !important;
}

.harvesta-dates > .wp-block-group > p:first-child {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.harvesta-dates h3 + p {
	margin-top: 0.3rem !important;
}

@media (max-width: 599px) {
	.harvesta-dates > .wp-block-group {
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--wp--preset--spacing--10);
	}
}

/* ---------- Ruled blocks: reviews and contact details ---------- */

.harvesta-ruled,
.harvesta-quote {
	border-top: 1px solid var(--wp--preset--color--ink);
	padding-top: var(--wp--preset--spacing--40);
}

.harvesta-quote > p:first-child {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.45;
}

/* ---------- Helper: 4-item grid (4 → 2 → 1 columns, never 3 + 1) ---------- */

@media (max-width: 1100px) {
	.wp-block-group.harvesta-grid-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 599px) {
	.wp-block-group.harvesta-grid-4 {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}

/* ---------- Block style: Image "Icon tile" ---------- */

.wp-block-image.is-style-harvesta-icon {
	width: 2.75rem;
	height: 2.75rem;
	padding: 0.6rem;
	margin: 0;
	box-sizing: border-box;
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--primary);
	flex: none;
}

.wp-block-image.is-style-harvesta-icon img {
	display: block;
	width: 100%;
	height: 100%;
}

/* ---------- Block style: Image "Photo" ---------- */

.wp-block-image.is-style-harvesta-photo img {
	border-radius: var(--wp--custom--radius--lg);
}

/* ---------- Block style: Image "Line drawing" ---------- */

.wp-block-image.is-style-harvesta-drawing {
	margin: 0;
}

.wp-block-image.is-style-harvesta-drawing img {
	display: block;
	height: auto;
	filter: var(--wp--custom--drawing-filter, none);
}

/* ---------- Block style: List "Leaf ticks" ---------- */

.is-style-harvesta-check {
	list-style: none;
	padding-left: 0;
}

.is-style-harvesta-check li {
	position: relative;
	padding-left: 2rem;
	margin-block: 0.5rem;
}

.is-style-harvesta-check li::before {
	content: "";
	position: absolute;
	left: 0.1rem;
	top: 0.3em;
	width: 1.15rem;
	height: 1.15rem;
	background-color: var(--wp--preset--color--primary);
	-webkit-mask: url("../images/icons/check.svg") center / contain no-repeat;
	mask: url("../images/icons/check.svg") center / contain no-repeat;
}

/* ---------- Details (FAQ) ---------- */

.wp-block-details {
	border-bottom: 1px solid var(--wp--preset--color--ink);
	padding-block: var(--wp--preset--spacing--30);
}

.wp-block-details summary {
	cursor: pointer;
	list-style: none;
	position: relative;
	padding-right: 2.5rem;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::after {
	content: "+";
	position: absolute;
	right: 0.25rem;
	top: 50%;
	transform: translateY(-50%);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 400;
	font-size: 1.5em;
	line-height: 1;
	color: var(--wp--preset--color--primary);
}

.wp-block-details[open] summary::after {
	content: "\2013";
}

.wp-block-details > :not(summary) {
	color: var(--wp--preset--color--ink-soft);
}

/* ---------- Posts ---------- */

.harvesta-post-card .wp-block-post-featured-image img {
	border-radius: var(--wp--custom--radius--lg);
}

.wp-block-post-excerpt__more-link {
	font-weight: 600;
}

/* ---------- Accessibility ---------- */

:where(a, button, summary, input):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.harvesta-strip.is-hero > span.is-now::before {
		animation: none;
	}
}

/* Dropdown menus: solid panel on desktop. */
.wp-block-navigation:not(.is-menu-open) .wp-block-navigation__submenu-container { background-color: var(--wp--preset--color--base) !important; color: var(--wp--preset--color--ink) !important; border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 12%, transparent) !important; border-radius: 10px; box-shadow: 0 12px 30px color-mix(in srgb, var(--wp--preset--color--ink) 14%, transparent); padding: .4rem 0; min-width: 210px !important; }
.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: .5rem 1.1rem; font-size: var(--wp--preset--font-size--small); color: inherit; }
.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover { background-color: color-mix(in srgb, var(--wp--preset--color--ink) 6%, transparent); }

/* Mobile menu: right-hand side panel (simple fade-in) with logo, divided list, tap-to-open child items, contact lines and button. */
.wp-block-navigation__responsive-container.is-menu-open { background-color: color-mix(in srgb, var(--wp--preset--color--ink) 45%, transparent) !important; color: var(--wp--preset--color--ink) !important; padding: 0 !important; animation: lt-menu-fade .3s ease-out !important; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close { position: relative; width: min(86vw, 360px); max-width: none; height: 100%; margin: 0 0 0 auto; background-color: var(--wp--preset--color--base); box-shadow: -8px 0 30px color-mix(in srgb, var(--wp--preset--color--ink) 18%, transparent); overflow-y: auto; animation: none !important; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog { padding: 1.1rem 1.4rem 2rem; margin: 0 !important; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close { top: 1.25rem; right: 1.1rem; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg { width: 28px; height: 28px; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content { padding-top: 1.75rem !important; gap: 0 !important; font-size: var(--wp--preset--font-size--medium); align-items: stretch !important; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container { gap: 0 !important; width: 100%; align-items: stretch !important; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item { display: flex; flex-direction: row !important; flex-wrap: wrap; align-items: center !important; width: 100%; border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 12%, transparent); }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content { flex: 1; padding: .85rem 0; font-weight: 600; color: inherit; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container { flex-basis: 100%; display: none !important; border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 0 0 .7rem 1rem !important; gap: 0 !important; font-size: var(--wp--preset--font-size--small); }
.wp-block-navigation__responsive-container.is-menu-open .lt-sub-open > .wp-block-navigation__submenu-container { display: flex !important; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: .45rem 0 !important; color: color-mix(in srgb, var(--wp--preset--color--ink) 78%, transparent); }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover, .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus { color: var(--wp--preset--color--primary); }
.lt-sub-toggle { display: none; }
.wp-block-navigation__responsive-container.is-menu-open .lt-sub-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -.6rem; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; transition: transform .2s; }
.wp-block-navigation__responsive-container.is-menu-open .lt-sub-open > .lt-sub-toggle { transform: rotate(90deg); }
.lt-menu-brand, .lt-menu-extra { display: none; }
.is-menu-open .lt-menu-brand { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: 0 3rem 0 0 !important; margin: 0 !important; position: static !important; background: none !important; border: 0 !important; box-shadow: none !important; }
.is-menu-open .lt-menu-brand > * { display: flex; align-items: center; gap: .6rem; margin: 0; }
.is-menu-open .lt-menu-brand .wp-block-site-title { font-size: var(--wp--preset--font-size--large); }
.is-menu-open .lt-menu-brand a { color: inherit; text-decoration: none; }
.is-menu-open .lt-menu-extra { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.5rem; font-size: var(--wp--preset--font-size--small); color: color-mix(in srgb, var(--wp--preset--color--ink) 75%, transparent); }
.is-menu-open .lt-menu-extra p { margin: 0; }
.is-menu-open .lt-menu-extra a { color: var(--wp--preset--color--primary); }
.is-menu-open .lt-menu-cta { display: flex !important; margin-top: .75rem; }
.is-menu-open .lt-menu-cta .wp-block-button, .is-menu-open .lt-menu-cta .wp-block-button__link { width: 100%; text-align: center; }
.is-menu-open .lt-menu-cta .wp-block-button__link { color: var(--wp--preset--color--base); }
@keyframes lt-menu-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wp-block-navigation__responsive-container.is-menu-open { animation: none !important; } }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container { --navigation-layout-justification-setting: flex-start; --navigation-layout-justify: flex-start; --navigation-layout-align: flex-start; text-align: left; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container { align-items: flex-start !important; }
