/*
Theme Name: YM Fibre
Theme URI: https://ym-fibre.com
Author: YM Fibre
Description: Thème bloc sur mesure de YM Fibre, installation de fibre optique. Converti depuis la maquette validée : bandes sombres, Instrument Sans, aucun accent de couleur.
Version: 1.0.1
Requires at least: 6.6
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ym-fibre
Tags: block-theme, full-site-editing, business, dark
*/

/* ==========================================================================
   Jetons — identiques à la maquette (maquette/styles.css)
   ========================================================================== */
:root {
  --noir: #000000;
  --bande-1: #0e0e0e;
  --bande-2: #262626;
  --bande-3: #3c3c3c;
  --blanc: #ffffff;
  --glace: #e8f1f9;
  --libelle: #776b6e;
  --largeur: 1344px;
  --police: "Instrument Sans", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bande-1);
  color: var(--blanc);
  font-family: var(--police);
  font-size: 16px;
  line-height: 28px;
  -webkit-font-smoothing: antialiased;
}

/* height:auto obligatoire : sinon l'attribut height des blocs image l'emporte sur aspect-ratio. */
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 400; margin: 0; hyphens: none; text-wrap: balance; }
h1, h2 { font-size: 38.4px; line-height: 1.2; text-align: center; }
h3 { font-size: 28.8px; line-height: 1.2; }
p { margin: 0; }

/* Espacement automatique de Gutenberg : coupé à la source (theme.json, blockGap 0px)
   et, en filet de sécurité, ici À SPÉCIFICITÉ NULLE — jamais « .wp-block-group > * ». */
:where(.wp-block-group) > :where(*), :where(.wp-block-buttons) { margin-block: 0; }
figure.wp-block-image { margin: 0; }
.wp-site-blocks > * + * { margin-block-start: 0; }

/* La référence arrondit toutes ses photos à 8 px (sauf le bandeau pleine largeur). */
.service img, .galerie img, .installateur .cadre img { border-radius: 8px; }

.enveloppe { width: 100%; max-width: calc(var(--largeur) + 80px); margin: 0 auto; padding: 0 40px; }

.bande { padding: 64px 0; }
.bande-1 { background: var(--bande-1); }
.bande-2 { background: var(--bande-2); }
.bande-3 { background: var(--bande-3); }
.bande > .enveloppe > h1,
.bande > .enveloppe > h2 { margin-bottom: 48px; }
.bande > .enveloppe > h1:has(+ .intro) { margin-bottom: 16px; }
.bande .intro { max-width: 720px; margin: 0 auto 48px; text-align: center; text-wrap: balance; }

/* ==========================================================================
   Boutons — même rendu pour core/button, l'élément bouton de CF7 et le menu
   ========================================================================== */
.wp-element-button, .wp-block-button__link, input.bouton,
.wp-block-navigation.nav .nav-bouton > .wp-block-navigation-item__content {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 16px;
  background: var(--glace); color: #000;
  font: 500 16px/22px var(--police);
  border: 0; border-radius: 6px; cursor: pointer;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, background-color .2s ease;
}
.wp-element-button:hover, .wp-block-button__link:hover, input.bouton:hover,
.wp-block-navigation.nav .nav-bouton > .wp-block-navigation-item__content:hover {
  background: #fff; color: #000; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, .45);
}
.wp-element-button:active, .wp-block-button__link:active, input.bouton:active { transform: translateY(0); box-shadow: none; }

/* ==========================================================================
   En-tête
   ========================================================================== */
.entete { position: relative; z-index: 10; background: var(--noir); --logo-hauteur: 48px; }
.entete .enveloppe { height: 72px; display: flex; align-items: center; justify-content: space-between; }
.entete .marque { display: flex; align-items: center; gap: 12px; }
.marque .wp-block-site-title, .pied .wp-block-site-title { font-size: 28.8px; line-height: 1.2; margin: 0; }
.marque .wp-block-site-title a, .pied .wp-block-site-title a { color: inherit; text-decoration: none; }
/* Zone logo : la largeur se règle dans l'éditeur (bloc Logo du site) ; la hauteur est plafonnée. */
.entete .wp-block-site-logo { line-height: 0; }
.entete .wp-block-site-logo img { max-height: var(--logo-hauteur); width: auto; object-fit: contain; }

/* core/navigation : le CSS du bloc est imprimé APRÈS cette feuille, d'où les sélecteurs qualifiés. */
.wp-block-navigation.nav { font-size: 16px; }
.wp-block-navigation.nav .wp-block-navigation__container { display: flex; align-items: center; gap: 8px; }
.wp-block-navigation.nav .wp-block-navigation-item__content { display: block; padding: 6px 12px; border-radius: 5px; line-height: 28px; color: var(--blanc); }
.wp-block-navigation.nav .wp-block-navigation-item:not(.nav-bouton):not(.connexion) > .wp-block-navigation-item__content:hover,
.wp-block-navigation.nav .wp-block-navigation-item.est-actif:not(.nav-bouton):not(.connexion) > .wp-block-navigation-item__content { background: var(--bande-2); }
.wp-block-navigation.nav .nav-bouton { margin-left: 16px; }
/* Connexion : petit lien atténué, isolé du menu par un filet vertical. */
.wp-block-navigation.nav .connexion { margin-left: 20px; padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, .25); height: 24px; display: flex; align-items: center; }
.wp-block-navigation.nav .connexion > .wp-block-navigation-item__content { padding: 0; font-size: 14px; color: #a9a9a9; background: none; transition: color .2s ease; }
.wp-block-navigation.nav .connexion > .wp-block-navigation-item__content:hover { color: var(--blanc); background: none; }
.wp-block-navigation.nav .wp-block-navigation__responsive-container-open,
.wp-block-navigation.nav .wp-block-navigation__responsive-container-close { color: var(--blanc); }
.wp-block-navigation.nav .wp-block-navigation__responsive-container-open svg { width: 28px; height: 28px; }

/* ==========================================================================
   Services
   ========================================================================== */
.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.service img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.service .wp-block-image { margin-bottom: 24px; }
.service h3 { margin-bottom: 16px; }
.service p { max-width: 95%; }
.services-centre { display: flex; flex-wrap: wrap; justify-content: center; gap: 48px 32px; }
.services-centre .service { width: calc((100% - 64px) / 3); }

/* ==========================================================================
   Galerie — chaque photo est un core/image : la classe est sur la figure
   ========================================================================== */
.galerie { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.galerie .wp-block-image { margin: 0; aspect-ratio: 4 / 3; }
.galerie .wp-block-image img { width: 100%; height: 100%; object-fit: cover; }
.galerie .grand { grid-column: span 3; }
.galerie .petit { grid-column: span 2; }

/* ==========================================================================
   Accroche
   ========================================================================== */
.accroche { text-align: center; }
.accroche h2 { margin-bottom: 16px !important; }
.accroche p { line-height: 24px; max-width: 720px; margin: 0 auto; text-wrap: balance; }
.accroche .wp-block-buttons { margin-top: 28px; justify-content: center; }

/* ==========================================================================
   Mentions légales
   ========================================================================== */
.texte-legal { max-width: 800px; margin: 0 auto; }
.texte-legal h3 { font-size: 24px; margin: 40px 0 12px; }
.texte-legal h3:first-child { margin-top: 0; }
.texte-legal p + p { margin-top: 12px; }
.texte-legal a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .4); }
.texte-legal a:hover { text-decoration-color: currentColor; }
.texte-legal em { font-style: normal; color: #a9a9a9; } /* « [à compléter] » */

/* ==========================================================================
   Bandeau, installateur, confiance
   ========================================================================== */
.bandeau { background: var(--bande-1); }
.bandeau img { width: 100%; height: 320px; object-fit: cover; }

.installateur .cadre { max-width: 800px; margin: 0 auto 40px; }
.installateur .cadre img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.installateur p { max-width: 800px; margin: 0 auto; text-align: center; line-height: 24px; }

.confiance { display: flex; justify-content: center; gap: 64px; flex-wrap: wrap; }
.confiance .carte-logo {
  width: 172px; height: 129px; border-radius: 8px; background: #fff; color: #000;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 20px; line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; padding: 12px;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
}
.confiance .carte-logo:hover { transform: translateY(-6px); box-shadow: 0 14px 28px rgba(0, 0, 0, .55); }

/* ==========================================================================
   Contact — formulaires Contact Form 7, carte [ym_carte]
   ========================================================================== */
.bande .coordonnees { text-align: center; margin: -32px 0 40px; }
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: stretch; }
.wpcf7 form.formulaire { display: flex; flex-direction: column; gap: 13px; }
.wpcf7-form-control-wrap { display: block; } /* sinon +5 à 13 px par champ sous la ligne de base */
.champ { position: relative; transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.champ input, .champ textarea {
  width: 100%; height: 56px; padding: 24px 12px 6px; /* inline-block, comme la maquette (rythme identique) */
  font: 400 16px/20px var(--police); color: #000;
  background: #fff; border: 1px solid #dee2e6; border-radius: 4px; outline: none;
  transition: box-shadow .3s ease, border-color .3s ease;
}
.champ textarea { height: 100px; resize: vertical; }
.champ label { position: absolute; left: 13px; top: 4px; font-size: 13px; line-height: 20px; color: var(--libelle); pointer-events: none; z-index: 1; }
.champ:hover, .champ:focus-within { transform: translateY(-2px); }
.champ:hover input, .champ:hover textarea,
.champ:focus-within input, .champ:focus-within textarea { border-color: #9aa7b4; box-shadow: 0 8px 18px rgba(0, 0, 0, .45); }
.formulaire input.bouton { align-self: flex-start; margin-top: 6px; width: auto; }
.wpcf7-spinner { display: none !important; }
.wpcf7-not-valid-tip { display: block; margin-top: 4px; font-size: 13px; line-height: 18px; color: #ffb4b4; }
.wpcf7 form .wpcf7-response-output { margin: 4px 0 0; padding: 8px 12px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px; font-size: 14px; line-height: 20px; }
.carte iframe { width: 100%; height: 100%; min-height: 340px; border: 0; display: block; }

.lettre { text-align: center; }
.lettre h2 { margin-bottom: 12px !important; }
.lettre .wpcf7 form { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.lettre .champ { width: 309px; text-align: left; }
.lettre input.bouton { width: 56px; height: 56px; padding: 0; font-size: 22px; }
.lettre .wpcf7 form .wpcf7-response-output { flex-basis: 100%; max-width: 373px; margin: 4px auto 0; }

/* ==========================================================================
   Pied de page
   ========================================================================== */
.pied { background: var(--noir); padding: 40px 0 32px; }
.pied-grille { display: flex; justify-content: space-between; align-items: stretch; gap: 24px; font-size: 14px; }
.pied-gauche { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.pied-droite { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 4px; }
.pied .pied-legal { display: flex; align-items: center; gap: 16px; min-height: 28px; }
.pied-legal a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .4); transition: text-decoration-color .2s ease; }
.pied-legal a:hover { text-decoration-color: currentColor; }
/* core/social-links : pastille blanche carrée 22 px, « in » noir — comme la maquette. */
.pied .wp-block-social-links.reseau { margin: 0; padding: 0; gap: 0; font-size: 16px; }
.pied .reseau .wp-social-link.wp-social-link-linkedin {
  width: 22px; height: 22px; border-radius: 4px; background-color: #fff; color: #000; margin: 0;
  opacity: .85; transition: transform .3s cubic-bezier(.2, .7, .2, 1), opacity .3s ease;
}
.pied .reseau .wp-social-link.wp-social-link-linkedin:hover { transform: translateY(-2px); opacity: 1; }
.pied .reseau .wp-social-link a { padding: 3px; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.pied .reseau .wp-social-link svg { width: 16px; height: 16px; fill: #000; }

/* ==========================================================================
   Mouvement au survol
   ========================================================================== */
.service img, .galerie img, .installateur .cadre img {
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
}
.service img:hover, .galerie img:hover, .installateur .cadre img:hover {
  transform: translateY(-6px); box-shadow: 0 14px 28px rgba(0, 0, 0, .55);
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .service img:hover, .galerie img:hover, .installateur .cadre img:hover,
  .confiance .carte-logo:hover, .champ:hover, .champ:focus-within, .wp-element-button:hover,
  .wp-block-button__link:hover, input.bouton:hover { transform: none; }
}

/* ==========================================================================
   Tablette et mobile (≤ 900 px) — même point de bascule que la maquette.
   core/navigation ne bascule en burger qu'à 600 px : entre 600 et 900 px on force le burger.
   ========================================================================== */
@media (min-width: 600px) and (max-width: 900px) {
  .wp-block-navigation.nav .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
  .wp-block-navigation.nav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
}
@media (max-width: 900px) {
  .enveloppe { padding: 0 24px; }
  .entete { --logo-hauteur: 40px; }

  /* Le panneau du menu s'ouvre sous l'en-tête, noir, liens à gauche (et non blanc plein écran). */
  .wp-block-navigation.nav .wp-block-navigation__responsive-container.is-menu-open {
    background-color: var(--noir) !important; color: var(--blanc) !important;
    top: 72px; bottom: auto; height: auto; padding: 8px 24px 24px;
  }
  .admin-bar .wp-block-navigation.nav .wp-block-navigation__responsive-container.is-menu-open { top: calc(72px + var(--wp-admin--admin-bar--height, 0px)); }
  .wp-block-navigation.nav .is-menu-open .wp-block-navigation__responsive-container-content { padding-top: 0; align-items: flex-start !important; }
  .wp-block-navigation.nav .is-menu-open .wp-block-navigation__container { flex-direction: column; align-items: flex-start !important; gap: 8px; width: 100%; }
  .wp-block-navigation.nav .is-menu-open .wp-block-navigation-item { align-items: flex-start !important; }
  .wp-block-navigation.nav .is-menu-open .wp-block-navigation__responsive-container-close { top: 8px; right: 0; }
  .wp-block-navigation.nav .is-menu-open .wp-block-navigation-item__content { padding: 6px 12px !important; }
  .wp-block-navigation.nav .is-menu-open .nav-bouton { margin: 8px 0 0; }
  .wp-block-navigation.nav .is-menu-open .nav-bouton > .wp-block-navigation-item__content { padding: 0 16px !important; }
  /* Dans le menu mobile, le filet passe à l'horizontale au-dessus du lien. */
  .wp-block-navigation.nav .is-menu-open .connexion {
    margin: 16px 0 0; padding: 12px 0 0; height: auto; border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, .25); align-self: stretch;
  }

  h1, h2 { font-size: 32.64px; }
  .services { grid-template-columns: 1fr; gap: 48px; }
  .services-centre .service { width: 100%; }
  .galerie .grand { grid-column: span 6; }
  .galerie .petit { grid-column: span 3; }
  .galerie .petit:nth-child(5n) { grid-column: span 6; }
  .bandeau img { height: 220px; }
  .confiance { gap: 16px; }
  .confiance .carte-logo { width: calc(50% - 8px); }
  .contact { grid-template-columns: 1fr; }
  .bande .coordonnees { margin-top: -24px; }
  .lettre .champ { width: auto; flex: 1; }

  .pied-grille { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pied-droite { display: block; text-align: left; }
  .pied-droite .pied-adresse, .pied-droite .pied-contact { display: inline; }
  .pied-droite .pied-contact::before { content: " · "; }
  .pied .pied-legal { flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 8px; }
}
