/* Вход: одна цветная сцена, клякса голоса здоровается, способы входа рядом с ней.
   Цвета сцены задаются тремя переменными: фон --a, клякса --b, текст --t (как у обложек голосов). */

.gate {
  --a: var(--red); --b: var(--cream); --t: var(--ink);
  position: relative; overflow: clip;
  min-height: max(100svh, 760px);
  padding: calc(var(--head) + 40px) var(--gutter) 64px;
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: 32px; align-items: center;
  background: var(--a); color: var(--t);
  transition: background-color .45s, color .45s;
}
.gate[data-state="error"] { --a: var(--cream); --b: var(--red); }
.gate[data-state="signed"] { --a: var(--yellow); --b: var(--ink); }

.gate__text { position: relative; z-index: 1; max-width: 600px; }
.gate__head[hidden], .ways[hidden], .ways__wait[hidden] { display: none; }

/* Заголовок, который произносит клякса: маркер идёт по словам записи */
.say { position: relative; font: 900 clamp(104px, 11.2vw, 184px)/.84 var(--display); margin: 0 0 28px; text-wrap: balance; }
.say .w { position: relative; z-index: 1; transition: color .12s; }
.say .w.is-now { color: var(--a); }
.say .marker {
  position: absolute; left: 0; top: 0; z-index: 0; width: 0; height: 0;
  background: var(--t); border-radius: .1em; opacity: 0; pointer-events: none;
  transition: transform .12s ease-out, width .12s ease-out, height .12s ease-out, opacity .2s;
}
.say .marker.is-on { opacity: 1; }
.say .marker.no-glide { transition: opacity .2s; }

.gate__lead { font-size: 20px; line-height: 1.35; max-width: 27em; margin-bottom: 32px; text-wrap: pretty; }
.gate__error { font-weight: 600; margin-bottom: 10px; }
.gate__code { font-size: 15px; margin-bottom: 32px; }
.gate__row { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; }

/* Способы входа: Telegram главный (им входит большинство), Google и Яндекс парой под ним */
.ways { max-width: 520px; outline: 0; }
.way {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 0 22px 0 10px; border-radius: 999px;
  border: 2px solid var(--t); color: var(--t);
  font-weight: 600; font-size: 18px; text-decoration: none; white-space: nowrap;
  transition: transform .18s, background-color .18s, color .18s, opacity .2s;
}
.way--main { min-height: 72px; padding-left: 12px; font-size: 20px; background: var(--t); color: var(--a); }
.way:hover { transform: translateY(-2px) rotate(-1deg); }
.way:not(.way--main):hover { background: color-mix(in srgb, var(--t) 10%, transparent); }
.way:focus-visible { outline: 3px solid var(--t); outline-offset: 4px; border-radius: 999px; }
.way:active { transform: translateY(0) scale(.98); }
.way__mark {
  position: relative; flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%; background: var(--cream);
}
.way--main .way__mark { width: 48px; height: 48px; }
.way__mark svg { width: 24px; height: 24px; }
.way--main .way__mark svg { width: 48px; height: 48px; }
.way__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ways__hint { font-size: 15px; margin: 10px 0 18px 4px; }
.ways__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* «Входим…»: выбранный способ крутит кольцо вокруг знака, остальные отходят */
.gate[data-state="busy"] .ways__hint { display: none; }
.gate[data-state="busy"] .way:not(.is-busy) { opacity: .38; pointer-events: none; }
.way.is-busy { pointer-events: none; }
.way.is-busy .way__mark::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; border-bottom-color: transparent;
  animation: way-rot .8s linear infinite;
}
.way--main.is-busy .way__mark::after { border-color: var(--a); border-right-color: transparent; border-bottom-color: transparent; }
@keyframes way-rot { to { transform: rotate(360deg); } }
.ways__wait { display: flex; align-items: baseline; gap: 8px 20px; flex-wrap: wrap; margin-top: 18px; font-weight: 500; }
.ways__wait .link { font-size: 16px; }

.gate__legal { margin-top: 26px; font-size: 14px; line-height: 1.45; max-width: 36em; }
.gate__legal a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gate__legal a:hover { text-decoration-thickness: 2px; }

/* Клякса голоса: сама кнопка «послушать» */
.gate__voice { position: relative; align-self: stretch; display: grid; place-items: center; align-content: center; gap: 14px; min-width: 0; }
.voice {
  position: relative; display: grid; place-items: center;
  width: min(100%, 66vh, 640px); aspect-ratio: 1; border-radius: 50%;
  color: var(--b); -webkit-tap-highlight-color: transparent;
}
.voice:focus-visible { outline: 3px solid var(--t); outline-offset: 8px; }
.voice__still, .voice canvas { grid-area: 1 / 1; width: 100%; height: 100%; overflow: visible; }
.voice__outer { fill: var(--b); transition: fill .45s; }
.voice__inner { fill: var(--a); transition: fill .45s; }
.voice canvas { display: none; }
.motion .voice.is-live canvas { display: block; }
.motion .voice.is-live .voice__still { visibility: hidden; }
/* Знак play в центре, как у кнопок play на главной */
.voice::after {
  grid-area: 1 / 1; z-index: 1; content: ""; width: 9%; aspect-ratio: 1; margin-left: 1.5%;
  background: var(--t); clip-path: polygon(14% 0, 100% 50%, 14% 100%);
  transition: transform .18s;
}
.voice:hover::after { transform: scale(1.18); }
.voice.is-playing::after { clip-path: polygon(8% 0, 38% 0, 38% 100%, 8% 100%, 8% 0, 62% 0, 92% 0, 92% 100%, 62% 100%, 62% 0); margin-left: 0; }
.voice__cap { justify-self: start; margin-left: 8%; display: grid; gap: 2px; font-size: 15px; }
.voice__cap strong { font: 900 34px/1 var(--display); }

@media (max-width: 1023px) {
  .gate { grid-template-columns: minmax(0, 1fr); align-items: start; min-height: 0; padding-top: calc(var(--head) + 24px); gap: 8px; }
  /* Клякса справа, подпись слева от неё: заголовок и вход остаются в первом экране */
  .gate__voice { order: -1; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
  .voice { order: 2; flex: none; width: min(50vw, 400px); margin: -12px -6vw -8px 0; }
  .voice__cap { margin: 0 0 6px; }
  .say { font-size: clamp(96px, 17vw, 150px); }
}
@media (max-width: 680px) {
  .gate { padding-bottom: 48px; }
  .gate { padding-top: calc(var(--head) + 12px); }
  .voice { width: 54vw; margin-right: -12vw; }
  .voice__cap { font-size: 14px; }
  .voice__cap strong { font-size: 26px; }
  .say { font-size: 25vw; margin-bottom: 20px; }
  .gate__lead { font-size: 18px; margin-bottom: 26px; }
  .way { font-size: 17px; padding-right: 16px; gap: 10px; }
  .way--main { font-size: 18px; }
  .ways__row { gap: 8px; }
  .gate__row .btn { width: 100%; }
}
@media (max-width: 359px) {
  .ways__row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .gate, .way, .say .w, .say .marker, .voice__outer, .voice__inner { transition: none; }
  .way:hover { transform: none; }
  .way.is-busy .way__mark::after { animation: none; border-right-color: currentColor; border-bottom-color: currentColor; opacity: .5; }
}
