/*
Theme Name: Deft 2027
Theme URI: https://www.onedeft.com
Author: La Ferme Graphique
Author URI: https://www.lafermegraphique.fr
Description: Thème en blocs du livre d'archives de Deft : graffiti, lettrage, fresques, toiles et art digital.
Requires at least: 6.9
Tested up to: 7.1
Requires PHP: 8.1
Version: 0.15.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: deft-2027
Tags: full-site-editing, block-patterns, block-styles, dark, wide-blocks, translation-ready
*/

/*
 * Ce fichier ne contient que l'en-tête et ce que theme.json ne sait pas faire.
 * Règles de contenu : assets/css/content.css.
 */

html {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* En-tête collant, sans extension. */
.deft-site-header {
	position: sticky;
	top: 0;
	z-index: 100;
}

.deft-site-header .wp-block-navigation a {
	text-decoration: none;
	padding-block: 0.25em;
	border-bottom: 2px solid transparent;
}

.deft-site-header .wp-block-navigation a:is(:hover, :focus-visible),
.deft-site-header .wp-block-navigation .current-menu-item > a {
	color: var(--wp--preset--color--foreground);
	border-bottom-color: var(--wp--preset--color--accent);
}

/* Bouton carré, même taille que le mini-panier (45 px), icône centrée dans les deux sens. */
.deft-site-header .wp-block-search__button {
	box-sizing: border-box;
	width: 2.8125rem;
	height: 2.8125rem;
	padding: 0;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
	color: var(--wp--preset--color--foreground);
}

.deft-site-header .wp-block-search__inside-wrapper {
	align-items: center;
}

/* Champ ouvert : en bandeau sous l'en-tête, calé à droite, au lieu de se glisser entre le menu et le bouton
 * (il n'y avait pas la place : champ de largeur nulle sur ordinateur, page élargie sur mobile).
 * Le bouton reste à sa place ; Échap ou un clic ailleurs referme (comportement du cœur). */
.deft-site-header .deft-header-search:not(.wp-block-search__searchfield-hidden) .wp-block-search__input {
	position: absolute;
	top: 100%;
	right: var(--wp--preset--spacing--40);
	width: min(22rem, calc(100% - 2 * var(--wp--preset--spacing--40))) !important;
	height: 2.8125rem;
	margin-top: var(--wp--preset--spacing--20);
	box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
}

/* Mobile : toute la largeur, moins les marges. */
@media (max-width: 781px) {
	.deft-site-header .deft-header-search:not(.wp-block-search__searchfield-hidden) .wp-block-search__input {
		left: var(--wp--preset--spacing--40);
		width: auto !important;
	}
}

.deft-site-header .wp-block-search__input {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--foreground);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
}

.deft-site-header .wp-block-search__button:hover {
	border-color: var(--wp--preset--color--accent);
	background: transparent;
	color: var(--wp--preset--color--accent);
}

/* Pied de page */
.deft-footer-meta {
	font-size: var(--wp--preset--font-size--meta);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.deft-footer-meta > p,
.deft-footer-meta > figure {
	margin: 0;
}

/* Logos du pied de page (patterns/footer-lfg.php), tailles équilibrées à surface visuelle égale
 * (environ 44 × 44 px) : un logo carré et un logo très large n'ont pas la même hauteur. */
.deft-footer-logos.deft-footer-logos {
	gap: clamp(0.75rem, 3vw, var(--wp--preset--spacing--40));
	align-items: center;
}

.deft-footer-logo {
	margin: 0;
}

.deft-footer-logo img {
	display: block;
	width: auto !important;
	height: 2.75rem !important;
	object-fit: contain;
	opacity: 0.75;
	transition: opacity 0.2s;
}

.deft-footer-logo a:is(:hover, :focus-visible) img {
	opacity: 1;
}

.deft-footer-soute img {
	height: 2.1rem !important;
	filter: invert(1);
}

.deft-footer-lfg img {
	height: 1.6rem !important;
}

/* Chromio : logo plein, il paraît plus gros à surface égale. */
.deft-footer-chromio img {
	height: 2.3rem !important;
}

/* Pied de page mobile : une seule colonne centrée, réseaux, logos, puis le copyright en dernier. */
@media (max-width: 781px) {
	.deft-footer-meta {
		flex-direction: column;
		align-items: center;
		gap: var(--wp--preset--spacing--40);
		text-align: center;
	}

	.deft-footer-meta > .wp-block-social-links {
		order: 1;
	}

	.deft-footer-meta > .deft-footer-logos {
		order: 2;
	}

	.deft-footer-meta > .deft-meta {
		order: 3;
	}
}

.admin-bar .deft-site-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .deft-site-header {
		top: 0;
	}
}

/* Focus visible partout. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

/* Contact : une icône d'enveloppe au lieu du mot, dans un carré de 45 px comme la recherche et le panier.
 * Gagne de la place pour le menu. Le mot reste lu par les lecteurs d'écran ; dans le menu mobile déroulé, il reste écrit. */
.deft-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content[href$="/contact/"] {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 2.8125rem;
	height: 2.8125rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
	color: var(--wp--preset--color--foreground);
}

.deft-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content[href$="/contact/"]::before {
	content: "";
	width: 1.25rem;
	height: 1.25rem;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Crect x='3' y='5.5' width='18' height='13' rx='1.5'/%3E%3Cpath d='M3.5 6.5 12 13l8.5-6.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Crect x='3' y='5.5' width='18' height='13' rx='1.5'/%3E%3Cpath d='M3.5 6.5 12 13l8.5-6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.deft-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content[href$="/contact/"] .wp-block-navigation-item__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.deft-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content[href$="/contact/"]:is(:hover, :focus-visible),
.deft-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .current-menu-item > .wp-block-navigation-item__content[href$="/contact/"] {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}

/* Pied de page sur ordinateur : copyright à gauche, logos au centre, réseaux sociaux à droite. */
@media (min-width: 782px) {
	.deft-footer-meta.deft-footer-meta {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
		align-items: center;
	}

	.deft-footer-meta > .deft-meta {
		grid-column: 1;
		grid-row: 1;
		justify-self: start;
	}

	.deft-footer-meta > .deft-footer-logos {
		grid-column: 2;
		grid-row: 1;
	}

	.deft-footer-meta > .wp-block-social-links {
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
		justify-content: flex-end;
	}
}

/* Très petits écrans : logos un peu plus petits et plus serrés, pour que les cinq tiennent sur une ligne. */
@media (max-width: 400px) {
	.deft-footer-logos.deft-footer-logos {
		gap: 0.6rem;
	}

	.deft-footer-logo img {
		height: 2.5rem !important;
	}

	.deft-footer-soute img {
		height: 1.9rem !important;
	}

	.deft-footer-lfg img {
		height: 1.45rem !important;
	}

	.deft-footer-chromio img {
		height: 2.1rem !important;
	}
}

/* ---------------------------------------------------------------------------
 * Menu mobile (0.15.0) : bouton ☰ carré tout à droite, et menu ouvert dans l'esprit du site :
 * grands mots en Unbounded alignés à gauche, numéro devant chaque entrée, filets, page courante en rouge.
 * ------------------------------------------------------------------------- */
@media (max-width: 899px) {
	/* Le menu (et donc le bouton ☰) passe après la recherche et le panier : tout à droite. */
	.deft-site-header .wp-block-navigation {
		order: 3;
	}
}

/* Boutons ☰ et ✕ : carrés de 45 px, comme la recherche et le panier.
 * L'affichage (display) reste géré par le cœur : le ☰ n'apparaît que sous 900 px (voir content.css). */
.deft-site-header :is(.wp-block-navigation__responsive-container-open, .wp-block-navigation__responsive-container-close) {
	box-sizing: border-box;
	display: none;
	place-items: center;
	width: 2.8125rem;
	height: 2.8125rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
	color: var(--wp--preset--color--foreground);
}

.deft-site-header :is(.wp-block-navigation__responsive-container-open, .wp-block-navigation__responsive-container-close):is(:hover, :focus-visible) {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}

.deft-site-header :is(.wp-block-navigation__responsive-container-open, .wp-block-navigation__responsive-container-close) svg {
	width: 1.375rem;
	height: 1.375rem;
}

/* Le menu ouvert. */
.deft-site-header .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	background: var(--wp--preset--color--background);
}

.deft-site-header .is-menu-open .wp-block-navigation__responsive-close {
	max-width: none;
}

.deft-site-header .is-menu-open .wp-block-navigation__responsive-container-close {
	top: 0;
	right: 0;
}

.deft-site-header .is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: calc(2.8125rem + var(--wp--preset--spacing--40)) !important;
	align-items: stretch !important;
}

.deft-site-header .is-menu-open .wp-block-navigation__container {
	counter-reset: deft-menu;
	width: 100%;
	align-items: stretch !important;
	gap: 0 !important;
	border-top: 1px solid var(--wp--preset--color--border);
}

.deft-site-header .is-menu-open .wp-block-navigation-item {
	width: 100%;
	border-bottom: 1px solid var(--wp--preset--color--border);
	counter-increment: deft-menu;
}

.deft-site-header .is-menu-open .wp-block-navigation-item__content {
	display: flex !important;
	align-items: baseline;
	gap: 0.9rem;
	width: 100%;
	padding: 0.55em 0 !important;
	border-bottom: 0 !important;
	color: var(--wp--preset--color--foreground);
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.625rem, 7.5vw, 2.5rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.01em;
	text-align: left;
	text-decoration: none;
}

/* Petit numéro devant chaque entrée : 01, 02… */
.deft-site-header .is-menu-open .wp-block-navigation-item__content::before {
	content: counter(deft-menu, decimal-leading-zero);
	min-width: 1.6rem;
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 600;
	letter-spacing: 0.08em;
	transform: translateY(-0.35em);
}

.deft-site-header .is-menu-open .wp-block-navigation-item__content:is(:hover, :focus-visible),
.deft-site-header .is-menu-open .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--accent);
}

/* Entrée en cascade à l'ouverture, coupée si le visiteur réduit les animations. */
@media (prefers-reduced-motion: no-preference) {
	.deft-site-header .is-menu-open .wp-block-navigation-item {
		animation: deft-menu-entree 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
	}

	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(2) { animation-delay: 0.04s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(3) { animation-delay: 0.08s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(4) { animation-delay: 0.12s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(5) { animation-delay: 0.16s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(6) { animation-delay: 0.2s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(7) { animation-delay: 0.24s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(8) { animation-delay: 0.28s; }
	.deft-site-header .is-menu-open .wp-block-navigation-item:nth-child(n + 9) { animation-delay: 0.32s; }

	@keyframes deft-menu-entree {
		from {
			opacity: 0;
			transform: translateY(14px);
		}
	}
}

/* Le ☰ s'affiche sous 900 px ; le ✕ quand le menu est ouvert. */
@media (max-width: 899px) {
	.deft-site-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: grid;
	}
}

.deft-site-header .is-menu-open .wp-block-navigation__responsive-container-close {
	display: grid;
}

/* ---------------------------------------------------------------------------
 * « Suivre Deft » (patterns/suivre.php) : bas des fiches et bas du menu mobile.
 * ------------------------------------------------------------------------- */
.deft-suivre {
	gap: var(--wp--preset--spacing--30);
	margin-top: var(--wp--preset--spacing--40);
}

.deft-suivre .deft-suivre-titre {
	margin: 0;
}

.deft-suivre .wp-block-social-links {
	gap: 0.5rem;
	margin: 0;
}

.deft-suivre .wp-social-link a {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
	color: var(--wp--preset--color--foreground);
}

.deft-suivre .wp-social-link a:is(:hover, :focus-visible) {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}

.deft-suivre .wp-social-link svg {
	width: 1.25rem;
	height: 1.25rem;
	fill: currentColor;
}

/* Dans le menu : seulement quand le menu mobile est ouvert, sans numéro ni grand corps. */
.deft-site-header .deft-menu-reseaux {
	display: none;
}

.deft-site-header .is-menu-open .deft-menu-reseaux {
	display: block;
	border-bottom: 0 !important;
	counter-increment: none;
	padding-top: var(--wp--preset--spacing--40);
}

.deft-site-header .is-menu-open .deft-menu-reseaux .deft-suivre {
	margin-top: 0;
}

/* Icônes monochromes (le style « logos seuls » du cœur leur donne les couleurs des marques). */
.deft-suivre .wp-block-social-links .wp-social-link {
	color: var(--wp--preset--color--foreground) !important;
	background: none !important;
}

.deft-suivre .wp-block-social-links .wp-social-link a:is(:hover, :focus-visible) {
	color: var(--wp--preset--color--accent) !important;
}

.deft-site-header .is-menu-open .deft-menu-reseaux .deft-suivre {
	justify-content: flex-start;
}

.deft-site-header .is-menu-open .wp-block-navigation-item.deft-menu-reseaux {
	justify-content: flex-start !important;
	align-items: flex-start !important;
}

/* ---------------------------------------------------------------------------
 * Mini-panier de l'en-tête (bloc woocommerce/mini-cart), sur toutes les pages.
 * Ici et pas dans assets/css/woocommerce.css : cette feuille n'est chargée
 * que sur les pages de la boutique (deft_2027_woocommerce_hors_boutique, 0.15.3).
 * ------------------------------------------------------------------------- */
.deft-site-header .wc-block-mini-cart__button {
	color: var(--wp--preset--color--foreground);
	padding: 0.45em;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
}

.deft-site-header .wc-block-mini-cart__button:hover {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}

.deft-site-header .wc-block-mini-cart__badge {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--on-accent);
}

.wc-block-mini-cart__drawer .components-modal__content,
.wc-block-mini-cart__drawer .wc-block-mini-cart__template-part {
	background: var(--wp--preset--color--background);
	color: var(--wp--preset--color--foreground);
}

/* Boutons du tiroir (Panier, Commander) : même règle que dans la boutique (woocommerce.css). */
.wc-block-mini-cart__drawer .wc-block-components-button:not(.is-link) {
	background: var(--wp--preset--color--accent) !important;
	color: var(--wp--preset--color--on-accent) !important;
	border-radius: 2px !important;
	font-weight: 600;
	letter-spacing: 0.04em;
}

.wc-block-mini-cart__drawer .wc-block-components-button:not(.is-link):is(:hover, :focus-visible) {
	background: var(--wp--preset--color--foreground) !important;
	color: var(--wp--preset--color--background) !important;
}

/* Sélecteur de quantité et filets des lignes du tiroir : comme dans la boutique. */
.wc-block-mini-cart__drawer .wc-block-components-quantity-selector {
	min-height: 3rem;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--foreground);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
}

.wc-block-mini-cart__drawer :is(.wc-block-cart-items, .wc-block-cart-items td) {
	border-color: var(--wp--preset--color--border) !important;
}
