/* Homepage hero: "feed it a problem". One set of markup, three layouts:
   phones (< 600px) a column with a sideways tray of problems; tablets (600 to 1023px) a column, or two columns in
   landscape; desktop (1024px+) the 1440 x 972 stage from the design canvas, scaled to fit the window by hero.js. */

.gbx-hero{position:relative;overflow:hidden;background-color:var(--bg-page);background-image:var(--dots-hero);background-size:var(--dots-hero-size)}
.gbx-hero__stage{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:calc(100vh - var(--nav-height-sm,68px));min-height:calc(100svh - var(--nav-height-sm,68px));box-sizing:border-box;padding:28px 20px 28px;color:var(--text-primary)}
.gbx-hero__intro{display:contents}
.gbx-hero__title{order:1;margin:0 0 12px;font-size:36px;font-weight:var(--fw-bold);line-height:var(--lh-tight);letter-spacing:var(--ls-display);text-align:center;text-wrap:balance}
.gbx-hero__lead{order:2;margin:0;font-size:17px;text-align:center;text-wrap:balance}
.gbx-hero__actions{order:6;display:flex;align-items:center;gap:24px;width:100%;margin-top:20px}
.gbx-hero__actions .gb-btn{flex:1}
.gbx-hero__actions .gb-link{display:none}
.gbx-hero__face{order:3;position:relative;width:210px;height:182px;margin-top:28px;z-index:1}
.gbx-hero__face canvas{position:absolute;left:-45px;top:-20px;width:300px;height:220px}
.gbx-hero__reply{order:4;position:relative;width:100%;min-height:150px;margin-top:20px;z-index:3}
.gbx-hero__qs{order:5;display:flex;gap:10px;width:calc(100% + 40px);margin:4px -20px 0;padding:4px 20px 12px;overflow-x:auto;scroll-padding-left:20px;scroll-snap-type:x mandatory;scrollbar-width:none}
.gbx-hero__qs::-webkit-scrollbar{display:none}
.gbx-hero__qs > *{scroll-snap-align:start}

/* a problem bubble */
.gbx-q{position:relative;flex-shrink:0;display:block;min-height:52px;padding:0 18px;border:0;background:transparent;color:var(--text-primary);font-family:var(--font-mono);font-size:14px;font-weight:500;white-space:nowrap;cursor:pointer;touch-action:pan-x;user-select:none;-webkit-user-select:none}
.gbx-q::before,.gbx-q::after{content:"";position:absolute;clip-path:var(--pixel-md)}
.gbx-q::before{inset:0;background:var(--pixel-bubble-edge)}
.gbx-q::after{inset:2px;background:var(--pixel-bubble-fill)}
.gbx-q > span{position:relative;z-index:1}
.gbx-q:hover::before,.gbx-q.is-drag::before{background:var(--accent)}
.gbx-q:hover::after,.gbx-q.is-drag::after{background:#4a0d20}
.gbx-q:focus-visible{outline:2px solid var(--focus-ring);outline-offset:3px}
.gbx-q.is-gone{display:none}
.gbx-q.is-busy{visibility:hidden}
.gbx-q.is-drag{z-index:20;cursor:grabbing;filter:drop-shadow(0 26px 30px rgba(0,0,0,.55))}
.gbx-q__tail{display:none}

/* the answer card */
.gbx-reply{position:relative;animation:gbx-reply-in 620ms cubic-bezier(.34,1.56,.64,1) both;transform-origin:50% 0}
.gbx-reply__tail{position:absolute;left:50%;top:-16px;width:12px;height:8px;margin-left:-6px;background:var(--pixel-bubble-edge)}
.gbx-reply__tail + .gbx-reply__tail{top:-8px;width:20px;margin-left:-10px}
.gbx-reply__card{padding:16px 18px;background:var(--pixel-bubble-fill);border:2px solid var(--pixel-bubble-edge);clip-path:var(--pixel-md)}
.gbx-reply__text{margin:0 0 6px;font-size:var(--fs-body);font-weight:var(--fw-semibold);line-height:1.45}
.gbx-reply__foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px}
.gbx-reply__meta{font-family:var(--font-mono);font-size:12px;color:var(--text-secondary)}
.gbx-hint{margin:40px 0 0;font-family:var(--font-mono);font-size:12px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-secondary);text-align:center;animation:gbx-hint 2.4s ease-in-out infinite}
.gbx-refill{margin-top:16px;min-height:44px;padding:0;background:transparent;border:0;cursor:pointer;font-family:inherit;font-size:15px;font-weight:600;color:var(--text-secondary)}
.gbx-refill:hover{color:var(--text-primary)}
.gbx-hero [hidden]{display:none !important}

/* the flight to the character, and the burst when it eats */
.gbx-ghost{position:fixed;z-index:50;pointer-events:none;transition:transform 600ms steps(9,end),opacity 120ms steps(2,end) 480ms}
.gbx-ghost.is-flying{opacity:0}
.gbx-burst{position:absolute;left:50%;top:50%;width:0;height:0;pointer-events:none}
.gbx-burst i{position:absolute;width:8px;height:8px;margin:-4px 0 0 -4px;background:var(--char-highlight);animation:gbx-burst 620ms cubic-bezier(.16,1,.3,1) both}
.gbx-burst i:nth-child(3n){background:var(--accent)}.gbx-burst i:nth-child(3n+1){background:var(--text-primary);width:6px;height:6px}
.gbx-burst b{position:absolute;left:-90px;top:-76px;width:180px;height:152px;border:2px solid rgba(255,59,114,.6);animation:gbx-ripple 700ms cubic-bezier(.16,1,.3,1) both}

@keyframes gbx-swipe{0%{transform:translateX(22px);opacity:0}20%{opacity:1}80%{transform:translateX(-22px);opacity:1}100%{transform:translateX(0);opacity:1}}
@keyframes gbx-reply-in{0%{opacity:0;transform:scale(.3)}60%{opacity:1}100%{opacity:1;transform:scale(1)}}
@keyframes gbx-hint{0%,100%{opacity:.6}50%{opacity:1}}
@keyframes gbx-ripple{0%{transform:scale(.55);opacity:.55}100%{transform:scale(1.9);opacity:0}}
@keyframes gbx-burst{0%{transform:translate(0,0) scale(1);opacity:1}100%{transform:translate(var(--bx),var(--by)) scale(.2);opacity:0}}
@keyframes gbx-float{0%,100%{translate:0 0}50%{translate:0 -9px}}

.gbx-swipe{display:none}

/* ---------- phones: no drag hint; problems sit under the character, the answer opens below them, with a swipe cue ---------- */
@media (max-width:599px){
  .gbx-hero__stage{padding:48px 20px}
  .gbx-hero__face{margin-top:40px}
  .gbx-hint{display:none}
  .gbx-hero__qs{order:4;margin-top:20px}
  .gbx-swipe{order:4;display:flex;justify-content:center;width:100%;margin-top:4px;color:var(--text-secondary)}
  .gbx-swipe svg{width:64px;height:20px;animation:gbx-swipe 1.5s steps(8,end) 600ms 3 both}
  .gbx-swipe.is-done{visibility:hidden}
  .gbx-hero__reply{order:5;min-height:0;margin-top:0;scroll-margin-bottom:16px}
  .gbx-hero__reply .gbx-reply{margin-top:20px}
  .gbx-reply__tail{display:none}
  .gbx-hero__actions{margin-top:32px}
}

@media (max-width:599px) and (max-height:700px){
  .gbx-hero__stage{padding:20px 20px}
  .gbx-hero__face{margin-top:8px}
  .gbx-hero__qs{margin-top:8px}
  .gbx-hero__actions{margin-top:20px}
}

/* ---------- tablets ---------- */
@media (min-width:600px) and (max-width:1023px){
  .gbx-hero__stage{padding:48px 40px 40px;min-height:calc(100vh - var(--nav-height-sm,68px));box-sizing:border-box}
  .gbx-hero__title{max-width:13ch;margin-bottom:16px;font-size:clamp(48px,7vw,64px)}
  .gbx-hero__lead{max-width:30em;font-size:19px}
  .gbx-hero__face{width:240px;height:208px;margin-top:36px}
  .gbx-hero__face canvas{left:-100px;top:-40px;width:440px;height:288px}
  .gbx-hero__reply{max-width:560px;margin-top:28px}
  .gbx-reply__text{font-size:var(--fs-body-l)}
  .gbx-hero__qs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;width:100%;max-width:720px;margin:20px 0 0;padding:0;overflow:visible}
  .gbx-q{width:100%;min-height:56px;padding:8px 14px;white-space:normal;line-height:1.3;text-align:center;touch-action:none}
  .gbx-q.is-gone{display:block;visibility:hidden}
  .gbx-hero__actions{width:auto;justify-content:center;margin-top:32px}
  .gbx-hero__actions .gb-btn{flex:none}
  .gbx-hero__actions .gb-link{display:inline-flex}
}
@media (min-width:600px) and (max-width:1023px) and (max-height:860px) and (orientation:portrait){
  .gbx-hero__stage{padding-top:28px}
  .gbx-hero__title{font-size:clamp(40px,5.6vh,52px)}
  .gbx-hero__face{margin-top:4px;zoom:.8}
  .gbx-hero__reply{min-height:118px;margin-top:0}
}
@media (min-width:600px) and (max-width:1023px) and (orientation:landscape){
  .gbx-hero__stage{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto auto auto;grid-template-areas:"title face" "lead reply" "actions qs";column-gap:40px;align-items:start;align-content:center;padding:40px 40px 32px}
  .gbx-hero__title{grid-area:title;align-self:end;text-align:left;font-size:clamp(40px,5vw,52px)}
  .gbx-hero__lead{grid-area:lead;text-align:left;font-size:17px}
  .gbx-hero__actions{grid-area:actions;justify-content:flex-start;margin-top:24px}
  .gbx-hero__face{grid-area:face;justify-self:center;margin-top:0;zoom:.72}
  .gbx-hero__reply{grid-area:reply;min-height:112px;margin-top:4px}
  .gbx-hero__reply .gbx-hint{display:none}
  .gbx-hero__qs{grid-area:qs;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:8px}
}

/* ---------- desktop: the canvas stage, 1440 x 972, scaled by --k ---------- */
@media (min-width:1024px){
  .gbx-hero{height:max(calc(972px * var(--k,1)),calc(100vh - var(--nav-height,88px)))}
  .gbx-hero{height:max(calc(972px * var(--k,1)),calc(100svh - var(--nav-height,88px)))}
  .gbx-hero__stage{display:block;position:absolute;left:50%;top:calc(50% - 486px * var(--k,1));width:1440px;height:972px;min-height:0;margin-left:-720px;padding:0;transform:scale(var(--k,1));transform-origin:50% 0}
  .gbx-hero__intro{display:flex;flex-direction:column;align-items:center;position:absolute;left:0;top:88px;width:1440px;text-align:center;z-index:2}
  .gbx-hero__title{max-width:720px;margin:0 0 24px;font-size:68px}
  .gbx-hero__lead{max-width:720px;margin:0 0 36px;font-size:var(--fs-body-l)}
  .gbx-hero__actions{width:auto;gap:28px;margin:0}
  .gbx-hero__actions .gb-btn{flex:none}
  .gbx-hero__actions .gb-link{display:inline-flex}
  .gbx-hero__face{position:absolute;left:570px;top:472px;width:300px;height:260px;margin:0}
  .gbx-hero__face canvas{left:-50px;top:-40px;width:400px;height:340px}
  .gbx-hero__reply{position:absolute;left:470px;top:762px;width:500px;min-height:0;margin:0}
  .gbx-reply__card{padding:24px 28px}
  .gbx-reply__text{margin-bottom:12px;font-size:var(--fs-h5);letter-spacing:var(--ls-tight)}
  .gbx-hint{margin:0}
  .gbx-hero__qs{display:block;position:static;width:auto;margin:0;padding:0;overflow:visible}
  .gbx-q{position:absolute;padding:16px 22px;font-size:15px;touch-action:none;filter:drop-shadow(0 16px 22px rgba(0,0,0,.4));animation:gbx-float 3.6s ease-in-out infinite}
  .gbx-q.is-gone{display:block;visibility:hidden}
  .gbx-q.is-drag,.gbx-q:hover{animation-play-state:paused}
  .gbx-q:nth-child(1){left:150px;top:462px;animation-delay:0s}
  .gbx-q:nth-child(2){left:96px;top:622px;animation-delay:.45s}
  .gbx-q:nth-child(3){left:190px;top:782px;animation-delay:.9s}
  .gbx-q:nth-child(4){left:1010px;top:462px;animation-delay:1.35s}
  .gbx-q:nth-child(5){left:1070px;top:622px;animation-delay:1.8s}
  .gbx-q:nth-child(6){left:990px;top:782px;animation-delay:2.25s}
  .gbx-q__tail{display:block;position:absolute;z-index:1;bottom:-8px;width:12px;height:8px;background:var(--pixel-bubble-edge)}
  .gbx-q__tail + .gbx-q__tail{bottom:-14px;width:6px}
  .gbx-q[data-side="r"] .gbx-q__tail{right:26px}.gbx-q[data-side="r"] .gbx-q__tail + .gbx-q__tail{right:20px}
  .gbx-q[data-side="l"] .gbx-q__tail{left:26px}.gbx-q[data-side="l"] .gbx-q__tail + .gbx-q__tail{left:20px}
}

@media (prefers-reduced-motion:reduce){
  .gbx-q,.gbx-reply,.gbx-hint,.gbx-swipe svg,.gbx-burst i,.gbx-burst b{animation:none !important}
  .gbx-ghost{transition:none}
}
