/* S1: landing (spec/s1-brief.md). Pure CSS framing: the still is cover-scaled and the head is never cropped.
   The generator mark is painted out of the still (questions.md Q4), so the whole width may show (--wm: 1). */
.hero {
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 200ms;
  --t-mid: 450ms;
  --t-slow: 700ms;
  --stagger: 55ms;
  --focus: var(--accent);
  /* From media/hero.json and the real size of hero.jpg (2560x1440) */
  --ar: 1.777778;
  --bx: .520312; --by: .025; --bw: .253125; --bh: .619444;
  --hx: calc(var(--bx) + var(--bw) / 2);   /* head centre, fraction of the still */
  --hx-screen: .73;                        /* where the head likes to sit, fraction of the stage width */
  --wm: 1;                                 /* max visible fraction of the still's width */
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: clip;
  isolation: isolate;
  color: var(--card);
  touch-action: pan-y;
  background: var(--paper);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 42% 36% at 100% 100%, color-mix(in srgb, var(--ink) 80%, transparent) 0%, transparent 100%),
    linear-gradient(100deg, color-mix(in srgb, var(--ink) 64%, transparent) 0%, color-mix(in srgb, var(--ink) 46%, transparent) 25%, color-mix(in srgb, var(--ink) 22%, transparent) 45%, transparent 62%),
    linear-gradient(to top, color-mix(in srgb, var(--ink) 34%, transparent) 0%, transparent 32%);
}
.hero__stage {
  position: absolute;
  inset: 0;
  overflow: clip;
  container-type: size;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--ink);
}
.hero__frame {
  --fw: max(calc(100cqw / var(--wm)), calc(100cqh * var(--ar)));
  position: absolute;
  top: 0;
  width: var(--fw);
  height: calc(var(--fw) / var(--ar));
  left: clamp(calc(100cqw - var(--wm) * var(--fw)), calc(100cqw * var(--hx-screen) - var(--hx) * var(--fw)), 0px);
}
.hero__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}
.hero__head {
  position: absolute;
  left: calc(var(--bx) * 100%);
  top: calc(var(--by) * 100%);
  width: calc(var(--bw) * 100%);
  height: calc(var(--bh) * 100%);
  max-width: none;
  pointer-events: none;
}

.hero__text { position: absolute; z-index: 2; left: var(--gutter); top: 136px; }
.hero__title {
  --fs: clamp(3rem, 5.6vw, 6.25rem);
  font: 500 var(--fs) / .95 var(--font-display);
  letter-spacing: -.025em;
  max-width: 8.2em;
  text-wrap: balance;
  text-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 30%, transparent), 0 2px 34px color-mix(in srgb, var(--ink) 50%, transparent);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero__statement {
  --fs2: clamp(1.125rem, 1.6vw, 1.75rem);
  position: absolute;
  z-index: 2;
  right: var(--gutter);
  bottom: clamp(28px, 6svh, 64px);
  text-align: right;
  font: 500 var(--fs2) / 1.15 var(--font-display);
  letter-spacing: -.01em;
  text-shadow: 0 1px 22px color-mix(in srgb, var(--ink) 55%, transparent);
}
.hero__line { display: block; }
.hero__line:nth-child(2) {
  font-style: italic;
  font-weight: 400;
  font-size: 1.15em;
}

/* Portrait (768x1024, 390x844): the head sits centred, the text stacks under it */
@media (max-aspect-ratio: 1/1) {
  .hero {
    --hx-screen: .5;
    min-height: 600px;
    display: grid;
    grid-template-rows: 1fr auto auto;
    padding: 0 var(--gutter) 28px;
  }
  .hero::before {
    background:
      linear-gradient(to bottom, color-mix(in srgb, var(--ink) 40%, transparent) 0, transparent 130px),
      linear-gradient(to top, color-mix(in srgb, var(--ink) 74%, transparent) 0%, color-mix(in srgb, var(--ink) 54%, transparent) 32%, transparent 56%);
  }
  .hero__stage { border-radius: 0; }
  .hero__text { grid-row: 3; position: relative; left: auto; top: auto; }
  .hero__title { --fs: clamp(2.25rem, 10.4vw, 4.5rem); max-width: 8.6em; }
  .hero__actions { margin-top: 20px; }
  .hero__statement {
    --fs2: clamp(1rem, 2.6vw, 1.375rem);
    grid-row: 2;
    position: relative;
    right: auto;
    bottom: auto;
    margin-bottom: 18px;
    text-align: left;
  }
}
@media (max-width: 699.98px) {
  .hero__actions .btn { flex: 1 1 0; justify-content: center; }
}

/* Motion: only with scripts on and motion allowed. Scripts off or reduced motion: the still, all text. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes hero-settle { from { transform: scale(1.06); } }
  @keyframes hero-rise { from { opacity: 0; transform: translateY(28px); } }
  html.js .hero__frame { transform-origin: 64% 30%; animation: hero-settle 1600ms var(--ease) backwards; }
  html.js .hero__title { animation: hero-rise 1000ms var(--ease) 200ms backwards; }
  html.js .hero__actions { animation: hero-rise 900ms var(--ease) 360ms backwards; }
  html.js .hero__line:nth-child(1) { animation: hero-rise 900ms var(--ease) 520ms backwards; }
  html.js .hero__line:nth-child(2) { animation: hero-rise 900ms var(--ease) 600ms backwards; }
  html.js .hero__head { opacity: 0; transition: opacity 300ms linear; }
  html.js .hero__head.is-ready { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__head { display: none; }
}
