/* The full-bleed two-photo hero, its sentence (three short lines on touch screens), and the scroll cue. */

.hero {
  position: relative;
  z-index: 0; /* Own stacking context, so the photo halves stay behind the content */
  box-sizing: border-box;
  height: 100vh;
  height: 100svh; /* the height a phone shows with its toolbars out */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* The background is two halves of one photo, rejoined without a seam: the
   left image fills the left half and the right image the right. Each covers
   its half and is anchored to its cut edge, so the crops meet cleanly on the
   center line. They are <img>s (not CSS backgrounds) so the browser finds
   them in the HTML at once and picks the size the screen needs. */
.hero-half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: -1; /* Behind the intro and the scroll cue */
}

.hero-left {
  left: 0;
}

.hero-right {
  right: 0;
}

.hero-half img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-left img {
  object-position: right center; /* The cut edge meets the center seam */
}

.hero-right img {
  object-position: left center; /* The cut edge meets the center seam */
}

/* Portrait or half-screen windows (width ≤ height): drop the right half and
   let the left crop fill the hero. index.html's <source media> matches this.
   The caption moves to the lower third, off the face. */
@media (max-aspect-ratio: 1 / 1) {
  .hero {
    justify-content: flex-end;
    padding-bottom: 16svh;
  }

  .hero-left {
    width: 100%;
  }

  .hero-left img {
    object-position: center center;
  }

  .hero-right {
    display: none;
  }
}

.scroll-cue {
  position: absolute;
  bottom: calc(2rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  opacity: 0;
  animation:
    cueFadeIn var(--cue-fade) ease forwards,
    bounce var(--bounce-period) ease-in-out infinite;
  animation-delay: var(--cue-delay), var(--cue-delay);
}

.scroll-cue svg {
  width: 30px;
  height: 30px;
  display: block;
}

@keyframes cueFadeIn {
  to {
    opacity: 0.85;
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(10px);
  }
}

/* The heading holds two forms of the intro, and the device shows one: with a
   mouse, the sentence as a mailto link; on touch screens, three short lines.
   The (hover) split matches the card zoom in projects.css. */
.intro-heading {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 400;
  text-align: center;
  color: var(--white);
}

.intro {
  color: inherit;
  text-decoration: none;
}

.intro strong {
  font-weight: 700;
}

/* With a mouse: one row, bare over the photo, and one continuous ink rectangle
   behind it on hover or keyboard focus, which signals the link. No transition,
   so the bar appears and disappears at once. */
@media (hover: hover) {
  /* As a flex box the heading has no line box of its own, so the link inside
     keeps exactly its layout. */
  .intro-heading {
    display: flex;
  }

  /* Shrink-to-fit, so the bar hugs the text rather than the full width. At
     max-width 92vw the sentence stays on one row on a desktop screen and wraps
     only in narrow windows. The padding is the bar's clearance, reserved even
     without hover so the text never shifts. */
  .intro {
    display: inline-block;
    box-sizing: border-box;
    max-width: 92vw;
    padding: 0.35rem 0.85rem;
    line-height: 1.5;
  }

  .intro:hover,
  .intro:focus-visible {
    background-color: var(--ink);
  }

  .intro-lines {
    display: none;
  }
}

/* On touch screens, where nothing hovers: the name, the two disciplines, and
   the place, one per line, each on its own ink bar so it reads over any part of
   the photo, centered and evenly spaced. There is no link here; the mail icon in
   the social row is the way to the email. */
@media (hover: none) {
  .intro {
    display: none;
  }

  .intro-lines {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
  }

  /* The name keeps the hero size. The other two lines take the smallest step:
     at 12px the longest, 46 characters, is 338px wide with its bar, so it fits
     on one line from a 360px phone up; narrower screens wrap it inside its bar. */
  .intro-line {
    padding: 0.3em 0.6em;
    background: var(--ink);
    font-size: var(--text-xs);
    line-height: 1.5;
  }

  .intro-name {
    font-size: inherit;
  }

  /* Tablets have room for every line at the hero size; a phone held
     sideways is as wide, but keeps the smaller lines to fit below the faces. */
  @media (min-width: 700px) and (min-height: 501px) {
    .intro-line {
      font-size: inherit;
    }
  }
}

/* Phones held sideways (touch, 500px tall or less): the faces fill the
   upper half, so the lines sit low, just above the scroll cue. */
@media (hover: none) and (max-height: 500px) {
  .hero {
    justify-content: flex-end;
    padding-bottom: calc(4.5rem + var(--safe-bottom));
  }
}

.intro-heading {
  opacity: 0;
  animation: fadeIn var(--intro-fade) ease forwards;
  animation-delay: var(--intro-delay);
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}
