/* --- Début : Réinitialisation et Box Sizing Global --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Variables CSS --- */
:root {
  --background-main: #F4F1E9;
  --background-content: #FFFFFF;
  --text-color: #333333;
  --header-footer-bg: #4A6B4C; /* Vert Pêche */
  --nav-bg: #6E8B6E; /* Vert plus clair */
  --nav-text: #FFFFFF;
  --heading-color: #A0522D; /* Marron Sienne (pour H2/H3 dans le contenu) */
  --accent-color: #FF8C00; /* Orange foncé (pour accents, liens survolés) */
  --border-color: #D7CCC8;
  --conclusion-bg: #E8F5E9;
  --conclusion-border: #4A6B4C;
  --recipe-bg: #FAF8F0;
  --link-color: #5D8B50; /* Vert pour liens */
  --shadow-color: rgba(0, 0, 0, 0.1);
}

/* --- Styles Généraux du Corps --- */
body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background-main);
  color: var(--text-color);
  line-height: 1.7;
  overflow-x: hidden;
}

/* --- Header --- */
header {
  background-color: var(--header-footer-bg);
  padding: 15px 20px;
  box-shadow: 0 2px 5px var(--shadow-color);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto; /* Centrer le conteneur */
  display: flex;
  align-items: center;
  justify-content: space-between; /* Espace entre logo, titre/img, pub */
  flex-wrap: wrap;
  gap: 15px; /* Espace par défaut entre les éléments du header */
}

.logo {
  max-height: 70px;
  display: block;
  flex-shrink: 0; /* Empêche le logo de trop rétrécir */
}

/* --- Header Title and Image Layout (Title Above Image) --- */
.header-title-container {
    display: flex;
    flex-direction: column; /* Empile Titre PUIS Image */
    align-items: center;    /* Centre horizontalement dans sa colonne */
    gap: 8px;               /* Espace vertical entre titre et image */
    flex-grow: 1;           /* Permet à ce bloc de prendre de la place */
    justify-content: center;/* Centre verticalement si hauteur dispo */
    margin: 0 10px;         /* Marge horizontale pour éviter de coller logo/pub */
    width: auto;            /* Taille basée sur contenu */
    max-width: 400px;       /* Limite la largeur max */
    text-align: center;     /* Centre le texte H1 */
}

.header-title {
    width: 100%;
    margin-bottom: 0; /* Pas de marge sous le bloc titre */
}

/* Add this to your CSS file and remove inline styles from H1 */
header .header-title h1 {
    color: #FFFFFF;
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    border: none;
    /* Adjust font-size if needed */
    font-size: 2.2em; /* Or keep the default H1 size */
     line-height: 1.2;
}
/* Adjust text-align if the container doesn't center it */
 header .header-title {
     text-align: center;
     flex-grow: 1; /* Help it take space */
 }

.ads-header {
  flex-shrink: 0;
  width: 336px;
  height: 280px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ads-header ins.adsbygoogle {
    display: inline-block;
    max-width: 100%;
    height: auto;
}


/* --- Navigation Rapide (Sticky) --- */
.nav-quick-links {
  background-color: var(--nav-bg);
  text-align: center;
  padding: 12px 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-quick-links a {
  color: var(--nav-text);
  text-decoration: none;
  margin: 0 12px;
  font-weight: bold;
  transition: color 0.3s ease;
}

.nav-quick-links a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

/* --- Conteneur Principal (Flexbox) --- */
.main-container {
  display: flex;
  max-width: 1280px;
  margin: 30px auto;
  padding: 0 20px;
  gap: 30px;
  align-items: flex-start;
}

/* --- Sidebar --- */
.sidebar {
  width: 350px;
  flex-shrink: 0;
  position: sticky;
  top: 70px; /* Ajuster si hauteur nav change */
  overflow-x: hidden;
}

.ads-sidebar, .sidebar-widget {
  background-color: var(--background-content);
  padding: 15px; /* Augmenté un peu le padding */
  border-radius: 8px;
  box-shadow: 0 2px 5px var(--shadow-color);
  margin-bottom: 20px; /* Augmenté un peu l'espacement */
  border: 1px solid var(--border-color);
}

.ads-sidebar ins.adsbygoogle {
  display: block;
  /* Width/height sont souvent définis par AdSense ou inline */
  /* width: 300px; height: 600px; */ /* Example */
  margin: 0 auto;
  max-width: 100%;
}

.sidebar-widget h3 {
    margin-top: 0;
    color: var(--heading-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    font-size: 1.2em;
    margin-bottom: 10px; /* Ajout espace sous titre widget */
}
.sidebar-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-widget ul li {
    margin-bottom: 8px;
}
.sidebar-widget ul li a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}
.sidebar-widget ul li a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* --- Contenu Principal --- */
.content {
  flex: 1; /* Prend l'espace restant */
  background-color: var(--background-content);
  padding: 35px;
  border-radius: 8px;
  box-shadow: 0 3px 8px var(--shadow-color);
  border: 1px solid var(--border-color);
  opacity: 0;
  animation: fadeInAnimation 0.8s ease-out forwards;
  animation-delay: 0.2s;
  min-width: 0; /* Important pour flexbox shrink */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Animation d'Apparition */
@keyframes fadeInAnimation {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Titres dans le Contenu (H2, H3) --- */
.content h2, .content h3 { /* Ciblage plus spécifique */
  color: var(--heading-color); /* Utilise la variable marron */
  border-bottom: 2px solid var(--nav-bg); /* Bordure verte */
  padding-bottom: 8px;
  margin-bottom: 25px;
}
/* Tailles spécifiques H2/H3 */
.content h2 { font-size: 1.7em; margin-top: 40px; }
.content h3 { font-size: 1.4em; margin-top: 30px; } /* Légèrement augmenté H3 */
.content h4 { font-size: 1.2em; color: var(--heading-color); margin-top: 25px; margin-bottom: 15px; } /* Ajout style H4 */

/* --- Paragraphes, Listes dans le Contenu --- */
.content p, .content ul, .content ol, .content dl {
  font-size: 1em;
  margin-bottom: 20px;
  color: var(--text-color); /* Assure couleur texte par défaut */
}
.content ul, .content ol {
  padding-left: 25px;
}
.content ul li, .content ol li {
  margin-bottom: 10px;
}
.content ul li::marker, .content ol li::marker {
   color: var(--heading-color); /* Change la couleur des puces/numéros */
}
.content dl dt {
  font-weight: bold;
  color: var(--heading-color);
  margin-top: 15px;
}
.content dl dd {
  margin-left: 20px;
  margin-bottom: 10px;
}
.content strong, .content b {
  color: #000000; /* Noir pour meilleure lisibilité du gras */
  font-weight: 700;
}
.content a {
    color: var(--link-color);
    text-decoration: underline;
    transition: color 0.2s ease;
}
.content a:hover {
    color: var(--accent-color);
}


/* --- Styles des Sections et Images Internes --- */
.content-section {
    background-color: #fdfdfd; /* Très léger fond pour distinguer sections */
    padding: 25px;
    margin-bottom: 30px;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
}

.content-section-image,
.content img { /* Cible toutes images dans .content */
  display: block;
  max-width: 100%;
  height: auto;
  margin: 20px auto 25px auto; /* Centrage et espacement */
  border-radius: 5px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

/* --- Blocs Publicitaires DANS le Contenu --- */
.ads-content {
    text-align: center;
    margin: 35px auto; /* Augmenté marge verticale */
    padding: 10px 0;
    max-width: 100%;
    width: 100%;
}
/* Styles spécifiques pour l'ins AdSense si nécessaire */
.ads-content ins.adsbygoogle {
    display: inline-block;
    /* width: 728px; height: 90px; */ /* Taille par défaut (sera responsive) */
    max-width: 100%;
}

/* --- Section Conclusion (si utilisée) --- */
.conclusion {
  background-color: var(--conclusion-bg);
  padding: 25px;
  border-left: 5px solid var(--conclusion-border);
  font-style: italic;
  border-radius: 0 5px 5px 0;
  margin-top: 30px;
}

/* --- Footer --- */
footer {
  background-color: var(--header-footer-bg);
  color: #e0e0e0;
  padding: 30px 20px; /* Augmenté padding */
  text-align: center;
  font-size: 0.9em;
  margin-top: 40px;
}

.footer-container {
    max-width: 1200px; /* Limite largeur contenu footer */
    margin: 0 auto;
}

.footer-keywords {
    margin: 20px 0;
    color: #b0bec5; /* Gris plus clair pour mots clés */
    font-size: 0.8em;
    line-height: 1.4;
}
.footer-keywords strong {
    color: #cfd8dc; /* Gris encore plus clair pour le label */
}

.footer-nav-main {
    margin: 20px 0;
    line-height: 1.6;
}
.footer-nav-main a {
  color: var(--nav-text);
  margin: 0 8px; /* Réduit marge liens nav */
  text-decoration: none;
  transition: color 0.3s ease;
}
.footer-nav-main a:hover {
  color: var(--accent-color);
}

.footer-info-links {
    margin-top: 20px;
}
.footer-info-links h4 {
    color: var(--accent-color);
    margin-bottom: 10px;
    font-size: 1em; /* Taille normale */
    text-transform: uppercase;
    letter-spacing: 1px;
}
.footer-info-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-info-links ul li {
    margin-bottom: 6px;
}
.footer-info-links ul li a {
    color: var(--nav-text);
    text-decoration: none;
    transition: color 0.3s ease;
}
.footer-info-links ul li a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* --- Effets Interactifs --- */
.interactive-element {
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}
.interactive-element:hover {
  transform: translateY(-3px); /* Effet de surélévation réduit */
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15); /* Ombre plus douce */
}

/* --- Bouton "Retour en Haut" --- */
#backToTopBtn {
  display: none; /* Caché par défaut, montré par JS */
  opacity: 0;
  visibility: hidden;
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 101;
  border: none;
  outline: none;
  background-color: var(--nav-bg);
  color: var(--nav-text);
  cursor: pointer;
  padding: 10px 14px; /* Taille ajustée */
  border-radius: 50%;
  font-size: 16px; /* Taille icône ajustée */
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: opacity 0.4s ease, visibility 0.4s ease, background-color 0.3s ease;
}
#backToTopBtn.show {
  display: block; /* Montré par JS */
  opacity: 0.8;
  visibility: visible;
}
#backToTopBtn:hover {
  background-color: var(--accent-color); /* Changé hover color */
  opacity: 1;
}

/* --- Highlight JS (si utilisé) --- */
.highlight { animation: highlight-fade 1.5s ease-out; }
@keyframes highlight-fade {
  0% { background-color: rgba(255, 140, 0, 0.2); } /* Highlight orange */
  100% { background-color: transparent; }
}

/* ===================================================== */
/* --- MEDIA QUERIES POUR RESPONSIVE DESIGN --- */
/* ===================================================== */

/* --- Tablettes et Petits Laptops --- */
@media (max-width: 992px) {
  .main-container {
    flex-direction: column; /* Empile sidebar et contenu */
    padding: 0 15px;
  }
  .sidebar {
    width: 100%;
    margin-bottom: 30px;
    position: static; /* Sidebar n'est plus sticky */
    max-height: none;
    overflow-y: visible;
    padding: 0;
  }
  .ads-sidebar, .sidebar-widget {
      max-width: 600px; /* Limite largeur widgets sidebar */
      margin-left: auto;
      margin-right: auto;
  }
  .content {
    width: 100%;
  }
}

/* --- Petites Tablettes et Grands Smartphones --- */
@media (max-width: 768px) {
  body { font-size: 0.98em; } /* Léger ajustement taille police base */

  .header-container {
      justify-content: center; /* Centre les éléments restants quand la pub disparaît/réduit */
      gap: 10px; /* Réduit l'espace sur tablette */
  }
   /* Ajustement taille H1 tablette */
  .header-title h1 { font-size: 2em; }

   /* L'image header reste à 330px max, mais 100% width max */

  .content { padding: 25px; }
  .content h2 { font-size: 1.6em; }
  .content h3 { font-size: 1.3em; }

  .nav-quick-links a { margin: 0 8px; font-size: 0.9em; }

  /* Ajustement responsive Ads */
  .ads-header, .ads-sidebar, .ads-content { text-align: center; } /* Centre le contenu des blocs pub */

   .ads-header ins.adsbygoogle,
   .ads-sidebar ins.adsbygoogle,
   .ads-content ins.adsbygoogle {
       /* S'assurer qu'ils ne dépassent pas */
       max-width: 100%;
       width: auto; /* Laisser AdSense gérer si possible */
       height: auto;
       /* Tailles spécifiques AdSense pour tablette si besoin */
       /* e.g., width: 468px; height: 60px; pour .ads-content */
   }
   /* Exemple spécifique pour la pub contenu */
   .ads-content ins.adsbygoogle[data-ad-slot="7088878457"] { /* Cible par slot ID si besoin */
        max-width: 468px; /* Largeur commune tablette */
        /* height: 60px; */ /* Hauteur correspondante */
   }
}

/* --- Smartphones --- */
@media (max-width: 600px) {
  header { padding: 10px 15px; } /* Réduit padding header */

  .header-container {
      flex-direction: column; /* Empile TOUT dans le header */
      align-items: center;
      text-align: center;
      gap: 10px; /* <<<< ESPACE VERTICAL réduit entre logo, titre/img, pub */
  }
  .logo { margin-bottom: 0; } /* Enlève marge si le gap suffit */
  .header-title-container {
      margin: 0; /* Enlève marge horiz qd empilé */
      gap: 5px;  /* Réduit encore gap titre/img */
  }
   /* Ajustement taille H1 mobile */
  .header-title h1 { font-size: 1.8em; }
  /* L'image header est déjà gérée par max-width: 100% */

  .ads-header { margin-top: 5px; order: 3; /* Met la pub en dernier si désiré */ }

  .nav-quick-links { padding: 10px 5px; position: static; } /* Nav n'est plus sticky */
  .nav-quick-links a { display: inline-block; margin: 5px 5px; font-size: 0.85em; }

  .content { padding: 20px; }
  .content h2 { font-size: 1.5em; margin-top: 30px;}
  .content h3 { font-size: 1.2em; margin-top: 25px;}

  #backToTopBtn { bottom: 15px; right: 15px; padding: 10px 13px; font-size: 16px; }

  /* Ads mobile */
  .ads-sidebar ins.adsbygoogle, .ads-content ins.adsbygoogle {
      /* Tailles communes mobile AdSense */
      /* max-width: 300px; */
      /* height: 250px; */
      max-width: 100%;
  }
   .ads-header ins.adsbygoogle {
       max-width: 100%;
        /* max-width: 320px; height: 100px; */
   }
}

/* --- Très Petits Écrans (< 480px) --- */
@media (max-width: 480px) {
    body { font-size: 0.92em; line-height: 1.6; }
    .main-container { padding: 0 10px; margin-top: 20px; }
    .content { padding: 15px; }

     /* Ajustement taille H1 petit mobile */
    .header-title h1 { font-size: 1.6em; }
    .header-title-image { width: 280px; max-width: 100%; } /* Image un peu plus petite */

    .content h2 { font-size: 1.4em; margin-top: 25px; margin-bottom: 20px;}
    .content h3 { font-size: 1.1em; margin-top: 20px; margin-bottom: 15px;}
    .content p, .content ul, .content ol, .content dl { margin-bottom: 15px; }

    .nav-quick-links a { font-size: 0.8em; margin: 5px 3px; }

    .content-section { padding: 15px; }
    .content-section-image { margin: 15px auto 20px auto; }

  /* Gestion Finale Blocs Publicitaires */
  .ads-sidebar, .sidebar-widget, .ads-header, .ads-content {
      width: 100%; max-width: 100%; padding: 10px 0;
      margin-left: 0; margin-right: 0; text-align: center; margin-bottom: 15px;
  }
   .ads-header { margin-top: 5px; margin-bottom: 10px; }
   .ads-content { margin: 25px auto; }

   /* AdSense tags specific styles for small screens */
  .ads-header ins.adsbygoogle,
  .ads-sidebar ins.adsbygoogle,
  .ads-content ins.adsbygoogle {
      width: auto; max-width: 100%; height: auto;
      display: inline-block;
      /* Exemple de taille fixe si auto pose pb */
      /* width: 300px; height: 100px; */
  }

   #backToTopBtn { bottom: 10px; right: 10px; padding: 8px 11px; font-size: 14px; }

   /* Gestion du texte pour éviter débordement */
   .content, .content p, .content li, .content dd, .content dt {
       overflow-wrap: break-word;
       word-wrap: break-word;
       -webkit-hyphens: auto;
       -moz-hyphens: auto;
       hyphens: auto;
   }
   .content pre, .content code {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-x: auto; /* Scroll si vraiment trop long */
        max-width: 100%;
   }
   .content table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap; /* Empêche le retour à la ligne dans les cellules */
   }
}