/*
Theme Name: Canopee Nonprofit
Theme URI: https://canopee.localeaf.ca
Author: Canopee Localeaf
Author URI: https://canopee.localeaf.ca
Description: Custom child theme for Canopee Localeaf — a registered non-profit focused on community pollinator habitat, Miyawaki tiny forests, and environmental education in Aylmer, Gatineau, QC. Features a forest green and fuchsia 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: canopee-nonprofit
Tags: block-theme, custom-colors, custom-fonts, nonprofit, community
*/

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

/* ── Canopée brand word — Prata font, uppercase, spaced ──────────────── */

.canopee-brand {
	font-family: var(--wp--preset--font-family--prata) !important;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--wp--preset--color--accent-1);
}

/* Canopée white inside the hero banner */
.wp-block-cover .canopee-brand {
	color: #fff;
}

/* Canopée white in the dark header */
.has-contrast-background-color .canopee-brand {
	color: #fff;
}

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

/* ── Header brand: stacked CANOPÉE / Localeaf beside logo ────────── */

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

.canopee-header-title-link {
	display: flex;
	flex-direction: column;
	justify-content: center;
	text-decoration: none !important;
	line-height: 1.15;
}

.canopee-header-title-link:hover {
	opacity: 0.85;
}

.canopee-header-title-top {
	font-family: var(--wp--preset--font-family--prata);
	text-transform: uppercase;
	letter-spacing: 3.5px;
	color: #fff;
	font-size: 18px;
	font-weight: 400;
}

.canopee-header-title-bottom {
	font-family: var(--wp--preset--font-family--special-elite);
	color: #fff;
	font-size: 22px;
	font-weight: 400;
	letter-spacing: 2.5px;
}

@media (max-width: 768px) {
	.canopee-header-title-top {
		font-size: 16px;
		letter-spacing: 2.5px;
	}
	.canopee-header-title-bottom {
		font-size: 20px;
	}
	.canopee-header-brand .wp-block-site-logo img {
		width: 50px;
		height: auto;
	}
}

/* ── Bio-map: minimal chrome on homepage (filters/search/toggle on full page only) */
body.home .bio-filters,
body.home .bio-search,
body.home .bio-view-toggle,
body.home .bio-list {
	display: none !important;
}

/* ── 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; fuchsia 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;
}

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

.canopee-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;
}
.canopee-search-toggle:hover {
	color: var(--wp--preset--color--accent-3);
}
.canopee-search-toggle[aria-expanded="true"] {
	color: var(--wp--preset--color--accent-1);
}

/* Search dropdown bar */
.canopee-search-dropdown {
	padding: 8px var(--wp--preset--spacing--50, 30px);
	max-width: var(--wp--style--global--wide-size, 990px);
	margin: 0 auto;
}
.canopee-search-dropdown[hidden] {
	display: none;
}
.canopee-search-form {
	display: flex;
	max-width: 500px;
	margin: 0 auto;
}
.canopee-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;
}
.canopee-search-form__input::placeholder {
	color: #999;
}
.canopee-search-form__input:focus {
	border-color: var(--wp--preset--color--accent-1);
	background: rgba(255,255,255,0.85);
}
.canopee-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;
}
.canopee-search-form__submit:hover {
	background: #A10051;
}

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

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

/* 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;
}

/* ── 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 on desktop, full-width on mobile ── */

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

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

/* Per-image full-width override — add CSS class "canopee-img-full" to any image block */
.wp-block-image.canopee-img-full {
	max-width: 100% !important;
}

.wp-block-image.canopee-img-full img {
	width: 100%;
}

@media (max-width: 768px) {
	.wp-block-image:not(.alignfull):not(.alignwide):not(.alignleft):not(.alignright):not(.canopee-img-full) {
		max-width: 100%;
	}
}

/* ── Video/embed — cap at same max-width as content images ────────── */

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

@media (max-width: 768px) {
	.wp-block-embed:not(.alignfull):not(.alignwide) {
		max-width: 100%;
	}
}

/* ── Gallery images — match site-wide treatment (5d) ─────────────── */

.wp-block-gallery .wp-block-image img {
	padding: 4px;
	background: #FFFFFF;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
	border-radius: 4px;
}

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

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

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

/* Sidebar column styling */
.canopee-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 */
.canopee-blog-content {
	min-width: 0;
	overflow: hidden;
}

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

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

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

	.canopee-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) {
	.canopee-blog-content:has(~ .canopee-blog-sidebar),
	.is-layout-flex:has(.canopee-blog-content) {
		flex-wrap: wrap !important;
	}
}

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

.canopee-blog-grid .blog-card {
	background: #FFFFFF;
	border: none;
	border-radius: 0;
	padding: 16px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

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

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

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

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

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

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

.canopee-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: background blocks get drop shadow ─────────── */

.has-accent-5-background-color.has-background,
.has-base-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(238, 42, 123, 0.15);
	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 ───────────────── */

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

/* ── Partner cards — logos use contain instead of cover ────────────── */

.canopee-partner-cards .canopee-partner-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	padding: 20px;
	margin: 0 !important;
	max-width: none !important;
}

.canopee-partner-cards .canopee-partner-logo img {
	max-height: 120px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	padding: 0;
	background: none;
	box-shadow: none;
}

/* ── Bio Cards — Media & Text blocks matching Localeaf About Us ──── */

.canopee-bio-card {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
	overflow: hidden;
}

.canopee-bio-card .wp-block-media-text__media {
	min-height: 280px;
}

.canopee-bio-card .wp-block-media-text__content {
	padding: var(--wp--preset--spacing--50, 2rem) !important;
}

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

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

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

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

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

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

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

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

.canopee-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;
}

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

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

/* Feature cards with text — title, description, button below image */

.canopee-feature-cards--with-text .canopee-feature-card__title {
	margin: 0 !important;
	padding: 0 8px;
	text-align: center;
	font-family: var(--wp--preset--font-family--special-elite);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
}

.canopee-feature-cards--with-text .canopee-feature-card__title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.canopee-feature-cards--with-text .canopee-feature-card__title a:hover {
	text-decoration: underline;
}

.canopee-feature-cards--with-text .canopee-feature-card__desc {
	margin: 0 !important;
	padding: 4px 10px 0;
	text-align: center;
	color: var(--wp--preset--color--accent-4, #666);
	line-height: 1.5;
}

.canopee-feature-cards--with-text .wp-block-buttons {
	margin-top: auto !important;
	padding: 8px 10px 4px;
	justify-content: center;
}

/* Icon area for program cards — same card shell as feature cards */

.canopee-feature-card__icon-area {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	color: var(--wp--preset--color--accent-1, #EE2A7B);
}

.canopee-feature-card__sublabel {
	margin: 0 !important;
	text-align: center;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--accent-4, #666);
	padding: 0 8px 8px;
}

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