/* ══════════════════════════════════════════════════════════════════════
   AUTH-REDESIGN (2026-10-12): вход, регистрация, подтверждение почты,
   «забыли пароль», новый пароль — templates/auth/*.html (общий каркас —
   auth/_base.html), скрипт — static/js/auth.js. Макет — context/auth-redesign.html.

   Одна карточка формы; вся «жизнь» — в фоне и в самой форме:
   · за карточкой — большие размытые блобы медленно перетекают («динамический градиент»);
   · под стеклом карточки — тягучие блобы-«лизуны», как в «Не конвейер», но живые:
     курсор их расталкивает, блоб рвётся на капли и стягивается обратно (auth.js);
   · у карточки — медленно вращающаяся градиентная рамка и свечение за курсором;
   · поля загораются рамкой при фокусе; кнопка — текучий градиент, блик за
     курсором, волна при нажатии, сердце и сердечки (как у «Доната»).
   Атмосферные цвета и цвета капель — свои, локальные: общие --atm-* сайта не трогаем.
   ══════════════════════════════════════════════════════════════════════ */
@property --au-ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.auth-wrap {
  --atm-violet: rgba(120, 80, 220, .40); --atm-blue: rgba(60, 110, 235, .34);
  --atm-indigo: rgba(80, 60, 200, .34); --atm-accent: rgba(229, 56, 59, .26);
  --g1: #e5383b; --g2: #8b5cf6; --g3: #ec4899; --g4: #6366f1; --goo-a: .7; --glass: 68%;
  --heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.3C.9 8.2 2.9 4.5 6.6 4.5c2 0 3.6 1 5.4 3 1.8-2 3.4-3 5.4-3 3.7 0 5.7 3.7 4.2 7.2C19.5 16.4 12 21 12 21Z'/%3E%3C/svg%3E");
}
/* на белом насыщенные капли выглядели бы тёмными пятнами под текстом — берём светлые тона, зато плотнее */
[data-theme="light"] .auth-wrap {
  --atm-violet: rgba(120, 80, 220, .20); --atm-blue: rgba(60, 110, 235, .18);
  --atm-indigo: rgba(80, 60, 200, .16); --atm-accent: rgba(204, 36, 39, .14);
  --g1: #ff8f91; --g2: #b9a2ff; --g3: #ff9ccd; --g4: #9da8ff; --goo-a: .95; --glass: 46%;
}

.auth-wrap { position: relative; min-height: calc(100svh - 100px); display: grid; place-items: center; padding: 36px 16px; overflow: hidden; isolation: isolate; }

/* блобы */
.auth-blobs { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.auth-blob-1 { width: 46vw; height: 46vw; max-width: 620px; max-height: 620px; left: 50%; top: 50%; margin: -34% 0 0 -44%;
               background: radial-gradient(circle, var(--atm-violet) 0%, transparent 68%); animation: au-d1 22s ease-in-out infinite alternate; }
.auth-blob-2 { width: 40vw; height: 40vw; max-width: 540px; max-height: 540px; left: 50%; top: 50%; margin: -20% 0 0 6%;
               background: radial-gradient(circle, var(--atm-blue) 0%, transparent 68%); animation: au-d2 18s ease-in-out infinite alternate; }
.auth-blob-3 { width: 38vw; height: 38vw; max-width: 500px; max-height: 500px; left: 50%; top: 50%; margin: 2% 0 0 -30%;
               background: radial-gradient(circle, var(--atm-indigo) 0%, transparent 68%); animation: au-d3 26s ease-in-out infinite alternate; }
.auth-blob-4 { width: 30vw; height: 30vw; max-width: 420px; max-height: 420px; left: 50%; top: 50%; margin: -4% 0 0 -8%;
               border-radius: 60% 40% 55% 45%;
               background: radial-gradient(ellipse 120% 80%, var(--atm-accent) 0%, transparent 70%); animation: au-d4 16s ease-in-out infinite alternate; }
@keyframes au-d1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(90px, 60px) scale(1.14); } }
@keyframes au-d2 { from { transform: translate(0, 0) scale(1.05); } to { transform: translate(-80px, 50px) scale(.9); } }
@keyframes au-d3 { from { transform: translate(0, 0) scale(.95); } to { transform: translate(70px, -60px) scale(1.12); } }
@keyframes au-d4 { from { transform: translate(-40px, 30px) scale(.9) rotate(-8deg); } to { transform: translate(60px, -40px) scale(1.15) rotate(10deg); } }
/* тягучие блобы — под стеклом самой карточки, как в «Не конвейер», но живые:
   плывут сами, а от курсора разбегаются и рвутся на капли; SVG-фильтр
   склеивает их при встрече */
.au-goo { position: absolute; inset: 0; z-index: 0; border-radius: inherit; overflow: hidden; pointer-events: none; container-type: size; }
.au-goo-in { position: absolute; inset: 0; filter: url(#au-goo-f) blur(6px); opacity: var(--goo-a); }
/* Капли расставляет и двигает скрипт (см. «живые блобы» внизу): у каждого блоба
   несколько капель на пружинах, курсор их расталкивает — блоб рвётся на капли,
   а потом стягивается обратно. Без скрипта и при reduced-motion — стоят на месте */
.au-goo-in i { position: absolute; left: 0; top: 0; display: block; border-radius: 50%; will-change: transform; }
/* стекло поверх блобов: сквозь него они читаются мягкими пятнами, текст — чётко */
.au-glass { position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none;
            background: color-mix(in srgb, var(--c-base) var(--glass), transparent);
            -webkit-backdrop-filter: blur(7px) saturate(1.25); backdrop-filter: blur(7px) saturate(1.25); }

/* карточка */
.auth-card {
  --mx: 50%; --my: 0%;
  position: relative; width: 100%; max-width: 470px; display: flex; flex-direction: column; gap: 18px;
  padding: 38px 36px 32px; border-radius: 28px;
  background: var(--c-base);
  box-shadow: var(--shadow-lg);
  animation: au-in .6s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes au-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
/* градиентная рамка: цвета блобов и акцент, медленно вращается */
.auth-card::before {
  content: ''; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--au-ang), var(--c-accent), #7a50dc 28%, #3c6eeb 52%, transparent 66%, transparent 84%, var(--c-accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  animation: au-spin 9s linear infinite; opacity: .85;
}
@keyframes au-spin { to { --au-ang: 360deg; } }
/* свечение за курсором */
.auth-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background: radial-gradient(320px circle at var(--mx) var(--my), color-mix(in srgb, var(--c-accent) 16%, transparent), transparent 70%);
  opacity: 0; transition: opacity .35s ease;
}
.auth-card:hover::after { opacity: 1; }
.auth-card > :not(.au-goo):not(.au-glass) { position: relative; z-index: 1; }

.auth-top { position: relative; display: flex; align-items: center; justify-content: center; min-height: 40px; }
.auth-logo { display: inline-flex; align-items: center; color: var(--c-text); }
.auth-logo svg { height: 18px; width: auto; display: block; }
.auth-logo svg * { fill: currentColor; }
/* «назад ко входу» — круглая кнопка с шевроном (без стрелки в тексте) */
.au-back { position: absolute; left: -8px; top: 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--c-stroke-s); cursor: pointer;
           display: grid; place-items: center; color: var(--c-text-2);
           background: color-mix(in srgb, var(--c-raised) 70%, transparent);
           transition: color .2s ease, border-color .2s ease, background-color .2s ease, transform .2s cubic-bezier(.3,1.4,.5,1); }
.au-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
               transition: transform .2s cubic-bezier(.3,1.4,.5,1); }
.au-back:hover { color: #fff; background: var(--c-accent); border-color: var(--c-accent); }
.au-back:hover svg { transform: translateX(-2px); }
.au-back:active { transform: scale(.94); }
.auth-title { margin: 4px 0 0; font: 800 30px/1.1 var(--f-ui); letter-spacing: -.02em; }
.auth-sub { margin: -8px 0 0; font-size: 14px; color: var(--c-text-2); text-wrap: pretty; }
/* зачем аккаунт — три пилюли (только на регистрации) */
/* столбиком: раскрывающаяся пилюля растёт вправо и не толкает соседей и форму */
.auth-perks { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: -4px 0 0; padding: 0; list-style: none; }
.auth-perks li { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 9px; border-radius: 999px;
                 font-size: 12.5px; font-weight: 600; color: var(--c-text-2);
                 background: color-mix(in srgb, var(--c-raised) 70%, transparent); border: 1px solid var(--c-stroke-s);
                 transition: color .2s ease, border-color .2s ease, transform .2s cubic-bezier(.3,1.4,.5,1); }
.auth-perks li:hover { color: var(--c-text); border-color: var(--c-accent-m); transform: translateY(-2px); }
.auth-perks svg { flex: none; width: 15px; height: 15px; fill: none; stroke: var(--c-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* пилюля с уточнением: при наведении (или фокусе, или тапе) дописывает хвост */
.auth-perks .more { display: inline-block; max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; vertical-align: bottom;
                    transition: max-width .45s cubic-bezier(.2,.9,.3,1), opacity .3s ease; }
.auth-perks li[data-more] { cursor: default; white-space: nowrap; }
.auth-perks li[data-more]:hover .more, .auth-perks li[data-more]:focus .more, .auth-perks li[data-more].on .more { max-width: 22em; opacity: 1; }
.auth-perks li[data-more]:hover, .auth-perks li[data-more]:focus, .auth-perks li[data-more].on { color: var(--c-text); border-color: var(--c-accent-m); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .field { display: flex; flex-direction: column; gap: 6px; }
.auth-card .field label { font-size: 13px; font-weight: 600; color: var(--c-text-2); transition: color .18s ease; }
.auth-card .field:focus-within label { color: var(--c-accent); }
.auth-card .field input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; outline: none;
  background: color-mix(in srgb, var(--c-raised) 82%, transparent); border: 1.5px solid var(--c-stroke-s); color: var(--c-text);
  font: 15px var(--f-ui); transition: border-color .18s ease, box-shadow .25s ease, background-color .18s ease;
}
.auth-card .field input::placeholder { color: var(--c-muted); }
.auth-card .field input:hover { border-color: color-mix(in srgb, var(--c-accent) 35%, var(--c-stroke-s)); }
.auth-card .field input:focus { border-color: var(--c-accent); background: var(--c-raised);
                     box-shadow: 0 0 0 4px var(--c-accent-s), 0 8px 26px -10px color-mix(in srgb, var(--c-accent) 60%, transparent); }
.auth-card .field-hint { font-size: 12.5px; color: var(--c-muted); }
.auth-card .field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.auth-card .field-row a { font-size: 13px; }
/* поля появляются по очереди */
.auth-form > * { animation: au-row .5s cubic-bezier(.2,.9,.3,1) both; }
.auth-form > :nth-child(1) { animation-delay: .12s; } .auth-form > :nth-child(2) { animation-delay: .19s; }
.auth-form > :nth-child(3) { animation-delay: .26s; } .auth-form > :nth-child(4) { animation-delay: .33s; }
.auth-form > :nth-child(5) { animation-delay: .4s; }
@keyframes au-row { from { opacity: 0; transform: translateY(10px); } }
/* пароль: «глаз» */
.au-pw { position: relative; }
.auth-card .au-pw input { padding-right: 50px; }
.au-eye { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none;
          color: var(--c-muted); cursor: pointer; display: grid; place-items: center; transition: color .18s ease; }
.au-eye:hover { color: var(--c-text); }
.au-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.au-eye .slash { transition: stroke-dashoffset .25s ease; stroke-dasharray: 26; stroke-dashoffset: 0; }
.au-eye.on .slash { stroke-dashoffset: 26; }
.auth-card .au-code input { height: 60px; text-align: center; font: 700 26px var(--f-mono); letter-spacing: .34em; padding-left: .34em; }
.au-sent { padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--c-raised) 70%, transparent); border: 1px solid var(--c-stroke); font-size: 13px; color: var(--c-text-2); }
.au-sent b { color: var(--c-text); }
.au-warn { padding: 10px 14px; border-radius: 14px; font-size: 12.5px; line-height: 1.5; color: var(--c-warn);
           background: var(--c-warn-s); border: 1px solid color-mix(in srgb, var(--c-warn) 45%, transparent); }

/* кнопка: градиент течёт сам, блик идёт за курсором, при нажатии — круговая волна;
   на входе, регистрации и подтверждении — сердце и сердечки, как у «Доната» */
.au-submit {
  --bx: 50%; --by: 50%;
  position: relative; height: 52px; margin-top: 4px; border: 0; border-radius: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  color: #fff; font: 700 15px var(--f-ui); letter-spacing: .01em;
  background: linear-gradient(110deg, var(--c-accent), #c2307a 45%, #7a50dc 70%, var(--c-accent)) 0 50% / 300% 100%;
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--c-accent) 55%, transparent);
  transition: transform .18s cubic-bezier(.3,1.4,.5,1), box-shadow .25s ease;
  animation: au-flow 9s ease-in-out infinite alternate;
}
@keyframes au-flow { from { background-position: 0 50%; } to { background-position: 100% 50%; } }
.au-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -8px color-mix(in srgb, var(--c-accent) 70%, transparent); animation-duration: 3.5s; }
.au-submit:active { transform: scale(.98); }
.au-glow { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.au-glow::before { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .25s ease;
                   background: radial-gradient(140px circle at var(--bx) var(--by), rgba(255,255,255,.34), transparent 70%); }
.au-submit:hover .au-glow::before { opacity: 1; }
.au-wave { position: absolute; left: var(--bx); top: var(--by); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
           background: rgba(255,255,255,.5); animation: au-wave .6s ease-out forwards; }
@keyframes au-wave { to { transform: scale(46); opacity: 0; } }
.au-submit:focus-visible, .au-eye:focus-visible, .au-ghost:focus-visible, .au-back:focus-visible, .auth-perks li:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
.au-submit > svg { width: 17px; height: 17px; fill: #fff; transform-origin: 50% 60%; animation: au-hb 2.4s ease-in-out infinite; position: relative; z-index: 1; }
.au-submit > span.t { position: relative; z-index: 1; }
@keyframes au-hb { 0%, 30%, 100% { transform: scale(1); } 8% { transform: scale(1.3); } 15% { transform: scale(.95); } 22% { transform: scale(1.18); } }
.au-submit:hover > svg { animation: au-hb-h .9s ease-in-out infinite; }
@keyframes au-hb-h { 0%, 46%, 100% { transform: scale(1); } 12% { transform: scale(1.55); } 22% { transform: scale(.92); } 33% { transform: scale(1.34); } }
.au-rise { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.au-out { position: absolute; left: 0; right: 0; bottom: 100%; height: 0; pointer-events: none; }
.au-rise i, .au-out i { position: absolute; width: 9px; height: 9px; opacity: 0;
  -webkit-mask: var(--heart) center / contain no-repeat; mask: var(--heart) center / contain no-repeat; }
.au-rise i { bottom: -10px; background: #fff; }
.au-rise i:nth-child(1) { left: 18%; } .au-rise i:nth-child(2) { left: 44%; width: 7px; height: 7px; }
.au-rise i:nth-child(3) { left: 66%; } .au-rise i:nth-child(4) { left: 86%; width: 7px; height: 7px; }
.au-out i { bottom: -4px; background: var(--c-accent); --dx: 0px; --r: 12deg; }
.au-out i:nth-child(1) { left: 10%; --dx: -8px; --r: -16deg; } .au-out i:nth-child(2) { left: 32%; --dx: -3px; width: 7px; height: 7px; }
.au-out i:nth-child(3) { left: 54%; --dx: 3px; --r: 18deg; width: 10px; height: 10px; }
.au-out i:nth-child(4) { left: 74%; --dx: 6px; --r: -10deg; width: 7px; height: 7px; } .au-out i:nth-child(5) { left: 90%; --dx: 9px; }
.au-submit:hover .au-rise i { animation: au-rise 1.3s ease-out infinite; }
.au-submit:hover .au-out i { animation: au-out 1.25s ease-out infinite; }
.au-submit:hover i:nth-child(2) { animation-delay: .3s; } .au-submit:hover i:nth-child(3) { animation-delay: .65s; }
.au-submit:hover i:nth-child(4) { animation-delay: .95s; } .au-submit:hover i:nth-child(5) { animation-delay: .5s; }
@keyframes au-rise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 25% { opacity: .75; } 100% { transform: translateY(-64px) scale(1.1) rotate(14deg); opacity: 0; } }
@keyframes au-out { 0% { transform: translate(0, 4px) scale(.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(var(--dx), -30px) scale(1.15) rotate(var(--r)); opacity: 0; } }

.auth-switch { margin: 2px 0 0; font-size: 14px; color: var(--c-muted); }
.auth-switch a { font-weight: 700; }
.auth-switch a:hover, .field-row a:hover { text-decoration: underline; }
.au-resend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--c-muted); }
.au-ghost { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--c-stroke-s); background: none; color: var(--c-text-2); font-weight: 600; cursor: pointer;
            transition: border-color .2s ease, color .2s ease; }
.au-ghost:hover { border-color: var(--c-accent-m); color: var(--c-text); }

@media (max-width: 520px) {
  /* на телефоне уточнение не помещается в строку — пилюля становится выше */
  .auth-perks li { max-width: 100%; }
  .auth-perks li[data-more] { height: auto; min-height: 32px; padding-top: 6px; padding-bottom: 6px; white-space: normal; align-items: flex-start; }
  .auth-perks li[data-more] svg { margin-top: 2px; }
  .auth-perks .more { display: none; max-width: none; white-space: normal; }
  .auth-perks li[data-more].on .more, .auth-perks li[data-more]:focus .more { display: inline; }
  .auth-wrap { padding: 18px 12px 28px; place-items: start center; }
  .auth-card { padding: 28px 20px 24px; border-radius: 24px; }
  .auth-title { font-size: 26px; }
  .auth-blob { filter: blur(50px); }
  .auth-blob-1, .auth-blob-2, .auth-blob-3, .auth-blob-4 { width: 80vw; height: 80vw; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-wrap *, .auth-wrap *::before, .auth-wrap *::after { animation: none !important; transition: none !important; }
}

/* сообщения (flash) внутри карточки */
.auth-card .flash { margin: 0; border-radius: 14px; }
.auth-card .field--error input { border-color: var(--c-accent); }
.auth-card .field-hint--error { color: var(--c-accent); }
.auth-logo:hover, .au-back:hover { text-decoration: none; }
/* запасной текстовый логотип (если в CMS нет SVG) */
.auth-logo-svg text { font-family: var(--f-mono); }
