/* ==========================================================================
   § 00 (3.2) · the AI card hero
   Two layouts on the same markup:
   · static (no JavaScript, no WebGL, reduced motion): headline, a crisp HTML card (front with
     its twin-artwork back fanned behind), actions and the first page's dock — all at once;
   · live (section[data-hero-live], js/hero-story.js): a pinned stage over a scroll runway. The
     WebGL card (js/hero-card.js) takes its rest position from .hero-card and its beat position
     from .hero-slot, then unfolds into the page at the origin dock. The beat is written to
     section[data-hero-beat]: intro | acquire | evolve | assist | page.
   ========================================================================== */

.hero { --card-ratio: 1.75; }
@media (max-width: 760px) { .hero { --card-ratio: 0.625; } } /* phones: the card stands upright */

/* ------------------------------------------------------------ the HTML card (static, and the
   reference rectangle for the WebGL card) */
.hero-card { position: relative; aspect-ratio: var(--card-ratio); perspective: 1600px; container-type: inline-size; }
.hc-face {
  position: absolute; inset: 0; border-radius: 4.2cqi; overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transition: transform 0.9s var(--ease-out);
}
.hc-front {
  display: grid; grid-template-rows: auto 1fr auto; padding: 5.6cqi 5.9cqi 4.4cqi; color: var(--paper-ink);
  background:
    radial-gradient(60% 70% at 88% 6%, rgba(76, 139, 255, 0.2), transparent 70%),
    repeating-radial-gradient(circle at 104% 108%, rgba(36, 111, 241, 0.06) 0 1px, transparent 1px 1.7cqi),
    linear-gradient(135deg, #f8fafd, #eef3fa 55%, #e1e9f5);
  box-shadow: 0 40px 80px -36px rgba(0, 4, 14, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 -0.6cqi 0 #246ff1 inset;
}
.hc-top { display: flex; align-items: center; gap: 1.6cqi; font-size: 1.7cqi; }
.hc-top .mark-mini { width: 3.2cqi; height: 3.8cqi; }
.hc-top .mark-mini::before, .hc-top .mark-mini::after { width: 1.9cqi; height: 2.7cqi; border-width: 0.62cqi; }
.hc-top b { font-weight: 600; color: #4a5f7d; font-size: 1.75cqi; }
.hc-top em { font: 500 1.3cqi/1 var(--mono); font-style: normal; letter-spacing: 0.3em; color: #7d93b0; }
.hc-pill { margin-left: auto; padding: 1cqi 2.2cqi; border-radius: 99px; background: rgba(36, 111, 241, 0.12); color: #1f4f9e; font-weight: 600; font-size: 1.7cqi; white-space: nowrap; }
.hc-id { display: flex; align-items: center; gap: 4cqi; padding-left: 0.6cqi; }
.hc-avatar {
  position: relative; display: grid; place-items: center; flex: none; width: 13.4cqi; aspect-ratio: 1; border-radius: 50%;
  background: linear-gradient(135deg, #4c8bff, #1847b8); color: #fff; font: 500 7.4cqi/1 var(--serif);
  box-shadow: 0 0 0 0.4cqi rgba(255, 255, 255, 0.9);
}
.hc-avatar i { position: absolute; right: -0.6cqi; bottom: -0.4cqi; display: grid; place-items: center; width: 4.8cqi; aspect-ratio: 1; border-radius: 50%; background: #fff; color: var(--blue); font: 700 1.85cqi/1 var(--sans); font-style: normal; }
.hc-who { display: grid; gap: 0.6cqi; }
.hc-who b { font: 500 8.2cqi/1.15 var(--serif); color: #0e1f3a; }
.hc-who > span { font-size: 2.65cqi; color: #4a5f7d; }
.hc-tags { display: flex; gap: 0.9cqi; margin-top: 0.8cqi; }
.hc-tags i { padding: 0.5cqi 1.4cqi; border-radius: 99px; background: #dce8f8; color: #1f4f9e; font: 500 1.95cqi/1.6 var(--sans); font-style: normal; white-space: nowrap; }
.hc-ways { display: grid; grid-template-columns: 0.86fr 1fr; gap: 1.9cqi; padding-top: 2.4cqi; border-top: 0.15cqi solid rgba(14, 31, 58, 0.1); }
.hc-ways i { display: grid; place-items: center; height: 6.4cqi; border-radius: 99px; border: 0.25cqi solid var(--blue); color: #1f4f9e; font: 600 2.5cqi/1 var(--sans); font-style: normal; }
.hc-ways i.is-primary { border-color: transparent; background: linear-gradient(110deg, #3b7bff, #1d56d8); color: #fff; }
.hc-note { position: absolute; right: 5.9cqi; bottom: 1.3cqi; font-size: 1.4cqi; color: #8b9db6; }
.hc-back {
  transform: rotateY(180deg);
  background:
    repeating-radial-gradient(circle at 70% 48%, transparent 0 7.2cqi, rgba(156, 193, 255, 0.13) 7.2cqi calc(7.2cqi + 1px)),
    radial-gradient(75% 90% at 70% 46%, #1d58c9, #0d2a63 42%, #050d1f);
  box-shadow: 0 40px 80px -36px rgba(0, 4, 14, 0.9), 0 0 0 1px rgba(156, 193, 255, 0.25) inset;
}
.hc-twin { position: absolute; left: 49%; top: -2%; height: 114%; width: auto; max-width: none; -webkit-mask-image: linear-gradient(#000 64%, transparent 86%); mask-image: linear-gradient(#000 64%, transparent 86%); }
.hc-logo { position: absolute; left: 6.3cqi; top: 7.4cqi; width: 27cqi; height: auto; }
.hc-back-line { position: absolute; left: 6.4cqi; top: 23cqi; font: 500 4.1cqi/1.3 var(--serif); color: var(--text-1); }
/* Turned over: the button (or a tap) flips the HTML card; with reduced motion, at once. */
.hero-card[data-flipped] .hc-front { transform: rotateY(-180deg); }
.hero-card[data-flipped] .hc-back { transform: rotateY(0deg); }

/* ------------------------------------------------------------ static layout */
.hero-stage { position: relative; padding: calc(var(--header) + clamp(28px, 5vh, 60px)) 0 clamp(84px, 11vh, 128px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  grid-template-areas: "intro card" "copy card" "under card" "origin card";
  column-gap: clamp(24px, 4vw, 72px); align-items: start;
}
.hero-intro { grid-area: intro; }
.hero-copy { grid-area: copy; }
.hero-under { grid-area: under; display: grid; gap: 18px; justify-items: start; margin-top: clamp(22px, 2.6vw, 36px); }
.hero .origin-card { grid-area: origin; align-self: start; margin-top: clamp(28px, 3.6vw, 48px); max-width: 460px; }
.hero .origin-card .paper-dock { --w: 62px; }
.hero-card { grid-area: card; align-self: center; justify-self: center; width: min(100%, 560px); margin-top: 18px; }
/* static: the twin side peeks out behind the face */
.hero:not([data-hero-live]) .hero-card:not([data-flipped]) .hc-back { transform: rotateY(0deg) rotate(-7deg) translate(-7%, -9%) scale(0.94); -webkit-backface-visibility: visible; backface-visibility: visible; }
.hero:not([data-hero-live]) .hero-card:not([data-flipped]) .hc-front { transform: rotate(2.5deg); }
.hero h1 { margin-bottom: clamp(18px, 2vw, 28px); }
.hero-slot, .hero-satellites, .hero-beats, .cue-live { display: none; }
html:not(.js) .hero-flip { display: none; }
.hero-flip {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px;
  font-size: 13px; letter-spacing: 0.12em; color: var(--text-3); transition: color var(--t-base);
}
.hero-flip:hover { color: var(--text-1); }
.hero-flip svg { font-size: 15px; }
.hero-glow, .hero-rings { left: 72%; top: 52%; }

@media (max-width: 900px) {
  /* the actions stay on the first screen; the (upright, taller) card follows */
  .hero-grid { grid-template-columns: 1fr; grid-template-areas: "intro" "copy" "under" "card" "origin"; }
  .hero-card { width: min(100%, 520px); margin-top: clamp(30px, 6vw, 44px); }
  .hero-under { justify-items: start; }
  .hero-glow, .hero-rings { left: 50%; top: 62%; }
}

/* ------------------------------------------------------------ live layout: a pinned stage */
.hero[data-hero-live] {
  --runway: 1.7;
  --stage-h: calc(100svh - var(--header));
  --card-w: min(44vw, 600px, calc(var(--stage-h) * 0.48 * var(--card-ratio)));
  --slot-w: min(34vw, 470px, calc(var(--stage-h) * 0.42 * var(--card-ratio)));
}
.hero[data-hero-live] .hero-runway { height: calc(100svh * (1 + var(--runway))); }
.hero[data-hero-live] .hero-stage { position: sticky; top: 0; height: 100svh; padding: 0; overflow: clip; touch-action: pan-y; }
.hero[data-hero-live] .hero-grid { position: absolute; top: var(--header); bottom: 0; left: 0; right: 0; display: block; }
.hero[data-hero-live] .hero-card { position: absolute; left: 50%; top: 46%; width: var(--card-w); margin: 0; translate: -50% -50%; visibility: hidden; }
.hero[data-hero-live] .hero-intro { position: absolute; top: 5%; left: 0; right: 0; justify-content: center; margin: 0; }
.hero[data-hero-live] .hero-under {
  position: absolute; left: 0; right: 0; top: calc(46% + var(--card-w) / var(--card-ratio) / 2 + clamp(18px, 3vh, 34px)); margin: 0;
  justify-items: center; gap: clamp(8px, 1.6vh, 16px);
}
.hero[data-hero-live] .hero-slot { display: block; position: absolute; left: 71%; top: 50%; width: var(--slot-w); aspect-ratio: var(--card-ratio); translate: -50% -50%; pointer-events: none; }
.hero[data-hero-live] .hero-copy { position: absolute; left: 0; top: 50%; width: 48%; translate: 0 -50%; }
/* Centred with margins, not translate: the journey measures the dock from layout offsets. */
.hero[data-hero-live] .origin-card {
  position: absolute; left: 71%; top: 50%; width: var(--slot-w); aspect-ratio: var(--card-ratio); margin: calc(var(--slot-w) / var(--card-ratio) / -2) 0 0 calc(var(--slot-w) / -2); max-width: none;
  display: grid; place-items: center; padding: 0; border: 0; background: none; pointer-events: none;
}
.hero[data-hero-live] .origin-card { --dock-w: calc(var(--slot-w) * 0.34); }
.hero[data-hero-live] .origin-card .paper-dock { --w: var(--dock-w); }
.hero[data-hero-live] .origin-card .paper-slot, .hero[data-hero-live] .origin-card .paper-dock::after { opacity: 0; }
.hero[data-hero-live] .origin-copy { position: absolute; left: -20%; right: -20%; top: calc(50% + var(--dock-w) * 1.276 / 2 + 22px); text-align: center; }
.hero[data-hero-live] .hero-satellites { display: block; position: absolute; left: 71%; top: 50%; width: var(--slot-w); aspect-ratio: var(--card-ratio); translate: -50% -50%; pointer-events: none; }
.hero[data-hero-live] .hero-signal { pointer-events: auto; }
.hero[data-hero-live] .signal-1 { left: -26%; top: -30%; }
.hero[data-hero-live] .signal-2 { right: -14%; bottom: -34%; }
.hero[data-hero-live] .signal-3 { left: -18%; bottom: -32%; }
.hero[data-hero-live] .hero-beats { display: flex; gap: 6px; margin-top: clamp(22px, 3vh, 34px); }
.hero[data-hero-live] .cue-live { display: inline; }
.hero[data-hero-live] .cue-static { display: none; }
.hero[data-hero-live] .scroll-cue { left: 50%; translate: -50% 0; bottom: clamp(14px, 3vh, 30px); }
.hero[data-hero-live] .hero-glow, .hero[data-hero-live] .hero-rings { left: 50%; top: 50%; transform: translate3d(var(--bg-x, 0px), var(--bg-y, 0px), 0); }

/* beat visibility: one transition language for everything that comes and goes */
.hero[data-hero-live] :is(.hero-intro, .hero-under, .scroll-cue, .hero-copy, .hero-satellites .hero-signal, .origin-copy) {
  transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out), visibility 0s linear 0s;
}
.hero[data-hero-live]:not([data-hero-beat="intro"]) :is(.hero-intro, .hero-under, .scroll-cue) {
  opacity: 0; visibility: hidden; transform: translateY(-14px); pointer-events: none;
  transition: opacity 0.4s ease, transform 0.6s var(--ease-out), visibility 0s linear 0.4s;
}
.hero[data-hero-live][data-hero-beat="intro"] .hero-copy { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
.hero[data-hero-live] h1 .line { overflow: hidden; padding-block: 0.06em 0.12em; margin-block: -0.06em -0.12em; }
.hero[data-hero-live] h1 .line > span { transition: transform 1s var(--ease-out); }
.hero[data-hero-live] h1 .line > span:not(.hero-rotor) { display: inline-block; } /* the rotor stays an inline grid: its variants share one cell */
.hero[data-hero-live] h1 .line:nth-child(2) > span { transition-delay: 80ms; }
.hero[data-hero-live] h1 .line:nth-child(3) > span { transition-delay: 160ms; }
.hero[data-hero-live][data-hero-beat="intro"] h1 .line > span { transform: translate3d(0, 108%, 0); transition-duration: 0.3s; transition-delay: 0s; }
.hero[data-hero-live]:is([data-hero-beat="intro"], [data-hero-beat="page"]) .hero-signal { opacity: 0; transform: scale(0.94); }
.hero[data-hero-live]:not([data-hero-beat="page"]) .origin-copy { opacity: 0; transform: translateY(10px); }
.hero[data-hero-live][data-hero-beat="page"] .hero-leads, .hero[data-hero-live][data-hero-beat="page"] .hero-beats { opacity: 0.35; transition: opacity 0.5s ease; }

.hero-beats button {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; line-height: 1;
  border-radius: 99px; border: 1px solid var(--hair-2); font-size: 13px; color: var(--text-3);
  transition: color var(--t-base), border-color var(--t-base), background var(--t-base);
}
.hero-beats button b { font: 500 11px/1 var(--mono); color: var(--text-4); }
.hero-beats button:hover { color: var(--text-1); border-color: var(--hair-3); }
.hero-beats button[aria-current="true"] { color: var(--text-1); border-color: var(--hair-3); background: rgba(36, 111, 241, 0.16); }
.hero-beats button[aria-current="true"] b { color: var(--blue-soft); }

@media (max-width: 900px) {
  .hero[data-hero-live] {
    --runway: 1.55;
    --card-w: min(86vw, 460px, calc(var(--stage-h) * 0.36 * var(--card-ratio)));
    --slot-w: min(62vw, 330px, calc(var(--stage-h) * 0.22 * var(--card-ratio)));
  }
  .hero[data-hero-live] .hero-intro { top: 4%; }
  .hero[data-hero-live] .hero-card { top: 40%; }
  .hero[data-hero-live] .hero-under { top: calc(40% + var(--card-w) / var(--card-ratio) / 2 + clamp(16px, 3vh, 30px)); }
  .hero[data-hero-live] :is(.hero-slot, .origin-card, .hero-satellites) { left: 50%; top: calc(var(--slot-w) / var(--card-ratio) / 2 + 3%); }
  .hero[data-hero-live] .hero-copy { left: 0; right: 0; top: calc(var(--slot-w) / var(--card-ratio) + 7%); width: auto; translate: none; text-align: center; }
  .hero[data-hero-live] .hero-lead { margin-inline: auto; }
  .hero[data-hero-live] .hero-beats { justify-content: center; }
  .hero[data-hero-live] .hero-satellites { display: none; }
  /* stacked layout: when the card has become the page, the page and its note take the screen alone */
  .hero[data-hero-live][data-hero-beat="page"] .hero-copy { opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0s linear 0.4s; }
  .hero[data-hero-live] .origin-card { --dock-w: calc(var(--slot-w) * 0.36); }
}
@media (max-width: 760px) {
  /* phones: an upright card — larger while it waits, a small portrait beside nothing once the story runs */
  .hero[data-hero-live] {
    --card-w: min(64vw, 300px, calc(var(--stage-h) * 0.52 * var(--card-ratio)));
    --slot-w: min(34vw, 150px, calc(var(--stage-h) * 0.27 * var(--card-ratio)));
  }
  .hero[data-hero-live] .hero-card { top: 42%; }
  .hero[data-hero-live] .hero-under { top: calc(42% + var(--card-w) / var(--card-ratio) / 2 + clamp(14px, 2.4vh, 24px)); }
  .hero[data-hero-live] .origin-card { --dock-w: calc(var(--slot-w) * 0.9); }
  .hero[data-hero-live] .origin-copy { top: calc(50% + var(--dock-w) * 1.276 / 2 + 14px); }
  .hero-card { width: min(68vw, 300px); }
  /* the HTML card, upright: avatar above the name, the call first */
  .hc-face { border-radius: 7cqi; }
  .hc-front { grid-template-rows: auto 1fr auto auto; padding: 8cqi 7.5cqi 9cqi; text-align: center; }
  .hc-top { gap: 2.4cqi; }
  .hc-top .mark-mini { width: 5.4cqi; height: 6.4cqi; }
  .hc-top .mark-mini::before, .hc-top .mark-mini::after { width: 3.2cqi; height: 4.6cqi; border-width: 1cqi; }
  .hc-top b { font-size: 3cqi; }
  .hc-top em { font-size: 2.2cqi; }
  .hc-pill { padding: 1.4cqi 3cqi; font-size: 2.6cqi; }
  .hc-pill { font-size: 0; } .hc-pill::before { content: "AI 分身"; font-size: 2.6cqi; }
  .hc-id { flex-direction: column; justify-content: center; gap: 4cqi; padding: 0; }
  .hc-avatar { width: 34cqi; font-size: 18cqi; box-shadow: 0 0 0 0.9cqi rgba(255, 255, 255, 0.9); }
  .hc-avatar i { width: 12cqi; font-size: 4.6cqi; }
  .hc-who { justify-items: center; gap: 1.6cqi; }
  .hc-who b { font-size: 14.6cqi; }
  .hc-who > span { font-size: 4.3cqi; }
  .hc-tags { gap: 1.6cqi; margin-top: 1.4cqi; }
  .hc-tags i { padding: 0.9cqi 2.4cqi; font-size: 3.3cqi; }
  .hc-ways { grid-template-columns: 1fr; gap: 3cqi; padding-top: 5cqi; }
  .hc-ways i { height: 12.6cqi; font-size: 4.4cqi; border-width: 0.45cqi; }
  .hc-ways i.is-primary { order: -1; }
  .hc-note { left: 0; right: 0; bottom: 2.6cqi; font-size: 2.4cqi; }
  .hc-twin { left: 50%; translate: -50% 0; top: 29%; height: 76%; }
  .hc-logo { left: 50%; translate: -50% 0; top: 11cqi; width: 52cqi; }
  .hc-back-line { left: 0; right: 0; top: 30cqi; text-align: center; font-size: 7cqi; }
}
@media (max-width: 520px) {
  .hero[data-hero-live] .hero-intro em { display: none; }
  .hero[data-hero-live] .hero-flip span { letter-spacing: 0.08em; }
  .hero[data-hero-live] .hero-beats button { padding: 0 11px; font-size: 12px; }
  .hero-stage { padding-top: calc(var(--header) + 20px); }
}

/* short screens (phones held sideways): the hero's actions sit near the bottom; the scroll cue would cover them */
@media (max-height: 560px) {
  .hero .scroll-cue { display: none; }
  .hero h1 { font-size: min(var(--fs-display-xl), 9.85cqi, 12.5svh); }
}
