/* "Open on your phone": QR code, link and install steps (shown in a pop-up, printable as one A4 page). */
@layer views {
  .modal:has(.phwrap) { width: min(720px, calc(100vw - 24px)); }
  .phwrap { display: grid; gap: 12px; }
  .phbar h2, .phbar p { margin: 0; }
  .phbar { display: grid; gap: 4px; }
  .phsheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 14px; }
  .phsheet header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .phsheet header img { height: 34px; width: auto; }
  .phsheet header h1 { margin: 0; font-size: 20px; flex: 1 1 auto; }
  .phsheet header span { color: var(--muted); font-size: 14px; }
  .phbody { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: center; }
  .phbody figure { margin: 0; display: grid; gap: 6px; justify-items: center; }
  .phqr { width: 240px; height: 240px; display: block; }
  .phbody figcaption { font-size: 13px; text-align: center; overflow-wrap: anywhere; }
  .phsteps { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 15px; line-height: 1.4; }
  .phafter { margin: 0; color: var(--muted); font-size: 14px; }
  .phbtn .sm { display: none; }
  .sidebar .phbtn {
    min-height: 36px; font-size: 13px; color: var(--on-dark); background: rgb(255 255 255 / .06); border: 1px solid rgb(255 255 255 / .1); box-shadow: none;
    &:hover { background: rgb(255 255 255 / .12); }
  }

  @media (max-width: 760px) {
    .phbody { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .phsteps { justify-self: stretch; }
    /* already on a phone: no need for a code to get onto one */
    .pagehead .phbtn { display: none; }
  }

  /* printing: only the sheet, big enough to scan from across the room */
  @media print {
    html.print-phone .shell, html.print-phone .scrim, html.print-phone .toast, html.print-phone .bottomnav,
    html.print-phone .phbar, html.print-phone .phwrap .mbtns { display: none !important; }
    html.print-phone .modal {
      position: static !important; transform: none !important; width: auto !important; max-height: none !important; overflow: visible !important;
      box-shadow: none !important; border: 0 !important; padding: 0 !important; background: #fff;
    }
    html.print-phone, html.print-phone body { background: #fff !important; }
    html.print-phone .phsheet { page: phone; border: 0; padding: 0; gap: 10mm; }
    html.print-phone .phsheet header h1 { font-size: 26px; }
    html.print-phone .phbody { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 10mm; }
    html.print-phone .phqr { width: 110mm; height: 110mm; }
    html.print-phone .phbody figcaption { font-size: 16px; }
    html.print-phone .phsteps { font-size: 18px; justify-self: stretch; gap: 4mm; }
    html.print-phone .phafter { font-size: 15px; }
  }
  @page phone { size: A4 portrait; margin: 15mm; }
}

/* Live demo: pill (sidebar, phone footer) and its pop-up. */
@layer views {
  .demopill {
    display: inline-flex; flex-direction: row; flex-wrap: nowrap; white-space: nowrap; width: auto; align-items: center; gap: 8px; min-height: 32px; padding: 4px 12px; font-size: 12px; line-height: 1.2; font-weight: 500;
    border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--bg); color: var(--ink); box-shadow: none; justify-content: flex-start;
    & i { width: 8px; height: 8px; border-radius: 50%; background: #9aa3af; flex: 0 0 auto; }
    & b { font-variant-numeric: tabular-nums; letter-spacing: .06em; margin-left: auto; }
    &.live i { background: #16a34a; box-shadow: 0 0 0 3px rgb(22 163 74 / .18); }
    &.offline i { background: #f59e0b; }
  }
  .sidebar .demopill {
    width: 100%; color: var(--on-dark); background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .1);
    &:hover { background: rgb(255 255 255 / .12); }
  }
  .mfoot .demopill { flex: 0 0 auto; }
  .mfoot .demopill b { margin-left: 0; }
  .demopill.inline { min-height: 0; border: 0; padding: 0; background: none; font-size: 13px; color: var(--muted); }
  .dmform p { margin: 0; }
  .dmcode { display: grid; gap: 4px; justify-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
  .dmcode b { font-size: 28px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
  .dmjoin { display: flex; gap: 8px; }
  .dmjoin input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: .1em; }
  .phdemo { margin: 0; font-size: 14px; padding: 8px 12px; border-radius: 8px; background: var(--soft); }
  @media print { .demopill { display: none !important; } }
}
