/*
Theme Name: RHM Atelier Latitude
Theme URI: https://rh-medias.com
Author: Romain Lafontaine - RH Medias
Author URI: https://rh-medias.com
Description: Thème block custom pour le site vitrine Atelier Latitude — architecte. Design minimaliste, zéro dépendance, animations GSAP.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 8.0
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: rhm-atelier-latitude
Tags: one-column, custom-colors, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, portfolio, wide-blocks, block-styles
*/

/* ==========================================================================
   Site Logo — SVG support
   ========================================================================== */

.wp-block-site-logo {
	min-width: 0;
}

/* Responsive logo size — cap at 180px on mobile (block outputs inline width). */
@media (max-width: 600px) {
	.wp-block-site-logo {
		width: 180px !important;
	}
}

.wp-block-site-logo a {
	display: block;
}

.wp-block-site-logo img[src$=".svg"] {
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Sticky Header
   ========================================================================== */

header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
	background-color: var(--wp--preset--color--base);
	transition: box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

header.wp-block-template-part.is-scrolled {
	background-color: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	box-shadow: 0 1px 0 #eeeeee;
}

/* Header entrance animation — first visit only (class added by inline JS) */
@keyframes al-header-reveal {
	from {
		opacity: 0;
		transform: translateY(-100%);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

header.wp-block-template-part.al-header-animate {
	animation: al-header-reveal 0.8s cubic-bezier(0.33, 1, 0.68, 1) both;
}

/* ---------- View Transitions API ---------- */
@view-transition {
	navigation: auto;
}

/* Keep the page background visible during the transition (prevents white flash) */
::view-transition-group(root) {
	animation-duration: 0s;
}

html::view-transition-old(root) {
	display: none;
}

html::view-transition-new(root) {
	animation: none;
}

/* Header stays in place across navigations */
header.wp-block-template-part {
	view-transition-name: site-header;
}

/* Footer stays in place across navigations */
footer.wp-block-template-part {
	view-transition-name: site-footer;
}

/* Animate main content with a subtle crossfade + slide */
main {
	view-transition-name: main-content;
}

::view-transition-old(main-content) {
	animation: 200ms ease-out both al-vt-fade-out;
}

::view-transition-new(main-content) {
	animation: 300ms ease-out 50ms both al-vt-fade-in;
}

@keyframes al-vt-fade-out {
	to {
		opacity: 0;
	}
}

@keyframes al-vt-fade-in {
	from {
		opacity: 0;
	}
}

/* Header/footer: no transition (stay in place) */
::view-transition-old(site-header),
::view-transition-new(site-header),
::view-transition-old(site-footer),
::view-transition-new(site-footer) {
	animation: none;
}

/* Navigation hover accent + underline */
.wp-block-navigation .wp-block-navigation-item__content {
	position: relative;
}

.wp-block-navigation .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	bottom: -0.15em;
	left: 0;
	width: 0;
	height: 2px;
	background-color: var(--wp--preset--color--accent);
	transition: width 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

.wp-block-navigation .wp-block-navigation-item__content:hover::after,
.wp-block-navigation .wp-block-navigation-item__content[aria-current="page"]::after {
	width: 100%;
}

/* Remove gap between header, main, and footer */
.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block-start: 0;
}

/* ==========================================================================
   Masonry Grid (CSS column-count) — archive pages
   ========================================================================== */

.al-masonry {
	column-count: 3;
	column-gap: var(--wp--preset--spacing--40);
}

.al-masonry > * {
	break-inside: avoid;
	margin-bottom: var(--wp--preset--spacing--40);
}

@media (max-width: 1024px) {
	.al-masonry {
		column-count: 2;
	}
}

@media (max-width: 768px) {
	.al-masonry {
		column-count: 1;
	}
}

/* ==========================================================================
   Bento Grid — homepage featured projects
   ========================================================================== */

.al-bento {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 320px;
	grid-auto-flow: dense;
	gap: var(--wp--preset--spacing--30);
}

.al-bento > * {
	min-width: 0;
	min-height: 0;
}

/* Large cards: 1st and 5th of every 6 */
.al-bento > *:nth-child(6n+1),
.al-bento > *:nth-child(6n+5) {
	grid-column: span 2;
	grid-row: span 2;
}

/* Card fills its grid cell */
.al-bento .al-card {
	height: 100%;
	border-radius: 4px;
}

/* Featured image fills the card */
.al-bento .al-card > a {
	display: block;
	height: 100%;
}

.al-bento .al-card > a > img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Overlay border-radius in bento */
.al-bento .al-card-overlay {
	border-radius: 4px;
}

/* Bigger title on large cards */
.al-bento > *:nth-child(6n+1) .al-card-overlay .wp-block-post-title,
.al-bento > *:nth-child(6n+5) .al-card-overlay .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
	.al-bento {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 280px;
	}

	.al-bento > *:nth-child(6n+1) {
		grid-column: span 2;
		grid-row: span 1;
	}

	.al-bento > *:nth-child(6n+5) {
		grid-column: span 1;
		grid-row: span 1;
	}
}

/* Mobile: single column */
@media (max-width: 768px) {
	.al-bento {
		grid-template-columns: 1fr;
		grid-auto-rows: 300px;
	}

	.al-bento > *:nth-child(6n+1),
	.al-bento > *:nth-child(6n+5) {
		grid-column: span 1;
		grid-row: span 1;
	}
}

/* ==========================================================================
   Section Header (title + icon button)
   ========================================================================== */

.al-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--30);
}

.al-section-header h2 {
	margin: 0;
}

.al-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 50%;
	color: var(--wp--preset--color--contrast);
	transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.al-section-header .al-icon-button svg {
	transform: rotate(-135deg);
}

.al-icon-button:hover {
	background-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* ==========================================================================
   CTA Link (text + animated arrow)
   ========================================================================== */

.al-cta-link {
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast);
	padding: var(--wp--preset--spacing--20) 0;
	position: relative;
}

.al-cta-link::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 0;
	height: 2px;
	background-color: var(--wp--preset--color--accent);
	transition: width 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

.al-cta-link:hover::after {
	width: 100%;
}

.al-cta-link svg {
	transform: rotate(-135deg);
	transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.al-cta-link:hover svg {
	transform: rotate(-90deg);
}

.al-cta-link:hover {
	color: var(--wp--preset--color--contrast);
}

/* Reset WP button block styles when using al-cta-link */
.wp-block-button.al-cta-link .wp-block-button__link {
	background: none !important;
	border: none !important;
	border-radius: 0 !important;
	padding: var(--wp--preset--spacing--20) 0 !important;
	color: var(--wp--preset--color--contrast) !important;
	text-decoration: none !important;
}

.wp-block-button.al-cta-link .wp-block-button__link:hover {
	background: none !important;
	color: var(--wp--preset--color--contrast) !important;
}

/* Button — Chat bubble hover effect (.al-bubble) */
.wp-block-button.al-bubble .wp-block-button__link {
	position: relative;
	overflow: visible;
	transition: background-color 0.35s cubic-bezier(0.33, 1, 0.68, 1),
	            color 0.35s cubic-bezier(0.33, 1, 0.68, 1),
	            border-radius 0.35s cubic-bezier(0.33, 1, 0.68, 1);
}

.wp-block-button.al-bubble .wp-block-button__link:hover {
	border-radius: 8px;
}

.wp-block-button.al-bubble .wp-block-button__link::after {
	content: "";
	position: absolute;
	bottom: 1px;
	right: 1.5em;
	width: 24px;
	height: 16px;
	background: inherit;
	clip-path: polygon(0 0, 100% 0, 50% 100%);
	transform: translateY(100%) scaleY(0);
	transform-origin: top center;
	transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.wp-block-button.al-bubble .wp-block-button__link:hover::after {
	transform: translateY(100%) scaleY(1);
}

/* ==========================================================================
   Project Cards — Hover Effects
   ========================================================================== */

.al-card {
	position: relative;
	overflow: hidden;
	display: block;
}

.al-card img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.6s cubic-bezier(0.33, 1, 0.68, 1);
	backface-visibility: hidden;
}

.al-card:hover img {
	transform: scale(1.05);
}

.al-card-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: var(--wp--preset--spacing--50);
	background: linear-gradient(to top, rgba(26, 26, 26, 0.7) 0%, transparent 60%);
	color: var(--wp--preset--color--base);
	opacity: 0;
	transition: opacity 0.4s ease;
}

.al-card:hover .al-card-overlay {
	opacity: 1;
}

.al-card-overlay a {
	color: inherit;
}

.al-card-overlay h3,
.al-card-overlay p {
	margin: 0;
}

/* ==========================================================================
   Single Projet — Cover Image (fixed on scroll)
   ========================================================================== */

.al-projet-cover {
	height: 60vh;
	overflow: hidden;
}

.al-projet-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	position: fixed;
	top: 0;
	left: 0;
	z-index: -1;
}

@media (max-width: 768px) {
	/* aspect-ratio évite le zoom iOS causé par les variations de vh au scroll */
	.al-projet-cover {
		height: auto;
		aspect-ratio: 16 / 9;
	}

	.al-projet-cover img {
		position: relative;
	}
}

/* ==========================================================================
   Single projet — Project Meta block
   ========================================================================== */

.al-project-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--40);
}

.al-project-meta-item {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.3em;
}

.al-project-meta-item p {
	margin: 0;
}

.al-project-meta-label {
	font-weight: 600;
}

@media (max-width: 768px) {
	.al-project-meta {
		row-gap: var(--wp--preset--spacing--20);
		column-gap: var(--wp--preset--spacing--40);
	}
}

/* ==========================================================================
   Footer — Social icons brand color on hover
   ========================================================================== */

.wp-block-social-links.is-style-logos-only .wp-social-link {
	transition: transform 0.3s ease;
}

.wp-block-social-links.is-style-logos-only .wp-social-link:hover {
	transform: scale(1.15);
}

.wp-block-social-links.is-style-logos-only .wp-social-link-facebook:hover svg {
	color: #1877F2;
	fill: #1877F2;
}

.wp-block-social-links.is-style-logos-only .wp-social-link-instagram:hover svg {
	color: #E4405F;
	fill: #E4405F;
}

.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin:hover svg {
	color: #0A66C2;
	fill: #0A66C2;
}

/* Footer — Navigation links use body font + accent color + compact spacing */
footer .wp-block-navigation .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--body);
	text-transform: none;
	letter-spacing: normal;
	color: var(--wp--preset--color--accent);
}

footer .wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--contrast);
}

footer .wp-block-navigation.is-vertical .wp-block-navigation__container {
	gap: 0.5rem;
	justify-content: flex-start;
}

/* Footer — Contact icons alignment */
.al-footer-contact-item {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.al-footer-contact-item svg {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin-top: 0.15em;
	color: var(--wp--preset--color--accent);
}

/* Footer — Contact links: gray at rest, accent on hover */
.al-footer-link {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding-bottom: 1px;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.al-footer-link:hover {
	color: var(--wp--preset--color--accent);
	border-bottom-color: var(--wp--preset--color--accent);
}


/* ==========================================================================
   Animation Classes (initial state — GSAP animates from here)
   ========================================================================== */

.al-fade-up {
	opacity: 0;
	transform: translateY(30px);
}

.al-fade-in {
	opacity: 0;
}

.al-slide-left {
	opacity: 0;
	transform: translateX(-30px);
}

.al-accent-line {
	position: relative;
	display: inline-block;
}

.al-accent-line::after {
	content: "";
	position: absolute;
	bottom: -0.15em;
	left: 0;
	width: 0;
	height: 3px;
	background-color: var(--wp--preset--color--accent);
	transition: width 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

.al-accent-line:hover::after {
	width: 100%;
}

/* Grid children: hidden until GSAP reveals them */
.al-bento > *,
.al-masonry > * {
	opacity: 0;
	transform: translateY(60px) scale(0.95);
}

/* ==========================================================================
   No-JS Fallback
   ========================================================================== */

.no-js .al-fade-up,
.no-js .al-fade-in,
.no-js .al-slide-left {
	opacity: 1;
	transform: none;
}

/* ==========================================================================
   Coordonnées — grille style Horizon (page contact)
   ========================================================================== */

.al-contact-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--wp--preset--spacing--50);
}

.al-contact-grid-item {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.al-contact-label {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 300;
	color: var(--wp--preset--color--muted);
}

.al-contact-value {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	color: var(--wp--preset--color--contrast);
	line-height: 1.55;
}

.al-contact-value a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.al-contact-value a:hover {
	color: var(--wp--preset--color--accent);
}

@media (max-width: 768px) {
	.al-contact-grid {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   Contact Form 7 — Styles personnalisés
   ========================================================================== */

/* Mise en page grille : email et téléphone côte à côte */
.wpcf7-form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: .4rem 1.25rem;
}

.wpcf7-form > * {
	grid-column: 1 / -1;
}

.wpcf7-form > p:has(input[type="email"]),
.wpcf7-form > p:has(input[type="tel"]),
.wpcf7-form > label:has(input[type="email"]),
.wpcf7-form > label:has(input[type="tel"]) {
	grid-column: span 1;
}

.wpcf7-form .wpcf7-form-control-wrap {
	display: block;
}

/* Reset marges navigateur (margin-block-start: 1em par défaut) */
.wpcf7-form > p,
.wpcf7-form > label {
	margin: 0;
}

/* Labels */
.wpcf7-form label {
	display: block;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--wp--preset--color--muted);
	margin-bottom: 0.5rem;
}

/* Inputs, selects, textarea */
.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form select,
.wpcf7-form textarea {
	width: 100%;
	background: transparent;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0;
	padding: 0.75rem 1rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--contrast);
	transition: border-color 0.3s ease;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
}

.wpcf7-form input[type="text"]:focus,
.wpcf7-form input[type="email"]:focus,
.wpcf7-form input[type="tel"]:focus,
.wpcf7-form select:focus,
.wpcf7-form textarea:focus {
	border-color: var(--wp--preset--color--accent);
}

.wpcf7-form textarea {
	resize: vertical;
	height: 100px;
	min-height: 100px;
}

/* Select — flèche personnalisée */
.wpcf7-form select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	padding-right: 2.5rem;
	cursor: pointer;
}

/* Bouton submit */
.wpcf7-form input[type="submit"],
.wpcf7-submit {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	background-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	border: none;
	border-radius: 0;
	padding: 0.9rem 2rem;
	cursor: pointer;
	transition: background-color 0.3s ease;
}

.wpcf7-form input[type="submit"]:hover,
.wpcf7-submit:hover {
	background-color: var(--wp--preset--color--accent);
}

/* Messages de validation */
.wpcf7-not-valid-tip {
	display: block;
	font-size: 0.8rem;
	color: #c0392b;
	margin-top: 0.25rem;
}

/* Overlay de confirmation après envoi */
.wpcf7 {
	position: relative;
}

/* Caché par défaut */
.wpcf7-response-output {
	display: none !important;
	margin: 0;
	padding: 0;
	border: none;
}

/* Succès → overlay couvrant tout le formulaire */
/* .sent est sur <form class="wpcf7-form sent">, pas sur le div.wpcf7 */
.wpcf7 form.sent .wpcf7-response-output {
	display: flex !important;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: absolute;
	inset: 0;
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border) !important;
	z-index: 10;
	text-align: center;
	padding: var(--wp--preset--spacing--50);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.9rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--wp--preset--color--contrast);
	margin: 0;
}

.wpcf7 form.sent .wpcf7-response-output::before {
	content: "";
	display: block;
	width: 4rem;
	height: 4rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56' fill='none'%3E%3Ccircle cx='28' cy='28' r='27' stroke='%23349a45' stroke-width='1.5'/%3E%3Cpath d='M16 29l8 8 16-17' stroke='%23349a45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
	margin-bottom: var(--wp--preset--spacing--40);
	flex-shrink: 0;
}

/* Erreurs → bandeau inline discret */
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output,
.wpcf7 form.unacceptable .wpcf7-response-output {
	display: block !important;
	margin-top: var(--wp--preset--spacing--30);
	padding: 0.75rem 1rem;
	border: 1px solid #c0392b !important;
	color: #c0392b;
	font-size: var(--wp--preset--font-size--small);
	grid-column: 1 / -1;
}

/* Masquer le honeypot (champ anti-spam) sans laisser de vide */
.wpcf7-form p:has(.nombre-de-chambres-wrap) {
	display: none;
}

/* Masquer le wrapper caché hCaptcha (évite une ligne de grille fantôme) */
.wpcf7-form-control-wrap.cf7apps-hcaptcha {
	display: none;
}

/* Supprimer les <br> parasites directs dans le formulaire */
.wpcf7-form > br {
	display: none;
}

/* Supprimer les paragraphes vides en fin de formulaire */
.wpcf7-form > p:empty {
	display: none;
}

/* Spinner inline avec le bouton (évite une case de grille séparée) */
.wpcf7-spinner {
	display: inline-block;
	vertical-align: middle;
	margin-left: 0.75rem;
}

/* ==========================================================================
   Grid 2 colonnes → 1 colonne en mobile
   Ajouter la classe "al-grid-stack" sur le bloc Grille dans l'éditeur
   via Avancé > Classe(s) CSS additionnelle(s).
   ========================================================================== */

@media (max-width: 768px) {
	.al-grid-stack {
		grid-template-columns: 1fr !important;
	}

	/* Inverse l'ordre des colonnes en mobile (ex. IMAGE|TEXTE → TEXTE|IMAGE) */
	.al-grid-stack.al-grid-reverse-mobile {
		display: flex !important;
		flex-direction: column-reverse;
	}

	/* Divs image vides (background-image sans contenu) : hauteur explicite sur mobile */
	.services-grid.has-background {
		min-height: clamp(220px, 55vw, 380px);
	}
}

/* ==========================================================================
   Bloc CTA — alignement droite (desktop) / gauche (mobile)
   Ajouter la classe "al-cta-right" sur le groupe bloc dans l'éditeur.
   ========================================================================== */

@media (max-width: 768px) {
	.al-cta-right {
		align-items: flex-start !important;
	}

	.al-cta-right p {
		text-align: left !important;
	}
}

