/*
Theme Name: Bidouilleur du dimanche
Description: Zéro tact. Zéro bullshit. Thème du blog bidouilleur-du-dimanche.fr.
Version: 0.1.0
Requires at least: 6.6
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: bidouilleur
*/

a:where(:not(.wp-element-button)):hover {
	text-decoration: underline;
}

/* --- En-tête ------------------------------------------------------------ */

/* Logo : curseur « _ » en accent */
.bdd-logo a::after {
	content: "_";
	color: var(--wp--preset--color--accent);
}

.bdd-logo a:hover {
	text-decoration: none;
}

/* Loupe : icône seule, sans fond de bouton, centrée sur la ligne du menu */
.bdd-search.wp-block-search {
	display: flex;
	align-items: center;
}

.bdd-search.wp-block-search .wp-block-search__inside-wrapper {
	align-items: center;
}

.bdd-search.wp-block-search .wp-block-search__button {
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	color: var(--wp--preset--color--foreground);
	padding: 0;
	margin-left: 0;
	border: 0;
	line-height: 0;
}

.bdd-search.wp-block-search .wp-block-search__button svg {
	display: block;
	width: 24px;
	height: 24px;
	min-width: 24px;
	min-height: 24px;
}

.bdd-search .wp-block-search__input {
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	background: var(--wp--preset--color--white);
}

/* --- Hero (accueil) ----------------------------------------------------- */

.bdd-hero__text h1 {
	margin: 0;
}

.bdd-hero__tagline {
	margin-top: 0.225rem;
}

.bdd-hero__intro {
	margin-top: 0.85rem;
}

.bdd-chips {
	margin-top: 1.375rem;
}

/* Pastilles de catégories */
.bdd-chips .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 15px;
	border-radius: 6px;
	background: var(--wp--preset--color--chip);
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.83rem;
	font-weight: 400;
}

.bdd-chips .wp-block-button__link:hover {
	text-decoration: none;
	color: var(--wp--preset--color--accent);
}

/* Illustration : déborde un peu sous la fin du titre et à droite, comme sur la maquette.
   Le blanc du dessin se fond dans le fond de page. */
.bdd-hero__illustration {
	margin: 0 -7px 0 -40px;
	width: calc(100% + 47px);
}

.bdd-hero__illustration img {
	display: block;
	width: 100%;
	height: auto;
	mix-blend-mode: multiply;
}

/* --- Derniers articles ------------------------------------------------- */

.bdd-latest__head h2,
.bdd-latest__all {
	margin: 0;
}

.bdd-cards {
	margin-top: 0.9rem;
}

.bdd-cards .wp-block-post {
	display: flex;
	flex-direction: column;
}

.bdd-cards .wp-block-post > * {
	margin: 0;
}

.bdd-cards .wp-block-post-featured-image img {
	display: block;
}

/* Catégorie : mono, majuscules, accent */
.bdd-card__cat {
	margin-top: 0.7rem !important;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
}

.bdd-card__title {
	margin-top: 0.3rem !important;
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.1;
}

.bdd-card__title a {
	color: var(--wp--preset--color--foreground);
}

.bdd-card__excerpt {
	margin-top: 0.4rem !important;
	color: var(--wp--preset--color--muted);
	font-size: 0.96rem;
	line-height: 1.3;
}

.bdd-card__excerpt p {
	margin: 0;
}

.bdd-card__meta {
	margin-top: 0.85rem !important;
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.72rem;
	line-height: 1.3;
}

.bdd-card__meta > * {
	margin: 0;
}

.bdd-card__meta .wp-block-post-date {
	font-size: inherit;
}

.bdd-card__more {
	margin-top: 0.25rem !important;
	font-size: 1rem;
	font-weight: 400;
}

/* --- Newsletter -------------------------------------------------------- */

.bdd-newsletter {
	min-height: 91px;
	padding: 11px 31px 11px 37px;
	gap: 0;
}

.bdd-newsletter__icon {
	flex: none;
	display: block;
	color: var(--wp--preset--color--accent);
}

/* Filet vertical accent entre l'enveloppe et le texte
   (sélecteurs renforcés : WordPress remet à zéro les marges des enfants flex) */
.bdd-newsletter .bdd-newsletter__text {
	position: relative;
	margin-left: 32px;
	padding-left: 31px;
}

.bdd-newsletter__text::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: 1px;
	height: 44px;
	transform: translateY(-50%);
	background: var(--wp--preset--color--accent);
}

.bdd-newsletter__text > * {
	margin: 0;
}

.bdd-newsletter__title {
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.1;
}

.bdd-newsletter__desc {
	margin-top: 0 !important;
	color: var(--wp--preset--color--muted);
	font-size: 0.86rem;
	line-height: 1.43;
}

.bdd-newsletter .bdd-newsletter__form {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

.bdd-newsletter__form input {
	box-sizing: border-box;
	width: 306px;
	height: 39px;
	padding: 0 14px;
	border: 1px solid #E2E2E2;
	border-radius: 4px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--foreground);
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.8125rem;
}

.bdd-newsletter__form input::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 0.85;
}

.bdd-newsletter__form input:focus {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: -1px;
	border-color: transparent;
}

.bdd-newsletter__form button {
	box-sizing: border-box;
	width: 130px;
	height: 40px;
	padding: 0;
	border: 0;
	cursor: pointer;
	font-size: 0.875rem;
	font-weight: 700;
}

/* Champ piège pour les robots : hors écran, invisible pour les humains */
.bdd-newsletter__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Largeur fixe (champ + bouton) : le message passe à la ligne au lieu d'élargir le formulaire */
.bdd-newsletter .bdd-newsletter__form {
	position: relative;
	flex: none;
	flex-wrap: wrap;
	justify-content: flex-end;
	width: 448px;
}

/* Message sous le champ (erreur) ou à la place du formulaire (succès) */
.bdd-newsletter__msg {
	flex: 1 1 100%;
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.3;
	text-align: left;
}

.bdd-newsletter__msg:empty {
	display: none;
}

.bdd-newsletter__msg.is-error {
	color: var(--wp--preset--color--accent);
}

/* Mention RGPD : dans l'espace sous les champs, sans décaler le formulaire.
   Masquée quand un message (succès ou erreur) prend sa place. */
.bdd-newsletter__legal {
	position: absolute;
	top: calc(100% + 5px);
	left: 0;
	margin: 0;
	color: var(--wp--preset--color--subtle);
	font-size: 12px;
	line-height: 1.3;
}

.bdd-newsletter__legal a {
	color: inherit;
	text-decoration: underline;
}

.bdd-newsletter__msg:not(:empty) ~ .bdd-newsletter__legal {
	display: none;
}

.bdd-newsletter__form.is-done input,
.bdd-newsletter__form.is-done button {
	display: none;
}

.bdd-newsletter__form.is-done .bdd-newsletter__msg {
	max-width: 448px;
	color: var(--wp--preset--color--foreground);
	font-size: 0.9375rem;
	font-weight: 600;
}

/* --- Pied de page ------------------------------------------------------ */

footer.wp-block-template-part {
	margin-top: 20px;
}

.bdd-footer {
	gap: 2rem;
}

.bdd-footer__copy {
	margin: 0;
	color: var(--wp--preset--color--subtle);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.71rem;
}

.bdd-footer__nav {
	color: var(--wp--preset--color--subtle);
	font-size: 0.83rem;
}

.bdd-footer__social .wp-social-link {
	color: var(--wp--preset--color--foreground);
}

.bdd-footer__social .wp-social-link a {
	padding: 0;
}

.bdd-footer__social .wp-social-link svg {
	width: 18px;
	height: 18px;
}

.bdd-footer__social .wp-social-link-github svg {
	width: 21px;
	height: 21px;
}

/* --- Pages, archives, article ------------------------------------------ */

.bdd-page-head {
	padding-top: 2.5rem;
	padding-bottom: 1.5rem;
}

.bdd-page-head h1 {
	margin: 0;
	font-size: clamp(2rem, 4vw, 3rem);
}

.bdd-page-head > * + * {
	margin-top: 0.75rem;
}

.bdd-page-head + .wp-block-group {
	padding-bottom: 1.5rem;
}

.bdd-single-head {
	padding-top: 2.5rem;
}

.bdd-single-head > * {
	margin: 0;
}

.bdd-single__title {
	margin-top: 0.6rem !important;
	font-size: clamp(2rem, 4vw, 2.75rem);
}

.bdd-single-head .bdd-card__meta {
	margin-top: 1rem !important;
}

.bdd-single__image {
	margin-top: 2rem;
}

.bdd-single__content {
	padding-bottom: 1.5rem;
}

/* Liste des catégories : pastilles */
.bdd-cat-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.0625rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bdd-cat-list li {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	height: 36px;
	padding: 0 15px;
	border-radius: 6px;
	background: var(--wp--preset--color--chip);
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.83rem;
}

.bdd-cat-list a {
	color: var(--wp--preset--color--foreground);
}

/* Pagination */
.bdd-pagination {
	margin-top: 2.5rem;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
}

.bdd-pagination .page-numbers.current {
	color: var(--wp--preset--color--accent);
	font-weight: 700;
}

/* --- Responsive --------------------------------------------------------- */

/* Sous la largeur de la maquette : on laisse l'intro couler naturellement */
@media (max-width: 1439px) {
	.bdd-hero__intro br {
		display: none;
	}
}

/* Tablette et mobile : menu burger (WordPress ne le fait que sous 600 px)
   et pas d'illustration, le texte prend toute la largeur */
@media (min-width: 600px) and (max-width: 1023px) {
	.bdd-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.bdd-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

@media (max-width: 1023px) {
	.bdd-header > .wp-block-group {
		gap: 1.25rem;
	}

	.bdd-header .wp-block-navigation__responsive-container-open svg,
	.bdd-header .wp-block-navigation__responsive-container-close svg {
		width: 28px;
		height: 28px;
	}

	.bdd-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		padding-top: 3.5rem;
	}

	.bdd-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		font-size: var(--wp--preset--font-size--x-large);
		font-weight: 600;
	}

	.bdd-hero .bdd-hero__visual {
		display: none;
	}

	.bdd-footer {
		flex-direction: column;
		align-items: flex-start !important;
		gap: 1rem;
	}

	.bdd-footer__right {
		flex-wrap: wrap !important;
		row-gap: 1rem;
	}

	.bdd-newsletter {
		flex-wrap: wrap !important;
		row-gap: 1.25rem;
		padding: 1.5rem;
	}

	.bdd-newsletter .bdd-newsletter__text {
		flex: 1 1 0;
		min-width: 0;
	}

	.bdd-newsletter .bdd-newsletter__form {
		flex: 1 1 100%;
		width: auto;
		margin-left: 0;
	}

	.bdd-newsletter__legal {
		position: static;
		flex: 1 1 100%;
	}

	.bdd-newsletter__form input {
		flex: 1 1 auto;
		width: auto;
		min-width: 0;
	}

	.bdd-hero .bdd-hero__text {
		flex-basis: 100% !important;
	}

	.bdd-cards .wp-block-post-template {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.bdd-hero {
		padding-top: 2rem !important;
		padding-bottom: 2rem !important;
	}
}

@media (max-width: 781px) {
	.bdd-cards .wp-block-post-template {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.bdd-cards .wp-block-post-template {
		grid-template-columns: minmax(0, 1fr);
	}

	.bdd-newsletter__icon {
		display: none;
	}

	.bdd-newsletter .bdd-newsletter__text {
		flex-basis: 100%;
		margin-left: 0;
		padding-left: 0;
	}

	.bdd-newsletter__text::before {
		display: none;
	}

	.bdd-newsletter__form {
		flex-wrap: wrap;
	}

	.bdd-newsletter__form input,
	.bdd-newsletter__form button {
		width: 100%;
	}

	.bdd-logo {
		font-size: 1.0625rem !important;
	}
}

/* Menu burger ouvert : liens alignés à gauche */
.bdd-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.bdd-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: flex-start;
}
