/* ============================================================
   QR fullscreen modal — opens when the user clicks the archive QR
   code in the envelope. Gives them a large scannable version.
   Animated in via CSS transitions triggered by removing [hidden].
   ============================================================ */
.qr-modal {
  position: fixed;
  inset: 0;
  /* Slightly more opaque to compensate for removed backdrop-filter blur */
  background: rgba(26, 22, 19, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 9999;
  cursor: zoom-out;
  animation: qrModalFade 0.22s ease-out;
}
.qr-modal[hidden] { display: none; }
@keyframes qrModalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.qr-modal-frame {
  position: relative;
  background: #f7edd2;
  padding: 2.5rem;
  /* Frame skaliert mit dem Viewport: nie größer als 480px, aber auch
     nie breiter als verfügbar. min() verhindert Overflow auf schmalen
     Geräten. Höhe wird durch aspect-ratio gehalten — wenn die durch
     den Viewport limitierte Breite kleiner ist, schrumpft auch die
     Höhe entsprechend mit. */
  width: min(480px, calc(100vw - 2rem), calc(100vh - 2rem));
  max-width: 100%;
  aspect-ratio: 1;
  cursor: default;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 10px 20px rgba(0, 0, 0, 0.3);
  animation: qrModalPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}
@keyframes qrModalPop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.qr-modal-img {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
}
.qr-modal-hint {
  margin: 1rem 0 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(42, 31, 21, 0.65);
}
.qr-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--ink, #2a1f15);
  background: #f7edd2;
  color: var(--ink, #2a1f15);
  font-family: sans-serif;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease;
}
.qr-modal-close:hover,
.qr-modal-close:focus-visible {
  background: var(--stamp-red, #8a2818);
  color: #f7edd2;
  outline: none;
}
@media (max-width: 720px) {
  .qr-modal { padding: 1rem; }
  .qr-modal-frame { padding: 1.25rem; }
  .qr-modal-hint { font-size: 0.58rem; }
  /* Close-Button innerhalb des Frames — sonst wird er bei knappem
     Viewport abgeschnitten */
  .qr-modal-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
  }
}

