/* Kisima — unified header & mobile drawer (all pages) */

/* Neutralize legacy Day template when style.css is still loaded */
#header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: auto !important;
  min-height: unset !important;
  z-index: 1002 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.75rem clamp(1rem, 3vw, 2rem) !important;
  background: linear-gradient(135deg, #0b1324 0%, #1d3f91 55%, #2563eb 100%) !important;
  box-shadow: 0 2px 18px rgba(11, 19, 36, 0.25) !important;
  border-bottom: 1px solid rgba(147, 197, 253, 0.22) !important;
  font-family: var(--kisima-font, 'Inter', sans-serif) !important;
  width: 100% !important;
  transition: box-shadow 0.3s ease, backdrop-filter 0.3s ease, padding 0.3s ease !important;
}

#header > .container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  width: 100%;
  max-width: 1360px;
  margin: 0;
  padding: 0;
}

#header .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  z-index: 1003;
  font-size: inherit !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  line-height: normal !important;
  padding: 0 !important;
  margin: 0 !important;
}

#header .logo img {
  height: 58px !important;
  max-height: 58px !important;
  width: auto;
  transition: transform 0.3s ease;
}

#header .logo:hover img {
  transform: scale(1.04);
}

#navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 !important;
}

#navbar .mobile-menu__panel {
  display: none;
}

#navbar .desktop-nav__track {
  display: none;
}

.header-cta-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-shrink: 0;
  z-index: 1003;
}

.header-phone-btn,
.header-quote-btn,
.cost-calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease, color 0.22s ease;
  border: 1px solid transparent;
}

.header-phone-btn {
  display: none;
  padding: 0.55rem 0.95rem;
  font-size: 0.82rem;
  color: #e2e8f0 !important;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.header-phone-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  transform: translateY(-1px);
}

.header-phone-btn i {
  color: #93c5fd;
  font-size: 0.95rem;
}

.header-quote-btn {
  display: none;
  padding: 0.58rem 1.05rem;
  font-size: 0.84rem;
  color: #fff !important;
  background: linear-gradient(135deg, #25d366, #128c7e);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.28);
}

.header-quote-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(37, 211, 102, 0.38);
  color: #fff !important;
}

.cost-calc-btn {
  padding: 0.58rem 1.05rem;
  font-size: 0.84rem;
  color: #f8fafc !important;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.cost-calc-btn:hover {
  transform: translateY(-2px);
  color: #fff !important;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(147, 197, 253, 0.45);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.25);
}

.cost-calc-btn i {
  font-size: 1rem;
  color: #93c5fd;
}

/* ——— Desktop navigation (1025px+) ——— */
@media (min-width: 1025px) {
  #header.header-scrolled {
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
  }

  #header.header-scrolled .logo img {
    height: 52px !important;
    max-height: 52px !important;
  }

  #navbar .desktop-nav__track {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      0 8px 28px rgba(2, 6, 23, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  #navbar .desktop-nav__links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin: 0;
    padding: 0;
    width: 100%;
    justify-content: center;
  }

  #navbar .desktop-nav__links li {
    flex: 0 1 auto;
  }

  #navbar .desktop-nav__links li a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.58rem clamp(0.7rem, 1.1vw, 1rem) !important;
    border-radius: 999px;
    color: #cbd5e1 !important;
    font-weight: 600;
    font-size: clamp(0.8rem, 0.72rem + 0.22vw, 0.9rem);
    letter-spacing: 0.01em;
    text-decoration: none !important;
    background: transparent !important;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  #navbar .desktop-nav__links li a span {
    position: relative;
    z-index: 1;
  }

  #navbar .desktop-nav__links li a::after {
    display: none !important;
  }

  #navbar .desktop-nav__links li a:hover {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
  }

  #navbar .desktop-nav__links li a.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.45), rgba(59, 130, 246, 0.55)) !important;
    box-shadow:
      0 4px 14px rgba(37, 99, 235, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .header-cta-group {
    gap: 0.65rem;
  }

  .header-quote-btn,
  .cost-calc-btn {
    display: inline-flex;
  }
}

@media (min-width: 1025px) and (max-width: 1199px) {
  #navbar .desktop-nav__links li a {
    padding: 0.52rem 0.72rem !important;
    font-size: 0.78rem;
  }

  .header-quote-btn span,
  .cost-calc-btn .btn-text {
    display: none;
  }

  .header-quote-btn,
  .cost-calc-btn {
    padding: 0.58rem 0.72rem;
  }
}

@media (min-width: 1200px) {
  #header .logo img {
    height: 62px !important;
    max-height: 62px !important;
  }

  #navbar .desktop-nav__links {
    gap: 0.28rem;
  }

  #navbar .desktop-nav__links li a {
    padding: 0.62rem 1.05rem !important;
    font-size: 0.9rem;
  }

  .header-phone-btn {
    display: inline-flex;
  }

  .header-cta-group {
    gap: 0.75rem;
  }
}

@media (min-width: 1200px) and (max-width: 1319px) {
  .header-phone-btn__text {
    display: none;
  }

  .header-phone-btn {
    padding: 0.55rem 0.72rem;
  }
}

@media (min-width: 1400px) {
  #header > .container {
    max-width: 1420px;
    gap: 2rem;
  }

  #navbar .desktop-nav__track {
    padding: 0.35rem;
  }

  #navbar .desktop-nav__links li a {
    padding: 0.65rem 1.15rem !important;
  }
}

.mobile-nav-toggle {
  display: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  color: #fff !important;
  font-size: inherit !important;
  line-height: normal !important;
}

.mobile-nav-toggle:hover {
  background: rgba(96, 165, 250, 0.3);
  border-color: rgba(147, 197, 253, 0.45);
}

.mobile-nav-toggle.is-open {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(96, 165, 250, 0.5);
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-toggle.is-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.is-open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle.is-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

#mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 1000;
  pointer-events: none;
}

#mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#header.header-scrolled {
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
  background: linear-gradient(135deg, rgba(11, 19, 36, 0.94) 0%, rgba(29, 63, 145, 0.92) 55%, rgba(37, 99, 235, 0.9) 100%) !important;
}

/* backdrop-filter on fixed headers breaks iOS touch targets after scroll */
@media (min-width: 1025px) {
  #header.header-scrolled {
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
  }
}

/* Homepage: hero is full-bleed under fixed header */
body.kisima-home-page {
  padding-top: 0 !important;
}

/* ——— Mobile drawer ——— */
@media (max-width: 1024px) {
  #header > .container {
    display: flex;
    justify-content: space-between;
  }

  #header .logo img {
    height: 50px !important;
    max-height: 50px !important;
  }

  .mobile-nav-toggle {
    display: flex;
    position: relative;
    z-index: 1004;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  #navbar .desktop-nav__track {
    display: none !important;
  }

  .header-phone-btn,
  .header-quote-btn {
    display: none !important;
  }

  .cost-calc-btn {
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25);
  }

  #header #navbar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(340px, 88vw);
    max-width: 100%;
    margin: 0;
    padding: 0;
    z-index: 1001;
    flex: none;
    justify-content: stretch;
    align-items: stretch;
    opacity: 1;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(105%);
    transition:
      transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.38s;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible;
  }

  #header #navbar.navbar-mobile {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition:
      transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0s;
  }

  #navbar .mobile-menu__panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: linear-gradient(165deg, #0c1222 0%, #132347 42%, #1e3a8a 100%);
    border-left: 1px solid rgba(147, 197, 253, 0.22);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
  }

  .mobile-menu__head {
    padding: calc(var(--kisima-header-h, 76px) + 0.5rem) 1.35rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.12) 0%, transparent 100%);
  }

  .mobile-menu__brand {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #f8fafc;
  }

  .mobile-menu__tagline {
    margin: 0;
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 500;
  }

  #navbar .mobile-menu__links {
    list-style: none !important;
    margin: 0 !important;
    padding: 0.65rem 0.85rem !important;
    flex: 1;
    overflow-y: auto;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
    position: static !important;
    width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #navbar .mobile-menu__links li {
    width: 100%;
    border: none !important;
  }

  #navbar .mobile-menu__links li a {
    display: flex !important;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #e2e8f0 !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 14px !important;
    text-decoration: none !important;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease !important;
  }

  #navbar .mobile-menu__links li a > i:first-child {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
    font-size: 1.05rem;
    flex-shrink: 0;
  }

  #navbar .mobile-menu__links li a span {
    flex: 1;
  }

  #navbar .mobile-menu__links li a .nav-chevron {
    font-size: 0.85rem;
    color: rgba(148, 163, 184, 0.7);
    transition: transform 0.2s ease, color 0.2s ease;
  }

  #navbar .mobile-menu__links li a::after {
    display: none !important;
  }

  #navbar .mobile-menu__links li a:hover,
  #navbar .mobile-menu__links li a.active {
    background: rgba(96, 165, 250, 0.22) !important;
    border-color: rgba(147, 197, 253, 0.35) !important;
    color: #ffffff !important;
    padding-left: 1rem !important;
    transform: translateX(2px);
  }

  #navbar .mobile-menu__links li a.active {
    box-shadow: inset 3px 0 0 #60a5fa;
  }

  #navbar .mobile-menu__links li a:hover .nav-chevron,
  #navbar .mobile-menu__links li a.active .nav-chevron {
    color: #93c5fd;
    transform: translateX(3px);
  }

  .mobile-menu__foot {
    padding: 1rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(8, 15, 30, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .mobile-menu__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-menu__cta--calc {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

  .mobile-menu__cta--calc:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
  }

  .mobile-menu__cta--wa {
    color: #fff;
    background: linear-gradient(135deg, #25d366, #128c7e);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  }

  .mobile-menu__cta--wa:hover {
    transform: translateY(-1px);
    color: #fff;
  }

  .cost-calc-btn .btn-text {
    display: none;
  }

  .cost-calc-btn {
    padding: 0.45rem 0.65rem;
  }
}

/* Legacy template overrides (style.css) */
#header #navbar.navbar-mobile {
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  background: transparent !important;
}

#header #navbar.navbar-mobile .mobile-nav-toggle {
  position: static !important;
}

@media (max-width: 480px) {
  #header {
    padding: 0.5rem 0.85rem !important;
  }

  #header .logo img {
    height: 44px !important;
    max-height: 44px !important;
  }
}
