/* Accepted intro from the Gemini review, with the original portal spacing. */
.intro {
  --intro-crest-width: clamp(4.75rem, 21vw, 11.25rem);
  --intro-gap: clamp(0.6rem, 2.5vw, 1.5rem);
  --portal-line-w: 2.5px;
  --portal-gutter: clamp(0.65rem, 2.3vw, 1.4rem);
  --intro-wordmark-width: clamp(8.25rem, 43vw, 22rem);
  --intro-rise: cubic-bezier(0.76, 0, 0.24, 1);
  --intro-settle: cubic-bezier(0.22, 1, 0.36, 1);
  /* Full lockup lands at 2.24s and holds for 0.5s before retracting at 2.74s. */
  --intro-retreat: 2740ms;
  position: fixed;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  max-block-size: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: var(--navy);
  overscroll-behavior: contain;
}

.intro::backdrop { background: transparent; }
.intro:not([open]), .detail-dialog:not([open]) { display: none; }

.intro-wash {
  position: absolute;
  inset: 0;
  background:
    var(--intro-veil),
    var(--intro-backdrop-url, url("assets/intro-backdrop-draft.webp")) center 54% / cover no-repeat;
  pointer-events: none;
}

.intro-stage {
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  display: grid;
  grid-template-columns: var(--intro-crest-width) calc(var(--portal-line-w) + var(--portal-gutter) + var(--intro-wordmark-width));
  gap: var(--intro-gap);
  align-items: center;
  pointer-events: none;
}

.intro-crest-seat {
  position: relative;
  display: grid;
  place-items: center;
}

.intro-crest-track {
  inline-size: 100%;
}

.intro-portal {
  position: relative;
  display: grid;
  grid-template-columns: var(--portal-line-w) var(--intro-wordmark-width);
  column-gap: var(--portal-gutter);
  align-items: center;
}

.intro-line {
  inline-size: var(--portal-line-w);
  border-radius: var(--pill);
  background: linear-gradient(180deg, #7F5E28 0%, #B9924A 48%, #775722 100%);
  box-shadow: 0 0 10px rgb(255 253 247 / 85%), 0 1px 4px rgb(10 34 57 / 22%);
  opacity: 0;
}

.intro-line-wheat {
  position: absolute;
  --line-x: -50%;
  inset: 0 auto 0 50%;
  translate: var(--line-x, 0px) var(--line-y, 0px);
}

.intro-line-portal {
  position: relative;
  --line-y: 0px;
  inset: auto;
  grid-column: 1;
  align-self: center;
  block-size: clamp(2.65rem, 7.2vw, 5.2rem);
  translate: var(--line-x, 0px) var(--line-y, 0px);
}

.intro-wordmark-window {
  grid-column: 2;
  margin-inline-start: 0;
  inline-size: 100%;
  overflow: hidden;
  clip-path: inset(0);
  padding-block: 0.22rem;
}

.intro-wordmark {
  inline-size: 100%;
  block-size: auto;
  filter: drop-shadow(0 1px 6px rgb(255 255 255 / 78%));
}

.intro .crest-wheat {
  filter: drop-shadow(0 2px 5px rgb(10 34 57 / 16%));
}

.intro .crest-monogram {
  filter: drop-shadow(0 1px 5px rgb(255 255 255 / 80%));
}

.intro .crest-dove {
  filter: drop-shadow(0 2px 5px rgb(10 34 57 / 28%));
}

.intro-actions {
  position: absolute;
  inset: auto max(1rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) auto;
  display: flex;
  gap: 0.6rem;
}

.intro-actions .button-outline {
  background: rgb(255 255 255 / 92%);
  border-color: var(--gold-deep);
  box-shadow: 0 4px 14px rgb(10 34 57 / 12%);
}

.intro-actions .button-primary {
  box-shadow: 0 4px 16px rgb(10 34 57 / 22%);
}

.intro-active #header-crest { opacity: 0; }

@property --wheat-sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@media (prefers-reduced-motion: no-preference) {
  .intro[open] .intro-line-wheat {
    animation:
      intro-rise 520ms var(--intro-rise) both,
      wheat-line-exit 380ms 520ms ease-out both;
  }

  .intro[open] .intro-line-portal {
    animation:
      intro-rise 520ms var(--intro-rise) both,
      portal-line-open 530ms 520ms var(--intro-settle) both,
      portal-line-close 380ms var(--intro-retreat) ease-out forwards;
  }

  .intro[open] .intro-crest-track {
    animation: intro-center-crest 380ms var(--intro-retreat) var(--intro-rise) both;
  }

  .intro[open] .crest-wheat {
    animation: intro-fade-in 650ms 520ms var(--intro-settle) both;
  }

  @supports (mask-image: conic-gradient(#000, transparent)) {
    .intro[open].has-wheat-sweep .crest-wheat {
      animation: intro-wheat 840ms 520ms ease-in-out both;
      mask-image: conic-gradient(from 180deg, #000 var(--wheat-sweep),
        transparent 0 calc(360deg - var(--wheat-sweep)), #000 0);
    }
  }

  .intro[open] .crest-monogram {
    animation: intro-fade-in 290ms 1360ms ease-out both;
  }

  .intro[open] .crest-dove {
    animation:
      intro-dove 590ms 1650ms var(--intro-settle) both,
      intro-dove-flap 295ms 1650ms steps(1, end) 2;
  }

  .intro[open] .intro-wordmark {
    animation:
      intro-wordmark-in 1500ms 660ms cubic-bezier(0.20, 0.65, 0.42, 1) both,
      intro-wordmark-out 380ms var(--intro-retreat) var(--intro-rise) forwards;
  }

  .intro-wash { transition: opacity 540ms ease-out; }
  .intro.is-docking .intro-wash { opacity: 0; }
}

@keyframes intro-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes intro-rise {
  from { translate: var(--line-x, 0px) calc(var(--line-y, 0px) + 65vh); opacity: 0; }
  18% { opacity: 1; }
  to { translate: var(--line-x, 0px) var(--line-y, 0px); opacity: 1; }
}

@keyframes wheat-line-exit {
  from { opacity: 1; scale: 1; }
  to { opacity: 0; scale: 1 0.62; }
}

@keyframes portal-line-open {
  from { opacity: 1; scale: 1 0.44; }
  to { opacity: 1; scale: 1; }
}

@keyframes portal-line-close {
  0%, 72% { opacity: 1; scale: 1; }
  to { opacity: 0; scale: 1 0.16; }
}

@keyframes intro-wheat {
  from { --wheat-sweep: 0deg; opacity: 0; }
  11% { opacity: 1; }
  to { --wheat-sweep: 180deg; opacity: 1; }
}

@keyframes intro-dove {
  from { transform: translate(45%, -50vh) scale(0.74); opacity: 0; }
  17% { opacity: 1; }
  78% { transform: translate(-4%, 4%) scale(1.04); }
  to { transform: translate(0) scale(1); opacity: 1; }
}

@keyframes intro-dove-flap {
  0%, 100% { background-position-x: 0%; }
  25% { background-position-x: 50%; }
  50% { background-position-x: 100%; }
  75% { background-position-x: 50%; }
}

@keyframes intro-wordmark-in {
  from { transform: translateX(-104%); opacity: 0; }
  14% { opacity: 1; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes intro-wordmark-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-104%); opacity: 0; }
}

@keyframes intro-center-crest {
  from { transform: translateX(0); }
  to {
    transform: translateX(
      calc((var(--intro-gap) + var(--portal-line-w) + var(--portal-gutter) + var(--intro-wordmark-width)) / 2)
    );
  }
}
