/* ═══════════════════════════════════════════════════
   KAVE — Header / Navigation / Calculator Drawer
   ═══════════════════════════════════════════════════ */

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  background: #eaeaea;
  transition: height var(--duration-base) var(--ease), background var(--duration-base) var(--ease);
  border-bottom: 1px solid var(--color-line);
}

header.scrolled {
  height: 60px;
  background: rgba(248, 248, 248, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.logo img {
  height: 35px;
  width: auto;
  display: block;
  transition: height var(--duration-base) var(--ease), opacity var(--duration-base) var(--ease);
}

.logo .logo-small {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 22px;
  opacity: 0;
  pointer-events: none;
}

.logo {
  position: relative;
  z-index: 45;
}

header.scrolled .logo img.logo-main {
  opacity: 0;
  pointer-events: none;
}

header.scrolled .logo .logo-small {
  opacity: 1;
  pointer-events: auto;
}

/* ── Navigation Links ── */
.nav-links {
  display: flex;
  gap: 40px;
  z-index: 45;
}

.nav-links a {
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-base) var(--ease);
}

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.menu-contacts {
  display: none;
}

/* ── Nav Utilities ── */
.nav-utils {
  display: flex;
  align-items: center;
  gap: 24px;
  z-index: 45;
}

.lang-switch span {
  font-family: var(--font-body);
  font-size: 14px;
  opacity: 0.5;
  transition: opacity var(--duration-fast);
}

.lang-switch span.active {
  font-weight: bold;
  opacity: 1;
}

.lang-switch span:hover {
  opacity: 1;
}

/* ── WhatsApp Button (hidden from header) ── */
.wa-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  border: 1px solid rgba(17, 29, 41, 0.18);
  transition: background var(--duration-base) var(--ease), color var(--duration-base) var(--ease), border-color var(--duration-base) var(--ease), transform var(--duration-base) var(--ease);
}

.wa-btn svg {
  width: 17px;
  height: 17px;
  display: block;
}

.wa-btn:hover {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
  transform: translateY(-2px);
}

/* ── Contact Button (header only) ── */
.primary-btn.contact-btn {
  padding: 12px 24px;
  font-size: 12px;
}

/* ── Mega Menu ── */
/* Mega overlay — covers page below header */
.mega-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 29, 41, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.mega-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.nav-item.has-mega {
  position: static;
}

.nav-item .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
}

.nav-chevron {
  opacity: 0.4;
  transition: transform var(--duration-fast);
}

.nav-item.has-mega:hover .nav-chevron { transform: rotate(180deg); }

.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 16px 48px rgba(17, 29, 41, 0.08);
  display: flex;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
  z-index: 50;
  padding: 0;
}

.nav-item.has-mega:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* When mega is open, force header to solid white */
header:has(.nav-item.has-mega:hover) {
  background: #fff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Left: category tabs */
.mega-categories {
  display: flex;
  flex-direction: column;
  width: 220px;
  padding: 20px 0;
  border-right: 1px solid var(--color-line);
  flex-shrink: 0;
}

.mega-cat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast);
  border-left: 3px solid transparent;
}

.mega-cat:hover,
.mega-cat.active {
  background: rgba(17, 29, 41, 0.03);
  border-left-color: var(--color-text);
}

.mega-cat-icon {
  width: 36px;
  height: 24px;
  object-fit: contain;
  filter: grayscale(0.2) opacity(0.7);
  transition: filter var(--duration-fast);
}

.mega-cat:hover .mega-cat-icon,
.mega-cat.active .mega-cat-icon {
  filter: grayscale(0) opacity(1);
}

/* Right: type cards grid */
.mega-types {
  flex: 1;
  padding: 24px 28px;
  position: relative;
}

.mega-type-group {
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.mega-type-group.active {
  display: grid;
}

.mega-type-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.mega-type-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f4f4f4;
  transition: transform 0.5s var(--ease);
}

.mega-type-card:hover img {
  transform: scale(1.05);
}

.mega-type-card span {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--color-text);
}

/* ── Burger Toggle ── */
.burger {
  display: none;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  padding: 0;
  position: relative;
  z-index: 101;
}

.burger span {
  display: block;
  position: absolute;
  left: 4px;
  right: 4px;
  height: 1.5px;
  background: var(--color-text);
  transition: transform var(--duration-base) var(--ease), opacity var(--duration-fast), top var(--duration-base) var(--ease);
}

.burger span:nth-child(1) { top: 11px; }
.burger span:nth-child(2) { top: 19px; }
.burger.open span:nth-child(1) { top: 15px; transform: rotate(45deg); }
.burger.open span:nth-child(2) { top: 15px; transform: rotate(-45deg); }

/* ── Calculator Drawer ── */
.calculator-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  background: #fff;
  color: var(--color-text);
  z-index: 1000;
  padding: 50px;
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.1);
  transition: right var(--duration-slow) var(--ease);
  overflow-y: auto;
}

.calculator-drawer.active {
  right: 0;
}

.drawer-close {
  position: absolute;
  top: 30px;
  right: 30px;
  font-size: 32px;
  font-weight: 300;
  background: none;
  border: none;
  color: var(--color-text);
  font-family: var(--font-body);
}

/* ═══ TABLET (≤960px) ═══ */
@media (max-width: 960px) {
  header { height: 70px; }
  header.scrolled { height: 46px; }
  .nav-links { gap: 28px; }
  .nav-links a { font-size: 13px; }
  .primary-btn.contact-btn { padding: 11px 20px; font-size: 11px; }
}

/* ═══ MOBILE (≤760px) ═══ */
@media (max-width: 760px) {
  header { height: 60px; z-index: 200; }
  header.scrolled { height: 44px; }
  .logo img { height: 35px; position: relative; z-index: 202; }
  .burger { display: block; z-index: 203; }

  /* Slide-in mobile menu */
  .nav-links {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100vh;
    background: var(--color-bg);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 36px;
    transform: translateX(100%);
    transition: transform var(--duration-slow) var(--ease);
    z-index: 201;
    padding: 0;
  }

  .nav-links.open { transform: translateX(0); }
  .nav-links > a,
  .nav-links .nav-item .nav-link {
    font-size: 24px;
    font-family: var(--font-heading);
    font-weight: 400;
  }
  .nav-links a::after { display: none; }
  .nav-chevron { display: none; }
  .mega-menu { display: none !important; }
  .nav-item.has-mega { position: relative; }

  /* Contact footer pinned to bottom of mobile menu */
  .menu-contacts {
    display: grid;
    position: absolute;
    left: 28px; right: 28px; bottom: 36px;
    grid-template-columns: 1fr 1fr;
    gap: 22px 20px;
    padding-top: 26px;
    border-top: 1px solid var(--color-line);
  }

  .mc-item { display: flex; flex-direction: column; gap: 4px; text-align: left; }
  .mc-label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 500;
    font-family: var(--font-body);
  }
  .mc-value {
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.45;
    font-family: var(--font-body);
    font-weight: 400;
  }
  a.mc-value { transition: opacity var(--duration-fast); }
  a.mc-value:hover { opacity: 0.55; }

  .wa-btn { width: 36px; height: 36px; }
  .wa-btn svg { width: 15px; height: 15px; }
  .lang-switch { display: flex; }
  .primary-btn.contact-btn { display: none; }

  /* Calculator drawer full width */
  .calculator-drawer { padding: 80px 24px 30px; max-width: 100%; }
  .drawer-close { top: 18px; right: 18px; }
}

@media (max-width: 420px) {
  .nav-utils { gap: 12px; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Header search (Phase 6B). The toggle is a byte-for-byte clone of .wa-btn's
   circle (so it reads as part of the original icon family) but is always shown.
   The overlay reuses the mega-menu's white-reveal + two-span close idiom.
   ────────────────────────────────────────────────────────────────────────── */
.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(17, 29, 41, 0.18);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  padding: 0;
  transition: background var(--duration-base) var(--ease), color var(--duration-base) var(--ease), transform var(--duration-base) var(--ease);
}
.search-toggle:hover {
  background: var(--color-text);
  color: #fff;
  transform: translateY(-2px);
}
.search-toggle svg { display: block; }

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(17, 29, 41, 0.18);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease);
}
.search-overlay.open { opacity: 1; }
.search-overlay-inner {
  position: relative;
  background: #fff;
  padding: 96px var(--gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}
.kave-search-form {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  border-bottom: 1px solid var(--color-line);
}
.kave-search-form input[type="search"] {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 24px;
  color: var(--color-text);
  padding: 12px 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.kave-search-form input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.kave-search-form button[type="submit"] {
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  padding: 8px;
  display: flex;
}
.kave-search-form button[type="submit"] svg { width: 22px; height: 22px; }
.search-close {
  position: relative;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex: none;
}
.search-close span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 1.5px;
  background: var(--color-text);
}
.search-close span:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.search-close span:last-child { transform: translate(-50%, -50%) rotate(-45deg); }

@media (max-width: 760px) {
  .search-toggle { width: 36px; height: 36px; }
  .search-overlay-inner { padding: 80px var(--gutter); gap: 16px; }
  .kave-search-form input[type="search"] { font-size: 19px; }
}
