/*
Theme Name:   Trésors de Chapitre
Theme URI:    https://tresorsdechapitre.com
Description:  Thème sur mesure de la boutique Trésors de Chapitre : univers fantasy, deux ambiances (Dark Romance, Romantasy), effets magiques légers.
Author:       Sophie Dehareng
Template:     twentytwentyfive
Version:      0.19.0
Requires at least: 6.5
Text Domain:  tresors-de-chapitre
*/

/* -----------------------------------------------------------------
   Ce fichier sert surtout à déclarer le thème (en-tête ci-dessus).
   Les couleurs, polices et tailles vivent dans theme.json.
   Les effets magiques vivent dans assets/css/magic.css et assets/js/magic.js.
   Ici : seulement quelques finitions que theme.json ne sait pas faire.
   ----------------------------------------------------------------- */

/* Sélection de texte aux couleurs de la marque */
::selection {
	background: var(--wp--preset--color--or);
	color: var(--wp--preset--color--prune);
}

/* Liens : soulignement fin et doré, plus élégant que le trait par défaut */
:where(.wp-site-blocks) a:where(:not(.wp-element-button)) {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	text-decoration-color: var(--wp--preset--color--or);
}

/* Focus clavier visible (accessibilité) */
:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--or);
	outline-offset: 3px;
}

/* -----------------------------------------------------------------
   EN-TÊTE
   ----------------------------------------------------------------- */

/* L'en-tête reste visible en haut quand on fait défiler (pratique au pouce).
   Le « collant » se pose sur l'enveloppe créée par WordPress autour de l'en-tête. */
.wp-block-template-part:has(> .tdc-entete) {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}

.tdc-entete {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0;
	padding: 10px max(16px, calc((100% - 1200px) / 2));
	border-bottom: 1px solid rgba(201, 164, 92, 0.45);
	background: rgba(244, 237, 228, 0.94);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.tdc-entete > * {
	margin: 0 !important;
}

.tdc-entete__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Le logo compact : le livre + le nom en Cormorant */
.tdc-marque {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none !important;
	color: var(--wp--preset--color--prune);
	flex-shrink: 0;
}

.tdc-entete .tdc-marque__livre {
	height: 40px !important;
	width: auto !important;
	max-width: none !important;
	transition: transform 0.5s ease;
}

.tdc-marque:hover .tdc-marque__livre {
	transform: translateY(-2px) rotate(-3deg);
}

.tdc-marque__nom {
	font-family: var(--wp--preset--font-family--titre);
	font-size: 1.35rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
}

.tdc-marque__nom em {
	font-size: 0.7em;
	font-style: normal;
	letter-spacing: 0.1em;
}

/* -----------------------------------------------------------------
   MENU — ordinateur : liens en ligne ; téléphone : bouton + rideau étoilé
   ----------------------------------------------------------------- */

/* Liens en ligne (ordinateur) */
.tdc-nav {
	display: none;
	margin-left: auto !important;
}

.tdc-nav__liens {
	display: flex;
	align-items: center;
	gap: 30px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tdc-nav a {
	position: relative;
	display: inline-block;
	padding: 6px 0;
	font-weight: 600;
	letter-spacing: 0.03em;
	color: var(--wp--preset--color--prune);
	text-decoration: none;
}

/* Trait doré qui se dessine sous le lien survolé ou actif */
.tdc-nav a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 1px;
	background: var(--wp--preset--color--or);
	transform: scaleX(0);
	transition: transform 0.35s ease;
}

.tdc-nav a:hover::after,
.tdc-nav a[aria-current="page"]::after {
	transform: scaleX(1);
}

/* « La Box » mise en avant : petit ovale doré */
.tdc-nav a.tdc-nav__box {
	padding: 6px 16px;
	border: 1px solid var(--wp--preset--color--or);
	border-radius: 999px;
}

.tdc-nav a.tdc-nav__box::after {
	display: none;
}

.tdc-nav a.tdc-nav__box:hover,
.tdc-nav a.tdc-nav__box[aria-current="page"] {
	background: var(--wp--preset--color--prune);
	color: var(--wp--preset--color--creme);
}

/* Panier : assez grand pour le pouce (44 px) */
.tdc-entete .wc-block-mini-cart__button {
	min-width: 44px;
	min-height: 44px;
	color: var(--wp--preset--color--prune);
}

/* Bouton du menu (téléphone) : trois traits qui deviennent une croix */
.tdc-burger {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(201, 164, 92, 0.6);
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--prune);
	cursor: pointer;
	transition: background 0.3s ease;
}

.tdc-burger:hover {
	background: rgba(201, 164, 92, 0.15);
}

.tdc-burger__traits {
	position: relative;
	display: block;
	width: 18px;
	height: 12px;
}

.tdc-burger__traits span {
	position: absolute;
	left: 0;
	height: 1.5px;
	border-radius: 2px;
	background: currentColor;
	transition: transform 0.35s ease, opacity 0.25s ease, width 0.35s ease;
}

.tdc-burger__traits span:nth-child(1) { top: 0; width: 100%; }
.tdc-burger__traits span:nth-child(2) { top: 5px; width: 70%; }
.tdc-burger__traits span:nth-child(3) { top: 10px; width: 100%; }

.tdc-burger:hover .tdc-burger__traits span:nth-child(2) {
	width: 100%;
}

/* Le rideau */
.tdc-rideau {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	padding: 14px 20px max(28px, env(safe-area-inset-bottom));
	overflow-y: auto;
	color: var(--wp--preset--color--creme);
	background:
		radial-gradient(ellipse at 50% 0%, rgba(201, 164, 92, 0.22), transparent 55%),
		radial-gradient(ellipse at 0% 100%, rgba(107, 63, 160, 0.55), transparent 55%),
		linear-gradient(170deg, #2B1240 0%, #4B1B45 55%, #3A1D63 100%);
	clip-path: circle(0 at calc(100% - 38px) 34px);
	transition: clip-path 0.55s cubic-bezier(0.7, 0, 0.2, 1);
}

.tdc-rideau[hidden] {
	display: none;
}

/* Il s'ouvre en cercle depuis le bouton, comme une bulle de magie */
.tdc-rideau.est-ouvert {
	clip-path: circle(150% at calc(100% - 38px) 34px);
}

/* Petit ciel étoilé en fond */
.tdc-rideau__ciel {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

.tdc-rideau__ciel i {
	position: absolute;
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: #F6E3A8;
	box-shadow: 0 0 6px 1px rgba(246, 227, 168, 0.8);
	opacity: 0;
	animation: tdc-ciel 3.2s ease-in-out infinite;
}

.tdc-rideau__ciel i:nth-child(1)  { top: 12%; left: 14%; animation-delay: 0s; }
.tdc-rideau__ciel i:nth-child(2)  { top: 22%; left: 78%; animation-delay: 0.4s; }
.tdc-rideau__ciel i:nth-child(3)  { top: 35%; left: 8%;  animation-delay: 1.1s; }
.tdc-rideau__ciel i:nth-child(4)  { top: 48%; left: 88%; animation-delay: 1.6s; }
.tdc-rideau__ciel i:nth-child(5)  { top: 62%; left: 20%; animation-delay: 0.7s; }
.tdc-rideau__ciel i:nth-child(6)  { top: 70%; left: 70%; animation-delay: 2.1s; }
.tdc-rideau__ciel i:nth-child(7)  { top: 82%; left: 40%; animation-delay: 1.3s; }
.tdc-rideau__ciel i:nth-child(8)  { top: 8%;  left: 52%; animation-delay: 2.5s; }
.tdc-rideau__ciel i:nth-child(9)  { top: 90%; left: 85%; animation-delay: 0.2s; }
.tdc-rideau__ciel i:nth-child(10) { top: 55%; left: 50%; animation-delay: 2.8s; width: 2px; height: 2px; }
.tdc-rideau__ciel i:nth-child(11) { top: 28%; left: 35%; animation-delay: 1.9s; width: 2px; height: 2px; }
.tdc-rideau__ciel i:nth-child(12) { top: 76%; left: 5%;  animation-delay: 0.9s; width: 2px; height: 2px; }

@keyframes tdc-ciel {
	0%, 100% { opacity: 0;   transform: scale(0.6); }
	50%      { opacity: 0.9; transform: scale(1.2); }
}

.tdc-rideau__haut {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 48px;
}

.tdc-rideau__logo img {
	display: block;
	width: auto;
	height: 40px;
}

/* Croix de fermeture */
.tdc-rideau__fermer {
	position: relative;
	width: 44px;
	height: 44px;
	border: 1px solid rgba(201, 164, 92, 0.6);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.tdc-rideau__fermer span,
.tdc-rideau__fermer span::before {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 1.5px;
	margin: -0.75px 0 0 -9px;
	background: var(--wp--preset--color--or);
	transform: rotate(45deg);
}

.tdc-rideau__fermer span::before {
	content: "";
	margin: 0;
	top: 0;
	left: 0;
	transform: rotate(90deg);
}

/* Les liens : grands, en Cormorant, qui apparaissent l'un après l'autre */
.tdc-rideau__nav {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 0;
}

.tdc-rideau__nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	text-align: center;
}

.tdc-rideau__nav li,
.tdc-rideau__bas {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
	transition-delay: calc(0.18s + var(--i, 0) * 0.07s);
}

.tdc-rideau.est-ouvert .tdc-rideau__nav li,
.tdc-rideau.est-ouvert .tdc-rideau__bas {
	opacity: 1;
	transform: none;
}

.tdc-rideau__nav a {
	position: relative;
	display: inline-block;
	padding: 8px 4px;
	font-family: var(--wp--preset--font-family--titre);
	font-size: clamp(2.1rem, 9vw, 2.8rem);
	font-weight: 500;
	line-height: 1.15;
	color: var(--wp--preset--color--creme);
	text-decoration: none;
}

.tdc-rideau__nav a:hover,
.tdc-rideau__nav a:focus-visible,
.tdc-rideau__nav a[aria-current="page"] {
	color: var(--wp--preset--color--or);
}

/* Petite étoile devant la page en cours */
.tdc-rideau__nav a[aria-current="page"]::before {
	content: "✦";
	position: absolute;
	left: -1.1em;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.5em;
	color: var(--wp--preset--color--or);
}

/* Bas du rideau : bouton doré + Instagram */
.tdc-rideau__bas {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.tdc-rideau__cta.wp-element-button {
	box-sizing: border-box;
	width: 100%;
	max-width: 340px;
	text-align: center;
	background: var(--wp--preset--color--or);
	color: var(--wp--preset--color--prune);
	border-color: #E8CF94;
}

.tdc-rideau__insta {
	font-size: 0.95rem;
	color: var(--wp--preset--color--creme);
	opacity: 0.8;
	text-decoration: none;
}

/* La page derrière ne défile pas quand le menu est ouvert */
html.tdc-menu-ouvert,
html.tdc-menu-ouvert body {
	overflow: hidden;
}

/* À partir de 900 px : liens en ligne, plus de bouton */
@media (min-width: 900px) {
	.tdc-nav {
		display: block;
	}

	.tdc-burger,
	.tdc-rideau {
		display: none !important;
	}

	.tdc-entete__actions {
		margin-left: 24px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tdc-rideau,
	.tdc-rideau__nav li,
	.tdc-rideau__bas {
		transition: none;
	}

	.tdc-rideau__ciel i {
		animation: none;
		opacity: 0.6;
	}
}

/* Sur téléphone : logo plus compact pour laisser la place au panier et au menu */
@media (max-width: 899px) {
	.tdc-entete {
		gap: 8px;
	}

	.tdc-marque {
		gap: 8px;
		min-width: 0;
		flex-shrink: 1;
	}

	.tdc-entete .tdc-marque__livre {
		height: 32px !important;
	}

	.tdc-marque__nom {
		font-size: 1.05rem;
		letter-spacing: 0.04em;
	}

	.tdc-entete__actions {
		gap: 4px;
		flex-shrink: 0;
	}
}

@media (max-width: 360px) {
	.tdc-marque__nom {
		font-size: 0.92rem;
		letter-spacing: 0.02em;
	}
}

@media (max-width: 320px) {
	.tdc-marque__nom {
		display: none;
	}
}

/* -----------------------------------------------------------------
   PIED DE PAGE
   ----------------------------------------------------------------- */

.tdc-pied {
	margin: 0;
	padding: 56px 16px 28px;
	background: var(--wp--preset--color--prune);
	color: var(--wp--preset--color--creme);
}

.tdc-pied__interieur {
	max-width: 1200px;
	margin: 0 auto;
}

.tdc-pied__colonnes {
	display: grid;
	gap: 32px;
	margin-top: 40px;
}

.tdc-pied h3 {
	color: var(--wp--preset--color--or);
	font-size: var(--wp--preset--font-size--large);
	margin: 0 0 14px;
}

.tdc-pied__logo img {
	width: 140px;
	height: auto;
	display: block;
	margin-bottom: 8px;
}

.tdc-pied__marque p {
	font-size: var(--wp--preset--font-size--small);
	max-width: 320px;
}

.tdc-pied__liens,
.tdc-pied__reseaux {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tdc-pied__liens {
	display: grid;
	gap: 10px;
}

.tdc-pied__reseaux {
	display: flex;
	gap: 14px;
}

.tdc-pied__reseaux a {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 1px solid rgba(201, 164, 92, 0.5);
	border-radius: 50%;
	transition: background 0.3s ease, transform 0.3s ease;
}

.tdc-pied__reseaux a:hover {
	background: rgba(201, 164, 92, 0.18);
	transform: translateY(-2px);
}

.tdc-pied__reseaux svg {
	width: 20px;
	height: 20px;
}

.tdc-pied a {
	color: var(--wp--preset--color--creme);
	text-decoration: none;
}

.tdc-pied a:hover {
	color: var(--wp--preset--color--or);
}

.tdc-pied__copyright {
	margin: 48px 0 0;
	padding-top: 20px;
	text-align: center;
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.7;
	border-top: 1px solid rgba(201, 164, 92, 0.3);
}

@media (min-width: 782px) {
	.tdc-pied__colonnes {
		grid-template-columns: 1.4fr 1fr 1fr 1fr;
		gap: 40px;
	}
}

/* Séparateur ornemental : ajouter la classe « tdc-ornement » à un bloc Séparateur */
.wp-block-separator.tdc-ornement,
hr.tdc-ornement {
	border: none;
	height: 24px;
	max-width: 280px;
	margin-inline: auto;
	opacity: 1;
	background: center / contain no-repeat url("assets/images/ornement.svg");
}

/* Pas d'espace crème entre le contenu et le pied de page */
.wp-block-template-part:has(> .tdc-pied) {
	margin-top: 0;
}

/* Évite le défilement horizontal causé par les bannières pleine largeur */
html,
body {
	overflow-x: clip;
}

/* -----------------------------------------------------------------
   PAGES DE TEXTE (FAQ, Livraison & retours, Contact, CGV…)
   ----------------------------------------------------------------- */

body.page .wp-block-post-title {
	text-align: center;
	font-size: clamp(2.3rem, 8vw, 3.4rem);
	margin-top: 40px;
}

body.page .wp-block-post-title::after {
	content: "";
	display: block;
	width: 220px;
	height: 22px;
	margin: 14px auto 0;
	background: center / contain no-repeat url("assets/images/ornement.svg");
}

body.page .wp-block-post-content {
	max-width: 720px;
	margin-left: auto;
	margin-right: auto;
	padding-bottom: 64px;
}

body.page .wp-block-post-content h2 {
	margin-top: 2em;
	font-size: clamp(1.6rem, 5vw, 2rem);
}

body.page .wp-block-post-content h2::before {
	content: "✦ ";
	font-size: 0.6em;
	vertical-align: middle;
	color: var(--wp--preset--color--or);
}

body.page .wp-block-post-content li::marker {
	color: var(--wp--preset--color--or);
}

/* Phrase d'introduction */
.tdc-intro {
	font-family: var(--wp--preset--font-family--titre);
	font-size: 1.45rem;
	line-height: 1.45;
	text-align: center;
	color: var(--wp--preset--color--prune);
}

/* Note interne (trames juridiques à valider) */
.tdc-note {
	padding: 12px 16px;
	border-radius: 10px;
	border: 1px dashed var(--wp--preset--color--or);
	background: var(--wp--preset--color--parchemin);
	font-size: 0.9rem;
}

/* Passages à compléter : bien visibles pour ne pas les oublier */
mark.tdc-a-completer {
	background: #FFF3EE;
	color: #8C1A32;
	border: 1px dashed #C0392B;
	border-radius: 4px;
	padding: 0 4px;
}

/* FAQ : questions dépliables */
.tdc-faq.wp-block-details {
	margin: 10px 0;
	border-radius: 12px;
	border: 1px solid rgba(201, 164, 92, 0.5);
	background: var(--wp--preset--color--parchemin);
	overflow: hidden;
}

.tdc-faq summary {
	position: relative;
	min-height: 44px;
	padding: 14px 48px 14px 18px;
	font-weight: 600;
	color: var(--wp--preset--color--prune);
	cursor: pointer;
	list-style: none;
}

.tdc-faq summary::-webkit-details-marker {
	display: none;
}

.tdc-faq summary::after {
	content: "+";
	position: absolute;
	right: 18px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.4rem;
	color: var(--wp--preset--color--or);
	transition: transform 0.3s ease;
}

.tdc-faq[open] summary::after {
	transform: translateY(-50%) rotate(45deg);
}

.tdc-faq[open] summary {
	border-bottom: 1px solid rgba(201, 164, 92, 0.3);
}

.tdc-faq > p {
	margin: 0;
	padding: 14px 18px 16px;
}

/* -----------------------------------------------------------------
   BANDEAU COOKIES (extension Complianz) aux couleurs du site
   « Refuser » reste aussi visible qu'« Accepter » (exigence RGPD).
   ----------------------------------------------------------------- */

.cmplz-cookiebanner {
	background: linear-gradient(160deg, #2B1240 0%, #4B1B45 60%, #3A1D63 100%) !important;
	color: var(--wp--preset--color--creme) !important;
	border: 1px solid rgba(201, 164, 92, 0.7) !important;
	border-radius: 18px !important;
	box-shadow: 0 24px 50px -16px rgba(20, 10, 30, 0.7) !important;
	font-family: var(--wp--preset--font-family--texte) !important;
}

.cmplz-cookiebanner .cmplz-title {
	font-family: var(--wp--preset--font-family--titre) !important;
	font-size: 1.5rem !important;
	font-weight: 600 !important;
	color: var(--wp--preset--color--or) !important;
}

.cmplz-cookiebanner .cmplz-title::before {
	content: "✦ ";
	font-size: 0.7em;
}

.cmplz-cookiebanner .cmplz-message,
.cmplz-cookiebanner .cmplz-message p,
.cmplz-cookiebanner .cmplz-categories,
.cmplz-cookiebanner .cmplz-category-title,
.cmplz-cookiebanner .cmplz-description {
	color: var(--wp--preset--color--creme) !important;
	font-size: 0.95rem !important;
	line-height: 1.55 !important;
}

.cmplz-cookiebanner .cmplz-btn {
	min-height: 46px !important;
	border-radius: 999px !important;
	font-family: var(--wp--preset--font-family--texte) !important;
	font-weight: 600 !important;
	font-size: 0.95rem !important;
	letter-spacing: 0.03em;
	transition: background 0.25s ease, color 0.25s ease;
}

.cmplz-cookiebanner .cmplz-btn.cmplz-accept {
	background: var(--wp--preset--color--or) !important;
	border: 1px solid #E8CF94 !important;
	color: var(--wp--preset--color--prune) !important;
}

.cmplz-cookiebanner .cmplz-btn.cmplz-accept:hover {
	background: #E0C07A !important;
}

.cmplz-cookiebanner .cmplz-btn.cmplz-deny,
.cmplz-cookiebanner .cmplz-btn.cmplz-view-preferences,
.cmplz-cookiebanner .cmplz-btn.cmplz-save-preferences {
	background: transparent !important;
	border: 1px solid rgba(244, 237, 228, 0.7) !important;
	color: var(--wp--preset--color--creme) !important;
}

.cmplz-cookiebanner .cmplz-btn.cmplz-deny:hover,
.cmplz-cookiebanner .cmplz-btn.cmplz-view-preferences:hover,
.cmplz-cookiebanner .cmplz-btn.cmplz-save-preferences:hover {
	background: rgba(244, 237, 228, 0.12) !important;
}

.cmplz-cookiebanner .cmplz-close,
.cmplz-cookiebanner .cmplz-close svg path {
	color: var(--wp--preset--color--creme) !important;
	fill: var(--wp--preset--color--creme) !important;
}

.cmplz-cookiebanner .cmplz-links a,
.cmplz-cookiebanner .cmplz-documents a,
.cmplz-cookiebanner .cmplz-link {
	color: var(--wp--preset--color--or) !important;
}

/* Écran « Voir les préférences » */
.cmplz-cookiebanner .cmplz-category {
	background: rgba(244, 237, 228, 0.07) !important;
	border-radius: 12px !important;
}

.cmplz-cookiebanner .cmplz-always-active {
	color: var(--wp--preset--color--or) !important;
}

/* Petit bouton « Gérer le consentement » qui reste en bas de l'écran */
.cmplz-manage-consent {
	background: var(--wp--preset--color--prune) !important;
	color: var(--wp--preset--color--creme) !important;
	border: 1px solid var(--wp--preset--color--or) !important;
	font-family: var(--wp--preset--font-family--texte) !important;
}
