/* Hero emblem: orbiting sun / atom (see core.js). Text left, emblem right; stacked on narrow / portrait screens. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: clamp(1rem, 3vw, 3rem);
  align-content: center;
  align-items: center;
  justify-items: start;
  grid-template-rows: 1fr auto auto 1fr;      /* spacer rows above and below: the text stays centred on the sun */
}
.hero > h1 { grid-row: 2; }
.hero > .lead { grid-row: 3; }
.hero > :not(.emblem) { grid-column: 1; }
/* wide screens: the hero may grow past the 76rem of the other sections so the slogan keeps two rows next to a large sun */
main > .hero { max-width: min(100%, 96rem); }
.hero h1 { font-size: clamp(1.9rem, 3.1vw, 3.5rem); }
/* the text always sits above the sun's glow */
.hero > :not(.emblem) { position: relative; z-index: 2; }
/* the slogan is set in capitals; its scramble uses capitals too, so the line never changes width or rows */
.hl { text-transform: uppercase; letter-spacing: .01em; }

.emblem {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 4;
  width: min(47vw, 82vh);
  margin-left: clamp(-9rem, -8vw, -3rem);       /* the text column gets that room back... */
  margin-right: 3vw;                           /* the hero is wide now, so the sun sits near the right edge without touching the rail */
  aspect-ratio: 1;
  pointer-events: none;
}
.emblem-fade {
  position: absolute;
  inset: 0;
  /* the glow melts into the space behind: no visible square edge */
  -webkit-mask-image: radial-gradient(closest-side, #000 86%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 86%, transparent 100%);
}
.emblem canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.emblem-sun { opacity: 0; transition: opacity .8s ease; }
.emblem-sun.on { opacity: 1; }

/* The end of the fall into the black hole is a flash of light; the sun comes out of that light. The emblem starts
   large and centred on the screen (--zx / --zy / --zs, set by core.js from where it really sits) and settles into its
   place, so it reads as a zoom OUT from the sun, one shared element instead of a fade. */
html[data-state] .hero > .emblem {
  opacity: 0;
  transform-origin: 50% 50%;
  transform: translate(var(--zx, 0px), var(--zy, 0px)) scale(var(--zs, 4.2));
}
html[data-state="open"] .hero > .emblem {
  opacity: 1;
  transform: none;
  transition: opacity 1.2s ease .05s, transform 2.6s cubic-bezier(.16, .72, .18, 1) .05s;
}

@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .hero > h1, .hero > .lead { grid-row: auto; }
  .hero { grid-template-rows: none; grid-template-columns: minmax(0, 1fr); padding-top: 5rem; padding-bottom: 3rem; gap: .9rem; justify-items: start; }
  .hero > :not(.emblem) { grid-column: 1; }
  .emblem { margin-left: 0; margin-right: 0; grid-column: 1; grid-row: 1; justify-self: center; width: min(88vw, 40svh); margin-bottom: .25rem; }
  .hero h1 { font-size: clamp(1.8rem, 7.4vw, 2.7rem); }
  .hint { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-state] .hero > .emblem, html[data-state="open"] .hero > .emblem { transition: none; transform: none; opacity: 1; }
  .emblem-sun { transition: none; }
}
