/*
Theme Name: Storefront Child (Planète Zen)
Theme URI: https://planetezen.fr/
Description: Thème enfant minimal pour Storefront — base propre pour la boutique Planète Zen.
Author: christophe geay
Author URI: https://planetezen.fr/
Template: storefront
Requires at least: 6.0
Tested up to: 6.6
Version: 1.0.0
License: GNU GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: storefront-child-pz
*/

/* =========================
   0) Variables globales
   ========================= */
:root{
  --pz-green-900:#1b4332;
  --pz-green-300:#95d5b2;
  --pz-green-100:#d8f3dc;
  --pz-beige:#fefae0;

  /* Header */
  --pz-logo-width:120px;                 /* largeur logo centrée */
  --pz-header-ico-size:1.4rem;           /* taille pictos */
  --pz-header-item:2rem;                 /* hitbox liens icône */
  --pz-header-gap:1rem;                  /* espacement entre icônes */
  --pz-header-min-h:260px;               /* hauteur bandeau */

  /* Fond global */
  --pz-bg-url:url('https://www.planetezen.fr/wp-content/uploads/2025/09/151aea04-f7e5-46dd-b3f1-d493c60f39d5.png');

  /* Image d’en-tête (Customizer) */
  --pz-header-img:url('https://www.planetezen.fr/wp-content/uploads/2025/09/cropped-Banniere_1950x500_topcrop.png');
}

/* =========================
   1) Base & fond global
   ========================= */
html,body{ min-height:100%; }
body{
  background: var(--pz-beige) fixed center top / auto repeat;
  background-image: var(--pz-bg-url);
  font-feature-settings:"liga","kern";
}
a{ text-decoration:none; }

/* =========================
   2) Header (image cover + pas de répétition)
   ========================= */
header#masthead.site-header{
  background-image: var(--pz-header-img) !important;
  background-repeat: no-repeat !important;
  background-position: center top !important;
  background-size: cover !important;
  background-attachment: scroll !important;
  background-color: var(--pz-beige);     /* évite de voir le fond du body */
  min-height: var(--pz-header-min-h);
}
header#masthead.site-header::before{ background:none !important; } /* neutralise éventuelle superposition */

/* Cas Customizer <img> (au lieu de background) */
.wp-custom-header,
.custom-header{
  position:relative;
  overflow:hidden;
  min-height: var(--pz-header-min-h);
}
.wp-custom-header img,
.custom-header img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  object-position:center top !important;
  display:block;
}

/* Responsive hauteur bandeau */
@media (max-width:1024px){
  header#masthead.site-header,
  .wp-custom-header,
  .custom-header{ min-height:220px; }
}
@media (max-width:768px){
  header#masthead.site-header,
  .wp-custom-header,
  .custom-header{ min-height:180px; }
}

/* =========================
   3) Branding & navigation centrés (Storefront-compatible)
   ========================= */
/* Logo centré + réduit */
.site-header .site-branding{
  display:flex; justify-content:center; align-items:center;
  width:100%; text-align:center;
}
.site-header .site-branding img.custom-logo,
.site-header .site-branding .custom-logo-link img,
.site-header .site-logo img{
  width: var(--pz-logo-width) !important;
  height:auto !important;
  display:block; margin:0 auto;
}

/* Centrage du menu (desktop) */
@media (min-width:768px){
  .site-header .col-full{
    display:flex; flex-direction:column; align-items:center;
  }
  .site-header .primary-navigation{ width:100%; }
  .main-navigation ul.menu{
    display:flex; flex-wrap:wrap; justify-content:center;
    gap:.75rem 1.25rem; margin:0;
  }
  .main-navigation ul.menu > li{
    float:none; display:flex; align-items:center; position:relative;
  }
  .main-navigation ul.menu > li > a{ padding:.8rem 1rem; }
}

/* Mobile : on garde l’accordéon natif, mais on centre le texte */
@media (max-width:767.98px){
  .handheld-navigation .menu{ text-align:center; }
  .handheld-navigation .menu > li > a{ display:inline-block; }
}

/* =========================
   4) Icônes header (Compte / Panier / Wishlist)
   ========================= */
/* Nettoyage des éléments à droite hérités Storefront si présents */
.site-header-cart,
.pz-header-utilities{ display:none !important; }

/* Lien “icône seule” */
.main-navigation .menu a.pz-icon-only{
  position:relative;
  display:inline-flex; align-items:center; justify-content:center;
  width:var(--pz-header-item); height:var(--pz-header-item);
  color:var(--pz-green-900);
  padding:0; font-size:0; line-height:0; /* masque le texte (a11y via aria-label) */
}

/* Espacement horizontal entre icônes adjacentes */
.main-navigation .menu .menu-item a.pz-icon-only + a.pz-icon-only{
  margin-left:var(--pz-header-gap);
}

/* Base icône par mask SVG */
.main-navigation .menu a.pz-icon-only::before{
  content:""; display:block;
  width:var(--pz-header-ico-size); height:var(--pz-header-ico-size);
  background:currentColor;
  -webkit-mask:no-repeat center/contain; mask:no-repeat center/contain;
}

/* COMPTE */
.main-navigation .menu a.pz-account::before{
  -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z'/><path d='M20 20v-1c0-3.314-3.582-6-8-6s-8 2.686-8 6v1'/></svg>");
          mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z'/><path d='M20 20v-1c0-3.314-3.582-6-8-6s-8 2.686-8 6v1'/></svg>");
}

/* PANIER */
.main-navigation .menu a.pz-cart::before{
  -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 18a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm10 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM5.2 16h12.2v-2H7.3c-.7 0-1.33-.41-1.61-1.05L2.5 5H1V3h3.2l.94 2H21a1 1 0 0 1 .94 1.34l-3 8a2 2 0 0 1-1.84 1.3H5.2Z'/></svg>");
          mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 18a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm10 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM5.2 16h12.2v-2H7.3c-.7 0-1.33-.41-1.61-1.05L2.5 5H1V3h3.2l.94 2H21a1 1 0 0 1 .94 1.34l-3 8a2 2 0 0 1-1.84 1.3H5.2Z'/></svg>");
}

/* WISHLIST (coeur) */
.main-navigation .menu a.pz-wishlist::before{
  -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-5.6-4.35-8.4-7.1A5.9 5.9 0 0 1 3 7.5 5.5 5.5 0 0 1 8.5 2c1.9 0 3.6 1.1 4.5 2.7A5 5 0 0 1 17 2a5.5 5.5 0 0 1 5 5.5c0 1.6-.7 3.2-1.9 4.4C17.6 16.65 12 21 12 21Z'/></svg>");
          mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-5.6-4.35-8.4-7.1A5.9 5.9 0 0 1 3 7.5 5.5 5.5 0 0 1 8.5 2c1.9 0 3.6 1.1 4.5 2.7A5 5 0 0 1 17 2a5.5 5.5 0 0 1 5 5.5c0 1.6-.7 3.2-1.9 4.4C17.6 16.65 12 21 12 21Z'/></svg>");
}

/* Hover + focus accessibles */
.main-navigation .menu a.pz-icon-only:hover{ opacity:.75; }
.main-navigation .menu a.pz-icon-only:focus-visible{
  outline:2px solid var(--pz-green-300);
  outline-offset:2px; border-radius:.5rem;
}

/* Badge panier */
.main-navigation .menu a.pz-cart .pz-badge{
  position:absolute; top:-.35rem; right:-.45rem;
  min-width:1.05rem; height:1.05rem; padding:0 .3rem;
  background:var(--pz-green-900); color:#fff;
  font:700 .72rem/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  border-radius:999px; display:inline-flex; align-items:center; justify-content:center;
}

/* Alignement items (harmonise icônes + liens texte) */
.main-navigation .menu > li{ display:flex; align-items:center; }


/* ===== Boutique (Planète Zen) — style "Accueil" sans hero ===== */
:root{
  --pz-green-900:#1b4332;
  --pz-green-300:#95d5b2;
  --pz-green-100:#d8f3dc;
  --pz-beige:#fefae0;
}

/* Fond image + léger voile pour lisibilité */
.pz-boutique{
  position: relative;
  min-height: 100dvh;
  padding: 2rem 1rem;
  background: url('https://www.planetezen.fr/wp-content/uploads/2025/09/hero-home.png') center / cover no-repeat;
}
@media (min-width: 1024px){
  .pz-boutique{ background-attachment: fixed; }
}
.pz-boutique::before{
  content:"";
  position:absolute; inset:0;
  background: rgba(255,255,255,.55);
  pointer-events:none;
}

.pz-boutique *{ box-sizing: border-box; }
.pz-boutique .pz-inner{
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
}

/* Titre encadré (pas de hero) */
.pz-boutique .pz-title{
  grid-column: 1 / -1;
  background: var(--pz-beige);
  border: 2px solid var(--pz-green-900);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  text-align: center;
  font-weight: 700;
  color: var(--pz-green-900);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Sidebar catégories (sticky + scroll) */
.pz-boutique .pz-sidebar{ position: relative; }
.pz-boutique .pz-sidebar-inner{
  position: sticky;
  top: 20px;
  background: #fff;
  border: 2px solid var(--pz-green-900);
  border-radius: 14px;
  padding: .75rem;
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}
.pz-boutique .pz-side-title{
  margin: .25rem .5rem .5rem;
  font-weight: 700;
  color: var(--pz-green-900);
  text-align: center;
}
.pz-boutique .pz-catmenu{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .5rem;
}
.pz-boutique .pz-catmenu a{
  display: block;
  background: var(--pz-beige);
  border: 1.5px solid var(--pz-green-300);
  border-left: 8px solid var(--pz-green-300);
  border-radius: 10px;
  padding: .6rem .7rem;
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 600;
}
.pz-boutique .pz-catmenu a:hover{
  filter: brightness(0.98);
  transform: translateX(2px);
}

/* Panneau principal */
.pz-boutique .pz-content{ min-width: 0; }
.pz-boutique .pz-panel{
  background: #fff;
  border: 2px solid var(--pz-green-900);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

/* Grille des catégories [product_categories] */
.pz-boutique ul.products{
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}
.pz-boutique ul.products li.product-category{
  list-style: none;
  background: #fff;
  border: 1.5px solid var(--pz-green-300);
  border-left: 8px solid var(--pz-green-300);
  border-radius: 12px;
  padding: .75rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.pz-boutique ul.products li.product-category:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,.08);
}
.pz-boutique ul.products li.product-category img{
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--pz-green-100);
}
.pz-boutique ul.products li.product-category h2,
.pz-boutique ul.products li.product-category .woocommerce-loop-category__title{
  margin: .6rem 0 0;
  font-weight: 700;
  color: var(--pz-green-900);
  text-align: center;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 1024px){
  .pz-boutique .pz-inner{ grid-template-columns: 1fr; }
  .pz-boutique .pz-sidebar{ order: 2; }
  .pz-boutique ul.products{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px){
  .pz-boutique ul.products{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pz-boutique .pz-title{ font-size: 1rem; padding: .8rem 1rem; }
}

/* Masquer l’éventuel header/hero WooCommerce dans ce contexte */
.woocommerce-shop .woocommerce-products-header{ display:none !important; }


/* === Correctif Boutique : 2 lignes de 4 cartes, sans décalages === */
.pz-boutique ul.products{
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;              /* hauteurs homogènes */
  gap: 1rem;
  margin: 0 !important;
  padding: 0 !important;
}

/* Neutraliser l'héritage WooCommerce (floats, largeurs, marges) */
.pz-boutique ul.products::before,
.pz-boutique ul.products::after{ display:none !important; }

.pz-boutique ul.products li.product,
.pz-boutique ul.products li.product-category{
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  list-style: none !important;

  display: flex;                    /* cartes auto-égalisées */
  flex-direction: column;
  height: 100%;                     /* occupe toute la ligne du grid-auto-rows */
}

/* Carte */
.pz-boutique ul.products li.product-category{
  background: #fff;
  border: 1.5px solid var(--pz-green-300);
  border-left: 8px solid var(--pz-green-300);
  border-radius: 12px;
  padding: .75rem;
  transition: transform .15s ease, box-shadow .15s ease;
}

/* Image : ratio stable pour éviter les hauteurs inégales */
.pz-boutique ul.products li.product-category img{
  width: 100%;
  aspect-ratio: 16/10;              /* fixe le ratio, remplace la hauteur figée */
  object-fit: cover;
  border-radius: 10px;
  background: var(--pz-green-100);
  display:block;
}

/* Titre : ligne unique stable */
.pz-boutique ul.products li.product-category .woocommerce-loop-category__title{
  margin: .6rem 0 0;
  font-weight: 700;
  color: var(--pz-green-900);
  text-align: center;
  font-size: 1rem;
  line-height: 1.2;
  min-height: 2.4em;                /* hauteur cohérente même si le nom est long */
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Compteur : évite le saut de ligne imprévu */
.pz-boutique ul.products li.product-category .woocommerce-loop-category__title .count{
  font-weight: 600;
  margin-left: .35em;
  white-space: nowrap;
}

/* Hover identique */
.pz-boutique ul.products li.product-category:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,.08);
}

/* Responsive inchangé : 3 colonnes puis 2 colonnes */
@media (max-width: 1024px){
  .pz-boutique ul.products{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px){
  .pz-boutique ul.products{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
