/*
 * navigation.css
 * Biharibuilder Design System — Navigation & Utility Bar
 * Version: 1.0
 *
 * Components:
 *   - Utility Bar (top, desktop only)
 *   - Main Navbar (sticky, transparent → white on scroll)
 *   - Mobile Drawer (slide from left)
 *   - Drawer Overlay
 *
 * Behavior:
 *   Desktop: Logo left, nav center, CTA right
 *   Mobile:  Hamburger left, logo center, estimate button right
 *   Scroll:  Transparent → white + backdrop blur + shadow
 */

/* =========================================================
   UTILITY BAR — desktop only, 40px height
   ========================================================= */

.utility-bar {
  display: none;   /* hidden on mobile */
  height: var(--utility-bar-height);  /* 40px */
  max-height: 40px;
  background-color: var(--color-anthracite);
  z-index: calc(var(--z-navbar) + 1);
  transition: max-height var(--transition-fast), opacity var(--transition-fast);
}

.utility-bar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.utility-bar__contact {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.utility-bar__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-caption);
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.utility-bar__item:hover {
  color: var(--color-white);
}

.utility-bar__item svg {
  width: 14px;
  height: 14px;
  color: var(--color-copper);
}

.utility-bar__hours {
  font-size: var(--text-caption);
  color: rgba(255, 255, 255, 0.6);
}

@media (min-width: 992px) {
  .utility-bar {
    display: flex;
  }
}

/* =========================================================
   MAIN NAVBAR
   ========================================================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-navbar);
  background-color: rgba(31, 33, 35, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background-color var(--transition-nav),
    backdrop-filter  var(--transition-nav),
    box-shadow       var(--transition-nav);
}

.site-header--with-bar {
  top: 0;
}

/* When scrolled — collapse utility bar and transition header to solid white */
.site-header.is-scrolled .utility-bar {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.site-header.is-scrolled {
  background-color: var(--nav-bg-solid);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  box-shadow: 0 1px 0 var(--nav-border), var(--shadow-sm);
}

/* =========================================================
   NAVBAR INNER
   ========================================================= */

.navbar {
  height: var(--nav-height-mobile);   /* 72px mobile */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--space-4);     /* 16px mobile */
}

@media (min-width: 768px) {
  .navbar {
    padding-inline: var(--space-8);   /* 32px tablet */
  }
}

@media (min-width: 1200px) {
  .navbar {
    height: var(--nav-height-desktop); /* 88px desktop */
    padding-inline: var(--space-12);   /* 48px desktop */
  }
}

/* =========================================================
   LOGO
   ========================================================= */

.navbar__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar__logo img {
  width: 140px;   /* mobile */
  height: auto;
  object-fit: contain;
  transition: opacity var(--transition-fast);
}

/* Dynamic Logo Toggling (White over dark header, Dark over white scrolled header) */
.site-header:not(.is-scrolled) .navbar__logo-img--white {
  display: block !important;
}
.site-header:not(.is-scrolled) .navbar__logo-img--dark {
  display: none !important;
}

.site-header.is-scrolled .navbar__logo-img--white {
  display: none !important;
}
.site-header.is-scrolled .navbar__logo-img--dark {
  display: block !important;
}

.navbar__logo:hover img {
  opacity: 0.85;
}

@media (min-width: 768px) {
  .navbar__logo img {
    width: 170px;
  }
}

@media (min-width: 1200px) {
  .navbar__logo img {
    width: 200px;
  }
}

/* =========================================================
   DESKTOP NAVIGATION LINKS
   ========================================================= */

.navbar__nav {
  display: none;      /* hidden on mobile */
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}

@media (min-width: 992px) {
  .navbar__nav {
    display: flex;
  }
}

.navbar__nav-link {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  padding-inline: var(--space-4);     /* 16px */
  font-family: var(--font-body);
  font-size: var(--text-small);       /* 16px */
  font-weight: var(--weight-medium);
  color: var(--nav-link-inactive);    /* anthracite */
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  white-space: nowrap;
}

/* Underline hover effect */
.navbar__nav-link::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: var(--space-4);
  right: var(--space-4);
  height: 2px;
  background: var(--color-copper);
  border-radius: var(--radius-round);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-normal);
}

.navbar__nav-link:hover {
  color: var(--color-copper);
}

.navbar__nav-link:hover::after,
.navbar__nav-link.is-active::after {
  transform: scaleX(1);
}

/* Active state */
.navbar__nav-link.is-active {
  color: var(--color-copper);
}

/* Transparent nav — white links over hero */
.site-header:not(.is-scrolled) .navbar__nav-link {
  color: rgba(255, 255, 255, 0.9);
}

.site-header:not(.is-scrolled) .navbar__nav-link::after {
  background: var(--color-white);
}

.site-header:not(.is-scrolled) .navbar__nav-link:hover,
.site-header:not(.is-scrolled) .navbar__nav-link.is-active {
  color: var(--color-white);
}

/* =========================================================
   NAVBAR CTA BUTTON — desktop right
   ========================================================= */

.navbar__cta {
  display: none;
}

@media (min-width: 992px) {
  .navbar__cta {
    display: inline-flex;
  }
}

/* Transparent nav — adjust CTA */
.site-header:not(.is-scrolled) .navbar__cta.btn-primary {
  background: rgba(180, 100, 60, 0.9);
  border-color: rgba(180, 100, 60, 0.9);
  backdrop-filter: blur(4px);
}

/* =========================================================
   MOBILE HEADER LAYOUT
   Hamburger | Logo (centered) | Estimate button
   ========================================================= */

.navbar__mobile-left {
  display: flex;
  align-items: center;
}

.navbar__mobile-logo {
  /* Centered on mobile via flex */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.navbar__mobile-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Compact estimate button for mobile navbar */
.navbar__mobile-cta {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding-inline: var(--space-4);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  background: var(--color-copper);
  color: var(--color-white);
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.navbar__mobile-cta:hover {
  background: var(--color-copper-dark);
}

@media (min-width: 992px) {
  .navbar__mobile-left,
  .navbar__mobile-logo,
  .navbar__mobile-right {
    display: none;
  }
}

/* =========================================================
   HAMBURGER BUTTON
   ========================================================= */

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: var(--space-2);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.hamburger:hover {
  background: rgba(47, 49, 51, 0.05);
}

.hamburger:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.hamburger__line {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-anthracite);
  border-radius: var(--radius-round);
  transition:
    transform  var(--transition-normal),
    opacity    var(--transition-normal),
    width      var(--transition-normal);
  transform-origin: center;
}

/* Over hero — white lines */
.site-header:not(.is-scrolled) .hamburger__line {
  background: var(--color-white);
}

/* Open state — transforms to X */
.hamburger[aria-expanded="true"] .hamburger__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

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

@media (min-width: 992px) {
  .hamburger {
    display: none;
  }
}

/* =========================================================
   MOBILE DRAWER
   ========================================================= */

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--color-white);
  z-index: var(--z-drawer);
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-lg);

  /* Safe area for notched phones */
  padding-bottom: env(safe-area-inset-bottom);
}

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

/* Drawer header */
.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  min-height: var(--nav-height-mobile);
  flex-shrink: 0;
}

.drawer__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.drawer__logo img {
  width: 130px;
  height: auto;
}

/* Close button */
.drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-heading);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.drawer__close:hover {
  background: var(--neutral-100);
}

.drawer__close:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.drawer__close svg {
  width: 24px;
  height: 24px;
}

/* Drawer navigation */
.drawer__nav {
  flex: 1;
  padding: var(--space-6);
  list-style: none;
}

.drawer__nav-item + .drawer__nav-item {
  border-top: 1px solid var(--border-light);
}

.drawer__nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);      /* 16px — large tap target */
  font-family: var(--font-body);
  font-size: 1.0625rem;               /* 17px — slightly larger for touch */
  font-weight: var(--weight-medium);
  color: var(--text-heading);
  text-decoration: none;
  min-height: 56px;                   /* >44px touch target */
  transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.drawer__nav-link:hover,
.drawer__nav-link.is-active {
  color: var(--color-copper);
  padding-left: var(--space-2);
}

.drawer__nav-link svg {
  width: 18px;
  height: 18px;
  color: var(--color-concrete);
  flex-shrink: 0;
}

.drawer__nav-link.is-active svg {
  color: var(--color-copper);
}

/* Drawer CTA */
.drawer__cta {
  padding: var(--space-6);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.drawer__cta .btn {
  width: 100%;
}

/* Drawer contact info */
.drawer__contact {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.drawer__contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-block: var(--space-3);
  font-size: var(--text-small);
  color: var(--text-muted);
  text-decoration: none;
  min-height: 44px;
}

.drawer__contact-item svg {
  width: 18px;
  height: 18px;
  color: var(--color-copper);
  flex-shrink: 0;
}

.drawer__contact-item:hover {
  color: var(--color-anthracite);
}

/* =========================================================
   DRAWER OVERLAY
   ========================================================= */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 49, 51, 0.5);
  backdrop-filter: blur(2px);
  z-index: calc(var(--z-drawer) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.drawer-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* =========================================================
   BODY SCROLL LOCK — when drawer is open
   ========================================================= */

body.drawer-open {
  overflow: hidden;
}
