/*
Theme Name: LocaLeaf Nursery
Theme URI: https://localeaf.ca
Author: LocaLeaf Gardens
Author URI: https://localeaf.ca
Description: Custom child theme for LocaLeaf Gardens — a native plant micro-nursery and social enterprise in Aylmer, Gatineau, QC. Features a warm terracotta and sage green palette with Special Elite and DM Sans typography.
Template: twentytwentyfive
Version: 1.0.0
Requires at least: 6.7
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: localeaf-nursery
Tags: block-theme, custom-colors, custom-fonts, native-plants
*/

/* Remove block-gap margins between header, main, and footer on homepage */
body.home .wp-site-blocks > * {
	margin-block-start: 0;
}

/* ── S.0  Transparent header overlay on homepage ────────────────────── */

/* Pin header to viewport top — always visible, starts transparent */
body.home header.wp-block-template-part {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 100;
}

/* Only the dark nav bar goes transparent; terracotta strip stays opaque */
body.home header.wp-block-template-part > .has-contrast-background-color {
	background-color: transparent !important;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* Language switcher restyle deferred to Phase 4 task 4.1 */

/* Scrolled state: restore dark nav background + add shadow */
body.home header.wp-block-template-part.header-scrolled > .has-contrast-background-color {
	background-color: var(--wp--preset--color--contrast) !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Push hero content below the overlaid header and expand hero to compensate */
body.home main > .wp-block-cover:first-child {
	padding-top: calc(var(--wp--preset--spacing--80) + 10rem) !important;
	min-height: calc(420px + 10rem) !important;
}

/* ── Site logo — constrain SVG (block width attr doesn't apply to SVGs) */
.wp-block-site-logo img {
	width: 75px;
	height: auto;
}

/* ── Header brand: logo + site title ─────────────────────────────── */

.localeaf-header-brand .wp-block-site-logo img {
	width: 75px;
	height: auto;
	border-radius: 0 !important;
}

@media (max-width: 768px) {
	.localeaf-header-brand .wp-block-site-logo img {
		width: 50px;
		height: auto;
	}
}

/* ── Header search toggle — icon button that opens dropdown ──────── */

.localeaf-search-toggle {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s ease;
}
.localeaf-search-toggle:hover {
	color: var(--wp--preset--color--accent-3);
}
.localeaf-search-toggle[aria-expanded="true"] {
	color: var(--wp--preset--color--accent-1);
}

/* Search dropdown bar */
.localeaf-search-dropdown {
	padding: 8px var(--wp--preset--spacing--50, 30px);
	max-width: var(--wp--style--global--wide-size, 990px);
	margin: 0 auto;
}
.localeaf-search-dropdown[hidden] {
	display: none;
}
.localeaf-search-form {
	display: flex;
	max-width: 500px;
	margin: 0 auto;
}
.localeaf-search-form__input {
	flex: 1;
	font-family: var(--wp--preset--font-family--dm-sans);
	font-size: 14px;
	padding: 6px 12px;
	border: 1px solid rgba(255,255,255,0.4);
	border-right: none;
	border-radius: 4px 0 0 4px;
	background: rgba(255,255,255,0.7);
	color: #333;
	outline: none;
}
.localeaf-search-form__input::placeholder {
	color: #999;
}
.localeaf-search-form__input:focus {
	border-color: var(--wp--preset--color--accent-1);
	background: rgba(255,255,255,0.85);
}
.localeaf-search-form__submit {
	background: var(--wp--preset--color--accent-1);
	color: #fff;
	border: none;
	padding: 6px 12px;
	border-radius: 0 4px 4px 0;
	cursor: pointer;
	display: flex;
	align-items: center;
}
.localeaf-search-form__submit:hover {
	background: #B8602A;
}

/* ── Header utilities — mobile responsive ────────────────────────── */

@media (max-width: 768px) {
	.localeaf-header-utils {
		gap: 8px !important;
	}
	.localeaf-header-utils > p a {
		font-size: 0 !important;
	}
	.localeaf-header-utils > p a svg {
		width: 18px;
		height: 18px;
	}
}

/* ── Reduce top spacing on content pages ──────────────────────────── */

/* TT5 page/single templates use spacing-60 margin + spacing-60 padding — too much */
/* Exclude single posts (hero cover handles its own spacing) and homepage */
body:not(.single):not(.home) .wp-site-blocks main.wp-block-group {
	margin-top: var(--wp--preset--spacing--50) !important;
}

body:not(.single):not(.home) .wp-site-blocks main.wp-block-group > .wp-block-group.alignfull {
	padding-top: var(--wp--preset--spacing--40) !important;
}

/* ── Content images — cap at 645px, center, white frame + shadow ──── */

.wp-block-image:not(.alignfull):not(.alignwide):not(.alignleft):not(.alignright) {
	max-width: 645px;
	margin-left: auto;
	margin-right: auto;
}

.wp-block-image:not(.alignfull):not(.alignwide) img {
	padding: 6px;
	background: #FFFFFF;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

/* ── Blog post hero — remove gap between header and cover ─────────── */

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

/* ── Blog post sidebar layout ─────────────────────────────────────── */

/* Sidebar column styling */
.localeaf-blog-sidebar {
	border-left: 1px solid var(--wp--preset--color--accent-5, #F5F5F5);
	padding-left: var(--wp--preset--spacing--50, 30px);
}

/* Allow flex column to shrink below content intrinsic width */
.localeaf-blog-content {
	min-width: 0;
	overflow: hidden;
}

/* Images in blog content should not exceed their column */
.localeaf-blog-content .wp-block-image img {
	max-width: 100%;
	height: auto;
}

/* Mobile: stack columns vertically */
@media (max-width: 768px) {
	.localeaf-blog-content,
	.localeaf-blog-sidebar {
		flex-basis: 100% !important;
	}

	/* Force the two-column flex to stack */
	.localeaf-blog-content + .localeaf-blog-sidebar {
		flex-basis: 100% !important;
	}

	.localeaf-blog-sidebar {
		border-left: none;
		border-top: 1px solid var(--wp--preset--color--accent-5, #F5F5F5);
		padding-left: 0;
		padding-top: var(--wp--preset--spacing--50, 30px);
	}
}

/* Ensure the parent flex container stacks on mobile */
@media (max-width: 768px) {
	.localeaf-blog-content:has(~ .localeaf-blog-sidebar),
	.is-layout-flex:has(.localeaf-blog-content) {
		flex-wrap: wrap !important;
	}
}

/* ── Blog post card separation (#4, #12) ─────────────────────────── */

.localeaf-blog-grid .blog-card {
	background: var(--wp--preset--color--accent-5, #F5F5F5);
	border: none;
	border-radius: 0;
	padding: 16px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

.localeaf-blog-grid .blog-card--featured {
	border-top: none;
}

/* ── Plant card common name — Special Elite (#6) ─────────────────── */

.localeaf-plant-card__name {
	font-family: var(--wp--preset--font-family--special-elite) !important;
	font-size: 1.15rem !important;
}

/* ── Hide empty tag cloud section (#14) ──────────────────────────── */

.localeaf-tag-cloud-section:has(.wp-block-tag-cloud:empty) {
	display: none;
}

/* Fallback: hide the tag cloud heading if no tags rendered */
.localeaf-tag-cloud-section .wp-block-tag-cloud:empty {
	display: none;
}

.localeaf-tag-cloud-section .wp-block-tag-cloud:empty ~ * {
	display: none;
}

/* ── P2 Table block overrides ────────────────────────────────────── */
/* theme.json css uses :root :where() (zero specificity) — WP core wins.
   These need real specificity to override .wp-block-table th/td defaults. */

.wp-block-table thead th {
	background-color: var(--wp--preset--color--accent-5);
	font-weight: 600;
	text-align: left;
	border: none;
	border-bottom: 2px solid var(--wp--preset--color--accent-4);
	padding: 12px 16px;
}

.wp-block-table td {
	border: none;
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
	padding: 12px 16px;
}

.wp-block-table tbody tr:nth-child(even) {
	background-color: var(--wp--preset--color--accent-5);
}

/* ── Global card style: accent-5 background blocks get drop shadow ─── */

.has-accent-5-background-color.has-background {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

/* ── Footer: fix low-contrast accent-4 text on dark background (#41) ── */

.has-footer-dark-background-color .has-accent-4-color {
    color: #AAAAAA !important;
}

/* ── P2 Global: ::selection highlight ────────────────────────────── */

::selection {
	background-color: rgba(211, 120, 63, 0.2);
	color: inherit;
}

/* ── P2 Global: Skip-to-content link focus styling ───────────────── */

.skip-link:focus {
	background-color: var(--wp--preset--color--accent-1);
	color: #fff;
	padding: 8px 16px;
	z-index: 100001;
	text-decoration: none;
	font-family: var(--wp--preset--font-family--dm-sans);
	font-size: var(--wp--preset--font-size--small);
	border-radius: 4px;
}

/* ── WPForms — match theme button styling via CSS custom properties ── */

div.wpforms-container-full {
	--wpforms-button-background-color: var(--wp--preset--color--accent-1);
	--wpforms-button-text-color: #FFFFFF;
	--wpforms-button-border-radius: 4px;
	--wpforms-button-size-height: auto;
}

div.wpforms-container-full .wpforms-submit {
	font-family: var(--wp--preset--font-family--dm-sans) !important;
	font-weight: 600 !important;
	padding: 12px 28px !important;
	font-size: var(--wp--preset--font-size--medium) !important;
}

/* ── P2 Plugin: filter toggle font inheritance fix ───────────────── */

.localeaf-filter-toggle,
.localeaf-catalogue__search input,
.localeaf-catalogue select {
	font-family: var(--wp--preset--font-family--dm-sans);
}

/* ── Feature Cards pattern ───────────────────────────────────────── */

.localeaf-feature-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--wp--preset--spacing--50, 1.5rem) !important;
}

.localeaf-feature-cards > * {
	margin-top: 0 !important;
}

.localeaf-feature-card {
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
	padding: 10px;
	gap: 10px;
}

.localeaf-feature-card > .wp-block-cover {
	min-height: 220px !important;
}

.localeaf-feature-card > .wp-block-cover .wp-block-cover__inner-container {
	display: none;
}

.localeaf-feature-card {
	position: relative;
	cursor: pointer;
	transition: box-shadow 0.15s ease;
}

.localeaf-feature-card:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.localeaf-feature-card__label {
	margin: 0 !important;
	margin-top: auto !important;
	text-align: center;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--medium);
	padding: 8px 0;
}

.localeaf-feature-card__label a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.localeaf-feature-card__label a::after {
	content: '';
	position: absolute;
	inset: 0;
}

@media (max-width: 781px) {
	.localeaf-feature-cards {
		grid-template-columns: 1fr;
		max-width: 420px;
		margin-left: auto;
		margin-right: auto;
	}
}
