/* ============================================================
   header.css — DESQ Energy
   Design tokens chargés via design-system.css
   Mobile-first : base = 360px, desktop via min-width: 1024px
============================================================ */

/* ─── BASE (mobile) ──────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  height: 60px;
  border-bottom: 1px solid #e8e8e8;
  transition: background 300ms ease-out,
              backdrop-filter 300ms ease-out;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.site-header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  outline-offset: 4px;
}

.site-header__logo img {
  height: 36px;
  width: auto;
  display: block;
}

.site-header__logo-text {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--color-secondary);
  letter-spacing: -0.02em;
}

.site-header__logo-text em {
  color: var(--color-primary);
  font-style: normal;
}

/* Desktop nav — masqué sur mobile */
.site-header__nav {
  display: none;
}

/* Actions */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* CTA — masqué sur mobile */
.site-header__cta {
  display: none;
}

/* Search */
.site-header__search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(26, 26, 26, 0.5);
  transition: color var(--transition-fast);
}

.site-header__search-btn:hover {
  color: #1a1a1a;
}

/* Hamburger */
.site-header__burger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #1a1a1a;
  flex-shrink: 0;
}

/* ─── SCROLL STATE ───────────────────────────────────────── */

.site-header--scrolled {
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #e8e8e8;
}

/* ─── DESKTOP (1024px+) ──────────────────────────────────── */

@media (min-width: 1024px) {
  .site-header {
    height: var(--header-height);
  }

  .site-header__logo img {
    height: 52px;
  }

  /* Nav */
  .site-header__nav {
    display: flex;
    flex: 1;
    justify-content: center;
  }

  .site-header__menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  /* Liens nav */
  .site-header__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: var(--fw-regular);
    color: #1a1a1a;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    transition: color 150ms ease-out;
    line-height: 1;
  }

  .site-header__link:hover,
  .site-header__link.is-active {
    color: var(--color-primary);
  }

  .site-header__link.is-active {
    font-weight: var(--fw-medium);
  }

  .site-header__link--accent {
    color: var(--color-primary);
    font-weight: var(--fw-medium);
  }

  .site-header__link--accent:hover {
    color: var(--color-primary-dark);
  }

  /* Chevron */
  .site-header__chevron {
    opacity: 0.6;
    transition: transform 200ms ease-out;
    flex-shrink: 0;
  }

  .menu-item--has-dropdown.is-open > .site-header__link--toggle .site-header__chevron {
    transform: rotate(180deg);
    opacity: 1;
  }

  /* Actions */
  .site-header__cta {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: var(--fw-medium);
    border-radius: var(--radius-md);
    transition: background var(--transition), transform var(--transition);
  }

  .site-header__cta:hover {
    transform: translateY(-1px);
  }

  .site-header__cta:active {
    transform: scale(0.98);
  }

  .site-header__actions {
    gap: 16px;
  }

  /* Hamburger — masqué sur desktop */
  .site-header__burger {
    display: none;
  }

  /* ─── DROPDOWNS ── */

  .menu-item--has-dropdown {
    position: relative;
  }

  .site-header__dropdown {
    position: absolute;
    top: 100%;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-top: 2px solid var(--color-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
    z-index: 200;
  }

  .site-header__dropdown.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  /* Titre interne */
  .site-header__dropdown-title {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(26, 26, 26, 0.4);
    margin-bottom: 16px;
  }

  /* Lien "voir tout" bas de dropdown */
  .site-header__dropdown-link-all {
    display: block;
    text-align: right;
    margin-top: 16px;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
  }

  .site-header__dropdown-link-all:hover {
    color: var(--color-primary-dark);
  }

  /* ─── SOLUTIONS — méga grille ── */

  .site-header__dropdown--solutions {
    width: 480px;
    left: 50%;
    padding: 24px;
    transform: translateX(-50%) translateY(-6px);
  }

  .site-header__dropdown--solutions.is-open {
    transform: translateX(-50%) translateY(0);
  }

  .solutions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .solutions-grid__cell {
    position: relative;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    display: block;
    text-decoration: none;
    cursor: pointer;
    background: var(--color-secondary-bg);
    border: 1px solid var(--color-border);
    transition: transform 200ms ease-out, border-color 200ms ease-out;
  }

  .solutions-grid__cell:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
  }

  .solutions-grid__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to top,
      rgba(15, 52, 96, 0.75) 0%,
      rgba(15, 52, 96, 0.2) 60%
    );
    transition: background 200ms ease-out;
  }

  .solutions-grid__cell:hover .solutions-grid__overlay {
    background: linear-gradient(
      to top,
      rgba(232, 114, 42, 0.8) 0%,
      rgba(232, 114, 42, 0.15) 70%
    );
  }

  .solutions-grid__label {
    position: absolute;
    bottom: 10px;
    left: 12px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: var(--fw-medium);
    color: #ffffff;
    z-index: 1;
  }

  /* ─── PRODUITS — sidebar + aperçu ── */

  .site-header__dropdown--products {
    width: 640px;
    left: 0;
    padding: 0;
    display: flex;
  }

  .products-dropdown__sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #f7f7f7;
    padding: 20px 0;
    border-right: 1px solid #e8e8e8;
  }

  .products-dropdown__sidebar .site-header__dropdown-title {
    padding: 0 20px;
    margin-bottom: 8px;
  }

  .products-dropdown__cat {
    display: block;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: var(--fw-regular);
    color: var(--color-text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 150ms ease-out,
                background 150ms ease-out,
                padding-left 150ms ease-out;
  }

  .products-dropdown__cat:hover {
    color: var(--color-text);
    background: #efefef;
    border-left-color: var(--color-primary);
    padding-left: 18px;
  }

  .products-dropdown__cat--all {
    color: var(--color-primary);
    font-weight: var(--fw-medium);
    border-left-color: transparent;
  }

  .products-dropdown__cat--all:hover {
    color: var(--color-primary-dark);
    background: none;
    border-left-color: transparent;
    padding-left: 20px;
  }

  .products-dropdown__preview {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    align-content: start;
  }

  .products-preview__card {
    display: block;
    border-radius: 6px;
    background: #f7f7f7;
    border: 1px solid #e8e8e8;
    padding: 12px;
    text-decoration: none;
    transition: background 150ms ease-out, transform 150ms ease-out, border-color 150ms ease-out;
  }

  .products-preview__card:hover {
    background: #fff4ee;
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
  }

  .products-preview__card img {
    width: 100%;
    height: 72px;
    object-fit: contain;
    margin-bottom: 8px;
  }

  .products-preview__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: var(--fw-medium);
    color: var(--color-text);
    line-height: 1.4;
  }

  .products-preview__link {
    display: block;
    margin-top: 6px;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--color-primary);
  }

  /* ─── SERVICES & À PROPOS — liste simple ── */

  .site-header__dropdown--list {
    width: 240px;
    left: 0;
    padding: 8px 0;
  }

  .list-dropdown__item {
    display: block;
    padding: 12px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: var(--fw-regular);
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 150ms ease-out, background 150ms ease-out;
  }

  .list-dropdown__item:hover {
    color: var(--color-primary);
    background: var(--color-primary-bg);
  }
}

/* ─── DRAWER MOBILE ──────────────────────────────────────── */

.nav-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  background: var(--color-secondary);
  z-index: 200;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-drawer.is-open {
  transform: translateX(280px);
}

.nav-drawer__header {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.nav-drawer__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-drawer__logo img {
  height: 28px;
  width: auto;
}

.nav-drawer__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 8px 0;
}

/* Items principaux */
.nav-drawer__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--fw-regular);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 150ms ease-out;
}

.nav-drawer__item:active {
  background: rgba(255, 255, 255, 0.05);
}

.nav-drawer__item--accent {
  color: var(--color-primary);
}

.nav-drawer__pill {
  display: inline-flex;
  align-items: center;
  background: rgba(232, 114, 42, 0.15);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--fw-medium);
  font-family: var(--font-body);
}

/* Chevron accordéon */
.nav-drawer__chevron {
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform 250ms ease-out;
}

.nav-drawer__item--toggle[aria-expanded="true"] .nav-drawer__chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* Groupe accordéon */
.nav-drawer__group {
  display: flex;
  flex-direction: column;
}

/* Sous-items */
.nav-drawer__sub {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
}

.nav-drawer__sub[hidden] {
  display: none;
}

.nav-drawer__sub-item {
  display: block;
  padding: 10px 24px 10px 40px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: var(--fw-regular);
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: color 150ms ease-out, background 150ms ease-out;
}

.nav-drawer__sub-item:hover,
.nav-drawer__sub-item:active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-drawer__sub-item--all {
  color: var(--color-primary);
  font-weight: var(--fw-medium);
}

/* Footer drawer */
.nav-drawer__footer {
  padding: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  margin-top: auto;
}

.nav-drawer__cta {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: var(--fw-medium);
  margin-bottom: 12px;
  border-radius: var(--radius-md);
}

.nav-drawer__phone {
  text-align: center;
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.nav-drawer__phone a {
  color: inherit;
  text-decoration: underline;
}

/* ─── OVERLAY ────────────────────────────────────────────── */

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease-out;
}

.nav-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* ─── FOCUS VISIBLE ──────────────────────────────────────── */

.site-header__link:focus-visible,
.site-header__logo:focus-visible,
.site-header__search-btn:focus-visible,
.site-header__burger:focus-visible,
.site-header__cta:focus-visible,
.nav-drawer__item:focus-visible,
.nav-drawer__sub-item:focus-visible,
.nav-drawer__logo:focus-visible,
.products-dropdown__cat:focus-visible,
.list-dropdown__item:focus-visible,
.solutions-grid__cell:focus-visible,
.products-preview__card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
