/* =====================================================================
   Маршрут — авторизация (B2 «Сумерки»).
   Модалка входа/регистрации/сброса (auth.js) + отдельные страницы
   confirm.html / reset.html. Токены продублированы, чтобы файл работал
   и поверх лендинга/кабинета, и на самостоятельных страницах.
   ===================================================================== */
:root {
  --auth-bg:     #14100C;
  --auth-panel:  #161009;
  --auth-tx:     #EFE4DA;
  --auth-tx-2:   #F5ECE3;
  --auth-sec:    #C9B6A6;
  --auth-mute:   #8A7868;
  --auth-mono-c: #9A8576;
  --auth-acc:    #F0743C;
  --auth-acc-l:  #F6B48E;
  --auth-grad:   linear-gradient(180deg, #F0743C, #E8622C);
  --auth-line:   rgba(255,255,255,.10);
  --auth-line-2: rgba(255,255,255,.14);
  --auth-err:    #E8836A;
  --auth-ok:     #6FC28A;
  --auth-font:   'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --auth-mono:   'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

@keyframes auth-in   { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes auth-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- overlay + модалка ---------- */
.auth-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8,6,4,.66);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: auth-fade .18s ease both;
}
.auth-overlay[hidden] { display: none; }

.auth-card {
  position: relative; width: 100%; max-width: 420px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025)), var(--auth-panel);
  border: 1px solid var(--auth-line); border-radius: 20px;
  padding: 30px 28px 26px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.7), 0 0 70px -30px rgba(232,98,44,.5), inset 0 1px 0 rgba(255,255,255,.06);
  animation: auth-in .22s ease both;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent;
}
.auth-card::-webkit-scrollbar { width: 8px; }
.auth-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }
.auth-card--page { animation: auth-in .26s ease both; }

.auth-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--auth-line); border-radius: 9px; background: rgba(255,255,255,.04);
  color: var(--auth-sec); cursor: pointer; font-size: 18px; line-height: 1; transition: background .15s;
}
.auth-close:hover { background: rgba(255,255,255,.08); }

.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: var(--auth-tx-2); margin-bottom: 18px; }
.auth-brand__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--auth-acc); box-shadow: 0 0 12px rgba(240,116,60,.8); }

.auth-title { font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--auth-tx-2); margin: 0 0 6px; }
.auth-sub { font-size: 14px; color: var(--auth-sec); margin: 0 0 22px; line-height: 1.5; }

/* ---------- поля ---------- */
.auth-field { margin-bottom: 14px; }
.auth-label { display: block; font-family: var(--auth-mono); font-size: 11px; letter-spacing: .04em; color: var(--auth-mute); margin-bottom: 7px; }
.auth-input {
  width: 100%; box-sizing: border-box; font-family: var(--auth-font); font-size: 15px;
  color: var(--auth-tx-2); background: rgba(255,255,255,.04);
  border: 1px solid var(--auth-line); border-radius: 12px; padding: 12px 14px;
  outline: none; transition: border-color .15s, background .15s;
}
.auth-input::placeholder { color: #7E6A5A; }
.auth-input:focus { border-color: rgba(240,116,60,.6); background: rgba(255,255,255,.06); }
.auth-input.is-invalid { border-color: rgba(232,131,106,.7); }

.auth-pass { position: relative; }
.auth-pass .auth-input { padding-right: 64px; }
.auth-pass__toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  border: none; background: transparent; color: var(--auth-mute); cursor: pointer;
  font-family: var(--auth-mono); font-size: 11px; padding: 6px 8px; border-radius: 8px;
}
.auth-pass__toggle:hover { color: var(--auth-acc-l); }

.auth-error { display: none; font-size: 12.5px; color: var(--auth-err); margin-top: 6px; }
.auth-error.is-shown { display: block; }

/* чекбокс согласия */
.auth-check { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--auth-sec); line-height: 1.45; margin: 4px 0 18px; cursor: pointer; }
.auth-check input { margin-top: 2px; accent-color: var(--auth-acc); flex: none; }
.auth-check a { color: var(--auth-acc-l); }

/* ---------- кнопки ---------- */
.auth-btn {
  width: 100%; box-sizing: border-box; border: none; cursor: pointer; font-family: var(--auth-font);
  font-weight: 700; font-size: 15px; padding: 13px; border-radius: 12px;
  background: var(--auth-grad); color: #fff; box-shadow: 0 12px 28px -10px rgba(232,98,44,.7);
  transition: filter .15s;
}
.auth-btn:hover { filter: brightness(1.06); }
.auth-btn--ghost {
  background: transparent; color: var(--auth-tx); border: 1px solid var(--auth-line-2);
  box-shadow: none; font-weight: 600;
}
.auth-btn--ghost:hover { background: rgba(255,255,255,.05); filter: none; }

.auth-row { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px 0; font-size: 13px; }
.auth-link { background: none; border: none; cursor: pointer; font-family: var(--auth-font); font-size: 13px; color: var(--auth-acc-l); padding: 0; }
.auth-link:hover { text-decoration: underline; }
.auth-foot { text-align: center; font-size: 13px; color: var(--auth-sec); margin-top: 18px; }
.auth-foot .auth-link { font-size: 13px; }

.auth-hint { font-family: var(--auth-mono); font-size: 11px; color: var(--auth-mono-c); text-align: center; margin-top: 16px; line-height: 1.5; }

/* состояние «письмо отправлено» / иконки статуса */
.auth-status { text-align: center; padding: 6px 0 2px; }
.auth-status__icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: rgba(240,116,60,.14); border: 1px solid rgba(240,116,60,.4); color: var(--auth-acc-l);
}
.auth-status__icon--ok  { background: rgba(111,194,138,.14); border-color: rgba(111,194,138,.4); color: var(--auth-ok); }
.auth-status__icon--err { background: rgba(232,131,106,.14); border-color: rgba(232,131,106,.4); color: var(--auth-err); }
.auth-status .auth-mailto { color: var(--auth-tx-2); font-weight: 600; }

[data-auth-view] { display: none; }
[data-auth-view].is-active { display: block; }

/* ---------- самостоятельные страницы confirm/reset ---------- */
.auth-page {
  margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  font-family: var(--auth-font); background: var(--auth-bg); color: var(--auth-tx);
  -webkit-font-smoothing: antialiased;
}
.auth-page__bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 36% at 50% 0%, rgba(232,98,44,.30), transparent 60%),
    radial-gradient(36% 40% at 80% 90%, rgba(176,52,24,.24), transparent 62%);
}
.auth-page .auth-card { position: relative; z-index: 1; }

@media (max-width: 480px) {
  .auth-card { padding: 26px 20px 22px; border-radius: 16px; }
  .auth-title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-overlay, .auth-card, .auth-card--page { animation: none; }
}
