/* A failed or disabled script must never cover the page. */
.intro-screen { display: none; }

.intro-screen.is-active {
  position: fixed;
  z-index: 2147483647;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #1F2A3A;
  color: #F7F4EF;
  touch-action: none;
}

.intro-logo-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(340px, calc(100% - 48px));
}

.intro-logo-wrap::before {
  position: absolute;
  z-index: -1;
  width: min(640px, 190vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 122, 74, .08) 0%, rgba(176, 122, 74, .045) 30%, transparent 68%);
  content: "";
  pointer-events: none;
}

.intro-logo { display: block; width: 100%; height: auto; }

.intro-scroll {
  position: absolute;
  bottom: max(28px, 6vh, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  min-width: 64px;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: rgba(247, 244, 239, .7);
  font: 600 10px/1.2 "Montserrat", Arial, sans-serif;
  letter-spacing: .2em;
  text-align: center;
  transform: translateX(-50%);
  cursor: pointer;
}

.intro-chevron {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: #B07A4A;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Keyboard focus is always visible even if the cue is still fading in. */
.intro-screen:not(.is-exiting) .intro-scroll:focus-visible {
  opacity: 1 !important;
  outline: 2px solid #F7F4EF;
  outline-offset: 5px;
}

/* Fixed body prevents both touch scrolling and late native restoration moving
   the page under the overlay. There is no scroll-driven intro or spacer. */
html.intro-lock { overflow: hidden; overscroll-behavior: none; scroll-behavior: auto !important; }
html.intro-lock body { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.header-spacer { display: none; }

/* Only an initialized overlay turns the normal sticky header into a fixed one.
   The hero starts at document y=0 and contains the full header allowance. */
html.intro-enhanced .site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  transition: height .3s ease, box-shadow .3s ease;
}
html.intro-enhanced .hero-content {
  min-height: min(calc(730px + var(--header, 96px)), 100svh);
  padding-top: calc(var(--header, 96px) + clamp(64px, 7vw, 100px));
  padding-bottom: clamp(36px, 3.8vw, 64px);
}
/* The cue gets its own row instead of sitting on top of the photo/frame. */
.hero-content { row-gap: 24px; }
.hero-content .scroll-cue {
  position: static;
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 44px;
}
html.intro-enhanced.intro-header-hidden .site-header {
  transform: translateY(-100%);
  pointer-events: none;
}
html.intro-enhanced.intro-header-entering .site-header {
  animation: haro-intro-header-in .45s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes haro-intro-header-in {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@media (max-width: 800px) {
  /* Preserve a generous image at all viewport heights; the stacked hero can
     naturally extend below the fold rather than shrinking the photograph. */
  .hero-content { gap: 32px; padding-block: 24px 30px; }
  html.intro-enhanced .hero-content { min-height: 0; padding-top: calc(var(--header, 86px) + 24px); padding-bottom: 30px; }
  .hero-visual { width: min(100%, 600px); }
}
@media (max-width: 700px) {
  .intro-logo-wrap { width: min(240px, calc(100% - 48px)); }
  html.intro-enhanced .hero-content { padding-top: calc(var(--header, 76px) + 24px); }
}
@media (max-height: 400px) {
  /* Give the logo and reachable control distinct rows in short landscape
     windows and when browser zoom leaves very little vertical space. */
  .intro-screen.is-active { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 20px; }
  .intro-logo-wrap { flex: none; width: min(240px, calc(100vw - 48px), max(0px, calc((100svh - 88px) * 1.19149))); }
  .intro-scroll { position: static; flex: none; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html.intro-enhanced.intro-header-entering .site-header { animation: none; }
}
