/* Match the header's content edges to the existing responsive shell. */
:root {
  --header: 80px;
  /* Includes the ticker's two one-pixel borders. Static labels can wrap taller. */
  --ticker-height: 74px;
}

.header-inner {
  width: min(100% - 112px, 1370px);
}

.site-header .logo-link {
  --header-logo-height: 45px;
  display: flex;
  align-items: center;
  width: auto;
  flex: 0 0 auto;
  padding: 6px 0;
  background: transparent;
}

.site-header .logo-link img {
  width: auto;
  height: var(--header-logo-height);
  max-height: calc(var(--header) - 24px);
  object-fit: contain;
  filter: none;
}

/* The header overlaps the hero (intro.css), so the first two main rows must
   together fill the viewport, not a viewport plus the header. The invisible
   spanning item reserves the viewport while the ticker's auto row measures
   its real height, including wrapped reduced-motion/no-JS labels. */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}

main::before {
  content: '';
  grid-column: 1;
  grid-row: 1 / 3;
  min-height: calc(100vh - var(--header) - var(--ticker-height));
  min-height: calc(100dvh - var(--header) - var(--ticker-height));
  margin-block: var(--header) var(--ticker-height);
  visibility: hidden;
  pointer-events: none;
}

.hero {
  grid-column: 1;
  grid-row: 1;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}

.intro-strip {
  grid-column: 1;
  grid-row: 2;
  min-height: var(--ticker-height);
}

/* The opening has an uninterrupted photo; once the header appears, move the
   image frame below it so the sticky bar does not hide the top of the photo. */
.hero-image {
  top: var(--header);
  transition: top .65s ease;
}

.opening-staging .hero-image {
  top: 0;
  transition: none;
}

/* If a slow image has not arrived, keep the dark hero visible and start the
   existing entrance only when the image is ready instead of popping it in. */
.hero-image.image-pending img {
  animation: none;
  opacity: 0;
}

.hero-image img {
  object-fit: cover;
  object-position: center 65%;
}

@media (prefers-reduced-motion: reduce) {
  .hero-image { transition: none; }
}

.hero-shade {
  background: linear-gradient(90deg, rgba(14,14,14,.82) 0%, rgba(14,14,14,.45) 45%, rgba(14,14,14,0) 75%);
}

.hero-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  /* Equal clearance keeps the copy centered below the overlapping header. */
  padding: calc(var(--header) + 48px) 0 48px;
}

.hero-eyebrow,
.hero h1,
.hero-copy {
  padding: 0;
  background: transparent;
  text-shadow: 0 2px 12px rgba(0,0,0,.35);
}

/* Preserve the legibility shadow while retaining the existing hover color. */
@media (hover: hover) and (pointer: fine) {
  .hero :is(.hero-eyebrow, h1, h1 em, .hero-copy):hover {
    text-shadow: 0 2px 12px rgba(0,0,0,.35);
  }
}

.hero-scroll {
  left: max(56px, calc((100% - 1370px) / 2));
  padding: 0;
  background: transparent;
  text-shadow: 0 2px 12px rgba(0,0,0,.35);
}

/* Keep the existing entrance, but avoid moving the actions over the cue. */
.reveal-ready .hero-buttons.motion-reveal.motion-from-up:not(.visible):not(:focus-within) {
  transform: translate3d(0, 12px, 0);
}

@media (max-width: 1250px) {
  .header-inner {
    width: calc(100% - 80px);
  }

  .site-header .logo-link {
    --header-logo-height: 39px;
  }

  .hero-scroll {
    left: 40px;
  }
}

@media (max-width: 700px) {
  :root {
    --header: 68px;
    --ticker-height: 68px;
  }

  /* Gently bridge the bright, image-only stage into the normal hero shade.
     The photograph and the final overlay remain unchanged. */
  .hero-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .65s ease;
  }

  .opening-staging .hero-image::after {
    opacity: .48;
    transition: none;
  }

  /* The stable mobile viewport avoids jumps as browser chrome expands. */
  main::before {
    min-height: calc(100svh - var(--header) - var(--ticker-height));
  }

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

  .site-header .logo-link {
    --header-logo-height: 30.5px;
    padding: 5px 0;
  }

  .hero-eyebrow {
    margin-bottom: 14px;
  }

  .hero-copy {
    margin: 16px 0 18px;
  }

  .hero-buttons {
    gap: 12px;
  }

  .hero-scroll {
    left: 21px;
  }
}

@media (max-width: 365px) {
  .site-header .logo-link {
    --header-logo-height: 26.5px;
  }

  .hero h1 {
    font-size: clamp(36px, 12vw, 46px);
  }
}

/* At very narrow widths, retain all header controls and allow the number to wrap. */
@media (max-width: 320px) {
  .site-header .logo-link {
    --header-logo-height: clamp(19px, calc(7.82vw - 2.72px), 27.9px);
    padding: 4px 0;
  }

  .header-actions {
    min-width: 0;
    gap: 3px;
  }

  .map-link,
  .social-link,
  .menu-toggle,
  .header-phone svg {
    flex-shrink: 0;
  }

  .header-phone {
    min-width: 0;
  }

  .header-phone span {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
  }
}

/* Make room for the copy and cue before letting an exceptionally short
   viewport grow: content must never be clipped to force a one-screen fit. */
@media (max-height: 600px) {
  .hero-content {
    padding: calc(var(--header) + 24px) 0 24px;
  }

  .hero-eyebrow { margin-bottom: 8px; }
  .hero h1 { font-size: clamp(38px, 5vw, 60px); }
  .hero-copy { line-height: 1.45; margin: 8px 0 12px; }
  .hero-scroll { bottom: 8px; }
}

@media (max-width: 700px) and (max-height: 700px) {
  .hero-content {
    padding: calc(var(--header) + 24px) 0 24px;
  }

  .hero-eyebrow { margin-bottom: 8px; letter-spacing: .1em; gap: 6px; }
  .hero h1 { font-size: clamp(32px, 10.5vw, 42px); }
  .hero-copy { font-size: 13px; line-height: 1.45; margin: 8px 0 12px; }
  .hero-buttons { width: 100%; gap: 8px; flex-wrap: nowrap; }
  .hero-buttons .button,
  .hero-buttons .text-link {
    min-width: 0;
    min-height: 44px;
    padding: 0 8px;
    gap: 8px;
    font-size: 10px;
  }
  .hero-scroll { bottom: 8px; }

  /* Keep every static label, with tighter spacing rather than clipping. */
  .intro-strip:not(.ticker-ready):not(.ticker-preparing) .ticker-group:first-child {
    padding: 10px 14px;
    row-gap: 5px;
    column-gap: 12px;
  }
}
