/* =====================================================================
   ДОЛОМИТ · Базовые стили
   Палитра «минерал»: базальтовый фон, доломитовое золото, жемчуг
   ===================================================================== */

:root {
  /* Фон */
  --ink-950: #07090D;
  --ink-900: #0B0D13;
  --ink-800: #10141D;
  --ink-700: #171C28;

  /* Текст */
  --text-hi:  #F2EEE3;              /* жемчужно-белый */
  --text:     #C8CAD1;
  --text-dim: #8A8FA0;

  /* Акценты */
  --gold:      #E3B85E;
  --gold-soft: #F0D391;
  --gold-deep: #A97F2E;
  --green:     #5FA987;
  --blue:      #7C9EC9;
  --rose:      #C98F9C;
  --copper:    #D08A54;
  --danger:    #E07A6B;

  /* Стекло и линии */
  --glass-bg:     linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  --glass-border: rgba(232,225,208,.10);
  --line:         rgba(232,225,208,.10);
  --line-strong:  rgba(232,225,208,.2);

  /* Поверхность документа (кремовая «бумага» исходных файлов) */
  --paper: #F7F3EA;

  /* Геометрия и типографика */
  --radius:    18px;
  --radius-sm: 12px;
  --font-ui:      "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "Cormorant", Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --shadow: 0 30px 70px -30px rgba(0, 0, 0, .55);
  --ease: cubic-bezier(.22, .61, .2, 1);
}

/* ---------- Сброс ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

img, svg { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
::selection { background: rgba(227, 184, 94, .3); color: var(--text-hi); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Полосы прокрутки */
* { scrollbar-width: thin; scrollbar-color: rgba(232,225,208,.18) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(232,225,208,.16); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(232,225,208,.28); }
*::-webkit-scrollbar-track { background: transparent; }

/* =====================================================================
   Фон: базальт, свечения, грани кристалла, зерно
   ===================================================================== */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 750px at 78% -12%, #1A2133 0%, transparent 60%),
    radial-gradient(950px 700px at -8% 112%, #14211C 0%, transparent 55%),
    linear-gradient(180deg, var(--ink-800), var(--ink-950));
}

.bg::after {                                   /* лёгкое зерно */
  content: "";
  position: absolute;
  inset: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.facets { position: absolute; inset: 0; width: 100%; height: 100%; }

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}
.glow.g1 { width: 560px; height: 560px; top: -180px; right: -120px; background: rgba(227,184,94,.14); animation: drift 26s var(--ease) infinite alternate; }
.glow.g2 { width: 520px; height: 520px; bottom: -200px; left: -140px; background: rgba(95,169,135,.11); animation: drift 32s var(--ease) infinite alternate-reverse; }
.glow.g3 { width: 420px; height: 420px; top: 38%; left: 46%; background: rgba(124,158,201,.08); animation: drift 38s var(--ease) infinite alternate; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-70px, 50px, 0) scale(1.12); }
}

/* =====================================================================
   Общие компоненты
   ===================================================================== */

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(95,169,135,.5);
  animation: pulse 2.6s ease-out infinite;
}
.status-dot.warn { background: var(--gold); box-shadow: 0 0 0 0 rgba(227,184,94,.5); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(95,169,135,.45); }
  70%  { box-shadow: 0 0 0 9px rgba(95,169,135,0); }
  100% { box-shadow: 0 0 0 0 rgba(95,169,135,0); }
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .01em;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s var(--ease);
}
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  color: #241A05;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold) 55%, #C89544);
  box-shadow: 0 14px 34px -14px rgba(227,184,94,.55), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 18px 40px -14px rgba(227,184,94,.65), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-primary:active { transform: translateY(0); filter: brightness(.97); }

.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: color .2s, background-color .2s, border-color .2s, transform .2s var(--ease);
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--text-hi); background: rgba(232,225,208,.07); border-color: var(--line); transform: translateY(-1px); }

.only-mobile { display: none; }

/* =====================================================================
   Экран авторизации
   ===================================================================== */

.auth {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  transition: opacity .4s var(--ease), visibility .4s;
}
.auth.fade-out { opacity: 0; visibility: hidden; }

.auth-inner {
  width: 100%;
  max-width: 430px;
  text-align: center;
}

.auth-mark { display: flex; justify-content: center; margin-bottom: 18px; }
.mark-lg {
  width: 76px; height: 76px;
  color: var(--gold);
  filter: drop-shadow(0 10px 28px rgba(227,184,94,.4));
  animation: markFloat 7s ease-in-out infinite;
}
@keyframes markFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 7vw, 54px);
  letter-spacing: .32em;
  text-indent: .32em;             /* компенсация трекинга для центровки */
  text-transform: uppercase;
  color: var(--text-hi);
  line-height: 1.1;
}

.auth-sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 15px;
}

.auth-card {
  margin-top: 30px;
  padding: 28px 26px 26px;
  text-align: left;
}
.auth-card.shake { animation: shake .5s var(--ease); }

@keyframes shake {
  10%, 90%      { transform: translateX(-1px); }
  20%, 80%      { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60%      { transform: translateX(5px); }
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
}
.field-icon {
  position: absolute;
  left: 15px;
  width: 18px; height: 18px;
  color: var(--text-dim);
  pointer-events: none;
  transition: color .2s;
}
.field:focus-within .field-icon { color: var(--gold); }

#auth-code {
  width: 100%;
  padding: 14px 48px 14px 44px;
  background: rgba(7, 9, 13, .5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-hi);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .1em;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
#auth-code::placeholder { color: var(--text-dim); letter-spacing: .02em; font-family: var(--font-ui); }
#auth-code:focus {
  outline: none;
  border-color: rgba(227,184,94,.55);
  box-shadow: 0 0 0 4px rgba(227,184,94,.13);
  background: rgba(7, 9, 13, .7);
}

.eye {
  position: absolute;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  color: var(--text-dim);
  transition: color .2s, background-color .2s;
}
.eye svg { width: 18px; height: 18px; }
.eye:hover { color: var(--text-hi); background: rgba(232,225,208,.07); }

.auth-error {
  display: none;
  margin: 12px 2px 0;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #F3C1B8;
  background: rgba(224,122,107,.1);
  border: 1px solid rgba(224,122,107,.32);
  border-radius: 10px;
}
.auth-error.visible { display: block; animation: fadeUp .35s var(--ease); }
.auth-error.is-info {
  color: #EBDDB4;
  background: rgba(227,184,94,.09);
  border-color: rgba(227,184,94,.32);
}

.auth-card form .btn { margin-top: 16px; }

.auth-note {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* Каскадное появление элементов авторизации */
.auth .reveal { opacity: 0; }
.auth.active .reveal { animation: fadeUp .8s var(--ease) both; }
.auth.active .r1 { animation-delay: .05s; }
.auth.active .r2 { animation-delay: .16s; }
.auth.active .r3 { animation-delay: .26s; }
.auth.active .r4 { animation-delay: .38s; }
.auth.active .r5 { animation-delay: .52s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Доступность: уменьшение движения
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
