/* ==========================================================================
   archive_card — کارت فیلم/سریال صفحات آرشیو (هم‌اندازه‌ی کارت فیلم: پوستر ۲:۳)
   رنگ پیش‌فرض آبی؛ ژانر انیمه (.kfac--anime) نارنجی.
   ========================================================================== */

.kfac {
  --k-accent: #2f6fed;
  --k-accent-2: #4d8dff;
  --k-glow: rgba(47, 111, 237, .45);
  --k-bg: #050b1c;
  --k-panel: rgba(6, 13, 32, .74);
  --k-ink: #eef3ff;
  --k-muted: #aab7d6;
  --k-star: #f5b301;
  --k-r: 16px;
  --k-pad: 10px;

  position: relative;
  width: 100%;
  margin-bottom: 18px;
  direction: rtl;
  container-type: inline-size;
  container-name: kfac;
}

.kfac--anime {
  --k-accent: #cf3b1b;
  --k-accent-2: #ee5a33;
  --k-glow: rgba(207, 59, 27, .45);
  --k-bg: #140a07;
  --k-panel: rgba(22, 10, 6, .74);
}

.kfac a,
.kfac a:hover,
.kfac a:focus {
  color: inherit;
  text-decoration: none;
}

.kfac svg {
  display: block;
  flex: none;
}

/* ---------- قاب ---------- */
.kfac__frame {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--k-accent) 35%, rgba(255, 255, 255, .08));
  border-radius: var(--k-r);
  background: var(--k-bg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
  color: var(--k-ink);
  isolation: isolate;
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.kfac:hover .kfac__frame {
  transform: translateY(-3px);
  border-color: var(--k-accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .5), 0 0 18px color-mix(in srgb, var(--k-accent) 30%, transparent);
}

.kfac__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.kfac__img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center top;
  border-radius: 0 !important;
  transition: transform .7s ease;
}

.kfac:hover .kfac__img {
  transform: scale(1.04);
}

.kfac__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--k-bg) 97%, transparent) 0%, color-mix(in srgb, var(--k-bg) 80%, transparent) 26%, transparent 56%),
    linear-gradient(to bottom, color-mix(in srgb, var(--k-bg) 55%, transparent) 0%, transparent 28%);
}

.kfac__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ---------- هاله‌ی تیره + ژانر + خلاصه (فقط روی هاور) ---------- */
.kfac__veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(var(--k-pad) + 84px) var(--k-pad) 96px;
  background: rgba(0, 0, 0, .78);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
  pointer-events: none;
}

.kfac__vgenres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.kfac__vgenres span {
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--k-accent) 60%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--k-accent) 18%, transparent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
}

.kfac__story {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.75;
  color: #e6ecfb;
  text-align: justify;
}

@media (hover: hover) {
  .kfac:hover .kfac__veil {
    opacity: 1;
    visibility: visible;
  }
}

/* ---------- بالا راست: [رتبه] [CC + جزئیات زیرش] ---------- */
.kfac__tags {
  position: absolute;
  top: var(--k-pad);
  right: var(--k-pad);
  z-index: 3;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  direction: ltr;
}

.kfac__stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.kfac__flag {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  background: var(--k-panel);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--k-ink);
  direction: rtl;
  pointer-events: none;
}

.kfac__cc {
  display: grid;
  place-items: center;
  height: 1.55em;
  padding: 0 .35em;
  border: 1.5px solid var(--k-accent-2);
  border-radius: 4px;
  color: var(--k-accent-2);
  font-size: .85em;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
}

.kfac__flag-ico {
  width: 1.5em;
  height: 1.5em;
  fill: none;
  stroke: var(--k-accent-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* دکمه‌ی جزئیات — دقیقاً زیر CC و هم‌عرض آن */
.kfac__details {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--k-accent-2), var(--k-accent));
  box-shadow: 0 0 12px var(--k-glow);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  direction: rtl;
  transition: filter .2s, transform .2s;
}

.kfac__details svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kfac__details:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

/* برچسب رتبه‌ی ۲۵۰ برتر، با رنگ اکسنت کارت */
.kfac__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 2.3em;
  padding: 0 9px 0 13px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--k-accent-2), var(--k-accent));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  direction: ltr;
  pointer-events: none;
}

/* ---------- پایین: عنوان‌ها + متا ---------- */
.kfac__body {
  position: absolute;
  left: var(--k-pad);
  right: var(--k-pad);
  bottom: var(--k-pad);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.kfac__titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kfac__en {
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-size: clamp(14px, 8.4cqw, 19px);
  font-weight: 800;
  line-height: 1.3;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
  direction: ltr;
  text-align: left;
}

.kfac__fa {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-size: clamp(10.5px, 6.2cqw, 13px);
  font-weight: 500;
  line-height: 1.35;
  color: rgba(238, 243, 255, .58);
  direction: rtl;
  text-align: left;
  unicode-bidi: plaintext;
}

.kfac__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--k-muted);
  direction: ltr;
}

.kfac__imdb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-weight: 700;
}

.kfac__imdb svg {
  width: 1.1em;
  height: 1.1em;
  fill: var(--k-star);
}

.kfac__year::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: .95em;
  margin-right: 8px;
  background: rgba(255, 255, 255, .28);
  vertical-align: -.1em;
}

.kfac__ep {
  font-size: 11px;
  font-weight: 600;
  color: var(--k-accent-2);
  direction: rtl;
  text-align: left;
  unicode-bidi: plaintext;
}

/* ---------- کارت‌های خیلی کوچک (موبایل) ---------- */
@container kfac (max-width: 170px) {
  .kfac__flag-t {
    display: none;
  }

  .kfac__flag {
    justify-content: center;
  }

  .kfac__veil {
    padding-top: calc(var(--k-pad) + 76px);
  }

  .kfac__story {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kfac__frame,
  .kfac__img,
  .kfac__details {
    transition: none;
  }

  .kfac:hover .kfac__frame,
  .kfac:hover .kfac__img {
    transform: none;
  }
}


/* ==========================================================================
   طرح جدید کارت «سریال» (.kfac--series) — مثل نمونه‌ی طراحی‌شده
   قاب نوری · پخش بالا چپ · CC/دوبله بالا راست · پنل شیشه‌ای پایین
   روی هاور: هاله‌ی تیره + ژانر + خلاصه‌ی داستان
   ========================================================================== */

.kfac--series {
  --k-r: 18px;
  --k-panel-bg: linear-gradient(180deg, rgba(8, 17, 42, .58), rgba(5, 10, 26, .94));
}

.kfac--series.kfac--anime {
  --k-panel-bg: linear-gradient(180deg, rgba(26, 12, 7, .58), rgba(16, 8, 5, .94));
}

.kfac--series .kfac__frame {
  border: 1.5px solid var(--k-accent-2);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--k-accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--k-accent) 38%, transparent),
    0 8px 22px rgba(0, 0, 0, .45);
}

.kfac--series:hover .kfac__frame {
  border-color: #fff;
  border-color: color-mix(in srgb, var(--k-accent-2) 70%, #fff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--k-accent) 55%, transparent),
    0 0 26px color-mix(in srgb, var(--k-accent) 60%, transparent),
    0 14px 30px rgba(0, 0, 0, .55);
}

/* سایه‌ی پایین کمتر؛ پنل شیشه‌ای کار تیرگی را می‌کند */
.kfac--series .kfac__shade {
  background:
    linear-gradient(to top, color-mix(in srgb, var(--k-bg) 70%, transparent) 0%, transparent 38%),
    linear-gradient(to bottom, color-mix(in srgb, var(--k-bg) 45%, transparent) 0%, transparent 22%);
}

/* ---------- دکمه‌ی پخش (بالا چپ) ---------- */
.kfac__play {
  position: absolute;
  top: var(--k-pad);
  left: var(--k-pad);
  z-index: 4;
  display: grid;
  place-items: center;
  width: clamp(30px, 17cqw, 40px);
  height: clamp(30px, 17cqw, 40px);
  border: 2px solid #d7e5ff;
  border-radius: 50%;
  background: rgba(5, 11, 28, .78);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--k-accent) 45%, transparent);
  color: #fff;
  transition: transform .25s ease, box-shadow .25s ease;
}

.kfac__play svg {
  width: 44%;
  height: 44%;
  margin-left: 4%;
  fill: currentColor;
}

.kfac__play:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px var(--k-accent), 0 0 16px var(--k-glow);
}

/* ---------- بالا راست: رتبه + آیکن‌های CC / دوبله ---------- */
.kfac--series .kfac__tr {
  position: absolute;
  top: var(--k-pad);
  right: var(--k-pad);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  direction: ltr;
  pointer-events: none;
}

.kfac__ico {
  display: grid;
  place-items: center;
  width: clamp(22px, 11cqw, 27px);
  height: clamp(22px, 11cqw, 27px);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(5, 11, 28, .66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: clamp(10px, 5.6cqw, 12.5px);
  line-height: 1;
}

/* ---------- هاله‌ی هاور: بالا و پایین جا برای دکمه‌ها و پنل ---------- */
.kfac--series .kfac__veil {
  padding: calc(var(--k-pad) + 34px) var(--k-pad) 112px;
  background: rgba(2, 5, 14, .8);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.kfac--series .kfac__story {
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

/* ---------- پنل شیشه‌ای پایین ---------- */
.kfac__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px var(--k-pad) 11px;
  border-top: 1px solid rgba(255, 255, 255, .09);
  background: var(--k-panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  direction: ltr;
  pointer-events: none;
}

.kfac__pmain {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.kfac--series .kfac__body {
  all: unset;
}

.kfac__chips {
  display: flex;
  align-items: center;
  gap: 6px;
  direction: ltr;
}

.kfac__chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  color: var(--k-ink);
  direction: rtl;
}

.kfac__chip--ep {
  border-color: transparent;
  background: linear-gradient(180deg, var(--k-accent-2), var(--k-accent));
  box-shadow: 0 0 12px var(--k-glow);
  color: #fff;
}

.kfac--series .kfac__titles {
  gap: 1px;
}

.kfac--series .kfac__en {
  font-size: clamp(13px, 7.4cqw, 16px);
}

.kfac--series .kfac__fa {
  font-size: clamp(10.5px, 5.8cqw, 12px);
}

.kfac--series .kfac__meta {
  font-size: 11.5px;
}

/* دکمه‌ی پخش گرد پایین راست پنل */
.kfac__go {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(26px, 13cqw, 32px);
  height: clamp(26px, 13cqw, 32px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(8, 16, 40, .88);
  box-shadow: 0 0 14px color-mix(in srgb, var(--k-accent) 45%, transparent);
  color: #fff;
  pointer-events: auto;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.kfac__go svg {
  width: 42%;
  height: 42%;
  margin-left: 4%;
  fill: currentColor;
}

.kfac__go:hover {
  transform: scale(1.08);
  background: var(--k-accent);
  box-shadow: 0 0 18px var(--k-glow);
}

@container kfac (max-width: 170px) {
  .kfac--series .kfac__veil {
    padding-top: calc(var(--k-pad) + 36px);
    padding-bottom: 108px;
  }

  .kfac--series .kfac__story {
    -webkit-line-clamp: 6;
    line-clamp: 6;
  }

  .kfac--series .kfac__year {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kfac__play,
  .kfac__go {
    transition: none;
  }
}


/* رتبه‌ی ۲۵۰ برتر: بالا چپ (جای دکمه‌ی پخش قبلی) */
.kfac--series .kfac__rank--tl {
  position: absolute;
  top: var(--k-pad);
  left: var(--k-pad);
  z-index: 4;
  height: 24px;
  min-width: 2em;
  padding: 0 8px 0 11px;
  border-radius: 8px;
  font-size: 11.5px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
