/* Glidemote's live demo, from glidemote.com: drag on the phone to move the pointer on
   the Mac screen, and while nobody touches it, it plays through the gestures by itself.
   The styles below the variables are a straight copy of the two "demo" sections of
   Glidemote's site/style.css, and glidemote-demo.js is its site/demo.js, so update
   them from there when Glidemote's demo changes. */
.demo {
  /* The app's own colours, which the copied styles use: blue for the pointer and
     the keyboard. */
  --move: var(--accent);
  --move-text: var(--accent-text);

  /* Device mock-ups look the same in both themes. */
  --dev-bg: #0a0b0d;
  --dev-surface: #131518;
  --dev-line: rgba(255, 255, 255, 0.08);
  --dev-fg: #eef0f3;
  --dev-muted: #8a9099;
  --dev-ok: #34d399;
  --font-device: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}
@keyframes blink { 50% { opacity: 0; } }

/* -- demo: Mac display ----------------------------------------------------- */

.demo {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  -webkit-user-select: none;
  user-select: none;
}
.display, .phone { grid-area: 1 / 1; }

.display { width: 84%; padding-bottom: 6%; }

.screen {
  position: relative;
  aspect-ratio: 16 / 10;
  max-width: 100%;
  overflow: hidden;
  container-type: inline-size;
  border-radius: 10px;
  border: 7px solid #0c0d10;
  outline: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(90% 80% at 12% 8%, #3d5fe0 0%, transparent 60%),
    radial-gradient(80% 90% at 95% 100%, #8251d8 0%, transparent 58%),
    radial-gradient(60% 60% at 70% 30%, #1f8fb3 0%, transparent 70%),
    #121834;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
}

.stand {
  width: 22%;
  height: 0;
  padding-bottom: 7%;
  margin: 0 auto;
  background: linear-gradient(180deg, #7d838c, #b9bec5 40%, #868c95);
  clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
}

.menubar {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.6cqw;
  height: 3.6cqw;
  padding: 0 1.8cqw;
  background: rgba(14, 16, 26, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.mb-dot { width: 1.4cqw; height: 1.4cqw; border-radius: 50%; background: rgba(255, 255, 255, 0.8); }
.mb-item { height: 0.9cqw; border-radius: 1cqw; background: rgba(255, 255, 255, 0.45); }
.mb-item.w1 { width: 4.6cqw; background: rgba(255, 255, 255, 0.7); }
.mb-item.w2 { width: 3cqw; }
.mb-item.w3 { width: 3.6cqw; }
.mb-clock { margin-left: auto; color: rgba(255, 255, 255, 0.85); font: 600 1.5cqw/1 var(--font-device); }

.window {
  position: absolute;
  left: 5%;
  top: 11%;
  width: 52%;
  height: 66%;
  border-radius: 1.4cqw;
  overflow: hidden;
  background: #1c1f26;
  outline: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2cqw 4cqw rgba(0, 0, 0, 0.45);
  transition: outline-color 0.2s;
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  height: 4.4cqw;
  padding: 0 1.6cqw;
  background: #25282f;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
}
.titlebar i { width: 1.2cqw; height: 1.2cqw; border-radius: 50%; background: #ff5f57; }
.titlebar i:nth-child(2) { background: #febc2e; }
.titlebar i:nth-child(3) { background: #28c840; }
.titlebar span { margin-left: 1.4cqw; color: rgba(255, 255, 255, 0.7); font: 600 1.45cqw/1 var(--font-device); }

.win-body { position: absolute; inset: 4.4cqw 0 0; overflow: hidden; }
.win-content { display: flex; flex-direction: column; gap: 1.15cqw; padding: 2.6cqw 3cqw; will-change: transform; }
.ln { display: block; flex: none; width: var(--w, 80%); height: 1cqw; border-radius: 1cqw; background: rgba(255, 255, 255, 0.13); }
.ln.h { width: 46%; height: 1.8cqw; margin-top: 0.8cqw; background: rgba(255, 255, 255, 0.34); }
.pic {
  display: block;
  flex: none;
  aspect-ratio: 16 / 6;
  margin-block: 0.6cqw;
  border-radius: 1cqw;
  background: linear-gradient(160deg, #f6b25b, #e8667c 45%, #5b4bd6);
}
.pic.alt { background: linear-gradient(200deg, #66d1c1, #3a7bd5 60%, #283a8f); }

/* An empty line in the notes, where the demo clicks and types from the phone. */
.typed {
  display: flex;
  align-items: center;
  flex: none;
  height: 2.2cqw;
  color: rgba(255, 255, 255, 0.88);
  font: 500 1.55cqw/1 var(--font-device);
  white-space: pre;
  transition: opacity 0.4s;
}
.typed .caret { display: none; width: 0.18cqw; height: 1.9cqw; margin-left: 0.1cqw; background: #8fb0ff; animation: blink 1.1s steps(1) infinite; }
.typed.active .caret { display: block; }
.typed.clearing { opacity: 0; }

.icon {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7cqw;
  width: 11cqw;
  translate: -50% -50%;
  transition: opacity 0.35s, scale 0.35s;
}
.icon .label {
  padding: 0.2cqw 0.7cqw;
  border-radius: 0.6cqw;
  color: #fff;
  font: 600 1.35cqw/1.3 var(--font-device);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.icon.selected .label { background: #2f62e8; text-shadow: none; }
.icon.selected .glyph { outline: 0.3cqw solid rgba(255, 255, 255, 0.35); outline-offset: 0.4cqw; }
.icon.lifted { transition: none; scale: 1.06; }
.icon.lifted .glyph { box-shadow: 0 1.4cqw 2cqw rgba(0, 0, 0, 0.45); }
.icon.gone { opacity: 0; scale: 0.4; }

.file { --x: 71%; --y: 25%; z-index: 2; }
.file .glyph {
  width: 4.8cqw;
  height: 6cqw;
  border-radius: 0.6cqw;
  background:
    linear-gradient(135deg, transparent 72%, rgba(0, 0, 0, 0.18) 72%) top right / 1.6cqw 1.6cqw no-repeat,
    linear-gradient(180deg, #eef1f6, #cfd5df);
  position: relative;
}
.file .glyph::after {
  content: "";
  position: absolute;
  inset: 2.1cqw 1.4cqw;
  border-radius: 0.3cqw;
  background: linear-gradient(160deg, #f6b25b, #e8667c 60%, #5b4bd6);
}
.folder { --x: 71%; --y: 62%; }
.folder .glyph {
  position: relative;
  width: 6.6cqw;
  height: 5cqw;
  margin-top: 0.8cqw;
  border-radius: 0.5cqw 0.5cqw 0.7cqw 0.7cqw;
  background: linear-gradient(180deg, #74b6ff, #3f8cf0);
  transition: filter 0.2s, scale 0.2s;
}
.folder .glyph::before {
  content: "";
  position: absolute;
  left: 0;
  top: -0.8cqw;
  width: 2.8cqw;
  height: 1.2cqw;
  border-radius: 0.5cqw 0.5cqw 0 0;
  background: #5aa4fb;
}
.folder.target .glyph { filter: brightness(1.25); scale: 1.08; }

.dock {
  position: absolute;
  left: 50%;
  bottom: 2.2%;
  display: flex;
  gap: 1cqw;
  padding: 0.9cqw;
  translate: -50% 0;
  border-radius: 1.8cqw;
  background: rgba(255, 255, 255, 0.16);
  outline: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.dock i { width: 4.2cqw; height: 4.2cqw; border-radius: 1.1cqw; background: linear-gradient(160deg, #6aa0ff, #3a5fe0); }
.dock i:nth-child(2) { background: linear-gradient(160deg, #c4a6ff, #7b4fd6); }
.dock i:nth-child(3) { background: linear-gradient(160deg, #ffd27a, #f08a24); }
.dock i:nth-child(4) { background: linear-gradient(160deg, #7ee2b0, #1fa36b); }
.dock i:nth-child(5) { background: linear-gradient(160deg, #e6e9ef, #9aa2ae); }

.ctx {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-width: 17cqw;
  padding: 0.6cqw;
  border-radius: 1.1cqw;
  background: rgba(40, 43, 51, 0.94);
  outline: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 1.6cqw 3cqw rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.9);
  font: 500 1.45cqw/1 var(--font-device);
  animation: pop 0.14s ease-out;
}
.ctx span { padding: 0.75cqw 1.2cqw; border-radius: 0.6cqw; }
.ctx span:first-child { background: #2f62e8; }
.ctx hr { width: 100%; height: 1px; margin: 0.5cqw 0; border: 0; background: rgba(255, 255, 255, 0.14); }
@keyframes pop { from { opacity: 0; scale: 0.94; } }

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 3.4cqw;
  height: 3.4cqw;
  margin: -0.35cqw 0 0 -0.7cqw;
  pointer-events: none;
  filter: drop-shadow(0 0.2cqw 0.4cqw rgba(0, 0, 0, 0.35));
  will-change: left, top;
}
.cursor.hidden { opacity: 0; }

.click-ring {
  position: absolute;
  z-index: 4;
  width: 5cqw;
  height: 5cqw;
  margin: -2.5cqw 0 0 -2.5cqw;
  border-radius: 50%;
  border: 0.35cqw solid rgba(255, 255, 255, 0.9);
  opacity: 0;
  pointer-events: none;
}
.click-ring.go { animation: ring 0.4s ease-out; }
.click-ring.r { border-color: #c4b1ff; }
@keyframes ring { from { opacity: 0.95; scale: 0.3; } to { opacity: 0; scale: 1.2; } }

/* -- demo: phone ----------------------------------------------------------- */

.phone {
  justify-self: end;
  align-self: end;
  position: relative;
  z-index: 1;
  width: 31%;
  aspect-ratio: 9 / 19;
  max-width: 100%;
  container-type: inline-size;
}
.phone-body {
  height: 100%;
  padding: 3.2cqw;
  border-radius: 15cqw;
  background: linear-gradient(160deg, #3a3e46, #15171b 40%, #2a2d33);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 40px 70px -20px rgba(0, 0, 0, 0.6);
}
.phone-screen {
  display: flex;
  flex-direction: column;
  gap: 3cqw;
  height: 100%;
  padding: 11cqw 3.4cqw 5cqw;
  border-radius: 12cqw;
  background: var(--dev-bg);
  color: var(--dev-fg);
  font-family: var(--font-device);
  overflow: hidden;
  transition: padding-bottom 0.3s;
}

.p-bar { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; min-height: 10cqw; }
.p-status {
  display: inline-flex;
  align-items: center;
  gap: 2cqw;
  min-width: 0;
  padding: 1.8cqw 3.2cqw 1.8cqw 2.8cqw;
  border-radius: 99px;
  background: var(--dev-surface);
  border: 1px solid var(--dev-line);
  font-size: 3.6cqw;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}
.p-dot {
  flex: none;
  width: 2.2cqw;
  height: 2.2cqw;
  border-radius: 50%;
  background: var(--dev-ok);
  box-shadow: 0 0 0 0.8cqw rgba(52, 211, 153, 0.18);
  transition: box-shadow 0.2s;
}
.p-dot.blip { box-shadow: 0 0 0 1.6cqw rgba(52, 211, 153, 0.25); }
/* Gestures, keyboard and settings, as in the app's top bar. */
.p-icons { display: flex; flex: none; gap: 4cqw; margin-right: 1.5cqw; color: var(--dev-muted); }
.p-icons svg { width: 6cqw; height: 6cqw; transition: color 0.15s, scale 0.15s; }
.p-icons .p-kbd { width: 6.6cqw; height: 6.6cqw; }
.typing .p-kbd { color: var(--move); }
.p-kbd.press { scale: 0.8; }

.p-pad {
  --tone: 91, 140, 255;
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 7cqw;
  background:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1.5px) 0 0 / 5.6cqw 5.6cqw,
    linear-gradient(180deg, #16181c, var(--dev-surface));
  border: 1px solid var(--dev-line);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.p-pad:active { cursor: grabbing; }
.p-pad:hover { border-color: rgba(91, 140, 255, 0.35); }
.p-pad.moving { border-color: rgba(var(--tone), 0.3); }
.p-pad.scrolling { --tone: 167, 139, 250; border-color: rgba(var(--tone), 0.5); }
.p-pad.drag { --tone: 245, 165, 36; border-color: rgba(var(--tone), 0.75); box-shadow: inset 0 0 0 1px rgba(var(--tone), 0.4), inset 0 0 10cqw rgba(var(--tone), 0.12); }
.p-pad.flash, .p-pad.flash-r, .p-pad.flash-m {
  border-color: rgb(var(--flash));
  box-shadow: inset 0 0 0 1px rgb(var(--flash)), inset 0 0 12cqw rgba(var(--flash), 0.2);
  transition: none;
}
.p-pad.flash { --flash: 91, 140, 255; }
.p-pad.flash-r { --flash: 167, 139, 250; }
.p-pad.flash-m { --flash: 45, 212, 191; }

/* A finger, as the app draws it: a bright dot in a glow, with a ring pulsing out of it. */
.touch {
  --tc: 91, 140, 255;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 20cqw;
  height: 20cqw;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle closest-side,
    #fff 1.3cqw,
    rgba(var(--tc), 0.95) 2cqw,
    rgba(var(--tc), 0.5) 3.2cqw,
    rgba(var(--tc), 0.2) 5.8cqw,
    rgba(var(--tc), 0.06) 8.4cqw,
    transparent);
  pointer-events: none;
  animation: touch-in 0.25s cubic-bezier(0.3, 1.7, 0.5, 1);
  transition: opacity 0.18s, scale 0.18s;
}
.touch::before {
  content: "";
  position: absolute;
  inset: 3.2cqw;
  border-radius: 50%;
  border: 0.5cqw solid rgba(var(--tc), 0.75);
  animation: touch-pulse 1.1s ease-out infinite;
}
.touch.rest { animation: none; opacity: 0.7; }
.touch.rest::before { animation: none; opacity: 0; }
.touch.scroll { --tc: 167, 139, 250; }
.touch.drag { --tc: 245, 165, 36; scale: 1.25; }
.touch.fade { opacity: 0; scale: 0.4; }
@keyframes touch-in { from { scale: 0.3; opacity: 0; } }
@keyframes touch-pulse {
  from { scale: 0.5; opacity: 0.9; }
  to { scale: 1.6; opacity: 0; }
}

.p-ripple {
  --rc: 91, 140, 255;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 30cqw;
  height: 30cqw;
  translate: -50% -50%;
  border-radius: 50%;
  border: 0.7cqw solid rgb(var(--rc));
  pointer-events: none;
  animation: ripple 0.4s ease-out forwards;
}
.p-ripple.r { --rc: 167, 139, 250; }
.p-ripple.m { --rc: 45, 212, 191; }
@keyframes ripple { from { opacity: 0.9; scale: 0.35; } to { opacity: 0; scale: 1.15; } }

/* What the pad is doing, named at the top in the action's colour, like the app. */
.p-mode {
  --tone: 91, 140, 255;
  position: absolute;
  left: 50%;
  top: 3cqw;
  display: flex;
  align-items: center;
  gap: 2cqw;
  translate: -50% -2cqw;
  padding: 1.8cqw 3.6cqw 1.8cqw 2.8cqw;
  border-radius: 99px;
  background: rgba(var(--tone), 0.16);
  border: 1px solid rgba(var(--tone), 0.5);
  box-shadow: 0 1.5cqw 5cqw rgba(var(--tone), 0.22);
  color: #fff;
  font-size: 3.2cqw;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, translate 0.2s;
}
.p-mode::before {
  content: "";
  flex: none;
  width: 2cqw;
  height: 2cqw;
  border-radius: 50%;
  background: rgb(var(--tone));
  box-shadow: 0 0 2.5cqw rgb(var(--tone));
}
.p-mode[data-tone="scroll"] { --tone: 167, 139, 250; }
.p-mode[data-tone="middle"] { --tone: 45, 212, 191; }
.p-mode[data-tone="drag"] { --tone: 245, 165, 36; }
.p-mode.show { opacity: 1; translate: -50% 0; }

/* The buttons under the trackpad, and while typing, the keys above the phone's keyboard. */
.p-media {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: 10.5cqw;
  gap: 2cqw 2.4cqw;
  flex: none;
}
.p-media span, .p-keyrow > span {
  display: grid;
  place-items: center;
  border-radius: 3.4cqw;
  background: var(--dev-surface);
  border: 1px solid var(--dev-line);
  color: var(--dev-muted);
}
.p-media svg {
  width: 5.6cqw;
  height: 5.6cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.p-keys { display: none; flex-direction: column; gap: 2cqw; flex: none; }
.p-keyrow { display: flex; gap: 1.5cqw; height: 10.5cqw; }
.p-keyrow > span { flex: 1; min-width: 0; font-size: 3.4cqw; font-weight: 500; }
.p-keyrow > .arrow { flex: none; width: 9.6cqw; font-size: 3.8cqw; }
.p-keyrow > .p-field {
  display: flex;
  justify-content: flex-start;
  overflow: hidden;
  padding: 0 3cqw;
  border-color: var(--move);
  color: var(--dev-fg);
  font-size: 3.9cqw;
  font-weight: 400;
  white-space: pre;
}
.p-field-text { flex: none; }
.p-field .caret { flex: none; width: 1.5px; height: 5cqw; margin-left: 0.3cqw; background: var(--move); animation: blink 1.1s steps(1) infinite; }
.typing .p-media { display: none; }
.typing .p-keys { display: flex; }

/* The phone's own keyboard, which slides up from the bottom edge while typing. */
.p-kb {
  display: flex;
  flex-direction: column;
  gap: 2.6cqw;
  flex: none;
  height: 0;
  margin: -3cqw -3.4cqw 0;
  padding: 0 1.2cqw;
  overflow: hidden;
  background: #222428;
  visibility: hidden;
  transition: height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), margin-top 0.3s, padding-top 0.3s, visibility 0s 0.3s;
}
.typing { padding-bottom: 0; }
.typing .p-kb {
  height: 66cqw;
  margin-top: 0;
  padding-top: 2.6cqw;
  visibility: visible;
  transition: height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), margin-top 0.3s, padding-top 0.3s;
}
.p-kb-row { display: flex; justify-content: center; gap: 1.2cqw; height: 10.4cqw; flex: none; }
.p-kb-row span {
  display: grid;
  place-items: center;
  width: 8cqw;
  border-radius: 1.6cqw;
  background: #45484f;
  color: #f2f3f5;
  font-size: 4.4cqw;
  box-shadow: 0 0.4cqw 0 rgba(0, 0, 0, 0.45);
  transition: background 0.08s;
}
.p-kb-row .fn { width: 12cqw; background: #2f3237; font-size: 3.6cqw; }
.p-kb-row .space { flex: 1; }
.p-kb-row .ret { width: 21cqw; background: #2f3237; font-size: 3.4cqw; }
.p-kb-row span.down { background: #8a8f99; }
.p-kb-row:nth-child(3) .fn:first-child { margin-right: auto; }
.p-kb-row:nth-child(3) .fn:last-child { margin-left: auto; }

.demo-caption {
  grid-area: 2 / 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.9375rem;
}
.demo-caption svg { width: 20px; height: 20px; flex: none; color: var(--move-text); }

@media (max-width: 980px) {
  .demo { max-width: 680px; }
}
@media (max-width: 560px) {
  .display { width: 78%; padding-bottom: 14%; }
  .phone { width: 40%; }
  .screen { border-width: 4px; border-radius: 7px; }
}
