/* Ported from the prototype's moallemoun.css — kept in the 'legacy' cascade layer so Tailwind utilities can override it. */
@layer legacy {
/* =========================================================
   الأترجة — معلمو الأترجة
   ---------------------------------------------------------
   Rebuilt from the "people behind your next big move" row on
   td-signal.framer.website, measured at 1440:

     · one flex row, 1320px wide, no gap — five 264×469 cards
       (a 280/498 ratio) that touch edge to edge
     · each card is rotated ±4°, alternating, so the corners
       overlap their neighbours
     · they sit at different heights: 0 / 60 / 0 / 48 / 8px
     · 6px white border, 24px radius, a soft four-layer shadow
     · entrance: opacity 0 → 1, scale .8 → 1, 0.4s tween
       ease(.44,0,.56,1), once, the moment the card enters view
     · hover: a 3D scene at perspective(1200px) turns 180° on Y
       in 0.5s ease(.42,0,.58,1); leaving turns it back in 0.3s
     · back face: coloured card, 40px padding, name 32/600,
       role 14, bio 18/1.3, pill links pinned to the bottom

   The page is RTL, so the row reads right to left and the
   rotations and the flip direction are mirrored.
   ========================================================= */

.moallemoun{
  --bg:     #F8F5ED;
  --ink:    #123C35;
  --ink-2:  #7A8982;
  --gold:   #D4AF5A;

  --flip-in:  .5s cubic-bezier(.42,0,.58,1);
  --flip-out: .3s cubic-bezier(.42,0,.58,1);
  --appear:   .4s cubic-bezier(.44,0,.56,1);

  --shadow:
    .08px .8px .8px -.19px rgba(18,60,53,.02),
    .24px 2.4px 2.4px -.38px rgba(18,60,53,.03),
    .64px 6.4px 6.4px -.56px rgba(18,60,53,.04),
    2px 20px 20px -.75px rgba(18,60,53,.10);
  --shadow-lift:
    .08px .8px .8px -.19px rgba(18,60,53,.03),
    .4px 4px 4px -.38px rgba(18,60,53,.05),
    1.2px 12px 14px -.56px rgba(18,60,53,.07),
    4px 36px 40px -6px rgba(18,60,53,.16);

  position:relative;
  background:var(--bg);
  color:var(--ink);
  padding:clamp(96px, 11vw, 150px) 40px clamp(110px, 12vw, 170px);
  overflow:hidden;
}

.tch-wrap{
  max-width:1320px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:56px;
}

/* =========================================================
   HEADER — the site's shared heading system, same as
   المناهج / الحلقات: centered label, big bold line with the
   gold hand-drawn circle, a light description under it
   ========================================================= */

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

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

.tch-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);
}

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

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

.t-up{
  opacity:0;
  transform:translateY(26px);
  transition:opacity .9s var(--ease-out, cubic-bezier(.22,.68,.32,1)), transform .9s var(--ease-out, cubic-bezier(.22,.68,.32,1));
  transition-delay:var(--d, 0s);
}
.moallemoun.is-seen .t-up{ opacity:1; transform:none; }

/* =========================================================
   THE ROW
   ========================================================= */

.tch-row{
  display:flex;
  flex-direction:row;
  align-items:flex-start;
  justify-content:center;
}

/* --- "كل المعلمين": the same pill button as المناهج --- */
.tch-foot{
  position:relative; z-index:1;
  display:flex;
  justify-content:center;
  /* clears the lowest card's 60px drop and its shadow */
  margin-top:clamp(40px, 6vw, 80px);
}
.tch-cta{
  display:inline-flex; align-items:center; gap:14px;
  /* 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);
}
.tch-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);
}
.tch-cta .ico svg{ width:17px; height:17px; }
.tch-cta:hover{
  transform:translateY(-3px);
  box-shadow:0 22px 40px -18px rgba(18,60,53,.9);
}
.tch-cta:hover .ico{ transform:translateX(-5px); background:var(--gold); }
.tch-cta:focus-visible{ outline:2px solid var(--gold); outline-offset:4px; }

/* the slot: one fifth of the row. Each carries its tilt and its drop;
   the drop is a share of the card's own height (60/469 …) so it scales
   with the card, and is applied as a translate so the row height stays put */
.tch-slot{
  flex:1 1 0;
  min-width:0;
  max-width:264px;
}
.tch-slot:nth-child(1){ --tilt:-4deg; --drop:0%; }
.tch-slot:nth-child(2){ --tilt: 4deg; --drop:12.8%; }   /* 60 / 469 */
.tch-slot:nth-child(3){ --tilt:-4deg; --drop:0%; }
.tch-slot:nth-child(4){ --tilt: 4deg; --drop:10.2%; }   /* 48 / 469 */
.tch-slot:nth-child(5){ --tilt:-4deg; --drop:1.7%; }    /*  8 / 469 */

/* the card: tilted, and where the entrance scale lives */
.tch-card{
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:280 / 498;
  translate:0 calc(var(--drop, 0%) * var(--drop-k, 1));
  transform:rotate(var(--tilt, 0deg));
  container-type:inline-size;
  cursor:pointer;
  outline:none;
}
.tch-card:hover,
.tch-card:focus-visible,
.tch-card.is-flipped{ z-index:3; }

.tch-appear{
  position:absolute; inset:0;
  perspective:1200px;
}
.js-tch .tch-appear{
  opacity:0;
  transform:scale(.8);
  transition:opacity var(--appear), transform var(--appear);
}
.js-tch .tch-card.is-in .tch-appear{
  opacity:1;
  transform:scale(1);
}

/* the 3D scene that turns over */
.tch-scene{
  position:absolute; inset:0;
  transform-style:preserve-3d;
  transition:transform var(--flip-out);
}
.tch-card:hover .tch-scene,
.tch-card.is-flipped .tch-scene{
  transform:rotateY(180deg);
  transition:transform var(--flip-in);
}

.tch-face{
  position:absolute; inset:0;
  border-radius:24px;
  overflow:hidden;
  -webkit-backface-visibility:hidden;
          backface-visibility:hidden;
  box-shadow:var(--shadow);
  transition:box-shadow var(--flip-in);
}
.tch-card:hover .tch-face,
.tch-card.is-flipped .tch-face{ box-shadow:var(--shadow-lift); }

/* --- front: the portrait --- */
.tch-front{ background:#E9EAEC; }
.tch-front img{
  display:block;
  width:100%; height:100%;
  object-fit:cover;
  object-position:50% 30%;
}
/* the 6px white frame sits on top of the photo, like the reference */
.tch-front::after{
  content:"";
  position:absolute; inset:0;
  border:6px solid #FFFFFF;
  border-radius:inherit;
  pointer-events:none;
}

.tch-badge{
  position:absolute;
  bottom:20px;
  inset-inline-start:20px;
  z-index:1;
  padding:3px 9px;
  border-radius:20px;
  background:#FFFFFF;
  font-size:14px;
  line-height:1.3;
  font-weight:500;
  color:var(--ink);
  white-space:nowrap;
}

/* --- back: the details --- */
.tch-back{
  transform:rotateY(180deg);
  display:flex;
  flex-direction:column;
  padding:clamp(22px, 15cqw, 40px);
  background:var(--tone, #DCE8DC);
  color:var(--ink);
}
.tch-slot:nth-child(1) .tch-back{ --tone:#DCE8DC; }
.tch-slot:nth-child(2) .tch-back{ --tone:#E8D4A5; }
.tch-slot:nth-child(3) .tch-back{ --tone:#D9D2EF; }
.tch-slot:nth-child(4) .tch-back{ --tone:#F3EBDD; }
.tch-slot:nth-child(5) .tch-back{ --tone:#C7DCCB; }

.tch-back h3{
  margin:0;
  font-size:clamp(19px, 9.8cqw, 26px);
  line-height:1.2;
  font-weight:600;
  letter-spacing:-.3px;
}
.tch-role{
  margin:6px 0 0;
  font-size:14px;
  line-height:1.4;
  font-weight:500;
  color:rgba(18,60,53,.72);
}
.tch-rule{
  display:block;
  width:28px; height:2px;
  margin:clamp(16px, 9cqw, 26px) 0 0;
  border-radius:2px;
  background:var(--gold);
}
.tch-bio{
  margin:clamp(14px, 8cqw, 24px) 0 0;
  font-size:clamp(14px, 6.6cqw, 17px);
  line-height:1.75;
  font-weight:500;
}

.tch-links{
  margin-top:auto;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.tch-links a{
  display:inline-flex; align-items:center;
  padding:4px 12px;
  border-radius:24px;
  background:#FFFFFF;
  font-size:14px;
  line-height:1.4;
  color:var(--ink);
  text-decoration:none;
  transition:background-color .25s ease, color .25s ease;
}
.tch-links a:hover,
.tch-links a:focus-visible{ background:var(--ink); color:#F8F5ED; }

/* the links live on the back only — keep them out of reach while
   the portrait is showing */
.tch-back .tch-links a{ pointer-events:none; }
.tch-card:hover .tch-back .tch-links a,
.tch-card.is-flipped .tch-back .tch-links a{ pointer-events:auto; }

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

@media (max-width:1100px){
  .moallemoun{ padding-inline:24px; }
}

/* phones and small tablets: the row becomes a swipeable track and
   a tap turns the card */
@media (max-width:820px){
  .moallemoun{ padding-inline:0; }
  .tch-wrap{ gap:40px; }
  .tch-head{ padding-inline:20px; padding-bottom:10px; }
  .tch-desc{ font-size:16px; }

  .tch-row{
    justify-content:flex-start;
    gap:4px;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    scroll-snap-type:x mandatory;
    scrollbar-width:none;
    padding:28px 32px 60px;
  }
  .tch-row::-webkit-scrollbar{ display:none; }
  .tch-slot{
    flex:0 0 min(64vw, 250px);
    max-width:none;
    scroll-snap-align:center;
    --drop-k:.5;
  }
  .tch-slot:nth-child(odd) { --tilt:-3deg; }
  .tch-slot:nth-child(even){ --tilt: 3deg; }

  .tch-foot{ padding-inline:20px; }
  .tch-cta{ width:100%; max-width:360px; justify-content:space-between; }
}

@media (hover:none){
  .tch-card:hover .tch-scene{ transform:none; transition:transform var(--flip-out); }
  .tch-card.is-flipped .tch-scene{ transform:rotateY(180deg); transition:transform var(--flip-in); }
  .tch-card:hover .tch-back .tch-links a{ pointer-events:none; }
  .tch-card.is-flipped .tch-back .tch-links a{ pointer-events:auto; }
}

@media (prefers-reduced-motion:reduce){
  .moallemoun .spark{ animation:none; }
  .js-tch .tch-appear{ opacity:1; transform:none; transition:none; }
  .t-up{ opacity:1 !important; transform:none !important; transition:none !important; }
  .tch-scene{ transition-duration:.001ms !important; }
}

}
