/*
Theme Name: République Gabonaise
Theme URI: https://github.com/aninf/ministere-gabon
Author: ANINF
Author URI: http://www.aninf.ga/
Description: Thème WordPress moderne pour les Ministères de la République Gabonaise, basé sur Tailwind CSS.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ministere-gabon
*/

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body, #ffffff);
}

/* ===========================================
   Preloader
   =========================================== */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.preloader-logo {
  max-width: 120px;
  height: auto;
}

.preloader-texts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.preloader-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preloader-sitename {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.preloader-progress-wrap {
  width: 200px;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.preloader-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  transition: none;
}

.preloader-percent {
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.gabarais-green {
  color: var(--color-primary, #009639);
}

.bg-gabarais-green {
  background-color: var(--color-primary, #009639);
}

.bg-gabarais-yellow {
  background-color: var(--color-secondary, #FFD100);
}

.bg-gabarais-blue {
  background-color: var(--color-accent, #0072C6);
}

.text-gabarais-green {
  color: var(--color-primary, #009639);
}

.border-gabarais-green {
  border-color: var(--color-primary, #009639);
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1;
}

.hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.hero-carousel-track {
  position: relative;
}

.hero-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-carousel-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.hero-carousel-btn-prev {
  left: 1rem;
}

.hero-carousel-btn-next {
  right: 1rem;
}

.hero-carousel-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 9999px;
}

.hero-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.45);
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-dot.is-active {
  background: #fff;
  transform: scale(1.25);
}

.hero-carousel-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.hero-carousel-progress-bar {
  height: 100%;
  width: 0;
  background: var(--color-primary, #009639);
  transition: width 0.1s linear;
}

.header-logo-2 {
  min-width: 3rem;
}

@media (max-width: 767px) {
  .hero-carousel-btn {
    width: 2.25rem;
    height: 2.25rem;
  }

  .hero-carousel-btn-prev {
    left: 0.5rem;
  }

  .hero-carousel-btn-next {
    right: 0.5rem;
  }
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary, #009639);
  transition: width 0.3s;
}

.nav-link:hover::after {
  width: 100%;
}

.card-hover {
  transition: transform 0.3s, box-shadow 0.3s;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.service-card {
  transition: all 0.3s;
}

.service-card:hover {
  background-color: #e8f5e9;
}

.arrow-btn {
  transition: transform 0.3s;
}

.arrow-btn:hover {
  transform: translateX(4px);
}

.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.mobile-menu.open {
  transform: translateX(0);
}

.search-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  transform: translateY(-30px);
  transition: transform 0.3s ease;
}

.search-overlay.open .search-panel {
  transform: translateY(0);
}

/* Custom adjustments for dynamic WordPress menu styling to match the mock */
.nav-container {
  position: relative;
}

.nav-container > ul {
  display: flex;
  align-items: stretch;
  width: 100%;
  position: relative;
}

.nav-container > ul > li {
  position: relative;
  margin: 0 1rem;
}

.nav-container > ul > li:first-child {
  margin-left: 0;
}

.nav-container > ul > li > a {
  display: block;
  padding: 0.75rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  transition: color 0.2s;
  position: relative;
}

.nav-container > ul > li > a:hover {
  color: var(--color-primary, #009639);
}

/* Active menu item — top level */
.nav-container > ul > .current-menu-item > a,
.nav-container > ul > .current-menu-ancestor > a,
.nav-container > ul > .current-menu-parent > a {
  color: var(--color-primary, #009639);
}

.nav-container > ul > .current-menu-item > a::after,
.nav-container > ul > .current-menu-ancestor > a::after,
.nav-container > ul > .current-menu-parent > a::after {
  width: 100%;
}

.nav-container > ul > .current-menu-item:not(.menu-item-has-children) > a::after,
.nav-container > ul > .current-menu-ancestor:not(.menu-item-has-children) > a::after,
.nav-container > ul > .current-menu-parent:not(.menu-item-has-children) > a::after {
  transform: scaleX(1);
}

/* Active sub-menu item */
.nav-container .sub-menu li.current-menu-item > a,
.nav-container .sub-menu li.current-menu-ancestor > a {
  background-color: #f0fdf4;
  color: var(--color-primary, #009639);
  font-weight: 600;
}

/* Underline animation — top-level links only (not chevron parents) */
.nav-container > ul > li:not(.menu-item-has-children) > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary, #009639);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.nav-container > ul > li:not(.menu-item-has-children) > a:hover::after {
  transform: scaleX(1);
}

/* ===========================================
   Dropdown Sub-menus
   =========================================== */

.nav-container .menu-item-has-children {
  position: relative;
}

/* Invisible bridge so hover is not lost between parent and panel */
.nav-container .menu-item-has-children::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 10px;
  z-index: 49;
}

/* Sub-menu: hidden by default */
.nav-container .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 50;
  padding: 0.25rem 0;
  margin: 0;
  list-style: none;
}

/* Show direct sub-menu on hover or keyboard focus */
.nav-container .menu-item-has-children:hover > .sub-menu,
.nav-container .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-container .sub-menu li {
  position: relative;
  width: 100%;
}

.nav-container .sub-menu li a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem !important;
  white-space: nowrap;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  font-weight: 400;
  color: #374151;
  transition: background-color 0.15s, color 0.15s;
}

.nav-container .sub-menu li:last-child > a {
  border-bottom: none;
}

.nav-container .sub-menu li a:hover,
.nav-container .sub-menu li a:focus {
  background-color: #f9fafb;
  color: var(--color-primary, #009639);
}

.menu-icon {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--color-primary, #009639);
  opacity: 0.65;
}

.sub-menu li a:hover .menu-icon {
  opacity: 1;
}

.menu-item-title {
  flex: 1;
}

/* Dropdown chevron — top-level parents only */
.nav-container > ul > .menu-item-has-children > a {
  padding-right: 1.5rem !important;
}

.nav-container > ul > .menu-item-has-children > a::after {
  content: '';
  position: absolute;
  right: 0.25rem;
  top: 50%;
  bottom: auto;
  left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.5;
  transform: translateY(-50%);
  background: none;
}

/* Nested sub-menu items with children */
.nav-container .sub-menu .menu-item-has-children > a {
  padding-right: 2rem !important;
}

.nav-container .sub-menu .menu-item-has-children > a::after {
  content: '';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  opacity: 0.5;
  transform: translateY(-50%);
}

/* 3rd level sub-menu: flyout to the right */
.nav-container .sub-menu .sub-menu {
  top: -4px;
  left: 100%;
  margin-left: -1px;
}

.nav-container .sub-menu .menu-item-has-children:hover > .sub-menu,
.nav-container .sub-menu .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ===========================================
   Mobile Menu Submenus
   =========================================== */

#mobileMenu .sub-menu {
  display: none;
  padding-left: 1rem;
  margin-top: 0.25rem;
}

#mobileMenu .sub-menu .sub-menu {
  padding-left: 1rem;
}

#mobileMenu .sub-menu.open {
  display: block;
}

#mobileMenu .sub-menu li a {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #374151;
}

#mobileMenu .sub-menu li a::after {
  display: none !important;
}

#mobileMenu .menu-item-has-children > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 0.5rem;
}

#mobileMenu .menu-item-has-children > a::after {
  display: inline-block;
  content: '';
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.5;
  transition: transform 0.2s;
}

#mobileMenu .menu-item-has-children > a.toggled::after {
  transform: rotate(180deg);
}

/* ===========================================
   Archive Page Pagination
   =========================================== */

.pagination-archive .nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pagination-archive .nav-links .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.pagination-archive .nav-links .page-numbers:hover {
  background-color: #f3f4f6;
  border-color: var(--color-primary, #009639);
  color: var(--color-primary, #009639);
}

.pagination-archive .nav-links .page-numbers.current {
  background-color: var(--color-primary, #009639);
  border-color: var(--color-primary, #009639);
  color: #fff;
  font-weight: 600;
}

.pagination-archive .nav-links .prev,
.pagination-archive .nav-links .next {
  border: none;
  color: var(--color-primary, #009639);
}

.pagination-archive .nav-links .prev:hover,
.pagination-archive .nav-links .next:hover {
  background-color: #e8f5e9;
}

/* ===========================================
   Archive Search Input Focus
   =========================================== */

.focus\:border-gabarais-green:focus {
  border-color: var(--color-primary, #009639);
}

.focus\:ring-gabarais-green:focus {
  --tw-ring-color: var(--color-primary, #009639);
}

/* ===========================================
   Mega Menu (nav-container walker)
   =========================================== */

.nav-container .mega-menu-item {
  position: static !important;
}

.nav-container .mega-menu-item::before {
  display: none;
}

.nav-container .mega-menu-item > .mega-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-top: none;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 50;
  padding: 1.5rem;
}

.nav-container .mega-menu-item:hover > .mega-container,
.nav-container .mega-menu-item:focus-within > .mega-container {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 4-column grid */
.nav-container .mega-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.2fr 1fr;
  gap: 1.5rem;
}

/* Column 1 — Description */
.nav-container .mega-col-desc {
  background: var(--megamenu-col1-bg, #f9fafb);
  padding: 1rem;
  border-radius: 6px;
}

.nav-container .mega-col-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.75rem 0;
}

.nav-container .mega-col-desc-text {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

/* Column 2 — Parent links */
.nav-container .mega-col-parents {
  border-right: 1px solid #e5e7eb;
  padding-right: 1rem;
}

.nav-container .mega-parents-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-container .mega-parent-item {
  margin-bottom: 0.25rem;
}

.nav-container .mega-parent-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-container .mega-parent-link:hover,
.mega-container .mega-parent-link:focus {
  background: #f0fdf4;
  color: var(--color-primary, #009639);
}

.nav-container .mega-parent-chevron {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.nav-container .mega-parent-link:hover .mega-parent-chevron {
  opacity: 1;
  transform: translateX(2px);
}

/* Column 3 — Children panels */
.nav-container .mega-col-children {
  padding: 0 1rem;
  min-height: 120px;
}

.nav-container .mega-children-panel {
  display: none;
}

.nav-container .mega-children-panel.active {
  display: block;
}

.nav-container .mega-children-title {
  display: none;
}

.nav-container .mega-children-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-container .mega-child-link {
  display: block;
  padding: 0.35rem 0;
  font-size: 0.8125rem;
  color: #4b5563;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-container .mega-child-link:hover {
  color: var(--color-primary, #009639);
}

.nav-container .mega-children-placeholder {
  font-size: 0.8125rem;
  color: #9ca3af;
  font-style: italic;
  margin: 0;
}

/* Column 4 — Minister */
.nav-container .mega-col-minister {
  text-align: center;
  padding-left: 1rem;
  border-left: 1px solid #e5e7eb;
}

.nav-container .minister-photo-wrap {
  margin-bottom: 0.75rem;
}

.nav-container .minister-photo {
  width: 100%;
  max-width: 140px;
  height: auto;
  border-radius: 0;
  border: 0;
  display: block;
  margin: 0 auto;
}

.nav-container .minister-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #374151;
  margin: 0;
  line-height: 1.3;
}

/* ===========================================
   Mega Menu (alternate megamenu walker)
   =========================================== */

/* Mega Menu Panel */
.megamenu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 3px solid var(--color-primary, #009639);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 100;
  max-width: 1400px;
  margin: 0 auto;
}

.megamenu-top-item:hover .megamenu-panel,
.megamenu-top-item:focus-within .megamenu-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.megamenu-inner {
  padding: 2rem 3rem;
}

.megamenu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

/* Mega Menu Column */
.megamenu-column {
  padding: 0;
}

.megamenu-column-header {
  margin-bottom: 1rem;
}

.megamenu-col-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  text-decoration: none;
  display: block;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary, #009639);
  margin-bottom: 0.75rem;
  transition: color 0.2s ease;
}

.megamenu-col-title:hover {
  color: var(--color-primary, #009639);
}

.megamenu-col-desc {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

/* Mega Menu Sublinks */
.megamenu-sublinks {
  list-style: none;
  padding: 0;
  margin: 0;
}

.megamenu-sublink-item {
  margin-bottom: 0.5rem;
}

.megamenu-sublink {
  font-size: 0.9375rem;
  color: #4b5563;
  text-decoration: none;
  display: block;
  padding: 0.5rem 0;
  transition: all 0.2s ease;
  position: relative;
}

.megamenu-sublink::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 2px;
  background: var(--color-primary, #009639);
  transition: width 0.2s ease;
}

.megamenu-sublink:hover {
  color: var(--color-primary, #009639);
  padding-left: 0.75rem;
}

.megamenu-sublink:hover::before {
  width: 4px;
}

.megamenu-sublink-active {
  color: var(--color-primary, #009639);
  font-weight: 600;
}

/* Mega Menu Top Item */
.megamenu-top-item {
  position: static;
}

.megamenu-top-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
  position: relative;
}

.megamenu-top-link:hover {
  color: var(--color-primary, #009639);
}

.megamenu-top-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary, #009639);
  transition: width 0.2s ease;
}

.megamenu-top-link:hover::after {
  width: 100%;
}

.megamenu-current {
  color: var(--color-primary, #009639) !important;
}

.megamenu-current::after {
  width: 100% !important;
}

.megamenu-chevron {
  transition: transform 0.2s ease;
}

.megamenu-has-children:hover .megamenu-chevron {
  transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 1024px) {
  .megamenu-panel {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
  }

  .megamenu-inner {
    padding: 0;
  }

  .megamenu-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .megamenu-col-title {
    font-size: 0.9375rem;
  }
}

/* ===========================================
   Archive / News listing
   =========================================== */

.archive-breadcrumb {
  background-color: #f9fafb;
}

.archive-card {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.archive-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.archive-search-input:focus {
  border-color: var(--color-primary, #009639);
  box-shadow: 0 0 0 1px var(--color-primary, #009639);
}

/* ===========================================
   Featured News Slider
   =========================================== */

.featured-slide-content {
  will-change: transform, opacity;
}

/* ===========================================
   Scroll-Triggered Reveal
   =========================================== */

[data-reveal] {
  will-change: transform, opacity;
}

/* ===========================================
   "Plus d'actualités" link
   =========================================== */

.more-news-link {
  position: relative;
  transition: color 0.3s;
}

.more-news-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary, #009639);
  transition: width 0.3s ease;
}

.more-news-link:hover::after {
  width: 100%;
}
