/* Ported from the prototype's manahij.css — kept in the 'legacy' cascade layer so Tailwind utilities can override it. */
@layer legacy {
/* =========================================================
   الأترجة — مناهج الأترجة
   Soft sand chapter: a vertical journey of alternating rows
   ========================================================= */

.manahij{
  --bg:       var(--atmo-manahij, #F4EBDD);
  --ink:      #123C35;
  --ink-2:    #66736D;
  --gold:     #D4AF5A;
  --sage:     #A8C7B5;
  --hairline: rgba(18,60,53,.10);

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

  position:relative;
  color:var(--ink);
  padding:132px 0 140px;
  overflow:hidden;
  isolation:isolate;
}

/* one quiet sage bloom, nothing more — the tone carries the mood */
.manahij::after{
  content:"";
  position:absolute;
  width:660px; height:520px;
  bottom:-200px; left:-180px;
  z-index:0;
  pointer-events:none;
  border-radius:50%;
  filter:blur(130px);
  background:radial-gradient(closest-side, rgba(168,199,181,.40), transparent 74%);
}

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

.mnh-head{
  position:relative; z-index:1;
  max-width:860px;
  margin:0 auto;
  padding:0 34px 86px;
  text-align:center;
}

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

.mnh-title{
  margin:20px 0 0;
  font-size:clamp(32px, 4.4vw, 62px);
  line-height:1.34;
  font-weight:700;
  letter-spacing:-.9px;
  color:var(--ink);
}

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

.mnh-cta{
  display:inline-flex; align-items:center; gap:14px;
  margin-top:34px;
  /* text side roomy, icon side snug — logical, so it follows RTL */
  padding-block:9px;
  padding-inline:26px 9px;
  border-radius:100px;
  background:var(--ink);
  color:#F8F5ED;
  font-size:16px; font-weight:600;
  box-shadow:0 14px 30px -18px rgba(18,60,53,.85);
  transition:transform .35s var(--ease), box-shadow .35s var(--ease);
}
.mnh-cta .ico{
  width:38px; height:38px;
  border-radius:50%;
  display:grid; place-items:center;
  background:#F8F5ED;
  color:var(--ink);
  transition:transform .35s var(--ease), background .35s var(--ease);
}
.mnh-cta .ico svg{ width:17px; height:17px; }
.mnh-cta:hover{
  transform:translateY(-3px);
  box-shadow:0 22px 40px -18px rgba(18,60,53,.9);
}
.mnh-cta:hover .ico{ transform:translateX(-5px); background:var(--gold); }

/* =========================================================
   THE JOURNEY
   ========================================================= */

.mnh-track{
  position:relative; z-index:1;
  max-width:1300px;
  margin:0 auto;
  padding:0 34px;
}

/* the rail: not a straight line — the reference masks a coloured bar
   with a hand-drawn brush stroke (32 x 1026), so the edges are rough and
   the width wavers down its length. Same stroke, our colour. */
.mnh-rail{
  position:absolute;
  top:6px; bottom:74px;
  right:calc(34px + 116px);
  width:26px;
  background:#D5C6A4;
  -webkit-mask:url(/assets/rail-stroke.svg) center / 100% 100% no-repeat;
          mask:url(/assets/rail-stroke.svg) center / 100% 100% no-repeat;
  transform:translateY(var(--rail-y, 0px));
  /* drawn top-down: JS feeds --rail-draw from the scroll position, so the
     stroke grows as you move through the section instead of just sitting
     there. Clipping (not resizing) keeps the brush texture undistorted. */
  clip-path:inset(0 0 var(--rail-draw, 100%) 0);
  z-index:0;
  pointer-events:none;
}

/* Row geometry follows the reference: a pill on the rail, then a
   rounded panel that clips a photo overflowing its far edge. */
.mnh-row{
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
  gap:0 44px;
  align-items:start;
  margin-bottom:52px;
}

/* the pill — 260 x 55, radius 36, padding 12/24, as measured */
.mnh-stamp{
  grid-column:1;
  position:relative;
  z-index:1;
  align-self:start;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:55px;                 /* the reference pill, to the pixel */
  padding:12px 24px;
  border-radius:36px;
  background:#FFFDF7;
  box-shadow:0 12px 28px -22px rgba(18,60,53,.8);
  font-size:15px;
  font-weight:600;
  color:var(--ink);
  white-space:nowrap;
}
.mnh-stamp span{
  font-size:12.5px;
  font-weight:400;
  color:var(--ink-2);
}

/* the panel — radius 30, padding 45, clips its own overflow */
.mnh-panel{
  grid-column:2;
  position:relative;
  display:flex;
  align-items:center;
  height:199px;                /* the reference card height, exactly */
  border-radius:30px;
  overflow:hidden;
  background:#FFFDF7;
  box-shadow:0 26px 54px -38px rgba(18,60,53,.65);
}
/* the photo swaps sides row by row */
.mnh-row:nth-of-type(even) .mnh-panel{ flex-direction:row-reverse; }

/* the photo: a complete square, shown whole — nothing masked or cut.
   It carries no reveal of its own; like the reference, it arrives with
   the card's lift. */
/* a complete square photo, running the full height of the card so it
   stays whole while the card keeps the reference's proportions */
.mnh-media{
  flex:0 0 199px;
  width:199px;
  height:199px;              /* square, and flush with the card's edges */
  margin:0;
  overflow:hidden;
  background:rgba(18,60,53,.06);
}
.mnh-media img{
  display:block;
  width:100%; height:100%;
  object-fit:cover;
  --dissolve-delay:.22s;
}
.mnh-panel:hover .mnh-media img{ transition:transform 1.4s var(--ease); }
.mnh-panel:hover .mnh-media img{ transform:scale(1.06); }

.mnh-body{
  flex:1 1 auto;
  min-width:0;
  align-self:center;
  padding:26px 38px;
  overflow:hidden;
}

.mnh-body h3{
  margin:0;
  font-size:clamp(20px, 1.5vw, 25px);
  font-weight:700;
  letter-spacing:-.4px;
  color:var(--ink);
}
.mnh-body > p{
  margin:9px 0 0;
  max-width:46ch;
  font-size:15px;
  line-height:1.62;
  font-weight:300;
  color:var(--ink-2);
}

.mnh-facts{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px 18px;
  margin:14px 0 0;
  padding:0;
  list-style:none;
}
.mnh-facts li{
  display:flex;
  align-items:baseline;
  gap:6px;
  font-size:13px;
  font-weight:600;
  color:var(--ink);
}
.mnh-facts li + li{
  padding-inline-start:18px;
  border-inline-start:1px solid var(--hairline);
}
.mnh-facts i{
  font-style:normal;
  font-size:12px;
  font-weight:500;
  color:var(--ink-2);
}

.mnh-link{
  position:absolute;
  bottom:22px;
  inset-inline-end:22px;
  z-index:2;
  display:grid; place-items:center;
  width:42px; height:42px;
  border-radius:50%;
  border:1px solid rgba(18,60,53,.18);
  color:var(--ink);
  background:transparent;
  transition:background .35s var(--ease), border-color .35s var(--ease),
             transform .35s var(--ease);
}
.mnh-link svg{ width:16px; height:16px; transition:transform .35s var(--ease); }
.mnh-link span{
  position:absolute;
  width:1px; height:1px;
  overflow:hidden;
  clip-path:inset(50%);
}
.mnh-link:hover{
  transform:translateY(-2px);
  background:var(--gold);
  border-color:var(--gold);
}
.mnh-link:hover svg{ transform:translateX(-3px); }
/* on rows where the photo sits on that side, tuck the button to the other */
.mnh-row:nth-of-type(even) .mnh-link{
  inset-inline-end:auto;
  inset-inline-start:22px;
}

/* the CTA now closes the list instead of opening it */
.mnh-foot{
  position:relative; z-index:1;
  margin-top:18px;
  text-align:center;
}

/* =========================================================
   REVEALS — the reference lifts each row 100px as it arrives
   ========================================================= */

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

.mnh-stamp,
.mnh-panel{
  opacity:0;
  transform:translateY(100px);
  transition:opacity .9s var(--ease), transform 1s var(--ease);
}
.mnh-stamp{ transition-delay:.06s; }

.mnh-row.is-in .mnh-stamp,
.mnh-row.is-in .mnh-panel{
  opacity:1;
  transform:none;
}

/* No separate motion on the photo: measured on the reference, its media
   holds a static transform at every scroll position and simply rides the
   card's 100px lift. */

/* text inside the body follows a beat later */
.mnh-body > *{
  opacity:0;
  transform:translateY(18px);
  transition:opacity .8s var(--ease), transform .8s var(--ease);
}
.mnh-row.is-in .mnh-body > *{ opacity:1; transform:none; }
.mnh-row.is-in .mnh-body > *:nth-child(1){ transition-delay:.18s; }
.mnh-row.is-in .mnh-body > *:nth-child(2){ transition-delay:.26s; }
.mnh-row.is-in .mnh-body > *:nth-child(3){ transition-delay:.34s; }
.mnh-row.is-in .mnh-body > *:nth-child(4){ transition-delay:.42s; }

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

@media (max-width:1080px){
  .mnh-row{ grid-template-columns:230px minmax(0,1fr); gap:0 30px; }
  .mnh-rail{ right:calc(34px + 102px); width:22px; }
  .mnh-body{ padding:26px 30px; }
  .mnh-rail{ right:calc(34px + 79px); }
  .mnh-panel{ gap:32px; padding-bottom:60px; }
  .mnh-media{ flex-basis:46%; }
}

@media (max-width:860px){
  .manahij{ padding:96px 0 104px; }
  .mnh-head{ padding:0 20px 56px; }
  .mnh-track{ padding:0 20px; }
  .mnh-row{ grid-template-columns:minmax(0,1fr); gap:0; }
  .mnh-rail{ display:none; }
  .mnh-stamp{
    grid-column:1;
    justify-self:start;
    margin:0 0 16px;
    padding:9px 18px;
  }
  .mnh-stamp span{ display:inline; margin:0 6px 0 0; }
  .mnh-row{ margin-bottom:26px; }
  .mnh-panel{
    grid-column:1;
    flex-direction:column !important;
    align-items:stretch;
    height:auto;
  }
  .mnh-media{
    flex:0 0 auto;
    width:100%;
    height:auto;
    aspect-ratio:16/11;            /* a whole photo, just wider on a phone */
  }
  .mnh-body{ padding:26px; }
  .mnh-link{ bottom:auto; top:calc(56.25vw - 62px); }
}

@media (max-width:480px){
  .mnh-media{ border-radius:22px; }
  .mnh-facts{ gap:10px 20px; }
  .mnh-cta{ width:100%; justify-content:space-between; }
}

@media (prefers-reduced-motion:reduce){
  .manahij *,
  .manahij *::before,
  .manahij *::after{
    animation:none !important;
    transition-duration:.001ms !important;
  }
  .m-up, .mnh-stamp, .mnh-panel, .mnh-media, .mnh-body > *{
    opacity:1 !important;
    transform:none !important;
  }
}

/* the arrow sits in its own lane at the end of the text, centred on the
   card — never over the facts, however long they run */
@media (min-width:861px){
  .mnh-body{ position:relative; align-self:stretch; display:flex; flex-direction:column; justify-content:center; padding-inline-end:100px; }
  .mnh-link,
  .mnh-row:nth-of-type(even) .mnh-link{ top:50%; bottom:auto; inset-inline-start:auto; inset-inline-end:34px; translate:0 -50%; }
}

}
