/*
Theme Name:   Pilotable
Theme URI:    https://pilotable.fr
Description:  Thème enfant Astra pour Pilotable.fr — Média B2B des énergies pilotables
Author:       Agence SW
Author URI:   https://agencesw.com
Template:     astra
Version:      1.1.0
Text Domain:  pilotable
License:      GPL-2.0+
*/

/* ═══════════════════════════════════════════
   VARIABLES CSS — CHARTE PILOTABLE.FR
   ═══════════════════════════════════════════ */

:root {
  /* Couleurs principales */
  --sw-navy: #0B1D33;
  --sw-navy-light: #132D4A;
  --sw-teal: #0D9488;
  --sw-teal-light: #14B8A6;
  --sw-teal-dark: #0F766E;

  /* Couleurs piliers */
  --sw-blue: #1A6BB5;       /* ⚛️ Nucléaire */
  --sw-orange: #E67E22;     /* 🔋 Stockage */
  --sw-violet: #7C3AED;     /* ⚡ Flexibilité */
  --sw-red: #DC2626;        /* 🏛️ Stratégie */
  /* 💧 Hydrogène = --sw-teal */

  /* Texte & fond */
  --sw-text: #1E293B;
  --sw-muted: #64748B;
  --sw-bg: #F8FAFB;
  --sw-card: #FFFFFF;
  --sw-border: #E2E8F0;

  /* Typographie */
  --sw-font-display: 'Playfair Display', Georgia, serif;
  --sw-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --sw-font-article: 'Source Serif 4', Georgia, serif;
}

/* ═══════════════════════════════════════════
   OVERRIDES ASTRA — Corriger les conflits
   de layout entre Astra et le thème enfant
   ═══════════════════════════════════════════ */

/* Retirer les marges/paddings Astra sur les templates custom */
.home .entry-content,
.single .entry-content,
.page-template .entry-content {
  margin: 0;
  padding: 0;
}

/* Le container Astra ne doit pas contraindre nos layouts */
.home .ast-container,
.single-post .ast-container {
  max-width: 100%;
  padding: 0;
}

/* Retirer le sidebar Astra par defaut sur single */
.single-post .ast-primary-content,
.home .ast-primary-content {
  width: 100%;
  max-width: 100%;
}

/* Masquer le sidebar par defaut d'Astra */
.home #secondary,
.single-post #secondary {
  display: none;
}

/* Corriger l'espacement header Astra */
.ast-above-header-wrap + .site-content {
  margin-top: 0;
}

/* Logo Astra */
.site-branding .custom-logo {
  max-height: 90px;
  width: auto;
}

.site-branding .custom-logo-link {
  display: inline-flex;
  align-items: center;
}

/* Masquer le titre texte si logo present */
.site-branding .site-title,
.site-branding .site-description {
  clip: rect(0 0 0 0);
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Menu principal — forcer couleur uniforme (pas de :visited bleu) */
.main-header-menu .menu-item > a,
.main-header-menu .menu-item > a:visited {
  color: var(--sw-text) !important;
}

.main-header-menu .menu-item > a:hover,
.main-header-menu .menu-item > a:focus {
  color: var(--sw-teal) !important;
}

.main-header-menu .current-menu-item > a,
.main-header-menu .current-menu-item > a:visited {
  color: var(--sw-teal) !important;
}

/* ═══════════════════════════════════════════
   RESPONSIVE FIXES
   ═══════════════════════════════════════════ */

/* Mobile : images pleine largeur */
@media (max-width: 767px) {
  .sw-card--featured {
    flex-direction: column;
  }

  .sw-card--featured .sw-card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: auto;
  }

  .sw-single-article {
    padding: 16px 16px 32px;
  }

  .sw-single-article__title {
    font-size: 1.5rem;
  }

  .sw-single-article__content {
    flex-direction: column;
  }

  .sw-single-article__body {
    max-width: 100%;
  }

  /* Data bar en 2x2 sur mobile */
  .sw-data-bar__container {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .sw-data-bar__value {
    font-size: 1.6rem;
  }

  /* Sidebar sous le contenu sur mobile */
  .sw-homepage__sidebar {
    margin-top: 24px;
  }

  /* Related articles en colonne sur mobile */
  .sw-related__grid {
    grid-template-columns: 1fr;
  }

  /* Author box compacte */
  .sw-author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* Tablette */
@media (min-width: 768px) and (max-width: 1023px) {
  .sw-single-article__body {
    max-width: 100%;
  }

  .sw-single-article__content {
    flex-direction: column;
  }
}

/* Forcer le contenu a ne pas depasser */
.sw-single-article__body,
.sw-single-guide__body {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.sw-single-article__body img,
.sw-single-guide__body img {
  max-width: 100%;
  height: auto;
}

/* ═══════════════════════════════════════════
   DESKTOP — Largeur uniforme header/body/footer
   ═══════════════════════════════════════════ */

/* Largeur max du contenu : 1200px
   Avec padding lateral : donne ~1120px utile
   Le header Astra doit respecter la meme largeur */

@media (min-width: 1024px) {
  /* Container global Astra — forcer la meme largeur partout */
  .ast-container,
  .site-content .ast-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
  }

  /* Container interne du header Astra */
  .ast-primary-header-bar .ast-builder-grid-row,
  .main-header-bar .ast-builder-grid-row,
  .ast-hfb-header .site-header-primary-section-left,
  .ast-hfb-header .site-header-primary-section-right {
    max-width: 100%;
  }

  .ast-primary-header-bar > .site-header-primary-section-left.ast-builder-grid-row,
  .main-header-bar-wrap .main-header-bar .ast-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
  }

  /* Homepage inner */
  .sw-homepage__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
  }

  /* Article single */
  .sw-single-article {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 40px 64px;
  }
}

/* Habillage publicitaire — ecrans larges */
@media (min-width: 1400px) {
  body {
    background-color: #EDF0F4;
  }

  /* Tout le site dans une boite blanche centree */
  #page {
    max-width: 1320px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 30px rgba(11, 29, 51, 0.06);
  }

  /* Le header Astra doit rester DANS #page, donc pas de max-width separe */
  /* Son container interne reste a 1200px */
  .main-header-bar-wrap .main-header-bar .ast-container,
  .ast-primary-header-bar .ast-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
  }
}

/* ═══════════════════════════════════════════
   FOOTER PILOTABLE
   ═══════════════════════════════════════════ */

.sw-footer {
  background: var(--sw-navy);
  color: rgba(255, 255, 255, 0.8);
  padding: 48px 20px 0;
}

.sw-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.sw-footer__brand {
  max-width: 320px;
}

.sw-footer__logo {
  font-family: var(--sw-font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px;
}

.sw-footer__desc {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 16px;
}

.sw-footer__social {
  display: flex;
  gap: 12px;
}

.sw-footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.sw-footer__social a:hover {
  background: var(--sw-teal);
}

.sw-footer__heading {
  font-family: var(--sw-font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  margin: 0 0 16px;
}

.sw-footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sw-footer__list li {
  margin-bottom: 8px;
}

.sw-footer__list a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.sw-footer__list a:hover {
  color: var(--sw-teal-light);
}

.sw-footer__bottom {
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.sw-footer__bottom a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}

.sw-footer__bottom a:hover {
  color: var(--sw-teal-light);
}

@media (min-width: 768px) {
  .sw-footer__inner {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
  }

  .sw-footer__bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Le footer est DANS #page, pas besoin de max-width separe */
