
/* injected by patch: cards progress + tags */
.hg-progress{position:relative;width:100%;height:4px;border-radius:999px;background:#e5e7eb;overflow:hidden}
.dark .hg-progress{background:#2b2b2b}
.hg-progress-bar{position:absolute;left:0;top:0;bottom:0;width:0;background:#E53945}
.hg-tag{background:#eef2f7;color:#1f2937;text-decoration:none}
.dark .hg-tag{background:#1f2937;color:#e5e7eb}

/* edge progress between cover and body */
.hg-progress-edge{position:relative;height:6px;background:#E5E7EB}
.dark .hg-progress-edge{background:#2b2b2b}
.hg-progress-edge .fill{position:absolute;left:0;top:0;bottom:0;background:#E53945;width:0}
.hg-divider{height:1px;background:rgba(0,0,0,0.06);margin-top:.75rem}
.dark .hg-divider{background:rgba(255,255,255,0.08)}
.hg-excerpt{font-size:.95rem;opacity:.9;margin-top:.35rem}
.hg-meta i{margin-inline-end:.35rem}
.hg-tag{background:#eef2f7;color:#1f2937;text-decoration:none}
.dark .hg-tag{background:#1f2937;color:#e5e7eb}

.hg-card-body{display:flex;flex-direction:column;gap:.5rem;min-height:190px}
.hg-top{display:block}
.hg-bottom{margin-top:auto}
.hg-title{font-weight:800;font-size:1.05rem;line-height:1.3;margin:.25rem 0}
.hg-excerpt{margin:.35rem 0 0 0;font-size:.95rem;opacity:1;color:inherit}
.dark .hg-excerpt{color:#cfd8e3}
.hg-meta{display:flex;align-items:center;gap:1rem;font-size:.85rem;opacity:.95;color:#374151}
.dark .hg-meta{color:#cfd8e3}
.hg-divider{height:1px;background:rgba(0,0,0,.06);margin:.6rem 0 .5rem}
.dark .hg-divider{background:rgba(255,255,255,.08)}
.hg-tags{display:flex;gap:.5rem;flex-wrap:wrap}
.hg-tag{font-size:.8rem;padding:.25rem .55rem;border-radius:999px;background:#eef2f7;color:#1f2937;text-decoration:none}
.dark .hg-tag{background:#1f2937;color:#e5e7eb}

/* Bottom pin */
.hg-card-body{display:flex;flex-direction:column;gap:.5rem;min-height:200px}
.hg-bottom{margin-top:auto}
/* Meta row ordering for AR */
.hg-meta{display:flex;align-items:center;gap:1rem;font-size:.85rem;opacity:.95}
.hg-meta [data-lang="en"][data-role="date"]{margin-left:auto}
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-left:0}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-left:auto}
/* One-line tags with auto shrink */
.hg-tags{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hg-tags .hg-tag{display:inline-block;margin-right:.4rem;margin-bottom:0}
.hg-tags.fit-small .hg-tag{font-size:.72rem;padding:.2rem .45rem}
.hg-tags.fit-smaller .hg-tag{font-size:.66rem;padding:.18rem .4rem}
.hg-tags.fit-tiny .hg-tag{font-size:.6rem;padding:.15rem .35rem}

/* Pin bottom using grid so caption length doesn't move it */
.hg-card-body{display:grid;grid-template-rows:1fr auto;min-height:220px}
.hg-top{min-height:0}
.hg-excerpt{ display:-webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6;-webkit-box-orient:vertical;overflow:hidden}
/* Meta row: mirror in AR (date left, duration right) */
.hg-meta{display:flex;align-items:center;gap:1rem}
.hg-meta [data-lang="en"][data-role="date"]{margin-left:auto}
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-left:0}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-left:auto}
/* Tags single line + auto shrink */
.hg-tags{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hg-tags .hg-tag{display:inline-block;margin-right:.35rem;margin-bottom:0;font-size:.78rem;padding:.22rem .5rem}
.hg-tags.fit-small .hg-tag{font-size:.72rem;padding:.2rem .45rem}
.hg-tags.fit-smaller .hg-tag{font-size:.66rem;padding:.18rem .4rem}
.hg-tags.fit-tiny .hg-tag{font-size:.6rem;padding:.15rem .35rem}

.hg-card{display:flex;flex-direction:column}
.hg-card .aspect-square{width:100%}
.hg-card .hg-card-body{display:grid;grid-template-rows:minmax(0,1fr) auto;min-height:260px}

/* === Strong bottom pin === */
.hg-card{display:flex;flex-direction:column;height:100%}
.hg-card .hg-card-body{display:flex;flex-direction:column;flex:1;min-height:300px}
.hg-bottom{margin-top:auto}
/* Meta row: Arabic mirroring */
.hg-meta{display:flex;align-items:center;gap:1rem}
.hg-meta [data-lang="en"][data-role="date"]{margin-left:auto}
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-left:0}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-left:auto}
/* One-line tag row */
.hg-tags{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hg-tag{display:inline-block;margin-right:.35rem;margin-bottom:0;font-size:.72rem;padding:.18rem .42rem;border-radius:999px}
/* shrinking buckets (used by JS or fallback classes) */
.hg-tags.tfit-1 .hg-tag{font-size:.68rem;padding:.16rem .38rem}
.hg-tags.tfit-2 .hg-tag{font-size:.63rem;padding:.14rem .34rem}
.hg-tags.tfit-3 .hg-tag{font-size:.58rem;padding:.12rem .3rem}
.hg-tags.tfit-4 .hg-tag{font-size:.52rem;padding:.1rem .26rem}

/* --- Consistent card height per row --- */
.hg-card{display:flex;flex-direction:column;height:100%;min-height:500px}
@media (min-width:640px){ .hg-card{min-height:520px} }
@media (min-width:1024px){ .hg-card{min-height:560px} }
.hg-card .hg-card-body{display:flex;flex-direction:column;flex:1;min-height:320px}
.hg-bottom{margin-top:auto}

/* Meta row Arabic mirroring (kept) */
.hg-meta{display:flex;align-items:center;gap:1rem}
.hg-meta [data-lang="en"][data-role="date"]{margin-left:auto}
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-left:0}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-left:auto}

/* One-line tags + more levels */
.hg-tags{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hg-tag{display:inline-block;margin-right:.35rem;margin-bottom:0;font-size:.7rem;padding:.18rem .42rem;border-radius:999px}
.hg-tags.tfit-1 .hg-tag{font-size:.66rem;padding:.16rem .38rem}
.hg-tags.tfit-2 .hg-tag{font-size:.62rem;padding:.15rem .36rem}
.hg-tags.tfit-3 .hg-tag{font-size:.58rem;padding:.14rem .34rem}
.hg-tags.tfit-4 .hg-tag{font-size:.54rem;padding:.13rem .32rem}
.hg-tags.tfit-5 .hg-tag{font-size:.50rem;padding:.12rem .30rem}
.hg-tags.tfit-6 .hg-tag{font-size:.46rem;padding:.10rem .28rem}

/* Title/Caption clamps to prevent overflow */
.hg-title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.hg-excerpt{-webkit-line-clamp:2}

/* Stronger bottom pin with safe max height avoidance via clamps */
.hg-card .hg-card-body{min-height:340px}

/* AR logical mirroring for meta row */
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-inline-start:0;margin-inline-end:auto}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-inline-start:auto;margin-inline-end:0}

/* === v17: Force single-line scrollable tags === */
.hg-tags{flex-wrap:nowrap !important; white-space:nowrap !important; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch; scrollbar-width:none; -ms-overflow-style:none;}
.hg-tags::-webkit-scrollbar{display:none}
.hg-tags .hg-tag{white-space:nowrap; word-break:keep-all; overflow-wrap:normal; flex:0 0 auto;}

/* === HG v18: Stable bottom grid + strict meta alignment + scroll tags === */
/* Pin card bottom */
.hg-card{display:flex;flex-direction:column;height:100%}
.hg-card .hg-card-body{display:flex;flex-direction:column;flex:1;min-height:340px}
.hg-bottom{margin-top:auto;display:grid;grid-template-rows:auto 1px auto;row-gap:.5rem}

/* Meta row */
.hg-meta{display:flex;align-items:center;gap:1rem}
/* EN: duration left, date right */
.hg-meta [data-lang="en"][data-role="dur"]{order:1}
.hg-meta [data-lang="en"][data-role="date"]{order:2;margin-left:auto !important;margin-right:0 !important}
/* AR: date left, duration right (mirror exactly) */
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-left:0 !important;margin-right:auto !important}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-left:auto !important;margin-right:0 !important}

/* Divider sits in row 2 of grid (height handled by element itself) */
.hg-divider{height:1px;background:rgba(0,0,0,.08)}
.dark .hg-divider{background:rgba(255,255,255,.12)}

/* Tags row: single line, horizontal scroll (no bar), pretty chips */
.hg-tags{grid-row:3;flex-wrap:nowrap !important;white-space:nowrap !important;overflow-x:auto;overflow-y:hidden;
  -webkit-overflow-scrolling:touch;scrollbar-width:none;-ms-overflow-style:none;padding:.05rem .25rem .15rem;gap:.5rem;display:flex;align-items:center}
.hg-tags::-webkit-scrollbar{display:none}
.hg-tag{display:inline-block;flex:0 0 auto;white-space:nowrap;word-break:keep-all;overflow-wrap:normal;
  padding:.42em .85em;border-radius:999px;border:1px solid rgba(0,0,0,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.8));box-shadow:0 1px 2px rgba(0,0,0,.04);font-size:.9rem;line-height:1}
.dark .hg-tag{border-color:rgba(255,255,255,.12);background:linear-gradient(180deg, rgba(31,41,55,.9), rgba(31,41,55,.8));color:#e5e7eb;box-shadow:0 1px 2px rgba(0,0,0,.25)}
.hg-tag:hover{filter:brightness(.98);transform:translateY(-1px);transition:transform .15s ease, filter .15s ease}

/* === HG v24: smaller tag font + balanced divider + tags hug bottom === */

/* Pin bottom and normalize internal spacing */
.hg-card{display:flex;flex-direction:column;height:100%}
.hg-card .hg-card-body{display:flex;flex-direction:column;flex:1;padding-bottom:0 !important}
.hg-bottom{margin-top:auto; padding:.12rem .75rem .06rem .75rem !important; row-gap:.48rem !important}

/* Meta row (keep existing alignment rules) */
.hg-meta{display:flex;align-items:center;gap:1rem}
.hg-meta [data-lang="en"][data-role="dur"]{order:1}
.hg-meta [data-lang="en"][data-role="date"]{order:2;margin-left:auto !important}
.hg-meta [data-lang="ar"][data-role="date"]{order:1;margin-right:auto !important}
.hg-meta [data-lang="ar"][data-role="dur"]{order:2;margin-left:auto !important}

/* Divider with symmetric margins */
.hg-divider{height:1px;background:rgba(0,0,0,.12);margin:.40rem 0 .40rem 0 !important}
.dark .hg-divider{background:rgba(255,255,255,.16)}

/* Tags: single-line scroll + low position + compact chips */
.hg-tags{display:flex;align-items:center;gap:.32rem;white-space:nowrap!important;flex-wrap:nowrap!important;
  overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:none;-ms-overflow-style:none;
  margin:0!important;padding:.04rem 0 0 0!important;touch-action:pan-x;scroll-snap-type:x proximity;
  -webkit-mask-image:linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
          mask-image:linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.hg-tags::-webkit-scrollbar{display:none}

/* Tag chips centered & compact */
.hg-tags .hg-tag,.hg-tags a.hg-tag,.hg-tags span.hg-tag,.hg-tags button.hg-tag{
  display:inline-flex;align-items:center;justify-content:center;
  font-size:.72rem !important;min-height:24px !important;line-height:1 !important;
  padding:.22em .50em !important;border-radius:999px !important;
  border:1px solid rgba(0,0,0,.22) !important;background:#fff !important;color:inherit !important;
  box-shadow:0 1px 1px rgba(0,0,0,.05) !important;scroll-snap-align:start !important;
  transition:background-color .18s,border-color .18s,transform .18s,box-shadow .18s !important;
}
.dark .hg-tags .hg-tag{border-color:rgba(255,255,255,.22)!important;background:rgba(31,41,55,.92)!important;color:#e5e7eb!important}
.hg-tags .hg-tag:hover{background:#f3f4f6 !important;transform:translateY(-.5px)!important}
.dark .hg-tags .hg-tag:hover{background:rgba(55,65,81,.96)!important}

/* === HG v25: more space between divider & tags + tags closer to bottom edge === */
/* Bring bottom block as low as possible */
.hg-card .hg-card-body{padding-bottom:0 !important}
.hg-bottom{margin-top:auto; padding:.10rem .75rem 0rem .75rem !important}

/* Divider: add modest space below, keep some above for rhythm */
.hg-divider{height:1px; background:rgba(0,0,0,.12); margin:.45rem 0 .28rem 0 !important}
.dark .hg-divider{background:rgba(255,255,255,.16)}

/* Tags: create clear top gap from divider, but keep near bottom (no extra bottom padding) */
.hg-tags{margin-top:.50rem !important; margin-bottom:0 !important; padding:0 !important}
/* Keep chip centering from previous versions */
.hg-tags .hg-tag, .hg-tags a.hg-tag, .hg-tags span.hg-tag, .hg-tags button.hg-tag{
  display:inline-flex; align-items:center; justify-content:center;
}

/* === HG v26: meta closer to divider + unified EN/AR alignment (time left, date right) === */
/* Meta row: same alignment in both languages */
.hg-meta{display:flex;align-items:center;gap:.75rem;margin:.35rem 0 .20rem 0 !important}
.hg-meta [data-role="dur"]{order:1 !important;margin-left:0 !important;margin-right:0 !important}
.hg-meta [data-role="date"]{order:2 !important;margin-left:auto !important;margin-right:0 !important}
/* Reset any old language-specific rules */
.hg-meta [data-lang="ar"][data-role="date"],
.hg-meta [data-lang="ar"][data-role="dur"]{float:none !important}

/* Divider: closer to meta (top), bigger space to tags (bottom kept by tags margin) */
.hg-divider{margin:.20rem 0 .50rem 0 !important}

/* === HG v27: rectangular rounded chips + refined palette (no '#') === */

/* Design tokens for chip colors */
:root{
  --hg-chip-bg: #f6f8fb;
  --hg-chip-border: rgba(0,0,0,.18);
  --hg-chip-hover: #eef2f7;
  --hg-chip-text: inherit;
  --hg-chip-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.dark{
  --hg-chip-bg: rgba(31,41,55,.92);
  --hg-chip-border: rgba(255,255,255,.22);
  --hg-chip-hover: rgba(55,65,81,.96);
  --hg-chip-text: #e5e7eb;
  --hg-chip-shadow: 0 1px 2px rgba(0,0,0,.45);
}

/* Chip shape + alignment (rectangular with rounded corners) */
.hg-tags .hg-tag, .hg-tags a.hg-tag, .hg-tags span.hg-tag, .hg-tags button.hg-tag{
  display:inline-flex; align-items:center; justify-content:center;
  font-size:.72rem !important; min-height:24px !important; line-height:1 !important;
  padding:.24em .62em !important;
  border-radius:10px !important;                 /* rectangle with rounded corners */
  border:1px solid var(--hg-chip-border) !important;
  background: var(--hg-chip-bg) !important;
  color: var(--hg-chip-text) !important;
  box-shadow: var(--hg-chip-shadow) !important;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease !important;
}
.hg-tags .hg-tag:hover{ background: var(--hg-chip-hover) !important; transform: translateY(-.5px) !important; }
.hg-tags .hg-tag:active{ transform: translateY(0) !important; box-shadow:none !important; }
.hg-tags .hg-tag:focus{ outline:2px solid rgba(59,130,246,.5) !important; outline-offset:2px !important; }
.dark .hg-tags .hg-tag:focus{ outline-color: rgba(96,165,250,.6) !important; }

/* === HG v28: Aesthetic tag chips + no fade overlay === */
/* Remove any gradient mask (left transparency) from tags row */
.hg-tags{
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

/* Compact, modern rounded-rectangle chips with soft color variants */
:root{
  --chip-radius: 12px;
  --chip-padding-y: .26em;
  --chip-padding-x: .70em;
  --chip-font: .72rem;
  --chip-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.hg-tags .hg-tag,
.hg-tags a.hg-tag,
.hg-tags span.hg-tag,
.hg-tags button.hg-tag{
  display:inline-flex; align-items:center; justify-content:center;
  font-size: var(--chip-font) !important;
  line-height: 1 !important;
  min-height: 24px !important;
  padding: var(--chip-padding-y) var(--chip-padding-x) !important;
  border-radius: var(--chip-radius) !important;
  border: 1px solid transparent !important;
  box-shadow: var(--chip-shadow) !important;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, color .16s ease;
}

/* Color variants (light mode) */
.hg-variant-0{ background:#eef5ff !important; color:#0b3b74 !important; border-color:#c8ddff !important; }
.hg-variant-0:hover{ background:#e4efff !important; }
.hg-variant-1{ background:#eefcf7 !important; color:#05583a !important; border-color:#c9f2e1 !important; }
.hg-variant-1:hover{ background:#e3f9f0 !important; }
.hg-variant-2{ background:#fff6ef !important; color:#7a3510 !important; border-color:#ffe1cc !important; }
.hg-variant-2:hover{ background:#ffeedf !important; }
.hg-variant-3{ background:#f9f0ff !important; color:#5a217a !important; border-color:#ead4ff !important; }
.hg-variant-3:hover{ background:#f3e6ff !important; }
.hg-variant-4{ background:#fff1f3 !important; color:#7a1f36 !important; border-color:#ffd6dd !important; }
.hg-variant-4:hover{ background:#ffe7ec !important; }
.hg-variant-5{ background:#f3f7ff !important; color:#253b7a !important; border-color:#d7e0ff !important; }
.hg-variant-5:hover{ background:#e9efff !important; }

/* Dark mode variants */
.dark .hg-variant-0{ background:#1d2a44 !important; color:#cfe2ff !important; border-color:#2a3a5e !important; }
.dark .hg-variant-0:hover{ background:#213153 !important; }
.dark .hg-variant-1{ background:#16372a !important; color:#c8f5e5 !important; border-color:#1f4b3a !important; }
.dark .hg-variant-1:hover{ background:#194030 !important; }
.dark .hg-variant-2{ background:#402611 !important; color:#ffd9bf !important; border-color:#573419 !important; }
.dark .hg-variant-2:hover{ background:#4a2c14 !important; }
.dark .hg-variant-3{ background:#2c1a3b !important; color:#edd6ff !important; border-color:#3b2451 !important; }
.dark .hg-variant-3:hover{ background:#341f45 !important; }
.dark .hg-variant-4{ background:#3a1824 !important; color:#ffd9e1 !important; border-color:#4e2030 !important; }
.dark .hg-variant-4:hover{ background:#431d2b !important; }
.dark .hg-variant-5{ background:#1a2445 !important; color:#dfe6ff !important; border-color:#233059 !important; }
.dark .hg-variant-5:hover{ background:#1f2b52 !important; }

/* === HG v29: micro-interactions & scroll affordance === */

/* Card hover lift + smooth */
.hg-card.hg-anim{
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  content-visibility: auto;
}
.hg-card.hg-anim:hover{ transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.08); }
@media (prefers-reduced-motion: reduce){
  .hg-card:not(.hg-anim), .hg-card:not(.hg-anim) *{ transition: none !important }
}

/* Cover zoom on hover */
.hg-cover img{
  transition: transform .35s ease;
  will-change: transform;
}
.hg-card.hg-anim:hover .hg-cover img{ transform: scale(1.035) }

/* "Playing" state (when play button clicked) */
.hg-card.is-playing{
  border-color: rgba(239,68,68,.45) !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.15), 0 14px 28px rgba(0,0,0,.12) !important;
  transform: translateY(-2px);
}

/* Tag chips: crisper hover feedback */
.hg-tags .hg-tag{
  will-change: transform, box-shadow;
}
.hg-tags .hg-tag:hover{
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 12px rgba(0,0,0,.08);
}

/* Scroll affordance without fades: slight negative left inset for first chip + right spacer */
.hg-tags{ padding-inline: .35rem !important; }
.hg-tags .hg-tag:first-child{ margin-left: .1rem !important; }
.hg-tags::after{ content:''; flex:0 0 .35rem; }


/* === HG v30 additions === */
/* Nav arrows for card grid (desktop only) */
@media (min-width: 768px){
  .card-grid-container{ position:relative; }
  .card-grid{ scroll-behavior:smooth; -ms-overflow-style: none; scrollbar-width: none; }
  .card-grid::-webkit-scrollbar{ display:none; }
  .nav-arrow{
    position:absolute; top:50%; transform:translateY(-50%);
    width:40px; height:40px; border-radius:9999px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    display:flex; align-items:center; justify-content:center;
    z-index: 5; cursor:pointer; transition: transform .2s ease, opacity .2s ease, background .2s ease;
    opacity:1;
  }
  .nav-arrow:hover{ transform: translateY(-50%) scale(1.08); background: rgba(255,255,255,1); }
  .nav-arrow.left{ left:10px; }
  .nav-arrow.right{ right:10px; }
  .nav-arrow i{ pointer-events:none; }
  .dark .nav-arrow{ background: rgba(18,18,18,0.9); }
  .dark .nav-arrow:hover{ background: rgba(18,18,18,1); }
}
@media (max-width: 767.98px){
  .nav-arrow{ display:none !important; }
}

/* Tag row fade affordances */
.hg-tags{ position:relative; overflow-x:auto; -webkit-overflow-scrolling: touch; }
.hg-tags::-webkit-scrollbar{ display:none; }
.hg-tags-fade{
  position:absolute; top:0; bottom:0; width:28px;
  pointer-events:none;
  background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
  opacity:0; transition: opacity .2s ease;
}
.hg-tags-fade-left{ left:0; }
.hg-tags-fade-right{ right:0; transform: scaleX(-1); } /* reuse same gradient */
.dark .hg-tags-fade{ background: linear-gradient(to right, rgba(18,18,18,1) 0%, rgba(18,18,18,0) 100%); }


/* v31: Fixed card dimensions opt-in (tied to body[data-hg-fixed="1"]) */
body[data-hg-fixed="1"] article.hg-card{ width: 320px; min-height: 560px; }
body[data-hg-fixed="1"] .hg-card .aspect-square{ width: 100%; }


/* v31.2 layout tweaks */
.hg-bottom{ margin-top:auto; padding-bottom:0.75rem; }
.hg-tags{ margin-top:0.5rem; }
article.hg-card .hg-tags{ position:relative; }


/* v31.3 caption & spacing fixes */
.hg-excerpt{
  display:block;
  overflow:visible;
  -webkit-line-clamp:unset;
}
article.hg-card .hg-card-body{ padding-bottom: 1rem !important; }
article.hg-card .hg-bottom{ padding-bottom: .5rem; }
article.hg-card .hg-tags{ margin-top: .6rem; padding-bottom: .25rem; }


/* v31.4: card sizing to match reference HTML */
/* Desktop: cards are 300px wide inside grids */
@media (min-width: 768px){
  .card-grid > article.hg-card,
  .card-grid .hg-card{
    flex: 0 0 300px;
    width: 300px;
  }
}

/* 9:16 aspect ratio for video covers */
.aspect-9-16{
  position: relative;
  padding-bottom: 177.78%;
  height: 0;
  overflow: hidden;
}
.aspect-9-16 > .hg-cover{ position:absolute; inset:0; width:100%; height:100%; }
.aspect-9-16 img{ width:100%; height:100%; object-fit:cover; }

/* Clamp titles/excerpts with ellipsis so card height won't grow */
.hg-title{
  display:-webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.hg-excerpt{ display:-webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6;
  overflow: hidden;
}

/* Keep bottom area spacing healthy */
article.hg-card .hg-card-body{ padding-bottom: 1rem !important; }
article.hg-card .hg-bottom{ padding-bottom: .5rem; }
article.hg-card .hg-tags{ margin-top: .6rem; padding-bottom: .25rem; }


/* v31.5: Taller cards for See Gaza and more caption room */
#see article.hg-card{ min-height: 760px; }
/* Keep width 300 in grids */
#see .card-grid > article.hg-card{ flex:0 0 300px; width:300px; }
/* Ensure body area can grow within fixed min-height */
#see article.hg-card .hg-card-body{ min-height: 420px; }


/* v31.8: See Gaza excerpt uses more lines (override any defaults) */
#see article.hg-card .hg-excerpt{
  -webkit-line-clamp: 12 !important;
}
#see article.hg-card{ min-height: 800px; }
#see article.hg-card .hg-card-body{ min-height: 460px; }


/* v32.0: Meta alignment per language (EN: date left, dur right) (AR: reverse) */
.hg-meta{display:flex;align-items:center;gap:1rem}
.hg-meta .hg-meta-item[data-role="date"][data-lang="en"]{order:1;margin-inline-start:0}
.hg-meta .hg-meta-item[data-role="dur"][data-lang="en"]{order:3;margin-inline-start:auto}
.hg-meta .hg-meta-item[data-role="dur"][data-lang="ar"]{order:1;margin-inline-start:0}
.hg-meta .hg-meta-item[data-role="date"][data-lang="ar"]{order:3;margin-inline-start:auto}


/* v32.0: Read Gaza slider */
#read .hg-cover{position:relative}
#read .hg-cover .hg-slider{position:absolute; inset:0; width:100%; height:100%; overflow:hidden}
#read .hg-cover .hg-slider img{position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition:opacity .35s ease}
#read .hg-cover .hg-slider img.active{opacity:1}
#read .hg-cover .hg-slide-btn{
  position:absolute; top:50%; transform:translateY(-50%); width:36px; height:36px;
  border-radius:999px; border:none; display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.45); color:white; cursor:pointer
}
#read .hg-cover .hg-slide-btn.prev{left:8px}
#read .hg-cover .hg-slide-btn.next{right:8px}

/* === v34: Mobile card width fit for See Gaza & Read Gaza (match Hear Gaza behavior) === */
@media (max-width: 767.98px){
  /* Make cards span the viewport width minus the section padding (.px-4 = 1rem each side) */
  #see .card-grid > article.hg-card,
  #read .card-grid > article.hg-card{
    flex: 0 0 calc(100vw - 2rem);
    width: calc(100vw - 2rem);
  }

  /* Reduce very tall min-heights on mobile for See Gaza cards */
  #see article.hg-card{
    min-height: 640px !important;
  }
  #see article.hg-card .hg-card-body{
    min-height: 380px !important;
  }

  /* Ensure inner cover blocks stretch fully */
  #see .aspect-9-16,
  #read .aspect-9-16,
  #read .hg-cover,
  #see .hg-cover{
    width: 100%;
  }
}

/* === v35: Mobile card width exact fit (subtracts grid gap) === */
@media (max-width: 767.98px){
  /* Card takes full viewport width minus section padding (.px-4 = 1rem*2) and minus grid gap (.gap-4 = 1rem) */
  #see .card-grid > article.hg-card,
  #read .card-grid > article.hg-card{
    flex: 0 0 calc(100vw - 2rem - 1rem) !important;
    width: calc(100vw - 2rem - 1rem) !important;
  }

  /* Optional: ensure the first item starts flush left */
  #see .card-grid, #read .card-grid{
    scroll-padding-left: 0;
  }

  /* Tweak min-heights to more reasonable values on mobile */
  #see article.hg-card{ min-height: 640px !important; }
  #see article.hg-card .hg-card-body{ min-height: 380px !important; }
}

/* === v36: Mobile cards fill container width using min-width:100% === */
@media (max-width: 767.98px){
  /* Force each card to occupy full width of the scroll container (container has its own padding) */
  #see .card-grid > article.hg-card,
  #read .card-grid > article.hg-card{
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 100% !important;
  }
}

/* === HG v47: Robust RTL row-reverse + init at visual start === */
@media (min-width: 768px){
  .card-grid-container{ position: relative; }
  .nav-arrow{
    position:absolute; top:50%; transform: translateY(-50%);
    width:40px; height:40px; border-radius:50%;
    background: rgba(255,255,255,0.8);
    display:flex; align-items:center; justify-content:center;
    cursor:pointer; z-index:10;
    box-shadow:0 2px 5px rgba(0,0,0,.2);
    transition: transform .3s ease, background .2s ease;
    color:#333;
  }
  .nav-arrow:hover{ background:#fff; transform: translateY(-50%) scale(1.1); }
  .nav-arrow.left{ left:10px; }
  .nav-arrow.right{ right:10px; }
  .nav-arrow i{ font-size:1.2rem; color: inherit; }
}
@media (max-width: 767.98px){ .nav-arrow{ display:none !important; } }

.dark .nav-arrow, [data-theme="dark"] .nav-arrow{ background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.92); }
.dark .nav-arrow:hover, [data-theme="dark"] .nav-arrow:hover{ background: rgba(255,255,255,0.22); transform: translateY(-50%) scale(1.1); }


/* === HG slider (cards) === */
.hg-cover{position:relative}
.hg-slider{position:absolute;inset:0;z-index:2;display:block}
.hg-slider-track{display:flex;width:100%;height:100%;overflow:hidden;touch-action:pan-y;user-select:none}
.hg-slide-img{flex:0 0 100%;width:100%;height:100%;object-fit:cover;pointer-events:none}
.hg-slider-prev,.hg-slider-next{position:absolute;top:50%;transform:translateY(-50%);border:0;outline:0;width:36px;height:36px;border-radius:999px;background:rgba(0,0,0,.45);color:#fff;font-size:22px;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer}
.hg-slider-prev{left:.5rem}
.hg-slider-next{right:.5rem}
.hg-slider-prev[disabled],.hg-slider-next[disabled]{opacity:.4;cursor:default}
@media (hover:hover){
  .hg-slider-prev,.hg-slider-next{opacity:0;transition:opacity .2s ease}
  .hg-slider:hover .hg-slider-prev,.hg-slider:hover .hg-slider-next{opacity:1}
}


/* Story slider styles (from design spec) */
.story-slider { scrollbar-width: none; -ms-overflow-style: none; }
.story-slider::-webkit-scrollbar { display: none; }
@media (min-width: 768px) {
  .story-slider-container { position: relative; }
  .story-nav-arrow { position: absolute; width: 24px; height: 24px; background: rgba(255,255,255,0.3); border-radius: 2px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: all 0.2s ease; color: rgba(0,0,0,0.7); }
  .story-nav-arrow:hover { background: rgba(255,255,255,0.5); }
  .story-nav-arrow.left { left: 10px; top: 50%; transform: translateY(-50%); }
  .story-nav-arrow.right { right: 10px; top: 50%; transform: translateY(-50%); }
  .story-nav-arrow i { font-size: 1rem; }
}


/* aspect-square fix */
.aspect-square{
  position: relative;
  padding-bottom: 100%;
  height: 0;
  overflow: hidden;
}
.aspect-square > .hg-cover{ position:absolute; inset:0; width:100%; height:100%; }
.aspect-square img{ width:100%; height:100%; object-fit:cover; }


/* Keep AR dots LTR to match left->right swipe progression */
.story-slider-container[data-lang="ar"] .rg-dots{ direction:ltr; }


/* --- Pin bottom meta/divider/tags to the card's bottom --- */
.card-grid .hg-card{
  display:flex;
  flex-direction:column;
}
.hg-card .rg-square-wrap{ flex:0 0 auto; }
.hg-card-body{
  display:flex;
  flex-direction:column;
  flex:1 1 auto; /* fill remaining height so bottom can stick */
}
.hg-card-body .hg-top{ flex:1 1 auto; }
.hg-card-body .hg-bottom{ margin-top:auto; }


/* === ReadGaza card body layout: all body for caption; bottom pinned (match reference) === */
.card-grid .hg-card{ display:flex; flex-direction:column; }
.hg-card .rg-square-wrap{ flex:0 0 auto; }

.hg-card-body{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;           /* fill remaining height under image */
  min-height: 180px;       /* keep room for caption on short posts */
}

.hg-card-body .hg-top{
  display:flex;
  flex-direction:column;
  gap: .5rem;              /* space between title and caption */
  flex:1 1 auto;           /* take all available vertical space */
  overflow:hidden;
}

.hg-card-body .hg-top .hg-title{ margin: 0; }
.hg-card-body .hg-top .hg-excerpt{
  flex:1 1 auto;           /* caption grows to occupy body */
  margin: 0;               /* no extra bottom margin to push bottom up */
  overflow: hidden;
  text-overflow: ellipsis;
}

.hg-card-body .hg-bottom{
  margin-top:auto;         /* stick to the bottom */
}

.hg-card-body .hg-bottom .hg-meta{ margin: 0 0 .5rem 0; }
.hg-card-body .hg-bottom .hg-divider{ margin: .25rem 0; }
.hg-card-body .hg-bottom .hg-tags{ margin-top:.5rem; margin-bottom:0; }


/* === v60 custom override: Read Gaza taller cards & longer captions === */
#read article.hg-card .hg-excerpt{
  -webkit-line-clamp: 12 !important;
}
#read article.hg-card .hg-card-body{
  min-height: 460px !important;
}
#read article.hg-card{
  min-height: 800px !important;
}


/* === v61 HEARGAZA: force meta (date/divider/time/tags) to stick to bottom on Hear Gaza cards === */
#hear article.hg-card{ display:flex !important; flex-direction:column !important; }
#hear article.hg-card .hg-card-body{ display:flex !important; flex-direction:column !important; min-height: 320px !important; }
#hear article.hg-card .hg-bottom{ margin-top:auto !important; }
#hear article.hg-card .hg-bottom .hg-divider{ margin-top:.5rem !important; }



/* === v61.1 HEARGAZA: enforce fixed bottom by constraining caption and heights === */
#hear article.hg-card{ display:flex !important; flex-direction:column !important; min-height: 560px !important; }
#hear article.hg-card .hg-card-body{ display:flex !important; flex-direction:column !important; min-height: 360px !important; }
#hear article.hg-card .hg-top{ flex: 0 0 auto !important; }
#hear article.hg-card .hg-excerpt{ display:-webkit-box !important; -webkit-line-clamp: 6 !important; -webkit-box-orient: vertical !important; overflow:hidden !important; }
#hear article.hg-card .hg-bottom{ margin-top:auto !important; }
#hear article.hg-card .hg-bottom .hg-divider{ margin-top:.5rem !important; margin-bottom:.5rem !important; }



/* === v61.2 HEARGAZA: broaden selectors to work even if <article> lacks .hg-card === */
#hear .card-grid > article{ display:flex !important; flex-direction:column !important; }
#hear .card-grid > article .hg-card-body{ display:flex !important; flex-direction:column !important; }
#hear .card-grid > article .hg-bottom{ margin-top:auto !important; }
#hear .card-grid > article .hg-bottom .hg-divider{ margin-top:.5rem !important; margin-bottom:.5rem !important; }



/* === HG ARFIX8: header-embedded chips for Hear Gaza archive === */
body.post-type-archive-hg_podcast #primary{ padding-top: calc(var(--hg-header-height, 120px) + 8px) !important; }
.hg-header-chips{ background: transparent; }
.dark .hg-header-chips{ background: transparent; }
.hg-header-chips .lang-en .inline-flex,
.hg-header-chips .lang-ar .inline-flex{ background:#1f2937; color:#e5e7eb; }
.dark .hg-header-chips .inline-flex{ background:#1f2937; color:#e5e7eb; }



/* === v61.8: Match archive/tag Hear Gaza cards height to home (#hear) ===
   - Keep total card min-height ≈ 560px (same as #hear)
   - Use smaller body min-height (≈ 240px) so image (1:1, ~320px) + body align exactly like home
*/
body.post-type-archive-hg_podcast article.hg-card,
body.post-type-archive-hg_video article.hg-card,
body.tax-hg_tag article.hg-card {
  min-height: 560px !important; /* match home card shell */
}
body.post-type-archive-hg_podcast article.hg-card .hg-card-body,
body.post-type-archive-hg_video article.hg-card .hg-card-body,
body.tax-hg_tag article.hg-card .hg-card-body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 300px !important; /* match home content area */
}

/* === v61.9: Chips bar RTL alignment === */
.hg-header-chips ul.lang-ar{ justify-content: flex-end; direction: rtl; }
.hg-header-chips ul.lang-en{ direction: ltr; }

/* === Force LTR scrolling for content rows under RTL locales === */
[dir="rtl"] .card-grid,
[dir="rtl"] .hg-tags {
  direction: ltr !important; /* make scrolling start from the left even in Arabic */
}
/* Keep Arabic text direction inside cards/content items */
[dir="rtl"] .card-grid > article,
[dir="rtl"] .card-grid .hg-card,
[dir="rtl"] .card-grid .hg-card * {
  direction: rtl;
  text-align: start;
}




/* === v63.1 SEE GAZA ARCHIVE PARITY ===
   Mirror homepage #hear card layout on the See Gaza archive (post-type-archive-hg_video) */
body.post-type-archive-hg_video article.hg-card{ display:flex !important; flex-direction:column !important; }
body.post-type-archive-hg_video article.hg-card .hg-card-body{ display:flex !important; flex-direction:column !important; min-height: 320px !important; }
body.post-type-archive-hg_video article.hg-card .hg-bottom{ margin-top:auto !important; }
body.post-type-archive-hg_video article.hg-card .hg-bottom .hg-divider{ margin-top:.5rem !important; margin-bottom:.5rem !important; }

/* Ensure caption/excerpt has the same height and is independent of raw text length */
body.post-type-archive-hg_video .hg-excerpt:not(.hidden){ display:-webkit-box !important; -webkit-line-clamp: 6 !important; -webkit-box-orient: vertical !important; overflow:hidden !important; }

/* Broaden selectors in case the <article> wrapper lacks .hg-card */
body.post-type-archive-hg_video .card-grid > article{ display:flex !important; flex-direction:column !important; }
body.post-type-archive-hg_video .card-grid > article .hg-card-body{ display:flex !important; flex-direction:column !important; min-height:320px !important; }
body.post-type-archive-hg_video .card-grid > article .hg-bottom{ margin-top:auto !important; }
body.post-type-archive-hg_video .card-grid > article .hg-excerpt:not(.hidden){ display:-webkit-box !important; -webkit-line-clamp:6 !important; -webkit-box-orient: vertical !important; overflow:hidden !important; }

/* Match grid spacing with homepage row */
body.post-type-archive-hg_video .card-grid{ gap: .5rem !important; }
@media (min-width: 768px){
  body.post-type-archive-hg_video .card-grid{ gap: .75rem !important; }
}

/* bilingual hidden safety (scoped) */
body.post-type-archive-hg_video [data-lang].hidden{ display:none !important; }




/* === v63.2 SEE GAZA ARCHIVE MOBILE GRID PARITY ===
   Make archive rows behave like #hear rows on mobile: horizontal scroll, snap, and card widths */
body.post-type-archive-hg_video .card-grid{ display:flex !important; overflow-x:auto !important; -webkit-overflow-scrolling:touch; scroll-snap-type:x mandatory; gap:.5rem; padding-bottom:1rem; }
body.post-type-archive-hg_video .card-grid > article{ flex:0 0 85% !important; max-width:85% !important; scroll-snap-align:start; }
@media (min-width:480px){
  body.post-type-archive-hg_video .card-grid > article{ flex-basis:70% !important; max-width:70% !important; }
}
@media (min-width:640px){
  body.post-type-archive-hg_video .card-grid{ gap:.75rem; }
  body.post-type-archive-hg_video .card-grid > article{ flex-basis:55% !important; max-width:55% !important; }
}
@media (min-width:768px){
  body.post-type-archive-hg_video .card-grid > article{ flex-basis:45% !important; max-width:45% !important; }
}
@media (min-width:1024px){
  /* on desktop switch back to multi-column grid look */
  body.post-type-archive-hg_video .card-grid{ overflow-x:visible !important; scroll-snap-type:none; }
  body.post-type-archive-hg_video .card-grid > article{ flex-basis:31% !important; max-width:31% !important; }
}




/* === v63.3 SEE GAZA ARCHIVE DESKTOP TUNING ===
   On desktop, wrap to multiple rows and reduce card width similar to #hear */
@media (min-width: 1024px){
  body.post-type-archive-hg_video .card-grid{
    overflow-x: visible !important;
    scroll-snap-type: none !important;
    flex-wrap: wrap !important;
    justify-content: flex-start;
  }
  body.post-type-archive-hg_video .card-grid > article{
    flex: 0 0 30% !important;   /* ~3 columns */
    max-width: 30% !important;
  }
}
@media (min-width: 1280px){
  body.post-type-archive-hg_video .card-grid > article{
    flex-basis: 23% !important; /* ~4 columns on xl */
    max-width: 23% !important;
  }
}
@media (min-width: 1536px){
  body.post-type-archive-hg_video .card-grid > article{
    flex-basis: 20% !important; /* ~5 columns on 2xl */
    max-width: 20% !important;
  }
}
/* keep cards from stretching too tall/wide */
body.post-type-archive-hg_video article.hg-card{ max-width: 420px; }



/* === Read Gaza archive: enforce parity with home card heights === */
body.post-type-archive-hg_photo article.hg-card{ 
  /* Increased to match homepage #read section */
  min-height: 800px !important;
}
body.post-type-archive-hg_photo article.hg-card .hg-card-body{ 
  display: flex !important;
  flex-direction: column !important;
  /* Increased to match homepage #read caption/content area */
  min-height: 460px !important;
}
/* Also ensure within the archive chip/topic filter pages (?topic=...) */
body.post-type-archive-hg_photo.tax-filter-active article.hg-card .hg-card-body{
  min-height: 460px !important;
}
