@layer components {
  .dialog {
    width: min(100% - 32px, 480px);
    margin: auto;
    padding: 23px 24px 24px;
    border: 0;
    border-radius: var(--radius-card);
    background: var(--color-paper);
    color: var(--color-ink);
    box-shadow: 0 8px 60px rgb(0 0 0 / 12%);
    opacity: 0;
    scale: 0.96;
    transition: opacity 150ms var(--ease-out-expo), scale 150ms var(--ease-out-expo), overlay 150ms allow-discrete, display 150ms allow-discrete;

    /* Arrives a little slower than it leaves */
    &[open] {
      opacity: 1;
      scale: 1;
      transition-duration: 220ms;
    }

    @starting-style {
      &[open] {
        opacity: 0;
        scale: 0.96;
      }
    }

    /* On phones it sits high, where the keyboard can't cover its buttons */
    @media (pointer: coarse) {
      margin-block: max(16px, 10vh) auto;
    }

    @media (prefers-reduced-motion: reduce) {
      scale: none;
    }

    &::backdrop {
      background: rgb(36 33 36 / 28%);
      opacity: 0;
      transition: opacity 150ms ease, overlay 150ms allow-discrete, display 150ms allow-discrete;
    }

    &[open]::backdrop {
      opacity: 1;
      transition-duration: 220ms;
    }

    @starting-style {
      &[open]::backdrop {
        opacity: 0;
      }
    }
  }

  .dialog__title {
    margin-bottom: 18px;
    font-size: var(--text-detail-title);
    letter-spacing: -0.02em;
  }

  .dialog__note {
    margin-top: 12px;
    font-size: var(--text-meta);
    line-height: 1.6;
    color: var(--color-ink-secondary);
  }

  .dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
  }

  /* The page for keeping a link, a sheet in the app */
  .link-sheet {
    max-width: calc(480px + 2 * var(--page-padding));
    margin: 0 auto;
    padding: 32px var(--page-padding);
  }

  .link-sheet__title {
    margin-bottom: 18px;
    font-size: var(--text-detail-title);
    letter-spacing: -0.02em;
  }
}
