/* Homepage scroll story. Native Elementor text and controls remain editable. */
html.tcs-hero-pending body:not(.elementor-editor-active) .tcs-first:not(.tcs-home-detail) .tcs-hero > :is(.tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry) {
  visibility: hidden;
  opacity: 0 !important;
  transition: none !important;
}

.tcs-first:not(.tcs-home-detail) .tcs-hero {
  position: relative !important;
  top: auto !important;
  /* Keep the oversized background inside the hero, including reduced motion. */
  overflow: clip !important;
}

.tcs-first:not(.tcs-home-detail) .tcs-hero::before {
  /* Elementor also owns .e-con::before for its optional overlay. Explicitly
     create our image layer; its unset --background-overlay otherwise hides it. */
  content: '';
  display: block;
  position: absolute;
  inset: -2%;
  width: auto;
  height: auto;
  border: 0;
  z-index: -2;
  background-image: inherit;
  background-position: inherit;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 1;
  mix-blend-mode: normal;
  pointer-events: none;
  transform: none;
  will-change: auto;
}

.tcs-homepage-hero-track {
  position: relative;
  width: 100%;
  flex: none;
  overflow: visible;
  /* Dynamic form contents must not become browser scroll-anchoring targets. */
  overflow-anchor: none;
}

/* The first section carries its back-to-top control as it rises over the hero. */
.tcs-first .tcs-hero-followup {
  overflow: visible !important;
  /* Keep sibling sections in DOM paint order as they cover this section. */
  z-index: auto;
}

.tcs-first .tcs-hero-followup .tcs-hero-return {
  position: absolute !important;
  top: -28px;
  left: 50%;
  width: 56px !important;
  max-width: 56px !important;
  margin: 0 !important;
  transform: translateX(-50%);
  z-index: 2;
}

.tcs-first .tcs-hero-return .elementor-button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
  width: 56px;
  height: 56px;
  padding: 0 !important;
  border: 6px solid #f4f9fc !important;
  border-radius: 50% !important;
  background: #0b6fa8 !important;
  color: #fff !important;
  box-shadow: none !important;
  transform: none !important;
}

.tcs-first .tcs-hero-return .elementor-button::before {
  content: '';
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(2px) rotate(45deg);
}

.tcs-first .tcs-hero-return .elementor-button-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.tcs-first .tcs-hero-return .elementor-button:hover {
  background: #0a2f47 !important;
}

.tcs-first .tcs-hero-return .elementor-button:focus-visible {
  outline: 3px solid #0a2f47;
  outline-offset: 3px;
}

.tcs-homepage-hero-track.is-pinned {
  height: calc(var(--tcs-hero-viewport, 100vh) * 14);
}

.tcs-first .tcs-homepage-hero-track.is-pinned > .tcs-hero {
  position: sticky !important;
  top: var(--tcs-hero-stage-top, 0px) !important;
  height: var(--tcs-hero-stage-height, 100vh) !important;
  min-height: var(--tcs-hero-stage-height, 100vh) !important;
  box-sizing: border-box;
  overflow: hidden !important;
}

/* Overlap native Elementor scenes only in the enhanced stage. Grid measures the
   taller scene, so the fit check does not add the two scene heights together. */
.tcs-first .tcs-homepage-hero-track.is-pinned > .tcs-hero,
.tcs-first .tcs-hero.is-image-scroll-measuring {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  align-content: end;
  gap: 0 !important;
}

.tcs-homepage-hero-track.is-pinned .tcs-hero > :is(.tcs-hero-copy, .tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry),
.tcs-hero.is-image-scroll-measuring > :is(.tcs-hero-copy, .tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry) {
  grid-area: 1 / 1;
  align-self: end;
  width: 100%;
  min-width: 0;
}

.tcs-first .tcs-hero-booking-panel {
  max-width: 900px;
  justify-self: center;
  align-self: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px #0a2f4726;
}

.tcs-first .tcs-hero-story-scene { max-width: 760px; }
.tcs-first .tcs-hero-scene-number {
  display: inline-block;
  padding: 5px 8px;
  margin-right: 8px;
  border-radius: 6px;
  background: #0b6fa8;
  color: #fff;
  letter-spacing: 0;
}

.tcs-first .tcs-hero-booking-point p { margin: 0; }
.tcs-first .tcs-hero-booking-scope { gap: 4px !important; }

.tcs-homepage-hero-track.is-pinned .tcs-hero > :is(.tcs-hero-copy, .tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry) {
  opacity: var(--tcs-scene-opacity, 0);
  transform: translate3d(0, var(--tcs-scene-y, 0px), 0);
  transition: opacity 160ms ease-out, transform 220ms ease-out;
}

.tcs-homepage-hero-track.is-pinned [inert] { pointer-events: none; }

/* Opacity can still be mid-transition when the initial loading guard is
   released. Inactive scenes must not paint at all, even during that hand-off. */
.tcs-homepage-hero-track.is-pinned .tcs-hero > :is(.tcs-hero-copy, .tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry)[inert] {
  visibility: hidden;
}

.tcs-hero.is-image-scroll-measuring > :is(.tcs-hero-copy, .tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry) {
  transform: none !important;
  transition: none !important;
}

/* The existing photograph is inherited from its editable Elementor background.
   A 2% overscan already exists in design.css, preventing exposed edges at p=0.
   Only this decorative layer moves; text and the dark overlay stay stationary. */
.tcs-first .tcs-hero.is-image-scroll-active::before {
  transform: translate3d(var(--tcs-hero-x, 1%), var(--tcs-hero-y, 0%), 0)
             scale(var(--tcs-hero-scale, 1.04));
  transform-origin: 58% 55%;
  will-change: transform;
  /* Brief interpolation softens discrete wheel steps without changing scroll. */
  transition: transform 180ms ease-out;
}

/* Decorative overscan must not be mistaken for overflowing text during resize. */
.tcs-first .tcs-hero.is-image-scroll-measuring::before {
  inset: 0 !important;
  transform: none !important;
  transition: none !important;
}

@media (max-width: 767px) {
  .tcs-first .tcs-hero-booking-panel { gap: 12px !important; }
  .tcs-first .tcs-hero-booking-scope,
  .tcs-first .tcs-hero-booking-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px !important;
  }
  .tcs-first .tcs-hero-booking-actions .elementor-widget-button {
    width: 100% !important;
    max-width: none !important;
  }
  .tcs-first .tcs-hero-booking-actions .elementor-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 12px 8px !important;
  }
}

/* Touch/tablet layouts and motion preferences restore normal reading order
   immediately, including while the controller catches up to a breakpoint. */
@media (max-width: 1024px), (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .tcs-homepage-hero-track.is-pinned { height: auto; }
  .tcs-first .tcs-homepage-hero-track.is-pinned > .tcs-hero {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    min-height: 100svh !important;
    overflow: clip !important;
    display: flex !important;
    gap: 32px !important;
  }
  .tcs-first .tcs-hero.is-image-scroll-active::before {
    transform: none !important;
    will-change: auto;
  }
  .tcs-homepage-hero-track.is-pinned :is(.tcs-hero-copy, .tcs-hero-story-scene, .tcs-hero-booking-panel, .tcs-hero-enquiry) {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto;
  }
}
