/*
 * Frames of the previews: a browser window by default, a phone when the preview is on mobile
 * (data-device="mobile", or the studio's preview carrying .mobile-preview).
 */
.pv-slot {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}
.pv-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid #c4cfd9;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px rgb(20 40 60 / 14%);
  transition: width 0.3s;
}
.pv-screen {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  /* A transformed ancestor makes the opening screen (position: fixed) fill the device, not the whole window */
  transform: translateZ(0);
}
/* The scrolling content fills the screen, whoever draws it */
.pv-screen > #invitation-live,
.pv-screen > .tp-screen,
.pv-screen > .preview-device,
.pv-screen > .dash-live {
  width: 100%;
  height: 100%;
}
/* A browser window: three dots and the address */
.pv-bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid #d7dfe6;
  background: #eef2f6;
}
.pv-dots {
  display: flex;
  gap: 6px;
}
.pv-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f57;
}
.pv-dots i:nth-child(2) {
  background: #febc2e;
}
.pv-dots i:nth-child(3) {
  background: #28c840;
}
.pv-url {
  flex: 1;
  max-width: 420px;
  height: 24px;
  margin: 0 auto;
  padding: 0 12px;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  color: #5b6b78;
  font-size: 12px;
  line-height: 24px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-url:empty {
  visibility: hidden;
}
.pv-btn,
.pv-status,
.pv-home {
  display: none;
}

/* A phone: real proportions, metal bezel, side buttons, island, status bar and home bar */
.pv-frame[data-device='mobile'] {
  width: min(390px, 100%);
  max-height: 820px;
  padding: 11px;
  overflow: visible;
  border: 0;
  border-radius: 58px;
  background: linear-gradient(145deg, #2a343d, #0d151c 45%, #1b242c);
  box-shadow:
    inset 0 0 0 2px #46525d,
    0 0 0 1px #070b0e,
    0 24px 50px rgb(13 21 28 / 28%);
}
.pv-frame[data-device='mobile'] .pv-bar {
  display: none;
}
.pv-frame[data-device='mobile'] .pv-screen {
  border-radius: 47px;
}
.pv-frame[data-device='mobile'] .pv-btn {
  display: block;
}
.pv-frame[data-device='mobile'] .pv-status {
  display: flex;
}
.pv-frame[data-device='mobile'] .pv-home {
  display: block;
}
/* The live preview of the studio becomes a phone with its "Mobile" switch (a class on the content) */
.pv-frame:has(.mobile-preview) {
  width: min(390px, 100%);
  max-height: 820px;
  padding: 11px;
  overflow: visible;
  border: 0;
  border-radius: 58px;
  background: linear-gradient(145deg, #2a343d, #0d151c 45%, #1b242c);
  box-shadow:
    inset 0 0 0 2px #46525d,
    0 0 0 1px #070b0e,
    0 24px 50px rgb(13 21 28 / 28%);
}
.pv-frame:has(.mobile-preview) .pv-bar {
  display: none;
}
.pv-frame:has(.mobile-preview) .pv-screen {
  border-radius: 47px;
}
.pv-frame:has(.mobile-preview) .pv-btn {
  display: block;
}
.pv-frame:has(.mobile-preview) .pv-status {
  display: flex;
}
.pv-frame:has(.mobile-preview) .pv-home {
  display: block;
}
/* The desktop switch of the modal and of the template preview goes back to the window */
.pv-frame[data-device='desktop'] {
  width: min(1100px, 100%);
}

.pv-btn {
  position: absolute;
  width: 4px;
  border-radius: 2px;
  background: #1b242c;
  box-shadow: inset 0 0 0 1px #46525d;
}
.pv-action,
.pv-up,
.pv-down {
  left: -4px;
}
.pv-action {
  top: 128px;
  height: 30px;
}
.pv-up {
  top: 188px;
  height: 58px;
}
.pv-down {
  top: 258px;
  height: 58px;
}
.pv-power {
  right: -4px;
  top: 214px;
  height: 92px;
}
.pv-status {
  position: absolute;
  inset: 0 0 auto;
  z-index: 99999;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 6px 30px 0 34px;
  /* The page scrolls under the bar: its own paper colour keeps the time readable */
  background: linear-gradient(var(--pv-paper, #fff) 55%, transparent);
  pointer-events: none;
}
.pv-screen:has(.invite-opening) .pv-status {
  background: none;
}
/* The ink of the status bar is the text colour of the invitation under it (set by pvTone in preview-frames.js) */
.pv-status b,
.pv-sys {
  color: var(--pv-ink, #111);
}
.pv-status b {
  font:
    600 15px/1 Manrope,
    sans-serif;
}
.pv-island {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 112px;
  height: 32px;
  border-radius: 20px;
  background: #05080a;
  transform: translateX(-50%);
}
.pv-sys {
  display: flex;
  align-items: center;
  gap: 6px;
  fill: currentColor;
}
.pv-home {
  position: absolute;
  bottom: 8px;
  left: 50%;
  z-index: 99999;
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: var(--pv-ink, #111);
  opacity: 0.75;
  transform: translateX(-50%);
  pointer-events: none;
}

/* The studio's preview inside its panel: the frame replaces the old ring around the content */
.gs-body .pv-screen > #invitation-live,
.gs-body .pv-screen > #invitation-live.mobile-preview {
  flex: none;
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  overflow: auto;
  border-radius: 0;
  box-shadow: none;
}
/* On a narrow screen the preview opens full screen: no device around it */
@media (max-width: 899px) {
  .gs-body .pv-frame,
  .gs-body .pv-frame:has(.mobile-preview) {
    width: 100%;
    max-height: none;
    padding: 0;
    border: 1px solid #c4cfd9;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
  }
  .gs-body .pv-bar,
  .gs-body .pv-btn,
  .gs-body .pv-status,
  .gs-body .pv-home {
    display: none !important;
  }
  .gs-body .pv-screen,
  .gs-body .pv-frame:has(.mobile-preview) .pv-screen {
    border-radius: 14px;
  }
}
/* A short invitation still fills the whole screen of the device */
.pv-screen .invitation {
  min-height: 100%;
}
/* On a phone the content starts under the status bar and ends above the home bar, like on a real one */
.pv-frame[data-device='mobile'] .pv-screen .invitation,
.pv-frame:has(.mobile-preview) .pv-screen .invitation {
  box-sizing: border-box;
  padding-top: 44px;
  padding-bottom: 22px;
}
@media (max-width: 899px) {
  .gs-body .pv-frame .pv-screen .invitation {
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* An empty section of the editor shows an example in the presentation chosen for it, faded under the call to fill it */
.invite-slot.has-ghost {
  position: relative;
  overflow: hidden;
  padding: 0;
}
.invite-ghost {
  max-height: 240px;
  overflow: hidden;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
}
.invite-slot .invite-ghost .invitation {
  min-height: 0 !important;
  margin: 0;
  padding: 0 !important;
  background: none !important;
  box-shadow: none;
}
.invite-ghost .invite-signature,
.invite-ghost .invite-particles,
.invite-ghost .invite-opening {
  display: none;
}
.invite-slot.has-ghost > .invite-fill {
  position: absolute;
  inset: auto 12px 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--invite-bg) 88%, #fff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--invite-accent) 70%, transparent);
}

/* The opening screen and the animations played on the live preview of the studio */
.pv-screen .invitation.pv-demo {
  position: absolute;
  inset: 0;
  z-index: 30;
  min-height: 0;
  padding: 0;
  background: none;
  pointer-events: none;
}
.pv-demo .invite-opening {
  pointer-events: auto;
}
.pv-demo-page {
  position: absolute;
  inset: 0;
  z-index: 25;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--invite-bg, #fff);
}
.pv-demo-bar {
  position: sticky;
  bottom: 30px;
  z-index: 6;
  display: flex;
  height: 0;
  justify-content: center;
}
.pv-demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-end;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: rgb(20 25 35 / 88%);
  color: #fff;
  font:
    600 12px/1 system-ui,
    sans-serif;
  box-shadow: 0 6px 18px rgb(0 0 0 / 28%);
  transform: translateY(-100%);
}
.pv-demo-chip button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 16%);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.pv-demo-chip button:hover {
  background: rgb(255 255 255 / 30%);
}

/*
 * The phone of the full editor, like the assistant's and the dashboard's: real proportions (390 x 820), scaled to the panel by
 * --phone-scale (set by editor-phone.js), so that it is seen whole and the page is laid out at the width of a phone.
 */
@media (min-width: 900px) {
  .gs-body .sx-preview .pv-slot:has(.mobile-preview) {
    display: block;
    flex: none;
    width: calc(390px * var(--phone-scale, 1));
    height: calc(820px * var(--phone-scale, 1));
    margin: 0 auto;
  }
  .gs-body .sx-preview .pv-frame:has(.mobile-preview) {
    flex: none;
    width: 390px;
    height: 820px;
    max-height: none;
    transform: scale(var(--phone-scale, 1));
    transform-origin: top left;
  }
}
