/* ─── TSAI Hero Animation — fresh build ─── */

/* Stage wrapper */
.hero-anim-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  overflow: visible;
  isolation: isolate;
}

/* Label row at top */
.ha-label {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  z-index: 10;
  user-select: none;
}
.ha-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-gold-soft);
  flex-shrink: 0;
  animation: ha-pulse 1.6s ease-out infinite;
}
@keyframes ha-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(212,184,138,0.55); }
  100% { box-shadow: 0 0 0 8px rgba(212,184,138,0); }
}

/* Deck — the stacked card area */
.ha-deck {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 380px;
}

/* Ghost cards (decorative stack behind) */
.ha-ghost {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--brand-plum-tint);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
}
.ha-ghost--1 { transform: translate(14px, 10px) rotate(2.5deg); opacity: 0.55; }
.ha-ghost--2 { transform: translate(26px, 18px) rotate(4.8deg); opacity: 0.30; }

/* ── Photo card ── */
.ha-photo {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--ink-3);
  box-shadow: 0 16px 40px rgba(69,43,81,0.18), 0 2px 6px rgba(0,0,0,0.2);
}
.ha-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}
/* Dual-layer stacking — both imgs are absolute, z-index controlled by JS */
.ha-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}
/* Subtle bottom gradient on photo */
.ha-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0,0,0,0.32) 100%);
  border-radius: 16px;
  pointer-events: none;
}

/* ── Score card (white card bottom-left) ── */
.ha-scores {
  position: absolute;
  left: -18px;
  bottom: -70px;
  width: 290px;
  background: var(--ink-1);
  border-radius: 16px;
  border: 1px solid var(--border-hair);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 18px 18px 18px;
  z-index: 4;
}
.ha-scores-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  color: var(--ink-8);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.ha-scores-rule {
  width: 24px;
  height: 1px;
  background: var(--brand-gold);
  margin-bottom: 12px;
}
.ha-scores-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Individual score row */
.ha-score {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
}
.ha-score-label {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--ink-7);
  font-weight: 500;
  /* start hidden — animate in */
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 280ms cubic-bezier(0.22,0.61,0.36,1),
              transform 280ms cubic-bezier(0.22,0.61,0.36,1);
}
.ha-score.label-visible .ha-score-label {
  opacity: 1;
  transform: translateX(0);
}

.ha-score-icon {
  width: 16px;
  height: 16px;
  color: var(--brand-plum);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 200ms cubic-bezier(0.22,0.61,0.36,1),
              transform 300ms cubic-bezier(0.34,1.4,0.64,1);
}
.ha-score.icon-visible .ha-score-icon {
  opacity: 1;
  transform: scale(1);
}
.ha-score-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Overall Match verdict (flips in from -90°) ── */
.ha-verdict {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  padding: 22px 32px 20px;
  min-width: 248px;
  text-align: center;
  background: rgba(46, 28, 56, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(69,43,81,0.28), 0 2px 12px rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.10);
  pointer-events: none;

  /* hidden state */
  opacity: 0;
  transform: translate(-50%, -50%) perspective(900px) rotateY(-90deg);
  transition: opacity 240ms cubic-bezier(0.22,0.61,0.36,1),
              transform 560ms cubic-bezier(0.22,0.61,0.36,1);
}
.ha-verdict.visible {
  opacity: 1;
  transform: translate(-50%, -50%) perspective(900px) rotateY(0deg);
}

.ha-verdict-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand-gold-soft);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ha-verdict-eyebrow::before,
.ha-verdict-eyebrow::after {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--brand-gold);
}
.ha-verdict-word {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
}

/* When verdict is visible, dim the photo slightly */
.ha-photo.dimmed {
  filter: brightness(0.72) saturate(0.88);
  transition: filter 360ms cubic-bezier(0.22,0.61,0.36,1);
}
.ha-photo.undimmed {
  filter: brightness(1) saturate(1);
  transition: filter 360ms cubic-bezier(0.22,0.61,0.36,1);
}

/* ── Enter / exit animations for the whole card group ── */
.ha-photo,
.ha-scores {
  will-change: transform, opacity;
}

.ha-photo.enter  { animation: ha-photo-in  580ms cubic-bezier(0.22,0.61,0.36,1) both; }
.ha-photo.exit   { animation: ha-photo-out 420ms cubic-bezier(0.22,0.61,0.36,1) both; }
.ha-scores.enter { animation: ha-scores-in 580ms cubic-bezier(0.22,0.61,0.36,1) 140ms both; }
.ha-scores.exit  { animation: ha-scores-out 420ms cubic-bezier(0.22,0.61,0.36,1) 80ms both; }

@keyframes ha-photo-in {
  from { opacity: 0; transform: translate(40px, 28px) rotate(6deg) scale(0.96); }
  to   { opacity: 1; transform: translate(0,0) rotate(0) scale(1); }
}
@keyframes ha-photo-out {
  from { opacity: 1; transform: translate(0,0) rotate(0) scale(1); }
  to   { opacity: 0; transform: translate(-28px,-10px) rotate(-2deg) scale(0.985); }
}
@keyframes ha-scores-in {
  from { opacity: 0; transform: translate(46px, 32px) rotate(5deg) scale(0.96); }
  to   { opacity: 1; transform: translate(0,0) rotate(0) scale(1); }
}
@keyframes ha-scores-out {
  from { opacity: 1; transform: translate(0,0) rotate(0) scale(1); }
  to   { opacity: 0; transform: translate(-22px,-6px) rotate(-2deg) scale(0.985); }
}

/* Progress dots — hidden */
.ha-progress { display: none; }

@media (max-width: 550px) {
  .hero-anim-stage { aspect-ratio: 4 / 5; }
  .ha-deck { top: 30px; transform: translateX(-50%) scale(0.8); transform-origin: 50% 0; }
}
