/* Questionnaire overlay.
   Only applies once a dialog actually carries a form (.has-survey), so the
   investor and perspective dialogs keep their approved sizing untouched. */

/* Only while open. A bare `display: flex` here would override the browser's
   own `display: none` for a closed dialog, leaving it on screen after Escape
   or the close button — which is exactly what happened. */
dialog.has-survey[open] {
  width: min(1020px, calc(100% - 28px));
  height: min(940px, calc(100dvh - 24px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  overflow: hidden;
}

.survey-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.survey-shell-mount {
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  overflow: hidden;
  /* A flex column, not a block: the mount's own height comes from min-height
     with height:auto, so a percentage height on a child cannot resolve and
     collapses to content size. Flex stretch does not need a definite height. */
  display: flex;
  flex-direction: column;
}

/* The embed SDK inserts its own wrapper element inside the mount and gives it a
   fixed default height (150px). Left alone, the form renders in a small band
   with dead space beneath it. Their stylesheet is injected after ours, so the
   wrapper is targeted by its own class to win on specificity. */
.survey-shell-mount > .tf-v1-widget {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.survey-shell-mount iframe {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
}

.survey-shell-status {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
}

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

/* Radio remote control, retro only.
   A modal dialog makes the page inert, so the real controls cannot be reached
   while a questionnaire is open. The music keeps playing either way; this
   keeps it controllable. */
.survey-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--azure, #0b3948);
  border-radius: 999px;
  background: var(--bone, #fffef9);
  font: 11px/1.4 'IBM Plex Mono', ui-monospace, monospace;
  flex: none;
}

.survey-radio-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--azure, #0b3948);
  opacity: .35;
  flex: none;
}

.survey-radio.is-playing .survey-radio-mark {
  background: var(--coral, #eb5e55);
  opacity: 1;
}

.survey-radio-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--azure, #0b3948);
}

.survey-radio-play {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--azure, #0b3948);
  border-radius: 999px;
  background: var(--azure, #0b3948);
  color: var(--bone, #fffef9);
  font: inherit;
  cursor: pointer;
}

.survey-radio-play:hover { background: #000; }
.survey-radio-play:focus-visible { outline: 2px solid var(--coral, #eb5e55); outline-offset: 2px; }

@media (max-width: 600px) {
  dialog.has-survey[open] {
    width: calc(100% - 12px);
    height: calc(100dvh - 12px);
    padding: 12px;
    gap: 9px;
  }
  .survey-shell-mount { min-height: 0; }
  .survey-radio { font-size: 10px; padding-left: 10px; }
  .survey-radio-play { padding: 0 11px; }
}

/* Screen one: the invitation.
   Owned here rather than on Typeform's welcome screen, which centres its text
   and cannot be aligned through the API. */
.survey-intro {
  flex: 1;
  min-height: 0;
  margin: 0;
  max-width: 56ch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9em;
  overflow-y: auto;
}

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

.survey-gate-title {
  margin: 0;
  font-size: clamp(20px, 3.2vw, 27px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.survey-intro p {
  margin: 0;
  text-align: left;
  font-size: 16px;
  line-height: 1.6;
}

.survey-intro p strong {
  font-weight: 700;
}

.survey-gate-next {
  align-self: flex-start;
  margin-top: 0.5em;
  min-height: 48px;
  padding: 0 34px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: transparent;
  color: inherit;
}

.survey-gate-next:hover { background: currentColor; }
.survey-gate-next:hover { color: var(--bone, #fffef9); }
.survey-gate-next:focus-visible { outline: 3px solid var(--coral, #eb5e55); outline-offset: 2px; }

/* Screen two: the one notice that stays in view beside the questionnaire. */
.survey-caution {
  flex: none;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  opacity: .75;
  text-align: left;
}

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

@media (max-width: 600px) {
  .survey-intro { gap: 0.75em; max-width: none; }
  .survey-gate-title { font-size: 21px; }
  .survey-intro p { font-size: 15px; line-height: 1.55; }
  .survey-gate-next { width: 100%; text-align: center; padding: 0; }
  .survey-caution { font-size: 12px; margin-bottom: 8px; }
}
