/* =========================================================================
   Faragiri - Blog engagement & content-polish layer (single posts)
   Loads after blog.css. Tokens match the redesign:
   surface #1a2030 / #161b27, border #262d3f, accent #24baef,
   text #e7eaf2, muted #9aa3b8, gradient #8D65E9 -> #5391E4 -> #6BCD94.
   ========================================================================= */

/* reliable Persian numerals for the ordered-list badges (self-contained) */
@counter-style fgri-eng-fa {
  system: numeric;
  symbols: "۰" "۱" "۲" "۳" "۴" "۵" "۶" "۷" "۸" "۹";
}

/* ----------------------------------------------------------------------
   1. READING-PROGRESS BAR (top of viewport, universal: mobile + desktop)
   ---------------------------------------------------------------------- */
.fgri-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
}
.fgri-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #8D65E9 0%, #5391E4 47%, #6BCD94 100%);
  box-shadow: 0 0 10px rgba(83, 145, 228, .55);
  transition: width .08s linear;
}

/* ----------------------------------------------------------------------
   2. ENGAGEMENT BAR (after the content, before the share row)
   ---------------------------------------------------------------------- */
:is(body.single-post,body.single-movie) .fgri-engage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 18px;
  margin: 36px 0 0;
  padding: 20px 22px;
  border: 1px solid #262d3f;
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(141, 101, 233, .10), transparent 55%),
    radial-gradient(120% 140% at 0% 100%, rgba(36, 186, 239, .08), transparent 55%),
    #161b27;
}
:is(body.single-post,body.single-movie) .fgri-engage__lead { display: flex; flex-direction: column; gap: 3px; }
:is(body.single-post,body.single-movie) .fgri-engage__q {
  font-size: 16px; font-weight: 600; color: #eef1f7; line-height: 1.6;
}
:is(body.single-post,body.single-movie) .fgri-engage__hint { font-size: 13px; color: #9aa3b8; }

:is(body.single-post,body.single-movie) .fgri-engage__actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* like button */
.fgri-like {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px;
  border-radius: 40px;
  border: 1px solid #2e3750;
  background: #11151f;
  color: #cfd6e6;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.fgri-like:hover { border-color: #e2606a; color: #ff8b94; }
.fgri-like:active { transform: scale(.96); }
.fgri-like__icon { display: inline-flex; }
.fgri-like__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; transition: transform .2s ease; }
.fgri-like__count { min-width: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.fgri-like__text { font-weight: 500; }
@media (max-width: 420px) { .fgri-like__text { display: none; } }

/* liked state */
.fgri-like.is-liked {
  border-color: #e2606a;
  background: linear-gradient(135deg, rgba(226, 96, 106, .20), rgba(226, 96, 106, .08));
  color: #ff7d87;
}
.fgri-like.is-liked .fgri-like__icon svg { fill: #ff5d6a; stroke: #ff5d6a; }
.fgri-like.is-animating .fgri-like__icon svg { animation: fgri-heart .42s ease; }
@keyframes fgri-heart {
  0% { transform: scale(1); }
  35% { transform: scale(1.32); }
  60% { transform: scale(.88); }
  100% { transform: scale(1); }
}
/* burst particles on like */
.fgri-like__icon { position: relative; }
.fgri-like.is-animating .fgri-like__icon::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 93, 106, .6);
  animation: fgri-burst .5s ease-out forwards;
}
@keyframes fgri-burst {
  0% { transform: scale(.4); opacity: .9; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* comment / view chips */
:is(body.single-post,body.single-movie) .fgri-engage__chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px;
  border-radius: 40px;
  border: 1px solid #2a3142;
  background: #11151f;
  color: #b9c0d0 !important;
  font-size: 14px; font-weight: 500;
  text-decoration: none !important;
  transition: border-color .2s ease, color .2s ease;
  font-variant-numeric: tabular-nums;
}
:is(body.single-post,body.single-movie) .fgri-engage__chip:hover { border-color: #24baef; color: #6fd0f5 !important; }
:is(body.single-post,body.single-movie) .fgri-engage__chip svg { width: 19px; height: 19px; flex: 0 0 auto; }
@media (max-width: 600px) {
  :is(body.single-post,body.single-movie) .fgri-engage { flex-direction: column; align-items: stretch; text-align: center; }
  :is(body.single-post,body.single-movie) .fgri-engage__actions { justify-content: center; }
}

/* ----------------------------------------------------------------------
   3. STICKY ACTION RAIL (desktop, end-side gutter - opposite the TOC rail)
   ---------------------------------------------------------------------- */
.fgri-rail {
  position: fixed;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  border: 1px solid #262d3f;
  border-radius: 50px;
  background: rgba(22, 27, 39, .82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
}
.fgri-rail.is-visible { opacity: 1; transform: translateY(0); }
.fgri-rail__btn {
  position: relative;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #aeb6c8;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .2s ease, color .2s ease, transform .12s ease;
  font-family: inherit;
}
.fgri-rail__btn:hover { background: #1f2638; color: #eef1f7; }
.fgri-rail__btn:active { transform: scale(.92); }
.fgri-rail__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; }
.fgri-rail__num { font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.fgri-rail__btn--like.is-liked { color: #ff5d6a; }
.fgri-rail__btn--like.is-liked svg { fill: #ff5d6a; stroke: #ff5d6a; }
.fgri-rail__btn--like.is-animating svg { animation: fgri-heart .42s ease; }
.fgri-rail__sep { height: 1px; margin: 1px 8px; background: #2a3142; }
.fgri-rail__btn--top { color: #6fd0f5; }

/* ----------------------------------------------------------------------
   4. CONTENT POLISH - lead paragraph, dividers, ordered/unordered lists,
      definition lists, marks, key-takeaways. Scoped to the article body.
   ---------------------------------------------------------------------- */

/* lead paragraph: the first paragraph reads larger & lighter */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) > p:first-of-type {
  font-size: 18.5px !important;
  line-height: 2.05 !important;
  color: #e3e8f1 !important;
}

/* horizontal rule -> gradient divider with a centred diamond */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) hr {
  border: 0 !important;
  height: 24px;
  margin: 38px auto !important;
  position: relative;
  background: none !important;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) hr::before {
  content: "";
  position: absolute; top: 50%; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, #2f3a50 18%, #2f3a50 82%, transparent);
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) hr::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 9px; height: 9px; transform: translate(-50%, -50%) rotate(45deg);
  background: #24baef; border-radius: 2px;
  box-shadow: 0 0 0 5px #0f131d;
}

/* ordered lists -> flat accent number chips (Persian numerals).
   Deliberately not a multi-hue gradient: the purple/blue/green blend read as
   generated decoration and clashed with the single-accent rest of the page.
   Same shape language as the TOC numbers in toc.css. */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ol:not(.fgri-toc__list):not(.fgri-toc__sublist) {
  counter-reset: fgri-ol;
  list-style: none !important;
  padding-right: 0 !important;
  margin: 0 0 22px !important;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ol:not(.fgri-toc__list):not(.fgri-toc__sublist) > li {
  position: relative;
  padding-right: 46px !important;
  margin-bottom: 14px !important;
  min-height: 30px;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ol:not(.fgri-toc__list):not(.fgri-toc__sublist) > li::before {
  counter-increment: fgri-ol;
  content: counter(fgri-ol, fgri-eng-fa);
  position: absolute;
  right: 0; top: .18em;
  width: 27px; height: 27px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
  line-height: 1;
  color: #24baef;
  background: rgba(36, 186, 239, .13);
  border: 1px solid rgba(36, 186, 239, .26);
  box-shadow: none;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ol:not(.fgri-toc__list):not(.fgri-toc__sublist) > li::marker { content: none; }
/* nested ordered lists restart with a lighter pill */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ol:not(.fgri-toc__list):not(.fgri-toc__sublist) ol { margin: 12px 0 6px !important; }
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ol:not(.fgri-toc__list):not(.fgri-toc__sublist) ol > li::before {
  background: #1f2942; color: #9fd2ef; box-shadow: none; border: 1px solid #2f3a50;
}

/* unordered lists -> custom accent marker */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ul {
  list-style: none !important;
  padding-right: 4px !important;
  margin: 0 0 22px !important;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ul > li {
  position: relative;
  padding-right: 28px !important;
  margin-bottom: 12px !important;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ul > li::before {
  content: "";
  position: absolute;
  right: 2px; top: .72em;
  width: 9px; height: 9px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: #24baef;
  box-shadow: 0 0 0 3px rgba(36, 186, 239, .14);
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ul > li::marker { content: none; }
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ul ul { margin: 10px 0 4px !important; }
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) ul ul > li::before {
  background: transparent; border: 2px solid #4a5570;
  box-shadow: none; width: 8px; height: 8px;
}

/* mark / highlight */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) mark {
  background: linear-gradient(transparent 55%, rgba(36, 186, 239, .28) 55%);
  color: inherit; padding: 0 2px; border-radius: 2px;
}

/* definition lists */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) dl {
  border: 1px solid #262d3f; border-radius: 14px; overflow: hidden; margin: 24px 0;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) dt {
  background: #1a2030; color: #eef1f7; font-weight: 600;
  padding: 11px 16px; border-bottom: 1px solid #262d3f;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) dd {
  margin: 0 !important; padding: 12px 16px; color: #c4cad8;
  border-bottom: 1px solid #232a3a;
}
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) dd:last-child { border-bottom: 0; }

/* ----------------------------------------------------------------------
   5. CODE BLOCKS - "copy" button overlay
   ---------------------------------------------------------------------- */
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .fgri-pre {
  position: relative;
}
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .fgri-pre .fgri-copy {
  position: absolute; top: 9px; left: 9px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 8px;
  border: 1px solid #2a3142; background: #161b27; color: #9aa3b8;
  font-size: 12px; font-family: inherit; cursor: pointer; direction: rtl;
  transition: all .2s ease; opacity: 0;
}
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .fgri-pre:hover .fgri-copy { opacity: 1; }
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .fgri-pre .fgri-copy:hover { color: #24baef; border-color: #24baef; }
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .fgri-pre .fgri-copy.is-copied { color: #25d366; border-color: #25d366; }
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .fgri-pre .fgri-copy svg { width: 14px; height: 14px; }

/* ----------------------------------------------------------------------
   6. IMAGE LIGHTBOX
   ---------------------------------------------------------------------- */
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) .wp-block-image img,
:is(body.single-post,body.single-movie) :is(.article__content,.movie__description) figure:not(.wp-block-video):not(.wp-block-audio):not(.wp-block-table) img {
  cursor: zoom-in;
}
.fgri-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 9, 16, .92);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
  padding: 24px;
}
.fgri-lightbox.is-open { opacity: 1; visibility: visible; }
.fgri-lightbox img {
  max-width: 96vw; max-height: 90vh;
  border-radius: 12px; border: 1px solid #2a3956;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  transform: scale(.96); transition: transform .25s ease;
  cursor: zoom-out;
}
.fgri-lightbox.is-open img { transform: scale(1); }
.fgri-lightbox__close {
  position: absolute; top: 18px; left: 18px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #2a3142; background: rgba(22, 27, 39, .8); color: #e7eaf2;
  font-size: 22px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s ease;
}
.fgri-lightbox__close:hover { background: #e2606a; border-color: #e2606a; color: #fff; }

/* ----------------------------------------------------------------------
   7. TOAST (copy-link / copy-code feedback that needs words)
   ---------------------------------------------------------------------- */
.fgri-toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 100001;
  background: #11151f; border: 1px solid #2a3142; color: #e7eaf2;
  padding: 11px 20px; border-radius: 40px; font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.fgri-toast.is-show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.fgri-toast svg { width: 17px; height: 17px; color: #25d366; }

/* ----------------------------------------------------------------------
   8. EMPTY COMMENT STATE
   ---------------------------------------------------------------------- */
:is(body.single-post,body.single-movie) .fgri-comments-empty {
  text-align: center;
  border: 1px dashed #2f3a50;
  border-radius: 16px;
  background: #12141a;
  padding: 30px 22px;
  margin: 0 0 8px;
}
:is(body.single-post,body.single-movie) .fgri-comments-empty__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(36, 186, 239, .1); color: #6fd0f5; margin-bottom: 14px;
}
:is(body.single-post,body.single-movie) .fgri-comments-empty__icon svg { width: 27px; height: 27px; }
:is(body.single-post,body.single-movie) .fgri-comments-empty__title {
  font-size: 17px !important; font-weight: 600 !important; color: #eef1f7 !important; margin: 0 0 6px !important;
}
:is(body.single-post,body.single-movie) .fgri-comments-empty__sub {
  font-size: 14px !important; line-height: 1.95 !important; color: #9aa3b8 !important;
  margin: 0 auto !important; max-width: 440px;
}

/* ----------------------------------------------------------------------
   9. HEADING ANCHOR LINKS (copy deep-link to a section on hover)
   ---------------------------------------------------------------------- */
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) h2,
:is(body.single-post,body.single-movie) :is(.article__content.entry-content,.movie__description) h3 { position: relative; }
.fgri-anchor {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  left: -34px;                      /* end side in RTL */
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
  color: #6fd0f5 !important;
  background: rgba(36, 186, 239, .1);
  opacity: 0; transition: opacity .18s ease, background .18s ease;
  text-decoration: none !important;
}
.fgri-anchor svg { width: 15px; height: 15px; }
.fgri-anchor:hover { background: rgba(36, 186, 239, .2); }
h2:hover > .fgri-anchor, h3:hover > .fgri-anchor { opacity: 1; }
/* only show where the side gutter can hold it without causing overflow */
@media (hover: none), (max-width: 1040px) { .fgri-anchor { display: none; } }

/* ----------------------------------------------------------------------
   10. MOVIE REVIEWS (MAS Videos) - list, star ratings, review form.
      The review thread uses .commentlist / .comment-body (review.php override),
      so the blog comment card styling already applies; these add the bits
      unique to the movie review system.
   ---------------------------------------------------------------------- */
body.single-movie .masvideos-Reviews { margin: 14px 0 0; }

/* "نظرات کاربران" heading */
body.single-movie .masvideos-reviews__title {
  font-size: 21px !important; font-weight: 600 !important; color: #e7eaf2 !important;
  margin: 28px 0 18px !important; padding: 0 0 14px !important;
  border-bottom: 1px solid #262d3f;
}

/* the reviews list (MAS uses .commentlist, blog uses .comment-list) */
body.single-movie ol.commentlist,
body.single-movie ol.commentlist .children {
  list-style: none !important; margin: 0 !important; padding: 0 !important;
}
body.single-movie ol.commentlist .children { padding-right: 22px; margin-top: 16px; }
body.single-movie ol.commentlist > li.comment { margin: 0 0 16px !important; }

/* star rating */
.fgri-stars { display: inline-flex; align-items: center; gap: 1px; line-height: 1; }
.fgri-star { font-size: 0; }
.fgri-star::before { content: "★"; font-size: 14px; color: #39435a; }
.fgri-star.is-on::before { color: #f5b50a; }
.fgri-stars__num { font-size: 11.5px; color: #9aa3b8; margin-right: 6px; font-variant-numeric: tabular-nums; }

/* empty state */
body.single-movie .masvideos-noreviews {
  background: #161b27 !important; border: 1px dashed #2f3a50 !important; color: #9aa3b8 !important;
  border-radius: 12px; padding: 16px 18px; text-align: center;
}

/* review form - give it the same dark card as the blog comment respond box */
body.single-movie #review_form_wrapper {
  background: #161b27; border: 1px solid #262d3f; border-radius: 16px;
  padding: 22px 22px 24px; margin: 14px 0 30px;
}
body.single-movie #review_form_wrapper .comment-reply-title {
  font-size: 18px !important; font-weight: 600 !important; color: #e7eaf2 !important;
  margin: 0 0 14px !important; padding: 0 !important; display: block;
}
body.single-movie #review_form_wrapper .comment-reply-title::after { display: none !important; }

/* rating select in the review form */
body.single-movie .comment-form-rating { margin: 0 0 14px; }
body.single-movie .comment-form-rating label { display: block; font-size: 13px; color: #aeb6c8; margin-bottom: 7px; }
body.single-movie #commentform select,
body.single-movie .comment-form-rating select {
  background: #0f1320 !important; border: 1px solid #2a3142 !important; border-radius: 10px !important;
  color: #e7eaf2 !important; padding: 10px 14px !important; font-size: 14px !important; font-family: inherit !important;
  min-width: 130px; cursor: pointer;
}
body.single-movie #commentform select:focus {
  border-color: #24baef !important; outline: none !important; box-shadow: 0 0 0 3px rgba(36, 186, 239, .15) !important;
}

/* the social-share strip MAS appends under reviews - tidy spacing */
body.single-movie .masvideos-Reviews .share-text { color: #9aa3b8; font-size: 13px; margin: 22px 0 10px; }
