/* ==========================================================================
   صفحه‌ی /actors (kfa-*) و صفحه‌ی هر بازیگر (kfs-*)
   ========================================================================== */

.kfa-page,
.kfs-page {
  --a-accent: var(--primaryColor, #4d6bff);
  --a-text: var(--text, #cce1ff);
  --a-dim: color-mix(in srgb, var(--a-text) 58%, transparent);
  --a-line: color-mix(in srgb, var(--a-text) 10%, transparent);
  --a-panel: color-mix(in srgb, var(--bg_lighter, #14253e) 55%, transparent);
  color: var(--a-text);
}

/* ===================== /actors ===================== */
.kfa-page {
  padding: 34px 0 60px;
}

.kfa-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 30px 28px;
  margin-bottom: 22px;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid var(--a-line);
  background:
    radial-gradient(70% 120% at 100% 0%, color-mix(in srgb, var(--a-accent) 34%, transparent), transparent 60%),
    radial-gradient(50% 90% at 0% 100%, rgba(124, 92, 255, .18), transparent 60%),
    color-mix(in srgb, var(--bg_lighter, #14253e) 60%, var(--bg, #0D1726));
}

.kfa-hero::after {
  /* نوار فیلم تزئینی */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 46%;
  opacity: .07;
  background: repeating-linear-gradient(90deg, #fff 0 18px, transparent 18px 34px);
  -webkit-mask-image: linear-gradient(90deg, #000, transparent);
  mask-image: linear-gradient(90deg, #000, transparent);
  pointer-events: none;
}

.kfa-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  color: color-mix(in srgb, var(--a-accent) 35%, #fff);
  background: color-mix(in srgb, var(--a-accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--a-accent) 35%, transparent);
}

.kfa-hero__eyebrow svg,
.kfa-search__ic,
.kfa-card__count svg,
.kfa-empty svg,
.kfs-sort svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kfa-hero__eyebrow svg { width: 16px; height: 16px; }

.kfa-page h1.kfa-hero__title {
  margin: 12px 0 6px !important;
  font-size: clamp(28px, 4vw, 40px) !important;
  font-weight: 900 !important;
  line-height: 1.3 !important;
  color: #fff;
}

.kfa-hero__sub {
  margin: 0;
  font-size: 14px;
  color: var(--a-dim);
}

.kfa-hero__sub b {
  color: var(--a-text);
  font-weight: 800;
}

.kfa-search {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex: 0 1 440px;
  height: 54px;
  padding: 5px;
  border-radius: 17px;
  background: color-mix(in srgb, var(--bg_darker, #09111c) 80%, transparent);
  border: 1px solid var(--a-line);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.kfa-search:focus-within {
  border-color: color-mix(in srgb, var(--a-accent) 70%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-accent) 18%, transparent);
}

.kfa-search__ic {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0 12px 0 6px;
  color: var(--a-dim);
}

.kfa-page .kfa-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 14px;
  color: var(--a-text) !important;
}

.kfa-search__input::placeholder { color: var(--a-dim); }
.kfa-search__input::-webkit-search-cancel-button { display: none; }

.kfa-search__btn {
  flex: none;
  height: 100%;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--a-accent) 80%, #fff 10%), var(--a-accent));
  box-shadow: 0 10px 22px -12px var(--a-accent);
  cursor: pointer;
  transition: filter .2s ease, transform .2s ease;
}

.kfa-search__btn:hover { filter: brightness(1.12); }
.kfa-search__btn:active { transform: scale(.97); }

/* نوار مرتب‌سازی */
.kfa-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.kfa-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
}

.kfa-tab {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--a-dim) !important;
  text-decoration: none !important;
  transition: background-color .2s ease, color .2s ease;
}

.kfa-tab:hover { color: var(--a-text) !important; }

.kfa-tab.is-active {
  color: #fff !important;
  background: var(--a-accent);
  box-shadow: 0 8px 18px -10px var(--a-accent);
}

.kfa-result {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
}

.kfa-result__clear {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 17px;
  line-height: 1;
  color: var(--a-text) !important;
  background: color-mix(in srgb, var(--a-text) 10%, transparent);
  text-decoration: none !important;
}

/* شبکه‌ی بازیگران */
.kfa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 18px 16px;
}

.kfa-card {
  --h: 220;
  display: block;
  color: inherit !important;
  text-decoration: none !important;
}

.kfa-card__photo {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(90% 70% at 30% 20%, hsl(var(--h) 70% 55% / .55), transparent 70%),
    linear-gradient(160deg, hsl(var(--h) 45% 26%), hsl(calc(var(--h) + 40) 45% 14%));
  box-shadow: 0 0 0 1px var(--a-line), 0 14px 28px -18px rgba(0, 0, 0, .9);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease;
}

.kfa-card__photo img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}

.kfa-card__initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 14%;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  font-family: Arial, sans-serif;
}

.kfa-card__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(0deg, rgba(4, 8, 16, .55), transparent 40%);
}

.kfa-card__rank {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
  background: rgba(8, 12, 22, .6);
  border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.kfa-card__body {
  display: block;
  padding: 10px 4px 0;
  text-align: center;
}

.kfa-card__name {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.6;
  color: color-mix(in srgb, var(--a-text) 92%, #fff);
  transition: color .2s ease;
}

.kfa-card__count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--a-dim);
}

.kfa-card__count svg { width: 15px; height: 15px; }

@media (hover: hover) {
  .kfa-card:hover .kfa-card__photo {
    transform: translateY(-5px);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--a-accent) 70%, transparent), 0 22px 36px -18px color-mix(in srgb, var(--a-accent) 80%, #000);
  }
  .kfa-card:hover .kfa-card__photo img { transform: scale(1.06); }
  .kfa-card:hover .kfa-card__name { color: #fff; }
}

/* صفحه‌بندی */
.kfa-pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 34px;
}

.kfa-pagination .page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  color: var(--a-dim) !important;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  text-decoration: none !important;
  transition: color .2s ease, border-color .2s ease;
}

.kfa-pagination a.page-numbers:hover {
  color: var(--a-text) !important;
  border-color: color-mix(in srgb, var(--a-accent) 60%, transparent);
}

.kfa-pagination .page-numbers.current {
  color: #fff !important;
  background: var(--a-accent);
  border-color: var(--a-accent);
}

.kfa-pagination .page-numbers.dots {
  background: transparent;
  border-color: transparent;
}

.kfa-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 60px 20px;
  border-radius: 22px;
  text-align: center;
  color: var(--a-dim);
  background: var(--a-panel);
  border: 1px dashed var(--a-line);
}

.kfa-empty svg { width: 42px; height: 42px; color: var(--a-accent); margin-bottom: 4px; }
.kfa-empty strong { font-size: 16px; color: var(--a-text); }

/* ===================== صفحه‌ی بازیگر ===================== */
.kfs-page {
  padding-bottom: 60px;
}

.kfs-hero {
  position: relative;
  padding: 26px 0 40px;
  margin-bottom: 26px;
  overflow: hidden;
  isolation: isolate;
}

.kfs-hero__bg {
  position: absolute;
  inset: -40px;
  z-index: -2;
  background-size: cover;
  background-position: center 25%;
  filter: blur(38px) saturate(1.3);
  opacity: .5;
  transform: scale(1.1);
}

.kfs-hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 90% at 85% 10%, color-mix(in srgb, var(--a-accent) 25%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg, #0D1726) 55%, transparent) 0%, var(--bg, #0D1726) 100%);
}

.kfs-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 12.5px;
  color: var(--a-dim);
}

.kfs-crumbs a { color: var(--a-dim) !important; text-decoration: none !important; }
.kfs-crumbs a:hover { color: var(--a-text) !important; }
.kfs-crumbs b { color: var(--a-text); font-weight: 600; }

.kfs-hero__inner {
  display: flex;
  align-items: flex-end;
  gap: 30px;
}

.kfs-photo {
  flex: none;
  width: 210px;
  aspect-ratio: 3 / 4;
  border-radius: 24px;
  overflow: hidden;
  background: var(--a-panel);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .1),
    0 0 0 6px color-mix(in srgb, var(--a-accent) 14%, transparent),
    0 30px 60px -25px rgba(0, 0, 0, .9);
}

.kfs-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.kfs-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 4px;
}

.kfs-role {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--a-accent) 35%, #fff);
  background: color-mix(in srgb, var(--a-accent) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--a-accent) 40%, transparent);
}

.kfs-page h1.kfs-name {
  margin: 10px 0 18px !important;
  font-size: clamp(28px, 4.4vw, 46px) !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  color: #fff;
  text-align: right;
}

.kfs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px !important;
  padding: 0 !important;
  list-style: none;
}

.kfs-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 92px;
  padding: 10px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg_darker, #09111c) 55%, transparent);
  border: 1px solid var(--a-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.kfs-stats b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.3;
  color: #fff;
}

.kfs-stats b svg { width: 16px; height: 16px; fill: #f5c518; }

.kfs-stats span {
  font-size: 12px;
  color: var(--a-dim);
}

.kfs-bio {
  max-width: 820px;
}

.kfs-bio__text {
  font-size: 14px;
  line-height: 2.1;
  color: color-mix(in srgb, var(--a-text) 80%, transparent);
}

.kfs-bio__text p { margin: 0 0 8px; }

.kfs-bio.is-clamped:not(.is-open) .kfs-bio__text {
  max-height: calc(2.1em * 4);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}

.kfs-bio__more {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: color-mix(in srgb, var(--a-accent) 55%, #fff);
  cursor: pointer;
}

.kfs-bio__more-close,
.kfs-bio.is-open .kfs-bio__more-open { display: none; }
.kfs-bio.is-open .kfs-bio__more-close { display: inline; }

/* نوار ابزار آثار */
.kfs-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 22px;
}

.kfs-page h2.kfs-works__title {
  margin: 0 !important;
  margin-left: auto !important;
  padding-right: 14px;
  position: relative;
  font-size: 20px !important;
  font-weight: 900 !important;
  color: #fff;
}

.kfs-works__title::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 4px;
  height: 20px;
  border-radius: 4px;
  transform: translateY(-50%);
  background: var(--a-accent);
}

.kfs-filters {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 14px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
}

.kfs-filter {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--a-dim);
  cursor: pointer;
  transition: color .25s ease;
  white-space: nowrap;
}

.kfs-filter i {
  font-style: normal;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  background: color-mix(in srgb, var(--a-text) 10%, transparent);
  transition: background-color .25s ease;
}

.kfs-filter:hover:not(:disabled) { color: var(--a-text); }
.kfs-filter.is-active { color: #fff; }
.kfs-filter.is-active i { background: rgba(255, 255, 255, .22); }
.kfs-filter:disabled { opacity: .4; cursor: not-allowed; }

.kfs-filters__pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  z-index: 0;
  border-radius: 10px;
  background: var(--a-accent);
  box-shadow: 0 8px 18px -10px var(--a-accent);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.1), width .35s ease;
}

.kfs-filters__pill.is-ready { opacity: 1; }

/* قبل از اجرای JS: تب فعال خودش رنگی باشد */
.kfs-filters:not(:has(.is-ready)) .kfs-filter.is-active {
  background: var(--a-accent);
}

.kfs-sort {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 44px;
  margin: 0;
  padding: 0 12px 0 6px;
  border-radius: 14px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  color: var(--a-dim);
}

.kfs-sort svg { width: 18px; height: 18px; flex: none; }

.kfs-page .kfs-sort select {
  height: 100%;
  padding: 0 8px 0 4px !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-text) !important;
  cursor: pointer;
}

.kfs-sort select option {
  color: #111;
  background: #fff;
}

/* شبکه‌ی آثار */
.kfs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 6px 16px;
}

.kfs-cell[hidden] { display: none !important; }

.kfs-cell.is-in {
  animation: kfsIn .4s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes kfsIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.kfs-none {
  padding: 40px 0;
  text-align: center;
  color: var(--a-dim);
}

/* ===================== موبایل ===================== */
@media (max-width: 991px) {
  .kfa-hero { flex-direction: column; align-items: stretch; padding: 24px 20px; }
  .kfa-search { flex-basis: auto; }
}

@media (max-width: 767px) {
  .kfa-page { padding-top: 18px; }
  .kfa-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .kfa-card__photo { border-radius: 16px; }
  .kfa-card__name { font-size: 13px; }
  .kfa-card__count { font-size: 11px; }
  .kfa-card__initials { font-size: 28px; }
  .kfa-tabs { width: 100%; }
  .kfa-tab { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; }

  .kfs-hero { padding-top: 16px; }
  .kfs-hero__inner { flex-direction: column; align-items: center; gap: 18px; text-align: center; }
  .kfs-photo { width: 150px; border-radius: 20px; }
  .kfs-page h1.kfs-name { text-align: center; margin-bottom: 14px !important; }
  .kfs-stats { justify-content: center; gap: 8px; }
  .kfs-stats li { min-width: 0; flex: 1 1 calc(50% - 8px); align-items: center; padding: 9px 10px; }
  .kfs-bio { text-align: right; }
  .kfs-crumbs { justify-content: center; }

  .kfs-toolbar { gap: 10px; }
  .kfs-page h2.kfs-works__title { width: 100%; font-size: 18px !important; }
  .kfs-filters { flex: 1 1 100%; }
  .kfs-filter { flex: 1; justify-content: center; padding: 8px 6px; }
  .kfs-sort { flex: 1 1 100%; }
  .kfs-sort select { flex: 1; }

  .kfs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
}

@media (max-width: 380px) {
  .kfa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===================== تم روشن قالب (html.dark) ===================== */
html.dark .kfa-page h1.kfa-hero__title,
html.dark .kfs-page h1.kfs-name,
html.dark .kfs-page h2.kfs-works__title,
html.dark .kfs-stats b,
html.dark .kfa-card__name {
  color: var(--text, #10223d);
}
html.dark .kfs-stats li,
html.dark .kfa-search {
  background: rgba(255, 255, 255, .7);
}
