Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

3.0 KB
Raw Blame
/* The inset is symmetric so the panel sits in the optical centre of the viewport rather than
   riding the top edge. It is published as a var because .sui-modal's max-height has to be the
   viewport minus both halves of it — if the two drift apart a tall modal overflows the backdrop
   and, because the panel is centre-aligned, loses its header off the top of the screen. */
.sui-modal__backdrop {
  --modal-inset-block: 2.5rem;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--modal-inset-block) 1.5rem;
  z-index: 100;
  animation: fadeIn 0.18s ease both;
  overscroll-behavior: contain;
}

.sui-modal {
  /* Set our own font: the modal portals to <body>, so it can't inherit the
     app's font through the DOM (the portal's .portal-scope isn't an ancestor). */
  font-family: var(--font-sans);
  background: var(--c-modal-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  box-shadow:
    0 1.25rem 3rem rgba(0, 0, 0, 0.35),
    0 0 0 1px var(--c-border-subtle);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - var(--modal-inset-block) * 2);
  /* mobile browser chrome shrinks 100vh */
  max-height: calc(100dvh - var(--modal-inset-block) * 2);
  overflow: hidden;
  overflow: clip;
  animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Phones: tighten the inset so the modal gets the vertical space. Only the variable moves —
   the max-height above follows it, so the pair cannot fall out of step. */
@media (max-width: 30rem) {
  .sui-modal__backdrop {
    --modal-inset-block: 1rem;
    padding-inline: 0.75rem;
  }
}

.sui-modal--sm {
  max-width: 24rem;
}
.sui-modal--md {
  max-width: 32rem;
}
.sui-modal--lg {
  max-width: 48rem;
}
.sui-modal--xl {
  max-width: 64rem;
}

.sui-modal__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.125rem 0.75rem;
  border-bottom: 1px solid var(--c-border-subtle);
}

/* A lone title centres against the back/close controls. With a subtitle the
   header text is two lines, so top-align it and let the controls sit on the
   title line rather than the middle of the taller block. */
.sui-modal__header:has(.sui-modal__sub) {
  align-items: flex-start;
}

.sui-modal__header-text {
  flex: 1 1 auto;
  min-width: 0;
}

.sui-modal__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-text);
}

.sui-modal__sub {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: var(--c-text-subtle);
}

/* Sizing/background/hover are owned by the Button; this just keeps them from
 * stretching. The back arrow leads the header; the close button trails it. */
.sui-modal__close,
.sui-modal__back {
  flex: 0 0 auto;
}

.sui-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1.125rem 1.125rem;
  color: var(--c-text-muted);
}

.sui-modal__footer {
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--c-border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}