/* FINAL is now a normal section. The former scroll-driven sheet lives in a dialog. */
.final-scroll { height: auto; background: var(--paper); }
.final-stage { position: relative; }
.final-stage .buy-section {
  height: max(650px, calc(100svh - var(--header-height)));
  min-height: 0;
  aspect-ratio: auto;
}

/* Native dialog keeps focus on the note; the root lock preserves native scrollY. */
.purchase-enabled { scrollbar-gutter: stable; }
.purchase-enabled.purchase-open { overflow: hidden; }
.purchase-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  overflow: auto;
  overscroll-behavior: contain;
}
.purchase-dialog::backdrop { background: rgb(225 224 219 / 94%); }
.purchase-stage { position: relative; min-height: max(100svh, 520px); overflow: clip; }
.purchase-printer {
  position: absolute;
  top: 20px;
  left: 50%;
  width: min(600px, 90vw, 70svh);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
}
.purchase-dismiss {
  position: fixed;
  z-index: 5;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--paper);
  border: 1px solid #14171915;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 300;
}
.purchase-paper {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: min(380px, calc(100vw - 32px), calc((max(100svh, 520px) - 64px) * 210 / 297));
  aspect-ratio: 210 / 297;
  padding: clamp(22px, 5.8vw, 34px);
  background: #fffefa;
  border: 1px solid #dcd7cc55;
  transform-origin: 50% 100%;
  clip-path: inset(100% 0 0 0);
  box-shadow: 0 2px 4px #3e342408;
}
/* A small highlight on the leading edge, without bending or stretching the text. */
.purchase-paper::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 7px;
  background: linear-gradient(transparent, #d7cebc16 70%, #fffefa);
  pointer-events: none;
}
.purchase-paper-content { height: 100%; display: flex; flex-direction: column; opacity: 0; }
.purchase-message h2 {
  margin: 5% 0 20px;
  font-size: clamp(23px, 6vw, 30px);
  font-weight: var(--headline-weight, 750);
  line-height: 1.08;
  letter-spacing: -.055em;
}
.purchase-message p {
  margin: 0 0 13px;
  font-size: clamp(11px, 2.8vw, 12px);
  line-height: 1.6;
  color: #63645f;
}
.purchase-signature { margin-top: auto; padding-top: 10px; }
.purchase-signature strong { font-size: 17px; letter-spacing: -.05em; }
.purchase-signature p { margin: 4px 0 22px; font-size: 11px; color: #63645f; }
.purchase-paper-close {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 35px;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid #14171922;
  background: transparent;
  font: 500 10px/1.4 var(--system-font);
  letter-spacing: .16em;
}
.purchase-paper-close span { font: 300 20px/1 sans-serif; }
.purchase-paper-close:hover { color: var(--brand-blue); }
@media (max-width: 760px) {
  .final-stage .buy-section { height: 760px; }
}
@media (max-width: 350px), (max-height: 600px) {
  .purchase-message h2 { margin: 0 0 15px; font-size: 23px; }
  .purchase-message p { margin-bottom: 10px; font-size: 11px; }
  .purchase-signature p { margin-bottom: 12px; }
}
