/* ============================================================
   HERO — splash, oversized type, image entrance, spotlight
   Preserves the reference hero's composition and interactions.
   ============================================================ */

/* ===== Splash: 10 accent panels split vertically ===== */

.splash {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: var(--z-splash);
  pointer-events: none;
  overflow: hidden;
  animation: splashHide 0.3s ease forwards;
  animation-delay: 1.35s;
}

.splash-row {
  display: flex;
  width: 100%;
  height: 50%;
}

.splash-box {
  width: 20%;
  height: 100%;
  background: var(--c-accent);
}

.splash-row-top .splash-box {
  animation: splashTop 1s cubic-bezier(0.96, -0.02, 0.38, 1.01) forwards;
}

.splash-row-bottom .splash-box {
  animation: splashBottom 1s cubic-bezier(0.96, -0.02, 0.38, 1.01) forwards;
}

.splash-box:nth-child(1) { animation-delay: 0s; }
.splash-box:nth-child(2) { animation-delay: 0.05s; }
.splash-box:nth-child(3) { animation-delay: 0.1s; }
.splash-box:nth-child(4) { animation-delay: 0.15s; }
.splash-box:nth-child(5) { animation-delay: 0.2s; }

@keyframes splashTop {
  from { transform: translateY(0%); }
  to { transform: translateY(-100%); }
}

@keyframes splashBottom {
  from { transform: translateY(0%); }
  to { transform: translateY(100%); }
}

@keyframes splashHide {
  to { opacity: 0; visibility: hidden; }
}

/* Failsafe: JS removes the splash from the flow once it has played,
   so a failed animation can never permanently block the page. */
.splash.is-done {
  display: none;
}

/* ===== Entrance animations ===== */

@keyframes heroImageIn {
  from { opacity: 0; transform: scale(1.5) rotate(3deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.hero-image-animate {
  opacity: 0;
  animation: heroImageIn 1.2s var(--ease-smooth) forwards;
  animation-delay: 1s;
}

@keyframes creatorSlideUp {
  from { transform: translateY(330px); }
  to { transform: translateY(0); }
}

.creator-text-animate {
  transform: translateY(330px);
  animation: creatorSlideUp 1s var(--ease-expressive) forwards;
  animation-delay: 1.5s;
}

@keyframes fadeUpSoft {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Hero shell ===== */

.hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--c-bg);
  min-height: 100vh;
}

@media (min-width: 768px) {
  .hero {
    height: 100vh;
    min-height: 800px;
  }
}

/* Oversized name sitting behind the image. The font size is measured and
   set by JS so any length spans the viewport; the value below is only a
   sensible starting point before that runs. */
.hero-big-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
  width: 100%;
  text-align: center;
}

.hero-big-text span {
  /* inline-block so the box shrink-wraps the glyphs — as a block it would
     report the container's width and the fit below could never scale. */
  display: inline-block;
  font-weight: 500;
  color: var(--c-dark);
  /* Tall enough for the "y" descender, so the whole name stays visible
     rather than bleeding off the bottom of the hero. */
  line-height: 1.05;
  letter-spacing: -0.04em;
  white-space: nowrap;
  font-size: 17vw;
}

/* "Hello, I'm" greeting stacked above the name, over the photo. The
   greeting word rotates through languages (see hero.js). */
.hero-greeting {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--hero-text-space, 22vh) + 8px);
  z-index: var(--z-hero-content);
  pointer-events: none;
  padding: 0 var(--gutter);
  text-align: center;
  font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  opacity: 0;
  animation: fadeUpSoft var(--dur-slow) var(--ease-smooth) forwards;
  animation-delay: 1.9s;
}

/* Plain inline text (not inline-block): an atomic box would add a line
   break opportunity before the comma and strand ", I'm" on its own line. */
.hero-greeting-word {
  transition: opacity 0.35s var(--ease-smooth);
}

.hero-greeting-suffix {
  white-space: nowrap;
}

.hero-greeting-word.is-out {
  opacity: 0;
}

.hero-base-img,
.hero-reveal-img {
  position: absolute;
  top: calc(14vh - 5px);
  left: 0;
  right: 0;
  /* Cleared above the oversized name (measured by JS into
     --hero-text-space) so the photo's silhouette never cuts across the
     letters — the two sit stacked, not layered. */
  bottom: calc(var(--hero-text-space, 30vh) + 12px);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom center;
}

@media (min-width: 768px) {
  .hero-base-img,
  .hero-reveal-img {
    top: calc(6vh - 5px);
    bottom: calc(var(--hero-text-space, 22vh) + 24px);
    background-position: bottom center;
  }
}

.hero-base-img {
  z-index: 5;
}

/* Spotlight layer. The mask is a CSS radial-gradient whose centre is
   driven by two custom properties — far cheaper than re-encoding a
   canvas every frame, with the same soft-edged result. */
.hero-reveal-img {
  z-index: 7;
  pointer-events: none;
  --spot-x: -999px;
  --spot-y: -999px;
  --spot-r: 260px;
  -webkit-mask-image: radial-gradient(
    circle var(--spot-r) at var(--spot-x) var(--spot-y),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 40%,
    rgba(0, 0, 0, 0.75) 60%,
    rgba(0, 0, 0, 0.4) 75%,
    rgba(0, 0, 0, 0.12) 88%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: radial-gradient(
    circle var(--spot-r) at var(--spot-x) var(--spot-y),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 40%,
    rgba(0, 0, 0, 0.75) 60%,
    rgba(0, 0, 0, 0.4) 75%,
    rgba(0, 0, 0, 0.12) 88%,
    rgba(0, 0, 0, 0) 100%
  );
  will-change: mask-image;
}

/* No hover on touch devices — hide the layer rather than leave it
   half-masked or invisible-but-present. */
.hero-reveal-img[hidden],
body.no-spotlight .hero-reveal-img {
  display: none;
}

.hero-content {
  position: relative;
  z-index: var(--z-hero-content);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 110px var(--gutter) var(--sp-3);
  pointer-events: none;
}

@media (min-width: 768px) {
  .hero-content {
    position: absolute;
    inset: 0;
    justify-content: space-between;
    /* Bottom padding clears the oversized name; JS sets the custom
       property from the text's measured height. */
    padding: 150px var(--gutter) calc(var(--hero-text-space, 100px) + 1.5rem);
  }
}

/* Scroll cue pinned to the hero's lower-right edge on desktop. */
.hero-meta {
  display: none;
  pointer-events: auto;
  width: 100%;
  justify-content: flex-end;
  align-items: flex-end;
  gap: var(--sp-4);
  opacity: 0;
  animation: fadeUpSoft var(--dur-slow) var(--ease-smooth) forwards;
  animation-delay: 1.6s;
}

@media (min-width: 900px) {
  .hero-meta {
    display: flex;
  }
}

.hero-scroll {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-meta);
  letter-spacing: var(--ls-meta);
  text-transform: uppercase;
  color: var(--c-dark);
}

.hero-scroll svg {
  animation: nudge 2s var(--ease-smooth) infinite;
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* ===== Reduced motion: show everything immediately ===== */
@media (prefers-reduced-motion: reduce) {
  html:not(.force-motion) .splash {
    display: none;
  }

  html:not(.force-motion) .splash-box {
    animation: none !important;
  }

  html:not(.force-motion) .hero-image-animate,
  html:not(.force-motion) .creator-text-animate,
  html:not(.force-motion) .hero-greeting,
  html:not(.force-motion) .hero-meta {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    visibility: visible !important;
  }

  html:not(.force-motion) .hero-reveal-img {
    display: none;
  }

  html:not(.force-motion) .hero-scroll svg {
    animation: none !important;
  }
}
