/*
Theme Name: EMIEConnect Child
Theme URI: https://emieconnect.com
Description: Thème enfant léger pour EMIEConnect Smart Solutions, basé sur Astra.
Author: EMIEConnect
Author URI: https://emieconnect.com
Template: astra
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: emieconnect
*/

/* =====================================================
   VARIABLES & PALETTE EMIECONNECT
   ===================================================== */
:root {
    --ec-primary:     #1a73e8;
    --ec-secondary:   #0d47a1;
    --ec-accent:      #f4a020;
    --ec-text:        #1c1c1c;
    --ec-text-light:  #5f6368;
    --ec-bg:          #ffffff;
    --ec-bg-alt:      #f8f9fa;
    --ec-border:      #e0e0e0;
    --ec-radius:      6px;
    --ec-shadow:      0 2px 8px rgba(0,0,0,.08);
    --ec-font:        'Inter', system-ui, -apple-system, sans-serif;
    --ec-transition:  .2s ease;
}

/* =====================================================
   TYPOGRAPHIE
   ===================================================== */
body {
    font-family: var(--ec-font);
    color: var(--ec-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--ec-text);
}

a {
    color: var(--ec-primary);
    text-decoration: none;
    transition: color var(--ec-transition);
}

a:hover {
    color: var(--ec-secondary);
    text-decoration: underline;
}

/* =====================================================
   MISE EN PAGE GÉNÉRALE
   ===================================================== */
.site-content {
    background-color: var(--ec-bg);
}

.entry-content p {
    margin-bottom: 1.25rem;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--ec-radius);
}

/* =====================================================
   EN-TÊTE
   ===================================================== */
.site-header,
.ast-hfb-header {
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* =====================================================
   NAVIGATION
   ===================================================== */
.main-header-menu .menu-item > a {
    font-weight: 500;
    letter-spacing: .02em;
}

.main-header-menu .menu-item > a:hover,
.main-header-menu .current-menu-item > a {
    color: var(--ec-primary);
}

/* =====================================================
   BOUTONS
   ===================================================== */
.ast-button,
.button,
button[type="submit"],
input[type="submit"] {
    background-color: var(--ec-primary);
    color: #fff;
    border: none;
    border-radius: var(--ec-radius);
    padding: .65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--ec-transition), transform var(--ec-transition);
}

.ast-button:hover,
.button:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    background-color: var(--ec-secondary);
    color: #fff;
    transform: translateY(-1px);
    text-decoration: none;
}

.ec-cta-btn {
    background-color: var(--ec-accent);
    color: #fff;
}

.ec-cta-btn:hover {
    background-color: #d48d10;
    color: #fff;
}

/* =====================================================
   CARTES & BLOCS
   ===================================================== */
.ec-card {
    background: var(--ec-bg);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius);
    padding: 1.5rem;
    box-shadow: var(--ec-shadow);
    transition: box-shadow var(--ec-transition), transform var(--ec-transition);
    position: relative;
    cursor: pointer;
}

.ec-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

/* Stretched link — toute la carte est cliquable via le bouton */
.ec-card .wp-block-button__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--ec-radius);
}

/* Au survol de la carte, le bouton s illumine */
.ec-card:hover .wp-block-button__link {
    background-color: #1558b0 !important;
    box-shadow: 0 2px 8px rgba(21,88,176,.35);
}

/* =====================================================
   SECTIONS ALTERNÉES
   ===================================================== */
.ec-section-alt {
    background-color: var(--ec-bg-alt);
    padding: 3rem 0;
}

/* =====================================================
   PIED DE PAGE
   ===================================================== */
.footer-widget-area,
.ast-footer-overlay {
    background-color: #12263a;
    color: #cfd8dc;
}

.ast-footer-copyright {
    background-color: #0a1929;
    color: #90a4ae;
    font-size: .85rem;
}

.footer-widget-area a,
.ast-footer-copyright a {
    color: var(--ec-accent);
}

.footer-widget-area a:hover,
.ast-footer-copyright a:hover {
    color: #fff;
}

/* =====================================================
   FORMULAIRES
   ===================================================== */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius);
    padding: .55rem .85rem;
    width: 100%;
    transition: border-color var(--ec-transition), box-shadow var(--ec-transition);
    font-family: var(--ec-font);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--ec-primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}

/* =====================================================
   ACCESSIBILITÉ
   ===================================================== */
:focus-visible {
    outline: 2px solid var(--ec-primary);
    outline-offset: 3px;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* =====================================================
   UTILITAIRES
   ===================================================== */
.ec-text-center { text-align: center; }
.ec-text-primary { color: var(--ec-primary); }
.ec-text-accent  { color: var(--ec-accent); }
.ec-mt-1 { margin-top: 1rem; }
.ec-mt-2 { margin-top: 2rem; }
.ec-mb-1 { margin-bottom: 1rem; }
.ec-mb-2 { margin-bottom: 2rem; }

/* =====================================================
   CORRECTIONS UI
   ===================================================== */

/* 1. Masquer le titre texte "ECSS" a cote du logo */
.ast-site-identity .site-title,
.ast-site-title-wrap .site-title {
    display: none !important;
}

/* 1b. Logo — réduit à 40 % de sa taille naturelle (393 → 157 px) */
img.custom-logo {
    width: 157px !important;
    max-width: 157px !important;
    height: auto !important;
}

/* 2. Masquer le titre de page "Accueil" */
.page .entry-header {
    display: none !important;
}

/* =====================================================
   MENU BURGER MOBILE
   ===================================================== */

.menu-toggle.main-header-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--ec-text, #1c1c1c);
    min-width: 44px;
    min-height: 44px;
}

.menu-toggle.main-header-menu-toggle:hover {
    color: var(--ec-primary, #1a73e8);
}

.menu-toggle.main-header-menu-toggle svg {
    width: 26px;
    height: 26px;
}

.ast-mobile-header-content {
    background: #fff;
    border-top: 2px solid var(--ec-primary, #1a73e8);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.ast-mobile-header-content .main-header-menu .menu-item .menu-link {
    font-size: 1rem;
    font-weight: 500;
    padding: 12px 24px;
    color: var(--ec-text, #1c1c1c);
    border-bottom: 1px solid var(--ec-border, #e0e0e0);
    display: block;
}

.ast-mobile-header-content .main-header-menu .menu-item .menu-link:hover,
.ast-mobile-header-content .main-header-menu .current-menu-item .menu-link {
    color: var(--ec-primary, #1a73e8);
    background: #f0f6ff;
    text-decoration: none;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.4rem; }
    .ec-section-alt { padding: 2rem 0; }
}

/* =====================================================
   BOUTON FLOTTANT — Découvrez votre besoin
   ===================================================== */

#ec-float-cta {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ec-primary, #1a73e8);
    color: #fff !important;
    border-radius: 50px;
    padding: 13px 22px;
    font-family: var(--ec-font, 'Inter', system-ui, sans-serif);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: 0 4px 18px rgba(26, 115, 232, .42);
    /* Caché par défaut — apparaît via .ec-visible déclenché par IntersectionObserver */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(.9);
    transition: opacity .4s ease, transform .4s cubic-bezier(.34,1.56,.64,1),
                background .22s ease, box-shadow .22s ease;
}

#ec-float-cta.ec-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

#ec-float-cta:hover {
    background: var(--ec-secondary, #0d47a1);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 8px 28px rgba(26, 115, 232, .52);
    color: #fff !important;
    text-decoration: none !important;
}

#ec-float-cta:active {
    transform: translateY(-1px) scale(.99);
}

#ec-float-cta:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.ec-float-icon {
    font-size: 1.1em;
    flex-shrink: 0;
    line-height: 1;
}

.ec-float-text {
    flex-shrink: 0;
}

/* @keyframes ecFloatIn supprimé — apparition pilotée par IntersectionObserver */

/* Mobile : texte raccourci sous 420 px */
@media (max-width: 420px) {
    #ec-float-cta {
        bottom: 16px;
        right: 16px;
        padding: 12px 16px;
        font-size: 0.85rem;
        max-width: calc(100vw - 32px);
    }
}

/* =====================================================
   QUIZ — Découvrez votre besoin (page 819)
   ===================================================== */

/* ── Quiz wrapper ── */
#ec-quiz-wrapper {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  color: #1c1c1c;
}

/* ── Indicateur de progression ── */
.ec-progress {
  margin-bottom: 3rem;
}
.ec-progress-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.ec-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}
.ec-prog-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #9e9e9e;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s, color .3s;
  position: relative;
  z-index: 1;
}
.ec-prog-label {
  font-size: 0.75rem;
  color: #9e9e9e;
  font-weight: 500;
  white-space: nowrap;
  transition: color .3s;
}
.ec-progress-step.active .ec-prog-num {
  background: #1a73e8;
  color: #fff;
}
.ec-progress-step.active .ec-prog-label { color: #1a73e8; }
.ec-progress-step.done .ec-prog-num {
  background: #0d47a1;
  color: #fff;
}
.ec-progress-step.done .ec-prog-label { color: #0d47a1; }
.ec-progress-line {
  width: 80px;
  height: 3px;
  background: #e0e0e0;
  margin-bottom: 22px;
  transition: background .3s;
  flex-shrink: 0;
}
.ec-progress-line.done { background: #0d47a1; }

@media (max-width: 480px) {
  .ec-progress-line { width: 40px; }
  .ec-prog-label { display: none; }
}

/* ── Étapes ── */
.ec-step-header { text-align: center; margin-bottom: 2.5rem; }
.ec-step-context {
  display: inline-block;
  background: #e8f0fe;
  color: #1a73e8;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.ec-step-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #1c1c1c;
}
.ec-step-subtitle {
  font-size: 1rem;
  color: #5f6368;
  margin: 0;
}

/* ── Bouton retour ── */
.ec-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 1.5rem;
}
.ec-back-btn:hover { color: #0d47a1; text-decoration: underline; }

/* ── Grille de cartes ── */
.ec-cards-grid {
  display: grid;
  gap: 1.25rem;
}
.ec-cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 640px) {
  .ec-cols-3 { grid-template-columns: 1fr; }
}
@media (min-width: 641px) and (max-width: 860px) {
  .ec-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Carte de choix (bouton) ── */
.ec-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 2rem 1.25rem;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  font-family: inherit;
}
.ec-card:hover {
  border-color: #1a73e8;
  box-shadow: 0 4px 16px rgba(26,115,232,.18);
  transform: translateY(-3px);
}
.ec-card-icon { font-size: 2.5rem; line-height: 1; }
.ec-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1c1c1c;
}
.ec-card-desc {
  font-size: 0.85rem;
  color: #5f6368;
  line-height: 1.4;
}

/* ── Cartes de résultats ── */
.ec-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.ec-result-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: box-shadow .2s, transform .2s;
}
.ec-result-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  transform: translateY(-2px);
}
.ec-result-icon { font-size: 2rem; line-height: 1; }
.ec-result-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: #1c1c1c;
}
.ec-result-desc {
  font-size: 0.87rem;
  color: #5f6368;
  line-height: 1.5;
  margin: 0;
}
.ec-result-link {
  margin-top: auto;
  color: #1a73e8;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.ec-result-link:hover { text-decoration: underline; color: #0d47a1; }

/* ── Bloc CTA final ── */
.ec-cta-block {
  background: #f0f6ff;
  border: 1px solid #c5d8f8;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}
.ec-cta-text {
  font-size: 1rem;
  color: #1c1c1c;
  margin: 0 0 1.25rem;
}
.ec-cta-btns {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.ec-btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, transform .2s;
  border: none;
  font-family: inherit;
}
.ec-btn-primary {
  background: #1a73e8;
  color: #fff;
}
.ec-btn-primary:hover { background: #0d47a1; color: #fff; text-decoration: none; transform: translateY(-1px); }
.ec-btn-outline {
  background: transparent;
  color: #1a73e8;
  border: 2px solid #1a73e8;
}
.ec-btn-outline:hover { background: #1a73e8; color: #fff; transform: translateY(-1px); }

/* ── Animation d'entrée ── */
@keyframes ecFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ec-step.active {
  animation: ecFadeIn .35s ease both;
}

/* =====================================================
   FIL D'ARIANE (Astra breadcrumb)
   ===================================================== */
.ast-breadcrumbs-wrapper {
    font-size: 0.85rem;
    color: var(--ec-text-light);
    padding: 8px 0 4px;
}

.ast-breadcrumbs-wrapper a {
    color: var(--ec-text-light);
    text-decoration: none;
}

.ast-breadcrumbs-wrapper a:hover {
    color: var(--ec-primary);
    text-decoration: underline;
}

/* =====================================================
   BOUTIQUE — Filtres par catégorie
   ===================================================== */
#ec-cat-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ec-border);
}

.ec-cat-btn {
    padding: 7px 16px;
    border: 2px solid var(--ec-border);
    background: var(--ec-bg);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--ec-font);
    font-weight: 500;
    color: var(--ec-text);
    transition: background var(--ec-transition), border-color var(--ec-transition), color var(--ec-transition);
    white-space: nowrap;
    line-height: 1.4;
}

.ec-cat-btn:hover,
.ec-cat-btn--active {
    background: var(--ec-primary);
    border-color: var(--ec-primary);
    color: #fff;
}

@media (max-width: 600px) {
    #ec-cat-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
    }
    #ec-cat-filters::-webkit-scrollbar { display: none; }
}

/* ── Badge "Article Partenaire" ── */
.ec-badge-partenaire {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: .4rem;
  vertical-align: middle;
}

/* =====================================================
   MEGA MENU — Services (3 col × 4 lignes) + Boutique — desktop ≥ 922 px
   Style compact, items sur une seule ligne (nowrap).
   ===================================================== */
@media (min-width: 922px) {

  /* Header — hauteur fixe, pas de padding dynamique au survol.
     Les dropdowns s'ouvrent par-dessus le contenu grâce au z-index. */
  .ast-primary-header-bar {
    padding-bottom: 0 !important;
    position: relative;
    z-index: 200;
  }

  /* Navigation — remontée de 16px dans le header (logo non touché).
     transform: translateY est purement visuel : le layout flex ne bouge pas,
     le dropdown suit intégralement (il est dans le même sous-arbre rendu). */
  .ast-primary-header-bar .site-header-primary-section-right {
    transform: translateY(-16px);
  }

  /* Dropdown — position absolue par-dessus le hero, jamais en flux */
  #menu-item-1085 > .sub-menu,
  #menu-item-1151 > .sub-menu {
    position: absolute !important;
    z-index: 9999 !important;
  }

  /* Services — grille 3 col × 4 lignes.
     width: max-content garantit que le fond blanc couvre toutes les colonnes.
     min-width évite un éventuel clipping par le parent positionné.
     Colonnes supplémentaires auto-générées en max-content si services > 12. */
  #menu-item-1085 > .sub-menu {
    display: grid !important;
    grid-template-columns: repeat(3, max-content) !important;
    grid-template-rows: repeat(4, auto) !important;
    grid-auto-flow: column !important;
    grid-auto-columns: max-content !important;
    gap: 0 !important;
    width: max-content !important;
    min-width: max-content !important;
  }

  /* Items — style compact identique Services & Boutique */
  #menu-item-1085 > .sub-menu > li,
  #menu-item-1151 > .sub-menu > li {
    margin: 0 !important;
  }

  #menu-item-1085 > .sub-menu > li > a,
  #menu-item-1151 > .sub-menu > li > a {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    font-size: 0.875rem !important;
    line-height: 1.35 !important;
    white-space: nowrap !important;
  }
}
