/*
Theme Name: KanopY
Description: Theme vitrine de KanopY, constructeur bois autour de Niort.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: kanopy
*/

:root {
	/* Palette KanopY, reprise du thème de l'ancien site (Helix3, préréglage 3 personnalisé). */
	--kanopy-green: #c8dc62;
	--kanopy-green-dark: #b9d338;
	--kanopy-brown: #503c28;
	--kanopy-brown-deep: #3a2b1d;
	--kanopy-orange: #c86430;
	--ink: #2e2419;
	--text: #4a3d30;
	--muted: #6b5d4f;
	--paper: #faf9f4;
	--white: #fff;
	--line: #e3ded2;
	--font-display: "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
	--font-body: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.65;
}

img {
	display: block;
	max-width: 100%;
}

a {
	color: inherit;
}

.skip-link {
	position: absolute;
	top: -100px;
	left: 16px;
	z-index: 20;
	padding: 10px 14px;
	background: var(--white);
	color: var(--kanopy-brown);
}

.skip-link:focus {
	top: 12px;
}

.site-header {
	position: relative;
	z-index: 5;
	background: var(--paper);
}

.header-inner {
	width: min(100% - 48px, 1320px);
	min-height: 82px;
	margin-inline: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 32px;
}

.brand {
	flex: 0 0 auto;
	text-decoration: none;
}

/* Le logo d'origine est un JPEG sur fond blanc : multiply fond ce blanc dans le fond du header. */
.brand-logo {
	display: block;
	width: 150px;
	height: auto;
	mix-blend-mode: multiply;
}

.brand-tagline {
	display: block;
	margin-top: 5px;
	color: var(--muted);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1.2px;
	text-transform: uppercase;
}

.primary-navigation {
	display: flex;
	align-items: center;
	gap: 28px;
}

.primary-navigation a {
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}

.primary-navigation a:hover,
.primary-navigation a:focus-visible {
	color: var(--kanopy-orange);
}

.navigation-links {
	display: flex;
	align-items: center;
	gap: 26px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.navigation-links > li {
	position: relative;
}

.navigation-links .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.navigation-links > li > .sub-menu {
	position: absolute;
	top: 100%;
	left: -20px;
	z-index: 20;
	display: none;
	min-width: 260px;
	padding: 16px 20px;
	border: 1px solid var(--line);
	background: var(--white);
	box-shadow: 0 18px 40px rgb(80 60 40 / 14%);
}

.navigation-links > li:hover > .sub-menu,
.navigation-links > li:focus-within > .sub-menu {
	display: block;
}

/* Menu à trois niveaux (Éco construction) : affiché en colonnes. */
.navigation-links > li:has(.sub-menu .sub-menu) > .sub-menu {
	left: 50%;
	width: min(92vw, 980px);
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px 28px;
	transform: translateX(-50%);
}

.navigation-links > li:has(.sub-menu .sub-menu):hover > .sub-menu,
.navigation-links > li:has(.sub-menu .sub-menu):focus-within > .sub-menu {
	display: grid;
}

.navigation-links .sub-menu a {
	display: block;
	padding: 5px 0;
	font-weight: 600;
}

.navigation-links .sub-menu .sub-menu a {
	color: var(--muted);
	font-size: 12px;
	font-weight: 500;
}

.navigation-links .sub-menu .menu-item-has-children > a {
	color: var(--kanopy-brown);
	font-weight: 700;
}

.navigation-cta,
.button {
	display: inline-flex;
	min-height: 48px;
	align-items: center;
	justify-content: center;
	padding: 0 20px;
	border: 1px solid var(--kanopy-green);
	background: var(--kanopy-green);
	color: var(--kanopy-brown);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.navigation-cta:hover,
.button:hover {
	transform: translateY(-2px);
	background: var(--kanopy-green-dark);
	color: var(--kanopy-brown);
}

.menu-toggle {
	display: none;
	width: 44px;
	height: 44px;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--line);
	background: transparent;
	color: var(--kanopy-brown);
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
	display: block;
	width: 18px;
	height: 2px;
	background: currentColor;
}

.menu-toggle span {
	position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
	position: absolute;
	left: 0;
	content: "";
}

.menu-toggle span::before {
	top: -6px;
}

.menu-toggle span::after {
	top: 6px;
}

.site-footer {
	padding: 64px 24px 28px;
	background: var(--kanopy-brown-deep);
	color: rgb(255 255 255 / 72%);
	font-size: 13px;
}

.footer-inner,
.footer-bottom {
	width: min(100%, 1320px);
	margin-inline: auto;
}

.footer-inner {
	display: grid;
	grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr));
	gap: 36px;
}

.footer-inner p {
	margin: 0 0 12px;
}

.footer-brand {
	color: var(--white);
	font-family: var(--font-display);
	font-size: 26px;
}

.footer-title {
	color: var(--kanopy-green);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1.2px;
	text-transform: uppercase;
}

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

.footer-links li + li {
	margin-top: 8px;
}

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

.site-footer a:hover,
.site-footer a:focus-visible {
	color: var(--white);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.footer-bottom {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	margin-top: 48px;
	padding-top: 20px;
	border-top: 1px solid rgb(255 255 255 / 14%);
	font-size: 12px;
}

.content-wrap {
	width: min(100% - 48px, 900px);
	min-height: 55vh;
	margin-inline: auto;
	padding-block: 72px;
}

.content-wrap h1,
.content-wrap h2 {
	font-family: var(--font-display);
	font-weight: 500;
}

.content-wrap h1 {
	font-size: 48px;
}

.content-wrap > article + article {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--line);
}

.content-wrap .entry-content {
	color: var(--text);
}

.content-wrap .entry-content img {
	height: auto;
}

/* Articles, pages, archives. */
.content-wrap.is-wide {
	width: min(100% - 48px, 1200px);
}

.entry-header h1,
.archive-header h1 {
	margin: 0 0 24px;
	color: var(--kanopy-brown);
	line-height: 1.1;
}

.entry-kicker {
	margin: 0 0 10px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 1.2px;
	text-transform: uppercase;
}

.entry-kicker a {
	color: var(--kanopy-orange);
	text-decoration: none;
}

.entry-kicker a:hover,
.entry-kicker a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.archive-header {
	margin-bottom: 40px;
}

.archive-description {
	max-width: 760px;
	color: var(--text);
	font-size: 17px;
}

.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 28px;
}

.card-grid + .card-grid {
	margin-top: 56px;
}

.card {
	background: var(--white);
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.card:hover,
.card:focus-within {
	transform: translateY(-3px);
	box-shadow: 0 18px 40px rgb(80 60 40 / 14%);
}

.card-link {
	display: flex;
	height: 100%;
	flex-direction: column;
	text-decoration: none;
}

.card-image {
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.card-image.is-empty {
	display: block;
	background: var(--kanopy-green);
}

.card-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px 20px 22px;
	border-top: 4px solid var(--kanopy-green);
}

.card-title {
	color: var(--kanopy-brown);
	font-family: var(--font-display);
	font-size: 22px;
	line-height: 1.2;
}

.card-body {
	flex: 1;
}

.card.is-text .card-body {
	padding-top: 24px;
}

.card-excerpt,
.card-meta {
	color: var(--muted);
	font-size: 14px;
}

.card-more {
	margin-top: auto;
	padding-top: 6px;
	color: var(--kanopy-orange);
	font-size: 13px;
	font-weight: 700;
}

.navigation.pagination {
	margin-top: 48px;
}

.navigation.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.navigation.pagination .page-numbers {
	min-width: 44px;
	padding: 10px 14px;
	border: 1px solid var(--line);
	background: var(--white);
	text-align: center;
	text-decoration: none;
}

.navigation.pagination .page-numbers.current {
	border-color: var(--kanopy-green);
	background: var(--kanopy-green);
	color: var(--kanopy-brown);
	font-weight: 700;
}

.post-siblings {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-top: 64px;
	padding-top: 28px;
	border-top: 1px solid var(--line);
}

.post-siblings a {
	color: var(--kanopy-brown);
	font-weight: 700;
	text-decoration: none;
}

.post-siblings a:hover,
.post-siblings a:focus-visible {
	color: var(--kanopy-orange);
}

.post-siblings span {
	display: block;
	color: var(--muted);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.post-siblings .is-next {
	grid-column: 2;
	text-align: right;
}

.button.is-secondary {
	border-color: var(--kanopy-brown);
	background: transparent;
}

.button + .button {
	margin-left: 12px;
}

.search-form {
	display: flex;
	gap: 8px;
	margin-top: 24px;
}

.search-form .search-field {
	flex: 1;
	min-height: 48px;
	padding: 0 12px;
	border: 1px solid var(--line);
	font: inherit;
}

.search-form .search-submit {
	min-height: 48px;
	padding: 0 20px;
	border: 0;
	background: var(--kanopy-brown);
	color: var(--white);
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}

/* Réalisation : photos de l'album en grille, ouvertes dans la visionneuse. */
.realisation .entry-content {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.realisation .entry-content > :not(figure) {
	grid-column: 1 / -1;
	max-width: 820px;
}

.realisation .entry-content figure {
	margin: 0;
}

.realisation .entry-content figure img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	cursor: zoom-in;
}

.realisation .entry-content figure img:focus-visible {
	outline: 3px solid var(--kanopy-green);
	outline-offset: 2px;
}

/* Les légendes reprennent le titre de l'album : masquées dans la grille. */
.realisation .entry-content figcaption {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.lightbox {
	width: 100vw;
	max-width: none;
	height: 100vh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgb(20 15 10 / 94%);
}

.lightbox::backdrop {
	background: rgb(20 15 10 / 70%);
}

.lightbox figure {
	display: flex;
	height: 100%;
	margin: 0;
	padding: 48px 72px;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.lightbox img {
	max-height: calc(100% - 32px);
	object-fit: contain;
}

.lightbox figcaption {
	color: rgb(255 255 255 / 75%);
	font-size: 14px;
}

.lightbox button {
	position: absolute;
	width: 48px;
	height: 48px;
	border: 0;
	background: rgb(255 255 255 / 12%);
	color: var(--white);
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
}

.lightbox button:hover,
.lightbox button:focus-visible {
	background: rgb(255 255 255 / 25%);
}

.lightbox-close {
	top: 16px;
	right: 16px;
}

.lightbox-nav {
	top: 50%;
	transform: translateY(-50%);
}

.lightbox-nav.is-previous {
	left: 12px;
}

.lightbox-nav.is-next {
	right: 12px;
}

/* Page Contact : formulaire Contact Form 7 et coordonnées. */
.contact-columns {
	gap: 48px;
}

.contact-details {
	align-self: flex-start;
	padding: 28px;
	border-top: 4px solid var(--kanopy-green);
	background: var(--white);
}

.contact-details h2 {
	margin-top: 0;
}

.wpcf7-form p {
	margin: 0 0 18px;
}

.wpcf7-form label {
	display: block;
	color: var(--kanopy-brown);
	font-size: 14px;
	font-weight: 700;
}

.wpcf7-form .wpcf7-form-control-wrap {
	display: block;
	margin-top: 6px;
}

.wpcf7-form input:not([type="submit"]),
.wpcf7-form select,
.wpcf7-form textarea {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid var(--line);
	border-radius: 0;
	background: var(--white);
	color: var(--ink);
	font: inherit;
	font-weight: 400;
}

.wpcf7-form textarea {
	height: 180px;
	resize: vertical;
}

.wpcf7-form input:focus,
.wpcf7-form select:focus,
.wpcf7-form textarea:focus {
	border-color: var(--kanopy-brown);
	outline: 2px solid var(--kanopy-green);
	outline-offset: 0;
}

.wpcf7-form .wpcf7-quiz-label {
	display: block;
	margin-top: 6px;
	font-weight: 400;
}

.wpcf7-form .wpcf7-submit {
	cursor: pointer;
	font-family: inherit;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Page d'accueil : blocs WordPress de la page « Accueil ». */
.home-content > .wp-block-group,
.home-content > .wp-block-cover {
	margin: 0;
}

.home-section {
	padding: 88px 24px;
}

.home-section > * {
	width: min(100%, 1200px);
	margin-inline: auto;
}

.home-section h2 {
	margin-bottom: 40px;
	color: var(--kanopy-brown);
	font-family: var(--font-display);
	font-size: clamp(32px, 4vw, 46px);
	font-weight: 500;
	text-align: center;
}

.home-section h3 {
	margin: 18px 0 10px;
	font-family: var(--font-display);
	font-size: 25px;
	font-weight: 500;
}

.home-section h3 a {
	text-decoration: none;
}

.home-more a {
	color: var(--kanopy-orange);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}

.home-more a:hover,
.home-more a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.home-savoir-faire {
	background: var(--white);
}

.home-savoir-faire .wp-block-image img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.home-realisations .home-more,
.home-savoir-faire h2 {
	text-align: center;
}

.home-realisations .wp-block-gallery.has-nested-images figure.wp-block-image img {
	aspect-ratio: 4 / 3;
}

.home-realisations .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	padding: 40px 14px 12px;
	font-size: 14px;
	font-weight: 700;
	text-align: left;
}

/* Diaporama : galerie défilante (scroll-snap), animée par assets/js/home-slider.js. */
.home-slider-wrap {
	position: relative;
}

.wp-block-gallery.has-nested-images.home-slider {
	display: flex;
	flex-wrap: nowrap;
	gap: 0;
	margin: 0;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.wp-block-gallery.has-nested-images.home-slider::-webkit-scrollbar {
	display: none;
}

.wp-block-gallery.has-nested-images.home-slider figure.wp-block-image:not(#individual-image) {
	flex: 0 0 100%;
	width: 100%;
	height: clamp(380px, 72svh, 680px);
	margin: 0;
	scroll-snap-align: start;
}

.wp-block-gallery.has-nested-images.home-slider figure.wp-block-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wp-block-gallery.has-nested-images.home-slider figure.wp-block-image figcaption {
	right: 0;
	bottom: 0;
	left: 0;
	width: auto;
	max-height: none;
	padding: 120px max(24px, calc((100vw - 1320px) / 2)) 56px;
	background: linear-gradient(0deg, rgb(46 36 25 / 80%), transparent);
	color: rgb(255 255 255 / 86%);
	font-size: 17px;
	text-align: left;
}

.wp-block-gallery.has-nested-images.home-slider figure.wp-block-image figcaption strong {
	display: block;
	color: var(--white);
	font-family: var(--font-display);
	font-size: clamp(34px, 5vw, 60px);
	font-weight: 500;
	line-height: 1.05;
}

.home-slider-button {
	position: absolute;
	top: 50%;
	display: grid;
	width: 48px;
	height: 48px;
	place-items: center;
	border: 0;
	background: rgb(255 255 255 / 85%);
	color: var(--kanopy-brown);
	font-size: 22px;
	cursor: pointer;
	transform: translateY(-50%);
}

.home-slider-button:hover,
.home-slider-button:focus-visible {
	background: var(--white);
}

.home-slider-button.is-previous {
	left: 18px;
}

.home-slider-button.is-next {
	right: 18px;
}

.home-eco {
	min-height: 420px;
	padding: 72px 24px;
	text-align: center;
}

.home-eco .wp-block-cover__inner-container > * {
	width: min(100%, 760px);
	margin-inline: auto;
}

.home-eco .home-eco-title {
	color: var(--white);
	font-family: var(--font-display);
	font-size: clamp(32px, 4vw, 46px);
	line-height: 1.15;
}

.home-eco p {
	font-size: 18px;
}

.home-eco .home-more a {
	display: inline-flex;
	min-height: 48px;
	align-items: center;
	padding: 0 22px;
	background: var(--kanopy-green);
	color: var(--kanopy-brown);
}

.home-about .wp-block-columns {
	align-items: center;
	gap: 56px;
}

.home-about p {
	color: var(--text);
	font-size: 17px;
}

@media (max-width: 900px) {
	.header-inner {
		width: min(100% - 36px, 1320px);
		min-height: 72px;
	}

	.menu-toggle {
		display: inline-flex;
	}

	.primary-navigation {
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		display: none;
		align-items: stretch;
		padding: 12px 18px 20px;
		border-top: 1px solid var(--line);
		background: var(--paper);
	}

	.primary-navigation.is-open {
		display: flex;
		flex-direction: column;
		gap: 16px;
	}

	.navigation-links {
		align-items: stretch;
		flex-direction: column;
		gap: 0;
	}

	.navigation-links a {
		display: block;
		padding: 10px 0;
	}

	.primary-navigation.is-open {
		max-height: calc(100svh - 72px);
		overflow-y: auto;
	}

	/* Sur mobile : deux niveaux dépliés, les articles restent accessibles depuis les catégories. */
	.navigation-links > li > .sub-menu,
	.navigation-links > li:has(.sub-menu .sub-menu) > .sub-menu {
		position: static;
		display: block;
		width: auto;
		min-width: 0;
		padding: 0 0 8px 14px;
		border: 0;
		box-shadow: none;
		transform: none;
	}

	.navigation-links > li:has(.sub-menu .sub-menu):hover > .sub-menu,
	.navigation-links > li:has(.sub-menu .sub-menu):focus-within > .sub-menu {
		display: block;
	}

	.navigation-links .sub-menu .sub-menu {
		display: none;
	}

	.navigation-links .sub-menu a {
		padding: 6px 0;
	}

	.footer-inner {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.footer-contact {
		grid-column: 1 / -1;
	}

	.navigation-cta {
		align-self: flex-start;
	}

}

@media (max-width: 620px) {
	.header-inner {
		width: min(100% - 36px, 1320px);
	}

	.footer-bottom {
		align-items: flex-start;
		flex-direction: column;
	}

	.footer-inner {
		grid-template-columns: 1fr;
	}

	.content-wrap {
		width: min(100% - 36px, 900px);
		padding-block: 52px;
	}

	.content-wrap h1 {
		font-size: 38px;
	}

	.home-section {
		padding: 64px 18px;
	}

	.wp-block-gallery.has-nested-images.home-slider figure.wp-block-image figcaption {
		padding: 80px 18px 36px;
		font-size: 15px;
	}

	.home-slider-button {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}