.header {
  position: fixed;
  top: var(--header-top);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 120px);
  max-width: 1600px;
  z-index: 1000;
  transition: top 0.3s ease;
}

.header__nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height-desktop);
  padding: 10px 12px 10px 30px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow: 0 0 9px 0 rgba(57, 49, 49, 0.15);
  transition: background var(--transition), border-radius var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header__logo-img--white {
  display: none;
}

.header__menu {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  height: 50px;
}

.header__menu-link {
  display: flex;
  align-items: center;
  gap: 0.35em;
  height: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-black);
  white-space: nowrap;
  transition: background-color var(--transition);
}

.header__menu-link:hover,
.header__menu-link[aria-current="page"],
.header__menu-link.is-active,
.header__mega-trigger:hover .header__menu-link {
  background-color: #fff;
  color: #FC0008;
}

.header__menu-brand {
  text-transform: uppercase;
}

.header__right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header__actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.header__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.28px;
  white-space: nowrap;
  transition: var(--transition);
  cursor: pointer;
}

.header__btn--ghost {
  height: 36px;
  background: transparent;
  border: 1px solid var(--color-dark);
  color: var(--color-dark);
}

.header__btn--ghost:hover {
  background: var(--color-dark);
  color: var(--color-white);
}

.header__btn--primary {
  height: 36px;
  background: var(--color-primary);
  border: none;
  color: var(--color-white);
}

.header__btn--primary:hover  { background: var(--color-primary-hover); }
.header__btn--primary:active { background: var(--color-primary-active); }

.header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  flex-shrink: 0;
}

.header__burger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-dark);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

.header__mobile-menu {
  display: none;
}

/* ========== MEGA MENU (desktop only) ========== */

.header__mega {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.header__mega.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Panel wrapper — frosted glass */
.header__mega-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 340px;
  backdrop-filter: blur(72px);
  -webkit-backdrop-filter: blur(72px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e7ebf0;
  border-radius: 16px;
  box-shadow: 0px 24px 54px 0px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Divider 1px between columns */
.header__mega-divider {
  width: 1px;
  flex-shrink: 0;
  align-self: stretch;
  background: #e7ebf0;
}

/* ── Column base ── */
.header__mega-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Col 1 — tabs */
.header__mega-col--tabs {
  flex-shrink: 0;
  width: 302px;
  padding: 32px 20px 32px 32px;
}

/* Col 2 — series left + photo right */
.header__mega-col--series {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  flex-direction: row;   /* override column from .header__mega-col */
  align-items: stretch;
  gap: 32px;
}

/* Left: label + panels */
.header__mega-series-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Right: photo img directly */
.header__mega-photo-img {
  display: block;
  width: 540px;
  height: 380px;
  flex-shrink: 0;
  border-radius: 12px;
  object-fit: cover;
  align-self: flex-start;
}

/* ── Column label ── */
.header__mega-label {
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0;
  flex-shrink: 0;
}

/* ── Category tabs ── */
.header__mega-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header__mega-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.4);
  transition: background var(--transition);
}

.header__mega-tab:hover,
.header__mega-tab.is-active {
  background: #fff;
}

.header__mega-tab-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.header__mega-tab-name {
  font-size: 16px;
  font-weight: 700;
  color: #1c1c1e;
  line-height: 1.2;
  transition: color var(--transition);
}

.header__mega-tab-desc {
  font-size: 14px;
  font-weight: 400;
  color: #4b5563;
  line-height: 1.3;
}

.header__mega-tab-arrow {
  flex-shrink: 0;
  color: #c0c8d0;
  transition: color var(--transition);
}

.header__mega-tab:hover .header__mega-tab-name,
.header__mega-tab.is-active .header__mega-tab-name {
  color: var(--color-primary);
}

.header__mega-tab:hover .header__mega-tab-arrow,
.header__mega-tab.is-active .header__mega-tab-arrow {
  color: var(--color-primary);
}

/* ── Series panels ── */
/* CSS grid with exactly 2 columns (max). minmax(0, 1fr) lets columns
   shrink below their content's intrinsic width, so the panel can never
   push beyond the available space inside .header__mega-series-left
   (which is itself flex:1 / min-width:0 next to the fixed-width photo). */
.header__mega-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  align-content: flex-start;
  gap: 16px 32px;
  min-width: 0;
}

.header__mega-panel.is-active {
  display: grid;
}

.header__mega-series-item {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: #111;
  text-decoration: none;
  line-height: 1.43; /* ~20px */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}

.header__mega-series-item:hover {
  color: var(--color-primary);
}

/* Featured series (e.g. SUPER NORDIC) — red + bold */
.header__mega-series-item--featured {
  color: var(--color-primary);
  font-weight: 700;
}


/* ≤1500px: hide nav, show burger next to buttons */
@media (max-width: 1500px) {
  .header__mega {
    display: none;
  }

  .header {
    width: calc(100% - 80px);
  }

  .header__menu {
    display: none;
  }

  .header__burger {
    display: flex;
  }

  .header__mobile-menu {
    display: block;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease;
  }

  .header--open .header__mobile-menu {
    max-height: 100vh;
  }

  /* Open: only animate burger lines, keep light header style */
  .header--open .header__nav {
    border-radius: 16px 16px 0 0;
  }

  .header--open .header__burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .header--open .header__burger-line:nth-child(2) {
    opacity: 0;
  }

  .header--open .header__burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Dropdown */
  .header__mobile-inner {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 16px 16px 20px;
    background: var(--color-bg-2);
    border-radius: 0 0 16px 16px;
  }

  .header__mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .header__mobile-item {
    width: 100%;
  }

  .header__mobile-link {
    display: flex;
    align-items: center;
    gap: 0.35em;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--color-white);
    border: none;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: var(--fs-small);
    font-weight: 400;
    color: var(--color-black);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--transition);
  }

  .header__mobile-link--accordion {
    justify-content: space-between;
  }

  .header__mobile-link:hover {
    background: var(--color-border);
  }

  .header__mobile-arrow {
    flex-shrink: 0;
    transition: transform var(--transition);
  }

  .header__mobile-link--accordion[aria-expanded="true"] .header__mobile-arrow {
    transform: rotate(180deg);
  }

  .header__mobile-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    padding-left: 12px;
    padding-top: 0;
  }

  .header__mobile-submenu[aria-hidden="false"] {
    max-height: 500px;
    padding-top: 6px;
  }

  .header__mobile-submenu-item + .header__mobile-submenu-item {
    margin-top: 4px;
  }

  .header__mobile-submenu-link {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    font-family: var(--font-primary);
    font-size: var(--fs-small);
    font-weight: 400;
    color: var(--color-black);
    transition: background-color var(--transition);
  }

  .header__mobile-submenu-link:hover {
    background: var(--color-border);
  }

  .header__mobile-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .header__mobile-actions .header__btn {
    width: 100%;
    height: 40px;
  }
}


/* ≤1023px: full-width bar */
@media (max-width: 1023px) {
  .header {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform: none;
  }

  .header__nav {
    height: var(--header-height-mobile);
    padding: 0 16px;
    border-radius: 0;
  }

  .header--open .header__nav {
    border-radius: 0;
  }

  .header__mobile-inner {
    border-radius: 0 0 8px 8px;
  }
}


/* ≤767px: hide buttons + red header when open */
@media (max-width: 767px) {
  .header__actions {
    display: none;
  }

  .header--open .header__nav {
    background: linear-gradient(to bottom, #ff4040, #fc0008);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: transparent;
    box-shadow: none;
  }

  .header--open .header__logo-img--dark {
    display: none;
  }

  .header--open .header__logo-img--white {
    display: block;
  }

  .header--open .header__burger-line {
    background: var(--color-white);
  }
}
