/**
 * @file
 * ATconnect survey modal.
 *
 * Uses the native <dialog> element so focus trapping, Escape-to-close and the
 * top layer come from the browser rather than from extra JavaScript.
 */

.atscale-survey {
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.25);
  color: inherit;
  background: #fff;
  overflow: hidden;
}

.atscale-survey[hidden] {
  display: none;
}

.atscale-survey::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.atscale-survey__panel {
  max-height: calc(100vh - 4rem);
  padding: 1.5rem;
  overflow-y: auto;
}

.atscale-survey__header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.atscale-survey__title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
}

.atscale-survey__close {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.atscale-survey__close:hover,
.atscale-survey__close:focus-visible {
  background: rgba(0, 0, 0, 0.08);
}

.atscale-survey__intro {
  margin: 0.75rem 0 0;
}

.atscale-survey__body {
  margin-top: 1rem;
}

.atscale-survey__loading {
  margin: 0;
  padding: 2rem 0;
  text-align: center;
  opacity: 0.7;
}

/* Give each question room to breathe inside the modal. */
.atscale-survey .form-item,
.atscale-survey .js-form-item {
  margin-bottom: 1.25rem;
}

.atscale-survey fieldset legend,
.atscale-survey .fieldset-legend {
  font-weight: 600;
}

/* Hint appended to the "select up to two" question by survey-popup.js. */
.atscale-survey__limit-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  opacity: 0.8;
}

.atscale-survey .webform-confirmation {
  padding: 1rem 0;
}

@media (prefers-reduced-motion: no-preference) {
  .atscale-survey[open] {
    animation: atscale-survey-in 200ms ease-out;
  }
}

@keyframes atscale-survey-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Third-party embed (JotForm, Microsoft Forms, Google Forms). */
.atscale-survey__frame {
  display: block;
  width: 100%;
  min-height: 60vh;
  border: 0;
}

.atscale-survey__error {
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
}
