/* The original front plates still paint every exterior border/corner pixel.
   Only the marked interior botanical area is replaced with quiet guilloche.
   The separate logo, guest name, hit area and front/back clock are unchanged. */
.envelope-front-infill {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-color: var(--mahogany);
  background-image: linear-gradient(#652b292e, #652b292e), url('assets/envelope-guilloche-infill-v1.webp');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  /* Follow the actual red aperture, including its lower chamfers. The old
     lower vertices sat below the bevel and painted over its gold corner art. */
  clip-path: polygon(18.9% 3.85%, 81% 3.85%, 94.1% 13.7%, 94.1% 82%, 81% 92.65%, 18.9% 92.65%, 5.8% 82%, 5.8% 13.7%);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
/* The cue follows the growing name box, never a fixed viewport coordinate. */
.envelope-front .guest-address { display: flex; flex-direction: column; align-items: center; }
.envelope-front .guest-address .guest-name { flex: none; text-wrap: balance; }
.envelope-front .guest-address .guest-name.is-long[lang=en] { line-height: 1.3; }
.guest-address .envelope-open-cue {
  position: static;
  flex: none;
  margin-top: 12px;
  width: 100%;
  min-height: 24px;
}
@media (min-width: 601px) {
  /* Maximum-length names need a readable card, not microscopic lettering. */
  .envelope-scene:has(.guest-name.is-very-long) { width: min(400px, 70vw); }
}
@media (max-width: 600px) {
  .guest-address .envelope-open-cue { min-height: 44px; }
  .envelope-front .guest-address:has(.guest-name.is-very-long) { left: 8%; width: 84%; }
}
@media (min-width: 601px) and (max-height: 700px) {
  /* The entrance already scrolls: keep a readable card in short desktop windows. */
  .envelope-scene { min-width: min(320px, 70vw); }
}
@media (max-width: 600px) {
  .envelope-front-infill {
    /* Match the width-scaled chamfers of the existing 852×1846 nine-slice,
       not percentages of the changing browser height. */
    /* Source lower bevel starts 242px above the base, not 188px. Keep a
       small inward allowance for JPEG edges and WebKit subpixel rounding.
       Width-based offsets follow the nine-slice when browser chrome moves. */
    clip-path: polygon(20.4% calc(100vw * 46 / 852), 79.4% calc(100vw * 46 / 852), 94.2% calc(100vw * 185 / 852), 94.2% calc(100% - 100vw * 242 / 852), 78.2% calc(100% - 100vw * 68 / 852), 21.4% calc(100% - 100vw * 68 / 852), 5.8% calc(100% - 100vw * 242 / 852), 5.8% calc(100vw * 185 / 852));
    /* Safari's owning face already culls this entire subtree at the midpoint. */
    -webkit-backface-visibility: visible;
    backface-visibility: visible;
  }
}
