/* ═══════════════════════════════════════════════════════════════
   Подбор группы в hero главной (js/group-picker.js)
   Карточка подбора → окно с группами → короткая заявка → «готово».
   ═══════════════════════════════════════════════════════════════ */

.language-block--hero {
  --gp-ink: #0f3077;
  --gp-text: #1b2a3d;
  --gp-muted: #5b6b80;
  --gp-accent: #1189bf;
  --gp-line: #d6e2ef;
  --gp-soft: #eef5fc;
  --gp-ok: #1f9d55;
  --gp-warn: #d97706;
  --gp-error: #c62828;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.language-block--hero h1 {
  margin-bottom: 22px;
}

/* Атрибут hidden сильнее любого display в этих блоках */
.group-picker [hidden],
.gp-dialog [hidden] {
  display: none !important;
}

/* ── Карточка подбора ─────────────────────────────────────────── */

.group-picker {
  background: #fff;
  border-radius: 20px;
  padding: 22px 24px 18px;
  box-shadow: 0 12px 40px rgba(15, 48, 119, 0.12);
  border: 1px solid #e3ecf6;
  max-width: 640px;
}

.group-picker__title {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gp-ink);
  margin: 0 0 14px;
}

.group-picker__langs {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--gp-soft);
  margin-bottom: 16px;
}

.gp-lang {
  position: relative;
  cursor: pointer;
}

.gp-lang input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gp-lang span {
  display: block;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gp-muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.gp-lang input:checked + span {
  background: #fff;
  color: var(--gp-ink);
  box-shadow: 0 2px 8px rgba(15, 48, 119, 0.12);
}

.gp-lang input:focus-visible + span {
  outline: 3px solid rgba(17, 137, 191, 0.45);
  outline-offset: 1px;
}

.group-picker__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.gp-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gp-field__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gp-muted);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.gp-field__control {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 50px;
  padding: 0 38px 0 14px;
  border: 1.5px solid var(--gp-line);
  border-radius: 12px;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%230f3077' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 14px center;
  font-family: inherit;
  font-size: 16px; /* 16px — iOS не увеличивает страницу при фокусе */
  color: var(--gp-text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gp-field__control:hover {
  border-color: #a9c1dc;
}

.gp-field__control:focus-visible {
  outline: none;
  border-color: var(--gp-accent);
  box-shadow: 0 0 0 3px rgba(17, 137, 191, 0.2);
}

.gp-field__control[aria-invalid='true'] {
  border-color: var(--gp-error);
}

.gp-field__error {
  margin-top: 5px;
  font-size: 13px;
  color: var(--gp-error);
}

.gp-field__test {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gp-accent);
  text-decoration: none;
}

.gp-field__test:hover,
.gp-field__test:focus-visible {
  text-decoration: underline;
}

.gp-field[hidden],
.gp-field__test[hidden] {
  display: none;
}

.group-picker__submit.btn {
  width: 100%;
  margin-top: 18px;
  justify-content: center;
}

.group-picker__alt {
  margin: 12px 0 0;
  text-align: center;
  font-size: 15px;
  color: var(--gp-muted);
}

.group-picker__callback {
  border: 0;
  background: none;
  padding: 4px 2px;
  font: inherit;
  font-weight: 700;
  color: var(--gp-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.group-picker__callback:hover {
  color: var(--gp-accent);
}

/* ── Полоса «почему мы» под hero (раньше — пункты в hero) ─────── */

.language-block--hero .hero-benefits {
  display: block; /* не сетка hero из двух колонок */
  margin-top: 36px;
}

.language-block--hero .hero-benefits .features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0;
  background: transparent;
}

.language-block--hero .hero-benefits .features li {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  padding-left: 52px;
}

.language-block--hero .hero-benefits .features li:hover {
  transform: none;
}

.language-block--hero .hero-benefits .feature-text {
  font-size: 17px;
}

@media (max-width: 900px) {
  .group-picker {
    max-width: none;
    padding: 18px 16px 14px;
  }

  .language-block--hero .hero-benefits .features {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ── Окно с группами ──────────────────────────────────────────── */

html.gp-lock {
  overflow: hidden;
}

.gp-dialog {
  --gp-ink: #0f3077;
  --gp-text: #1b2a3d;
  --gp-muted: #5b6b80;
  --gp-accent: #1189bf;
  --gp-line: #d6e2ef;
  --gp-soft: #eef5fc;
  --gp-ok: #1f9d55;
  --gp-warn: #b45309;
  --gp-error: #c62828;
  width: min(720px, calc(100vw - 32px));
  max-height: min(90vh, 920px);
  margin: auto; /* глобальный сброс margin на сайте ломает центрирование <dialog> */
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: #fff;
  color: var(--gp-text);
  box-shadow: 0 24px 70px rgba(10, 25, 60, 0.3);
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.gp-dialog::backdrop {
  background: rgba(10, 25, 50, 0.55);
}

/* Браузер без <dialog>: окно — обычный блок поверх страницы */
.gp-dialog.gp-dialog--fallback[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 10000;
}

.gp-dialog__inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.gp-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #e6edf5;
}

.gp-dialog__title {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--gp-ink);
  outline: none;
}

.gp-dialog__summary {
  margin: 0;
  font-size: 15px;
  color: var(--gp-muted);
}

.gp-link {
  border: 0;
  background: none;
  padding: 0 2px;
  font: inherit;
  font-weight: 700;
  color: var(--gp-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.gp-dialog__close {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--gp-soft);
  color: var(--gp-ink);
  font-size: 18px;
  cursor: pointer;
}

.gp-dialog__close:hover {
  background: #dde9f6;
}

.gp-dialog__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 24px 24px;
}

.gp-view[hidden] {
  display: none;
}

.gp-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0;
  color: var(--gp-muted);
}

.gp-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #d7e4f2;
  border-top-color: var(--gp-accent);
  animation: gp-spin 0.8s linear infinite;
}

@keyframes gp-spin {
  to {
    transform: rotate(360deg);
  }
}

.gp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.gp-filter {
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--gp-line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--gp-text);
  cursor: pointer;
}

.gp-filter[aria-pressed='true'] {
  border-color: var(--gp-ink);
  background: var(--gp-ink);
  color: #fff;
}

.gp-filter:disabled {
  opacity: 0.45;
  cursor: default;
}

.gp-notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff8e6;
  color: #6b4a00;
  font-size: 15px;
  line-height: 1.45;
}

.gp-notice a {
  color: inherit;
  font-weight: 700;
}

.gp-section + .gp-section {
  margin-top: 22px;
}

.gp-section__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--gp-muted);
}

.gp-list {
  display: grid;
  gap: 12px;
}

.gp-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1.5px solid #e3ebf5;
  border-radius: 16px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gp-card:hover {
  border-color: #b6cbe3;
  box-shadow: 0 6px 20px rgba(15, 48, 119, 0.08);
}

.gp-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gp-card__title {
  margin: 0;
  font-size: 18px;
  color: var(--gp-ink);
}

.gp-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: #e6f3fa;
  color: #0b6d99;
  font-size: 13px;
  font-weight: 800;
}

.gp-card__meta,
.gp-card__note {
  margin: 0;
  font-size: 15px;
  color: var(--gp-muted);
}

.gp-card__time {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--gp-text);
}

.gp-card__time i {
  margin-right: 6px;
  color: var(--gp-accent);
}

.gp-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.gp-seats {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.gp-seats::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.gp-seats--available {
  color: var(--gp-ok);
}

.gp-seats--few {
  color: var(--gp-warn);
}

.gp-seats--full {
  color: var(--gp-muted);
}

.gp-choose {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--gp-ink);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gp-choose:hover {
  background: #173f96;
}

.gp-card--full .gp-choose {
  background: #fff;
  color: var(--gp-ink);
  box-shadow: inset 0 0 0 1.5px var(--gp-ink);
}

.gp-more {
  margin-top: 12px;
}

.gp-wish {
  margin-top: 22px;
  padding: 18px;
  border: 1.5px dashed #b6cbe3;
  border-radius: 16px;
  background: #f8fbff;
  text-align: center;
}

.gp-wish__title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: var(--gp-ink);
}

.gp-wish__text {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--gp-muted);
}

.gp-wish .gp-choose {
  background: #fff;
  color: var(--gp-ink);
  box-shadow: inset 0 0 0 1.5px var(--gp-ink);
}

.gp-empty {
  padding: 8px 0 0;
  text-align: center;
}

.gp-empty__title {
  margin: 6px 0;
  font-size: 19px;
  color: var(--gp-ink);
}

.gp-empty__text {
  margin: 0 auto 16px;
  max-width: 460px;
  color: var(--gp-muted);
}

/* ── Заявка ───────────────────────────────────────────────────── */

.gp-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--gp-accent);
  cursor: pointer;
}

.gp-back[hidden] {
  display: none;
}

.gp-choice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--gp-soft);
}

.gp-choice__label {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--gp-muted);
}

.gp-choice__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--gp-ink);
}

.gp-choice__text {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--gp-text);
}

.gp-form__times {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.gp-form__times[hidden] {
  display: none;
}

.gp-form__times legend {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gp-text);
}

.gp-chip {
  position: relative;
  display: inline-block;
  margin: 0 6px 8px 0;
  cursor: pointer;
}

.gp-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gp-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--gp-line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.gp-chip input:checked + span {
  border-color: var(--gp-ink);
  background: var(--gp-ink);
  color: #fff;
}

.gp-chip input:focus-visible + span {
  outline: 3px solid rgba(17, 137, 191, 0.45);
  outline-offset: 1px;
}

.gp-form__row {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.gp-form__row[hidden] {
  display: none;
}

.gp-form__row label {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gp-text);
}

.gp-form__row input {
  height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--gp-line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  color: var(--gp-text);
}

.gp-form__row input:focus-visible {
  outline: none;
  border-color: var(--gp-accent);
  box-shadow: 0 0 0 3px rgba(17, 137, 191, 0.2);
}

.gp-form__row input[aria-invalid='true'],
.gp-form__row input.error {
  border-color: var(--gp-error);
}

.gp-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--gp-muted);
  cursor: pointer;
}

.gp-consent input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--gp-ink);
}

.gp-consent a {
  color: var(--gp-accent);
}

.gp-consent__error {
  display: block;
  margin-left: 30px;
}

.gp-consent__error[hidden],
.gp-field__error[hidden],
.gp-form__error[hidden] {
  display: none;
}

.gp-form__error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fdecea;
  color: var(--gp-error);
  font-size: 14px;
}

.gp-form__submit.btn {
  width: 100%;
  margin-top: 18px;
  justify-content: center;
}

.gp-form__submit[disabled] {
  opacity: 0.7;
  cursor: progress;
}

.gp-form__hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--gp-muted);
}

/* ── Готово ───────────────────────────────────────────────────── */

.gp-done {
  padding: 12px 0 4px;
  text-align: center;
}

.gp-done__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #e5f6ec;
  color: var(--gp-ok);
  font-size: 28px;
}

.gp-done__title {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--gp-ink);
  outline: none;
}

.gp-done__text {
  margin: 0 auto 16px;
  max-width: 480px;
  line-height: 1.5;
}

.gp-done__test {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  margin: 0 auto 18px;
  font-weight: 700;
  color: var(--gp-accent);
}

.gp-done__test[hidden] {
  display: none;
}

/* ── Телефон: окно на весь экран ──────────────────────────────── */

@media (max-width: 640px) {
  .gp-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
  }

  .gp-dialog__inner {
    height: 100%;
  }

  .gp-dialog__head {
    padding: 14px 16px 12px;
  }

  .gp-dialog__title {
    font-size: 19px;
  }

  .gp-dialog__body {
    flex: 1;
    padding: 14px 16px calc(24px + env(safe-area-inset-bottom));
  }

  .gp-card {
    padding: 14px;
  }

  .gp-card__foot .gp-choose {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gp-lang span,
  .gp-field__control,
  .gp-card,
  .gp-choose {
    transition: none;
  }

  .gp-spinner {
    animation-duration: 2s;
  }
}
