/* The landing stage: miniature figures of Ashish doing what he does away from
   the screen. Lives in the hero, next to the headline. See stage.js. */

.hero-main{display:grid;grid-template-columns:minmax(0,1fr);gap:44px;align-items:center}
.hero-copy{min-width:0}
@media (min-width:1040px){
  .hero-main{grid-template-columns:minmax(0,1.22fr) minmax(0,.9fr);gap:52px}
  .hero.has-stage h1{font-size:clamp(38px,4.7vw,66px)}
}

.me-stage{
  --stage-floor:#eceef1;
  --stage-shadow:.2;
  --stage-ink:#111114;
  --stage-bubble:#ffffff;
  position:relative;aspect-ratio:1/1;width:100%;max-width:520px;justify-self:end;
  border-radius:28px;overflow:hidden;isolation:isolate;
  background:var(--stage-floor);
  -webkit-user-select:none;user-select:none;
  -webkit-tap-highlight-color:transparent;
}
[data-theme="dark"] .me-stage{
  --stage-floor:#15161c;
  --stage-shadow:.62;
  --stage-ink:#e7e7ea;
  --stage-bubble:#23242c;
  background:
    radial-gradient(90% 80% at 42% 36%,rgba(255,255,255,.085),rgba(255,255,255,0) 68%),
    var(--stage-floor);
}
/* on narrow screens the stage leads, as the first thing you meet */
@media (max-width:1039px){.me-stage{justify-self:start;max-width:560px;order:-1}.hero-main{gap:36px}}

/* a figure: a strip of frames and a matching strip of shadows, shown one frame at a time */
.me-fig{
  position:absolute;left:var(--x);top:var(--y);width:var(--w);aspect-ratio:var(--ar);
  padding:0;border:0;background:none;font:inherit;color:inherit;
  transform:translate(calc(var(--ax) * -100%),calc(var(--ay) * -100%));
  z-index:var(--z,1);pointer-events:none;cursor:pointer;
}
.me-fig[hidden]{display:none}
.me-pose{position:absolute;inset:0;transform-origin:calc(var(--ax) * 100%) calc(var(--ay) * 100%)}
.me-cel{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.me-cel img{position:absolute;left:0;top:0;width:calc(var(--cols) * 100%);height:calc(var(--rows) * 100%);max-width:none;display:block;pointer-events:none;-webkit-user-drag:none}
.me-cel--shadow{opacity:var(--stage-shadow)}
.me-fig--tight .me-cel--body{inset:auto;left:var(--hl);top:var(--ht);width:var(--hw);height:var(--hh)}

/* the clickable part is the figure itself, not the shadow around it */
.me-hit{position:absolute;left:var(--hl);top:var(--ht);width:var(--hw);height:var(--hh);pointer-events:auto;border-radius:12px}
.me-fig:focus-visible{outline:none}
.me-fig:focus-visible .me-hit{outline:2px solid var(--stage-ink);outline-offset:3px}
/* The hover lift moves the box itself, not a transform: a transform would hand the figure to the
   compositor mid-animation, and its frames could go missing for a moment while it is there. */
@media (hover:hover){.me-fig:hover .me-pose{top:-1.4%;bottom:1.4%}}
.me-pose{transition:top .2s ease-out,bottom .2s ease-out,transform .28s cubic-bezier(.34,1.56,.64,1),opacity .2s}

/* coming and going */
.me-fig.is-out .me-pose{opacity:0;transform:scale(.55);transition:transform .2s cubic-bezier(.5,0,.75,0),opacity .18s}
.me-fig.is-in .me-pose{animation:me-in .42s cubic-bezier(.34,1.56,.64,1) both}
@keyframes me-in{from{opacity:0;transform:scale(.6)}to{opacity:1;transform:none}}

.me-poof{position:absolute;left:var(--x);top:var(--y);width:var(--poof,16%);aspect-ratio:1;margin:calc(var(--poof,16%) * -.81) 0 0 calc(var(--poof,16%) * -.5);pointer-events:none;z-index:400;
  background:
    radial-gradient(closest-side,var(--stage-ink),transparent) 20% 30%/42% 42% no-repeat,
    radial-gradient(closest-side,var(--stage-ink),transparent) 78% 28%/36% 36% no-repeat,
    radial-gradient(closest-side,var(--stage-ink),transparent) 50% 72%/48% 48% no-repeat,
    radial-gradient(closest-side,var(--stage-ink),transparent) 12% 78%/26% 26% no-repeat,
    radial-gradient(closest-side,var(--stage-ink),transparent) 88% 74%/28% 28% no-repeat;
  opacity:0;animation:me-poof .46s ease-out both}
@keyframes me-poof{0%{opacity:.34;transform:scale(.35)}100%{opacity:0;transform:scale(1.5)}}

/* caption */
.me-say{
  position:absolute;left:0;top:0;z-index:500;max-width:min(64%,250px);
  padding:9px 12px;border-radius:12px;background:var(--stage-bubble);color:var(--stage-ink);
  font-size:13.5px;line-height:1.38;font-weight:500;text-align:left;
  box-shadow:0 10px 30px -12px rgba(0,0,0,.45),0 0 0 1px rgba(127,127,140,.18);
  opacity:0;transform:translate(var(--bx,0),var(--by,0)) scale(.94);transform-origin:var(--tail,50%) 100%;
  transition:opacity .16s,transform .24s cubic-bezier(.34,1.56,.64,1);pointer-events:none;
}
.me-say.is-on{opacity:1;transform:translate(var(--bx,0),var(--by,0)) scale(1)}
.me-say::after{content:"";position:absolute;left:var(--tail,50%);bottom:-5px;width:10px;height:10px;margin-left:-5px;background:inherit;transform:rotate(45deg);border-radius:2px}
.me-say.is-below::after{bottom:auto;top:-5px}
.me-say.is-below{transform-origin:var(--tail,50%) 0}

.me-hint{position:absolute;left:18px;bottom:14px;z-index:450;font-size:12px;letter-spacing:.02em;color:var(--stage-ink);opacity:.5;pointer-events:none;transition:opacity .4s}
.me-stage.is-touched .me-hint{opacity:0}

@media (prefers-reduced-motion:reduce){
  .me-fig.is-in .me-pose,.me-poof{animation:none}
  .me-pose,.me-say{transition:opacity .15s}
}

/* ---------------------------------------------------------------------------
   Staging. The hero's data-stage picks how stage and headline sit together on
   desktop (below 1040px every option falls back to the square stage above).
     0  side by side: headline left, square stage right
     1  stage on top: a landscape floor, headline and intro beneath it
     2  line-up: headline centred on top, the figures standing below it, no panel
     3  flanks: headline centred, figures down both sides of it, no panel
        (needs room at the sides: between 1040 and 1199px it is laid out as 2)
   stage.js reads the same attribute to choose where the figures stand.
   --------------------------------------------------------------------------- */
@media (min-width:1040px){
  .hero:is([data-stage="1"],[data-stage="2"],[data-stage="3"]) .hero-main{grid-template-columns:minmax(0,1fr)}
  .hero:is([data-stage="1"],[data-stage="2"],[data-stage="3"]) .me-say{max-width:250px}

  /* 1: a landscape floor on top, the headline across the full width, then intro and buttons side by side */
  .hero[data-stage="1"]{padding-top:40px}
  .hero[data-stage="1"] .hero-main{gap:30px}
  .hero[data-stage="1"] .me-stage{order:-1;max-width:none;justify-self:stretch;aspect-ratio:1096/392;--poof:7%}
  .hero[data-stage="1"] .hero-copy{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:56px;align-items:center}
  .hero[data-stage="1"] .greet{grid-column:1;grid-row:1;margin-bottom:14px}
  .hero[data-stage="1"] .avail{grid-column:2;grid-row:1;justify-self:end;margin-bottom:14px}
  .hero[data-stage="1"] h1{grid-column:1 / -1;grid-row:2;font-size:clamp(36px,4.3vw,60px);line-height:1.13;max-width:none;text-wrap:balance}
  .hero[data-stage="1"] .lede{grid-column:1;grid-row:3;margin-top:24px;max-width:66ch}
  .hero[data-stage="1"] .hero-btns{grid-column:2;grid-row:3;margin-top:24px;align-self:end;flex-wrap:nowrap}
  .hero[data-stage="1"] .marquee{margin-top:48px}

  /* 2 and 3: headline centred, and no floor panel: the figures stand on the hero itself */
  .hero:is([data-stage="2"],[data-stage="3"]) .hero-copy{display:flex;flex-direction:column;align-items:center;text-align:center}
  .hero:is([data-stage="2"],[data-stage="3"]) .hero-btns{justify-content:center}
  .hero:is([data-stage="2"],[data-stage="3"]) .me-stage{background:none;border-radius:0;overflow:visible;--stage-shadow:.24}
  [data-theme="dark"] .hero:is([data-stage="2"],[data-stage="3"]) .me-stage{background:none;--stage-shadow:.6}
}
/* 2: the line-up below the headline (also 3 on narrower desktops) */
@media (min-width:1040px){
  .hero[data-stage="2"]{padding-top:44px}
  .hero[data-stage="2"] .hero-main{gap:36px}
  .hero[data-stage="2"] .avail{margin-bottom:20px}
  .hero[data-stage="2"] .greet{margin-bottom:14px}
  .hero[data-stage="2"] h1{font-size:clamp(36px,4.2vw,58px);line-height:1.13;max-width:27ch;text-wrap:balance}
  .hero[data-stage="2"] .lede{max-width:60ch;margin-top:18px;font-size:15px;line-height:1.6}
  .hero[data-stage="2"] .hero-btns{margin-top:26px}
  .hero[data-stage="2"] .me-stage{max-width:none;justify-self:stretch;aspect-ratio:1096/372;--poof:7%}
  .hero[data-stage="2"] .me-hint{display:none}
  .hero[data-stage="2"] .marquee{margin-top:56px}
}
@media (min-width:1040px) and (max-width:1199.98px){
  .hero[data-stage="3"]{padding-top:44px}
  .hero[data-stage="3"] .hero-main{gap:22px}
  .hero[data-stage="3"] .avail{margin-bottom:20px}
  .hero[data-stage="3"] .greet{margin-bottom:14px}
  .hero[data-stage="3"] h1{font-size:clamp(36px,4.2vw,58px);line-height:1.13;max-width:27ch;text-wrap:balance}
  .hero[data-stage="3"] .lede{max-width:60ch;margin-top:18px;font-size:15px;line-height:1.6}
  .hero[data-stage="3"] .hero-btns{margin-top:26px}
  .hero[data-stage="3"] .me-stage{max-width:none;justify-self:stretch;aspect-ratio:1096/372;--poof:7%}
  .hero[data-stage="3"] .marquee{margin-top:56px}
}
/* 3: the figures stand down both sides of the headline; the stage is laid over the whole hero */
@media (min-width:1200px){
  .hero[data-stage="3"] .hero-main{position:relative;min-height:660px;align-items:center}
  .hero[data-stage="3"] .hero-copy{max-width:560px;margin:0 auto;position:relative;z-index:2}
  .hero[data-stage="3"] h1{font-size:clamp(34px,3.7vw,52px);line-height:1.16;max-width:16ch}
  .hero[data-stage="3"] .lede{font-size:16.5px;max-width:48ch}
  .hero[data-stage="3"] .me-stage{position:absolute;inset:-56px -52px -14px;width:auto;max-width:none;aspect-ratio:auto;justify-self:auto;pointer-events:none;z-index:3;--poof:6.5%}
  .hero[data-stage="3"] .me-hint{display:none}
}

/* The chosen staging (2) on every screen size: no "Pick a figure" line, and a quieter intro paragraph. */
.hero[data-stage="2"] .me-hint{display:none}
.hero[data-stage="2"] .lede{font-size:15px;line-height:1.6}
