/* ==================================
   EPIV - Layout Styles
   Header, Navigation, Footer
   ================================== */

/* ===== Header & Navigation ===== */
#header-placeholder {
  position: sticky;
  top: 0;
  z-index: 9999;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background-color: white;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  padding: var(--spacing-sm) 0;
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
  padding: 4px 0;
}

.site-header .site-logo img {
  transition: all 0.3s ease;
}

.header-top {
  background-color: var(--color-forest);
  color: white;
  padding: var(--spacing-xs) 0;
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
}

.header-top a {
  color: var(--color-mustard);
}

.header-top a:hover {
  color: white;
}

.header-main {
  padding: var(--spacing-sm) 0;
}

.header-main .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
}

.site-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.main-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.search-container {
  flex: 0 0 auto;
}

.site-logo img {
  height: 60px;
  width: auto;
  object-fit: contain;
}

.site-logo a:focus-visible {
  outline: 2px solid var(--color-emerald);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* ===== Main Navigation ===== */
.main-nav {
  flex-grow: 1;
}

.main-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--spacing-sm);
  align-items: center;
  justify-content: flex-end;
}

.main-nav li {
  position: relative;
  margin: 0;
}

.main-nav a {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--color-forest);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
}

.main-nav a:hover,
.main-nav a:focus {
  background-color: var(--color-celadon);
  color: var(--color-dark-forest);
  text-decoration: none;
}

.main-nav a.active {
  color: var(--color-emerald);
  background-color: var(--color-celadon);
}

/* Dropdown menu */
.main-nav .has-dropdown {
  position: relative;
}

.main-nav .has-dropdown > a::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: var(--spacing-xs);
  vertical-align: middle;
  border-top: 4px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background-color: white;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-base);
  list-style: none;
  padding: var(--spacing-xs);
  margin-top: var(--spacing-xs);
  z-index: var(--z-dropdown);
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li {
  margin: 0;
}

.dropdown-menu a {
  padding: var(--spacing-sm) var(--spacing-md);
  display: block;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.dropdown-menu a:hover {
  background-color: var(--color-celadon);
  color: var(--color-forest);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: transparent;
  border: 2px solid var(--color-forest);
  padding: var(--spacing-xs);
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-forest);
  font-size: var(--font-size-lg);
}

.menu-toggle:hover {
  background-color: var(--color-celadon);
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--color-emerald);
  outline-offset: 2px;
}

/* ============================================
   FOOTER - Refined editorial style
   ============================================ */
.site-footer.epiv-footer {
  position: relative;
  background: linear-gradient(180deg, #054444 0%, #032d2d 100%);
  color: var(--color-text-on-dark);
  padding: var(--spacing-3xl) 0 var(--spacing-md);
  margin-top: 0;
  overflow: hidden;
  border-top: 3px solid var(--color-emerald);
}

.epiv-footer .footer-glow {
  position: absolute;
  top: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(26, 194, 151, 0.12) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}

.epiv-footer .container {
  position: relative;
  z-index: 2;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 1.2fr 1.2fr;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
  padding-bottom: var(--spacing-xl);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 1100px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl) var(--spacing-lg);
  }
  .footer-map-section { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---- Brand block ---- */
.footer-logo-link {
  display: inline-block;
  margin-bottom: var(--spacing-md);
  background: white;
  padding: 14px 18px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.footer-logo-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 194, 151, 0.25);
}
.footer-logo-img {
  display: block;
  height: 44px;
  width: auto;
  max-width: 100%;
}
.footer-tagline {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-emerald-light);
  letter-spacing: 0.3px;
  margin-bottom: var(--spacing-sm);
}
.footer-desc {
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(217, 241, 233, 0.75);
  max-width: 320px;
}

/* ---- Section headers ---- */
.footer-section h4 {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-emerald-light);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid rgba(26, 194, 151, 0.2);
  display: inline-block;
}

/* ---- Lists ---- */
.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-section ul li {
  margin-bottom: 10px;
}
.footer-section ul li a {
  color: rgba(217, 241, 233, 0.82);
  font-size: 0.92rem;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding-left: 0;
}
.footer-section ul li a::before {
  content: '';
  width: 0;
  height: 1px;
  background: var(--color-emerald);
  transition: width 0.25s ease;
  display: inline-block;
}
.footer-section ul li a:hover {
  color: white;
  padding-left: 4px;
}
.footer-section ul li a:hover::before {
  width: 12px;
}

/* ---- Contact list ---- */
.footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--spacing-sm);
  font-size: 0.9rem;
  color: rgba(217, 241, 233, 0.85);
  line-height: 1.55;
}
.footer-contact li a {
  color: rgba(217, 241, 233, 0.85);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-contact li a:hover { color: white; }
.footer-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(26, 194, 151, 0.12);
  border: 1px solid rgba(26, 194, 151, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-emerald-light);
  flex-shrink: 0;
}
.footer-icon svg {
  width: 14px;
  height: 14px;
}

/* ---- Social ---- */
.footer-social {
  display: flex;
  gap: 8px;
  margin-top: var(--spacing-md);
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background-color: rgba(26, 194, 151, 0.12);
  border: 1px solid rgba(26, 194, 151, 0.25);
  border-radius: 10px;
  color: var(--color-emerald-light);
  transition: all 0.25s ease;
}
.footer-social a:hover {
  background-color: var(--color-emerald);
  border-color: var(--color-emerald);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26, 194, 151, 0.35);
}

/* Backwards-compat for old social-links class */
.social-links {
  display: flex;
  gap: 8px;
  margin-top: var(--spacing-md);
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background-color: rgba(26, 194, 151, 0.12);
  border: 1px solid rgba(26, 194, 151, 0.25);
  border-radius: 10px;
  color: var(--color-emerald-light);
  transition: all 0.25s ease;
}
.social-links a:hover {
  background-color: var(--color-emerald);
  border-color: var(--color-emerald);
  color: white;
  transform: translateY(-2px);
}

/* ---- Map ---- */
.footer-map-wrapper {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(26, 194, 151, 0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.footer-map {
  width: 100%;
  height: 200px;
  border: 0;
  display: block;
  filter: saturate(0.85) contrast(0.95);
}

/* ---- Bottom bar ---- */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-md);
  font-size: 0.82rem;
  color: rgba(217, 241, 233, 0.55);
}
.footer-bottom .footer-copy { margin: 0; }
.footer-bottom .footer-legal {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.footer-bottom a {
  color: rgba(217, 241, 233, 0.7);
  text-decoration: none;
  margin: 0;
  transition: color 0.2s;
}
.footer-bottom a:hover { color: var(--color-emerald-light); }
.footer-bottom .sep {
  color: rgba(217, 241, 233, 0.3);
  margin: 0 4px;
}

@media (max-width: 600px) {
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* Backwards compat for legacy footer */
.site-footer:not(.epiv-footer) {
  background-color: var(--color-forest);
  color: var(--color-text-on-dark);
  padding: var(--spacing-2xl) 0 var(--spacing-md);
  margin-top: 0;
}
.site-footer:not(.epiv-footer) .footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}
.site-footer:not(.epiv-footer) .footer-section h3 {
  color: var(--color-mustard);
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-md);
}
.site-footer:not(.epiv-footer) .footer-section p,
.site-footer:not(.epiv-footer) .footer-section a {
  color: var(--color-celadon);
  font-size: var(--font-size-sm);
}
.site-footer:not(.epiv-footer) .footer-section a:hover {
  color: white;
}
.site-footer:not(.epiv-footer) .footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-footer:not(.epiv-footer) .footer-section ul li {
  margin-bottom: var(--spacing-sm);
}

/* Simplified footer for inner pages */
.site-footer.footer-simple {
  padding: var(--spacing-lg) 0;
  margin-top: var(--spacing-2xl);
}

.site-footer.footer-simple .footer-content {
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  text-align: center;
  margin-bottom: var(--spacing-md);
}

/* ===== Main Content Area ===== */
main {
  min-height: 50vh;
}

.page-header {
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-dark-forest) 100%);
  color: white;
  padding: var(--spacing-2xl) 0 var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
}

.page-header h1 {
  color: white;
  margin-bottom: var(--spacing-sm);
}

.page-header p {
  font-size: var(--font-size-lg);
  color: var(--color-celadon);
  max-width: 800px;
}

/* Breadcrumb (optionnel) */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-md);
  color: var(--color-celadon);
}

.breadcrumb a {
  color: var(--color-mustard);
}

.breadcrumb-separator {
  color: var(--color-celadon);
}

/* Section */
section {
  padding: var(--spacing-2xl) 0;
}

section:nth-child(even) {
  background-color: var(--bg-secondary);
}

/* ===== Responsive Layout ===== */
/* ===== TABLET (1024px) ===== */
@media (max-width: 1024px) {
  .header-main .container {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .main-nav ul {
    gap: 0;
  }

  .main-nav ul li:not(.nav-separator) a {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .nav-separator {
    padding: 0 4px;
    font-size: 0.9rem;
  }

  .search-container {
    display: none;
  }

  .site-logo img {
    height: 55px;
  }
}

/* ===== TABLET SMALL (900px) - Show hamburger ===== */
@media (max-width: 900px) {
  /* Show hamburger menu */
  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-forest);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }

  .menu-toggle:hover,
  .menu-toggle:focus {
    background: var(--color-emerald);
  }

  /* Header layout */
  .header-main .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 8px 16px;
    gap: 0;
  }

  /* Logo centered */
  .site-logo {
    order: 2;
    flex: 1;
    display: flex;
    justify-content: center;
  }

  .site-logo img {
    height: 45px;
  }

  /* Hamburger on left */
  .menu-toggle {
    order: 1;
  }

  /* Spacer on right for balance */
  .search-container {
    order: 3;
    width: 44px;
    display: block;
    visibility: hidden;
  }

  /* Hide full nav by default */
  .main-nav {
    order: 4;
    width: 100%;
    display: none;
    background: white;
    border-top: 1px solid var(--color-celadon);
    margin-top: 8px;
    padding: 8px 0;
  }

  .main-nav.active {
    display: block;
    animation: slideDown 0.25s ease-out;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .main-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0;
  }

  .main-nav li {
    border-bottom: 1px solid rgba(5, 68, 68, 0.08);
  }

  .main-nav li:last-child {
    border-bottom: none;
  }

  .main-nav ul li:not(.nav-separator) a {
    display: block;
    padding: 12px 20px;
    font-size: 1rem;
    text-align: left;
  }

  .main-nav ul li:not(.nav-separator) a:hover {
    background: var(--color-celadon);
  }

  /* Hide separators */
  .nav-separator {
    display: none !important;
  }

  /* Dropdown */
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    margin: 0;
    padding: 0 0 0 20px;
    background: rgba(217, 241, 233, 0.5);
    border-radius: 0;
    display: none;
    border: none;
  }

  .dropdown.active .dropdown-menu {
    display: block;
  }

  .dropdown-menu a {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}

/* ===== MOBILE (600px) ===== */
@media (max-width: 600px) {
  .header-main .container {
    padding: 6px 12px;
  }

  .site-logo img {
    height: 40px;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .search-container {
    width: 40px;
  }

  .main-nav ul li:not(.nav-separator) a {
    padding: 10px 16px;
    font-size: 0.95rem;
  }
}

  /* Footer adjustments */
  .footer-content {
    grid-template-columns: 1fr;
  }

  .page-header {
    padding: var(--spacing-xl) 0 var(--spacing-md);
  }
}

/* ==================================
   Hero Slideshow Styles (Homepage)
   ================================== */

/* Hero — hauteur stricte et bornée pour éviter tout débordement
   sur grands écrans (2K, 4K). Hauteur fixe forcée par !important
   pour qu'aucune autre règle ne puisse étendre la section. */
.hero-section {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 640px !important;
  min-height: 640px !important;
  max-height: 640px !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  contain: layout size style !important;
  isolation: isolate !important;
  z-index: 1;
}

.hero-slideshow {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  z-index: 1 !important;
}

.hero-slide {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  z-index: 1;
}

/* Container du contenu dans le hero — flow naturel, simplement positionné
   relative pour passer au-dessus du slideshow */
.hero-section > .container {
  position: relative !important;
  z-index: 3 !important;
  width: 100% !important;
  max-width: 1100px !important;
  margin: 0 auto !important;
  padding: 0 var(--spacing-md) !important;
}

/* Bornes responsives sur la hauteur (pas de height fixe pour laisser
   le contenu respirer, juste min/max pour éviter explosion) */
@media (max-width: 768px) {
  .hero-section {
    min-height: 480px !important;
    max-height: 700px !important;
    padding: 70px 0 40px !important;
  }
  /* Cards icônes très compactes sur tablette */
  .hero-buttons-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    max-width: 100% !important;
    padding: 0 12px !important;
    margin-top: 24px !important;
  }
  .header-illustration-card,
  .header-illustration-card.header-illustration-card {
    padding: 10px 6px !important;
    border-radius: 10px !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .header-illustration-card .illustration-content {
    padding: 4px !important;
    height: auto !important;
  }
  .header-illustration-card .illustration-icon {
    width: 36px !important;
    height: 36px !important;
    padding: 4px !important;
    margin: 0 auto 6px !important;
  }
  .header-illustration-card .illustration-title {
    font-size: 0.7rem !important;
    letter-spacing: 0.3px !important;
    margin: 0 !important;
  }
}

@media (max-width: 480px) {
  .hero-section {
    min-height: 440px !important;
    max-height: 640px !important;
    padding: 60px 0 32px !important;
  }
  .hero-buttons-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    margin-top: 20px !important;
    padding: 0 10px !important;
  }
  .header-illustration-card,
  .header-illustration-card.header-illustration-card {
    padding: 8px 4px !important;
    border-radius: 8px !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .header-illustration-card .illustration-content {
    padding: 2px !important;
  }
  .header-illustration-card .illustration-icon {
    width: 30px !important;
    height: 30px !important;
    padding: 3px !important;
    margin: 0 auto 4px !important;
  }
  .header-illustration-card .illustration-title {
    font-size: 0.6rem !important;
    letter-spacing: 0.2px !important;
  }
  /* Titre plus petit sur petit écran */
  .hero-title {
    font-size: 1.5rem !important;
    margin-bottom: 8px !important;
  }
  .hero-subtitle {
    font-size: 0.82rem !important;
  }
}

.hero-slide.active {
  opacity: 1;
}

.hero-slideshow-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(5, 68, 68, 0.75) 0%, rgba(2, 63, 63, 0.85) 100%);
  z-index: 2;
  pointer-events: none;
}

.hero-slide-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: transparent;
  border: none;
  color: white;
  font-size: 4rem;
  width: 80px;
  height: 80px;
  cursor: pointer;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 300;
}

.hero-slide-btn:hover {
  transform: translateY(-50%) scale(1.2);
  text-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

.hero-slide-btn.prev {
  left: 30px;
}

.hero-slide-btn.next {
  right: 30px;
}

@media (max-width: 768px) {
  .hero-slide-btn {
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
  }

  .hero-slide-btn.prev {
    left: 10px;
  }

  .hero-slide-btn.next {
    right: 10px;
  }
}
