/**
 * 10-base.css — Reset ciblé, typographie, éléments natifs, accessibilité.
 *
 * Pas de `* { margin: 0 }` : un reset trop large écrase les blocs Gutenberg
 * et les extensions. On remet à zéro ce qu'on redéfinit, rien d'autre.
 *
 * @package Tresor_Sublime
 */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--ts-entete-h) + var(--ts-2));
}

@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 {
	margin: 0;
	background-color: var(--ts-papier);
	color: var(--ts-encre);
	font-family: var(--ts-texte);
	font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
	font-weight: 400;
	line-height: 1.68;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------
 * Titres
 * ----------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 var(--ts-2);
	font-family: var(--ts-titre);
	font-weight: 400;
	line-height: 1.16;
	color: var(--ts-encre);
	text-wrap: balance;
}

h1 { font-size: var(--ts-t-5); }
h2 { font-size: var(--ts-t-4); }
h3 { font-size: var(--ts-t-3); }
h4 { font-size: var(--ts-t-2); }
h5 { font-size: var(--ts-t-1); }
h6 {
	font-family: var(--ts-rubr);
	font-size: var(--ts-t--1);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ts-laiton);
}

/* --------------------------------------------------------------
 * Texte courant
 * ----------------------------------------------------------- */

p {
	margin: 0 0 1.15em;
}

/* Une URL collée ou un mot très long ne doit jamais élargir la page. */
p, li, dd, h1, h2, h3, h4, h5, h6, blockquote, figcaption {
	overflow-wrap: break-word;
}

a {
	color: var(--ts-vert);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color var(--ts-transit);
}

a:hover,
a:focus {
	color: var(--ts-laiton);
}

strong, b {
	font-weight: 600;
}

em, i {
	font-style: italic;
}

small {
	font-size: var(--ts-t--1);
}

hr {
	height: 1px;
	margin: var(--ts-4) 0;
	border: 0;
	background-color: var(--ts-filet);
}

blockquote {
	margin: var(--ts-3) 0;
	padding: 0 0 0 var(--ts-3);
	border-left: 2px solid var(--ts-laiton);
	font-family: var(--ts-titre);
	font-size: var(--ts-t-2);
	line-height: 1.4;
	color: var(--ts-encre);
}

blockquote p:last-child {
	margin-bottom: 0;
}

blockquote cite {
	display: block;
	margin-top: var(--ts-1);
	font-family: var(--ts-rubr);
	font-size: var(--ts-t--1);
	font-style: normal;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ts-encre-pale);
}

ul, ol {
	margin: 0 0 1.15em;
	padding-left: 1.35em;
}

li {
	margin-bottom: 0.35em;
}

code, kbd, samp, pre {
	font-family: var(--ts-mono);
	font-size: 0.875em;
}

code {
	padding: 0.1em 0.36em;
	border-radius: var(--ts-rayon);
	background-color: var(--ts-papier-bas);
	color: var(--ts-encre-douce);
}

pre {
	margin: var(--ts-3) 0;
	padding: var(--ts-2) var(--ts-3);
	overflow-x: auto;
	border: 1px solid var(--ts-filet);
	border-left: 2px solid var(--ts-laiton);
	border-radius: var(--ts-rayon);
	background-color: var(--ts-papier-haut);
	line-height: 1.7;
}

pre code {
	padding: 0;
	background: none;
}

/* --------------------------------------------------------------
 * Médias
 * ----------------------------------------------------------- */

img, svg, video, canvas, iframe {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

img {
	border-radius: var(--ts-rayon);
}

figure {
	margin: var(--ts-3) 0;
}

/* Vidéos et contenus embarqués : toujours à la bonne échelle. */
.ts-embed {
	position: relative;
	margin: var(--ts-3) 0;
	aspect-ratio: 16 / 9;
	border-radius: var(--ts-rayon);
	overflow: hidden;
	background-color: var(--ts-papier-bas);
}

.ts-embed iframe,
.ts-embed video,
.ts-embed object,
.ts-embed embed {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Les intégrations sans ratio fixe (Twitter, Instagram…) gardent leur hauteur. */
.ts-embed:has(blockquote),
.ts-embed:has(.twitter-tweet) {
	aspect-ratio: auto;
}

figcaption,
.wp-caption-text {
	margin-top: var(--ts-1);
	font-family: var(--ts-rubr);
	font-size: var(--ts-t--1);
	line-height: 1.5;
	color: var(--ts-encre-pale);
}

/* --------------------------------------------------------------
 * Tableaux
 * ----------------------------------------------------------- */

/* Enveloppe posée autour de chaque tableau du contenu : c'est elle qui
   défile, pas la page entière. */
.ts-tableau {
	margin: var(--ts-3) 0;
	padding-bottom: 2px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	/* Le cadre dit au lecteur que le tableau glisse, il ne le devine pas. */
	border: 1px solid var(--ts-filet);
	border-radius: var(--ts-rayon);
}

.ts-tableau th:first-child,
.ts-tableau td:first-child {
	padding-left: var(--ts-2);
}

.ts-tableau tr:last-child td {
	border-bottom: 0;
}

.ts-tableau table {
	margin: 0;
	min-width: 32rem;
}

table {
	width: 100%;
	margin: var(--ts-3) 0;
	border-collapse: collapse;
	font-size: var(--ts-t--1);
	font-variant-numeric: tabular-nums;
}

th, td {
	padding: var(--ts-1) var(--ts-2);
	border-bottom: 1px solid var(--ts-filet);
	text-align: left;
}

th {
	font-family: var(--ts-rubr);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-size: 0.75rem;
	color: var(--ts-encre-douce);
}

/* --------------------------------------------------------------
 * Formulaires
 * ----------------------------------------------------------- */

input, textarea, select, button {
	font: inherit;
	color: inherit;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="password"],
textarea,
select {
	width: 100%;
	padding: 0.7em 0.9em;
	border: 1px solid var(--ts-filet-fort);
	border-radius: var(--ts-rayon);
	background-color: var(--ts-papier-haut);
	color: var(--ts-encre);
	font-size: 1rem; /* 16px : empêche le zoom automatique sur iOS */
	transition: border-color var(--ts-transit), box-shadow var(--ts-transit);
}

input::placeholder,
textarea::placeholder {
	color: var(--ts-encre-pale);
	opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--ts-vert);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ts-vert) 18%, transparent);
}

textarea {
	min-height: 9rem;
	resize: vertical;
}

button,
input[type="submit"],
.ts-bouton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ts-1);
	padding: 0.72em 1.4em;
	border: 1px solid var(--ts-vert);
	border-radius: var(--ts-rayon);
	background-color: var(--ts-vert);
	color: var(--ts-papier-haut);
	font-family: var(--ts-rubr);
	font-size: var(--ts-t--1);
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--ts-transit), color var(--ts-transit), border-color var(--ts-transit);
}

button:hover,
input[type="submit"]:hover,
.ts-bouton:hover,
.ts-bouton:focus {
	background-color: var(--ts-vert-profond);
	border-color: var(--ts-vert-profond);
	color: var(--ts-papier-haut);
}

body.ts-sombre-auto .ts-bouton,
body.ts-sombre-auto button,
body.ts-sombre-auto input[type="submit"] {
	color: var(--ts-papier-bas);
}

/* Sur fond vert, c'est le laiton qui porte l'appel à l'action. */
.ts-bouton--laiton {
	background-color: var(--ts-laiton-clair);
	border-color: var(--ts-laiton-clair);
	color: var(--ts-panneau-2);
}

.ts-bouton--laiton:hover,
.ts-bouton--laiton:focus {
	background-color: var(--ts-panneau-encre);
	border-color: var(--ts-panneau-encre);
	color: var(--ts-panneau-2);
}

.ts-bouton--fantome {
	background: none;
	color: var(--ts-vert);
	border-color: var(--ts-filet-fort);
}

.ts-bouton--fantome:hover,
.ts-bouton--fantome:focus {
	background-color: var(--ts-vert);
	border-color: var(--ts-vert);
	color: var(--ts-papier-haut);
}

/* --------------------------------------------------------------
 * Accessibilité
 * ----------------------------------------------------------- */

:focus-visible {
	outline: 2px solid var(--ts-laiton);
	outline-offset: 3px;
	border-radius: var(--ts-rayon);
}

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

.screen-reader-text:focus {
	z-index: 10000;
	top: var(--ts-1);
	left: var(--ts-1);
	width: auto;
	height: auto;
	padding: var(--ts-1) var(--ts-2);
	clip: auto;
	clip-path: none;
	background-color: var(--ts-papier-haut);
	color: var(--ts-encre);
	font-family: var(--ts-rubr);
	font-size: var(--ts-t--1);
	text-decoration: none;
	box-shadow: var(--ts-ombre);
}

.ts-lien-evitement {
	position: absolute;
	top: -100px;
	left: var(--ts-2);
	z-index: 10000;
	padding: var(--ts-1) var(--ts-2);
	background-color: var(--ts-papier-haut);
	color: var(--ts-encre);
	font-family: var(--ts-rubr);
	font-size: var(--ts-t--1);
	text-decoration: none;
	box-shadow: var(--ts-ombre);
	transition: top var(--ts-transit);
}

.ts-lien-evitement:focus {
	top: var(--ts-1);
}

/* --------------------------------------------------------------
 * Deux utilitaires, pas trois
 * ----------------------------------------------------------- */

.ts-centre {
	text-align: center;
}

.ts-gauche {
	text-align: left;
}

.ts-espace-avant {
	margin-top: var(--ts-5);
}

/* --------------------------------------------------------------
 * Alignements WordPress
 * ----------------------------------------------------------- */

.alignleft {
	float: left;
	margin: 0.35em var(--ts-3) var(--ts-2) 0;
}

.alignright {
	float: right;
	margin: 0.35em 0 var(--ts-2) var(--ts-3);
}

.aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.alignwide,
.alignfull {
	max-width: none;
}

@media (max-width: 600px) {
	.alignleft,
	.alignright {
		float: none;
		display: block;
		margin: var(--ts-3) 0;
	}
}

.sticky {
	position: relative;
}

/* --------------------------------------------------------------
 * Ornement — le rub el hizb, séparateur du thème
 * ----------------------------------------------------------- */

.ts-ornement {
	font-family: var(--ts-titre);
	color: var(--ts-laiton);
	line-height: 1;
	display: inline-block;
}

.ts-filet-orne {
	display: flex;
	align-items: center;
	gap: var(--ts-2);
	margin: var(--ts-4) 0;
	color: var(--ts-filet-fort);
}

.ts-filet-orne::before,
.ts-filet-orne::after {
	content: "";
	flex: 1;
	height: 1px;
	background-color: currentColor;
}

.ts-filet-orne .ts-ornement {
	font-size: 1.35rem;
}

/* --------------------------------------------------------------
 * Styles de blocs proposés dans l'éditeur (voir inc/editeur.php)
 * ----------------------------------------------------------- */

/* « Vers » : conserve les retours à la ligne saisis dans l'éditeur. */
.is-style-ts-vers {
	white-space: pre-line;
	font-family: var(--ts-titre);
	font-size: 1.28rem;
	line-height: 1.95;
}

/* « Arabe » : Amiri assure le naskh dans la même fonte que les titres. */
.is-style-ts-arabe,
[lang="ar"] {
	direction: rtl;
	text-align: right;
	font-family: var(--ts-titre);
	font-size: 1.45em;
	line-height: 2.1;
	overflow-wrap: break-word;
}

/* « Exergue » : la citation prend toute la place, sans filet. */
.wp-block-quote.is-style-ts-exergue {
	padding: 0;
	border: 0;
	text-align: center;
	font-size: var(--ts-t-3);
	line-height: 1.35;
}

/* « Ornement » : le séparateur devient le rub el hizb. */
.wp-block-separator.is-style-ts-ornement {
	position: relative;
	height: auto;
	margin-block: var(--ts-4);
	border: 0;
	background: none;
	text-align: center;
}

.wp-block-separator.is-style-ts-ornement::before {
	content: "۞";
	font-family: var(--ts-titre);
	font-size: 1.5rem;
	line-height: 1;
	color: var(--ts-laiton);
}
