/* Компоненты по разделу 07 брендбука. Радиус 0, без теней, без градиентов на кнопках и тексте. */

/* ===== Кнопки ===== */
.btn {
  height: var(--btn-h);
  padding: 0 var(--s-6);
  border: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-display); font-variation-settings: 'wdth' 100; font-weight: 700;
  font-size: var(--fs-label); letter-spacing: var(--tracking-label); text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--primary:hover { background: #2A2A2A; }
.btn--secondary { background: var(--paper); color: var(--ink); }
.btn--secondary:hover { background: var(--ground); }
.btn:disabled, .btn[aria-disabled='true'] {
  background: var(--ground); color: #767676; border-color: var(--hairline); cursor: not-allowed; transform: none;
}
.btn--block { width: 100%; }
.btn--sm { height: var(--tap); padding: 0 var(--s-4); }
.btn svg { flex-shrink: 0; }
.btn-row { display: flex; gap: var(--s-3); }
.btn-row > .btn { flex: 1; padding: 0 var(--s-2); }

/* Текстовая кнопка-ссылка */
.link-btn {
  background: none; border: 0; padding: var(--s-2) 0; min-height: var(--tap);
  font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* Кнопка-иконка 44×44 */
.iconbtn {
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  border: var(--line); background: var(--paper); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color var(--dur) var(--ease);
}
.iconbtn:hover { background: var(--ground); }
.iconbtn:active { transform: translateY(1px); }
.iconbtn--bare { border-color: transparent; background: transparent; }
.iconbtn--bare:hover { background: var(--ground); }

/* ===== Метка (на фото) и чип ===== */
.tag {
  display: inline-block; background: var(--ink); color: var(--paper);
  padding: 7px 10px;
  font-family: var(--font-display); font-variation-settings: 'wdth' 60; font-weight: 700;
  font-size: 13px; letter-spacing: var(--tracking-label); text-transform: uppercase; line-height: 1.1;
}
.tag--light { background: var(--paper); color: var(--ink); border: var(--line); }
.chip {
  display: inline-flex; align-items: center; border: var(--line);
  padding: 4px 9px; font-size: 13px; font-weight: 700; line-height: 1.3; background: transparent;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Поля ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 700; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); }
.field__count { font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.field__count--over { color: var(--danger); }
.input, .textarea, .select {
  width: 100%; border: var(--line); background: var(--paper);
  font-size: 16px; /* 16 px — iOS не зумит поле */
  appearance: none; -webkit-appearance: none;
}
.input, .select { height: var(--input-h); padding: 0 14px; }
.textarea { min-height: 112px; padding: 13px 14px; line-height: var(--lh-body); resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-width: 2.5px; padding-left: 13px; padding-right: 13px; }
.textarea:focus { padding-top: 12px; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 22 22' fill='none' stroke='%23111' stroke-width='1.8'%3E%3Cpath d='M4 8 L11 15 L18 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
.field__hint { font-size: 13px; color: var(--muted); }
.field--error .input, .field--error .textarea, .field--error .select { border-color: var(--danger); }
.field--error .field__hint { color: var(--danger); }

/* Сегменты — выбор одного из нескольких (пол, кого ищу). Строже нет: те же рамки 1.5 px. */
.segmented { display: flex; border: 0; padding: 0; margin: 0; min-width: 0; }
.segmented legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 700; }
.segmented__opts { display: flex; width: 100%; }
.segmented__opt { flex: 1; position: relative; }
.segmented__opt + .segmented__opt { margin-left: -1.5px; }
.segmented__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented__opt span {
  height: var(--input-h); display: flex; align-items: center; justify-content: center;
  border: var(--line); background: var(--paper); font-weight: 600; padding: 0 var(--s-2); text-align: center;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented__opt input:checked + span { background: var(--ink); color: var(--paper); font-weight: 700; }
.segmented__opt input:focus-visible + span { outline: var(--focus); outline-offset: 2px; position: relative; z-index: 1; }

/* ===== Чекбокс ===== */
.check { display: flex; gap: var(--s-3); align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 22px; height: 22px; margin: 0; border: var(--line); background: var(--paper);
  display: grid; place-content: center; cursor: pointer;
}
.check input:checked { background: var(--ink); }
.check input:checked::after {
  content: ''; width: 10px; height: 6px;
  border-left: 2px solid var(--paper); border-bottom: 2px solid var(--paper);
  transform: rotate(-45deg) translate(1px, -1px);
}
.check--error input { border-color: var(--danger); }

/* Переключатель «вкл/выкл» сделан как чекбокс-строка (строже свитча) */
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-4); background: var(--paper);
}

/* ===== Фото, полоски, заглушка ===== */
.photo {
  position: relative; overflow: hidden; background: var(--ground);
  aspect-ratio: 4 / 5; width: 100%;
  user-select: none; -webkit-user-select: none; touch-action: pan-y;
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo__bars { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 2; }
.photo__tag { position: absolute; left: 12px; bottom: 12px; z-index: 2; max-width: calc(100% - 24px); }
.photo__more { position: absolute; right: 12px; top: 24px; z-index: 3; }
/* Зоны листания: левая и правая трети */
.photo__prev, .photo__next {
  position: absolute; top: 0; bottom: 0; width: 33.4%; z-index: 1;
  background: transparent; border: 0; padding: 0; cursor: pointer;
}
.photo__prev { left: 0; } .photo__next { right: 0; }
.photo__prev:focus-visible, .photo__next:focus-visible { outline-offset: -4px; }

.bars { display: flex; gap: 4px; }
.bars i { flex: 1; height: 3px; background: rgba(17, 17, 17, .2); }
.bars i.on { background: var(--ink); }

/* Заглушка: градиент выбирается по id анкеты */
.stub { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.g-0 { background: var(--g-banana-pink); }
.g-1 { background: var(--g-peach-coral); }
.g-2 { background: var(--g-pink-lilac); }
.g-3 { background: var(--g-lilac-sky); }
.g-4 { background: var(--g-sky-mint); }
.g-5 { background: var(--g-mint-banana); }

/* ===== Карточка анкеты ===== */
.card { background: var(--paper); }
.card__body { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.card__bio { overflow-wrap: anywhere; white-space: pre-line; }

/* Метки свайпа на фото */
.swipe-stamp {
  position: absolute; top: 48px; z-index: 4; pointer-events: none; opacity: 0;
  padding: 10px 14px;
  font-family: var(--font-display); font-variation-settings: 'wdth' 60; font-weight: 800;
  font-size: 22px; letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.swipe-stamp--like { left: 16px; background: var(--ink); color: var(--paper); }
.swipe-stamp--skip { right: 16px; background: var(--paper); color: var(--ink); border: var(--line); }

/* ===== Нижняя навигация ===== */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: var(--app-max-w); margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper); border-top: var(--line-thin);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.navbar--static { position: static; }
.navbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none; font-size: 12px; font-weight: 500; color: var(--muted);
}
.navbar a[aria-current='page'] { color: var(--ink); font-weight: 700; }

/* ===== Тост ===== */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 90; pointer-events: none;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s-3));
  max-width: var(--app-max-w); margin: 0 auto; padding: 0 var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.toast {
  pointer-events: auto; background: var(--ink); color: var(--paper);
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
  font-size: 14px; animation: toast-in var(--dur) var(--ease);
}
.toast button { background: none; border: 0; color: var(--paper); font-weight: 700; padding: 4px 0; cursor: pointer; text-decoration: underline; }
.toast button:focus-visible { outline-color: var(--paper); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ===== Нижний лист (меню «⋯», жалоба) и модальное окно ===== */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(17, 17, 17, .4);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in var(--dur) var(--ease);
}
.sheet {
  width: 100%; max-width: var(--app-max-w); background: var(--paper);
  padding: var(--s-6) var(--s-4) calc(var(--s-6) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--s-4);
  max-height: 90dvh; overflow-y: auto;
  animation: sheet-in var(--dur) var(--ease);
}
.sheet__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); }
.menu-list { display: flex; flex-direction: column; border-top: var(--line-thin); }
.menu-item {
  display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: 0 var(--s-1);
  background: none; border: 0; border-bottom: var(--line-thin); text-align: left; font-weight: 600; cursor: pointer;
}
.menu-item:hover { background: var(--ground); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(24px); } }

/* ===== Состояния: скелетон, пусто, ошибка ===== */
.skeleton { background: var(--hairline); animation: pulse 1.4s var(--ease) infinite alternate; }
.skeleton--line { height: 14px; }
.skeleton--name { height: 36px; width: 60%; }
@keyframes pulse { from { opacity: .45; } to { opacity: .9; } }

.empty {
  padding: var(--s-8) var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start;
}
.empty--accent { background: var(--g-sky-mint); }
.empty--plain { background: var(--paper); }
.notice { background: var(--paper); padding: var(--s-4); border-left: 3px solid var(--ink); }
.notice--error { border-left-color: var(--danger); }

/* ===== Списки (мэтчи), секции, админка ===== */
.section { background: var(--paper); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-4); }
.list { background: var(--paper); display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: var(--line-thin); }
.list-item:first-child { border-top: 0; }
.list-item__photo { width: 64px; height: 80px; flex-shrink: 0; overflow: hidden; background: var(--ground); }
.list-item__photo img { width: 100%; height: 100%; object-fit: cover; }
.list-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item__title {
  font-family: var(--font-display); font-variation-settings: 'wdth' 70; font-weight: 800;
  font-size: 20px; line-height: 1; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--hairline); }
.stat { background: var(--paper); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); }
.stat__num { font-family: var(--font-display); font-variation-settings: 'wdth' 40; font-weight: 900; font-size: 40px; line-height: .9; font-variant-numeric: tabular-nums; }

/* Загрузчик фото: три слота */
.uploader { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.slot { position: relative; aspect-ratio: 4 / 5; background: var(--ground); border: var(--line); overflow: hidden; }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot--empty { border-style: dashed; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot--empty:hover { background: var(--paper); }
.slot__main { position: absolute; left: 0; top: 0; }
.slot__actions { position: absolute; right: 0; bottom: 0; display: flex; }
.slot__actions .iconbtn { width: 36px; height: 36px; border-width: 0; border-left: var(--line); border-top: var(--line); }
.slot input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Счётчик анкет в шапке */
.counter { font-family: var(--font-display); font-variation-settings: 'wdth' 40; font-weight: 700; font-size: var(--fs-label); letter-spacing: var(--tracking-label); font-variant-numeric: tabular-nums; }

/* ===== Лента: колода и свайп ===== */
.deck { position: relative; }
.deck .card { position: relative; will-change: transform; touch-action: pan-y; }
.deck .card.is-leaving { transition: transform 220ms var(--ease), opacity 220ms var(--ease); }
.deck .card.is-returning { transition: transform var(--dur) var(--ease); }
.deck .card.is-entering { animation: card-in var(--dur) var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
.feed-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s-3)); z-index: 5; }
.header-right { display: flex; align-items: center; gap: var(--s-2); }

/* ===== Экран мэтча ===== */
.match {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  display: flex; justify-content: center;
  background: var(--g-pink-lilac); background-size: 200% 200%;
  animation: fade-in var(--dur) var(--ease), match-float 24s ease-in-out infinite alternate;
}
@keyframes match-float { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
.match__inner {
  width: 100%; max-width: var(--app-max-w); min-height: 100%;
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: calc(var(--s-3) + env(safe-area-inset-top)) var(--s-4) calc(var(--s-6) + env(safe-area-inset-bottom));
}
.match__head { display: flex; justify-content: space-between; align-items: center; height: 52px; }
.match__word { animation: rise 360ms var(--ease) 80ms both; }
@keyframes rise { from { transform: translateY(32px); opacity: 0; } }
.match__photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.match__photo {
  aspect-ratio: 4 / 5; background: rgba(255, 255, 255, .55); border: var(--line); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.match__photo img { width: 100%; height: 100%; object-fit: cover; }
.match .link-btn { align-self: center; }

/* Причины жалобы — список радиокнопок в стиле чекбоксов */
.radio-list { display: flex; flex-direction: column; border: 0; padding: 0; margin: 0; }
.radio-list label { display: flex; align-items: center; gap: var(--s-3); min-height: 48px; border-bottom: var(--line-thin); cursor: pointer; font-weight: 600; }
.radio-list input {
  appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; flex-shrink: 0;
  border: var(--line); background: var(--paper); display: grid; place-content: center; cursor: pointer;
}
.radio-list input:checked::after { content: ''; width: 10px; height: 10px; background: var(--ink); }
/* В ленте фото не выше ~половины экрана, чтобы кнопки помещались на маленьких телефонах */
.deck .photo { max-height: 56dvh; }

/* Чип с кнопкой удаления (редактор интересов) */
.chip--removable { padding-right: 0; gap: 2px; }
.chip--removable button {
  width: 28px; height: 26px; margin: -4px 0; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.chip--removable button:hover { background: var(--ground); }
.add-row { display: flex; gap: var(--s-2); }
.add-row .input { flex: 1; min-width: 0; }
.add-row .btn { height: var(--input-h); }
.two-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-3); }
.slot__badge { position: absolute; left: 0; top: 0; padding: 4px 6px; font-size: 11px; }
.slot.is-busy::after { content: ''; position: absolute; inset: 0; background: var(--hairline); animation: pulse 1.2s var(--ease) infinite alternate; }
.slot--empty:focus-within { outline: var(--focus); outline-offset: 2px; }
.list-item__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ссылки-строки в настройках */
.menu-list--plain { border-top: 0; background: var(--paper); }
.menu-item--link { text-decoration: none; color: var(--ink); justify-content: space-between; padding: 0 var(--s-4); }
.danger-zone { background: var(--paper); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }

/* Админка */
.report { background: var(--paper); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.report__head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.report__comment { border-left: 3px solid var(--hairline); padding-left: var(--s-3); overflow-wrap: anywhere; white-space: pre-line; }
.report .list-item { padding: 0; border: 0; }
.filter { margin-bottom: 0; }
/* Панель кнопок прилипает к навигации и не даёт тексту просвечивать */
.feed-actions { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--ground); padding: var(--s-2) 0 var(--s-3); margin: calc(var(--s-2) * -1) 0 calc(var(--s-3) * -1); }

/* Метки на фото стопкой: цель, курс */
.photo__tags { position: absolute; left: 12px; bottom: 12px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: calc(100% - 24px); }
/* Множественный выбор — отдельные кнопки с зазором, чтобы выбранные соседи не сливались */
.segmented--multi .segmented__opts { gap: var(--s-2); }
.segmented--multi .segmented__opt + .segmented__opt { margin-left: 0; }

/* ===== Карточка: имя + «Подробнее» в одну строку ===== */
.card__body--row { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--s-3); }
.card__body--row .t-name { min-width: 0; overflow-wrap: anywhere; }
.card__body--row .btn { flex-shrink: 0; }

/* Подсказки в редакторе тегов */
.chip--suggest { cursor: pointer; border-color: var(--hairline); color: var(--muted); background: var(--paper); font-family: inherit; }
.chip--suggest:hover { border-color: var(--ink); color: var(--ink); }

/* Строка списка, которая открывает «Подробнее» */
.list-item__open { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-3); padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }

/* ===== Экран «Подробнее» ===== */
.details {
  position: fixed; inset: 0; z-index: 65; overflow-y: auto; background: var(--ground);
  display: flex; justify-content: center; animation: fade-in var(--dur) var(--ease);
}
.details__inner { width: 100%; max-width: var(--app-max-w); min-height: 100%; display: flex; flex-direction: column; }
.details__head {
  position: sticky; top: 0; z-index: 3; background: var(--paper);
  height: calc(var(--header-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--s-2) 0;
  display: flex; align-items: center; justify-content: space-between;
}
.details__spacer { width: var(--tap); }
.details__body { flex: 1; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.details__block { gap: var(--s-3); }
.details__actions {
  position: sticky; bottom: 0; background: var(--ground);
  padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom));
}
.project-block { border: 0; border-top: var(--line-thin); border-bottom: var(--line-thin); margin: 0; padding: var(--s-4) 0; min-width: 0; }
.project-block legend { padding: 0 var(--s-2) 0 0; }
.project-block[hidden] { display: none; }
