/* ============================================================
   GDEAM-62 — Composants UI
   Portage fidèle de maquettes/styles.css.
   Dépend de tokens.css (doit être chargé avant).
   ============================================================ */

/* ---------- Reset & base ----------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ---------- Accessibilité ---------------------------------- */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary-dark);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { top: 0; }

/* ---------- Typographie ------------------------------------ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.15;
  margin: 0 0 var(--space-sm);
}
h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 2.8vw, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }
p  { margin: 0 0 var(--space-sm); }

.lead {
  font-size: 1.15rem;
  color: var(--color-text-soft);
  max-width: 60ch;
}

.kicker {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-orange);
  margin-bottom: var(--space-sm);
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-lg);
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--color-accent-yellow);
  border-radius: 2px;
  margin: var(--space-sm) auto 0;
}

/* ---------- Layout ---------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  padding: var(--space-2xl) 0;
}
section.tight { padding: var(--space-xl) 0; }
.section-alt { background: var(--color-bg-alt); }

/* ---------- Header ---------------------------------------- */

.site-header {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  height: var(--header-height);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-primary-dark);
}
.logo:hover { text-decoration: none; }

.logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
/* Remplace le logo-mark par l'image quand le logo officiel est uploadé */
.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.1;
}
.logo-text small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---------- Navigation principale -------------------------- */

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: nowrap;
}

.main-nav a {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(0.85rem, 0.45vw + 0.78rem, 0.95rem);
  color: var(--color-text);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.2;
}
.main-nav a:hover {
  background: var(--color-bg-soft);
  text-decoration: none;
}
.main-nav a.current-menu-item,
.main-nav a.active {
  color: var(--color-primary-dark);
  background: var(--color-bg-soft);
  font-weight: 600;
}

/* Resserrement progressif sur écrans intermédiaires */
@media (max-width: 1100px) {
  .main-nav ul { gap: 0; }
  .main-nav a  { padding: 0.4rem 0.5rem; }
}
@media (max-width: 940px) {
  .main-nav a  { padding: 0.35rem 0.4rem; }
  .header-inner { gap: var(--space-sm); }
}

/* ---------- Menu burger (mobile) --------------------------- */

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  color: var(--color-primary-dark);
}
.nav-toggle svg { display: block; }

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-sm) var(--space-md);
}
.mobile-nav a {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--color-text);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  display: block;
}
.mobile-nav a:hover { background: var(--color-bg-soft); text-decoration: none; }
.mobile-nav.is-open { display: flex; }

@media (max-width: 800px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .header-inner .btn-header { display: none; }
}

/* ---------- Boutons ---------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--color-accent-orange);
  color: white;
  border-color: var(--color-accent-orange);
}
.btn-primary:hover { background: #d65a3c; border-color: #d65a3c; }

.btn-secondary {
  background: var(--color-primary-dark);
  color: white;
  border-color: var(--color-primary-dark);
}
.btn-secondary:hover { background: var(--color-primary); border-color: var(--color-primary); }

.btn-outline {
  background: transparent;
  color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}
.btn-outline:hover { background: var(--color-primary-dark); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--color-primary-dark);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-bg-soft); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* ---------- Hero (page d'accueil) -------------------------- */

.hero {
  position: relative;
  padding: var(--space-2xl) 0;
  background: linear-gradient(135deg, var(--color-bg-soft) 0%, var(--color-bg) 100%);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--color-accent-yellow) 0%, transparent 70%);
  opacity: 0.25;
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -150px; left: -150px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--color-primary-light) 0%, transparent 70%);
  opacity: 0.15;
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }
.hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

/* ---------- Hero compact (pages internes) ------------------ */

.page-hero {
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
  color: var(--color-on-dark);
  padding: var(--space-xl) 0 var(--space-lg);
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute;
  bottom: -100px; right: -100px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--color-accent-yellow) 0%, transparent 70%);
  opacity: 0.2;
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero h1  { color: white; }
.page-hero .lead { color: rgba(255, 255, 255, 0.9); }

/* Fil d'Ariane */
.breadcrumb {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}
.breadcrumb a { color: rgba(255, 255, 255, 0.85); }
.breadcrumb li:not(:last-child)::after {
  content: '›';
  margin-left: var(--space-xs);
  color: rgba(255, 255, 255, 0.5);
}

/* ---------- Volets (3 axes d'engagement) ------------------- */

.volets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
}

.volet-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  border: 2px solid transparent;
  transition: all 0.3s;
  overflow: hidden;
}
.volet-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: var(--color-primary);
}
.volet-card--orange::before { background: var(--color-accent-orange); }
.volet-card--green::before  { background: var(--color-primary); }
.volet-card--yellow::before { background: var(--color-accent-yellow); }
.volet-card--blue::before   { background: var(--color-accent-blue); }

.volet-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.volet-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: var(--space-sm);
  background: var(--color-bg-soft);
}
.volet-card--orange .volet-icon { background: rgba(231, 111, 81, 0.15); }
.volet-card--green  .volet-icon { background: rgba(82, 183, 136, 0.18); }
.volet-card--yellow .volet-icon { background: rgba(244, 162, 97, 0.18); }
.volet-card--blue   .volet-icon { background: rgba(74, 111, 165, 0.15); }

.volet-card h3 { margin-bottom: var(--space-xs); }
.volet-card p  { color: var(--color-text-soft); margin-bottom: var(--space-sm); }
.volet-link {
  margin-top: auto;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-primary-dark);
}

/* ---------- Bloc 2 colonnes (agenda + réseaux) ------------- */

.two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

.block-card {
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: var(--space-lg);
}
.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.block-header h2 { margin: 0; font-size: 1.4rem; }
.link-arrow {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-primary);
}
.link-arrow:hover { text-decoration: underline; }

/* ---------- Agenda ----------------------------------------- */

.agenda-list {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.agenda-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm);
  border-radius: var(--radius);
  transition: background 0.2s;
}
.agenda-item:hover { background: var(--color-bg-soft); }

.agenda-date {
  flex-shrink: 0;
  width: 64px;
  text-align: center;
  background: var(--color-primary-dark);
  color: white;
  border-radius: var(--radius);
  padding: var(--space-xs);
  font-family: var(--font-heading);
  line-height: 1;
}
.agenda-day   { display: block; font-size: 1.5rem; font-weight: 700; }
.agenda-month { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; margin-top: 2px; }

.agenda-content h4 { margin: 0 0 4px; font-size: 1rem; color: var(--color-primary-dark); }
.agenda-meta { font-size: 0.85rem; color: var(--color-muted); margin: 0; }

/* ---------- Contenu prose (pages internes) ----------------- */

.content-prose { max-width: 720px; }
.content-prose h2 { margin-top: var(--space-lg); }
.content-prose ul,
.content-prose ol { padding-left: 1.5rem; }
.content-prose li { margin-bottom: var(--space-xs); }
.content-prose blockquote {
  border-left: 4px solid var(--color-accent-yellow);
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-soft);
  font-style: italic;
  color: var(--color-text-soft);
}

.info-box {
  background: var(--color-bg-soft);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  border-left: 4px solid var(--color-accent-orange);
}
.info-box h4 { margin-top: 0; color: var(--color-accent-orange); }

/* ---------- Cards blog / actualités ------------------------ */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
}

.post-card {
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.post-cover {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  position: relative;
  overflow: hidden;
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-cover.var-2 { background: linear-gradient(135deg, var(--color-accent-yellow), var(--color-accent-orange)); }
.post-cover.var-3 { background: linear-gradient(135deg, var(--color-accent-blue), var(--color-primary-dark)); }

.post-content { padding: var(--space-md); display: flex; flex-direction: column; flex: 1; }
.post-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: var(--space-xs);
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.post-card h3 { font-size: 1.2rem; margin-bottom: var(--space-xs); }
.post-card h3 a { color: var(--color-primary-dark); }
.post-card h3 a:hover { text-decoration: underline; }
.post-excerpt { color: var(--color-text-soft); margin-bottom: var(--space-sm); flex: 1; }
.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* ---------- Thème en avant (featured) ---------------------- */

.theme-feature {
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  align-items: center;
  position: relative;
  overflow: hidden;
}
@media (max-width: 700px) { .theme-feature { grid-template-columns: 1fr; } }
.theme-feature::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--color-accent-yellow) 0%, transparent 70%);
  opacity: 0.2;
}
.theme-feature h2    { color: white; margin: 0 0 var(--space-sm); }
.theme-feature p     { color: rgba(255,255,255,0.9); }
.theme-feature .label {
  display: inline-block;
  background: var(--color-accent-yellow);
  color: var(--color-primary-dark);
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}
.theme-feature .visual { font-size: 6rem; text-align: center; position: relative; z-index: 1; }

/* ---------- Bloc abonnement / adhésion --------------------- */

.subscribe-card {
  background: var(--color-bg-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  border: 2px dashed var(--color-border-strong);
}
.subscribe-card h3 { margin-bottom: var(--space-xs); }
.subscribe-card .subscribe-options {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

/* ---------- Tags thématiques ------------------------------- */

.tag {
  display: inline-block;
  background: var(--color-bg-soft);
  color: var(--color-text-soft);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 500;
  text-decoration: none;
}
.tag:hover { text-decoration: none; opacity: 0.85; }

.tag-flore   { background: rgba(82, 183, 136, 0.18); color: var(--color-primary-dark); }
.tag-faune   { background: rgba(74, 111, 165, 0.18); color: var(--color-accent-blue); }
.tag-paysage { background: rgba(244, 162, 97, 0.20); color: #b8631a; }
.tag-eau     { background: rgba(74, 111, 165, 0.18); color: var(--color-accent-blue); }

/* ---------- Footer ----------------------------------------- */

.site-footer {
  background: var(--color-bg-dark);
  color: var(--color-on-dark);
  padding: var(--space-xl) 0 var(--space-md);
  margin-top: var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-grid h4 {
  color: white;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a  { color: rgba(244, 239, 215, 0.75); font-size: 0.9rem; }
.footer-grid a:hover { color: white; text-decoration: none; }

.footer-identity p {
  color: rgba(244, 239, 215, 0.75);
  font-size: 0.9rem;
  margin-top: var(--space-sm);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-md);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: rgba(244, 239, 215, 0.6);
}
.footer-bottom a { color: rgba(244, 239, 215, 0.75); }
.footer-bottom a:hover { color: white; }

/* ---------- Pagination ------------------------------------- */

.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}
.pagination a,
.pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  text-decoration: none;
}
.pagination a:hover { background: var(--color-bg-soft); text-decoration: none; }
.pagination .current {
  background: var(--color-primary-dark);
  color: white;
  border-color: var(--color-primary-dark);
}

/* ---------- Responsive global ------------------------------ */

@media (max-width: 800px) {
  section { padding: var(--space-xl) 0; }
  .hero   { padding: var(--space-xl) 0; }
}
