/* Shared visual language for Resella dialogs, sheets and viewers. */
:root {
  --resella-modal-surface: #fff;
  --resella-modal-ink: #20243b;
  --resella-modal-muted: #747c99;
  --resella-modal-border: #e8eaf2;
  --resella-modal-radius: 24px;
  --resella-modal-shadow: 0 24px 72px rgba(30, 31, 65, .2);
  --resella-modal-backdrop: rgba(37, 35, 56, .48);
  --resella-modal-accent: #6549f5;
}

dialog.resella-modal:not(.resella-modal--immersive):not(.resella-modal--page),
[role="dialog"].resella-modal:not(.resella-modal--immersive):not(.resella-modal--page) {
  box-sizing: border-box;
  color-scheme: light;
  color: var(--resella-modal-ink);
  background: var(--resella-modal-surface);
  border-color: var(--resella-modal-border);
  border-radius: var(--resella-modal-radius);
  box-shadow: var(--resella-modal-shadow);
}

dialog.resella-modal::backdrop {
  background: var(--resella-modal-backdrop);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

dialog.resella-modal--immersive::backdrop {
  background: rgba(12, 14, 27, .88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

dialog.resella-modal--center[open] {
  position: fixed;
  inset: 0;
  margin: auto;
}

.extension-link-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  margin: auto;
  padding: 24px;
}

@media (max-width: 640px) {
  dialog.resella-modal--sheet[open] {
    position: fixed !important;
    inset: auto 0 0 !important;
    width: min(100%, 640px) !important;
    max-width: 100% !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px) !important;
    margin: 0 auto !important;
    transform: none !important;
    border-radius: 26px 26px 0 0 !important;
    border-bottom: 0 !important;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
    overscroll-behavior: contain;
  }

  dialog.resella-modal--sheet:not(.flatlay-confirm-dialog):not(.credits-paywall-dialog)[open] {
    padding-top: 36px !important;
  }

  dialog.resella-modal--sheet:not(.flatlay-confirm-dialog):not(.credits-paywall-dialog)::before {
    content: "";
    position: absolute;
    top: 11px;
    left: 50%;
    width: 48px;
    height: 4px;
    border-radius: 999px;
    background: #dedfe9;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .bottom-sheet.resella-modal {
    border: 1px solid var(--resella-modal-border);
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
    background: var(--resella-modal-surface);
    color: var(--resella-modal-ink);
    box-shadow: 0 -14px 48px rgba(30, 31, 65, .16);
  }
}

dialog.resella-modal:not(.resella-modal--immersive) h1,
dialog.resella-modal:not(.resella-modal--immersive) h2,
dialog.resella-modal:not(.resella-modal--immersive) h3,
[role="dialog"].resella-modal:not(.resella-modal--immersive) h1,
[role="dialog"].resella-modal:not(.resella-modal--immersive) h2,
[role="dialog"].resella-modal:not(.resella-modal--immersive) h3 {
  color: var(--resella-modal-ink);
}

dialog.resella-modal input:not([type="checkbox"]):not([type="radio"]),
dialog.resella-modal select,
dialog.resella-modal textarea,
[role="dialog"].resella-modal input:not([type="checkbox"]):not([type="radio"]),
[role="dialog"].resella-modal select,
[role="dialog"].resella-modal textarea {
  border-color: var(--resella-modal-border);
  border-radius: 13px;
}

dialog.resella-modal :is(input, select, textarea):focus-visible,
[role="dialog"].resella-modal :is(input, select, textarea):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--resella-modal-accent) 58%, transparent);
  outline-offset: 2px;
}

dialog.resella-modal button:not([aria-label]):not(.generation-mode-option):not(.generation-gender-option):not(.flatlay-confirm-scene),
[role="dialog"].resella-modal button:not([aria-label]):not(.generation-mode-option):not(.generation-gender-option):not(.flatlay-confirm-scene) {
  min-height: 44px;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

dialog.resella-modal button:not([aria-label]):active,
[role="dialog"].resella-modal button:not([aria-label]):active {
  transform: scale(.985);
}

.resella-modal--page {
  --resella-modal-page-card: rgba(255, 255, 255, .9);
}

.resella-modal--page .support-contact-form-card {
  border-color: var(--resella-modal-border);
  border-radius: 24px;
  background: var(--resella-modal-page-card);
  box-shadow: 0 12px 36px rgba(47, 54, 102, .07);
}

.resella-modal--drawer {
  border-color: var(--resella-modal-border) !important;
  border-radius: 20px !important;
  box-shadow: var(--resella-modal-shadow) !important;
}

.resella-modal--drawer .bar {
  border-radius: 20px 20px 0 0;
}

@media (max-width: 820px) {
  .resella-modal--drawer {
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

.resella-modal--immersive {
  --resella-modal-radius: 0;
}

@media (prefers-reduced-motion: reduce) {
  dialog.resella-modal button,
  [role="dialog"].resella-modal button {
    transition: none !important;
  }
}
