/* ── Portfolio checkout modal (assets/portfolio-embed.js) ──────────────────
   Sized to the embed's reported content height (--pe-content), capped at the
   viewport; past the cap the store page scrolls inside the iframe. Invisible
   (backdrop only) until the first height arrives, so it opens at its final size. */

.pe-dialog {
  position: fixed; box-sizing: border-box;
  width: min(1320px, calc(100vw - 48px));   /* the store grid goes to 4 columns at 1280px */
  height: min(var(--pe-content, 100dvh), calc(100dvh - 48px));
  /* A briefly empty view (e.g. Stripe loading) doesn't collapse the modal; on a short screen
     (landscape phone) it never pushes the bottom, and the embed's Checkout bar, off-screen. */
  min-height: min(320px, calc(100dvh - 48px));
  opacity: 0;
  max-width: none; max-height: none;
  margin: auto; padding: 0;
  border: none; border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(13,31,18,0.3);
  overflow: visible;   /* the close button sits over the corner */
}
.pe-dialog.pe-ready { opacity: 1; transition: height 0.25s ease, opacity 0.15s ease; }   /* later views still ease between sizes */
.pe-dialog::backdrop { background: rgba(13,31,18,0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.pe-frame { position: relative; z-index: 1; display: block; width: 100%; height: 100%; border: 0; border-radius: inherit; background: transparent; }

/* Sits behind the iframe until the store page paints over it. */
.pe-loading {
  position: absolute; inset: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted, #5f6b63); font-size: 0.95rem;
}

/* Clear of the embed's own "Visit the store" link in its header bar. */
.pe-close {
  position: absolute; top: -14px; right: -14px; z-index: 2;
  width: 36px; height: 36px; padding: 0;
  border: none; border-radius: 50%;
  background: #fff; color: var(--dark, #0d1f12);
  box-shadow: 0 4px 14px rgba(13,31,18,0.25);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.pe-close:hover { color: var(--forest, #1d4d2b); }
.pe-close:focus-visible { outline: 3px solid var(--forest, #1d4d2b); outline-offset: 2px; }

/* Full screen, with the close in its own strip: the embed's basket bar owns the bottom edge. */
@media (max-width: 640px) {
  .pe-dialog { width: 100vw; height: 100dvh; min-height: min(320px, 100dvh); padding-top: 48px; border-radius: 0; }
  .pe-dialog.pe-ready { transition: opacity 0.15s ease; }
  .pe-close { top: 6px; right: 8px; box-shadow: none; }
}
