/* Ported from the prototype's halaqat.css — kept in the 'legacy' cascade layer so Tailwind utilities can override it. */
@layer legacy {
/* =========================================================
   الأترجة — حلقات الأترجة
   Light editorial header + an endless horizontal card ticker
   ========================================================= */

.halaqat{
  /* soft sage atmosphere — the community chapter of the journey */
  --bg:       var(--atmo-halaqat, #E3EEE5);
  --ink:      #123C35;
  --ink-2:    #66736D;
  --gold:     #D4AF5A;
  --sage:     #A8C7B5;
  --card:     #F8F5ED;   /* lighter than the section, so cards lift */
  --hairline: rgba(18,60,53,.08);

  --ease: cubic-bezier(.22,.68,.32,1);

  --card-w: 400px;
  --gap:    28px;

  position:relative;
  /* background comes from the .atmo utility (tone + seam) */
  color:var(--ink);
  padding:132px 0 140px;
  overflow:hidden;
  isolation:isolate;
}

/* ---------------------------------------------------------
   decorative layer: two soft organic shapes, a light lattice
   and a few small gold marks. All of it sits behind content.
   --------------------------------------------------------- */

/* organic shapes */
.halaqat::before,
.halaqat::after{
  content:"";
  position:absolute;
  z-index:0;
  pointer-events:none;
}
.halaqat::before{
  width:620px; height:560px;
  top:-140px; right:-180px;
  background:radial-gradient(closest-side, rgba(168,199,181,.55), transparent 72%);
  border-radius:62% 38% 44% 56% / 48% 56% 44% 52%;
  filter:blur(10px);
}
.halaqat::after{
  width:560px; height:500px;
  bottom:-160px; left:-160px;
  background:radial-gradient(closest-side, rgba(232,212,165,.42), transparent 74%);
  border-radius:44% 56% 62% 38% / 56% 44% 56% 44%;
  filter:blur(10px);
}

/* light lattice texture */
.hlq-texture{
  position:absolute; inset:0;
  z-index:0;
  pointer-events:none;
  opacity:.5;
  background-image:
    linear-gradient(45deg,  rgba(18,60,53,.055) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(18,60,53,.055) 1px, transparent 1px);
  background-size:46px 46px;
  -webkit-mask-image:radial-gradient(90% 70% at 50% 34%, #000 0%, transparent 78%);
          mask-image:radial-gradient(90% 70% at 50% 34%, #000 0%, transparent 78%);
}

/* small gold details */
.hlq-mark{
  position:absolute;
  z-index:0;
  color:var(--gold);
  font-size:18px;
  line-height:1;
  opacity:.55;
  pointer-events:none;
  animation:hlq-twinkle 6s var(--ease) infinite;
}
.hlq-mark--1{ top:118px;  right:11%; font-size:22px; animation-delay:-1.2s; }
.hlq-mark--2{ top:212px;  left:14%;                  animation-delay:-3.4s; }
.hlq-mark--3{ bottom:96px; right:22%; font-size:15px; animation-delay:-5s;  }
@keyframes hlq-twinkle{
  0%,100%{ opacity:.25; transform:scale(.85) rotate(0deg); }
  50%    { opacity:.7;  transform:scale(1)  rotate(45deg); }
}

/* =========================================================
   HEADING
   ========================================================= */

.hlq-head{
  position:relative;
  z-index:1;
  max-width:900px;
  margin:0 auto;
  padding:0 34px 68px;
  text-align:center;
}

.hlq-label{
  display:inline-flex; align-items:center; gap:10px;
  margin:0;
  font-size:14px; font-weight:600;
  letter-spacing:.14em;
  color:var(--ink-2);
}
.hlq-label .spark{
  color:var(--gold);
  font-size:15px; line-height:1;
  animation:spark-turn 9s linear infinite;
}

.hlq-title{
  margin:20px 0 0;
  font-size:clamp(34px, 5vw, 72px);
  line-height:1.32;
  font-weight:700;
  letter-spacing:-1px;
  color:var(--ink);
}

/* the hand-drawn gold circle lives in shared.css */

.hlq-desc{
  margin:24px auto 0;
  max-width:620px;
  font-size:17px;
  line-height:2.1;
  font-weight:300;
  color:var(--ink-2);
}

/* =========================================================
   TICKER
   ========================================================= */

.hlq-viewport{
  position:relative;
  z-index:1;
  /* the maths below is horizontal, so pin it to LTR regardless of the page */
  direction:ltr;
  -webkit-mask-image:linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
          mask-image:linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
  padding:10px 0 22px;   /* room for the cards' lift and shadow */
}

.hlq-track{
  display:flex;
  gap:var(--gap);
  width:max-content;
  will-change:transform;
  animation:hlq-run 52s linear infinite;
  animation-play-state:paused;      /* JS starts it after the reveal */
}
.halaqat.is-running .hlq-track{ animation-play-state:running; }
.hlq-viewport:hover .hlq-track{ animation-play-state:paused; }

/* two identical sets: shifting by one set + one gap loops seamlessly */
@keyframes hlq-run{
  from{ transform:translate3d(0,0,0); }
  to  { transform:translate3d(calc(-50% - var(--gap) / 2), 0, 0); }
}

.hlq-set{
  display:flex;
  gap:var(--gap);
}

/* =========================================================
   CARD
   ========================================================= */

.hlq-card{
  direction:rtl;
  flex:0 0 var(--card-w);
  width:var(--card-w);
  display:flex;
  flex-direction:column;
  --pad:32px;
  padding:var(--pad);
  border-radius:34px;
  background:var(--card);
  border:1px solid var(--hairline);
  box-shadow:0 22px 44px -30px rgba(18,60,53,.55);
  transition:transform .5s var(--ease), box-shadow .5s var(--ease),
             border-color .5s var(--ease);
}

/* the faint square texture from the reference */
.hlq-card::before{
  content:"";
  position:absolute; inset:0;
  border-radius:inherit;
  background-image:
    linear-gradient(to right,  rgba(18,60,53,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(18,60,53,.05) 1px, transparent 1px);
  background-size:30px 30px;
  pointer-events:none;
}
.hlq-card{ position:relative; overflow:hidden; }

.hlq-card h3{
  margin:0;
  font-size:26px;
  font-weight:700;
  letter-spacing:-.4px;
  color:var(--ink);
}
.hlq-card p{
  margin:12px 0 0;
  font-size:15.5px;
  line-height:1.95;
  font-weight:300;
  color:var(--ink-2);
  min-height:calc(1.95em * 2);
}

/* The photo bleeds to the card's edges and is cut by an organic
   scalloped mask — the same four shapes the reference uses. Each card
   picks one with --mask. The mask stretches to the box (as it does on
   the reference), while the photo inside stays cover-cropped. */
.hlq-media{
  position:relative;
  margin:26px calc(-1 * var(--pad)) calc(-1 * var(--pad));
  overflow:hidden;
  -webkit-mask:var(--mask) center / 100% 100% no-repeat;
          mask:var(--mask) center / 100% 100% no-repeat;
}
.hlq-media img{
  display:block;
  width:100%;
  aspect-ratio:375/277;
  object-fit:cover;
  transform:scale(1.001);
  transition:transform .8s var(--ease);
}

.hlq-card:hover{
  transform:translateY(-8px);
  box-shadow:0 34px 58px -28px rgba(18,60,53,.62);
  border-color:rgba(212,175,90,.45);
}
.hlq-card:hover .hlq-media img{ transform:scale(1.07); }

/* =========================================================
   REVEALS
   ========================================================= */

.h-up{
  opacity:0;
  transform:translateY(26px);
  transition:opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay:var(--d, 0s);
}
.halaqat.is-seen .h-up{ opacity:1; transform:none; }

/* cards rise one after another; duplicates are already off-screen */
.hlq-set--lead .hlq-card{
  opacity:0;
  transform:translateY(46px);
  transition:opacity .85s var(--ease), transform .85s var(--ease),
             box-shadow .5s var(--ease), border-color .5s var(--ease);
  transition-delay:calc(.45s + var(--i, 0) * .14s);
}
.halaqat.is-seen .hlq-set--lead .hlq-card{ opacity:1; transform:none; }
.halaqat.is-seen .hlq-set--lead .hlq-card:hover{ transform:translateY(-8px); }

/* The photo arrives with the site-wide blob dissolve (.img-dissolve in
   shared.css), staggered card by card. The scallop stays still while the
   picture materialises inside it. */
.hlq-set--lead .hlq-media img{
  --dissolve-delay:calc(.7s + var(--i, 0) * .2s);
}
.hlq-card:hover .hlq-media img{ transform:scale(1.07); }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width:1100px){
  .halaqat{ --card-w:340px; padding:96px 0 104px; }
  .hlq-card{ --pad:26px; border-radius:28px; }
  .hlq-card h3{ font-size:23px; }
}

@media (max-width:640px){
  .halaqat{ --card-w:264px; --gap:16px; padding:76px 0 84px; }
  .hlq-head{ padding:0 20px 44px; }
  .hlq-title{ line-height:1.45; letter-spacing:-.2px; }
  .hlq-desc{ font-size:16px; line-height:2; }
  .hlq-card{ --pad:20px; border-radius:24px; }
  .hlq-card h3{ font-size:20px; }
  .hlq-card p{ font-size:14px; }
  .hlq-media{ margin-top:20px; }
}

@media (prefers-reduced-motion:reduce){
  .halaqat *,
  .halaqat *::before,
  .halaqat *::after{
    animation:none !important;
    transition-duration:.001ms !important;
  }
  .h-up,
  .hlq-set--lead .hlq-card{ opacity:1 !important; transform:none !important; }
  .hlq-set--lead .hlq-media img{ transform:none !important; }

  /* no auto-scroll: let the row be swiped instead */
  .hlq-viewport{
    overflow-x:auto;
    scroll-snap-type:x mandatory;
    -webkit-mask-image:none; mask-image:none;
    padding:0 34px;
  }
  .hlq-card{ scroll-snap-align:center; }
  .hlq-set--dup{ display:none; }
}

/* «عرض جميع الحلقات» closes the section, like the curricula one (the pill itself is .mnh-cta) */
.hlq-foot{ position:relative; z-index:1; margin-top:8px; text-align:center; }

}
