/**
 * Archange 140 — base : jetons, ornements, styles de blocs partagés.
 * Les couleurs/typos viennent de theme.json (variables --wp--preset--*).
 */

:root {
	--a140-accent: var(--wp--preset--color--or-profond);
	--a140-line: var(--wp--preset--color--lin);
	--a140-muted: var(--wp--preset--color--pierre);
	--a140-surface: var(--wp--preset--color--ivoire);
	--a140-ease: var(--wp--custom--transition, 180ms cubic-bezier(0.2, 0.7, 0.2, 1));
	--a140-cross: url("../img/croix-jerusalem.svg");
	--a140-cross-pattee: url("../img/croix-pattee.svg");
	--a140-cross-latine: url("../img/croix-latine.svg");
	--a140-lys: url("../img/fleur-de-lys.svg");
	--a140-rosace: url("../img/rosace.svg");
	/* Anneau de focus : or profond sur les fonds clairs (5,1:1 sur parchemin), or clair sur les fonds sombres. */
	--a140-focus: var(--wp--preset--color--or-profond);
}

/* Sections sombres : l'accent passe à l'or clair, les lignes s'adoucissent. */
.has-nuit-background-color,
.has-encre-background-color,
.has-marial-background-color,
.has-pourpre-background-color,
.has-vitrail-gradient-background,
.is-style-vitrail,
.wp-block-cover:not(.is-light) {
	--a140-accent: var(--wp--preset--color--or);
	--a140-line: rgba(194, 160, 99, 0.35);
	--a140-muted: rgba(251, 248, 242, 0.72);
	--a140-focus: var(--wp--preset--color--or);
}

/* Surface claire posée dans une section sombre : le focus repasse à l'or profond. */
.has-parchemin-background-color,
.has-ivoire-background-color,
.has-blanc-background-color,
.has-lin-background-color {
	--a140-focus: var(--wp--preset--color--or-profond);
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	font-feature-settings: "kern", "liga", "calt";
}

::selection {
	background: var(--wp--preset--color--or);
	color: var(--wp--preset--color--nuit);
}

a {
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
	transition: color var(--a140-ease), opacity var(--a140-ease);
}

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

img {
	height: auto;
}

/* Lien d'évitement */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--nuit);
	color: var(--wp--preset--color--ivoire);
	padding: 0.75rem 1.25rem;
	z-index: 100000;
}

/* ---------- Titres ---------- */
h1, h2, h3, h4, h5, h6 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* ---------- Paragraphe : surtitre ---------- */
.is-style-surtitre {
	font-family: var(--wp--preset--font-family--inscription);
	font-size: var(--wp--preset--font-size--x-small) !important;
	font-weight: 600;
	letter-spacing: var(--wp--custom--letter-spacing--surtitre, 0.32em);
	text-transform: uppercase;
	color: var(--a140-accent);
	line-height: 1.5;
}

.is-style-surtitre.has-text-align-center {
	padding-left: var(--wp--custom--letter-spacing--surtitre, 0.32em); /* compense l'espacement final */
}

/* ---------- Paragraphe : verset ---------- */
.is-style-verset {
	font-family: var(--wp--preset--font-family--serif);
	font-style: italic;
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.35;
	font-weight: 500;
}

/* ---------- Titres : gothique & orné ---------- */
.is-style-gothique {
	font-family: var(--wp--preset--font-family--gothique) !important;
	font-weight: 400 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	line-height: 1.05;
}

.wp-block-heading.is-style-orne {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.wp-block-heading.is-style-orne.has-text-align-center {
	justify-content: center;
}

.wp-block-heading.is-style-orne::before,
.wp-block-heading.is-style-orne.has-text-align-center::after {
	content: "";
	flex: 0 0 auto;
	width: 0.7em;
	height: 0.7em;
	max-width: 22px;
	max-height: 22px;
	background-color: var(--a140-accent);
	-webkit-mask: var(--a140-cross) center / contain no-repeat;
	mask: var(--a140-cross) center / contain no-repeat;
}

/* ---------- Séparateur : croix ---------- */
.wp-block-separator.is-style-croix {
	position: relative;
	border: 0 !important;
	height: 22px;
	max-width: 280px;
	margin-left: auto;
	margin-right: auto;
	background:
		linear-gradient(var(--a140-line), var(--a140-line)) left center / calc(50% - 22px) 1px no-repeat,
		linear-gradient(var(--a140-line), var(--a140-line)) right center / calc(50% - 22px) 1px no-repeat;
	opacity: 1;
}

.wp-block-separator.is-style-croix::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 18px;
	height: 18px;
	transform: translate(-50%, -50%);
	background-color: var(--a140-accent);
	-webkit-mask: var(--a140-cross) center / contain no-repeat;
	mask: var(--a140-cross) center / contain no-repeat;
}

.wp-block-separator.is-style-croix.alignwide,
.wp-block-separator.is-style-croix.alignfull {
	max-width: none;
}

/* ---------- Liste : puces en croix ---------- */
.wp-block-list.is-style-croix {
	list-style: none;
	padding-left: 0;
}

.wp-block-list.is-style-croix li {
	position: relative;
	padding-left: 1.75rem;
	margin-bottom: 0.5rem;
}

.wp-block-list.is-style-croix li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.42em;
	width: 0.85em;
	height: 0.85em;
	background-color: var(--a140-accent);
	-webkit-mask: var(--a140-cross-pattee) center / contain no-repeat;
	mask: var(--a140-cross-pattee) center / contain no-repeat;
}

/* ---------- Arche (image, couverture, image mise en avant, image produit) ---------- */
.wp-block-image.is-style-arche img,
.wp-block-image.is-style-arche .components-resizable-box__container,
.wp-block-post-featured-image.is-style-arche img,
.wp-block-post-featured-image.is-style-arche,
.wp-block-cover.is-style-arche,
.wc-block-components-product-image.is-style-arche,
.wp-block-woocommerce-product-image.is-style-arche,
.is-style-arche .wc-block-components-product-image,
.is-style-arche > a > img,
.is-style-arche img {
	border-radius: var(--wp--custom--radius--arche, 999px 999px 0 0);
	overflow: hidden;
}

.wp-block-cover.is-style-arche {
	isolation: isolate;
}

/* ---------- Cadre doré ---------- */
.wp-block-group.is-style-cadre-or {
	border: 1px solid var(--a140-accent);
	outline: 1px solid var(--a140-accent);
	outline-offset: -9px;
}

.wp-block-image.is-style-cadre-or img {
	border: 1px solid var(--a140-accent);
	padding: 8px;
	background: transparent;
}

/* ---------- Groupe vitrail : nuit + rosace ---------- */
.wp-block-group.is-style-vitrail {
	position: relative;
	background-color: var(--wp--preset--color--nuit);
	background-image: var(--wp--preset--gradient--vitrail);
	color: var(--wp--preset--color--ivoire);
	isolation: isolate;
}

.wp-block-group.is-style-vitrail::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image: var(--a140-rosace);
	background-size: 160px 160px;
	opacity: 0.18;
	-webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 0%, transparent 75%);
	mask-image: radial-gradient(ellipse at 50% 40%, #000 0%, transparent 75%);
	pointer-events: none;
}

/* ---------- Boutons ---------- */
.wp-block-button__link,
.wp-element-button {
	transition: background-color var(--a140-ease), color var(--a140-ease), border-color var(--a140-ease), transform var(--a140-ease);
}

/* Contour : même gabarit que les boutons pleins (le style du cœur impose 2px et 0.667em/1.333em). */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: inherit;
	border: 1px solid currentColor;
	padding: 0.95rem 1.75rem;
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--nuit);
	color: var(--wp--preset--color--ivoire);
	border-color: var(--wp--preset--color--nuit);
}

.wp-block-button.is-style-contour-or > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--or);
	border: 1px solid var(--wp--preset--color--or);
}

.wp-block-button.is-style-contour-or > .wp-block-button__link:hover {
	background: var(--wp--preset--color--or);
	color: var(--wp--preset--color--nuit);
	border-color: var(--wp--preset--color--or);
}

.wp-block-button.is-style-lien > .wp-block-button__link {
	background: none;
	border: 0;
	padding: 0.25rem 0;
	color: inherit;
	border-bottom: 1px solid currentColor;
	border-radius: 0;
}

.wp-block-button.is-style-lien > .wp-block-button__link::after {
	content: " →";
	display: inline-block;
	transition: transform var(--a140-ease);
}

.wp-block-button.is-style-lien > .wp-block-button__link:hover {
	color: var(--wp--preset--color--pourpre);
	background: none;
}

.has-nuit-background-color .wp-block-button.is-style-lien > .wp-block-button__link:hover,
.is-style-vitrail .wp-block-button.is-style-lien > .wp-block-button__link:hover,
.wp-block-cover .wp-block-button.is-style-lien > .wp-block-button__link:hover {
	color: var(--wp--preset--color--or);
}

.wp-block-button.is-style-lien > .wp-block-button__link:hover::after {
	transform: translateX(4px);
}

/* Boutons pleins dans les zones sombres : passage à l'ivoire. */
:is(.has-nuit-background-color, .is-style-vitrail, .wp-block-cover:not(.is-light)) .wp-block-button:not([class*="is-style-"]) > .wp-block-button__link:not(.has-background),
:is(.has-nuit-background-color, .is-style-vitrail, .wp-block-cover:not(.is-light)) .wp-block-button.is-style-fill > .wp-block-button__link:not(.has-background) {
	background: var(--wp--preset--color--ivoire);
	color: var(--wp--preset--color--nuit);
	border-color: var(--wp--preset--color--ivoire);
}

:is(.has-nuit-background-color, .is-style-vitrail, .wp-block-cover:not(.is-light)) .wp-block-button:not([class*="is-style-"]) > .wp-block-button__link:not(.has-background):hover,
:is(.has-nuit-background-color, .is-style-vitrail, .wp-block-cover:not(.is-light)) .wp-block-button.is-style-fill > .wp-block-button__link:not(.has-background):hover {
	background: var(--wp--preset--color--or);
	border-color: var(--wp--preset--color--or);
	color: var(--wp--preset--color--nuit);
}

/* ---------- Citation / verset ---------- */
.wp-block-quote cite,
.wp-block-pullquote cite {
	display: block;
	margin-top: 0.75rem;
	color: var(--a140-accent);
}

/* ---------- Formulaires ---------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="password"],
input[type="url"],
select,
textarea {
	font: inherit;
	color: var(--wp--preset--color--nuit);
	background: var(--wp--preset--color--blanc);
	border: 1px solid var(--wp--preset--color--lin);
	border-radius: 2px;
	padding: 0.7rem 0.9rem;
	transition: border-color var(--a140-ease), box-shadow var(--a140-ease);
}

input:focus,
select:focus,
textarea:focus {
	border-color: var(--a140-focus);
	box-shadow: 0 0 0 1px var(--a140-focus), 0 0 0 4px rgba(194, 160, 99, 0.25);
	outline: none;
}

/*
 * Mobiles et écrans tactiles : iOS Safari zoome sur tout champ dont le texte fait moins de 16px
 * (et la page reste zoomée). Plancher de 16px pour les champs de saisie ; un champ plus grand
 * hérité de son parent (1em) est conservé. Seule exception volontaire du thème à la règle
 * « pas de !important » : aucune règle de zone ne doit pouvoir réintroduire ce zoom.
 */
@media (max-width: 781px), (hover: none) and (pointer: coarse) {
	input:not([type="checkbox"], [type="radio"], [type="range"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="image"], [type="color"], [type="hidden"]),
	select,
	textarea {
		font-size: max(16px, 1em) !important;
	}
}

/* ---------- Notices WooCommerce (blocs) : palette du thème au lieu du vert, bleu et rouge par défaut ---------- */
.wc-block-components-notice-banner {
	background-color: var(--wp--preset--color--ivoire);
	color: var(--wp--preset--color--nuit);
	border: 1px solid var(--wp--preset--color--lin);
	border-left: 2px solid var(--wp--preset--color--or-profond);
	border-radius: 2px;
}

.wc-block-components-notice-banner.is-success,
.wc-block-components-notice-banner.is-info {
	background-color: var(--wp--preset--color--ivoire);
	border-color: var(--wp--preset--color--lin);
	border-left-color: var(--wp--preset--color--or-profond);
}

.wc-block-components-notice-banner.is-warning {
	background-color: var(--wp--preset--color--ivoire);
	border-color: var(--wp--preset--color--lin);
	border-left-color: var(--wp--preset--color--or);
}

.wc-block-components-notice-banner.is-error {
	background-color: var(--wp--preset--color--ivoire);
	border-color: var(--wp--preset--color--lin);
	border-left-color: var(--wp--preset--color--pourpre);
}

.wc-block-components-notice-banner > svg {
	fill: var(--wp--preset--color--ivoire);
	background-color: var(--wp--preset--color--or-profond);
}

.wc-block-components-notice-banner.is-success > svg,
.wc-block-components-notice-banner.is-info > svg {
	background-color: var(--wp--preset--color--or-profond);
}

.wc-block-components-notice-banner.is-warning > svg {
	fill: var(--wp--preset--color--nuit);
	background-color: var(--wp--preset--color--or);
}

.wc-block-components-notice-banner.is-error > svg {
	background-color: var(--wp--preset--color--pourpre);
}

.wc-block-components-notice-banner > .wc-block-components-notice-banner__content .wc-forward {
	color: var(--wp--preset--color--nuit) !important; /* WooCommerce impose sa couleur en !important */
	opacity: 1;
	font-weight: 600;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.wc-block-components-notice-banner > .wc-block-components-notice-banner__content .wc-forward:hover {
	color: var(--wp--preset--color--pourpre) !important;
	text-decoration: underline;
}

/* La notice reçoit le focus par script après un ajout au panier : un filet discret, pas un cadre noir. */
.wc-block-components-notice-banner:focus-visible {
	outline: 1px solid var(--a140-focus);
	outline-offset: 2px;
}

/* ---------- Apparition douce (respecte prefers-reduced-motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
	.a140-reveal {
		animation: a140-fade-up 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	@keyframes a140-fade-up {
		from { opacity: 0; transform: translateY(14px); }
		to { opacity: 1; transform: none; }
	}
}

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