/* NO PERRY — Hero Copy Reveal (23A5)
   Letter formation → Welcome-owned gap → FLIP morph into #hero-title.
   Autonomous from Chibi. No hold/freeze waiting for chase.
   SECOND_REVEAL terminal geometry === FINAL_STATIC. No letter-spacing morph. */

.hero-copy-prologue {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.52s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-copy-prologue.is-active {
  opacity: 1;
}

.hero-copy-prologue.is-leaving:not(.is-morphing) {
  opacity: 0;
}

.hero-copy-prologue.is-done {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Member count — reveals only after Welcome FINAL_STATIC (independent of Chibi) */
.hero-guild-count {
  margin: 0.55rem 0 0;
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: clamp(0.68rem, 1.1vw, 0.78rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(210, 190, 150, 0.55);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    letter-spacing 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.hero-guild-count.is-visible {
  opacity: 1;
  transform: translateY(0);
  letter-spacing: 0.28em;
}

/* Guild age clock — last Welcome element (after member count; independent of Chibi) */
.hero-guild-age {
  margin: 0.7rem 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  min-height: 3.1rem;
}

.hero-guild-age.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-guild-age__label {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: clamp(0.68rem, 1.15vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(232, 208, 150, 0.78);
  text-shadow:
    0 0 12px rgba(200, 160, 70, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.65);
}

.hero-guild-age__value {
  position: relative;
  font-family: var(--font-mono, 'Courier New', monospace);
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  letter-spacing: 0.2em;
  font-weight: 600;
  color: #ffe9b0;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 0 12px rgba(240, 200, 90, 0.7),
    0 0 32px rgba(200, 150, 50, 0.45),
    0 0 48px rgba(160, 110, 30, 0.25),
    0 2px 4px rgba(0, 0, 0, 0.75);
  animation: np-guild-age-breathe 3.6s ease-in-out infinite;
}

.hero-guild-age__value::after {
  content: '';
  position: absolute;
  inset: -20% -8%;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 236, 180, 0.35) 48%,
    transparent 62%
  );
  mix-blend-mode: soft-light;
  pointer-events: none;
  animation: np-guild-age-shimmer 4.8s ease-in-out infinite;
}

@keyframes np-guild-age-breathe {
  0%, 100% {
    filter: brightness(1);
    text-shadow:
      0 0 10px rgba(220, 180, 80, 0.45),
      0 0 24px rgba(180, 140, 50, 0.28),
      0 2px 4px rgba(0, 0, 0, 0.7);
  }
  50% {
    filter: brightness(1.12);
    text-shadow:
      0 0 16px rgba(240, 200, 100, 0.7),
      0 0 36px rgba(200, 160, 60, 0.45),
      0 2px 4px rgba(0, 0, 0, 0.7);
  }
}

@keyframes np-guild-age-shimmer {
  0%, 100% { transform: translateX(-40%); opacity: 0; }
  40% { opacity: 0; }
  50% { opacity: 1; }
  60% { transform: translateX(40%); opacity: 0; }
}

html:not(.np-copy-done) .hero-guild-count,
html:not(.np-copy-done) .hero-guild-age {
  visibility: hidden;
}

@media (max-width: 767px) {
  .hero-guild-count {
    letter-spacing: 0.18em;
    font-size: 0.62rem;
  }
  .hero-guild-count.is-visible {
    letter-spacing: 0.14em;
  }
  .hero-guild-age__label {
    letter-spacing: 0.28em;
    font-size: 0.62rem;
  }
  .hero-guild-age__value {
    font-size: 0.95rem;
    letter-spacing: 0.12em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-guild-age__value,
  .hero-guild-age__value::after {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-guild-count {
    transition: none;
    opacity: 1;
    transform: none;
    letter-spacing: 0.28em;
  }
}

/* Welcome #2 gold awaken + narrow specular on PERRY */
.hero-title.is-final-reveal .hero-title-perry {
  position: relative;
}

.hero-title.is-gold-awake .hero-perry-word,
.hero-title.is-final-static .hero-perry-word {
  filter: contrast(1.06) saturate(1.08);
}

/* Title layout is static during morph — only transform/filter move */
#hero-title,
.hero-title.is-final-reveal,
.hero-title.is-final-static {
  letter-spacing: normal;
}

.hero-title.is-specular .hero-title-perry::after {
  content: '';
  position: absolute;
  top: 8%;
  bottom: 12%;
  left: -12%;
  width: 18%;
  pointer-events: none;
  z-index: 3;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 236, 190, 0) 18%,
    rgba(255, 236, 190, 0.28) 48%,
    rgba(255, 220, 140, 0.12) 62%,
    transparent 100%
  );
  mix-blend-mode: soft-light;
  transform: skewX(-18deg);
  animation: np-title-specular-sweep 780ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes np-title-specular-sweep {
  from { left: -14%; opacity: 0; }
  12% { opacity: 1; }
  to { left: 96%; opacity: 0; }
}

.hero-title.is-halo-on .hero-title-perry-halo,
.hero-title.is-final-static .hero-title-perry-halo {
  opacity: 1;
  transition: opacity 0.55s ease;
}

.hero-title:not(.is-halo-on):not(.is-final-static) .hero-title-perry-halo {
  opacity: 0.35;
}

.hero-copy-prologue-inner {
  text-align: center;
  padding: var(--gap-xl) var(--gap-lg);
  max-width: 920px;
}

.hero-copy-prologue .welcome__line {
  margin: 0 0 0.65rem;
  --line-delay: 0s;
  --leave-delay: 0s;
}

.hero-copy-prologue .welcome__line--title {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-bottom: clamp(1rem, 3vw, 1.6rem);
  font-size: clamp(2.8rem, 10vw, 6.4rem);
  transform-origin: center center;
}

.hero-copy-prologue .welcome__line[data-line="1"] {
  --line-delay: 0s;
  --leave-delay: 1.20s;
}

.hero-copy-prologue .welcome__line[data-line="2"] {
  --line-delay: 1.05s;
  --leave-delay: 0.60s;
  font-family: var(--font-body);
  font-size: clamp(0.72rem, 1.85vw, 0.95rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.65;
  transition: opacity 0.55s ease, transform 0.55s ease, filter 0.55s ease;
}

.hero-copy-prologue .welcome__line[data-line="3"] {
  --line-delay: 1.35s;
  --leave-delay: 0s;
  font-family: var(--font-body);
  font-size: clamp(0.72rem, 1.85vw, 0.95rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.65;
  transition: opacity 0.55s ease, transform 0.55s ease, filter 0.55s ease;
}

.hero-copy-prologue .welcome__word {
  display: inline-block;
  white-space: nowrap;
}

.hero-copy-prologue .welcome__char {
  display: inline-block;
  padding: 0 0.04em;
  background: linear-gradient(
    168deg,
    #8b6914 0%,
    #c9a227 26%,
    #f3dd9a 47%,
    #e8c547 55%,
    #a67c1a 78%,
    #7a5a12 100%
  );
  background-size: 320% 100%;
  background-position: 0% 50%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 6px rgba(201, 162, 39, 0.45),
    0 0 14px rgba(201, 162, 39, 0.28),
    0 1px 1px rgba(40, 8, 4, 0.35);
  opacity: 0;
  transform: translateY(14px) scale(0.78);
  filter: blur(10px) brightness(1.2) saturate(1.2);
  animation:
    welcome-char-emerge 0.85s cubic-bezier(.22, 1, .36, 1) forwards,
    welcome-char-lava 8s linear infinite;
  animation-delay:
    calc(var(--line-delay, 0s) + var(--ci, 0) * 0.024s),
    calc(var(--line-delay, 0s) + var(--ci, 0) * 0.024s + 0.4s);
  will-change: opacity, transform, filter, background-position;
}

.hero-copy-prologue .welcome__line[data-line="2"] .welcome__char,
.hero-copy-prologue .welcome__line[data-line="3"] .welcome__char {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text-dim);
  text-shadow: none;
  filter: blur(8px);
  animation: welcome-char-emerge 0.85s cubic-bezier(.22, 1, .36, 1) forwards;
  animation-delay: calc(var(--line-delay, 0s) + var(--ci, 0) * 0.024s);
}

.hero-copy-prologue .welcome__char--space {
  filter: none;
  background: none;
  animation: welcome-char-in-space 0.85s linear forwards;
  animation-delay: calc(var(--line-delay, 0s) + var(--ci, 0) * 0.024s);
}

@keyframes welcome-char-lava {
  0% { background-position: 0% 50%; }
  100% { background-position: 320% 50%; }
}

@keyframes welcome-char-emerge {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.78);
    filter: blur(10px) brightness(1.4) saturate(1.4);
  }
  18% {
    opacity: 0.30;
    transform: translateY(10px) scale(0.86);
    filter: blur(7px) brightness(1.5) saturate(1.5);
  }
  35% {
    opacity: 0.70;
    transform: translateY(6px) scale(0.94);
    filter: blur(3px) brightness(1.45) saturate(1.5);
  }
  55% {
    opacity: 1;
    transform: translateY(2px) scale(1.02);
    filter: blur(1px) brightness(1.22) saturate(1.45);
  }
  78% {
    opacity: 1;
    transform: translateY(0) scale(1.015);
    filter: blur(0.4px) brightness(1.08) saturate(1.35);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0) brightness(1) saturate(1.25);
  }
}

@keyframes welcome-char-in-space {
  to { opacity: 1; }
}

/* ---- Morph after chase (19A) ---- */
.hero-copy-prologue.is-morphing {
  opacity: 1;
  z-index: 11;
}

.hero-copy-prologue.is-morphing .welcome__line[data-line="2"],
.hero-copy-prologue.is-morphing .welcome__line[data-line="3"] {
  opacity: 0;
  transform: translateY(-6px);
  filter: blur(3px);
}

/* Source title stays until FLIP handoff frame — never fades out first */
.hero-copy-prologue.is-morphing:not(.is-title-handed-off) .welcome__line--title {
  opacity: 1;
}

.hero-copy-prologue.is-title-handed-off .welcome__line--title {
  visibility: hidden;
  opacity: 0;
}

.hero-copy-prologue.is-leaving:not(.is-morphing) .welcome__char {
  animation: welcome-char-out 0.55s cubic-bezier(.4, 0, .6, 1) forwards;
  animation-delay: calc(var(--leave-delay, 0s) + var(--ci, 0) * 0.018s);
}

.hero-copy-prologue.is-leaving:not(.is-morphing) .welcome__char--space {
  animation-name: welcome-char-out-space;
}

@keyframes welcome-char-out {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.92);
    filter: blur(6px);
  }
}

@keyframes welcome-char-out-space {
  to { opacity: 0; }
}

/* During prologue + chase: hide final hero stack (layout still present for measure) */
html.np-copy-prologue:not(.np-copy-morphing) .hero-content,
html.np-copy-prologue:not(.np-copy-morphing) .hero-scroll-indicator {
  visibility: hidden;
}

html.np-copy-morphing .hero-content,
html.np-copy-morphing .hero-scroll-indicator {
  visibility: visible;
}

/* Final title owns the morph — children must be visible for FLIP */
html.np-copy-morphing .hero-title {
  opacity: 0;
  will-change: transform;
}

html.np-copy-morphing.np-copy-morph-active .hero-title {
  opacity: 1;
}

html.np-cinematic.np-copy-morphing:not(.np-reduced) .hero-title-no-motion,
html.np-cinematic.np-copy-morphing:not(.np-reduced) .hero-title-perry-motion {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  transition: none !important;
  will-change: auto;
}

html.np-cinematic.np-copy-morphing:not(.np-entered):not(.np-reduced) .hero-enter:not(.hero-enter-perry) {
  opacity: 0;
  visibility: visible;
  transform: translate3d(0, 12px, 0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

html.np-copy-morphing .hero-enter-eyebrow,
html.np-copy-morphing .hero-enter-copy,
html.np-copy-morphing .hero-enter-cta,
html.np-copy-morphing .hero-enter-scroll {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

html.np-copy-morphing.np-copy-handoff .hero-enter-eyebrow {
  opacity: 1;
  transform: none;
  transition-delay: 0.08s;
}
html.np-copy-morphing.np-copy-handoff .hero-enter-copy {
  opacity: 1;
  transform: none;
  transition-delay: 0.18s;
}
html.np-copy-morphing.np-copy-handoff .hero-enter-cta {
  opacity: 1;
  transform: none;
  transition-delay: 0.28s;
}
html.np-copy-morphing.np-copy-handoff .hero-enter-scroll {
  opacity: 1;
  transform: none;
  transition-delay: 0.36s;
}

html.np-cinematic.np-copy-handoff:not(.np-reduced) .hero-enter-eyebrow,
html.np-cinematic.np-copy-handoff:not(.np-reduced) .hero-enter-copy,
html.np-cinematic.np-copy-handoff:not(.np-reduced) .hero-enter-cta,
html.np-cinematic.np-copy-handoff:not(.np-reduced) .hero-enter-scroll {
  opacity: 1;
  visibility: visible;
  transform: none;
}

html.np-copy-prologue #navbar,
html.np-copy-prologue #stats-bar {
  opacity: 0;
  pointer-events: none;
}

html.np-copy-morphing #navbar,
html.np-copy-morphing #stats-bar {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.8s ease 0.35s;
}

.hero-copy-prologue.welcome--mobile-lite .welcome__line {
  opacity: 0;
  animation: welcome-line-in 0.55s ease forwards;
}

.hero-copy-prologue.welcome--mobile-lite .welcome__line[data-line="1"] { animation-delay: 0s; }
.hero-copy-prologue.welcome--mobile-lite .welcome__line[data-line="2"] { animation-delay: 0.18s; }
.hero-copy-prologue.welcome--mobile-lite .welcome__line[data-line="3"] { animation-delay: 0.36s; }

@keyframes welcome-line-in {
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy-prologue .welcome__char {
    animation: welcome-char-in-space 0.32s ease forwards !important;
    filter: none !important;
    transform: none !important;
  }
  html.np-copy-morphing .hero-enter-eyebrow,
  html.np-copy-morphing .hero-enter-copy,
  html.np-copy-morphing .hero-enter-cta {
    transition-duration: 0.01ms !important;
  }
}
