/* Custom Typeform-like UI (namespaced) */

#custom-form-root {
  --tfk-bg: #fffcf9;
  --tfk-text: #11222b;
  --tfk-muted: rgba(17, 34, 43, 0.6);
  --tfk-placeholder: rgba(17, 34, 43, 0.28);
  --tfk-accent: #43f6c0;
  --tfk-ease: cubic-bezier(0.215, 0.61, 0.355, 1);

  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  /* если родитель — flex (Squarespace), растягиваемся на всю ширину */
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 0;
}

#custom-form-root .tfk {
  background: var(--tfk-bg);
  color: var(--tfk-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  width: 100%;
  min-height: 600px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 22px 18px 80px;
  box-sizing: border-box;
}

#custom-form-root .tfk__wrap {
  width: min(820px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

#custom-form-root .tfk__viewport {
  /* Внутренний скролл как в Typeform */
  height: 560px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px; /* место под скроллбар */
  box-sizing: border-box;
}

#custom-form-root .tfk__progress {
  width: min(720px, 100%);
  margin: 6px auto 0;
  height: 4px;
  border-radius: 999px;
  background: rgba(17, 34, 43, 0.18);
  overflow: hidden;
}

#custom-form-root .tfk__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--tfk-text);
  transition: width 220ms var(--tfk-ease);
}

#custom-form-root .tfk__stage {
  margin-top: 64px;
  display: flex;
  justify-content: center;
}

#custom-form-root .tfk__card {
  width: min(720px, 100%);
}

#custom-form-root .tfk__q {
  will-change: opacity, transform, filter;
  transform: translateY(0);
  filter: blur(0);
  opacity: 1;
  transition:
    opacity 420ms var(--tfk-ease),
    transform 420ms var(--tfk-ease),
    filter 420ms var(--tfk-ease);
}

#custom-form-root .tfk__q.is-exiting {
  opacity: 0;
  transform: translateY(-18px);
  filter: blur(2px);
  pointer-events: none;
}

#custom-form-root .tfk__q.is-entering {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(2px);
}

#custom-form-root .tfk__q-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

#custom-form-root .tfk__q-num {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tfk-text);
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1;
  flex: 0 0 auto;
  margin-top: 5px;
}

#custom-form-root .tfk__q-title {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.01em;
}

#custom-form-root .tfk__req {
  margin-left: 4px;
}

#custom-form-root .tfk__q-desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--tfk-muted);
}

#custom-form-root .tfk__q-body {
  margin-top: 26px;
}

#custom-form-root .tfk__input {
  width: min(580px, 100%);
  background: transparent;
  color: var(--tfk-text);
  border: none;
  border-bottom: 2px solid var(--tfk-text);
  padding: 10px 0 6px;
  font-size: 20px;
  line-height: 1.1;
  outline: none;
}

#custom-form-root .tfk__input::placeholder {
  color: var(--tfk-placeholder);
}

#custom-form-root .tfk__input:focus {
  border-bottom-width: 2px;
}

#custom-form-root .tfk__input.is-invalid {
  border-bottom-color: #d34b4b;
}

#custom-form-root .tfk__confirm {
  margin-top: 18px;
  background: var(--tfk-text);
  color: var(--tfk-accent);
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

#custom-form-root .tfk__confirm:active {
  transform: translateY(1px);
}

#custom-form-root .tfk__yesno {
  width: min(580px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#custom-form-root .tfk__yesno .tfk__choice {
  width: min(280px, 100%);
}

#custom-form-root .tfk__media {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 6px 0 14px;
}

#custom-form-root .tfk__media-img {
  /* “окно” для картинки: меньше пустого пространства, больше “зум” */
  width: min(760px, 100%);
  max-width: 100%;
  height: 280px;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  object-fit: cover;
  object-position: center;
  transform: scale(1.06);
}

#custom-form-root .tfk__choices {
  width: min(580px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#custom-form-root .tfk__choice {
  width: 100%;
  background: rgba(17, 34, 43, 0.07);
  border: 1px solid rgba(17, 34, 43, 0.08);
  border-radius: 999px;
  padding: 12px 14px;
  text-align: left;
  color: var(--tfk-text);
  font-size: 16px;
  line-height: 1.25;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

#custom-form-root .tfk__choice:hover {
  background: rgba(17, 34, 43, 0.09);
}

#custom-form-root .tfk__choice.is-active {
  background: transparent;
  border: 2px solid var(--tfk-text);
  padding: 11px 13px; /* компенсируем 2px border */
}

#custom-form-root .tfk__choice-key {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(17, 34, 43, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: rgba(17, 34, 43, 0.8);
  flex: 0 0 auto;
}

#custom-form-root .tfk__choice-key.is-active {
  background: var(--tfk-text);
  border-color: var(--tfk-text);
  color: #fff;
}

#custom-form-root .tfk__choice:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(67, 246, 192, 0.45);
}

#custom-form-root .tfk__choices-wrap {
  width: min(580px, 100%);
}

#custom-form-root .tfk__other-input {
  margin-top: 12px;
  width: 100%;
  background: transparent;
  color: var(--tfk-text);
  border: none;
  border-bottom: 2px solid var(--tfk-text);
  padding: 10px 0 6px;
  font-size: 20px;
  line-height: 1.1;
  outline: none;
}

#custom-form-root .tfk__other-input::placeholder {
  color: var(--tfk-placeholder);
}

#custom-form-root .tfk__phone {
  width: min(580px, 100%);
  position: relative;
}

#custom-form-root .tfk__phone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--tfk-text);
  padding: 8px 0 6px;
}

#custom-form-root .tfk__phone-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: rgba(17, 34, 43, 0.75);
}

#custom-form-root .tfk__phone-flag {
  font-size: 20px;
  line-height: 1;
  /* На Windows флаги часто не рисуются без emoji-шрифта */
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  font-variant-emoji: emoji;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#custom-form-root .tfk__phone-flag .tfk__flag-img {
  width: 20px;
  height: 15px;
  border-radius: 3px;
  display: block;
}

#custom-form-root .tfk__phone-caret {
  font-size: 14px;
  line-height: 1;
  transform: translateY(1px);
}

#custom-form-root .tfk__phone-dial {
  font-size: 20px;
  color: rgba(17, 34, 43, 0.5);
  letter-spacing: 0.01em;
}

#custom-form-root .tfk__phone-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--tfk-text);
  font-size: 20px;
  line-height: 1.1;
  padding: 0;
}

#custom-form-root .tfk__phone-input::placeholder {
  color: var(--tfk-placeholder);
}

#custom-form-root .tfk__phone-input.is-invalid {
  box-shadow: none;
}

#custom-form-root .tfk__phone-row:has(.tfk__phone-input.is-invalid) {
  border-bottom-color: #d34b4b;
}

#custom-form-root .tfk__phone-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: min(420px, 100%);
  max-height: 260px;
  overflow: auto;
  background: var(--tfk-bg);
  border: 1px solid rgba(17, 34, 43, 0.18);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  padding: 6px;
  z-index: 50;
}

#custom-form-root .tfk__phone-option {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
  color: var(--tfk-text);
}

#custom-form-root .tfk__phone-option:hover {
  background: rgba(17, 34, 43, 0.06);
}

#custom-form-root .tfk__phone-option[aria-selected="true"] {
  background: rgba(17, 34, 43, 0.09);
}

#custom-form-root .tfk__phone-option-flag {
  font-size: 18px;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  font-variant-emoji: emoji;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#custom-form-root .tfk__phone-option-flag .tfk__flag-img {
  width: 18px;
  height: 14px;
  border-radius: 3px;
  display: block;
}

#custom-form-root .tfk__phone-option-name {
  font-size: 14px;
}

#custom-form-root .tfk__phone-option-dial {
  font-size: 14px;
  color: rgba(17, 34, 43, 0.55);
}

/* Date (DD / MM / YYYY) */
#custom-form-root .tfk__date {
  width: min(580px, 100%);
}

#custom-form-root .tfk__date-labels {
  display: grid;
  grid-template-columns: 72px 72px 1fr;
  gap: 18px;
  margin: 18px 0 10px;
  color: rgba(17, 34, 43, 0.75);
  font-size: 13px;
}

#custom-form-root .tfk__date-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#custom-form-root .tfk__date-sep {
  font-size: 28px;
  line-height: 1;
  color: rgba(17, 34, 43, 0.55);
  transform: translateY(-2px);
}

#custom-form-root .tfk__date-part {
  border: none;
  outline: none;
  background: transparent;
  color: var(--tfk-text);
  font-size: 28px;
  line-height: 1.05;
  padding: 6px 0 10px;
  border-bottom: 2px solid rgba(17, 34, 43, 0.28);
}

#custom-form-root .tfk__date-part::placeholder {
  color: rgba(17, 34, 43, 0.35);
}

#custom-form-root .tfk__date-day,
#custom-form-root .tfk__date-month {
  width: 72px;
}

#custom-form-root .tfk__date-year {
  width: 120px;
}

#custom-form-root .tfk__date-part.is-invalid {
  border-bottom-color: #d34b4b;
}

#custom-form-root .tfk__footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  bottom: 0;
  background: var(--tfk-bg);
  padding: 16px 0 18px;
}

#custom-form-root .tfk__footer-nav {
  display: inline-flex;
  border-radius: 10px;
  overflow: hidden;
}

/* навигация теперь рендерится внутри .tfk__footer (под вопросом справа) */
#custom-form-root .tfk__nav,
#custom-form-root .tfk__nav-inner {
  display: none;
}

#custom-form-root .tfk__nav-btn {
  width: 34px;
  height: 34px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

#custom-form-root .tfk__nav-btn--prev {
  background: var(--tfk-text);
  color: var(--tfk-accent);
}

#custom-form-root .tfk__nav-btn--next {
  background: var(--tfk-text);
  color: var(--tfk-accent);
}

#custom-form-root .tfk__nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#custom-form-root .tfk__nav-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

#custom-form-root .tfk__footer-nav .tfk__nav-btn + .tfk__nav-btn {
  border-left: 1px solid rgba(255, 252, 249, 0.18);
}

@media (max-width: 520px) {
  #custom-form-root .tfk__stage {
    margin-top: 34px;
  }

  #custom-form-root .tfk__q-title {
    font-size: 18px;
  }

  #custom-form-root .tfk__input {
    font-size: 20px;
  }
}

