/* Shared Header - Top bar (icons) + Main nav */

/* Wrapper so the logo can overlap the top bar safely (also handles sticky together) */
.header-stack {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
}

/* ----- Top bar ----- */
.top-bar {
  width: 100%;
  background: var(--color-topbar);
  color: rgba(255, 255, 255, 0.92);
}

/* Full-bleed (matches footer; main content still uses --max-width) */
.top-bar-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0.6rem var(--page-gutter);
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0 1.25rem;
}

.top-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.85);
}

.top-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-size: 0.8125rem;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.top-bar-item:hover {
  color: white;
  text-decoration: none;
}

.top-bar-item .header-icon {
  color: var(--color-accent);
}

.top-bar-item__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.top-bar-whatsapp {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .top-bar-inner {
    justify-content: flex-start;
    padding: 0.6rem var(--page-gutter);
  }

  .top-bar-actions {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }

  .top-bar-item__text {
    max-width: 140px;
  }
}

@media (max-width: 480px) {
  .top-bar-item__text {
    max-width: 120px;
  }
}

/* ----- Main header ----- */
.site-header {
  width: 100%;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  position: relative;
}

.header-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0.4rem var(--page-gutter);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 84px;
  /* Let an oversized logo spill out without pushing nav around */
  position: relative;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: transform 0.2s;
  flex-shrink: 0;
  /* Allow logo to extend beyond the header height (out of box) */
  margin: -22px 0;
  z-index: 2;
}

.logo:hover {
  text-decoration: none;
  transform: scale(1.03);
}

.logo-image {
  display: block;
  height: clamp(86px, 8.5vw, 116px);
  width: auto;
  max-width: 360px;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(46, 50, 16, 0.18));
}

@media (max-width: 900px) {
  .logo-image {
    height: clamp(72px, 9vw, 92px);
    max-width: 290px;
  }
}

@media (max-width: 640px) {
  .header-inner {
    min-height: 68px;
  }

  .logo {
    margin: -14px 0;
  }

  .logo-image {
    height: 68px;
    max-width: 230px;
  }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0.5rem;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.2s;
}

.nav-toggle:hover {
  background: var(--color-bg);
}

.nav-toggle-bar {
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.main-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.2rem;
}

.main-nav a {
  display: inline-block;
  padding: 0.5rem 0.7rem;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.main-nav a:hover {
  color: var(--color-primary);
  background: rgba(107, 142, 35, 0.08);
}

.main-nav__secondary {
  opacity: 0.88;
  font-size: 0.9em;
}

.main-nav a.active {
  color: var(--color-primary);
  font-weight: 600;
  background: rgba(107, 142, 35, 0.1);
}

@media (max-width: 1024px) {
  .nav-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.75rem var(--page-gutter);
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    gap: 0.25rem;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: var(--shadow-md);
  }

  .main-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .main-nav a {
    padding: 0.75rem 1rem;
  }
}
