/* ═══════════════════════════════════════════════════
   TEACHERS SHOWCASE — Scroll-driven per-teacher reveal
   Phone stays sticky, moves left↔right, spins 360° Y
   Info panel appears on the opposite side
   ═══════════════════════════════════════════════════ */

/* ═══════ SCROLL CONTAINER — tall, drives the pin ═══════ */
.showcase-scroll-container {
  position: relative;
  /* height set dynamically by JS: n * 100vh */
}

/* ═══════ STAGE — sticky CSS fallback so the phone stays put before
   GSAP/ScrollTrigger finishes booting on slow networks. Once GSAP loads,
   ScrollTrigger.create({pin: stage}) upgrades it to position:fixed. ═══════ */
.showcase-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stage uses an "early-pin" class added by JS the moment the Hero starts
   exiting (scroll > 1px). It detaches the stage from the scroll-container
   so the phone is fixed in place from the very first scroll, eliminating
   the black gap that would otherwise appear before ScrollTrigger boots. */
.showcase-stage.is-early-pinned {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

/* ═══════ BACKGROUND LAYERS ═══════ */
.showcase-bg-morph {
  position: absolute;
  inset: -200px;
  border-radius: 50%;
  filter: blur(180px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  transition: background 1.2s ease, opacity 1s ease;
}

.showcase-subject-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.3;
}

/* ═══════ SECTION HEADING — centered near top, RTL ═══════ */
.showcase-heading {
  position: absolute;
  top: 6vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  direction: rtl;
  pointer-events: none;
}

.showcase-heading .section-badge {
  margin-bottom: 10px;
}

.showcase-heading .section-title {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.2;
  margin: 0;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

/* ═══════ PHONE CENTER — positioned via transform for GPU acceleration ═══════ */
.showcase-phone-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8; /* above info-track (z-index:6) so hover events reach it */
  display: flex;
  align-items: center;
  justify-content: center;
  /* Transform-based positioning: translate(-50%,-50%) + translateX(Xvw) set by JS */
  transform: translate(-50%, -50%) translateX(-28vw);
  will-change: transform;
  transition: none; /* GSAP handles movement */
  pointer-events: none; /* container is just a positioner; let wrapper handle events */
}

/* Gradient glow behind phone */
.showcase-phone-glow {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: background 1s ease, opacity 0.8s ease;
}

.showcase-phone-glow.active {
  opacity: 0.55;
}

.showcase-phone-wrapper {
  position: relative;
  width: 420px;
  height: 680px;
  z-index: 1;
  overflow: visible;
  pointer-events: auto; /* wrapper receives hover/click for screen swap */
  cursor: pointer;
}

.iphone3d-container {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iphone3d-container canvas {
  width: 100% !important;
  height: 100% !important;
  pointer-events: auto;
}

.iphone3d-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-ar);
  transition: opacity 0.5s ease;
  z-index: 5;
}

.iphone3d-loading.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.iphone3d-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-glass);
  border-top-color: var(--neon-primary);
  border-radius: 50%;
  animation: iphone3dSpin 0.8s linear infinite;
}

@keyframes iphone3dSpin {
  to { transform: rotate(360deg); }
}

/* ═══════ INFO TRACK — full viewport, panels positioned by JS ═══════ */
.showcase-info-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 6;
  pointer-events: none;
}

/* ═══════ INFO PANEL — one per teacher ═══════ */
.showcase-info-panel {
  position: absolute;
  top: 0;
  height: 100%;
  width: 45%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 48px;
  direction: rtl;
  pointer-events: none;
  /* Hidden by default — GSAP reveals */
  opacity: 0;
  will-change: transform, opacity;
}

.showcase-info-panel.is-active {
  pointer-events: all;
}

/* Panel on the left side (phone is on right) — RTL: left = text side */
.showcase-info-panel.side-left {
  left: 0;
  right: auto;
  text-align: right;
  padding-right: 60px;
  padding-left: 32px;
}

/* Panel on the right side (phone is on left) */
.showcase-info-panel.side-right {
  right: 0;
  left: auto;
  text-align: right;
  padding-right: 60px;
  padding-left: 32px;
}

/* Subject badge — sits beside name */
.showcase-subject-badge {
  display: inline-block;
  padding: 0;
  font-family: var(--font-ar);
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
  vertical-align: middle;
}

/* Teacher name */
.showcase-teacher-name {
  font-family: var(--font-ar);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0;
}

/* Teacher description */
.showcase-teacher-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.9;
  margin-bottom: 28px;
}

/* ═══════ TEACHER CONTENT LAYOUT — photo on top, name beneath ═══════ */
.showcase-teacher-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
}

.showcase-teacher-top {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 2px;
}

/* ═══════ TEACHER PHOTO — frameless, themed shadow, bottom fade ═══════ */
.showcase-teacher-photo-wrap {
  position: relative;
  flex-shrink: 0;
  width: 200px;
  height: 255px;
}

.showcase-teacher-photo-glow {
  position: absolute;
  inset: -24px -18px -8px -18px;
  border-radius: 50%;
  filter: blur(44px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: background 1s ease, opacity 0.8s ease;
  animation: showcasePhotoGlowPulse 4s ease-in-out infinite;
}

.showcase-info-panel .showcase-teacher-photo-glow {
  opacity: 0.75;
}

@keyframes showcasePhotoGlowPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.85; transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .showcase-teacher-photo-glow { animation: none; }
}

/* Frameless media: no border, no background, top fully lit, bottom fades */
.showcase-teacher-photo-media {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, rgba(0,0,0,0.6) 80%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 55%, rgba(0,0,0,0.6) 80%, transparent 100%);
}

.showcase-teacher-photo-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: drop-shadow(0 -4px 10px rgba(255, 255, 255, 0.08));
}

.showcase-teacher-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18px;
  font-size: 4rem;
  font-weight: 800;
  font-family: var(--font-ar);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

/* ═══════ PLATFORM LINKS ═══════ */
.showcase-platforms {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.platform-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-ar);
  transition: all 0.25s var(--ease-out-quart);
}

.platform-link:hover {
  background: var(--bg-glass-hover);
  border-color: var(--neon-primary);
  color: var(--text-primary);
  box-shadow: 0 0 20px var(--neon-glow-soft);
  transform: translateY(-2px);
}

.platform-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   LIGHTWEIGHT CSS iPHONE 15 PRO MAX MOCKUP — Mobile only
   - Hidden on desktop (3D Three.js takes over)
   - Pure CSS: no GLB, no WebGL, no Three.js parse
   - Dynamic Island, titanium-style frame, side buttons, glare
   ═══════════════════════════════════════════════════ */
.iphone-css-mockup {
  display: none; /* hidden on desktop, shown on mobile via @media */
}

.iphone-css-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 52px;
  background:
    linear-gradient(145deg, #4a4a52 0%, #2c2c34 25%, #1a1a20 55%, #2c2c34 85%, #45454d 100%);
  padding: 11px;
  box-shadow:
    /* Inner titanium edge */
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    /* Outer drop shadow */
    0 30px 70px rgba(0, 0, 0, 0.55),
    0 12px 28px rgba(0, 0, 0, 0.45);
}

/* Side buttons — subtle titanium ridges on the frame */
.iphone-css-side-btn {
  position: absolute;
  background: linear-gradient(90deg, #2a2a30 0%, #4a4a52 50%, #2a2a30 100%);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

/* Action button (top-left in RTL phone = top-right of frame visually,
   but iPhones have it on the LEFT side. Here we place on the right edge
   because phone is mirrored / RTL flipped via translate. Keep simple: left side. */
.iphone-css-side-btn--mute {
  left: -2px;
  top: 110px;
  width: 4px;
  height: 30px;
}

.iphone-css-side-btn--vol-up {
  left: -2px;
  top: 160px;
  width: 4px;
  height: 52px;
}

.iphone-css-side-btn--vol-down {
  left: -2px;
  top: 222px;
  width: 4px;
  height: 52px;
}

.iphone-css-side-btn--power {
  right: -2px;
  top: 165px;
  width: 4px;
  height: 78px;
}

/* The actual screen — rounded inset where the screenshot lives */
.iphone-css-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 42px;
  overflow: hidden;
  background: #000;
  box-shadow:
    inset 0 0 0 2px #0a0a0e,
    inset 0 0 24px rgba(0, 0, 0, 0.55);
}

/* Dynamic Island — pill-shaped notch */
.iphone-css-island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 30px;
  background: #000;
  border-radius: 18px;
  z-index: 5;
  box-shadow:
    inset 0 1px 1px rgba(40, 40, 50, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Dynamic Island camera dot — small accent */
.iphone-css-island::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #2a2a3a 0%, #050508 60%, #000 100%);
  box-shadow: inset 0 0 2px rgba(80, 80, 120, 0.4);
}

/* The screenshot image — fills the screen */
.iphone-css-screenshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: opacity 0.35s ease;
  z-index: 1;
}

.iphone-css-screenshot:not([src]),
.iphone-css-screenshot[src=""] {
  opacity: 0;
}

/* Subtle screen glare — diagonal sheen across the glass */
.iphone-css-screen-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(125deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0) 22%,
      rgba(255, 255, 255, 0) 68%,
      rgba(255, 255, 255, 0.05) 85%,
      rgba(255, 255, 255, 0) 100%
    );
  z-index: 4;
  mix-blend-mode: screen;
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1100px) {
  .showcase-phone-wrapper {
    width: 360px;
    height: 580px;
  }

  .showcase-phone-glow {
    width: 380px;
    height: 380px;
  }

  .showcase-info-panel {
    width: 50%;
  }

  .showcase-teacher-photo-wrap {
    width: 160px;
    height: 205px;
  }

  .showcase-teacher-content {
    gap: 14px;
  }

  .showcase-teacher-top {
    gap: 18px;
  }
}

@media (max-width: 768px) {
  /* Mobile: BIG phone as the stage/backdrop, teacher photo standing in front
     of it like a hero spotlit on stage. Phone is the canvas, teacher is the star.
     Phone stays static on mobile (no spin/parallax/floating) for performance. */
  .showcase-phone-center {
    left: 50% !important;
    top: 38%;
    transform: translate(-50%, -50%) !important;
    z-index: 1; /* behind the photo */
  }

  .showcase-phone-wrapper {
    width: 280px;
    height: 600px;
    transform: rotate(-2deg);
    transform-origin: center center;
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.55));
    opacity: 0.95;
  }

  /* Mobile: 3D Three.js container OFF, lightweight CSS mockup ON */
  .iphone3d-container {
    display: none !important;
  }

  .iphone-css-mockup {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
  }

  .showcase-phone-glow {
    width: 460px;
    height: 460px;
    opacity: 0.7 !important;
    filter: blur(85px);
  }

  /* Info track holds the photo + text in front of the phone */
  .showcase-info-track {
    width: 100%;
    top: 0;
    bottom: auto;
    height: 100%;
    z-index: 2;
  }

  .showcase-info-panel {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0;
    height: 100%;
    padding: 0 24px 24px;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
  }

  .showcase-teacher-content {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
  }

  .showcase-teacher-top {
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    margin-bottom: 6px;
  }

  /* Hero photo: large, in front of the phone, full body visible */
  .showcase-teacher-photo-wrap {
    position: relative;
    width: 320px;
    height: 440px;
    margin: 0 auto;
    z-index: 3; /* above the phone */
    pointer-events: none;
  }

  .showcase-teacher-photo-media {
    /* Soft fade only at the very bottom so feet blend into panel */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 78%, rgba(0,0,0,0.6) 92%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 0%, #000 78%, rgba(0,0,0,0.6) 92%, transparent 100%);
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
  }

  .showcase-teacher-photo-glow {
    inset: -10px -30px -10px -30px;
    filter: blur(50px);
    opacity: 1;
  }

  .showcase-teacher-name-row {
    margin-top: 2px;
    margin-bottom: 8px !important;
    gap: 10px !important;
  }

  .showcase-platforms {
    margin-top: 4px;
    gap: 10px;
  }

  .showcase-teacher-photo-placeholder {
    font-size: 2.2rem;
  }

  .showcase-subject-badge {
    align-self: center;
  }

  .showcase-teacher-name {
    font-size: clamp(1.3rem, 5vw, 1.7rem);
  }

  .showcase-teacher-desc {
    font-size: 0.85rem;
    margin-bottom: 16px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .showcase-heading {
    display: none;
  }

  .platform-link {
    padding: 9px 16px;
    font-size: 0.8rem;
  }

  .showcase-platforms {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .showcase-phone-center {
    top: 36%;
  }

  .showcase-phone-wrapper {
    width: 310px;
    height: 555px;
  }

  .showcase-phone-glow {
    width: 400px;
    height: 400px;
  }

  .showcase-info-panel {
    padding: 0 18px 20px;
  }

  .showcase-teacher-photo-wrap {
    width: 280px;
    height: 380px;
  }

  .showcase-teacher-photo-placeholder {
    font-size: 1.8rem;
    padding-top: 10px;
  }

  .platform-link {
    padding: 8px 14px;
    font-size: 0.75rem;
    border-radius: 10px;
  }
}
