/**
 * BooThème — Reset intelligent des classes WordPress.
 *
 * Chargé juste après Bootstrap. Principe : ne pas réinventer de design, mais
 * faire correspondre les classes produites par WordPress (éditeur classique,
 * widgets, commentaires, galeries…) aux conventions et variables Bootstrap
 * (--bs-*). Ainsi, tout changement dans Réglages > Thème site s'applique aussi
 * au contenu généré par WordPress.
 *
 * Sommaire
 *   1. Accessibilité
 *   2. Alignements (éditeur classique)
 *   3. Légendes et médias
 *   4. Galeries
 *   5. Contenu éditorial (tables, citations, code)
 *   6. Widgets classiques
 *   7. Commentaires
 *   8. Divers (sticky, formulaire mot de passe, pagination interne)
 *   9. Balisage de blocs résiduel (anciens contenus)
 *  10. Équivalents des styles inline retirés (inc/core/inline-styles.php)
 */

/* ==========================================================================
   1. Accessibilité — équivalent de .visually-hidden / .visually-hidden-focusable
   ========================================================================== */

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

.screen-reader-text:focus {
	z-index: 100000;
	top: .5rem;
	left: .5rem;
	width: auto !important;
	height: auto !important;
	padding: .5rem 1rem !important;
	margin: 0 !important;
	clip: auto !important;
	white-space: normal !important;
	color: var(--bs-body-color);
	background-color: var(--bs-body-bg);
	border-radius: var(--bs-border-radius);
	box-shadow: var(--bs-box-shadow);
}

/* ==========================================================================
   2. Alignements de l'éditeur classique
   ========================================================================== */

.alignleft {
	float: left;
	margin: .375rem 1.5rem 1rem 0;
}

.alignright {
	float: right;
	margin: .375rem 0 1rem 1.5rem;
}

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

.alignnone {
	margin-bottom: 1rem;
}

@media (max-width: 575.98px) {
	.alignleft,
	.alignright {
		float: none;
		margin-right: 0;
		margin-left: 0;
	}
}

/* Les contenus flottants ne débordent pas de leur conteneur. */
.entry-content::after {
	display: block;
	clear: both;
	content: "";
}

/* ==========================================================================
   3. Légendes et médias — alignés sur .figure / .figure-caption
   ========================================================================== */

.wp-caption {
	display: inline-block;
	max-width: 100%;
	margin-bottom: 1rem;
}

.wp-caption img {
	display: block;
	max-width: 100%;
	height: auto;
	margin-bottom: .5rem;
	line-height: 1;
}

.wp-caption-text,
.gallery-caption {
	font-size: .875em;
	color: var(--bs-secondary-color);
}

.entry-content img,
.widget img,
.comment-content img {
	max-width: 100%;
	height: auto;
}

.entry-content iframe,
.entry-content embed,
.entry-content object,
.entry-content video {
	max-width: 100%;
}

/* Repris du CSS inline de WordPress (retiré dans inc/core/wp-reset.php). */
img:is([sizes="auto" i], [sizes^="auto," i]) {
	contain-intrinsic-size: 3000px 1500px;
}

.wp-smiley,
.emoji {
	display: inline !important;
	width: 1em !important;
	height: 1em !important;
	margin: 0 .07em !important;
	vertical-align: -.1em !important;
	border: none !important;
	box-shadow: none !important;
}

/* ==========================================================================
   4. Galeries ([gallery]) — grille CSS basée sur la gouttière Bootstrap
   ========================================================================== */

.gallery {
	display: grid;
	grid-template-columns: repeat(var(--bootheme-gallery-columns, 3), minmax(0, 1fr));
	gap: var(--bs-gutter-x, 1.5rem);
	margin-bottom: 1.5rem;
}

.gallery-columns-1 { --bootheme-gallery-columns: 1; }
.gallery-columns-2 { --bootheme-gallery-columns: 2; }
.gallery-columns-3 { --bootheme-gallery-columns: 3; }
.gallery-columns-4 { --bootheme-gallery-columns: 4; }
.gallery-columns-5 { --bootheme-gallery-columns: 5; }
.gallery-columns-6 { --bootheme-gallery-columns: 6; }
.gallery-columns-7 { --bootheme-gallery-columns: 7; }
.gallery-columns-8 { --bootheme-gallery-columns: 8; }
.gallery-columns-9 { --bootheme-gallery-columns: 9; }

@media (max-width: 767.98px) {
	.gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.gallery-columns-1 {
		grid-template-columns: minmax(0, 1fr);
	}
}

.gallery-item {
	margin: 0;
}

.gallery-item img {
	width: 100%;
	height: auto;
	border-radius: var(--bs-border-radius);
}

.gallery br {
	display: none;
}

/* ==========================================================================
   5. Contenu éditorial — tables, citations, code
   ========================================================================== */

.entry-content table:not(.table) {
	width: 100%;
	margin-bottom: 1rem;
	vertical-align: top;
	border-color: var(--bs-border-color);
	caption-side: bottom;
}

.entry-content table:not(.table) th,
.entry-content table:not(.table) td {
	padding: .5rem;
	border-bottom: var(--bs-border-width) solid var(--bs-border-color);
}

.entry-content table:not(.table) thead th {
	border-bottom-width: calc(var(--bs-border-width) * 2);
}

.entry-content blockquote {
	padding: .5rem 0 .5rem 1rem;
	margin: 0 0 1rem;
	font-size: 1.125rem;
	border-left: .25rem solid var(--bs-primary);
}

.entry-content blockquote p:last-child,
.entry-content blockquote cite {
	margin-bottom: 0;
}

.entry-content blockquote cite {
	display: block;
	font-size: .875em;
	font-style: normal;
	color: var(--bs-secondary-color);
}

.entry-content pre {
	padding: 1rem;
	background-color: var(--bs-tertiary-bg);
	border-radius: var(--bs-border-radius);
}

/* ==========================================================================
   6. Widgets classiques
   ========================================================================== */

.widget ul,
.widget ol {
	padding-left: 0;
	margin-bottom: 0;
	list-style: none;
}

.widget li {
	padding: .375rem 0;
	border-bottom: var(--bs-border-width) solid var(--bs-border-color-translucent);
}

.widget li:last-child {
	border-bottom: 0;
}

.widget .children,
.widget .sub-menu {
	padding-left: 1rem;
	margin-top: .375rem;
}

.widget .children li:last-child,
.widget .sub-menu li:last-child {
	padding-bottom: 0;
}

.widget a {
	text-decoration: none;
}

.widget a:hover,
.widget a:focus {
	text-decoration: underline;
}

/* Listes déroulantes (archives, catégories) : rendu équivalent à .form-select. */
.widget select {
	display: block;
	width: 100%;
	padding: .375rem 2.25rem .375rem .75rem;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--bs-body-color);
	appearance: none;
	background-color: var(--bs-body-bg);
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right .75rem center;
	background-size: 16px 12px;
	border: var(--bs-border-width) solid var(--bs-border-color);
	border-radius: var(--bs-border-radius);
}

.widget select:focus {
	border-color: rgba(var(--bs-primary-rgb), .5);
	outline: 0;
	box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

.widget_calendar table {
	width: 100%;
	text-align: center;
}

.widget_calendar caption {
	caption-side: top;
	font-weight: 600;
	color: var(--bs-body-color);
}

.widget_calendar .wp-calendar-nav {
	display: flex;
	justify-content: space-between;
	margin-top: .5rem;
}

.tagcloud {
	display: flex;
	flex-wrap: wrap;
	gap: .375rem;
}

.tagcloud a {
	display: inline-block;
	padding: .25rem .5rem;
	font-size: .875rem !important;
	color: var(--bs-secondary-color);
	background-color: var(--bs-tertiary-bg);
	border-radius: var(--bs-border-radius-pill);
}

/* ==========================================================================
   7. Commentaires
   ========================================================================== */

.comment-list,
.comment-list .children {
	padding-left: 0;
	list-style: none;
}

.comment-list .children {
	padding-left: 1.5rem;
	margin-top: 1rem;
	border-left: var(--bs-border-width) solid var(--bs-border-color);
}

.bypostauthor > .comment-body .comment-author .fn::after {
	margin-left: .375rem;
	font-size: .75em;
	font-weight: 400;
	color: var(--bs-primary);
	content: "\2605";
}

p.comment-form-cookies-consent {
	display: flex;
	gap: .5rem;
	align-items: flex-start;
}

.comment-awaiting-moderation {
	font-style: italic;
	color: var(--bs-secondary-color);
}

.logged-in-as,
.comment-notes {
	font-size: .875em;
	color: var(--bs-secondary-color);
}

/* ==========================================================================
   8. Divers
   ========================================================================== */

.sticky {
	position: relative;
}

.post-password-form input[type="password"] {
	display: inline-block;
	width: auto;
	padding: .375rem .75rem;
	border: var(--bs-border-width) solid var(--bs-border-color);
	border-radius: var(--bs-border-radius);
}

.post-password-form input[type="submit"] {
	padding: .375rem .75rem;
	color: var(--bootheme-primary-contrast, #fff);
	background-color: var(--bs-primary);
	border: 0;
	border-radius: var(--bs-border-radius);
}

.page-links {
	display: flex;
	flex-wrap: wrap;
	gap: .375rem;
	align-items: center;
	margin: 1.5rem 0;
}

/* ==========================================================================
   9. Balisage de blocs résiduel (contenus créés avant la désactivation de Gutenberg)
   ========================================================================== */

.wp-block-image,
.wp-block-embed,
.wp-block-gallery {
	margin: 0 0 1rem;
}

.wp-block-image img {
	max-width: 100%;
	height: auto;
}

.wp-block-image figcaption,
.wp-block-embed figcaption {
	font-size: .875em;
	color: var(--bs-secondary-color);
}

.wp-block-button__link {
	display: inline-block;
	padding: .375rem .75rem;
	color: var(--bootheme-primary-contrast, #fff);
	text-decoration: none;
	background-color: var(--bs-primary);
	border-radius: var(--bs-border-radius);
}

.wp-block-separator {
	opacity: .25;
}

/* ==========================================================================
   10. Équivalents des styles inline retirés du HTML (inc/core/inline-styles.php)
   ========================================================================== */

/* Barre d'administration : décalage du document. */
@media screen {
	html:has(> body.admin-bar) {
		margin-top: 32px !important;
	}
}

@media screen and (max-width: 782px) {
	html:has(> body.admin-bar) {
		margin-top: 46px !important;
	}
}

@media print {
	#wpadminbar {
		display: none;
	}
}

/* Shortcodes [video] et [audio] : pleine largeur du conteneur. */
.wp-video,
.wp-video-shortcode,
.wp-audio-shortcode {
	width: 100%;
	max-width: 100%;
}

/* Widget « Commentaires récents ». */
.recentcomments a {
	display: inline !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* Lien « Annuler la réponse » : visible uniquement quand le formulaire est déplacé sous un commentaire. */
#cancel-comment-reply-link {
	display: none;
}

.comment-list #cancel-comment-reply-link {
	display: inline;
}
