/* ==========================================================================
   Header Component
   ADVANCE v2 Theme
   Includes: Header layouts, Navigation, Hamburger, Drawer
   ========================================================================== */

/* --------------------------------------------------------------------------
   Header Base
   -------------------------------------------------------------------------- */
.l-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-bg);
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.l-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* --------------------------------------------------------------------------
   Header Layout: Standard (Logo left, Nav+Phone+CTA right)
   -------------------------------------------------------------------------- */
.l-header--standard .l-header__inner {
  justify-content: space-between;
}

.l-header--standard .l-header__actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* --------------------------------------------------------------------------
   Header Layout: Center (Logo center, Nav below)
   -------------------------------------------------------------------------- */
.l-header--center .l-header__inner {
  flex-direction: column;
  justify-content: center;
  height: auto;
  padding-top: 1rem;
  padding-bottom: 0;
}

.l-header--center .l-header__logo {
  margin-bottom: 0.75rem;
}

.l-header--center .l-header__nav {
  width: 100%;
  border-top: 1px solid var(--color-border);
  padding: 0.5rem 0;
}

.l-header--center .l-header__nav-list {
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Header Layout: Fixed (position fixed instead of sticky)
   -------------------------------------------------------------------------- */
.l-header--fixed {
  position: fixed;
  width: 100%;
}

/* Add body padding when header is fixed */
body.has-fixed-header {
  padding-top: var(--header-height);
}

@media (max-width: 1024px) {
  body.has-fixed-header {
    padding-top: var(--header-height-sp);
  }
}

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */
.l-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.l-header__logo a {
  display: flex;
  align-items: center;
}

.l-header__logo img {
  height: 40px; /* overridden by inline style */
  width: auto;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.l-header__nav {
  display: flex;
  align-items: center;
}

.l-header__nav-list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.l-header__nav-list li {
  position: relative;
}

.l-header__nav-list li a {
  display: block;
  padding: 0.5em 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
}

.l-header__nav-list li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-normal);
}

.l-header__nav-list li a:hover {
  color: var(--color-primary);
}

.l-header__nav-list li a:hover::after {
  width: 100%;
}

/* Current page indicator */
.l-header__nav-list li.is-current a {
  color: var(--color-primary);
}

.l-header__nav-list li.is-current a::after {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Phone (Header)
   -------------------------------------------------------------------------- */
.l-header__phone {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.l-header__phone-icon {
  font-size: 1.2em;
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   CTA Button (Header)
   -------------------------------------------------------------------------- */
.l-header__cta .c-btn {
  font-size: 0.85rem;
  padding: 0.6em 1.5em;
}

/* --------------------------------------------------------------------------
   Hamburger Menu
   -------------------------------------------------------------------------- */
.l-header__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  z-index: 1002;
  position: relative;
}

.l-header__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-text);
  transition:
    transform var(--transition-normal),
    opacity var(--transition-normal);
  position: absolute;
}

.l-header__hamburger span:nth-child(1) {
  transform: translateY(-7px);
}

.l-header__hamburger span:nth-child(2) {
  transform: translateY(0);
}

.l-header__hamburger span:nth-child(3) {
  transform: translateY(7px);
}

/* Hamburger active state (X shape) */
.l-header__hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg);
}

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

.l-header__hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg);
}

/* ==========================================================================
   Drawer (Mobile Navigation)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Drawer Panel
   -------------------------------------------------------------------------- */
.l-drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background-color: var(--color-bg);
  z-index: 1001;
  overflow-y: auto;
  transition: right var(--transition-normal);
  padding: calc(var(--header-height-sp) + 1rem) 1.5rem 2rem;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.l-drawer[aria-hidden="false"] {
  right: 0;
}

/* --------------------------------------------------------------------------
   Drawer Overlay
   -------------------------------------------------------------------------- */
.l-drawer__overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.l-drawer__overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Drawer Navigation
   -------------------------------------------------------------------------- */
.l-drawer__nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.l-drawer__nav-list li a {
  display: block;
  padding: 0.85em 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: color var(--transition-fast);
}

.l-drawer__nav-list li a:hover {
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Drawer Phone & CTA
   -------------------------------------------------------------------------- */
.l-drawer__phone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.75em;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  border: 2px solid var(--color-primary);
  border-radius: var(--btn-radius);
}

.l-drawer__cta {
  display: block;
  margin-top: 1rem;
  text-align: center;
}

.l-drawer__cta .c-btn {
  width: 100%;
}

/* ==========================================================================
   Responsive: Tablet and below (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .l-header__inner {
    height: var(--header-height-sp);
  }

  /* Hide desktop nav, phone, and CTA */
  .l-header__nav,
  .l-header__phone,
  .l-header__cta {
    display: none;
  }

  /* Show hamburger */
  .l-header__hamburger {
    display: flex;
  }

  /* Center layout falls back to standard on mobile */
  .l-header--center .l-header__inner {
    flex-direction: row;
    height: var(--header-height-sp);
    padding-top: 0;
    padding-bottom: 0;
  }

  .l-header--center .l-header__nav {
    display: none;
  }
}

/* ==========================================================================
   Body scroll lock when drawer is open
   ========================================================================== */
body.is-drawer-open {
  overflow: hidden;
}
