/* ============================================================
   «кот растёт» — предложка
   Общие стили. Все значения взяты из макета в Фигме.
   ============================================================ */

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope-var.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --c-white:      #FFFFFF;
  --c-black:      #2C3036;
  --c-red:        #FF4E4E;

  --c-text-2:     rgba(0, 0, 0, 0.60);   /* secondary text */
  --c-text-3:     rgba(0, 0, 0, 0.30);   /* tetriary text  */
  --c-divider:    rgba(0, 0, 0, 0.10);

  --c-vk:         #0077FF;
  --c-gray:       #F5F5F5;

  --r-control:    14px;
  --r-button:     12px;
  --r-card:       20px;
  --r-modal:      24px;
  --r-thumb:      16px;

  --gutter:       20px;
  --content:      1140px;
  --form:         752px;
}

/* ─── База ───────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--c-white);
  color: var(--c-black);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: normal;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }

img, svg { display: block; }

/* скрытая вкладка должна быть действительно скрыта:
   у .inputs есть display:flex, и он перебивает атрибут hidden */
[hidden] { display: none !important; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ─── Каркас ─────────────────────────────────────────────── */

.page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter);
}

.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
}

/* ─── Верхняя навигация ──────────────────────────────────── */

/* Узкий экран: строка с логотипом и кнопкой меню.
   Широкий: ссылки в одну строку по центру, без логотипа и кнопки. */

.site-head {
  flex-shrink: 0;
  margin: 0 calc(var(--gutter) * -1);   /* на всю ширину, поля задаём внутри */
  padding: 0 var(--gutter);
}

.site-head__bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}

.site-head__logo { display: block; line-height: 0; }
.site-head__logo img { width: 56px; height: 56px; }

.burger {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-right: -10px;   /* зона нажатия больше значка */
  padding: 0; border: 0; background: none;
  color: var(--c-black); cursor: pointer;
}
.burger svg { width: 24px; height: 24px; }

.site-nav {
  display: none;
  font-size: 16px;
  line-height: 1.375;
}

.site-nav__link {
  color: var(--c-black);
  font-weight: 600;
  text-decoration: none;
}

.site-nav__dot { display: none; }

@media (hover: hover) {
  .site-nav__link:hover { color: var(--c-black); text-decoration: underline;
                          text-underline-offset: 3px; }
}

/* Меню раскрыто: список занимает экран вместо содержимого страницы */
body.nav-open .site-head { flex: 1 0 auto; }          /* подвал остаётся внизу */
body.nav-open .site-nav {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 15px;
  padding: 24px 0 0;
}
body.nav-open .main { display: none; }
body.nav-open .site-nav__link--home { display: none; }  /* туда ведёт логотип */

/* Под шапкой содержимому нужен меньший отступ, чем без неё */
.site-head + .main .layout { padding-top: 16px; }

/* ============================================================
   ГЛАВНАЯ
   ============================================================ */

.hero { text-align: center; padding-top: 70px; }

.hero__logo { width: 96px; height: 96px; margin: 0 auto 16px; }

.hero__title { font-size: 32px; font-weight: 800; }

.hero__subtitle {
  margin-top: 16px;
  font-size: 14px;
  color: var(--c-text-2);
  max-width: 34ch;
  margin-left: auto;
  margin-right: auto;
}

.socials { margin-top: 16px; display: flex; justify-content: center; gap: 12px; }

.socials__link {
  display: grid; place-items: center;
  width: 48px; height: 48px;          /* зона нажатия больше иконки */
  border-radius: 12px;
  transition: transform .15s ease;
}
.socials__link img { width: 40px; height: 40px; }
@media (hover: hover) { .socials__link:hover { transform: translateY(-2px); } }

.cards { margin-top: 40px; display: grid; grid-template-columns: 1fr; gap: 8px; }

.card {
  display: block; height: 100%;
  padding: 20px;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-card);
  text-decoration: none;
  /* длительность и кривая как у Smart Animate в Фигме:
     ease-out, 300 мс — переход мягкий, без рывка */
  transition: background-color .3s cubic-bezier(.22, .61, .36, 1);
}
/* в макете ховер — только смена фона на серый, без тени и сдвига */
@media (hover: hover) {
  .card:hover { background: var(--c-gray); }
}
.card:active { background: var(--c-gray); }

/* две иконки лежат стопкой: цветная проявляется на ховере.
   Обе загружаются сразу, поэтому подмена происходит без мигания. */
.card__icon {
  position: relative;
  display: block;
  width: 40px; height: 40px;
}
.card__icon img {
  position: absolute; inset: 0;
  width: 40px; height: 40px;
  transition: opacity .3s cubic-bezier(.22, .61, .36, 1);
}
.card__icon-on { opacity: 0; }

@media (hover: hover) {
  .card:hover .card__icon-off { opacity: 0; }
  .card:hover .card__icon-on  { opacity: 1; }
}
.card:active .card__icon-off { opacity: 0; }
.card:active .card__icon-on  { opacity: 1; }
.card__title { margin-top: 16px; font-size: 20px; font-weight: 700; }
.card__text  { margin-top: 8px; font-size: 14px; color: var(--c-text-2); }

.footer {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 8px 16px;
  padding: 40px 0 32px;
  font-size: 14px;
  color: var(--c-text-2);
}
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer__dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

/* ============================================================
   СТРАНИЦА ФОРМЫ
   ============================================================ */

.layout {
  display: flex; flex-direction: column; gap: 24px;
  padding-top: 63px; padding-bottom: 64px;
}

.top { display: flex; flex-direction: column; gap: 12px; }
.top__title { font-size: 28px; font-weight: 700; }
.top__text  { font-size: 16px; color: var(--c-text-2); }
.top__text p + p { margin-top: 4px; }

/* ─── Вкладки ────────────────────────────────────────────── */

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.tab {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-button);
  background: var(--c-white);
  color: var(--c-black);
  font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab[aria-selected="true"] {
  background: var(--c-black);
  border-color: var(--c-black);
  color: var(--c-white);
}
@media (hover: hover) {
  .tab:not([aria-selected="true"]):hover { border-color: rgba(0, 0, 0, .28); }
}

/* ─── Поля ───────────────────────────────────────────────── */

.inputs {
  display: flex; flex-direction: column; gap: 24px;
  width: 100%; max-width: var(--form);
}

.field { display: flex; flex-direction: column; gap: 8px; }

.field__label { font-size: 18px; font-weight: 600; }
.field__label .req { color: inherit; }

.field__desc { font-size: 16px; color: var(--c-text-2); }

.control {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-control);
  background: var(--c-white);
  color: var(--c-black);
  font: inherit;
  font-size: 16px;          /* меньше 16 нельзя: iOS зумит страницу */
  transition: border-color .15s ease;
}
.control::placeholder { color: var(--c-text-3); }
textarea.control { height: 130px; resize: vertical; display: block; }

@media (hover: hover) { .control:hover { border-color: rgba(0, 0, 0, .28); } }
.control:focus { border-color: var(--c-black); outline: none; }

.field__error { font-size: 14px; color: var(--c-red); }
.field.is-error .control,
.field.is-error .dropzone { border-color: var(--c-red); }

.field.is-disabled .field__label,
.field.is-disabled .field__desc { opacity: .5; }
.control:disabled { background: rgba(0, 0, 0, .03); color: var(--c-text-3); cursor: not-allowed; }

/* ─── Загрузка фотографий ────────────────────────────────── */

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  min-height: 130px;
  padding: 16px;
  border: 1px dashed var(--c-divider);
  border-radius: var(--r-control);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover,
.dropzone.is-over { border-color: var(--c-black); background: rgba(0, 0, 0, .02); }

.dropzone__icon { width: 24px; height: 24px; color: var(--c-black); }
.dropzone__main { font-size: 14px; color: var(--c-text-2); }
.dropzone__hint { font-size: 14px; color: var(--c-text-3); }

.dropzone__text { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.dropzone__count { display: none; font-size: 14px; color: var(--c-text-2); }

.dropzone.has-files { gap: 24px; cursor: default; }
.dropzone.has-files .dropzone__icon,
.dropzone.has-files .dropzone__main { display: none; }
.dropzone.has-files .dropzone__count { display: block; }

.thumbs { display: none; flex-wrap: wrap; gap: 16px; justify-content: center; }
.dropzone.has-files .thumbs { display: flex; }

.thumb {
  position: relative;
  padding: 8px;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-thumb);
}
.thumb img { width: 80px; height: 80px; border-radius: 12px; object-fit: cover; }

.thumb__remove {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;          /* зона нажатия, сама иконка 16 */
  display: grid; place-items: center;
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--c-black);
}
.thumb__remove svg { width: 16px; height: 16px; }

.thumb--add {
  width: 98px; height: 98px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-thumb);
  background: var(--c-white);
  font: inherit; font-size: 12px; color: var(--c-black); text-align: center;
  cursor: pointer;
  transition: border-color .15s ease;
}
.thumb--add:hover { border-color: var(--c-black); }
.thumb--add svg { width: 24px; height: 24px; }

/* ─── Подпись и тоггл «анонимно» ─────────────────────────── */

.author { display: flex; flex-direction: column; gap: 16px; }

.anon { display: flex; align-items: center; gap: 8px; }
.anon__label { font-size: 16px; font-weight: 600; cursor: pointer; }

.toggle {
  position: relative;
  flex-shrink: 0;
  width: 36px; height: 21px;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.toggle::before {                      /* дорожка */
  content: ''; position: absolute; left: 0; top: 4.5px;
  width: 36px; height: 12px; border-radius: 10.5px;
  background: #D9D9D9;
  transition: background .15s ease;
}
.toggle::after {                       /* кружок */
  content: ''; position: absolute; left: 0; top: 0;
  width: 21px; height: 21px; border-radius: 50%;
  background: #B5B5B5;
  transition: transform .15s ease, background .15s ease;
}
.toggle[aria-pressed="true"]::before { background: rgba(44, 48, 54, .35); }
.toggle[aria-pressed="true"]::after  { background: var(--c-black); transform: translateX(15px); }

/* ─── Низ формы ──────────────────────────────────────────── */

.bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 20px;
  border: 0; border-radius: var(--r-button);
  background: var(--c-black);
  color: var(--c-white);
  font: inherit; font-size: 16px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .15s ease, transform .1s ease;
}
@media (hover: hover) { .button:hover { opacity: .85; } }
.button:active { transform: scale(.98); }
.button:disabled { opacity: .4; cursor: not-allowed; }

.button__spinner { display: none; width: 16px; height: 16px; }
.button.is-loading .button__spinner { display: block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.consent { display: flex; align-items: flex-start; gap: 8px; }

.consent__box {
  flex-shrink: 0;
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; margin: 3px 0 0;
  border: 1px solid rgba(0, 0, 0, .25);
  border-radius: 4px;
  background: var(--c-white);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.consent__box:checked {
  background: var(--c-black) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.8 8.5 9.5 3.8' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-color: var(--c-black);
}
.consent.is-error .consent__box { border-color: var(--c-red); }

.consent__text { font-size: 14px; color: var(--c-text-2); cursor: pointer; }
.consent__text a { color: inherit; }

/* ============================================================
   МОДАЛКА
   ============================================================ */

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  padding: var(--gutter);
  background: rgba(44, 48, 54, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal.is-open { display: flex; }

.modal__card {
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 24px;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-modal);
  background: var(--c-white);
  animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } }

.modal__icon  { width: 40px; height: 40px; }

/* ─── Модалка с документом (условия, политика) ───────────── */

.modal--doc .modal__card {
  max-width: 896px;
  max-height: min(887px, calc(100svh - 40px));
  gap: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.doc-head h2 { font-size: 24px; font-weight: 700; }

.doc-close {
  flex-shrink: 0;
  width: 40px; height: 40px;          /* зона нажатия, сама иконка 24 */
  display: grid; place-items: center;
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--c-black);
  border-radius: 10px;
}
.doc-close:hover { background: var(--c-gray); }
.doc-close svg { width: 24px; height: 24px; }

.modal--doc .doc { max-width: none; }
.modal--doc .doc h1 { display: none; }        /* заголовок уже в шапке модалки */
.modal--doc .doc .layout { padding: 0; }
.modal--doc .doc hr:first-of-type { display: none; }
.modal__title { font-size: 20px; font-weight: 700; }
.modal__text  { font-size: 14px; }
.modal__text p + p { margin-top: 8px; }

/* ============================================================
   ТЕКСТОВАЯ СТРАНИЦА (условия, политика)
   ============================================================ */

.doc { max-width: 896px; display: flex; flex-direction: column; gap: 20px; }
.doc h1 { font-size: 28px; font-weight: 700; }
.doc h2 { font-size: 20px; font-weight: 700; }
.doc p.doc__date { font-size: 16px; color: var(--c-text-2); }

.doc__section { display: flex; flex-direction: column; gap: 12px; }
.doc__section p + p { margin-top: -4px; }   /* между абзацами 8, а не 12 */

.doc p, .doc li { font-size: 16px; color: var(--c-black); }
.doc ul { padding-left: 24px; list-style: disc; display: flex; flex-direction: column; gap: 4px; }
.doc strong { font-weight: 600; }
/* Скруглённые углы возможны только при раздельных границах:
   внешнюю рамку рисует сама таблица, ячейки — только внутренние линии. */
.doc table {
  margin-top: 16px; width: 100%;
  border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-control);
  overflow: hidden;
  font-size: 14px;
}
.doc th, .doc td {
  padding: 10px 12px; text-align: left; color: var(--c-text-2);
  border: 0;
  border-bottom: 1px solid var(--c-divider);
  border-right: 1px solid var(--c-divider);
}
.doc th:last-child, .doc td:last-child { border-right: 0; }
.doc tr:last-child td { border-bottom: 0; }
.doc th { color: var(--c-black); font-weight: 600; }
.doc hr { margin: 32px 0; border: 0; border-top: 1px solid var(--c-divider); }

/* ============================================================
   ДЕСКТОП
   ============================================================ */

@media (min-width: 768px) {

  .page { padding: 0 40px; }

  /* навигация: ссылки одной строкой по центру, логотип и кнопка не нужны */
  .site-head { margin: 0; padding: 64px 0 0; }
  .site-head__bar { display: none; }

  .site-nav {
    display: flex; align-items: center; flex-wrap: wrap;
    justify-content: center; gap: 16px;
    font-size: 14px; line-height: 1.357;
  }
  .site-nav__link { color: var(--c-text-2); font-weight: 400; }
  .site-nav__link.is-here { color: var(--c-black); font-weight: 600; }
  .site-nav__dot {
    display: block; width: 3px; height: 3px;
    border-radius: 50%; background: var(--c-text-3);
  }
  /* на широком экране сетка начинается ниже навигации */
  .site-head + .main .layout { padding-top: 72px; }

  /* главная */
  .hero { padding-top: 60px; }
  .hero__logo { width: 112px; height: 112px; margin-bottom: 24px; }
  .hero__title { font-size: 48px; }
  .hero__subtitle { margin-top: 20px; font-size: 16px; max-width: none; }
  .socials { margin-top: 20px; }
  .cards { margin-top: 80px; grid-template-columns: repeat(4, 1fr); gap: 24px; }
  .footer { padding: 64px 0 40px; }

  /* форма */
  .layout { padding-top: 80px; padding-bottom: 80px; }
  .top__title { font-size: 36px; }
  .tab { font-size: 16px; }
  .field__label { font-size: 20px; }

  /* документы */
  .doc h1 { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
