/* The Gummybear homepage hero: a pixel-art camp at dusk, made for a phone held upright.
 *
 * The picture fills the first screen and runs on a little under it, where the meadow sinks into the dark page the
 * next section sits on. It is anchored at the bottom, so a short screen loses sky from the top, never the bear.
 * Over it: the glass heading, a line the bear types, the glass button. camp.js measures the screen and the picture
 * and sets the custom properties below; nothing here is positioned by hand. */

@font-face { font-family: 'Noto Sans'; font-weight: 500; font-display: swap; src: url('fonts/noto-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans'; font-weight: 600; font-display: swap; src: url('fonts/noto-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 500; font-display: swap; src: url('fonts/roboto-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 600; font-display: swap; src: url('fonts/roboto-mono-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 700; font-display: swap; src: url('fonts/roboto-mono-latin-700-normal.woff2') format('woff2'); }

:root {
  /* set by camp.js */
  --pic-w: 442px; --pic-h: 796px;    /* the picture, at two CSS pixels a cell */
  --pic-x: 0px; --pic-y: 0px;        /* its top left corner on the stage */
  --fade: 220px;                     /* how much of it lies under the first screen */
  --crop: 0px;                       /* sky above its top that is never shown */
  --head-x: 24px; --head-y: 80px; --head-w: 240px; --head-size: 54px;
  --typed-y: 300px; --typed-size: 15px;
  --cta-x: 24px; --cta-y: 340px;
  --sky-top: #736796;                /* the picture's top edge: the stand-in while it loads, the phone's bars after */
  /* the page's own */
  --page: #121212;                   /* the dark the hero ends in */
  --cream: #FFF6E9;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sans: 'Noto Sans', -apple-system, system-ui, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
html[data-scene$='camp-b'] { --sky-top: #73699F; --pic-h: 832px; --fade: 120px; }

* { box-sizing: border-box; }
html { overflow-x: clip; background: var(--page); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; overflow-x: clip; font-family: var(--sans); color: var(--cream); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* the site's dark page: #1A1A1A at the top of the screen to #121212 at the bottom, fixed to the screen */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: linear-gradient(to bottom, #1A1A1A, var(--page)); }
a { color: inherit; text-decoration: none; }
/* While the picture is at the top of the page on a phone (data-sky-bar: there from the first paint, kept up by camp.js)
 * the phone's own bars, and the stretch you see when you pull the page down, are the sky's colour: both show the root's
 * background. Two things keep that colour from showing anywhere else. The fixed backdrop gives up only its top part,
 * which the picture covers. And the hero carries a slab of the page's dark behind its lower half and most of a screen
 * below it: Safari shows the page itself under its bottom bar, where a fixed backdrop does not reach. */
html[data-sky-bar] { background: var(--sky-top); }
html[data-sky-bar] body::before { -webkit-clip-path: inset(40% 0 0 0); clip-path: inset(40% 0 0 0); }
.hero::after { content: ''; position: absolute; z-index: -2; left: 0; right: 0; top: 50%; bottom: -75vh; background: var(--page); pointer-events: none; }

/* ---------- the stage and the picture ---------- */
.hero { position: relative; display: flex; justify-content: center; }
.stage {
  position: relative; flex: none; overflow: hidden;
  width: min(100%, var(--pic-w));
  height: calc(100vh + var(--fade));
  height: calc(100svh + var(--fade));                 /* the first screen, plus the meadow's fall into the dark */
  min-height: calc(440px + var(--fade));
  max-height: calc(var(--pic-h) - var(--crop));       /* never taller than the picture: no gap above it */
}
.pic { position: absolute; left: var(--pic-x); top: var(--pic-y); width: var(--pic-w); height: var(--pic-h); }
/* until the picture has loaded: its sky's colour, falling to the page's dark. The picture comes up over it, and then
 * it goes, because the picture's foot is see-through and the page must show there, not this */
.pic::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-top) 22%, var(--page) 78%);
  transition: opacity 0.3s ease 0.5s;
}
.pic canvas {
  position: relative; width: 100%; height: 100%; display: block; image-rendering: pixelated;
  opacity: 0; transition: opacity 0.5s ease;
}
html[data-pic] .pic::before { opacity: 0; }
html[data-pic] .pic canvas { opacity: 1; }
.next { min-height: 100vh; }

/* ---------- the words wait for the picture, then rise ----------
 * The glass in the heading is cut from the picture, so the words are held back until camp.js says it is ready
 * (data-ready), and then come up one after another. Without the script nothing is held back. */
html[data-js]:not([data-ready]) :is(.headline, .typed, .cta, .scrim) { visibility: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
html[data-ready] .headline { animation: rise 0.9s var(--ease) 0.05s backwards; }
html[data-ready] .typed { animation: rise 0.9s var(--ease) 0.15s backwards; }
html[data-ready] .cta { animation: rise 0.9s var(--ease) 0.25s backwards; }
html[data-ready] .scrim { animation: rise 1.2s ease backwards; }

/* ---------- the heading ----------
 * Glass letters: every letter a pane of frosted glass. Inside it the picture behind, blurred and lifted (camp.js
 * cuts that from the canvas and hands it over as --frost) under a veil of white; round it a fine light rim; along
 * the tops a brighter rim where the light catches (the silent copy, .shine); under it a soft shadow. */
.headline {
  position: absolute; margin: 0; left: var(--head-x); top: var(--head-y);
  padding-bottom: 0.3em;                              /* text filled this way is painted only inside its box: room for the g's tail */
  font-family: var(--mono); font-size: var(--head-size); font-weight: 700; letter-spacing: -0.04em; line-height: 1.04;
  white-space: nowrap; text-align: center;
  background-image: linear-gradient(rgb(255 255 255 / 0.27), rgb(255 255 255 / 0.27)), var(--frost, none);
  background-size: 100% 100%, var(--frost-size, 100% 100%);
  background-position: 0 0, var(--frost-pos, 0 0);
  background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  -webkit-text-stroke: 0.8px rgb(255 255 255 / 0.45);
  filter: drop-shadow(0 12px 24px rgb(4 6 20 / 0.42)) drop-shadow(0 1px 1px rgb(4 6 20 / 0.30));
}
.headline.shine {
  background: none; filter: none; pointer-events: none; -webkit-user-select: none; user-select: none;
  -webkit-text-stroke: 1.3px rgb(255 255 255 / 0.95);
  -webkit-mask: linear-gradient(180deg, transparent 15%, #000 20%, transparent 50%) 0 0 / 100% 1.04em repeat-y;
  mask: linear-gradient(180deg, transparent 15%, #000 20%, transparent 50%) 0 0 / 100% 1.04em repeat-y;
}
/* a soft dark patch behind the heading, so the glass reads over a bright peak */
.scrim {
  position: absolute; pointer-events: none; border-radius: 50%;
  left: calc(var(--head-x) + var(--head-w) / 2 - 200px); top: calc(var(--head-y) - 54px); width: 400px; height: 300px;
  background: radial-gradient(closest-side, rgb(10 16 46 / 0.50), rgb(10 16 46 / 0.22) 60%, transparent);
  opacity: var(--scrim, 1);                           /* camp.js: as strong as the picture behind is bright */
}

/* ---------- the typed line ----------
 * The bear says hello, then what he is here for, one line at a time, typed and rubbed out (camp.js has the lines).
 * Roboto Mono, white, with a blinking caret. Its box is as wide as the line being typed will be and the text starts
 * at the box's left, so nothing slides sideways while he types. */
.typed {
  position: absolute; z-index: 2; left: 0; right: 0; top: var(--typed-y); margin: 0;
  text-align: center; white-space: nowrap;
  font: 500 var(--typed-size)/22px var(--mono); letter-spacing: -0.01em;
  color: rgb(255 255 255 / 0.96); text-shadow: 0 1px 2px rgb(10 14 40 / 0.7), 0 0 12px rgb(10 14 40 / 0.5);   /* it must read over lit snow too */
}
.typed .line { display: inline-block; text-align: left; }
.typed .say::after {
  content: ''; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -0.16em;
  background: #FFFFFF; animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.typed .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- the button ----------
 * A capsule in the heading's glass: the picture behind, blurred and lifted, a faint white veil, a fine white rim, a
 * brighter rim along the top (.rim), a soft shadow. Its words shimmer the way a status does in the app's chat: a
 * soft white band sweeps through them left to right in 1.6 s, then rests 0.6 s. It is drawn 34 px tall; the area
 * that answers a finger is larger (::after). */
.cta {
  position: absolute; isolation: isolate;
  left: var(--cta-x); top: var(--cta-y);
  display: block; height: 34px; border-radius: 17px;
  font: 600 13px/34px var(--mono); letter-spacing: -0.01em; white-space: nowrap;
  color: #F5F5F7;
  background: rgb(255 255 255 / 0.12);
  -webkit-backdrop-filter: blur(7px) brightness(1.55) saturate(1.2);
  backdrop-filter: blur(7px) brightness(1.55) saturate(1.2);
  box-shadow: inset 0 0 0 0.8px rgb(255 255 255 / 0.45), 0 12px 24px rgb(4 6 20 / 0.42), 0 1px 1px rgb(4 6 20 / 0.30);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform 0.18s var(--ease), background-color 0.18s;
}
.cta::after { content: ''; position: absolute; inset: -9px -8px; }      /* 52 px tall to the finger */
.cta .label {
  position: relative; display: block; padding: 0 18px;
  background-image: linear-gradient(90deg, rgb(255 255 255 / 0.8) 0 44%, #FFFFFF 50%, rgb(255 255 255 / 0.8) 56% 100%);
  background-size: 500% 100%; background-position: 70% 0;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 1px 2px rgb(8 10 28 / 0.35));
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { 0% { background-position: 70% 0; } 72.7%, 100% { background-position: 30% 0; } }
.cta .rim {
  position: absolute; inset: 0; border-radius: inherit; padding: 1.3px; pointer-events: none;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.95) 0 12%, rgb(255 255 255 / 0) 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
@media (hover: hover) { .cta:hover { background-color: rgb(255 255 255 / 0.18); } }
.cta:active { transform: scale(0.97); }
.cta:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 4px; }

/* ---------- a picture's own needs ----------
 * camp-b (JK's own picture) and the dropped camp-min: over a bright snow peak or pale mist the button's glass must
 * not go pale under its white words, so it is a shade darker. */
html[data-scene$='camp-min'] .cta, html[data-scene$='camp-b'] .cta {
  background: rgb(40 30 70 / 0.22);
  -webkit-backdrop-filter: blur(7px) brightness(0.86) saturate(1.3);
  backdrop-filter: blur(7px) brightness(0.86) saturate(1.3);
}

/* ---------- stillness ----------
 * For someone who asked their phone for less motion, and for screenshots (?animate=off, ?freeze): nothing rises,
 * blinks or shimmers. camp.js holds the picture and the typed line still for the same cases. */
@media (prefers-reduced-motion: reduce) {
  html[data-ready] :is(.headline, .typed, .cta, .scrim), .typed .say::after, .cta .label { animation: none; }
  .pic canvas, .pic::before { transition: none; }
}
html[data-animate='off'][data-ready] :is(.headline, .typed, .cta, .scrim), html[data-animate='off'] .typed .say::after, html[data-animate='off'] .cta .label { animation: none; }
html[data-animate='off'] :is(.pic canvas, .pic::before) { transition: none; }
