/**
 * KBM Core rc.176 — Featured Premium Card / Mobile Composition Authority
 * PEP-FEATURED-PREMIUM-CARD-MOBILE-COMPOSITION-AUTHORITY-176
 * Visual/composition only. Featured entitlement, ranking and payment logic stay in the rc175 contract now owned by rc176.
 */
:root{
  --kbm-f176-navy:#0b2a3b;
  --kbm-f176-navy-2:#123d55;
  --kbm-f176-yellow:#ffc400;
  --kbm-f176-yellow-soft:#fff5c4;
  --kbm-f176-cream:#fffdf7;
  --kbm-f176-line:#eadc9b;
  --kbm-f176-muted:#66758a;
  --kbm-f176-shadow:0 14px 34px rgba(11,42,59,.10);
}

/* -------------------------------------------------------------------------
 * Featured signature — physical top-right, compact and image-safe.
 * The old diagonal ribbon/pill composition is intentionally retired.
 * ---------------------------------------------------------------------- */
.kbm-card165__media,
.kbm-ads-recode-card-media,
.kbm-hust48-card__media,
.kbm-psu70-card__media,
.kbm-ad-single-recode-gallery-stage{position:relative}

.is-featured .kbm-f176-featured-mark,
.kbm-f176-featured-mark{
  position:absolute!important;
  top:0!important;
  right:0!important;
  bottom:auto!important;
  left:auto!important;
  width:46px!important;
  height:46px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  filter:none!important;
  pointer-events:none!important;
  overflow:hidden!important;
  z-index:40!important;
  transform:none!important;
}
.kbm-f176-featured-mark__corner{
  position:absolute!important;
  inset:0!important;
  display:flex!important;
  align-items:flex-start!important;
  justify-content:flex-end!important;
  box-sizing:border-box!important;
  padding:6px 7px 0 0!important;
  background:linear-gradient(145deg,#ffdc54 0%,var(--kbm-f176-yellow) 64%,#eeb300 100%)!important;
  color:var(--kbm-f176-navy)!important;
  border:0!important;
  border-radius:0 14px 0 0!important;
  clip-path:polygon(100% 0,100% 100%,0 0)!important;
  box-shadow:none!important;
  font:950 14px/1 Estedad,IRANSansX,system-ui,sans-serif!important;
}

.kbm-card165.is-featured:not(.is-expired),
.kbm-ads-recode-card.is-featured:not(.is-expired),
.kbm-hust48-card.is-featured,
.kbm-psu70-card.is-featured{
  border-color:#e0ba29!important;
}

/* -------------------------------------------------------------------------
 * Premium Featured Zone.
 * Header is deliberately one line: no redundant "انتخاب ویژه" kicker.
 * ---------------------------------------------------------------------- */
.kbm-f176-rail{
  position:relative;
  width:100%;
  margin:0 0 24px;
  padding:14px;
  box-sizing:border-box;
  border:1px solid rgba(224,186,41,.48);
  border-radius:20px;
  background:linear-gradient(180deg,var(--kbm-f176-cream) 0%,#fff 76%);
  box-shadow:0 10px 26px rgba(11,42,59,.045);
  overflow:hidden;
  direction:rtl;
}
.kbm-f176-rail__head{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:12px!important;
  margin:0 0 12px!important;
  padding:0 0 10px!important;
  border-bottom:1px solid rgba(11,42,59,.08)!important;
}
.kbm-f176-rail__head h2{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  margin:0!important;
  color:var(--kbm-f176-navy)!important;
  font:950 clamp(19px,2vw,27px)/1.45 Estedad,IRANSX,system-ui,sans-serif!important;
}
.kbm-f176-rail__head h2 i{
  width:28px;
  height:28px;
  flex:0 0 28px;
  display:grid;
  place-items:center;
  border-radius:9px;
  background:var(--kbm-f176-yellow);
  color:var(--kbm-f176-navy);
  font-style:normal;
  font-size:13px;
  box-shadow:0 4px 10px rgba(255,196,0,.20);
}
.kbm-f176-rail__actions{display:flex!important;align-items:center!important;gap:5px!important;direction:ltr}
.kbm-f176-rail__actions button{
  width:31px;height:31px;min-width:31px;padding:0;display:grid;place-items:center;
  border:1px solid rgba(11,42,59,.13);border-radius:9px;background:#fff;color:var(--kbm-f176-navy);
  cursor:pointer;font:900 15px/1 system-ui,sans-serif;
}
.kbm-f176-rail__actions button:focus-visible{outline:2px solid rgba(255,196,0,.42);outline-offset:2px}

/* Persistent Empty State */
.kbm-f176-empty{
  min-height:142px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;
  padding:18px 14px;box-sizing:border-box;border:1px dashed #e1c85e;border-radius:15px;
  background:linear-gradient(180deg,#fffef9,#fff);text-align:center;color:var(--kbm-f176-navy);
}
.kbm-f176-empty__icon{width:40px;height:40px;display:grid;place-items:center;border-radius:12px;background:#fff4bf;color:#906800;border:1px solid #efd05a;font-size:22px}
.kbm-f176-empty strong{font:900 14px/1.7 Estedad,IRANSX,system-ui,sans-serif}
.kbm-f176-empty p{max-width:560px;margin:0;color:var(--kbm-f176-muted);font:700 11.5px/1.9 Estedad,IRANSX,system-ui,sans-serif}
.kbm-f176-empty__cta{display:inline-flex;align-items:center;justify-content:center;min-height:35px;margin-top:3px;padding:0 14px;border-radius:10px;background:var(--kbm-f176-navy);color:#fff!important;text-decoration:none!important;font-size:11px;font-weight:900}

/* -------------------------------------------------------------------------
 * Carousel geometry.
 * 1 card = 100% width. 2+ cards = next card peeks on mobile.
 * ---------------------------------------------------------------------- */
.kbm-f176-splide{position:relative;direction:rtl;width:100%}
.kbm-f176-splide .splide__track{
  width:100%;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;
  scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;
}
.kbm-f176-splide .splide__track::-webkit-scrollbar{display:none}
.kbm-f176-splide .splide__list{
  width:100%;min-width:100%;display:flex!important;flex-wrap:nowrap!important;align-items:stretch!important;
  gap:12px!important;margin:0!important;padding:1px!important;list-style:none!important;direction:rtl!important;
}
.kbm-f176-splide .splide__slide{
  flex:0 0 clamp(320px,42vw,430px)!important;width:clamp(320px,42vw,430px)!important;max-width:430px!important;
  min-width:0!important;margin:0!important;scroll-snap-align:start;direction:rtl!important;box-sizing:border-box;
}
.kbm-f176-rail.is-single .splide__list{width:100%!important}
.kbm-f176-rail.is-single .splide__slide{flex:0 0 100%!important;width:100%!important;max-width:none!important}
.kbm-f176-splide__progress{width:min(170px,40%);height:3px;margin:11px auto 0;overflow:hidden;border-radius:999px;background:#e8e9ec}
.kbm-f176-splide__progress>span{display:block;width:0;height:100%;border-radius:inherit;background:var(--kbm-f176-yellow);transition:width .25s ease}
.kbm-f176-rail.is-single .kbm-f176-rail__actions,.kbm-f176-rail.is-single .kbm-f176-splide__progress{display:none!important}

/* -------------------------------------------------------------------------
 * Dedicated Featured Card Composition.
 * Data comes from each canonical vertical renderer; only composition changes.
 * ---------------------------------------------------------------------- */
.kbm-f176-premium-card{height:100%;min-width:0}
.kbm-f176-premium-card > :is(.kbm-ads-recode-card,.kbm-card165,.kbm-psu70-card){
  position:relative!important;
  display:flex!important;
  flex-direction:column!important;
  grid-template-columns:none!important;
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  overflow:hidden!important;
  border:1px solid #e0ba29!important;
  border-radius:18px!important;
  background:#fff!important;
  box-shadow:var(--kbm-f176-shadow)!important;
  transform:none!important;
}
.kbm-f176-premium-card > :is(.kbm-ads-recode-card,.kbm-card165,.kbm-psu70-card)::before{display:none!important}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-media,.kbm-card165__media,.kbm-psu70-card__media){
  display:block!important;position:relative!important;width:100%!important;height:210px!important;min-height:210px!important;max-height:210px!important;
  aspect-ratio:auto!important;overflow:hidden!important;border-radius:0!important;background:#eef3f7!important;grid-column:auto!important;grid-row:auto!important;
}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-media,.kbm-card165__media,.kbm-psu70-card__media) > img{
  display:block!important;width:100%!important;height:100%!important;min-height:100%!important;object-fit:cover!important;object-position:center!important;
}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-body,.kbm-card165__body){
  display:flex!important;flex:1!important;flex-direction:column!important;gap:8px!important;min-width:0!important;height:auto!important;min-height:138px!important;
  padding:12px 13px 13px!important;background:#fff!important;grid-column:auto!important;grid-row:auto!important;
}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-body,.kbm-card165__body)::before{
  content:"★ ویژه";align-self:flex-start;display:inline-flex;align-items:center;justify-content:center;min-height:23px;padding:0 8px;
  border:1px solid #efd15b;border-radius:999px;background:var(--kbm-f176-yellow-soft);color:#6f5200;
  font:900 10px/1 Estedad,IRANSX,system-ui,sans-serif;white-space:nowrap;
}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-title,.kbm-card165__title){
  margin:0!important;min-height:0!important;color:var(--kbm-f176-navy)!important;font-size:15px!important;line-height:1.7!important;font-weight:950!important;
  display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;
}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-title,.kbm-card165__title) a{color:var(--kbm-f176-navy)!important;text-decoration:none!important}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-meta,.kbm-card165__meta){display:flex!important;gap:5px!important;flex-wrap:wrap!important;max-height:54px!important;overflow:hidden!important}
.kbm-f176-premium-card :is(.kbm-ads-recode-chip,.kbm-card165__chip):nth-child(n+4){display:none!important}
.kbm-f176-premium-card .kbm-card165__rating{margin-top:0!important}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-foot,.kbm-card165__foot){
  display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:8px!important;
  margin-top:auto!important;padding-top:9px!important;border-top:1px solid #edf0f2!important;
}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-price,.kbm-card165__commercial){min-width:0!important;max-width:100%!important}
.kbm-f176-premium-card :is(.kbm-ads-recode-card-cta,.kbm-card165__cta){
  display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:82px!important;min-height:36px!important;padding:0 12px!important;
  border-radius:10px!important;background:var(--kbm-f176-navy)!important;color:#fff!important;text-decoration:none!important;font-size:11px!important;font-weight:900!important;box-shadow:none!important;
}

/* Hide the old rc174 rail if a legacy route still renders it. */
.kbm-ads-recode-section--featured[data-kbm-featured-reel]{display:none!important}

/* Single page: one compact corner signature, no body pill overlay. */
.kbm-ad-single-recode-gallery-stage>.kbm-f176-featured-mark{width:48px!important;height:48px!important}
.kbm-ad-single-recode-gallery-stage>.kbm-f176-featured-mark .kbm-f176-featured-mark__corner{font-size:15px!important}

@media(max-width:760px){
  .kbm-f176-rail{margin-bottom:18px;padding:10px;border-radius:17px}
  .kbm-f176-rail__head{margin-bottom:9px!important;padding-bottom:8px!important}
  .kbm-f176-rail__head h2{font-size:18px!important;line-height:1.45!important}
  .kbm-f176-rail__head h2 i{width:26px;height:26px;flex-basis:26px;font-size:12px}
  .kbm-f176-rail__actions button{width:29px;height:29px;min-width:29px;border-radius:8px;font-size:14px}

  .kbm-f176-rail.is-multi .splide__slide{flex:0 0 89%!important;width:89%!important;max-width:89%!important}
  .kbm-f176-rail.is-single .splide__slide{flex:0 0 100%!important;width:100%!important;max-width:100%!important}

  .kbm-f176-premium-card :is(.kbm-ads-recode-card-media,.kbm-card165__media,.kbm-psu70-card__media){height:168px!important;min-height:168px!important;max-height:168px!important}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-body,.kbm-card165__body){min-height:126px!important;padding:10px 11px 11px!important;gap:6px!important}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-body,.kbm-card165__body)::before{min-height:22px;padding:0 7px;font-size:9.5px}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-title,.kbm-card165__title){font-size:14px!important;line-height:1.65!important}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-meta,.kbm-card165__meta){max-height:48px!important}
  .kbm-f176-premium-card .kbm-card165__rating{display:none!important}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-foot,.kbm-card165__foot){padding-top:7px!important;gap:6px!important}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-cta,.kbm-card165__cta){min-height:34px!important;min-width:76px!important;padding:0 10px!important}

  .is-featured .kbm-f176-featured-mark,.kbm-f176-featured-mark{width:40px!important;height:40px!important}
  .kbm-f176-featured-mark__corner{padding:5px 6px 0 0!important;border-radius:0 12px 0 0!important;font-size:12px!important}
}

@media(max-width:380px){
  .kbm-f176-rail.is-multi .splide__slide{flex-basis:91%!important;width:91%!important;max-width:91%!important}
  .kbm-f176-premium-card :is(.kbm-ads-recode-card-media,.kbm-card165__media,.kbm-psu70-card__media){height:154px!important;min-height:154px!important;max-height:154px!important}
}

@media(prefers-reduced-motion:reduce){
  .kbm-f176-splide__progress>span{transition:none}
  .kbm-f176-splide .splide__track{scroll-behavior:auto}
}

/* Legacy featured visual firewall. */
body.kbm-ipui25 .is-featured .kbm-f176-featured-mark,
body.kbm-ipui25 .kbm-f176-featured-mark{background:transparent!important;color:inherit!important;border-color:transparent!important;box-shadow:none!important;filter:none!important}
body.kbm-ipui25 .kbm-f176-featured-mark__corner{background:linear-gradient(145deg,#ffdc54 0%,var(--kbm-f176-yellow) 64%,#eeb300 100%)!important;color:var(--kbm-f176-navy)!important;border:0!important;box-shadow:none!important}
