:is(#app[data-city-edition], [data-city-itinerary-detail]) {
  --city-header-height: var(--ctm-global-header-height, 76px);
  --city-header-on-hero: #fffdf9;
}

@media (max-width: 1024px) {
  :is(#app[data-city-edition], [data-city-itinerary-detail]) {
    --city-header-height: var(--ctm-global-header-height-compact, 64px);
  }
}

/* Extend the page's own hero image under the header and keep its content below the navigation. */
#app[data-city-edition] > .site-header + .city-hero {
  box-sizing: content-box;
  margin-block-start: calc(-1 * var(--city-header-height));
  padding-block-start: var(--city-header-height);
}

#app[data-city-edition] .city-hero__eyebrow > a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Let the city copy wrap without covering the actions at intermediate widths. */
@media (min-width: 481px) {
  #app[data-city-preview] > .city-hero {
    display: grid;
    height: auto;
  }

  #app[data-city-preview] .city-hero__inner {
    height: auto;
  }
}

@media (min-width: 769px) {
  #app[data-city-preview] > .city-hero {
    min-height: 300px;
  }
}

#app[data-city-edition] > .site-header:has(+ .city-hero) {
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
}

#app[data-city-edition] > .site-header:has(+ .city-hero)::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 -2rem;
  background: linear-gradient(to bottom, rgb(8 31 26 / 78%), rgb(8 31 26 / 66%) var(--city-header-height), transparent);
  content: '';
  pointer-events: none;
}

#app[data-city-edition] > .site-header:has(+ .city-hero) .site-header__inner :is(.brand, .site-nav > a, .header-actions > .icon-button, .header-site-search) {
  color: var(--city-header-on-hero);
}

#app[data-city-edition] > .site-header:has(+ .city-hero) .site-nav > a::after {
  background: currentColor;
}

#app[data-city-edition] > .site-header:has(+ .city-hero) .header-actions > .icon-button:hover {
  background: rgb(255 255 255 / 15%);
}

#app[data-city-edition] > .site-header:has(+ .city-hero) .site-header__inner :is(a, button):focus-visible {
  outline: 2px solid var(--city-header-on-hero);
  outline-offset: 3px;
}

[data-city-itinerary-detail] .site-header {
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
}

[data-city-itinerary-detail] .article-entry {
  margin-block-start: calc(-1 * var(--city-header-height));
  padding-block-start: var(--city-header-height);
  background: var(--ctm-surface);
}

@media print {
  [data-city-itinerary-detail] .article-entry {
    display: none;
  }
}

#app[data-city-edition] :is([id^="hotel-area-"], [id^="trip-"], [id^="itinerary-card-title-"]) {
  scroll-margin-block-start: calc(var(--city-header-height) + 1rem);
}
