/* qr-modal.css — the navbar's "Open on phone" control and its modal.
 *
 * The BUTTON belongs to the navbar family and keeps its house rules: square
 * corners (that family opts out of tokens.css's `--radius: 8px` deliberately --
 * see account-menu.css, and do not "restore the token" here) and elevation
 * rather than borders.
 *
 * The MODAL follows auth-modal.css, which already solved the same problem: a
 * fixed full-viewport scrim that DIMS rather than hides, a centred card, and
 * the light/dark elevation split taken from tokens (--sh-modal). Restating any
 * of that in hex here is how the two drift apart. It keeps the square corners
 * though -- the auth modal's radius predates that preference.
 *
 * WHY A MODAL AND NOT THE POPOVER IT STARTED AS. The anchor bought nothing. A
 * dropdown pins to its button because the eye compares the two; here the eye
 * goes to the code and the hands go to a phone, and the button is never looked
 * at again. Dropping the anchor also dropped a per-open measurement of the
 * button's rect (the bar's width varies with #saveStatus / #geoFileBadge) and
 * the resize handler that had to close the panel when that measurement went
 * stale. The scrim earns its keep too: the app's busiest pages are full-bleed
 * maps, and a code floating over one is a code the eye has to hunt for.
 */

/* ── The button ─────────────────────────────────────────────────── */
/* ICON PLUS WORD, and modelled on .nav-signin rather than .nav-icon-btn.
 *
 * It shipped icon-only for half a day on the theory that this bar's grammar is
 * icon-only. It is not — .nav-signin has carried a word on desktop all along —
 * and a bare QR glyph between a coloured emoji and an avatar turned out to be
 * something nobody would press, because nothing on screen said what it was
 * for. The mark says "a code"; the word says where the code goes.
 *
 * The width is free. This control is hidden below 900px (see the media query),
 * and at every width that shows it the left half of the navbar is empty --
 * the tab strip was removed from up here long ago (base.html). */
.nav-qr-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: 500;
  line-height: 1;
  color: var(--t1);
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.nav-qr-btn:hover,
.nav-qr-btn[aria-expanded="true"] { background: var(--bg2); color: var(--t0) }
/* 17px, not the 14px .nav-signin gives its arrow: that mark is one stroke, this
 * one carries three finder squares and their centres, and below ~16px they
 * silt up into a grey smudge. */
.nav-qr-btn svg { width: 17px; height: 17px; flex-shrink: 0 }

/* NOT ON A PHONE. Same judgement account-menu.css makes about the theme toggle,
 * and a harder one: a QR of the page you are already holding is furniture. The
 * id rather than the class, so the next control to borrow .nav-icon-btn does
 * not inherit a decision made about this one. */
@media (max-width: 900px) {
  #navQrBtn { display: none }
}

/* ── The modal ──────────────────────────────────────────────────── */
.qr-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* Dim, not hide — the same call auth-modal.css makes. You are handing over
   * the page BEHIND this, so hiding it would be hiding the subject. */
  background: rgba(6, 8, 12, .58);
  backdrop-filter: blur(2px);
  animation: qrFade .12s ease-out;
}
.qr-modal[hidden] { display: none }

@keyframes qrFade { from { opacity: 0 } to { opacity: 1 } }

.qr-modal-card {
  position: relative;
  width: min(316px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 22px 22px 18px;
  background: var(--bg1);
  border-radius: 0;
  box-shadow: var(--sh-modal);
  animation: qrRise .14s ease-out;
}

@keyframes qrRise {
  from { opacity: 0; transform: translateY(6px) }
  to   { opacity: 1; transform: none }
}

.qr-modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--t2);
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.qr-modal-x:hover { background: var(--bg2); color: var(--t0) }
.qr-modal-x svg   { width: 15px; height: 15px }

.qr-modal-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--t0);
}
/* The page you are handing over, named. Without it the card is a code and an
 * address, and the address is the part nobody reads at a glance. */
.qr-modal-page {
  margin: 2px 0 0;
  font-size: var(--fs-caption);
  color: var(--t2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* The white tile. Padded on all sides even though the SVG already carries its
 * 4-module quiet zone: the quiet zone is what the CAMERA needs, this is what
 * the eye needs, and collapsing the two makes the code look pasted on. */
.qr-modal-code {
  display: grid;
  place-items: center;
  margin: 14px 0 0;
  padding: 12px;
  background: #fff;
}
/* 248px, up from the 184 the corner panel could afford. This is the only
 * number in the feature a phone actually feels: a bigger code locks on from
 * further away and at a worse angle, which is the whole job. The SVG ships a
 * bare viewBox, so this box is the only thing deciding how big it draws
 * (routes/qr_routes.py). */
.qr-modal-code img { display: block; width: 248px; height: 248px }
/* Between opening and the first byte there is no src, and an <img> with an
 * empty src draws a broken-image glyph in the middle of the white tile. */
.qr-modal-code img:not([src]),
.qr-modal-code img[src=""] { visibility: hidden }

/* The instruction. Between the code and the address because that is the order
 * the questions arrive in: what is this, then what do I do, then what exactly
 * am I sending. */
.qr-modal-hint {
  margin: 12px 0 0;
  font-size: var(--fs-caption);
  line-height: 1.45;
  color: var(--t1);
}

.qr-modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--bdr) 55%, transparent);
}
.qr-modal-url {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--t2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* Clipping the TAIL of a URL loses the part that identifies it, but
   * `direction: rtl` reorders the punctuation and prints nonsense. Ellipsis at
   * the end, and Copy beside it is the real answer for a long address. */
}
.qr-modal-copy {
  flex-shrink: 0;
  height: 26px;
  padding: 0 12px;
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--t1);
  background: var(--bg2);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.qr-modal-copy:hover { color: var(--t0) }
