/* ═══════════════════════════════════════
   Picturium — Дизайн галереи v3
   Тёплый, иммерсивный, вдохновлён Unsplash
   ========================================== */

:root {
  --primary: #c44536;
  --primary-light: rgba(196, 69, 54, 0.07);
  --primary-hover: #a83a2d;
  --accent: #d4a574;
  --bg: #faf8f6;
  --bg-card: #fff;
  --bg-subtle: #f0ebe6;
  --bg-hover: #f5f1ed;
  --text: #2c2520;
  --text-2: #5d5347;
  /* AA-коррекция (WCAG 1.4.3, 02.09.2026, M-35): было #8b7e74 — 3.9:1 на #fff, ниже порога 4.5:1
     для мелкого текста (даты, авторы, подписи). #776a5f даёт ≈5.2:1 на #fff и ≈4.9:1 на --bg.
     Сознательно отличается от мобильной палитры label — не синхронизировать. --text-4 не
     трогаем: это плейсхолдер/декор, к нему требование AA не применяется — но для
     СОДЕРЖАТЕЛЬНЫХ подписей на карточках берите --text-3, а не --text-4. */
  --text-3: #776a5f;
  --text-4: #a89b8e;
  --border: #e5ddd6;
  --border-light: #f0ece7;
  --shadow-sm: 0 1px 2px rgba(44, 37, 32, 0.05);
  --shadow-md: 0 4px 16px rgba(44, 37, 32, 0.07);
  --shadow-lg: 0 8px 32px rgba(44, 37, 32, 0.1);
  --shadow-card:
    0 1px 3px rgba(44, 37, 32, 0.04), 0 0 0 1px rgba(44, 37, 32, 0.03);
  --shadow-card-hover:
    0 8px 24px rgba(44, 37, 32, 0.1), 0 0 0 1px rgba(44, 37, 32, 0.04);
  --font: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ═══════════════════════════════════════
   Шапка
   ========================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(250, 248, 246, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(229, 221, 214, 0.4);
}

.header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.header__logo:hover {
  opacity: 0.8;
}

.header__logo-img {
  height: 32px;
  width: auto;
}

.header__logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
}

.header__spacer {
  flex: 1;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header__link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-3);
  padding: 8px 16px;
  border-radius: 100px;
  /* Только цвета, НЕ all (24.10.2026): подгонка меню (_Header.cshtml) меняет поля пунктов и сразу их мерит — с
     «all» поля плыли 0,2 с, замер видел старые, и на 1280 по-французски последний пункт оставался обрезанным. */
  transition:
    color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
  /* Без переноса (24.10.2026): японские и корейские подписи иначе ломались по буквам в столбик —
     CJK разрешает перенос между любыми знаками. Тесноту теперь решает «Ещё» (header.css). */
  white-space: nowrap;
}

.header__link:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.header__link.is-active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

/* ═══════════════════════════════════════
   Обёртка страницы
   ========================================== */

.page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .page-wrap {
    padding: 0 28px;
  }
}

/* ═══════════════════════════════════════
   Тулбар — сортировка + фильтры
   ========================================== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 16px;
}

.toolbar__sort {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar__sort::-webkit-scrollbar {
  display: none;
}

.toolbar__spacer {
  flex: 1;
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toolbar__fbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.toolbar__fbtn:hover {
  border-color: var(--text-4);
  color: var(--text);
  background: var(--bg-hover);
}

.toolbar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 100px;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
}

/* ═══════════════════════════════════════
   Чип
   ========================================== */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.2s var(--ease);
  cursor: pointer;
  text-decoration: none;
}

.chip:hover {
  border-color: var(--text-4);
  color: var(--text);
  background: var(--bg-hover);
}

.chip--on {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.chip--on:hover {
  background: var(--text-2);
  border-color: var(--text-2);
  color: #fff;
}

.chip--sm {
  padding: 6px 13px;
  font-size: 0.8rem;
}

.chip--reset {
  color: var(--primary);
  border-color: rgba(196, 69, 54, 0.25);
  background: rgba(196, 69, 54, 0.04);
}

.chip--reset:hover {
  background: rgba(196, 69, 54, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

/* ═══════════════════════════════════════
   Панель фильтров
   ========================================== */

/* ЕДИНСТВЕННОЕ определение .fpanel (02.09.2026, M-43): дубль из gallery-additions.css удалён —
   он грузился позже и молча перекрывал отсюда easing и потолок max-height (его же комментарий
   признавал себя заплаткой «REPLACE those rules»). Свёрнутая панель уходит из Tab-обхода и
   a11y-дерева через visibility:hidden: max-height:0 + overflow:hidden прячут её только
   визуально, и Tab ходил по невидимым чипам/селектам. Трюк с задержкой: при закрытии
   visibility переключается ЧЕРЕЗ .4s — когда схлопывание уже отыграло; при открытии
   (.is-open → transition-delay:0s) — мгновенно, иначе раскрытие анимировалось бы «в невидимости».
   Потолок 1200px — значение, которое реально действовало до слияния (700px отсюда перекрывал
   дубль): при overflow:hidden заниженный потолок молча обрезал бы низ панели, поэтому берём
   уже обкатанный запас, а не «родные» 700. */
.fpanel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition:
    max-height 0.4s var(--ease),
    opacity 0.3s ease,
    visibility 0s 0.4s;
}

.fpanel.is-open {
  max-height: 1200px;
  opacity: 1;
  visibility: visible;
  /* ИСПРАВЛЕНО 02.09.2026 (жалоба Дэвида: «ввожу имя автора, а список где-то под, не виден»).
     overflow:hidden выше нужен только для эффекта раскрытия, но он же ОБРЕЗАЛ выпадашку
     поиск-пикера автора/книги (.fpicker__results — position:absolute под полем): в открытой
     панели список упирался в её нижнюю границу, и человеку был виден лишь верхний пункт.
     У открытой панели разрешаем вылет за границы. overflow — дискретное свойство:
     allow-discrete откладывает переключение до конца раскрытия (Chrome 117+, Safari 17.4+),
     в старых браузерах оно применяется сразу — чуть меняется анимация, но список цел. */
  overflow: visible;
  transition:
    max-height 0.4s var(--ease),
    opacity 0.3s ease,
    visibility 0s,
    overflow 0.4s;
  transition-behavior: allow-discrete;
  margin-bottom: 4px;
}

.fpanel__body {
  display: grid;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .fpanel__body {
    grid-template-columns: 1fr 1fr;
    gap: 16px 28px;
    padding: 20px 24px;
  }
}

.fgroup--span {
  grid-column: 1 / -1;
}

.fgroup__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-4);
  margin-bottom: 8px;
}

.fgroup__row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.fgroup__row::-webkit-scrollbar {
  display: none;
}
.fgroup__row--wrap {
  flex-wrap: wrap;
}

.fselect {
  width: 100%;
  padding: 10px 36px 10px 14px;
  font-family: var(--font);
  font-size: 0.86rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B7E74' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.fselect:hover {
  border-color: var(--text-4);
}
.fselect:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ═══════════════════════════════════════
   Masonry-сетка — Pinterest-центрирование
   Ширина карточки фиксирована; Masonry + fitWidth выбирает
   кол-во колонок автоматически.

   ОТКАЗОУСТОЙЧИВОСТЬ (аудит 17.08.2026): раньше карточки рождались
   с opacity:0 и «проявлялись» только после инициализации Masonry —
   при сбое JS/CDN или отключённом JS главная и /Library выглядели
   ПУСТЫМИ. Паттерн инвертирован: по умолчанию карточки ВИДИМЫ, а
   раскладка — обычные CSS-колонки. Класс .js-anim вешает site.js
   синхронно (до первой отрисовки) и ТОЛЬКО когда Masonry реально
   загружен: тогда колонки снимаются (Masonry позиционирует сам),
   а карточки уходят под staggered-анимацию. Любой сбой = карточки
   остаются видимыми в CSS-колонках.
   ========================================== */

.grid {
  margin: 0 auto; /* centered by fitWidth */
  padding-top: 4px;
}

/* Фолбэк-раскладка без JS/Masonry: многоколоночный поток */
.grid:not(.js-anim) {
  column-width: 220px;
  column-gap: 14px;
  width: 100%;
}

.grid:not(.js-anim) .grid__item {
  width: 100%; /* заполняем колонку, а не фиксированные 220px */
  break-inside: avoid;
}

.grid__sizer,
.grid__item {
  width: 220px;
}

/* Мельче на телефонах, чтобы помещались 2 колонки */
@media (max-width: 539px) {
  .grid__sizer,
  .grid__item {
    width: calc((100vw - 44px - 12px) / 2);
    /* 44px = page-wrap padding (16px × 2) + safety; 12px = gutter */
  }

  .grid:not(.js-anim) {
    column-width: auto;
    column-count: 2;
    column-gap: 12px;
  }

  .grid:not(.js-anim) .grid__item {
    width: 100%;
  }
}

.grid__item {
  margin-bottom: 14px;
}

/* Анимация появления — ТОЛЬКО при работающем JS (.js-anim ставит site.js) */
.grid.js-anim .grid__item {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.5s ease,
    transform 0.5s var(--ease);
}

.grid.js-anim .grid__item.is-visible {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════
   Card — artwork item
   ========================================== */

.card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  transition:
    box-shadow 0.35s var(--ease),
    transform 0.35s var(--ease);
  will-change: transform;
}

.card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
  }
  .card:hover .card__img {
    transform: scale(1.04);
  }
}

.card__visual {
  position: relative;
  overflow: hidden;
  line-height: 0;
  background: var(--bg-subtle);
}

.card__img {
  width: 100%;
  display: block;
  transition:
    opacity 0.6s ease,
    transform 0.6s var(--ease);
}

/* Проявление после загрузки — только при работающем JS: без .js-anim
   (JS не стартовал) картинка видна сразу, иначе галерея пустая */
.grid.js-anim .card__img:not(.is-loaded) {
  opacity: 0;
}

/* Бейдж лайков — правый верхний угол, всегда виден */
.card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 100px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
}

.card__badge svg {
  width: 13px;
  height: 13px;
  fill: #fff;
}

/* Нижняя полоска с автором */
.card__info {
  display: flex;
  align-items: center;
  padding: 9px 11px;
}

.card__author-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease);
}

.card__author-link:hover {
  background: var(--bg-subtle);
}

.card__av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-subtle);
}

.card__av--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.55rem;
  font-weight: 600;
}

.card__author {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ═══════════════════════════════════════
   Пагинация
   ========================================== */

.pager {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 36px 0 28px;
}

.pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: all 0.2s var(--ease);
  cursor: pointer;
}

.pager__btn:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg-hover);
}

.pager__btn.is-active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.pager__btn.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.pager__dots {
  display: inline-flex;
  align-items: center;
  color: var(--text-4);
  font-size: 0.87rem;
  padding: 0 6px;
}

/* ═══════════════════════════════════════
   Страница работы
   ========================================== */

.detail {
  padding: 24px 0 48px;
}

@media (min-width: 768px) {
  .detail {
    padding: 32px 0 64px;
  }
}

.detail__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 20px;
  transition: color 0.2s;
}
.detail__back:hover {
  color: var(--text);
}
.detail__back svg {
  width: 16px;
  height: 16px;
}

.detail__grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 768px) {
  .detail__grid {
    grid-template-columns: 1fr 360px;
    gap: 40px;
  }
}

@media (min-width: 1024px) {
  .detail__grid {
    grid-template-columns: 1fr 420px;
    gap: 48px;
  }
}

.detail__img-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-subtle);
  box-shadow: var(--shadow-md);
  line-height: 0;
  cursor: zoom-in;
}

.detail__img-wrap img {
  width: 100%;
  transition: opacity 0.5s ease;
}

.detail__side {
  padding: 4px 0;
}

@media (min-width: 768px) {
  .detail__side {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
  }
}

/* Карточка пользователя */
.detail__user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  transition: background 0.2s;
}

.detail__user:hover {
  background: var(--bg-hover);
}

.detail__user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.detail__user-avatar-ph {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail__user-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.detail__user-date {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Заголовок */
.detail__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 10px;
}

@media (min-width: 576px) {
  .detail__title {
    font-size: 1.7rem;
  }
}

.detail__desc {
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* Статистика */
.detail__stats {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.detail__stat {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.87rem;
  color: var(--text-2);
}

.detail__stat svg {
  width: 18px;
  height: 18px;
  color: var(--text-4);
}
.detail__stat strong {
  font-weight: 600;
  color: var(--text);
}

/* Метки секций */
.detail__section {
  margin-bottom: 22px;
}

.detail__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-4);
  margin-bottom: 8px;
}

/* Мини-карточка книги */
.book-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.book-card__cover {
  width: 38px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.book-card__title {
  font-weight: 600;
  font-size: 0.87rem;
  line-height: 1.3;
}
.book-card__author {
  font-size: 0.76rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Чипы материалов */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-tag {
  padding: 6px 14px;
  background: var(--bg-subtle);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
}

/* Комментарии */
.comments {
  margin-top: 32px;
}

.comments__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.cmt {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.cmt:last-child {
  border-bottom: none;
}

.cmt__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.cmt__avatar-ph {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cmt__body {
  flex: 1;
  min-width: 0;
}

.cmt__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.cmt__name {
  font-weight: 600;
  font-size: 0.84rem;
  transition: color 0.2s;
}
.cmt__name:hover {
  color: var(--primary);
}
.cmt__date {
  font-size: 0.72rem;
  color: var(--text-4);
}

.cmt__text {
  font-size: 0.87rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-top: 4px;
  word-wrap: break-word;
}

/* ═══════════════════════════════════════
   Profile
   ========================================== */

.profile {
  padding: 36px 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

@media (min-width: 768px) {
  .profile {
    flex-direction: row;
    text-align: left;
    gap: 32px;
    align-items: flex-start;
    padding: 44px 0 16px;
  }
}

.profile__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.profile__avatar-ph {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 2.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.profile__name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

@media (min-width: 576px) {
  .profile__name {
    font-size: 1.9rem;
  }
}

.profile__loc {
  color: var(--text-2);
  font-size: 0.87rem;
  margin-top: 3px;
}

.profile__bio {
  color: var(--text-2);
  font-size: 0.92rem;
  margin-top: 12px;
  line-height: 1.6;
  max-width: 520px;
}

.profile__nums {
  display: flex;
  gap: 28px;
  margin-top: 18px;
  justify-content: center;
}

@media (min-width: 768px) {
  .profile__nums {
    justify-content: flex-start;
  }
}

.profile__num {
  text-align: center;
}
.profile__num strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}
.profile__num small {
  font-size: 0.74rem;
  color: var(--text-3);
}

.profile__divider {
  width: 100%;
  height: 1px;
  background: var(--border-light);
  margin: 24px 0;
}

/* ═══════════════════════════════════════
   Пустое состояние
   ========================================== */

.empty {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-3);
}

.empty__icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
}
.empty__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-2);
}
.empty__hint {
  font-size: 0.87rem;
  margin-top: 6px;
}

/* ═══════════════════════════════════════
   Подвал
   ========================================== */

.footer {
  margin-top: 56px;
  padding: 28px 20px 24px;
  text-align: center;
  border-top: 1px solid var(--border-light);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--text-3);
}

/* Десктоп: лого слева, CTA по центру, соцсети справа */
@media (min-width: 576px) {
  .footer__inner {
    justify-content: space-between;
  }

  .footer__logo {
    flex: 1 1 0;
  }

  .footer__cta {
    flex: 0 0 auto;
  }

  .footer__social {
    flex: 1 1 0;
    justify-content: flex-end;
  }

  .footer__copy {
    flex-basis: 100%;
    text-align: center;
  }
}

.footer__brand {
  font-weight: 600;
  color: var(--text-2);
}
.footer__sep {
  color: var(--border);
}
.footer__link {
  color: var(--primary);
  font-weight: 500;
  transition: color 0.2s;
}
.footer__link:hover {
  color: var(--primary-hover);
}

.footer__copy {
  font-size: 0.74rem;
  color: var(--text-4);
  margin-top: 8px;
}

.footer__social {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-3);
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.footer__social-link:hover {
  color: var(--primary);
  background: var(--bg-subtle);
}

/* ═══════════════════════════════════════
   Заголовок страницы
   ========================================== */

.page-head {
  padding: 28px 0 20px;
}

.page-head__title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-head__sub {
  font-size: 0.87rem;
  color: var(--text-3);
  margin-top: 3px;
}

@media (min-width: 576px) {
  .page-head {
    padding: 40px 0 28px;
  }
  .page-head__title {
    font-size: 1.8rem;
  }
}

/* ═══════════════════════════════════════
   Утилиты
   ========================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Skip-link: спрятана, пока не получит фокус (первый Tab на странице).
   Уводит клавиатуру/скринридер сразу к <main id="main">, минуя шапку и меню. ── */
.skip-link {
  position: absolute;
  top: -80px;
  left: 8px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 8px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Цель skip-link получает программный фокус — не рисуем вокруг всего контента рамку. */
#main:focus {
  outline: none;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════
   Бейджи пользователя (художник/блогер)
   ========================================== */
.user-badge {
  /* inline-flex изолирует от родительской ссылки: text-decoration/цвет ссылки
     не протекают внутрь, поэтому пилюля выглядит одинаково и внутри <a>. */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
  text-decoration: none;
  border: 1px solid transparent;
}

.user-badge--artist {
  color: var(--primary);
  background: var(--primary-light);
  border-color: rgba(196, 69, 54, 0.2);
}

/* Тёмное золото на светло-песочном фоне — отдельная палитра с достаточным контрастом
   (не путать с reddish-фоном художника). */
.user-badge--blogger {
  color: #8a5a1c;
  background: rgba(212, 165, 116, 0.16);
  border-color: rgba(212, 165, 116, 0.45);
}

/* ═══════════════════════════════════════
   prefers-reduced-motion — уважаем системную настройку «меньше движения»
   Раньше поддержка была точечной (шиммер логотипа/скана, карусель) — здесь
   глобальный тормоз: почти обнуляем анимации и переходы (слайд drawer, тосты,
   hover-скейл карточек, шиммеры), убираем backdrop-blur подложки drawer.
   Цветовой переход темы гасится отдельно в theme-toggle.js (его !important-правило
   в dark-theme.css грузится ПОЗЖЕ и переспорило бы этот блок).
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Блюр подложки drawer — статичный фильтр, его !important-обнуление transition не
     трогает; убираем явно (тяжёлый эффект + провокатор укачивания). */
  .drawer__backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  /* Ховер-подъём/зум карточек — снимаем сам сдвиг, а не только его анимацию. */
  .card:hover,
  .card:hover .card__img {
    transform: none;
  }
}

/* ── Флаг страны (самохост SVG, wwwroot/flags) ──────────────────────────────
   Единый вид флага-<img> на всех страницах (профиль, /Users, списки подписок).
   object-fit:cover — SVG 4:3 вписывается в рамку 14×10 без искажения; vertical-align
   выравнивает флаг по строке текста (профиль рисует его инлайн рядом с городом).
   Рисуется партиалом _CountryFlag.cshtml / хелпером Html.CountryFlag. */
.cflag {
  display: inline-block;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: -1px;
}

/* ─── Роль-бейдж (_RoleBadge.cshtml) ───
   Живёт в site.css, а не в per-page файле: партиал используют личка (messages.js зеркалит
   разметку) и чат-комнаты (chats.js), а завтра — любой раздел со списком людей. Переехал сюда
   из messages.css 16.09.2026, когда появился второй потребитель. */
.role-badge {
  flex-shrink: 0;
  padding: 1px 7px;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-badge--admin {
  background: var(--primary-light);
  color: var(--primary);
}

.role-badge--moderator {
  background: var(--bg-subtle);
  color: var(--text-2);
}

/* ─── Закрываемые призывы в приложение (23.10.2026, просьба Давида: «некоторые специально
   пользуются вебом, их может раздражать») ───
   Крестик ЛЮБОГО призыва прячет ВСЕ призывы сайта на 30 дней: срок пишет site.js в localStorage,
   а гейт в <head> _Layout ставит класс app-cta-closed на <html> до отрисовки — закрытое не мелькает.
   Здесь, в общем site.css, а не в стилях раздела: помеченное data-app-promo живёт на разных
   страницах (новости, совместники, конкурсы, наборы, автор, шапка телефона), и правило «закрыл —
   спрятано» должно действовать везде одинаково. Помечать надо ВНЕШНЮЮ обёртку блока (секцию с
   полями) — иначе после закрытия останется пустой отступ. Блоки _AppCta прячет app-cta.css. */
html.app-cta-closed [data-app-promo] {
  display: none !important;
}

/* Крестик старых призывов (партиал _AppPromoClose): угол блока, зона нажатия 36px, значок 14px —
   как у .app-cta__close. Блоку нужны position: relative и поле справа под крестик. */
.promo-close {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.promo-close[hidden] {
  display: none; /* без JS крестик мёртв — его показывает site.js */
}
.promo-close:hover {
  background: rgba(44, 37, 32, 0.08);
  color: var(--text);
}
.promo-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.promo-close svg {
  width: 14px;
  height: 14px;
}
html[data-theme="dark"] .promo-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
