/* ==========================================================================
   Site header + mobile menu (shared for marketing pages)
   ========================================================================== */

/* Header height for layout (sibling section uses .header-offset for padding-top) */
:root {
  --header-height: 120px;
}

@media (max-width: 1200px) {
  :root {
    --header-height: 104px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 76px;
  }
}

.header-scrolled header {
  --header-height: 80px;
}

.header-scrolled .header-nav-link {
  font-size: 18px;
}

.header-scrolled .header-logo {
  width: 7vw;
}

/* --------------------------------------------------------------------------
   Mobile menu backdrop
   -------------------------------------------------------------------------- */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .mobile-menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Header base
   -------------------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  height: var(--header-height);
  margin-bottom: calc(-1 * var(--header-height));
  background: transparent;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    height 0.1s ease;
}

/* Sibling section: padding-top matches header height so content starts below sticky header */
.header-offset {
  padding-top: var(--header-height);
}

body.menu-open header {
  position: sticky;
  top: 0;
  background: #fff !important;
}

body.header-scrolled header {
  background: #ffffffd9;
  box-shadow: 0 4px 100px 0 #e4e0e0;
  border-bottom: 1px solid var(--color-light-gray);
}

.admin-editing header {
  top: 48px;
}

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */
.header-logo {
  width: 10vw;
  min-width: 80px;
  max-width: 140px;
  transition: width 0.1s ease;
}

.header-logo img {
  max-width: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Nav container + links (desktop)
   -------------------------------------------------------------------------- */
.header-nav-container {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

header nav {
  display: flex;
  flex: 1;
  gap: 40px;
  justify-content: flex-end;
  align-items: center;
}

header nav .header-nav-link-container {
  flex: 1;
  display: flex;
  gap: 40px;
  justify-content: flex-end;
  align-items: center;
}

.header-nav-link {
  font-weight: 500;
  font-size: 20px;
  color: var(--color-text-primary);
  text-decoration: none;
}

#header-auth-link {
  color: var(--color-deep-charcoal);
  border-color: var(--color-deep-charcoal);
}

.header-nav-link:hover {
  opacity: 0.8;
}

/* Auth link (login/app) */
header .button-outline {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Mobile toggle (checkbox + label + icons)
   -------------------------------------------------------------------------- */
header input[type="checkbox"] {
  display: none;
}

.header-nav-toggle-label {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
}

#header-nav-toggle-icon-close {
  display: none;
}

header.menu-open #header-nav-toggle-icon-open {
  display: none;
}

header.menu-open #header-nav-toggle-icon-close {
  display: block;
}

/* --------------------------------------------------------------------------
   Desktop: hide toggle
   -------------------------------------------------------------------------- */
@media (min-width: 769px) {
  header .header-nav-toggle-label {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Mobile: menu open state (body/header) + dropdown
   -------------------------------------------------------------------------- */

body.menu-open .header-nav-container nav .header-nav-link-container {
  background: #fff;
  padding: 8px 16px 16px 16px;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: 0 4px 100px 0 #e4e0e0;
}

body.menu-open .header-nav-container nav .header-nav-link {
  color: var(--color-deep-charcoal);
}

body.menu-open .header-nav-container .button-outline {
  color: var(--color-deep-charcoal);
  border-color: var(--color-deep-charcoal);
}

body.menu-open header .header-nav-toggle-label {
  position: relative;
  z-index: 1002;
}

/* --------------------------------------------------------------------------
   Mobile: dropdown layout (collapsed by default)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  header {
    padding: 24px 16px;
  }

  .header-nav-link-container {
    position: fixed;
    top: 76px;
    left: 0;
    width: 100vw;
    height: 0;
    padding-left: 40px;
    padding-right: 40px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 48px;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    box-shadow: 0 4px 100px 0 #e4e0e0;
    background: transparent;
    pointer-events: none;
    transition: background-color 0.3s ease;
  }

  header.menu-open .header-nav-link-container {
    height: auto;
    padding-top: 48px;
    padding-bottom: 48px;
    pointer-events: auto;
    background: #fff;
  }

  .header-nav-link {
    font-size: 20px;
    font-weight: 500;
    color: var(--color-deep-charcoal);
  }
}

@media (max-width: 1200px) {
  .header-nav-link {
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  .header-nav-link {
    font-size: 16px;
  }
}
