/* Ported from the prototype's mohadarat.css — kept in the 'legacy' cascade layer so Tailwind utilities can override it. */
@layer legacy {
/* =========================================================
   الأترجة — محاضرات الأترجة
   A dark, cinematic chapter: an endless deck of lecture cards
   drifting through 3D space.
   Card geometry follows the reference (kiddo): image-led cards,
   20px apart, travelling continuously instead of stepping —
   no arrows, it never stops.
   ========================================================= */

.mohadarat{
  --bg:       #071F1A;
  --bg-mid:   #0B2923;
  --bg-lift:  #123C35;

  --ink:      #F8F5ED;
  --ink-2:    rgba(248,243,231,.64);
  --gold:     #D4AF5A;
  --gold-lt:  #E6D0A0;
  --sage:     #A8C7B5;
  --line:     rgba(248,243,231,.10);

  --ease: cubic-bezier(.22,.68,.32,1);
  --gap:  24px;                 /* measured: 624 pitch − 600 card */
  --w:    min(600px, 84vw);     /* the reference card, exactly */
  --h:    380px;

  position:relative;
  color:var(--ink);
  padding:132px 0 140px;
  overflow:hidden;
  isolation:isolate;
  background:
    radial-gradient(120% 85% at 50% -10%, var(--bg-lift) 0%, var(--bg-mid) 46%, var(--bg) 100%);
}

/* --- atmosphere: dotted texture + two soft glows --- */
.mhd-texture{
  position:absolute; inset:0;
  z-index:0;
  pointer-events:none;
  opacity:.5;
  background-image:radial-gradient(rgba(248,243,231,.13) 1px, transparent 1px);
  background-size:26px 26px;
  -webkit-mask-image:radial-gradient(80% 65% at 50% 34%, #000 0%, transparent 84%);
          mask-image:radial-gradient(80% 65% at 50% 34%, #000 0%, transparent 84%);
}
.mohadarat::before,
.mohadarat::after{
  content:"";
  position:absolute;
  z-index:0;
  pointer-events:none;
  border-radius:50%;
  filter:blur(130px);
}
.mohadarat::before{
  width:760px; height:520px;
  top:-220px; right:-120px;
  background:radial-gradient(closest-side, rgba(212,175,90,.24), transparent 72%);
}
.mohadarat::after{
  width:820px; height:560px;
  bottom:-260px; left:-160px;
  background:radial-gradient(closest-side, rgba(168,199,181,.16), transparent 74%);
}

/* =========================================================
   HEADER
   ========================================================= */

.mhd-head{
  position:relative; z-index:2;
  max-width:1300px;
  margin:0 auto 74px;
  padding:0 34px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:44px;
}

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

.mhd-title{
  margin:18px 0 0;
  font-size:clamp(34px, 4.6vw, 66px);
  line-height:1.26;
  font-weight:700;
  letter-spacing:-1.1px;
  color:var(--ink);
}
.mhd-title .line{ display:block; }

.mhd-desc{
  margin:22px 0 0;
  max-width:520px;
  font-size:16.5px;
  line-height:2;
  font-weight:300;
  color:var(--ink-2);
}

.mhd-cta{
  flex:0 0 auto;
  display:inline-flex; align-items:center; gap:13px;
  margin-bottom:8px;
  /* text side roomy, icon side snug — logical, so it follows RTL */
  padding-block:9px;
  padding-inline:28px 9px;
  border-radius:100px;
  background:var(--gold);
  color:#123C35;
  font-size:16px; font-weight:700;
  box-shadow:0 16px 34px -18px rgba(212,175,90,.9);
  transition:transform .35s var(--ease), box-shadow .35s var(--ease),
             background .35s var(--ease);
}
.mhd-cta .ico{
  width:38px; height:38px;
  border-radius:50%;
  display:grid; place-items:center;
  background:#123C35;
  color:var(--gold);
  transition:transform .35s var(--ease);
}
.mhd-cta .ico svg{ width:17px; height:17px; }
.mhd-cta:hover{
  transform:translateY(-3px);
  background:var(--gold-lt);
  box-shadow:0 24px 44px -18px rgba(212,175,90,1);
}
.mhd-cta:hover .ico{ transform:translateX(-5px); }

/* =========================================================
   THE DECK — always moving, never stepping
   ========================================================= */

.mhd-rail{
  position:relative; z-index:1;
  /* horizontal maths, pinned regardless of the page direction */
  direction:ltr;
  perspective:1500px;
  perspective-origin:50% 45%;
  -webkit-mask-image:linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
          mask-image:linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}

/* scroll parallax lives here so it composes with the loop below */
.mhd-parallax{
  transform:translate3d(var(--drift, 0px), 0, 0);
  will-change:transform;
}

.mhd-track{
  display:flex;
  align-items:center;
  gap:var(--gap);
  width:max-content;
  padding:56px 0 64px;
  transform-style:preserve-3d;
  animation:mhd-run 46s linear infinite;
  animation-play-state:paused;        /* JS starts it after the reveal */
}
.mohadarat.is-running .mhd-track{ animation-play-state:running; }
.mhd-rail:hover .mhd-track{ animation-play-state:paused; }

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

.mhd-set{
  display:flex;
  align-items:center;
  gap:var(--gap);
  transform-style:preserve-3d;
}

/* =========================================================
   CARD — the reference's split card: photo beside a soft
   tinted panel, all cards the same size, 16px radius.
   The tints are the brand's own colours, lightened.
   ========================================================= */

.mhd-card{
  direction:rtl;
  position:relative;
  flex:0 0 var(--w);
  width:var(--w);
  height:var(--h);
  display:flex;
  align-items:stretch;
  gap:32px;                     /* the reference's image → text gutter */
  border-radius:16px;
  overflow:hidden;
  background:var(--tint, #F8F5ED);
  box-shadow:0 40px 80px -42px rgba(0,0,0,.9);
  transform:translateZ(var(--tz, 0px)) translateY(var(--float, 0px));
  transition:box-shadow .5s var(--ease);
  animation:mhd-float calc(9s + var(--i, 0) * 1.1s) var(--ease) infinite;
  animation-delay:calc(var(--i, 0) * -1.7s);
}

@property --float{ syntax:'<length>'; inherits:false; initial-value:0px; }
@keyframes mhd-float{
  0%,100%{ --float:0px; }
  50%    { --float:-14px; }
}

.mhd-media{
  flex:0 0 44.7%;               /* 268 of 600 */
  position:relative;
  margin:0;
  overflow:hidden;
  background:rgba(18,60,53,.08);
}
.mhd-card img{
  display:block;
  width:100%; height:100%;
  object-fit:cover;
  transition:transform 1.4s var(--ease);
}

.mhd-body{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:space-between; /* title up top, button at the foot */
  padding:32px;
  padding-inline-start:0;        /* the image side carries the gutter */
  color:#123C35;
}
.mhd-body h3{
  margin:0;
  font-size:clamp(23px, 1.9vw, 32px);   /* 32 / 1.2 on the reference */
  line-height:1.2;
  font-weight:700;
  letter-spacing:-.4px;
  color:#123C35;
}
.mhd-body p{
  margin:12px 0 0;
  font-size:17px;
  line-height:1.5;
  font-weight:300;
  color:#4C5F58;
}
.mhd-body .top{ display:block; }

.mhd-more{
  display:inline-flex; align-items:center; gap:9px;
  padding:13px 26px;
  border-radius:100px;
  background:#FFFFFF;
  font-size:14.5px; font-weight:600;
  color:#123C35;
  box-shadow:0 10px 22px -16px rgba(18,60,53,.8);
  transition:background .35s var(--ease), transform .35s var(--ease),
             color .35s var(--ease);
}
.mhd-more svg{ width:15px; height:15px; transition:transform .35s var(--ease); }
.mhd-more:hover{
  transform:translateY(-2px);
  background:#123C35;
  color:#F8F5ED;
}
.mhd-more:hover svg{ transform:translateX(-4px); }

.mhd-card:hover{ box-shadow:0 50px 92px -40px rgba(0,0,0,.95); }
.mhd-card:hover img{ transform:scale(1.06); }

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

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

/* cards arrive from different directions, then settle into the drift */
.mhd-set--lead .mhd-card{
  opacity:0;
  transform:
    translateZ(-240px)
    translateX(var(--from-x, 0px))
    translateY(var(--from-y, 60px));
  animation:none;
}
.mohadarat.is-seen .mhd-set--lead .mhd-card{
  opacity:1;
  transform:translateZ(var(--tz, 0px));
  transition:opacity .9s var(--ease), transform 1.1s cubic-bezier(.2,.85,.3,1);
  transition-delay:calc(.3s + var(--i, 0) * .14s);
}
/* once settled, hand back to the endless float */
.mohadarat.is-running .mhd-set--lead .mhd-card{
  transition:box-shadow .5s var(--ease), border-color .5s var(--ease);
  animation:mhd-float calc(9s + var(--i, 0) * 1.1s) var(--ease) infinite;
  animation-delay:calc(var(--i, 0) * -1.7s);
}

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

@media (max-width:1100px){
  .mohadarat{ padding:104px 0 112px; --w:min(560px, 86vw); --h:356px; }
  .mhd-card{ gap:26px; }
  .mhd-body{ padding:26px; padding-inline-start:0; }
}

@media (max-width:860px){
  .mohadarat{ padding:84px 0 92px; }
  .mhd-head{
    flex-direction:column;
    align-items:flex-start;
    gap:26px;
    margin-bottom:48px;
    padding:0 20px;
  }
  .mhd-rail{ perspective:none; }
  .mohadarat{ --w:min(330px, 84vw); --h:auto; }
  .mhd-card{
    flex-direction:column;
    height:auto;
    gap:0;
    border-radius:16px;
  }
  .mhd-media{ flex:0 0 auto; aspect-ratio:16/10; }
  .mhd-body{ padding:24px 22px 26px; justify-content:flex-start; }
  .mhd-body p{ font-size:15.5px; }
  .mhd-more{ margin-top:22px; }
  .mhd-track{ padding:34px 0 40px; }
}

@media (prefers-reduced-motion:reduce){
  .mohadarat *,
  .mohadarat *::before,
  .mohadarat *::after{
    animation:none !important;
    transition-duration:.001ms !important;
  }
  .v-up{ opacity:1 !important; transform:none !important; }
  .mhd-set--lead .mhd-card{ opacity:1 !important; transform:none !important; }
  .mhd-rail{
    overflow-x:auto;
    -webkit-mask-image:none; mask-image:none;
  }
  .mhd-set--dup{ display:none; }
}

}
