/*
Theme Name: Parti du bon sens
Theme URI: https://partidubonsens.fr
Author: Heptadeca
Author URI: https://heptadeca.com
Description: Thème WordPress sur-mesure du Parti du bon sens — actualités, programme, sondages interactifs et adhésion, construit à partir de la base officielle Twenty Twenty-Five.
Requires at least: 6.7
Tested up to: 6.7
Requires PHP: 7.4
Version: 1.8.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: partidubonsens
Tags: full-site-editing, custom-colors, custom-logo, block-patterns, translation-ready
*/

/*
 * Link styles
 * https://github.com/WordPress/gutenberg/issues/42319
 */
a {
	text-decoration-thickness: 1px !important;
	text-underline-offset: .1em;
}

/* Focus styles */
:where(.wp-site-blocks *:focus) {
	outline-width: 2px;
	outline-style: solid;
}

/* Increase the bottom margin on submenus, so that the outline is visible. */
.wp-block-navigation .wp-block-navigation-submenu .wp-block-navigation-item:not(:last-child) {
	margin-bottom: 3px;
}

/* Increase the outline offset on the parent menu items, so that the outline does not touch the text. */
.wp-block-navigation .wp-block-navigation-item .wp-block-navigation-item__content {
	outline-offset: 4px;
}

/* Remove outline offset from the submenus, otherwise the outline is visible outside the submenu container. */
.wp-block-navigation .wp-block-navigation-item ul.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	outline-offset: 0;
}

/*
 * Progressive enhancement to reduce widows and orphans
 * https://github.com/WordPress/gutenberg/issues/55190
 */
h1, h2, h3, h4, h5, h6, blockquote, caption, figcaption, p {
	text-wrap: pretty;
}

/*
 * Change the position of the more block on the front, by making it a block level element.
 * https://github.com/WordPress/gutenberg/issues/65934
*/
.more-link {
	display: block;
}

/* Cartes pastel (couleur injectée en inline par inc/card-color.php) */
.pdbs-card {
	position: relative;
	overflow: hidden;
}

/* Zone image des vignettes de listing : ancre le badge de votes à la photo (le titre passe au-dessus) */
.pdbs-media {
	position: relative;
	overflow: hidden;
}

/* Badge de votes fictif en haut à droite des vignettes (inc/vote-badge.php) */
.pdbs-vote-badge-overlay {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 1;
	margin: 0 !important;
	background-color: #1a1a1a;
	color: #fff;
	padding: 4px 10px;
	border-radius: 999px;
}

/* Badge de votes des vignettes Propositions (pas de visuel à ancrer, donc pas
   d'overlay : badge affiché normalement dans le flux, sous le titre). */
.pdbs-vote-badge-inline {
	display: inline-block;
	background-color: #1a1a1a;
	color: #fff;
	padding: 4px 10px;
	border-radius: 999px;
}

/* Image à la une des articles/pages : pleine largeur sur mobile, bornée à 900px sur desktop */
.pdbs-article-featured-image {
	margin-left: auto;
	margin-right: auto;
}

@media (min-width: 782px) {
	.pdbs-article-featured-image {
		max-width: 900px;
	}
}

/* Vote réel sur les articles (inc/article-vote.php, assets/js/article-vote.js) */
.pdbs-article-vote {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.pdbs-article-vote__button {
	padding: 6px 16px;
	font-size: var(--wp--preset--font-size--small);
	border-radius: 8px;
}

.pdbs-article-vote__button:disabled {
	opacity: .6;
	cursor: default;
}

/* Bouton "Je ne soutiens plus cette proposition" (après un vote) : rose pastel */
.pdbs-article-vote[data-pdbs-voted="1"] .pdbs-article-vote__button {
	background-color: #fbe4ec;
	color: #1a1a1a;
}

.pdbs-article-vote[data-pdbs-voted="1"] .pdbs-article-vote__button:hover {
	background-color: color-mix(in srgb, #fbe4ec 85%, black);
	color: #1a1a1a;
}

/* Bascule visiteur clair/sombre (inc/theme-toggle.php, assets/js/theme-toggle.js) */
:root[data-theme="dark"] {
	--wp--preset--color--base: #1a1a1a;
	--wp--preset--color--contrast: #f5f5f5;
	--wp--preset--color--accent: #7fa3e0;
}

:root[data-theme="dark"] .wp-block-site-logo img {
	filter: invert(1);
}

.pdbs-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1.5px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: currentColor;
	cursor: pointer;
}

.pdbs-theme-toggle:hover {
	background-color: color-mix(in srgb, currentColor 10%, transparent);
}

.pdbs-theme-toggle svg {
	width: 22px;
	height: 22px;
}

.pdbs-theme-toggle .pdbs-icon-sun {
	display: none;
}

:root[data-theme="dark"] .pdbs-theme-toggle .pdbs-icon-moon {
	display: none;
}

:root[data-theme="dark"] .pdbs-theme-toggle .pdbs-icon-sun {
	display: block;
}

/* Marges latérales réduites en mobile (gouttière globale du thème) */
@media (max-width: 599px) {
	html body {
		--wp--style--root--padding-left: 5px;
		--wp--style--root--padding-right: 5px;
	}
}

/* Quelle que soit la largeur d'écran, le bandeau pastel plein écran (article/page)
   reste en plein bord mais son contenu (titre, visuel) garde 10px d'air ; les
   vignettes de listing (pas plein écran) sont elles-mêmes décollées de 10px des
   bords de l'écran. */
.pdbs-card.alignfull {
	padding-left: 10px;
	padding-right: 10px;
}

.pdbs-card:not(.alignfull) {
	margin-left: 10px;
	margin-right: 10px;
	height: 100%;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

/* Neutralise la marge auto que la mise en page "constrained" du bloc
   appliquerait sinon au titre dans ce contexte flex (visible surtout quand
   la vignette n'a pas d'image, le titre étant alors l'élément le plus
   étroit de la carte). */
.pdbs-card:not(.alignfull) > .wp-block-post-title {
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* Toute la surface d'une vignette de listing est cliquable (lien étiré sur le
   titre, qui pointe déjà vers l'article). */
.pdbs-card:not(.alignfull) .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}
