/* ═══════════════════════════════════════════════════
   TEACHERS SECTION — Horizontal scroll track
   Simple, stable, works everywhere.
   ═══════════════════════════════════════════════════ */

.teachers-grid-section {
  padding: var(--section-padding) 0;
  position: relative;
}

.teachers-grid-section .section-container {
  margin-bottom: 40px;
}

.teachers-grid-section .section-badge,
.teachers-grid-section .section-title {
  text-align: center;
  display: block;
}

/* ═══════ WRAPPER: positions track + nav arrows ═══════ */
.teachers-carousel {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 60px;
}


/* ═══════ SCROLL TRACK ═══════ */
.teachers-stage {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 190px 20px 28px;          /* top: room for the larger floating photo + hover scale */
  /* hide scrollbar visually */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.teachers-stage::-webkit-scrollbar {
  display: none;
}

/* ═══════ TEACHER CARD ═══════ */
.teacher-grid-card {
  flex: 0 0 320px;
  scroll-snap-align: center;
  position: relative;
  border-radius: 26px;
  background: linear-gradient(
    180deg,
    hsla(var(--card-hue, 290), 45%, 16%, 0.45) 0%,
    hsla(var(--card-hue, 290), 30%, 10%, 0.25) 50%,
    var(--bg-glass) 100%
  );
  border: 1px solid hsla(var(--card-hue, 290), 60%, 55%, 0.22);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 240px 24px 28px;          /* larger top padding — photo got bigger and sits higher */
  transition:
    transform 0.35s var(--ease-out-quart),
    border-color 0.35s var(--ease-out-quart),
    box-shadow 0.35s var(--ease-out-quart);
  overflow: visible;
  cursor: default;
}

.teacher-grid-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: radial-gradient(
    ellipse at 50% 0%,
    hsla(var(--card-hue, 290), 80%, 60%, 0.18),
    transparent 65%
  );
  pointer-events: none;
}

.teacher-grid-card:hover {
  transform: translateY(-6px);
  border-color: hsla(var(--card-hue, 290), 70%, 60%, 0.5);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 50px hsla(var(--card-hue, 290), 80%, 55%, 0.28);
  /* Active card rises above its neighbours so the enlarged photo + screens
     never get clipped by the adjacent card on the side. */
  z-index: 5;
}

/* ═══════ FLOATING STAGE (photo + screenshots behind it) ═══════ */
.teacher-card-stage {
  position: absolute;
  top: -150px;                    /* deeper so the scaled-up photo has headroom */
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 320px;
  height: 380px;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

/* V-fanned screenshots */
.teacher-card-screens {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.teacher-card-screen {
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 150px;
  height: 305px;
  border-radius: 28px;
  overflow: hidden;
  border: 1.5px solid hsla(var(--card-hue, 290), 70%, 65%, 0.3);
  background: var(--bg-dark);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.5),
    0 0 32px hsla(var(--card-hue, 290), 80%, 55%, 0.24);
  opacity: 0;
  transform-origin: 50% 90%;
  transform: rotate(0deg) scale(0.5);
  transition:
    transform 0.7s var(--ease-out-expo),
    opacity 0.5s var(--ease-out-expo);
}

.teacher-card-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teacher-card-screen-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
  background: linear-gradient(
    135deg,
    var(--bg-dark) 0%,
    hsla(var(--card-hue, 290), 40%, 20%, 0.3) 100%
  );
}

/* Fan out on hover — screens push further out AND scale up so the V
   reads cleanly around the larger photo */
.teacher-grid-card:hover .teacher-card-screen.screen-left {
  opacity: 1;
  transform: translate(-104px, 18px) rotate(-17deg) scale(1.18);
}
.teacher-grid-card:hover .teacher-card-screen.screen-right {
  opacity: 1;
  transform: translate(104px, 18px) rotate(17deg) scale(1.18);
}

/* Always visible on touch devices (no hover on mobile) */
@media (hover: none) {
  .teacher-card-screen.screen-left {
    opacity: 1;
    transform: translate(-66px, 18px) rotate(-13deg) scale(0.92);
  }
  .teacher-card-screen.screen-right {
    opacity: 1;
    transform: translate(66px, 18px) rotate(13deg) scale(0.92);
  }
}

/* ═══════ FLOATING PHOTO — frameless, just a soft glow behind the teacher ═══════ */
.teacher-card-photo {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 240px;
  height: 340px;
  overflow: visible;
  transform-origin: 50% 0%;         /* anchor head at top — scale grows downward so head never clips */
  background: transparent;
  border: none;
  border-radius: 0;
  z-index: 3;
  transition: transform 0.4s var(--ease-out-expo), filter 0.4s var(--ease-out-expo);
  /* Themed ambient halo sitting behind the person (no hard frame, no box) */
  filter:
    drop-shadow(0 20px 40px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 34px hsla(var(--card-hue, 290), 90%, 60%, 0.35));
}

/* Soft radial aura behind the photo — replaces the old frame */
.teacher-card-photo::before {
  content: '';
  position: absolute;
  inset: -10% -8% -4%;
  background: radial-gradient(
    ellipse at 50% 48%,
    hsla(var(--card-hue, 290), 90%, 60%, 0.35) 0%,
    hsla(var(--card-hue, 290), 80%, 45%, 0.18) 32%,
    transparent 70%
  );
  filter: blur(14px);
  z-index: -1;
  pointer-events: none;
}

.teacher-grid-card:hover .teacher-card-photo {
  transform: scale(1.18);
  filter:
    drop-shadow(0 32px 60px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 50px hsla(var(--card-hue, 290), 100%, 65%, 0.6));
}

.teacher-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;          /* show the full teacher, not a cropped frame */
  object-position: center bottom;
  border-radius: 0;
  /* Fade bottom edge so it blends into the card without a hard line */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 88%, transparent 100%);
}

.teacher-card-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6.5rem;
  font-weight: 800;
  font-family: var(--font-ar);
  color: hsla(var(--card-hue, 290), 70%, 85%, 1);
  text-shadow: 0 4px 24px hsla(var(--card-hue, 290), 80%, 45%, 0.9);
  background: radial-gradient(
    ellipse at 50% 45%,
    hsla(var(--card-hue, 290), 70%, 30%, 0.35) 0%,
    transparent 70%
  );
  border-radius: 0;
}

/* ═══════ CARD BODY ═══════ */
.teacher-card-body {
  position: relative;
  z-index: 1;
  text-align: center;
  direction: rtl;
}

/* Inner wrapper that hosts the faded app-icon background. Spans from
   the subject line down through the description — that's the band the
   user wants the icon to sit behind. */
.teacher-card-body-inner {
  position: relative;
  z-index: 0;
  padding: 4px 0 8px;
  isolation: isolate; /* contain the icon's blend/opacity to this band */
}

.teacher-card-logo-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  border-radius: 18px;
}

.teacher-card-logo-bg img {
  width: 78%;
  max-width: 240px;
  max-height: 82%;
  object-fit: contain;
  object-position: center;
  opacity: 0.12;
  filter:
    saturate(1.05)
    drop-shadow(0 0 26px hsla(var(--card-hue, 290), 80%, 55%, 0.45));
  /* Fade edges into the card so it reads as a watermark */
  -webkit-mask-image: radial-gradient(
    ellipse at 50% 50%,
    #000 40%,
    rgba(0, 0, 0, 0.55) 72%,
    transparent 100%
  );
          mask-image: radial-gradient(
    ellipse at 50% 50%,
    #000 40%,
    rgba(0, 0, 0, 0.55) 72%,
    transparent 100%
  );
  transition: opacity 0.35s var(--ease-out-quart);
}

.teacher-grid-card:hover .teacher-card-logo-bg img {
  opacity: 0.2;
}

.teacher-card-name {
  font-family: var(--font-ar);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 28px;                  /* breathing room between photo and name */
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Meta row: app icon + logo (only rendered when at least one is present) */
.teacher-card-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.teacher-card-app-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid hsla(var(--card-hue, 290), 70%, 60%, 0.3);
  background: linear-gradient(
    135deg,
    hsla(var(--card-hue, 290), 80%, 60%, 0.2),
    hsla(var(--card-hue, 290), 60%, 25%, 0.08)
  );
  box-shadow: 0 4px 12px hsla(var(--card-hue, 290), 80%, 40%, 0.3);
}

.teacher-card-app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teacher-card-subject {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsla(var(--card-hue, 290), 70%, 80%, 1);
  padding: 5px 14px;
  border-radius: 100px;
  background: hsla(var(--card-hue, 290), 70%, 50%, 0.12);
  border: 1px solid hsla(var(--card-hue, 290), 70%, 60%, 0.28);
  white-space: nowrap;
}

/* Subject shown inline under name — no frame, smaller text */
.teacher-card-subject-inline {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-ar);
  color: hsla(var(--card-hue, 290), 60%, 72%, 0.9);
  margin-top: 2px;
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 0.02em;
}

.teacher-card-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-glass);
  background: var(--bg-surface);
}

.teacher-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

/* Description */
.teacher-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;                /* extra gap before the platform buttons */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.8em;
}

/* Platform links */
.teacher-card-platforms {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 4;
  margin-top: 4px;
}

.teacher-card-platform {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 11px;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-ar);
  text-decoration: none;
  transition: all 0.25s var(--ease-out-quart);
  pointer-events: auto;
  min-height: 38px;
}

.teacher-card-platform:hover {
  border-color: hsla(var(--card-hue, 290), 80%, 60%, 0.55);
  color: hsla(var(--card-hue, 290), 80%, 85%, 1);
  box-shadow: 0 0 14px hsla(var(--card-hue, 290), 80%, 50%, 0.35);
  transform: translateY(-2px);
}

.teacher-card-platform svg {
  width: 13px;
  height: 13px;
}

/* ═══════ NAVIGATION ARROWS ═══════ */
.teachers-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition:
    background 0.3s var(--ease-out-quart),
    border-color 0.3s var(--ease-out-quart),
    box-shadow 0.3s var(--ease-out-quart),
    transform 0.3s var(--ease-out-quart);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.teachers-nav-btn svg {
  width: 22px;
  height: 22px;
}

.teachers-nav-btn:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  transform: translateY(-50%) scale(1.08);
}

.teachers-nav-btn:active {
  transform: translateY(-50%) scale(0.94);
}

/* RTL: prev (→) on right, next (←) on left */
.teachers-nav-prev {
  right: 0;
}
.teachers-nav-next {
  left: 0;
}

/* ═══════ DOTS INDICATOR ═══════ */
.teachers-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-bottom: 4px;
}

.teachers-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition:
    transform 0.4s var(--ease-out-expo),
    background 0.4s var(--ease-out-expo),
    border-color 0.4s var(--ease-out-expo),
    box-shadow 0.4s var(--ease-out-expo);
}

.teachers-dot:hover {
  background: rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.3);
}

.teachers-dot.is-active {
  transform: scale(1.6);
  background: var(--neon-primary);
  border-color: transparent;
  box-shadow: 0 0 10px rgba(var(--neon-primary-rgb), 0.7);
}

/* ═══════ SECURE IMAGE STATES ═══════ */
.secure-img-loading { opacity: 0; transition: opacity 0.4s ease; }
.secure-img-loaded  { opacity: 1; }
.secure-img-failed  { opacity: 0.15; filter: grayscale(1); }

/* ═══════ EMPTY STATE ═══════ */
.teachers-empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.8;
}

/* ═══════ REDUCED MOTION ═══════ */
@media (prefers-reduced-motion: reduce) {
  .teacher-grid-card,
  .teacher-card-photo,
  .teacher-card-screen,
  .teachers-nav-btn,
  .teachers-dot {
    transition-duration: 0.01ms !important;
  }
  .teachers-stage {
    scroll-behavior: auto;
  }
}
