/* =========================================================
   فهرست شخصیت‌ها؛ چینش موزائیکی هماهنگ با گالری
   ========================================================= */

.characters-page {
  padding-bottom: 64px;
}

.characters-intro {
  max-width: 780px;
  margin: 10px auto 28px;
  text-align: center;
  color: #b7bbb2;
  font-size: 14px;
  line-height: 2.15;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(105px, 10.5vw, 165px);
  grid-auto-flow: dense;
  gap: 12px;
}

.character-card {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #090d0b;
  border: 1px solid rgba(216, 190, 135, .22);
  border-radius: 2px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  text-decoration: none;
  color: #f2eee5;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.character-card:hover,
.character-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(220, 190, 130, .7);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .3);
  outline: none;
}

.character-card:nth-child(1) {
  grid-column: span 2;
  grid-row: span 2;
}

.character-card:nth-child(4) {
  grid-column: span 2;
}

.character-card-image {
  position: absolute;
  inset: 0;
  height: auto;
  overflow: hidden;
  background: #141b17;
}

.character-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease, filter .35s ease;
}

.character-card:hover .character-card-image img {
  transform: scale(1.035);
  filter: saturate(1.06);
}

.character-card-image::after {
  content: "";
  position: absolute;
  inset: 40% 0 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .82));
}

.character-card-name {
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  bottom: 0;
  margin: 0;
  padding: 28px 12px 11px;
  text-align: right;
  color: #f3ead8;
  font-size: clamp(13px, 1.2vw, 16px);
  line-height: 1.9;
  font-weight: 700;
  text-shadow: 0 1px 5px #000;
}

.character-card-image .character-episode {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  padding: 4px 9px;
  border-radius: 5px;
  background: rgba(4, 9, 6, .78);
  border: 1px solid rgba(220, 190, 130, .35);
  font-size: 11px;
  color: #e5c991;
}


/* =========================================================
   صفحات معرفی هر شخصیت
   ========================================================= */

.profile-wrap {
  padding-bottom: 54px;
}

.profile-hero {
  display: grid;
  grid-template-columns: minmax(220px, 34%) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
  margin: 20px 0 30px;
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid rgba(216, 190, 135, .2);
  border-radius: 18px;
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, .05),
    rgba(255, 255, 255, .012)
  );
  box-shadow: 0 20px 55px rgba(0, 0, 0, .2);
}

/* تصویر پروفایل با نسبت اصلی و بدون برش نمایش داده می‌شود. */
.profile-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: visible;
  aspect-ratio: auto;
  border-radius: 13px;
  background: #141b17;
}

.profile-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  position: static;
  inset: auto;
  object-fit: contain;
  border-radius: 13px;
}

.profile-kicker {
  margin: 0 0 8px;
  color: #c7a66e;
  font-size: 12px;
  line-height: 1.9;
}

.profile-title {
  margin: 0 0 11px;
  color: #f4eee3;
  font-size: clamp(25px, 4vw, 42px);
  line-height: 1.6;
}

.profile-role {
  margin: 0;
  color: #c7c8bf;
  font-size: 15px;
  line-height: 2.1;
}

/* حذف جمله معرفی اضافه و عنوان «زندگی‌نامه و روایت» */
.profile-intro {
  display: none !important;
}

.profile-panel > h2 {
  display: none !important;
}

.profile-panel {
  margin-top: 22px;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: rgba(255, 255, 255, .025);
}

.profile-panel p {
  margin: 0 0 14px;
  color: #dadbd4;
  font-size: 14px;
  line-height: 2.3;
}

.profile-panel p:last-child {
  margin-bottom: 0;
}

.profile-quote {
  margin: 16px 0;
  padding: 16px 18px;
  border-right: 3px solid #bd975c;
  border-radius: 6px 0 0 6px;
  background: rgba(192, 153, 91, .07);
  color: #e0d1b3;
  font-size: 13px;
  line-height: 2.25;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.profile-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid rgba(210, 183, 124, .35);
  border-radius: 10px;
  color: #f0e5d0;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.7;
  transition: background .2s ease, border-color .2s ease;
}

.profile-actions a.primary {
  background: linear-gradient(135deg, #b89355, #856a3f);
  color: #10140f;
  border-color: transparent;
  font-weight: 700;
}

.profile-actions a:hover {
  background: rgba(210, 183, 124, .12);
  border-color: rgba(210, 183, 124, .65);
}

.profile-related {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding: 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  color: #bfc3b9;
  font-size: 13px;
  line-height: 2;
}


/* واکنش‌گرایی */

@media (max-width: 950px) {
  .characters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(105px, 16vw, 155px);
    gap: 10px;
  }
}

@media (max-width: 800px) {
  .profile-hero {
    grid-template-columns: minmax(130px, 36%) minmax(0, 1fr);
    gap: 18px;
    padding: 17px;
  }

  .profile-role {
    font-size: 13px;
  }
}

@media (max-width: 650px) {
  .characters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(105px, 30vw, 145px);
    gap: 8px;
  }

  .character-card-name {
    font-size: 12px;
    padding: 24px 8px 8px;
  }

  .character-card-image .character-episode {
    top: 7px;
    right: 7px;
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  .profile-hero {
    grid-template-columns: 1fr;
  }

  .profile-image img {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .profile-title {
    font-size: 26px;
  }

  .profile-panel {
    padding: 18px;
  }

  .profile-actions a {
    flex: 1 1 100%;
  }

  .profile-related {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .character-card,
  .character-card-image img,
  .profile-actions a {
    transition: none;
  }
}
