/* ==========================================================================
   Header Component
   Sticky header, desktop nav, mobile hamburger menu
   ========================================================================== */

/* ---- Base header ---- */

/*
  Logo variants:
  - Default (light header): assets/images/Snack-Media-Logo-Black-small.png
  - For dark/hero sections:  assets/images/snack-media-logo.png (white version)
*/

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--z-header);
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-text);
  transition: box-shadow var(--transition-base);
  border-bottom: 1px solid var(--color-border);
}

:root[data-theme="dark"] .header {
  background-color: rgba(10, 10, 10, 0.9);
}

.header--scrolled {
  box-shadow: var(--shadow-md);
}

/* ---- Over hero/sub-hero: transparent header with white text ---- */
/* Applied on any page where the header sits over a full-bleed hero video */

.header.header--over-hero {
  background-color: transparent;
  border-bottom: none;
}

.header.header--over-hero .header__nav-link {
  color: var(--color-white);
}

.header.header--over-hero .header__toggle-bar {
  background-color: var(--color-white);
}

.header.header--over-hero .header__nav-link:hover,
.header.header--over-hero .header__nav-link.is-active,
.header.header--over-hero .header__nav-link[aria-current="page"] {
  color: var(--color-white);
}

.header.header--over-hero .header__nav-link::after {
  background-color: var(--color-white);
}

.header.header--over-hero .header__theme-toggle {
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.75);
  background: transparent;
}

.header.header--over-hero .header__theme-toggle:hover {
  border-color: var(--color-white);
  background: transparent;
}

@media (max-width: 1023px) {
  .header.header--over-hero .header__nav {
    background-color: transparent;
  }
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 90px;
  position: relative;
}

/* ---- Logo ---- */

.header__logo {
  position: absolute;
  left: var(--container-padding);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  z-index: 2;
}

.header__logo img {
  height: 22px;
  width: auto;
  margin-top: 3px;
  margin-left: -5px;
}

/* ---- Navigation ---- */

.header__nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.header__nav {
  margin-left: auto;
}

.header__nav-link {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--transition-fast);
  position: relative;
}

.header__nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-base);
}

.header__nav-link:hover {
  color: var(--color-primary);
}

.header__nav-link:hover::after {
  width: 100%;
}

.header__nav-link.is-active,
.header__nav-link[aria-current="page"] {
  color: var(--color-primary);
}

.header__nav-link.is-active::after,
.header__nav-link[aria-current="page"]::after {
  width: 100%;
}

/* ---- CTA button in header ---- */

.header__cta {
  margin-left: var(--space-xl);
}

.header__theme-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  margin-left: var(--space-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-primary) 8%);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.header__theme-toggle:hover {
  background-color: var(--color-surface-muted);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px) scale(1.02);
}

.header__theme-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

:root[data-theme="dark"] .header__theme-toggle {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(148, 163, 184, 0.45);
  color: #f8fafc;
}

:root[data-theme="dark"] .header__theme-toggle:hover {
  background: rgba(30, 41, 59, 0.98);
  border-color: rgba(125, 211, 252, 0.8);
}

/* ---- Hamburger toggle (hidden on desktop) ---- */

.header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  z-index: calc(var(--z-header) + 1);
}

.header__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  border-radius: var(--radius-full);
  transition:
    transform var(--transition-base),
    opacity var(--transition-base);
}

/* Hamburger → X animation when open */
.header__toggle[aria-expanded="true"] .header__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__toggle[aria-expanded="true"] .header__toggle-bar:nth-child(2) {
  opacity: 0;
}

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

/* ==========================================================================
   Mobile/Tablet styles — below 1024px
   ========================================================================== */

@media (max-width: 1023px) {
  .header__container {
    height: 74px;
  }

  .header__logo img {
    height: 26px;
  }

  .header__logo {
    position: relative;
    transform: none;
    z-index: calc(var(--z-header) + 2);
  }

  .header__nav {
    z-index: calc(var(--z-header) + 1);
  }

  /* Show hamburger */
  .header__toggle {
    display: flex;
  }

  /* Off-canvas nav */
  .header__nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100dvh;
    background-color: var(--color-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2xl);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    z-index: var(--z-header);
  }

  .header.header--over-hero .header__nav.is-open {
    background-color: var(--color-surface);
  }

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

  .header__nav-list {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .header__nav-link {
    font-size: var(--font-size-lg);
  }

  .header__cta {
    margin-left: 0;
  }

  .header__theme-toggle {
    width: 40px;
    height: 40px;
    margin-left: 0;
    margin-bottom: var(--space-sm);
  }

  .header__logo {
    position: relative;
    top: 0;
  }
}


/* ==========================================================================
   Desktop styles — 1024px+
   ========================================================================== */

@media (min-width: 1024px) {
  .header__nav {
    display: flex;
    align-items: center;
  }
}

