/* Phase 2, opt-in dialog shell. No existing popup selectors or loader hooks.
   Use with modal-v2.js and the current customer theme + button stylesheet. */
dialog.ep-modal-v2 {
  box-sizing: border-box; padding: 0; margin: auto;
  width: min(480px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  color: var(--ep-ink); background: var(--ep-bg);
  border: 1px solid var(--ep-border-2); border-radius: 16px;
  box-shadow: var(--ep-shadow, 0 24px 80px rgba(0,0,0,.35));
  overflow: hidden; font: inherit; text-align: start;
}
dialog.ep-modal-v2[open] { display: flex; flex-direction: column; }
dialog.ep-modal-v2.wide { width: min(560px, calc(100vw - 32px)); }
dialog.ep-modal-v2::backdrop {
  background: rgba(0,0,0,.62); backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px); animation: ep-modal-backdrop-in 180ms ease-out both;
}
dialog.ep-modal-v2[data-modal-state="closing"]::backdrop { animation: ep-modal-backdrop-out 120ms ease-out both; }
.ep-modal-v2 .ep-modal-head {
  display: flex; align-items: flex-start; gap: 16px; flex: none;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--ep-border);
}
.ep-modal-v2 .ep-modal-head > .ep-modal-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ep-modal-v2 .ep-modal-head > .ep-modal-close { margin-inline-start: auto; }
.ep-modal-v2 .ep-modal-heading { flex: 1; min-width: 0; padding-top: 6px; }
.ep-modal-v2 .ep-modal-title { margin: 0; font-size: 18px; line-height: 1.6; font-weight: 800; }
.ep-modal-v2 .ep-modal-title:focus { outline: none; }
.ep-modal-v2 .ep-modal-caption { margin: 4px 0 0; color: var(--ep-ink-3); font-size: 12px; line-height: 1.8; }
.ep-modal-v2 .ep-modal-close {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0; border-radius: 8px;
  border: 1px solid var(--ep-border); background: var(--ep-surface-2);
  color: var(--ep-ink-3); cursor: pointer;
}
.ep-modal-v2 .ep-modal-close svg { width: 18px; height: 18px; }
.ep-modal-v2 .ep-modal-close:focus-visible { outline: 2px solid var(--ep-accent-2); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .ep-modal-v2 .ep-modal-close:hover { color: var(--ep-ink); border-color: var(--ep-border-2); }
}
.ep-modal-v2 .ep-modal-body { padding: 24px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; line-height: 1.9; }
.ep-modal-v2 .ep-modal-body > :first-child { margin-top: 0; }
.ep-modal-v2 .ep-modal-body > :last-child { margin-bottom: 0; }
.ep-modal-v2 .ep-modal-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: none;
  padding: 16px 24px 20px; border-top: 1px solid var(--ep-border);
  background: var(--ep-surface);
}
.ep-modal-v2 .ep-modal-foot .ep-button { flex: 1; white-space: normal; }
.ep-modal-v2 .ep-modal-foot .ep-button.ghost { flex: 0 1 auto; }
.ep-modal-v2 .ep-modal-note { font-size: 13px; color: var(--ep-ink-3); }
@keyframes ep-modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ep-modal-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@media (max-width: 480px) {
  .ep-modal-v2 .ep-modal-head { padding: 14px 16px 12px; gap: 8px; }
  .ep-modal-v2 .ep-modal-body { padding: 20px 16px; }
  .ep-modal-v2 .ep-modal-foot { padding: 12px 16px 16px; }
  .ep-modal-v2 .ep-modal-title { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { dialog.ep-modal-v2::backdrop, dialog.ep-modal-v2[data-modal-state="closing"]::backdrop { animation: none; } }
dialog.ep-modal-v2[data-modal-motion="off"]::backdrop { animation: none; }
