/*
Theme Name: Laetitia Libert — thème enfant
Template: twentytwentyfour
Version: 0.3.3
Text Domain: libert-child
*/

/*
 * La couche visuelle propre au site reste versionnée avec le thème enfant.
 * La structure et les classes portici-* viennent des compositions Gutenberg ;
 * le thème porte la grille, le rythme, les cartes, les images et le responsive.
 * Le thème parent Twenty Twenty-Four n'est jamais modifié.
 */

/* -------------------------------------------------------------------------- */
/* Accueil : titres, citation et transitions                                 */
/* -------------------------------------------------------------------------- */

main h2.wp-block-heading.is-style-asterisk::before {
	margin-inline: auto;
}

main > .wp-block-group.alignfull.has-accent-2-background-color h1.wp-block-heading {
	text-align: center;
}

body .wp-site-blocks > .portici-latest-articles + footer.wp-block-template-part,
body .wp-site-blocks > .portici-faq + footer.wp-block-template-part {
	margin-block-start: 0 !important;
}

body .portici-latest-articles > h2.wp-block-heading,
body .portici-faq h2.wp-block-heading {
	width: 100%;
	text-align: center !important;
}

body .portici-latest-articles > h2.wp-block-heading::before,
body .portici-faq h2.wp-block-heading::before {
	margin-inline: auto !important;
}

/* -------------------------------------------------------------------------- */
/* Accueil : encart des derniers articles                                    */
/* -------------------------------------------------------------------------- */

body .portici-latest-articles-query {
	width: 100%;
	max-width: none;
	margin-inline: 0;
}

body .portici-latest-articles-query .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2rem;
	width: 100%;
	max-width: none;
	padding: 0;
	list-style: none;
}

body .portici-latest-articles-query .wp-block-post {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-self: stretch;
	height: 100%;
	min-width: 0;
	width: auto;
	max-width: none;
	margin-block-start: 0 !important;
	padding: clamp(1.25rem, 2.2vw, 2rem);
	border-radius: 1.5rem;
	background: #f7f1eb;
}

body .portici-latest-articles-query .wp-block-post-featured-image {
	aspect-ratio: 1 / 1 !important;
	overflow: hidden;
	margin-block-start: 0 !important;
	height: auto !important;
}

body .portici-latest-articles-query .wp-block-post-featured-image a {
	height: auto !important;
}

body .portici-latest-articles-query .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto !important;
	aspect-ratio: 1 / 1 !important;
	object-fit: cover !important;
	object-position: center;
	border-radius: 1rem;
}

body .portici-latest-articles-query .wp-block-post-title {
	margin: 0 0 0.75rem !important;
	font-size: clamp(1.1rem, 2vw, 1.45rem);
}

body .portici-latest-articles-query .portici-latest-articles__excerpt {
	margin: 0 !important;
}

/* -------------------------------------------------------------------------- */
/* FAQ : accordéons en cartes                                                 */
/* -------------------------------------------------------------------------- */

body .portici-faq > .wp-block-group {
	width: min(950px, 100%);
	max-width: 950px !important;
}

body .portici-faq > .wp-block-group > h2.wp-block-heading {
	margin-block-end: 2rem !important;
}

body .portici-faq .wp-block-details {
	box-sizing: border-box;
	width: 100%;
	max-width: 950px !important;
	margin-block: 0 2rem !important;
	padding: var(--wp--preset--spacing--30);
	border: 0;
	border-radius: 1.5rem !important;
	background: var(--wp--preset--color--base-2, #fff);
}

body .portici-faq > .wp-block-group > .wp-block-details:last-child {
	margin-block-end: 0 !important;
}

body .portici-faq .wp-block-details > summary {
	position: relative;
	display: flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 2.5rem;
	padding: 0 3.5rem 0 0;
	cursor: pointer;
	list-style: none;
	font-size: clamp(1.2rem, 1.8vw, 1.65rem);
	font-weight: 600;
	line-height: 1.25;
}

body .portici-faq .wp-block-details > summary::-webkit-details-marker {
	display: none;
}

body .portici-faq .wp-block-details > summary::marker {
	content: "";
}

body .portici-faq .wp-block-details > summary::before {
	content: "";
	position: absolute;
	top: 50%;
	right: 0;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: var(--wp--preset--color--base, #f9f9f9);
	transform: translateY(-50%);
}

body .portici-faq .wp-block-details > summary::after {
	content: "";
	position: absolute;
	top: calc(50% - 0.35rem);
	right: 0.92rem;
	width: 0.55rem;
	height: 0.55rem;
	border: solid var(--wp--preset--color--contrast, #333);
	border-width: 0 1px 1px 0;
	transform: rotate(45deg);
	transition: transform 0.2s ease, top 0.2s ease;
}

body .portici-faq .wp-block-details[open] > summary::after {
	top: calc(50% - 0.05rem);
	transform: rotate(-135deg);
}

body .portici-faq .wp-block-details > p {
	max-width: 65ch;
	margin-block: var(--wp--preset--spacing--20) 0;
	font-size: clamp(1.05rem, 1.4vw, 1.35rem);
	line-height: 1.55;
}

/* -------------------------------------------------------------------------- */
/* Archive blog : même grille et mêmes cards que l'accueil                   */
/* -------------------------------------------------------------------------- */

body .portici-blog-archive-query .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2rem;
	width: 100%;
	max-width: none;
}

body .portici-blog-archive-query .wp-block-post {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-self: stretch;
	height: 100%;
	gap: 0 !important;
	min-width: 0;
	margin-block-start: 0 !important;
	padding: clamp(1.25rem, 2.2vw, 2rem);
	border-radius: 1.5rem;
	background: #f7f1eb;
}

body .portici-blog-archive-query .wp-block-post-featured-image {
	width: 100%;
	aspect-ratio: 1 / 1 !important;
	overflow: hidden;
	margin: 0 0 1.5rem !important;
}

body .portici-blog-archive-query .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto !important;
	aspect-ratio: 1 / 1 !important;
	object-fit: cover !important;
	object-position: center;
	border-radius: 1rem;
}

body .portici-blog-archive-query .wp-block-post-title {
	margin: 0 0 0.75rem !important;
}

body .portici-blog-archive-query .portici-blog-archive__excerpt {
	margin: 0 !important;
}

/* Le spacer d'ouverture du template Blog séparait inutilement l'identité,
 * le titre et son introduction. L'écart utile reste porté par la section. */
body.page:has(.portici-blog-archive) main > .wp-block-group:first-child > .wp-block-spacer:first-child {
	display: none;
}

/* -------------------------------------------------------------------------- */
/* Article : rythme vertical et hiérarchie des titres                       */
/* -------------------------------------------------------------------------- */

body.single-post main > .wp-block-group:first-child {
	padding-top: var(--wp--preset--spacing--20) !important;
	margin-bottom: var(--wp--preset--spacing--20) !important;
}

body.single-post main .wp-block-post-featured-image {
	margin-bottom: var(--wp--preset--spacing--20) !important;
}

body.single-post main .wp-block-post-content {
	margin-top: 0 !important;
}

body.single-post main > .wp-block-group:last-child {
	margin-top: var(--wp--preset--spacing--20) !important;
	padding-bottom: var(--wp--preset--spacing--20) !important;
}

body.single-post main > .wp-block-group:last-child > .wp-block-group > .wp-block-spacer {
	height: var(--wp--preset--spacing--20) !important;
}

body.single-post main > .wp-block-group:last-child .wp-block-separator {
	margin-top: 0 !important;
	margin-bottom: var(--wp--preset--spacing--20) !important;
}

body.single-post main > .wp-block-group:last-child nav {
	margin-top: 0 !important;
	padding-top: var(--wp--preset--spacing--20) !important;
	padding-bottom: var(--wp--preset--spacing--20) !important;
}

body.single-post main .wp-block-post-title {
	font-size: clamp(2.5rem, 3.5vw, 3.5rem) !important;
	line-height: 1.1;
}

body.single-post main .wp-block-post-content h2 {
	font-size: clamp(1.75rem, 2.25vw, 2.5rem) !important;
	line-height: 1.15;
}

/* -------------------------------------------------------------------------- */
/* Images éditoriales et header mobile                                       */
/* -------------------------------------------------------------------------- */

body.blog main .wp-block-image img {
	border-radius: 1rem;
}

@media (max-width: 781px) {
	body .portici-latest-articles-query .wp-block-post-template,
	body .portici-blog-archive-query .wp-block-post-template {
		grid-template-columns: 1fr;
		gap: 2rem;
	}

	body .portici-faq .wp-block-details {
		padding: 1.25rem;
	}

	body .portici-faq .wp-block-details > summary {
		font-size: 1.15rem;
	}

	body header > .wp-block-group > .wp-block-group.is-content-justification-center,
	body header > .wp-block-group > .wp-block-group.is-content-justification-center > .wp-block-group,
	body header .wp-block-site-title {
		width: 100%;
		text-align: center;
	}

	body header .wp-block-site-title {
		margin-block-start: 0;
		margin-block-end: 0;
	}

	body header .wp-block-site-title a {
		text-align: center;
	}
}
