/**
 * Layout Styles
 *
 * Grid systems, containers, and layout utilities
 *
 * @package Ithawk_Theme
 * @version 1.0.0
 */

/* ========================================
   MAIN NAVIGATION (Desktop)
   ======================================== */

.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.site-main {
  flex-grow: 1;
}
.main-nav {
  padding: var(--spacing-4) 0;
  background-color: var(--color-bg-primary);
}

.main-nav__container {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-6);
}

.main-nav__menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-grow: 1;
}

.main-nav__item,
.main-nav__menu .menu-item {
  margin: 0;
  padding: 0;
}

.main-nav__link,
.main-nav__menu .menu-item a {
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color var(--transition-base);
  padding: var(--spacing-2) 0;
  display: inline-block;
  position: relative;
}

.main-nav__link:hover,
.main-nav__menu .menu-item a:hover {
  color: var(--color-text-primary);
}

.main-nav__link::after,
.main-nav__menu .menu-item a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-base);
}

.main-nav__link:hover::after,
.main-nav__link--active::after,
.main-nav__menu .menu-item a:hover::after,
.main-nav__menu .current-menu-item a::after {
  width: 100%;
}

.main-nav__link--active,
.main-nav__menu .current-menu-item a {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
}

.main-nav__search {
  background: none;
  border: none;
  padding: var(--spacing-2);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.main-nav__search:hover {
  color: var(--color-text-primary);
}

/* Hide main nav on mobile */
@media (max-width: 767px) {
  .main-nav {
    display: none;
  }
}

/* ========================================
   MOBILE HEADER & MENU
   ======================================== */

.mobile-header {
  display: none;
  background-color: var(--color-bg-primary);
  padding: var(--spacing-4) var(--content-padding);
  position: relative;
  z-index: var(--z-index-sticky);
}

.mobile-header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
}

.mobile-header__search {
  background: none;
  border: none;
  padding: var(--spacing-2);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-base);
}

.mobile-header__search:hover {
  color: var(--color-text-primary);
}

/* Hamburger Button */
.mobile-menu-toggle {
  background: none;
  border: none;
  padding: var(--spacing-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 24px;
}

.hamburger__line {
  width: 100%;
  height: 2px;
  background-color: currentColor;
  transition: all var(--transition-base);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger__line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

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

.mobile-menu-toggle[aria-expanded="true"] .hamburger__line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Menu Drawer */
.mobile-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  background-color: var(--color-bg-primary);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-index-modal);
  transition: left var(--transition-slow);
  overflow-y: auto;
  padding: var(--spacing-6);
}

.mobile-menu.active {
  left: 0;
}

.mobile-menu__close {
  background: none;
  border: none;
  padding: var(--spacing-2);
  cursor: pointer;
  margin-bottom: var(--spacing-6);
  font-size: var(--font-size-2xl);
  color: var(--color-text-primary);
}

.mobile-menu__nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-menu__item {
  margin-bottom: var(--spacing-2);
}

.mobile-menu__link {
  display: block;
  padding: var(--spacing-3) var(--spacing-4);
  font-family: var(--font-verdana);
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  transition: all var(--transition-base);
  border-left: 3px solid transparent;
}

.mobile-menu__link:hover,
.mobile-menu__link--active {
  color: var(--color-text-primary);
  border-left-color: var(--color-primary);
  background-color: var(--color-bg-secondary);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-index-modal) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Show mobile header on mobile */
@media (max-width: 767px) {
  .mobile-header {
    display: block;
  }
}

/* ========================================
   CONTAINER
   ======================================== */

.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--content-padding);
  padding-right: var(--content-padding);
}
.container.section {
  min-height: calc(100vh - 465px);
}
/* Desktop only: White background for content containers to separate from pattern */
@media (min-width: 769px) {
  .container {
    background-color: var(--color-white);
    padding-top: var(--spacing-8);
    padding-bottom: var(--spacing-8);
  }

  /* Keep header/footer sections with primary background */
  .site-header .container,
  .site-footer .container {
    background-color: var(--color-bg-primary);
    padding-top: 0;
    padding-bottom: 0;
  }
}

.container-sm {
  max-width: var(--container-sm);
}

.container-md {
  max-width: var(--container-md);
}

.container-lg {
  max-width: var(--container-lg);
}

.container-xl {
  max-width: var(--container-xl);
}

.container-full {
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}

/* ========================================
   GRID SYSTEM
   ======================================== */

.grid {
  display: grid;
  gap: var(--spacing-6);
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive Grid */
@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   FLEXBOX UTILITIES
   ======================================== */

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: var(--spacing-2);
}

.gap-4 {
  gap: var(--spacing-4);
}

.gap-6 {
  gap: var(--spacing-6);
}

.gap-8 {
  gap: var(--spacing-8);
}

/* ========================================
   SECTION SPACING
   ======================================== */

.section {
  padding-top: var(--spacing-16);
  padding-bottom: var(--spacing-16);
}

.section-sm {
  padding-top: var(--spacing-12);
  padding-bottom: var(--spacing-12);
}

.section-lg {
  padding-top: var(--spacing-24);
  padding-bottom: var(--spacing-24);
}

@media (max-width: 768px) {
  .section {
    padding-top: var(--spacing-12);
    padding-bottom: var(--spacing-12);
  }

  .section-sm {
    padding-top: var(--spacing-8);
    padding-bottom: var(--spacing-8);
  }

  .section-lg {
    padding-top: var(--spacing-16);
    padding-bottom: var(--spacing-16);
  }
}

/* ========================================
   HEADER
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-index-sticky);
  background-color: var(--color-white);
  padding: var(--spacing-4) 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
  background-color: var(--color-gray-900);
  color: var(--color-white);
  padding: var(--spacing-12) 0 var(--spacing-6);
}

/* Desktop only: Extend footer background to full width over pattern */
@media (min-width: 769px) {
  .site-footer {
    position: relative;
  }

  .site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-gray-900);
    z-index: -1;
  }
}

.site-footer a {
  color: var(--color-gray-300);
}

.site-footer a:hover {
  color: var(--color-white);
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}
