/* ===== Анкета персонажа ===== */
.custom_tag.char-card{
  --photo-w: 184px;
  --gap: 16px;
  --r: 10px;
  --hair: color-mix(in oklab, var(--bord,#b8b8b8) 62%, transparent);
  --ink: var(--text,#000);
  --ink2: color-mix(in oklab, var(--sec-text,#0e0c0b) 85%, #000 15%);
  --accent-ink: var(--accent,#915252);

  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(150px,var(--photo-w)) 1fr 1fr;
  grid-template-rows: repeat(10, auto);
  gap: var(--gap);
  color: var(--ink);
  background: none;
  font-family: var(--main-font, manrope, system-ui, Arial, sans-serif);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.custom_tag.char-card *{ box-sizing: border-box; min-inline-size: 0; }
.custom_tag.char-card p{ margin:0; }
.custom_tag.char-card p + p{ margin-top:.6em; }

.custom_tag.char-card .char-image{ grid-column: 1; grid-row: 1 / 11; align-self:start; }
.custom_tag.char-card .char-image img,
.custom_tag.char-card .char-image .postimg{
  display:block; width:100%;
  aspect-ratio: 3 / 4;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--hair);
}

.custom_tag.char-card > .char-field,
.custom_tag.char-card > .char-face-proto,
.custom_tag.char-card > .char-gender,
.custom_tag.char-card > .char-pair{
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: 10px 12px;
  background: none;
}
.custom_tag.char-card > .char-field::before,
.custom_tag.char-card > .char-face-proto::before,
.custom_tag.char-card > .char-gender::before,
.custom_tag.char-card > .char-pair::before{
  content: attr(data-label);
  display:block;
  margin-bottom:6px;
  font-size:11px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color: var(--accent-ink);
}

.custom_tag.char-card > .char-name-ru{
  grid-column: 2 / 4; grid-row: 1;
  font-family: var(--sec-font, auge, var(--main-font));
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing:.2px;
}
.custom_tag.char-card > .char-name-ru::before{ content:""; }

.custom_tag.char-card > .char-name-en{
  grid-column: 3; grid-row: 1;
  justify-self: end; align-self: end;
  font-size: 12px; color: var(--ink2);
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--hair);
}

/* Порядок коротких полей */
.custom_tag.char-card > .char-face-proto{ grid-column: 2; grid-row: 2; }
.custom_tag.char-card > .char-gender{      grid-column: 3; grid-row: 2; }
.custom_tag.char-card > .char-birthdate{ grid-column: 2; grid-row: 3; }
.custom_tag.char-card > .char-age{       grid-column: 3; grid-row: 3; }
.custom_tag.char-card > .char-race{      grid-column: 2; grid-row: 4; }
.custom_tag.char-card > .char-occupation{grid-column: 3; grid-row: 4; }
/* Пара сразу после расы, рядом с occupation по вертикали ниже */
.custom_tag.char-card > .char-pair{      grid-column: 2; grid-row: 5; }

.custom_tag.char-card > .char-bondlevel{ grid-column: 3; grid-row: 5; }
.custom_tag.char-card > .char-ability{    grid-column: 2 / 4; grid-row: 6; }
.custom_tag.char-card > .char-appearance{ grid-column: 2 / 4; grid-row: 7; }
.custom_tag.char-card > .char-bio{        grid-column: 2 / 4; grid-row: 8; }
.custom_tag.char-card > .char-misc{       grid-column: 2 / 4; grid-row: 9; }

.custom_tag.char-card > .char-pair::before{ content:"Пара"; }
.custom_tag.char-card > .char-face-proto::before{ content:"Прототип внешности"; }
.custom_tag.char-card > .char-gender::before{     content:"Пол"; }
.custom_tag.char-card > .char-birthdate::before{  content:"Дата рождения"; }
.custom_tag.char-card > .char-age::before{        content:"Возраст"; }
.custom_tag.char-card > .char-race::before{       content:"Раса"; }
.custom_tag.char-card > .char-occupation::before{ content:"Статус / роль"; }
.custom_tag.char-card > .char-bondlevel::before{  content:"Уровень связи"; }
.custom_tag.char-card > .char-ability::before{    content:"Особенности / дар"; }
.custom_tag.char-card > .char-appearance::before{ content:"Внешность"; }
.custom_tag.char-card > .char-bio::before{        content:"Биография"; }
.custom_tag.char-card > .char-misc::before{       content:"Дополнительно"; }

.custom_tag.char-card > .char-birthdate,
.custom_tag.char-card > .char-age,
.custom_tag.char-card > .char-race,
.custom_tag.char-card > .char-gender,
.custom_tag.char-card > .char-face-proto,
.custom_tag.char-card > .char-occupation,
.custom_tag.char-card > .char-bondlevel,
.custom_tag.char-card > .char-pair{
  display:grid;
  grid-template-columns: 140px 1fr;
  align-items:center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.custom_tag.char-card .char-occupation{
  display:grid;
  grid-template-columns: 140px 1fr;
  align-items:center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
}
.custom_tag.char-card .char-occupation > p{ display:none; }
.custom_tag.char-card .char-occupation .custom_tag{
  display:inline-flex; gap:6px; flex-wrap:wrap;
}
.custom_tag.char-card .char-status p,
.custom_tag.char-card .char-role p{
  display:inline-block; padding: 4px 8px;
  border: 1px solid var(--hair); border-radius: 999px; line-height: 1.2;
}
.custom_tag.char-card .char-status p{
  background: color-mix(in oklab, var(--accent-ink) 8%, transparent);
  color: var(--ink2);
}
.custom_tag.char-card .char-role p{ font-size: 12px; letter-spacing:.02em; }

.custom_tag.char-card :is(.char-ability,.char-appearance,.char-bio,.char-misc) p{
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  line-height: 1.6;
}

.custom_tag.char-card a{
  color: var(--accent-ink);
  text-decoration:none; border-bottom:1px dotted currentColor;
}
.custom_tag.char-card a:hover{ border-bottom-style:solid; }

@media (max-width: 860px){
  .custom_tag.char-card{
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 12px;
  }
  .custom_tag.char-card .char-image{ grid-column:1; grid-row:auto; }
  .custom_tag.char-card > .char-name-ru,
  .custom_tag.char-card > .char-name-en,
  .custom_tag.char-card > .char-face-proto,
  .custom_tag.char-card > .char-gender,
  .custom_tag.char-card > .char-birthdate,
  .custom_tag.char-card > .char-age,
  .custom_tag.char-card > .char-race,
  .custom_tag.char-card > .char-occupation,
  .custom_tag.char-card > .char-bondlevel,
  .custom_tag.char-card > .char-ability,
  .custom_tag.char-card > .char-appearance,
  .custom_tag.char-card > .char-bio,
  .custom_tag.char-card > .char-misc,
  .custom_tag.char-card > .char-pair{ grid-column:1; grid-row:auto; }

  .custom_tag.char-card > :is(.char-face-proto,.char-gender,.char-birthdate,.char-age,.char-race,.char-occupation,.char-bondlevel,.char-pair){
    grid-template-columns: 1fr;
    align-items:start;
  }

  .custom_tag.char-card > .char-name-en{ justify-self:start; }
}


/* ===== Каталог персонажей ===== */
.chars__title { margin: 0 0 12px; font-size: 20px; }

.chars__filters{
  display:grid;
  gap:12px;
  grid-template-columns: repeat(7, 1fr);
  align-items:end;
  margin-bottom:16px;
}
.chars__filter-group{ display:flex; flex-direction:column; gap:6px; }
.chars__filter-label{ font-size:12px; opacity:.8; }
.chars__input,.chars__select{
  width:100%; padding:8px 10px;
  border:1px solid var(--hair,#ccc); border-radius:8px;
  background:none; color:inherit; font:inherit;
}
.chars__age-row{ display:flex; gap:8px; }
.chars__btn{ padding:8px 12px; border-radius:8px; border:1px solid var(--hair,#ccc); background:none; cursor:pointer; }
.chars__btn--ghost{ opacity:.85; }
.chars__actions{ grid-column:1 / -1; display:flex; gap:8px; }

.chars__list{ }
.chars__empty,.chars__error{ padding:16px; opacity:.8; }

.chars__grid{
  display:grid; gap:12px;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

@media (max-width: 980px){
  .chars__filters{ grid-template-columns: repeat(2, 1fr); }
  .chars__grid{ grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 640px){
  .chars__grid{ grid-template-columns: 1fr; }
}

.chars__card{
  display:grid;
  grid-template-columns: 96px 1fr;
  gap: 10px 12px;
  border:1px solid var(--hair,#ccc);
  border-radius:10px;
  padding:10px 12px;
  background:none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.chars__card-body{ min-inline-size:0; }
.chars__card-img img{
  display:block; width:96px; height:128px;
  object-fit:cover; border-radius:8px;
  border:1px solid var(--hair,#ccc);
  background: color-mix(in oklab, var(--bord,#b8b8b8) 20%, transparent);
}

.chars__card-title{
  margin:0 0 4px;
  font-size:16px; line-height:1.25;
  overflow-wrap:anywhere; hyphens:auto;
}
.chars__card-title a{
  color: var(--accent-ink,#915252);
  text-decoration:none; border-bottom:1px dotted currentColor;
}
.chars__card-title a:hover{ border-bottom-style:solid; }

.chars__name-ru{
  margin:0 0 6px;
  font-size:13px; opacity:.8;
  overflow-wrap:anywhere; hyphens:auto;
}

.chars__meta{
  display:grid;
  gap:6px;
  align-items:start;
}

/* Ряды метаданных */
.chars__field{
  display:grid;
  grid-template-columns: 128px 1fr;
  gap:6px 10px;
  align-items:start;
}
.chars__field-label{
  font-size:12px; opacity:.7;
  line-height:1.35;
}
.chars__field-value{
  line-height:1.45;
  overflow-wrap:anywhere; word-break:break-word; hyphens:auto;
}

/* Бейджи (если попадутся старые карточки) */
.chars__badge{
  display:inline-block; padding:3px 8px;
  border-radius:999px; border:1px solid var(--hair,#ccc);
  font-size:12px; line-height:1.2;
}
.chars__badge.is-status{
  background: color-mix(in oklab, var(--accent-ink,#915252) 8%, transparent);
}
.chars__badge.is-gift{ border-style:dashed; }
.chars__face{ font-size:12px; opacity:.8; }

.chars__pair{
  margin:2px 0 0;
  font-size:12px;
  display:flex; gap:6px; align-items:center;
  overflow-wrap:anywhere; hyphens:auto;
}
.chars__pair-label{ opacity:.75; }
.chars__pair-link{
  color: var(--accent-ink,#915252);
  text-decoration:none; border-bottom:1px dotted currentColor;
}
.chars__pair-link:hover{ border-bottom-style:solid; }

.chars__card.is-related{
  border-color: var(--accent-ink,#915252);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent-ink,#915252) 30%, transparent);
}
