/*
  Карточки артистов с переворачиванием.

  Согласовано с владельцем 22.11.2026 на примере _booking/flip_card_demo.html:
  переворот ТОЛЬКО по щелчку и тапу. Наведением карточка не переворачивается —
  курсор, проходящий по сетке, открывал бы карточки без намерения.

  Основа — рабочий код с artikapromotion.ru (классы cf-*), переписанный
  mobile-first и под сетку вместо карусели. Сетка лучше для SEO: все карточки
  в разметке и доступны поисковику, а не спрятаны в горизонтальной прокрутке.

  Цвета берутся из переменных styles.css — фиолетового нет.
*/

/* Сетка карточек.
   Решение владельца 22.11.2026: карточки втрое меньше, промежутки больше,
   и на телефоне сетка остаётся многоколоночной — как на компьютере, а не
   в одну колонку. При 487 персонах одна колонка на телефоне означала бы
   бесконечную прокрутку.

   auto-fill с minmax даёт нужное поведение само: браузер укладывает столько
   колонок, сколько влезает при минимальной ширине карточки. На узком экране
   это 2–3 колонки, на широком 6–7. */
.cf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 22px 14px;
}

.cf-card {
  aspect-ratio: 3 / 4;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
}

.cf-inner {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  display: block;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  font: inherit;
  color: inherit;
  text-align: left;
}

.cf-inner:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.cf-flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.32, 1.05, .3, 1);
}

.cf-card.flipped .cf-flip { transform: rotateY(180deg); }

.cf-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ---- Лицевая сторона ---- */
.cf-front { background: var(--card-bg); }

.cf-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  pointer-events: none;
  -webkit-user-drag: none;
}

.cf-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(8, 7, 14, 0) 40%,
    rgba(8, 7, 14, .75) 74%,
    rgba(8, 7, 14, .96) 100%);
}

.cf-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 9px 9px;
}

/* Мелкий кегль: карточка втрое меньше прежней, крупный текст в неё не
   поместится. Имя переносится максимум на две строки, дальше обрезается
   многоточием — иначе длинные имена ломают сетку. */
.cf-name {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cf-role {
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Подсказка видна сразу, а не после первого тапа: иначе на телефоне
   человек не поймёт, что карточка двусторонняя. */
/* Подсказка на мелкой карточке — только значок: слово «подробнее» заняло бы
   половину ширины. */
.cf-hint {
  position: absolute;
  top: 6px; right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: rgba(8, 7, 14, .62);
  backdrop-filter: blur(4px);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.cf-hint > span:first-child { font-size: 11px; font-style: italic; }
.cf-hint-label { display: none; }

/* ---- Обратная сторона ---- */
/* Обратная сторона мелкой карточки.
   Втрое меньшая карточка вмещает втрое меньше текста, поэтому описание
   обрезается по строкам, а строки «Формат» и «Подходит» на самых узких
   экранах скрыты: они есть в заявке и в разговоре, а в карточке важнее
   имя и кнопка. */
.cf-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--back-1) 0%, var(--back-2) 55%, var(--back-3) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 9px 9px 8px;
  overflow: hidden;
}

.cf-back-name {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cf-back-row {
  font-size: 8.5px;
  line-height: 1.35;
  color: var(--text-dim);
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cf-back-row b { color: #fff; font-weight: 600; }
/* Вторую и третью строки прячем на мелких карточках. */
.cf-back-row ~ .cf-back-row { display: none; }

.cf-cta {
  margin-top: auto;
  display: block;
  padding: 6px 4px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
}
.cf-cta:hover { text-decoration: none; opacity: .92; }

.cf-disclaimer {
  margin: 22px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-mute);
}

/* Атрибуция фотографий. Свёрнута, чтобы не мешать каталогу, но присутствует
   на странице: лицензии CC BY и CC BY-SA требуют указания автора. */
.credits {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--text-mute);
}
.credits summary {
  cursor: pointer;
  padding: 6px 0;
  color: var(--text-mute);
}
.credits ul {
  margin: 6px 0 0;
  padding-left: 18px;
  line-height: 1.7;
  columns: 1;
}
.credits a { color: var(--text-mute); text-decoration: underline; }

@media (min-width: 700px) {
  .credits ul { columns: 2; column-gap: 28px; }
}

/* Старые правила на 1 и 2 колонки убраны: auto-fill выше сам укладывает
   столько колонок, сколько влезает, и на телефоне тоже даёт несколько в ряд.
   Здесь только увеличиваем карточку и текст по мере роста экрана. */
@media (min-width: 600px) {
  .cf-grid {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 26px 16px;
  }
  .cf-name { font-size: 12.5px; }
  .cf-role { font-size: 10px; }
  .cf-back-name { font-size: 11.5px; }
  .cf-back-row { font-size: 9px; }
  .cf-cta { font-size: 10px; padding: 7px 5px; }
}

@media (min-width: 1000px) {
  .cf-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 30px 18px;
  }
  .cf-name { font-size: 13.5px; }
  .cf-role { font-size: 10.5px; }
  .cf-back-name { font-size: 12px; }
  .cf-back-row { font-size: 9.5px; }
  /* На широком экране места хватает — показываем все строки. */
  .cf-back-row ~ .cf-back-row { display: -webkit-box; -webkit-line-clamp: 2; }
  .cf-cta { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .cf-flip { transition: none !important; }
}
