/* RSVP dialog: a copy of the hero signup card. Centred modal from 901px,
   bottom sheet below. The card keeps its hero styles; only placement changes. */
.signup-dialog {
  position: fixed;
  inset: 0;
  width: min(100% - 2rem, 30rem);
  max-width: none;
  max-height: calc(100% - 2rem);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
}
.signup-dialog::backdrop {
  background: color-mix(in srgb, var(--palette-black) 55%, transparent);
}
.signup-dialog[open] > :is(.signup-dialog-sheet, .faq-dialog-card) {
  /* Keep the native top layer and its backdrop fixed from the first paint.
     Only the visible card enters, so the page never flashes around its edge. */
  animation: signup-dialog-in var(--duration-normal) var(--ease-out);
}
@keyframes signup-dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
.signup-dialog .signup-dialog-card {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  min-height: 0;
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  overscroll-behavior: none;
  scroll-behavior: auto;
  scroll-padding-block: 1rem;
  -webkit-overflow-scrolling: touch;
}
.signup-dialog-sheet {
  position: relative;
  width: 100%;
  max-height: inherit;
  /* Initial focus is informational, not an interactive control. */
  outline: none;
}
.local-preview-page :is(.signup-dialog-sheet, .faq-dialog-card):focus {
  /* Initial content focus does not visually promote the dismiss control. */
  outline: none;
}
/* A dialog has one scrollport for every step. Inline cards still reserve the
   original layout, but that fixed-height overlay would clip a keyboard sheet. */
.signup-dialog .sf-original[aria-hidden='true'] {
  display: none;
}
.signup-dialog .sf-stage {
  position: relative;
  inset: auto;
  padding: 0;
  overflow: visible;
  border-radius: 0;
}
.signup-dialog .sf-heading {
  padding-right: var(--control-hit-size, 2.75rem);
}
.signup-dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--control-hit-size, 2.75rem);
  height: var(--control-hit-size, 2.75rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-round);
  background: var(--color-paper);
  color: var(--ink);
  cursor: pointer;
}
.signup-dialog-close svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.signup-dialog-close:hover {
  border-color: var(--ink);
}
.signup-dialog-close:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
[data-theme='dark'] .signup-dialog-close {
  background: var(--color-surface);
}
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .signup-dialog {
    width: 100%;
    max-height: calc(100% - 1.5rem);
    margin: auto 0 0;
  }
  .signup-dialog[open] > :is(.signup-dialog-sheet, .faq-dialog-card) {
    animation-name: signup-dialog-sheet;
  }
  @keyframes signup-dialog-sheet {
    from {
      opacity: 0;
      transform: translateY(24px);
    }
  }
  .signup-dialog .signup-dialog-card {
    max-height: calc(100dvh - 1.5rem);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 0;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }
  .signup-dialog:has(.signup-dialog-sheet) {
    --signup-sheet-gap: max(1rem, env(safe-area-inset-top));
    inset: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding-top: var(--signup-sheet-gap);
    box-sizing: border-box;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .signup-dialog:has(.signup-dialog-sheet)[data-visual-viewport] {
    /* Only a keyboard or zoom needs a JS rectangle. Native bottom anchoring
       follows iOS toolbar changes even while visualViewport metrics lag. */
    top: var(--signup-viewport-top);
    bottom: auto;
    left: var(--signup-viewport-left);
    width: var(--signup-viewport-width);
    height: var(--signup-viewport-height);
  }
  .signup-dialog:has(.signup-dialog-sheet)[open] {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  .signup-dialog-sheet {
    max-height: 100%;
  }
  .signup-dialog:has(.signup-dialog-sheet) .signup-dialog-card {
    max-height: calc(var(--signup-viewport-height, 100dvh) - var(--signup-sheet-gap));
    padding-top: max(1.5rem, env(safe-area-inset-top));
  }
  .signup-dialog input {
    font-size: max(1rem, var(--text-base));
  }
}
/* Paper keeps a comfortable touch form when browser chrome or the keyboard
   shortens the viewport. The sheet owns its scroll instead of clipping actions. */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .local-preview-page .signup-dialog:not(.faq-dialog) {
    max-height: none;
  }
  .local-preview-page .signup-dialog:not(.faq-dialog) .signup-dialog-card {
    max-height: calc(var(--signup-viewport-height, 100dvh) - max(1rem, env(safe-area-inset-top)));
    scroll-padding-block: var(--space-4);
    -webkit-overflow-scrolling: touch;
  }
  .local-preview-page .signup-dialog:not(.faq-dialog) .phone-field input {
    font-size: 1rem;
  }
  .local-preview-page .signup-dialog:not(.faq-dialog) .paper-event-title {
    /* Follow the visible area when the keyboard opens, not the unchanged
       layout viewport. Keep the mark above the form instead of scrolling its
       top away to reveal the submit button. */
    width: min(
      calc(100% - 2.75rem),
      clamp(7rem, calc(var(--signup-viewport-height, 100dvh) * 0.34), 13rem)
    );
  }
  .local-preview-page .signup-dialog:not(.faq-dialog) .button {
    min-height: 3.25rem;
    font-size: 1rem;
  }
}
@media (max-height: 500px) and (max-width: 900px) {
  .local-preview-page .signup-dialog:not(.faq-dialog) .signup-dialog-card {
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--paper-card-radius);
  }
}
@media (prefers-reduced-motion: reduce) {
  .signup-dialog[open] > :is(.signup-dialog-sheet, .faq-dialog-card) {
    animation: none;
  }
}
