/* The browser demo page (/demo/, site_src/build_site.py page_demo): the handset drawn around the
   interface. Proportions are the Pulse Ultra's (web/src/lib/device.ts): a 440 x 956 pt screen, a
   3.4 mm bezel on a 79.27 mm body, body corner 14 mm, screen corner 10.6 mm. Only this page loads
   the file; everything else comes from site.css. */

.demo-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--s4); }
.page-head .demo-ctas { margin-top: var(--s4); }

.demo-section { padding-top: var(--s4); }
.demo-stage {
  position: relative; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: radial-gradient(60% 50% at 50% 42%, #1c1c21 0, #0c0c0f 70%);
  padding: clamp(28px, 5vw, 72px) var(--gutter) clamp(32px, 5vw, 80px);
  display: grid; justify-items: center; overflow: hidden;
}
.demo-stage::before {
  content: ""; position: absolute; inset: auto 0 0; height: 55%;
  background: radial-gradient(50% 60% at 50% 100%, rgba(217, 195, 163, .10) 0, transparent 70%);
  pointer-events: none;
}

/* The body: the screen's size plus the bezel on every side. Padding in % is of the width, which
   is what makes the bezel the same on all four sides. */
.handset {
  /* --bw is the body's own width (a % in padding or radius would be of the stage instead). */
  --bw: min(100%, 432px);
  --bezel: calc(var(--bw) * 0.04289);   /* 3.4 mm of 79.27 mm */
  position: relative; width: var(--bw); aspect-ratio: 481.29 / 997.29;
  padding: var(--bezel); box-sizing: border-box;
  border-radius: calc(var(--bw) * 0.1766);  /* 14 mm */
  background: linear-gradient(165deg, #5a5650 0%, #39373330 30%, #26252300 60%) , linear-gradient(180deg, #34322f 0%, #1f1e1c 50%, #151413 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .10),
    inset 0 0 0 2.5px rgba(0, 0, 0, .55),
    inset 0 0 0 3px rgba(255, 255, 255, .04),
    0 50px 90px -40px rgba(0, 0, 0, .9), 0 20px 40px -30px rgba(0, 0, 0, .8);
  filter: drop-shadow(0 0 0 transparent);
  z-index: 0;
}
.handset .screen {
  position: relative; width: 100%; height: 100%;
  border-radius: calc(var(--bw) * 0.133);  /* 64 pt of the 481 pt body: 10.6 mm */
  overflow: hidden; background: #000; isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(white, black); /* Safari clips the frame to the radius */
  box-shadow: 0 0 0 1px #000;
}
.handset iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }

/* The keys, as on the handset: action and volume on the left, the side button on the right. */
.handset .key {
  position: absolute; width: 1.1%; border-radius: 2px; padding: 0; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #4a4742, #23221f);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12), 0 0 0 .5px rgba(0, 0, 0, .6);
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.handset .key::after { content: ""; position: absolute; inset: -6px -10px; }   /* a finger-sized target */
.handset .key.is-down { background: linear-gradient(180deg, #2c2a27, #171615); transform: scaleX(.7); }
.handset .key:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.handset .key-action { left: -1.0%; top: 17.5%; height: 3.2%; }
.handset .key-up { left: -1.0%; top: 23.5%; height: 6.4%; }
.handset .key-down { left: -1.0%; top: 31.2%; height: 6.4%; }
.handset .key-side { right: -1.0%; top: 26.5%; height: 9.6%; }

.demo-caption {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2) var(--s4);
  margin-top: var(--s3); color: var(--text-3); font-size: var(--t-small); line-height: 1.55;
}
.demo-caption p { margin: 0; max-width: 62ch; }
.demo-caption b { color: var(--text-2); font-weight: 500; }

.demo-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.demo-cols h2 { font-size: var(--t-sub); line-height: 1.1; letter-spacing: -0.02em; }
.demo-cols .points { margin-top: var(--s3); }
.demo-cols .small { margin-top: var(--s3); }
.demo-cols .small a { color: var(--text); }

.demo-end { text-align: center; }
.demo-end .lede { margin-left: auto; margin-right: auto; }
.demo-end .demo-ctas { justify-content: center; }

@media (max-width: 900px) {
  .demo-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  /* The stage runs edge to edge so the handset keeps a readable scale on a phone screen. */
  .demo-stage { border-radius: 0; border-left: 0; border-right: 0; margin: 0 calc(-1 * var(--gutter)); padding: 24px 16px 28px; }
  .handset { --bw: 100%; }
  .handset .key { display: none; }
  .demo-caption { flex-direction: column; align-items: flex-start; }
}
