/* Разделы страницы персонажа: карточки сценариев, цены, «О персонаже» (с тегами), закрытая галерея,
   заголовки сеток медиа. Подключается из character.css (@import). */

/* ---------- Карточки сценариев: обложка во всю карточку, текст на затемнении ---------- */
.scn-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.scn-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--r-lg);
  text-align: left;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  box-shadow: var(--elev-1);
  animation: rise-in 320ms var(--ease-out) both;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t);
}
.scn-tile:active { transform: scale(0.985); }
.scn-tile.is-default { border-color: rgba(139, 92, 246, 0.55); }
.scn-tile__img,
.scn-tile__grad {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
  transition: transform 700ms var(--ease-out);
}
.scn-tile__grad { display: flex; align-items: center; justify-content: center; font-size: 60px; }
.scn-tile__grad span { transform: translateY(-30%); filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35)); }
.scn-tile__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 10, 20, 0) 22%, rgba(11, 10, 20, 0.55) 52%, rgba(11, 10, 20, 0.95) 100%);
}
.scn-tile__badge {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: var(--fw-heavy);
  color: #fff;
  background: rgba(139, 92, 246, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}
.scn-tile__badge .icon { width: 13px; height: 13px; }
.scn-tile__body { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 5px; padding: 14px; }
.scn-tile__title {
  font-size: 19px;
  font-weight: var(--fw-black);
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Тизер из двух строк (описание 
 реплика) склеиваем пробелом: с pre-line первая фраза занимала обе строки клампа,
   вторая, с репликой, не была видна вовсе, а обрез выглядел «в пайетках.…» (S-06) */
.scn-tile__teaser {
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--text-2);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scn-tile__foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.scn-tile__free { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: var(--fw-heavy); color: var(--green); }
.scn-tile__free .icon { width: 14px; height: 14px; }
.scn-tile__note { font-size: 12px; font-weight: var(--fw-bold); color: var(--amber); }
.scn-tile__cta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  padding: 0 12px 0 18px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: var(--fw-heavy);
  color: #fff;
  background: var(--grad);
  box-shadow: var(--glow);
}
.scn-tile__cta .icon { width: 16px; height: 16px; transform: rotate(180deg); }
.scn-tile.is-loading { pointer-events: none; }
.scn-tile.is-loading .scn-tile__cta { animation: blink 1s ease-in-out infinite; }
.scn-tile:disabled { opacity: 0.6; }
.scn-tile:disabled .scn-tile__cta { background: var(--card-3); box-shadow: none; }
.char-skel-tile { aspect-ratio: 16 / 11; border-radius: var(--r-lg); }
@media (hover: hover) and (pointer: fine) {
  .scn-tile:not(:disabled):hover { border-color: rgba(255, 45, 120, 0.5); box-shadow: 0 16px 36px rgba(255, 45, 120, 0.18); }
  .scn-tile:not(:disabled):hover .scn-tile__img { transform: scale(1.04); }
}

/* ---------- Цены ---------- */
.char-prices { margin-top: 26px; }
.char-prices__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.char-prices__title { margin: 0; }
.char-prices__free { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: var(--fw-heavy); color: var(--green); }
.char-prices__free .icon { width: 14px; height: 14px; }
/* Телефон — сетка 2×2: подписи «сообщение», «ход звонка» целиком; шире — в одну строку.
   Цена над подписью у всех плиток и ряды одной высоты: на 360 px «💎 50 открыть видео» переносилась, соседние —
   нет, и плитки были разной высоты (S-14) */
.char-prices__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 8px; }
@media (min-width: 600px) { .char-prices__list { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); } }
.char-price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 10px 11px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
}
.char-price b { font-size: 16px; font-weight: var(--fw-black); font-variant-numeric: tabular-nums; }
.char-price span { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- «О персонаже» ---------- */
.char-about { display: block; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; }
.char-about__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 14px;
  text-align: left;
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  color: var(--text);
}
.char-about__head:active { background: var(--card-2); }
.char-about__icon { display: inline-flex; color: var(--violet); }
.char-about__icon .icon { width: 18px; height: 18px; }
.char-about__chev { display: inline-flex; color: var(--muted); }
.char-about__chev .icon { width: 18px; height: 18px; transform: rotate(-90deg); transition: transform var(--t) var(--ease); }
.char-about__head.is-open .char-about__chev .icon { transform: rotate(90deg); }
.char-about__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 14px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  user-select: text;
  -webkit-user-select: text;
}
.char-about__body b { color: var(--text); font-weight: var(--fw-bold); }
.char-about__tags { display: flex; flex-wrap: wrap; gap: 6px; }
/* Каталожный и чужой персонаж: подробностей нет (их видит только админка) — под ценами одна строка тегов */
.char-tags { margin-top: 14px; }
.char-delete { margin-top: 14px; color: var(--red); border-color: rgba(255, 77, 94, 0.35); }

/* ---------- Галерея и «Моё» ---------- */
.char-pane__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; margin: 2px 0 10px; }
.char-pane__title { font-size: 12px; font-weight: var(--fw-bold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
.char-pane__badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: var(--fw-bold); color: var(--green); }
.char-pane__badge .icon { width: 14px; height: 14px; }
.char .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Набор «галерея целиком» (ECONOMY.md 1.4): коллаж размытых превью закрытого, «Всё у {Имя}», что внутри и кнопка
   «Открыть всё · 💎98 · по отдельности 195💎». Цена — на кнопке, подпись о списании — на экране кадра и в шторке. */
.char-bundle {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(255, 45, 120, 0.22), rgba(139, 92, 246, 0.22)), var(--card);
  border: 1px solid rgba(255, 45, 120, 0.5);
  box-shadow: 0 12px 30px rgba(255, 45, 120, 0.16);
  animation: rise-in 260ms var(--ease-out) both;
}
.char-bundle__collage { position: absolute; inset: 0; z-index: -1; display: flex; opacity: 0.55; }
.char-bundle__collage img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; filter: blur(14px) saturate(1.3); transform: scale(1.25); }
.char-bundle__collage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 10, 20, 0.35), rgba(11, 10, 20, 0.82));
}
.char-bundle__body { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.char-bundle__head { display: flex; align-items: center; gap: 12px; }
.char-bundle__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--glow);
}
.char-bundle__icon .icon { width: 20px; height: 20px; }
.char-bundle__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.char-bundle__text b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-bundle__text span { font-size: var(--fs-sm); color: var(--text-2); }
.char-bundle__cta { gap: 8px; font-size: 16px; font-weight: var(--fw-heavy); animation: glow-pulse 2.6s ease-in-out infinite; }
.char-bundle__price { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.char-bundle__price .icon { width: 15px; height: 15px; color: #fff; }
/* Набора нет (одни фото, набор не дешевле суммы) — как открывать по одному */
.char-gallery__each {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: var(--fs-sm);
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line);
}
.char-gallery__each .icon { flex: 0 0 auto; width: 16px; height: 16px; color: var(--pink); }
.char-gallery__bundle:empty { display: none; }
/* Цены: ⚡ — разговор, 💎 — фото и видео */
.char-price--gems b { color: var(--gem); }

/* Шторка набора: цена на кнопке и в карточке «Галерея целиком», подпись о списании */
.bundle-sheet__price { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; font-variant-numeric: tabular-nums; }
.bundle-sheet__price .icon { width: 16px; height: 16px; }
.bundle-sheet__total { display: inline-flex; align-items: center; gap: 4px; color: var(--gem); }
.bundle-sheet__total .icon { width: 20px; height: 20px; }
.bundle-sheet__note { font-size: 12px; line-height: 1.4; color: var(--muted); }

/* ---------- Широкие экраны ---------- */
@media (min-width: 720px) {
  .scn-tile, .char-skel-tile { aspect-ratio: 16 / 10; }
}
@media (min-width: 1180px) {
  /* Первый сценарий — широкий, остальные парами; одинокий последний тоже растягивается */
  .scn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scn-tile { aspect-ratio: 4 / 5; }
  .scn-tile:first-child,
  .scn-tile:last-child:nth-child(even) { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
  .char .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .char-bundle__body { flex-direction: row; align-items: center; }
  .char-bundle__head { flex: 1; min-width: 0; }
  .char-bundle__cta { width: auto; flex: 0 0 auto; padding: 0 24px; }
}
