/* The landing's key visual, "scene" (landing-scene.js): a warm light, from the
   lamp at the top to the brand's accent at the bottom. The words are dark, at
   the top on the left; the button is the brand's deep colour, since its
   accent is the background's. Everything here hangs off .kv-scene (the
   screen) or .kv-scene-art (the picture), so the direction is dropped with
   this file. */

.kv-scene-art {
  /* Over the warm light, a dusk along the bottom, under the phone: the button
     and the footer read on it, and the card and Bubbles stay bright. A
     gradient, not a blur: nothing to compute. */
  background:
    linear-gradient(to bottom, transparent 66%, color-mix(in srgb, var(--deep) 32%, transparent) 81%, color-mix(in srgb, var(--deep) 72%, transparent) 100%),
    linear-gradient(172deg, var(--lamp) 0%, color-mix(in srgb, var(--tableGlow) 50%, var(--lamp)) 26%, color-mix(in srgb, var(--accent) 82%, var(--tableGlow)) 62%, var(--accent) 100%);
}
.kv-scene-art .kv-phone { z-index: 1; }
/* The window's edges in a plain colour, for a phone's Safari bars (landing-scene.js):
   the light's at the top, the dusk's at the bottom, so they are not seen. */
.kv-edge { position: fixed; left: 0; right: 0; height: 0.25rem; z-index: -1; }
@media (hover: hover) { .kv-edge { display: none; } }
.kv-edge.top { top: 0; background-color: var(--lamp); }
.kv-edge.bottom { bottom: 0; background-color: color-mix(in srgb, var(--deep) 72%, var(--accent)); }

/* Ink, with a white outline under it (the inverse of the answer's on the
   card's corner) and a light halo, so it reads on the dusk and on the card. */
.kv-scene .landing-foot { color: var(--paperInk); text-shadow: 0 0 0.375rem color-mix(in srgb, var(--paperWhite) 85%, transparent), 0 0 0.125rem color-mix(in srgb, var(--paperWhite) 70%, transparent); -webkit-text-stroke: 0.22em var(--paperWhite); paint-order: stroke fill; }

/* The words and the bar over a light picture: the paper's ink in place of
   white, and surfaces of paper in place of glass. */
.screen.landing.kv-scene {
  --ink: var(--paperInk);
  --inkMuted: color-mix(in srgb, var(--paperInk) 78%, transparent);
  --surface: color-mix(in srgb, var(--paperWhite) 42%, transparent);
  --surfacePressed: color-mix(in srgb, var(--paperWhite) 70%, transparent);
  --surfaceStroke: color-mix(in srgb, var(--paperInk) 24%, transparent);
  color: var(--ink);
}
/* The two ways in, Get started and Log in, alike: paper on an edge of their own,
   a darker shade under the face, as a shadow, so it takes no room, and a
   fine light line along the face's top. Under a mouse the face rises a
   pixel and lightens; pressed, it drops onto the edge at once, with no
   easing. */
.kv-scene .btn.primary, .kv-scene .sign-in-btn {
  --edge: color-mix(in srgb, var(--paperInk) 32%, var(--accent));
  --depth: 0.1875rem;
  --rise: 0px;
  translate: 0 calc(var(--rise) * -1);
  transition: background-color 0.15s ease, translate 0.15s ease, box-shadow 0.15s ease;
  color: var(--ink);
  background: color-mix(in srgb, var(--paperWhite) 62%, transparent);
  border-color: color-mix(in srgb, var(--paperInk) 22%, transparent);
  box-shadow:
    inset 0 0.0625rem 0 color-mix(in srgb, var(--paperWhite) 80%, transparent),
    0 calc(var(--depth) + var(--rise)) 0 var(--edge);
}
@media (hover: hover) and (pointer: fine) {
  .kv-scene .btn.primary:hover, .kv-scene .sign-in-btn:hover { --rise: 1px; background: var(--paperWhite); }
}
/* Get started: the same depth, in the brand's deep colour, with the light glow
   round it; its edge a darker shade of its face. */
.kv-scene .btn.primary {
  --edge: color-mix(in srgb, var(--canvas) 45%, var(--deep));
  --depth: 0.25rem;
  min-height: 3.75rem;
  font-size: 1.0625rem;
  color: var(--paper);
  background: var(--canvas);
  border-color: var(--canvas);
  box-shadow:
    inset 0 0.0625rem 0 color-mix(in srgb, var(--paper) 22%, transparent),
    0 calc(var(--depth) + var(--rise)) 0 var(--edge),
    0 0 1.75rem color-mix(in srgb, var(--paperWhite) 55%, transparent);
}
@media (hover: hover) and (pointer: fine) {
  .kv-scene .btn.primary:hover { background: color-mix(in srgb, var(--canvas) 88%, var(--wallLit)); border-color: color-mix(in srgb, var(--canvas) 88%, var(--wallLit)); }
}
.kv-scene .pitch .btn.primary:active {
  background: var(--canvas);
  box-shadow: inset 0 0.0625rem 0 color-mix(in srgb, var(--paper) 22%, transparent), 0 0 1.75rem color-mix(in srgb, var(--paperWhite) 55%, transparent);
}
.kv-scene .btn.primary:active, .kv-scene .sign-in-btn:active {
  transform: none;
  translate: 0 var(--depth);
  transition: none;
  background: var(--paperWhite);
  box-shadow: inset 0 0.0625rem 0 color-mix(in srgb, var(--paperWhite) 80%, transparent);
}
.reduce-motion .kv-scene .btn.primary, .reduce-motion .kv-scene .sign-in-btn { transition: none; }
.kv-scene .btn:focus-visible { outline-color: var(--paperInk); }

/* The phone (landing-scene.js phone), in the picture itself (.kv, play.css:
   fixed to the window, behind the words, and clipped by it), so it can be far
   too big: it starts under the headline, beside the footer's words, and runs
   off the right and bottom edges, behind the button. Its body is turned a
   little (.kv-device: --ry, --rx, --rz); Bubbles stands over it, flat. The
   game on its screen is
   drawn to the phone's width, so everything inside is in units of the screen
   (cqw). The meters have just moved, cash up and portfolio down; a card from
   Bubbles is caught mid-swipe, leaning left, "Peek inside first" over it.
   Nothing moves. */
.kv-phone {
  --top: calc(6rem + 2.94 * clamp(2.75rem, 14vw, 3.75rem));
  --pw: min(104vw, calc((100dvh - var(--top) - 6.5rem) * 0.69));
  --ry: -14deg;
  --rx: 7deg;
  --rz: -2deg;
  --t: calc(var(--pw) * 0.006);
  --side: color-mix(in srgb, var(--deep) 62%, var(--wallLit));
  --sideDark: color-mix(in srgb, var(--deep) 86%, var(--wallLit));
  position: absolute;
  top: var(--top);
  left: max(42vw, 10.5rem);
  width: var(--pw);
  aspect-ratio: 9 / 19.5;
  pointer-events: none;
  user-select: none;
}
/* The body that turns: its right edge towards us, its top leaning back, so
   its right side and its bottom show their thickness, drawn as a stack of
   hard shadows (--t: one step of it). Turned about its middle, so the
   perspective doesn't drag one corner. Everything on it is in its own units
   (cqw), the screen's contents in the screen's. */
.kv-device {
  position: absolute;
  inset: 0;
  container-type: inline-size;
  border-radius: calc(var(--pw) * 0.16);
  background: linear-gradient(120deg, color-mix(in srgb, var(--deep) 70%, var(--wallLit)) 0%, color-mix(in srgb, var(--deep) 55%, var(--shade)) 38%, color-mix(in srgb, var(--deep) 40%, var(--shade)) 100%);
  box-shadow:
    inset 0 0 0 calc(var(--pw) * 0.006) color-mix(in srgb, var(--paper) 26%, transparent),
    var(--t) calc(var(--t) * 0.6) 0 var(--side),
    calc(var(--t) * 2) calc(var(--t) * 1.2) 0 var(--side),
    calc(var(--t) * 3) calc(var(--t) * 1.8) 0 var(--side),
    calc(var(--t) * 4) calc(var(--t) * 2.4) 0 var(--sideDark),
    calc(var(--t) * 5) calc(var(--t) * 3) 0 var(--sideDark),
    calc(var(--pw) * 0.08) calc(var(--pw) * 0.1) calc(var(--pw) * 0.16) rgba(var(--paperShadeRgb), 0.42),
    calc(var(--pw) * 0.02) calc(var(--pw) * 0.03) calc(var(--pw) * 0.05) rgba(var(--paperShadeRgb), 0.3);
  transform-origin: 50% 40%;
  transform: perspective(calc(var(--pw) * 4)) rotateZ(var(--rz)) rotateY(var(--ry)) rotateX(var(--rx));
}
.kv-screen {
  position: absolute;
  inset: calc(var(--pw) * 0.035);
  overflow: hidden;
  container-type: inline-size;
  border-radius: calc(var(--pw) * 0.13);
  background: radial-gradient(120% 70% at 50% 78%, var(--canvas) 0%, var(--deep) 100%);
  color: var(--paper);
}
/* The glass: a band of light across it, from the lamp's side. */
.kv-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(118deg, color-mix(in srgb, var(--paperWhite) 13%, transparent) 0%, color-mix(in srgb, var(--paperWhite) 4%, transparent) 24%, transparent 24.2%);
}
.kv-screen svg { display: block; }
.kv-meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5cqw; padding: 17cqw 8cqw 0; }
.kv-meter { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2.4cqw; }
.kv-meter > svg:first-child { width: 6.5cqw; height: 6.5cqw; }
.kv-track { display: flex; width: 100%; height: 2cqw; border-radius: 1cqw; overflow: hidden; background: color-mix(in srgb, var(--paper) 22%, transparent); }
.kv-fill, .kv-delta { flex: none; width: calc(var(--level) * 100%); height: 100%; }
.kv-fill { background: var(--paperWhite); }
.kv-meter.up { --tone: var(--verdictGood); }
.kv-meter.down { --tone: var(--verdictBad); }
/* A meter the card has just moved: its sign and its whole bar in its colour,
   lit; what it lost, where it used to reach, faint; and the tag over it. */
.kv-meter.up > svg:first-child, .kv-meter.down > svg:first-child {
  color: var(--tone);
  scale: 1.25;
  filter: drop-shadow(0 0 1.6cqw color-mix(in srgb, var(--tone) 70%, transparent));
}
.kv-meter.up .kv-track, .kv-meter.down .kv-track {
  height: 2.6cqw;
  margin-top: -0.3cqw;
  box-shadow: 0 0 0 0.5cqw color-mix(in srgb, var(--tone) 30%, transparent), 0 0 3.5cqw color-mix(in srgb, var(--tone) 60%, transparent);
}
.kv-meter.up .kv-fill, .kv-meter.up .kv-delta, .kv-meter.down .kv-fill { background: var(--tone); }
.kv-meter.down .kv-delta { background: color-mix(in srgb, var(--tone) 30%, transparent); }
.kv-badge {
  position: absolute;
  top: -9.5cqw;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 0.6cqw;
  padding: 0.5cqw 1.6cqw 0.5cqw 1.1cqw;
  border-radius: 999px;
  background: var(--tone);
  color: var(--deep);
  font-size: 3.3cqw;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 0 3cqw color-mix(in srgb, var(--tone) 55%, transparent);
}
.kv-badge > svg:first-child { width: 2.6cqw; height: 2.6cqw; fill: currentColor; }
.kv-screen .kv-prompt {
  margin: 6.5cqw 8cqw 0;
  font-size: 4.6cqw;
  font-weight: 500;
  line-height: 1.38;
  text-align: center;
  text-wrap: balance;
  color: var(--paperWhite);
}
.kv-deck { position: absolute; left: 10cqw; right: 10cqw; top: var(--deckTop, 86cqw); aspect-ratio: 63 / 88; }
.kv-back, .kv-card { position: absolute; inset: 0; border-radius: 6cqw; }
.kv-back {
  background: linear-gradient(160deg, color-mix(in srgb, var(--deep) 80%, var(--wallLit)) 0%, var(--deep) 60%);
  border: 0.5cqw solid color-mix(in srgb, var(--paper) calc(22% - var(--depth) * 2%), transparent);
  translate: 0 calc(var(--depth) * -2.1cqw);
  scale: calc(1 - var(--depth) * 0.018);
  filter: brightness(calc(1 - var(--depth) * 0.06));
  /* Each card a card thick: its edge, then its shadow on the one under it. */
  box-shadow:
    0 0.4cqw 0 color-mix(in srgb, var(--deep) 60%, var(--shade)),
    0 3cqw 4cqw rgba(var(--paperShadeRgb), 0.5);
}
.kv-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--paper);
  /* Its thickness, a paper edge a shade darker, then the shadow it throws
     on the deck as it lifts off it: close and sharp, and far and soft. */
  box-shadow:
    inset 0 0.4cqw 0 color-mix(in srgb, var(--paperWhite) 70%, transparent),
    0.3cqw 0.6cqw 0 var(--paperEdge),
    0.6cqw 1.2cqw 0 color-mix(in srgb, var(--paperEdge) 75%, var(--paperInk)),
    1.5cqw 3cqw 3cqw rgba(var(--paperShadeRgb), 0.45),
    4cqw 9cqw 12cqw rgba(var(--paperShadeRgb), 0.4);
  transform-origin: 50% 100%;
  transform: translateX(-14%) rotate(-10deg);
}
.kv-name {
  position: relative;
  z-index: 1;
  align-self: center;
  margin-top: 4cqw;
  font-size: 3.8cqw;
  font-weight: 700;
  white-space: nowrap;
  color: var(--paperInk);
  /* The footer's light halo, so it reads where Bubbles comes near. */
  text-shadow: 0 0 0.375rem color-mix(in srgb, var(--paperWhite) 85%, transparent), 0 0 0.125rem color-mix(in srgb, var(--paperWhite) 70%, transparent); -webkit-text-stroke: 0.22em var(--paperWhite); paint-order: stroke fill;
}
/* Bubbles, over the phone and not in its screen, so nothing clips him: wider
   than the phone, his top under the card's edge, his left side out past the
   frame, and the shadow he was drawn with falling on his card. */
.kv-portrait {
  position: absolute;
  left: var(--bx, calc(var(--pw) * -0.34));
  top: var(--by, calc(var(--pw) * 0.8));
  width: var(--bw, calc(var(--pw) * 1.02));
  max-width: none;
  height: auto;
  rotate: -7deg;
  filter: drop-shadow(calc(var(--pw) * -0.01) calc(var(--pw) * 0.02) calc(var(--pw) * 0.03) rgba(var(--paperShadeRgb), 0.35));
}
.kv-rim { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.kv-rim text {
  fill: var(--paperWhite);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.01em;
  /* An ink outline under the white, so it reads on the light and on the dark. */
  stroke: var(--deep);
  stroke-width: 2.2px;
  stroke-linejoin: round;
  paint-order: stroke fill;
}
.kv-keys { position: absolute; left: 7cqw; right: 7cqw; bottom: 8cqw; display: flex; justify-content: space-between; }
.kv-key {
  display: grid;
  place-items: center;
  width: 12cqw;
  height: 12cqw;
  border-radius: 50%;
  background: color-mix(in srgb, var(--deep) 88%, transparent);
  border: 0.4cqw solid color-mix(in srgb, var(--paper) 20%, transparent);
}
.kv-key svg { width: 5cqw; height: 5cqw; }

/* A phone on its side has no room for another. */
@media (max-height: 500px) {
  .kv-phone { display: none; }
}
/* A phone: Bubbles lower, under his card's name. */
@media (max-width: 599px) {
  /* Up under the headline's last line, which stands over its top edge. */
  .kv-phone { --deckTop: 72cqw; --by: calc(var(--pw) * 0.76); --top: calc(0.75rem + 2.94 * clamp(2.75rem, 14vw, 3.75rem)); }
}
/* A short phone: the phone starts beside the headline's last word, to stay big. */
@media (max-width: 599px) and (max-height: 740px) and (min-height: 501px) {
  .kv-phone { --top: 9.5rem; left: max(48vw, 11.5rem); }
}
/* A tablet: the phone to the right of the middle, where the footer ends. */
@media (min-width: 600px) and (min-height: 501px) {
  .kv-phone { --top: 12rem; --pw: min(60vw, calc((100dvh - var(--top) - 6.5rem) * 0.69)); left: calc(50% + 5rem); }
}

@media (min-width: 900px) and (min-height: 501px) {
  .screen.landing.kv-scene { --measure: 68rem; }
  /* The name over the headline's left edge, Sign in over the phone's right one. */
  .kv-scene > .topbar { grid-column: content; padding-inline: 0; }
  .kv-scene .pitch h1 { margin-top: min(3rem, 4vh); font-size: min(6rem, 13vh); }
  .kv-scene .pitch .btn.primary { margin: 2.25rem 0 0; }
  .kv-scene .pitch .btn.primary { grid-row: 3; justify-self: start; width: var(--wordW, 18rem); margin: 3.75rem 0 0; }
  /* The words on the left, centred in the height; the phone fills the right
     half, turned towards them, from under the bar to past the bottom edge. */
  .kv-scene .pitch {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr auto auto 1fr;
  }
  .kv-scene .pitch h1 { grid-row: 2; }
  .kv-scene .pitch .btn.primary { grid-row: 3; align-self: start; justify-self: start; }
  .kv-phone {
    --top: max(6rem, 18vh);
    --pw: min(40vw, 38rem, calc((100dvh - var(--top)) * 0.66));
    /* Its right edge on the right edge of the words' column, where Sign in ends. */
    left: calc(50% + 34rem - var(--pw));
    /* Lower and a size down, clear of the card's name and of the answer on
       its corner, still out past the screen and the frame on the left. */
    --bx: calc(var(--pw) * -0.27);
    --by: calc(var(--pw) * 0.9);
    --bw: calc(var(--pw) * 0.84);
  }
}
