/*
Theme Name: ASGV Parc 1965
Theme URI: https://www.asl-grandvillage.fr/
Author: Comité Syndical ASGV
Description: Thème léger et accessible pour l'Association Syndicale Libre de Grand Village. Palette parc arboré & chemins roses, mode sombre, animation aquarelle, héro saisonnier automatique et Flash Infos prioritaire sur mobile.
Version: 1.1.0
Text Domain: asgv-parc
*/

:root {
  --bg-main: #FAF9F5;
  --bg-card: #F0EDE4;
  --color-primary: #2D5A3C;
  --color-primary-hover: #21442D;
  --color-secondary: #6B8E76;
  --color-accent: #C86D51;
  --text-main: #262926;
  --text-muted: #525852;
  --border-color: #DCD7C9;
  --shadow: 0 4px 16px rgba(45, 90, 60, 0.06);
  --radius: 10px;
}

[data-theme="dark"] {
  --bg-main: #181C19;
  --bg-card: #222723;
  --color-primary: #4E8A63;
  --color-primary-hover: #62A378;
  --color-secondary: #7FA38A;
  --color-accent: #DF8265;
  --text-main: #EDEBE4;
  --text-muted: #B5B2A8;
  --border-color: #343C36;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.65;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
  overflow-x: hidden;
}

/* Canvas feuilles aquarelle en arrière-plan */
#watercolor-leaves {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.site-wrapper { position: relative; z-index: 1; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent); text-decoration: underline; }

/* Header & Logo 60s */
.site-header {
  background-color: var(--bg-main);
  border-bottom: 2px solid var(--border-color);
  padding: 1rem 0 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Préserve la lisibilité du logo années 60 sur fond sombre */
.brand img {
  max-height: 72px;
  width: auto;
  border-radius: 6px;
  background: #FAF9F5;
  padding: 4px;
}

.brand-text h1, .brand-text .site-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.brand-text p {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-icon:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* Navigation Principale (3 niveaux supportés) */
.main-nav {
  background-color: var(--color-primary);
  color: #FAF9F5;
}

.nav-toggle {
  display: none;
  width: 100%;
  background: none;
  border: none;
  color: #FAF9F5;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.menu-primary {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}

.menu-primary > li { position: relative; }

.menu-primary a {
  display: block;
  padding: 0.85rem 1.15rem;
  color: #FAF9F5;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.menu-primary > li > a:hover,
.menu-primary > li.current-menu-item > a,
.menu-primary > li.current-menu-ancestor > a {
  background-color: var(--color-primary-hover);
  box-shadow: inset 0 -3px 0 var(--color-accent);
}

/* Sous-menus */
.menu-primary .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  list-style: none;
  padding: 0.4rem 0;
  z-index: 50;
}

.menu-primary li:hover > .sub-menu,
.menu-primary li:focus-within > .sub-menu { display: block; }

.menu-primary .sub-menu a {
  color: var(--text-main);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.menu-primary .sub-menu a:hover {
  background-color: var(--bg-main);
  color: var(--color-accent);
}

/* Niveau 3 (ex: Énergies nouvelles -> PAC / Panneaux solaires) */
.menu-primary .sub-menu .sub-menu {
  top: 0;
  left: 100%;
  border-radius: var(--radius);
}

/* Hero Banner */
.hero-section {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
}

.hero-inner {
  position: relative;
  max-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-inner img, .hero-inner svg {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.season-badge {
  position: absolute;
  bottom: 12px;
  right: 16px;
  background: rgba(38, 41, 38, 0.72);
  color: #FAF9F5;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  backdrop-filter: blur(4px);
}

/* Animations SVG Saisons */
@keyframes sway {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}
@keyframes leafFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.9; }
  100% { transform: translateY(45px) rotate(90deg); opacity: 0; }
}
.tree-crown { transform-origin: bottom center; animation: sway 6s ease-in-out infinite; }
.falling-leaf { animation: leafFall 4s ease-in infinite; }

/* Grille principale : Contenu + Sidebar */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  padding: 2rem 0 3.5rem;
  align-items: start;
}

.content-area {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.content-area h1, .content-area h2 {
  color: var(--color-primary);
  margin-top: 0;
  border-bottom: 2px solid var(--bg-card);
  padding-bottom: 0.5rem;
}

.content-area h3 { color: var(--color-accent); }

/* Sidebar & Widgets (Flash Infos, Boîte à outils, Newsletter) */
.sidebar-area,
.sidebar-flash-wrapper,
.sidebar-main-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

/* Mise en avant visuelle du Flash Infos (bordure Chemin Rose) */
.widget-flash {
  border-left: 4px solid var(--color-accent);
}

.widget-title {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
}
.widget li:last-child { border-bottom: none; }
.widget li::before {
  content: "• ";
  color: var(--color-accent);
  font-weight: bold;
}

/* Formulaires (Recherche, Newsletter, Contact) */
input[type="text"], input[type="email"], input[type="search"], textarea, select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.92rem;
  margin-bottom: 0.65rem;
}

button[type="submit"], .wp-block-button__link {
  background: var(--color-primary);
  color: #FAF9F5 !important;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
}
button[type="submit"]:hover { background: var(--color-accent); }

/* Articles (GV Info / Tous les articles) */
.post-card {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Footer */
.site-footer {
  background: var(--color-primary);
  color: #FAF9F5;
  padding: 2rem 0;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-menu {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}

.footer-menu a { color: #FAF9F5; }
.footer-menu a:hover { color: #F0EDE4; text-decoration: underline; }

/* Responsive Mobile */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  /* Place le Flash Infos tout en haut, avant le texte de Présentation */
  .sidebar-area {
    display: contents;
  }
  .sidebar-flash-wrapper {
    order: 1;
  }
  .content-area {
    order: 2;
    padding: 1.35rem;
  }
  .sidebar-main-wrapper {
    order: 3;
  }

  .nav-toggle { display: block; }
  .menu-primary { display: none; flex-direction: column; }
  .menu-primary.is-open { display: flex; }
  .menu-primary .sub-menu, .menu-primary .sub-menu .sub-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1.25rem;
    background: rgba(0, 0, 0, 0.12);
  }
  .menu-primary .sub-menu a { color: #FAF9F5; }
}