.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  background: #f7f9fc;
  border-bottom: 1px solid rgba(39, 48, 112, 0.08);
  box-shadow: 0 4px 24px rgba(39, 48, 112, 0.04);
}

@supports (
  (backdrop-filter: blur(20px)) or
  (-webkit-backdrop-filter: blur(20px))
) {
  .site-header {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: center;
  width: min(1140px, calc(100% - 64px));
  min-height: var(--header-height);
  margin-inline: auto;
}

.site-logo {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
}

.site-logo img {
  display: block;
  width: 150px;
  height: auto;
}

.main-menu {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.menu-list,
.submenu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-list {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.menu-item {
  --dropdown-width: min(320px, calc(100vw - 40px));
  --panel-height: 44px;
  position: relative;
  isolation: isolate;
  min-width: 0;
}

/* Společná plocha kapsle a podmenu. */
.menu-item::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 4px;
  left: -12px;
  width: 36px;
  height: 36px;
  border-radius: 22px;
  background: var(--paspoint-blue);
  opacity: 0;
  pointer-events: none;
  transition:
    left 750ms cubic-bezier(0.4, 0, 0.2, 1),
    top 750ms cubic-bezier(0.4, 0, 0.2, 1),
    width 750ms cubic-bezier(0.4, 0, 0.2, 1),
    height 650ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 300ms ease;
}

.menu-item.is-active::before,
.menu-item:focus-within::before {
  top: 0;
  left: 0;
  width: 100%;
  height: 44px;
  opacity: 1;
}

.menu-item.is-expanded {
  z-index: 20;
}

.menu-item.is-expanded::before {
  left: calc((100% - var(--dropdown-width)) / 2);
  width: var(--dropdown-width);
  height: var(--panel-height);
}

.menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--paspoint-blue);
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 24px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 350ms ease 200ms;
}

.menu-label {
  display: inline-block;
  text-align: center;
}

.menu-label::after {
  content: attr(data-label);
  display: block;
  height: 0;
  font-weight: 700;
  visibility: hidden;
  pointer-events: none;
}

.menu-item:is(.is-active, .is-expanded, :focus-within) > .menu-link {
  color: #fff;
  font-weight: 700;
}

.submenu {
  position: absolute;
  top: 44px;
  left: calc((100% - var(--dropdown-width)) / 2);
  width: var(--dropdown-width);
  max-height: calc(100dvh - var(--header-height) - 24px);
  padding: 8px 10px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 250ms ease,
    transform 400ms ease,
    visibility 0s linear 250ms;
}

.submenu[hidden] {
  display: none;
}

.menu-item.is-expanded > .submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity 350ms ease 350ms,
    transform 450ms ease 250ms,
    visibility 0s;
}

.submenu a {
  display: block;
  padding: 10px 12px;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  text-decoration: none;
  overflow-wrap: break-word;
}

.submenu a:hover,
.submenu a:focus-visible {
  font-weight: 700;
}

.site-header a:focus-visible,
.site-header button:focus-visible {
  outline: 2px solid var(--paspoint-blue);
  outline-offset: 3px;
  border-radius: 12px;
}

.submenu a:focus-visible {
  outline-color: #fff;
}

.menu-toggle {
  display: none;
}

@media (max-width: 1150px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    width: min(1140px, calc(100% - 40px));
  }

  .site-logo img {
    width: 140px;
  }

  /* Tlačítko: tři rovné čárky, po otevření kolečko s křížkem. */
  .menu-toggle:not([hidden]) {
    position: relative;
    isolation: isolate;
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--paspoint-blue);
    cursor: pointer;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 300ms ease;
  }

  .menu-toggle::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 50%;
    background: var(--paspoint-cyan);
    opacity: 0;
    transform: scale(0.65);
    transition:
      opacity 300ms ease,
      transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .menu-toggle[aria-expanded="true"] {
    color: #fff;
  }

  .menu-toggle[aria-expanded="true"]::before {
    opacity: 1;
    transform: scale(1);
  }

  /* Původní text zůstává v HTML, vizuálně se nepoužívá. */
  .menu-toggle > span:not(.menu-toggle-icon) {
    display: none;
  }

  .menu-toggle-icon {
    position: relative;
    display: block;
    width: 24px;
    height: 18px;
    font-size: 0;
    line-height: 0;
    pointer-events: none;
  }

  .menu-toggle-icon::before,
  .menu-toggle-icon::after,
  .menu-toggle-line {
    position: absolute;
    left: 0;
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform-origin: center;
    transition:
      top 350ms cubic-bezier(0.22, 1, 0.36, 1),
      transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 200ms ease;
  }

  .menu-toggle-icon::before,
  .menu-toggle-icon::after {
    content: "";
  }

  .menu-toggle-icon::before {
    top: 0;
  }

  .menu-toggle-line {
    top: 8px;
  }

  .menu-toggle-icon::after {
    top: 16px;
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon::before {
    top: 8px;
    transform: rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-line {
    opacity: 0;
    transform: scaleX(0);
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon::after {
    top: 8px;
    transform: rotate(-45deg);
  }

  .menu-toggle:focus-visible {
    border-radius: 50%;
  }

  .main-menu {
    grid-column: 1 / -1;
    grid-row: 2;
    max-height: calc(100dvh - var(--header-height));
    padding: 12px 4px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .main-menu[hidden] {
    display: none;
  }

  .menu-list {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .menu-item {
    --dropdown-width: 100%;
  }

  .menu-link {
    justify-content: center;
    width: 100%;
    padding-inline: 16px;
  }

  .menu-label {
    text-align: center;
  }

  .menu-item.is-expanded::before {
    left: 0;
    height: 100%;
  }

  .submenu {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  .has-submenu:not(.is-expanded) > .submenu {
    position: absolute;
    left: 0;
  }

  .submenu a {
    padding: 12px;
  }

  .site-header:has(.menu-toggle[hidden]) {
    position: static;
    margin-top: calc(-1 * var(--header-height));
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-link,
  .menu-item::before,
  .submenu,
  .menu-item.is-expanded > .submenu {
    transition: none;
    transform: none;
  }

  .menu-toggle,
  .menu-toggle::before,
  .menu-toggle-icon::before,
  .menu-toggle-icon::after,
  .menu-toggle-line {
    transition: none;
  }
}