/* ============================================================
   AVatar Финдир — направление C «Округлый гуманист»
   ДНК: cold · humanist-rounded (Rubik / Nunito Sans) · editorial-rail · светлый
   Тепло — только от формы шрифта и интонации. Палитра — холодная и дисциплинированная.
   ============================================================ */

/* ---------- Шрифты (self-hosted, кириллица + латиница раздельно) ---------- */

/* Rubik — display, округло-геометрический гротеск, родная кириллица (OFL) */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/rubik-cyrillic-500.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/rubik-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/rubik-cyrillic-600.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/rubik-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/rubik-cyrillic-700.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/rubik-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}

/* Nunito Sans — body, округлый гуманист-гротеск (OFL, variable 400..700) */
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/nunitosans-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/nunitosans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/nunitosans-cyrillic-italic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/nunitosans-latin-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2116, U+2122, U+2212;
}

/* ---------- Токены ---------- */
:root {
  /* Палитра 60/30/10 — холодная (провенанс: дневной свет сквозь стекло, вечерний экран данных) */
  --bg:            #F2F4F8; /* 60% — прохладный off-white, сине-серый подтон */
  --surface:       #E6EAF1; /* 30% — чуть глубже фона, холодный светло-серый (карточки) */
  --ink:           #1A1D23; /* текст — холодный почти-чёрный, не #000 */
  --muted:         #4E5563; /* второстепенный текст — холодный графит */
  --accent:        #2F5878; /* 10% — спокойный сумеречный синий (не финтех-бирюза/зелень) */
  --accent-strong: #264862; /* hover / нажатие */
  --accent-wash:   #E2E9F1; /* холодная бледная заливка hover ghost-кнопки */

  /* Кольца-обводки (вместо рамок) — холодный подтон, согласован с фоном */
  --ring:        rgba(45, 72, 98, 0.22);
  --ring-accent: rgba(47, 88, 120, 0.55);

  /* Радиус — единый, умеренный (дружелюбие ритма, не «пузыри») */
  --r-card: 16px;
  --r-ctrl: 12px;

  /* Тень — двухуровневая, холодный подтон (согласован с фоном), не чёрная, не clay */
  --shadow: 0 1px 2px rgba(38, 72, 98, 0.06), 0 14px 28px -12px rgba(38, 72, 98, 0.16);
  --shadow-lift: 0 2px 4px rgba(38, 72, 98, 0.08), 0 22px 40px -16px rgba(38, 72, 98, 0.22);

  /* Типографика — модульная шкала ×1.25, база 18px */
  --ff-display: 'Rubik', system-ui, sans-serif;
  --ff-body: 'Nunito Sans', system-ui, sans-serif;
  --fs-caption: 0.9375rem; /* 15px — служебные подписи */
  --fs-body: 1.125rem;     /* 18px */
  --fs-lead: 1.40625rem;   /* 22.5px */
  --fs-h3: 1.7578rem;      /* 28.1px */
  --fs-h2: 2.1973rem;      /* 35.2px */
  --fs-h1: clamp(2.5rem, 1.6rem + 3.6vw, 3.4375rem); /* 40 → 55px (следующая ступень шкалы) */

  --measure: 65ch;
  --maxw: 1600px;
  --rail-w: 3.5rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* одна кривая на весь сайт */
}

/* ---------- Сброс / база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--ff-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

::selection { background: var(--accent); color: #FFFFFF; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

img, svg { max-width: 100%; display: block; }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--accent);
  color: #FFFFFF;
  padding: 0.5rem 1rem;
  border-radius: var(--r-ctrl);
  z-index: 100;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0.5rem; color: #FFFFFF; }

/* ---------- Раскладка: editorial-rail ---------- */
.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 4rem);
}

.rail-grid {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 3rem);
  align-items: start;
}

/* Вертикальная подпись/оглавление в гаттере (writing-mode) — «один смелый ход» ДНК */
.rail {
  position: sticky;
  top: 2rem;
  align-self: start;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  gap: 1rem;
  height: fit-content;
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: var(--fs-caption);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail .rail-mark {
  color: var(--accent);
  font-weight: 700;
}
.rail::after {
  content: "";
  flex: 1;
  min-height: 5rem;
  border-radius: 999px;
  background: linear-gradient(var(--accent), transparent);
  opacity: 0.35;
  writing-mode: horizontal-tb;
  width: 2px;
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand .brand-glyph { color: var(--accent); flex: none; }

/* ---------- Кнопки ---------- */
.btn {
  --pad-y: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: var(--pad-y) 1.5rem;
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  border: none;
  border-radius: var(--r-ctrl);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.12s var(--ease);
}
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-strong); color: #FFFFFF; }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--ring-accent);
}
.btn-ghost:hover { background: var(--accent-wash); color: var(--accent-strong); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 8vh, 6rem) clamp(2.5rem, 6vh, 4.5rem); }
.hero-eyebrow {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.hero-eyebrow b { color: var(--accent); font-weight: 700; }

.hero h1 { max-width: 18ch; margin-bottom: 1.5rem; }
.hero h1 .soft { color: var(--accent); }

.hero-lead {
  font-size: var(--fs-lead);
  line-height: 1.45;
  color: var(--muted);
  max-width: 54ch;
  margin-bottom: 2rem;
}
.hero-lead dfn { font-style: italic; color: var(--ink); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.875rem; align-items: center; }
.hero-cta .note { font-size: var(--fs-caption); color: var(--muted); }

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

/* ---------- Сигнатура: карточка-переводчик ---------- */
.translator {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: clamp(1.5rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}
.translator-head {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}
.translator-head .glyph { color: var(--accent); align-self: center; flex: none; }
.translator-head h2 {
  font-size: var(--fs-h3);
  letter-spacing: -0.015em;
}
.field-label {
  display: block;
  font-weight: 700;
  font-size: var(--fs-caption);
  color: var(--ink);
  margin-bottom: 0.5rem;
}

/* стилизованный <select> — appearance:none + SVG-стрелка, семантика нативная */
.select-shell { position: relative; }
.term-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 3rem 0.75rem 1rem;
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--bg);
  border: none;
  box-shadow: inset 0 0 0 1.5px var(--ring);
  border-radius: var(--r-ctrl);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232F5878' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}
.term-select::-ms-expand { display: none; }
.term-select:hover { box-shadow: inset 0 0 0 1.5px var(--ring-accent); }
.term-select option { background: var(--bg); color: var(--ink); }

.translation {
  margin-top: 1.25rem;
  padding: 1.25rem 1.375rem;
  background: var(--bg);
  border-radius: var(--r-ctrl);
}
.translation .from {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--accent);
  margin-bottom: 0.375rem;
}
.translation .from svg { flex: none; }
.translation .to {
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  transition: opacity 0.2s var(--ease);
}

/* ---------- Раздел «Как это работает» ---------- */
.section { padding-block: clamp(3rem, 8vh, 6rem); }
.section-head { max-width: var(--measure); margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head .eyebrow {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.section-head h2 { font-size: var(--fs-h2); margin-bottom: 1rem; }
.section-head p { font-size: var(--fs-lead); line-height: 1.45; color: var(--muted); max-width: 52ch; }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}
.step {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: clamp(1.5rem, 2.5vw, 2rem);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.step:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.step-num {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.step-num .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex: none; }
.step h3 { font-size: var(--fs-h3); margin-bottom: 0.625rem; }
.step p { color: var(--muted); line-height: 1.55; }
.step p dfn { font-style: italic; color: var(--ink); font-weight: 600; }

/* ---------- Подвал ---------- */
.site-footer {
  padding-block: clamp(2.5rem, 5vh, 4rem);
  border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--muted);
  font-size: var(--fs-caption);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Логин-модалка ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
}
.modal-card {
  width: min(26rem, 100%);
  background: var(--bg);
  border-radius: var(--r-card);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-shadow: var(--shadow-lift);
}
.modal-card h2 { font-size: var(--fs-h3); margin-bottom: 0.5rem; }
.modal-card .sub { color: var(--muted); font-size: var(--fs-caption); margin-bottom: 1.5rem; }
.modal-close {
  float: right;
  margin: -0.25rem -0.25rem 0 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none; background: transparent; color: var(--muted);
  border-radius: var(--r-ctrl); cursor: pointer;
}
.modal-close:hover { background: var(--surface); color: var(--ink); }
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 700; font-size: var(--fs-caption); margin-bottom: 0.375rem; }
.form-row input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--surface);
  border: none;
  box-shadow: inset 0 0 0 1.5px var(--ring);
  border-radius: var(--r-ctrl);
}
.form-row input:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.modal-card .btn-primary { width: 100%; margin-top: 0.5rem; }

/* ---------- Движение: один оркестрованный момент (fade-up reveal) ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  animation: fade-up 0.55s var(--ease) both;
  animation-timeline: view();
  animation-range: entry 0% cover 26%;
}
.reveal-load { animation: fade-up 0.6s var(--ease) both; }
.steps .step { animation-delay: calc(var(--i, 0) * 70ms); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-load, .steps .step,
  .btn, .step, .translation .to { animation: none !important; transition: none !important; }
  .step:hover { transform: none; }
}

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .hero-layout { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .hero h1 { max-width: 100%; }
}
@media (max-width: 720px) {
  .rail-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rail {
    position: static;
    writing-mode: horizontal-tb;
    transform: none;
    flex-direction: row;
    margin-bottom: 1.5rem;
  }
  .rail::after { display: none; }
  .steps { grid-template-columns: minmax(0, 1fr); }
}
