/*
Theme Name: SolarGadgetsHub
Theme URI: https://www.solargadgetshub.com/
Author: nick
Description: Custom theme for SolarGadgetsHub
Version: 1.0
Text Domain: solargadgetshub
*/

/* ========================
   HEADER & NAVIGATION LAYOUT
   ======================== */

.site-header {
  background: #11120d;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: relative;
  z-index: 1000;
  width: 100%;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 20px;
  position: relative;
}

 /*Site branding */
.site-branding {
  flex-shrink: 0;
}

.site-branding .logo {
  font-size: 1.8rem;
  font-weight: bold;
  color: #4a8c39;
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-branding .logo:hover {
  color: #3a6c2d;
}


 /*========================*/
   /*DESKTOP NAVIGATION (DEFAULT)*/
   /*======================== */
/**/
.main-navigation {
  display: flex;
  justify-content: center;
}

.primary-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
  align-items: center;
  justify-content: center;
}

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

.primary-menu a {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.3s ease;
  font-weight: 500;
  border-radius: 4px;
}

.primary-menu a:hover {
  color: #4a8c39;
  background: rgba(255,255,255,0.1);
}

 /*Dropdown arrow for menu items that have children */
.primary-menu .menu-item-has-children > a::after {
  content: "▼";
  font-size: 0.6em;
  margin-left: 0.3rem;
  transition: transform 0.3s ease;
}

 /*Dropdown menu (sub-menu) - ABSOLUTELY POSITIONED */
.primary-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  min-width: 200px;
  box-shadow: 0px 8px 16px rgba(0,0,0,0.15);
  border-radius: 6px;
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
  z-index: 1001;
  border: 1px solid #eee;
}

.primary-menu .sub-menu li {
  margin: 0;
}

.primary-menu .sub-menu a {
  padding: 0.75rem 1.5rem;
  white-space: nowrap;
  color: #555;
  border-bottom: none;
  display: block;
  font-weight: normal;
  text-align: center;
}

.primary-menu .sub-menu a:hover {
  background-color: #f8f8f8;
  color: #4a8c39;
}

 /*Show dropdown on hover */
.primary-menu li:hover > .sub-menu {
  display: block;
}

 /*Rotate arrow when dropdown is visible */
.primary-menu li:hover > a::after {
  transform: rotate(180deg);
}

 /*Active state for current page */
.primary-menu .current-menu-item > a,
.primary-menu .current-category-parent > a {
  color: #4a8c39;
  font-weight: bold;
}

 /*========================*/
   /*HAMBURGER MENU (HIDDEN ON DESKTOP)*/
   /*======================== */

.hamburger-menu {
  display: none; /* Hidden by default on desktop */
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 25px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger-menu span {
  width: 100%;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

 /*Hamburger animation when active */
.hamburger-menu[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

 /*========================*/
   /*MOBILE RESPONSIVENESS (768px and below)*/
   /*======================== */

@media (max-width: 768px) {
   /*Show hamburger menu on mobile */
  .hamburger-menu {
    display: flex;
  }
  
   /*Hide desktop navigation on mobile */
  .main-navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #11120d;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
  }
  
  .main-navigation.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }
  
   /*Mobile menu styles */
  .primary-menu {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    padding: 2rem;
  }
  
  .primary-menu > li {
    width: 100%;
    text-align: center;
  }
  
  .primary-menu a {
    padding: 1rem;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    display: block;
  }
  
   /*Mobile dropdown styles */
  .primary-menu .sub-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    width: 100%;
    background-color: rgba(255,255,255,0.1);
    display: none;
    margin-top: 0.5rem;
  }
  
  .primary-menu .sub-menu a {
    padding: 0.8rem 1rem;
    color: #fff;
    font-size: 1rem;
  }
  
   /*Show dropdown when active */
  .primary-menu li.active > .sub-menu {
    display: block;
  }
 
  
   /*Ensure site header has proper spacing on mobile */
  .site-header .container {
    padding: 0.8rem 20px;
    min-height: 60px;
  }
  
   /*Logo sizing on mobile */
  .site-branding .logo {
    font-size: 1.5rem;
  }
  
   /*Mobile menu close button */
  .menu-close {
    display: block;
  }
  
   /*Hero section adjustments for mobile */
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
}

 /*========================*/
   /*BLOG SECTION - CENTERED & STABLE*/
   /*======================== */

.main-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero {
  background: url('https://www.solargadgetshub.com/wp-content/uploads/2025/08/solar-i.png') no-repeat center center/cover;
  height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding: 150px 20px;
  margin: 0;
  position: relative;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.6);
}

.hero p {
  font-size: 1.2rem;
  max-width: 600px;
  text-shadow: 1px 1px 5px rgba(0,0,0,0.6);
}

.blog-section {
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  justify-content: center;
}

 /*Center everything in blog section */
.blog-section h2,
.blog-section .dropdown,
.blog-section .pagination {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.dropdown {
  position: relative;
  display: inline-block;
  width: auto;
  text-align: center;
  margin: 20px auto;
}

 /*========================*/
   /*LAYOUT STABILITY FIXES*/
   /*======================== */
 /*Prevent any layout shifts */
html, body {
  overflow-x: hidden;
}

body {
  position: relative;
}

 /*Ensure header doesn't move anything */
.site-header {
  position: relative;
}

 /*Center all content properly */
.container {
  box-sizing: border-box;
}

 /*Smooth transitions for any animations */
.primary-menu .sub-menu,
.main-navigation {
  transition: all 0.3s ease;
}

 /*=======================*/
   /*ADDITIONAL FIXES FOR VISIBILITY*/
   /*======================== */

 /*Ensure hamburger is clickable and visible */
.site-header .container {
  position: relative;
  z-index: 1002;
}

 /*Prevent body scrolling when menu is open */
body.menu-open {
  overflow: hidden;
}

 /*Mobile menu close button */
.menu-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1002;
  display: none;
}

 /*========================*/
   /*DROPDOWN CENTERING FIX*/
   /*======================== */

 /*Perfect center alignment for dropdowns */
.primary-menu > .menu-item-has-children {
  position: relative;
}

.primary-menu .sub-menu {
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.primary-menu .menu-item-has-children > a::after {
  content: "▼";
  font-size: 0.6em;
  margin-left: 0.3rem;
  transition: transform 0.3s ease;
  transform: rotate(var(--arrow-rotate, 0deg));
}
/* ======================== */
/* MOBILE MENU - FIXED HEIGHT, NOT FULL SCREEN (COMPACT) */
/* ======================== */
@media (max-width: 768px) {
  .main-navigation {
    position: absolute;
    top: 100%; /* just below the header */
    left: 0;
    width: 100%;
    max-height: 0;
    background: #11120d;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border-radius: 0 0 10px 10px;
  }

  .main-navigation.active {
    max-height: 400px; /* less tall */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .primary-menu {
    flex-direction: column;
    gap: 0.3rem;       /* less gap */
    width: 100%;
    padding: 0.5rem 1rem;  /* less padding */
  }

  .primary-menu a {
    padding: 0.6rem 0.8rem; /* reduced padding */
    font-size: 1rem;        /* slightly smaller font */
    color: #fff;
    text-align: left;
    border-radius: 5px;
    transition: background 0.3s ease;
  }

  .primary-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #4a8c39;
  }

  .primary-menu .sub-menu {
    background: rgba(255, 255, 255, 0.05);
    margin-top: 0.2rem;
    border-radius: 5px;
    display: none;
    padding: 0.2rem 0;  /* tighter spacing */
  }

  .primary-menu li.active > .sub-menu {
    display: block;
  }

  .primary-menu .sub-menu a {
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem; /* smaller padding */
    color: #f5f5f5;
  }
}
/* ======================== */
/* DROPDOWN ANIMATION (DESKTOP + MOBILE) */
/* ======================== */
.primary-menu .sub-menu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);  /* slide down */
  transition: all 0.35s ease;
  transform-origin: top center;
}

.primary-menu li:hover > .sub-menu,
.primary-menu li.active > .sub-menu {
  max-height: 500px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ======================== */
/* BLOG DROPDOWN - OPEN UPWARDS WITH SLIDE EFFECT */
/* ======================== */
.primary-menu .menu-item-blog > .sub-menu {
  top: auto;
  bottom: 100%;
  transform: translateY(-10px); /* slide up */
  transform-origin: bottom center;
}

.primary-menu .menu-item-blog:hover > .sub-menu,
.primary-menu .menu-item-blog.active > .sub-menu {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  max-height: 500px;
}
/* ======================== */
/* BLOG DROPDOWN - DESKTOP ONLY */
/* ======================== */
@media (min-width: 769px) {
  .primary-menu .menu-item-blog > .sub-menu {
    left: 0;                 /* align directly under Blog */
    transform: none;         /* remove centering */
  }
}