/* ═══════════════════════════════════════════════════
   RESPONSIVE DESIGN — Adapt + Polish + Quieter
   ═══════════════════════════════════════════════════ */

/* ═══════ PERFORMANCE: content-visibility for below-fold ═══════ */
/* Disabled: content-visibility can cause rendering issues with GSAP animations */
/* 
.about,
.showcase-fullscreen,
.teachers-grid-section,
.stats,
.features,
.contact {
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}
*/

/* ═══════ POLISH: :active touch feedback for interactive cards ═══════ */
.feature-card:active {
  transform: translateY(-2px) scale(0.99);
  transition-duration: 0.1s;
}

.stat-card:active {
  transform: translateY(-2px) scale(0.99);
  transition-duration: 0.1s;
}

.contact-card:active {
  transform: translateY(-2px) scale(0.99);
  transition-duration: 0.1s;
}

/* Adapt: platform links — ensure 44px touch target height */
.platform-link {
  min-height: 44px;
}

/* ═══════ TABLET (max-width: 1024px) ═══════ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tablet: 2-col features */
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hero: logo 60% viewport width */
  .hero-logo-slot {
    width: 60vw;
    max-width: 360px;
  }

  /* Rift: reduce to 4 lines */
  .hero-rift .rift-line-5,
  .hero-rift .rift-line-6 {
    display: none;
  }
}

/* ═══════ MOBILE LARGE (max-width: 768px) ═══════ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  /* Adapt: 44×44px touch target for hamburger button */
  .nav-menu-btn {
    display: flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /* Hero: logo 75% viewport width */
  .hero-logo-slot {
    width: 75vw;
    max-width: 280px;
  }

  /* Nav anchor: smaller docked logo */
  .nav-logo-anchor {
    width: 90px;
    height: 27px;
  }

  /* Aurora: reduce blur for performance */
  .hero-aurora {
    filter: blur(30px);
  }

  /* Rift: reduce to 3 lines */
  .hero-rift .rift-line-4,
  .hero-rift .rift-line-5,
  .hero-rift .rift-line-6 {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    max-width: 380px;
  }

  /* Quieter: less padding on mobile stat cards */
  .stat-card {
    padding: 28px 20px;
  }

  .features-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .contact-cards {
    flex-direction: column;
    align-items: center;
  }

  .contact-card {
    width: 100%;
    max-width: 340px;
    padding: 28px 32px;
  }

  /* Showcase Mobile */
  .showcase-viewport {
    min-height: 580px;
  }

  .showcase-phones {
    height: 320px;
  }

  .showcase-phone {
    width: 140px;
    height: 280px;
    border-radius: 20px;
  }

  .showcase-phone-left {
    transform: translateX(80px) translateZ(-30px) rotateY(8deg);
  }

  .showcase-phone-right {
    transform: translateX(-80px) translateZ(-30px) rotateY(-8deg);
  }

  .showcase-teacher-photo {
    width: 120px;
    height: 120px;
  }

  .showcase-teacher-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  /* Track: smaller padding on mobile */
  .teachers-stage {
    padding: 120px 8px 20px;
    gap: 16px;
  }

  .teacher-grid-card {
    flex: 0 0 290px;
    padding: 180px 20px 22px;
  }

  .teacher-card-stage {
    width: 290px;
    height: 290px;
    top: -90px;
  }

  .teacher-card-photo {
    width: 190px;
    height: 260px;
  }

  .teacher-card-screen {
    width: 128px;
    height: 258px;
  }

  /* Nav arrows: smaller, hug the section edges */
  .teachers-nav-btn {
    width: 42px;
    height: 42px;
  }
  .teachers-nav-prev { right: 8px; }
  .teachers-nav-next { left: 8px; }

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

  .about-stats-row {
    justify-content: center;
    gap: 24px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Dev Panel Mobile */
  .dev-panel {
    width: 95%;
    max-height: 90vh;
  }

  .dev-field-row {
    grid-template-columns: 1fr;
  }

  .dev-panel-footer {
    flex-wrap: wrap;
  }

  .dev-btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
    min-height: 44px;
  }
}

/* ═══════ MOBILE SMALL (max-width: 480px) ═══════ */
@media (max-width: 480px) {
  :root {
    --section-padding: 40px;
  }

  /* Hero logo slot: smaller on tiny screens */
  .hero-logo-slot {
    width: 80vw;
    max-width: 240px;
    margin-bottom: 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .feature-card {
    padding: 22px 18px;
  }

  .features-headline {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }

  /* Track: small phones */
  .teachers-stage {
    padding: 100px 12px 18px;
    gap: 14px;
  }

  .teacher-grid-card {
    flex: 0 0 262px;
    padding: 160px 16px 20px;
  }

  .teacher-card-stage {
    width: 260px;
    height: 250px;
    top: -78px;
  }

  .teacher-card-photo {
    width: 168px;
    height: 226px;
  }

  .teacher-card-screen {
    width: 110px;
    height: 222px;
  }

  .teacher-card-name {
    font-size: 1.2rem;
    margin-top: 22px;
  }

  .teacher-card-desc {
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    min-height: 3em;
  }

  .showcase-phones {
    height: 220px;
  }

  .showcase-phone {
    width: 100px;
    height: 200px;
    border-radius: 12px;
  }

  .showcase-phone-left {
    transform: translateX(45px) translateZ(-20px) rotateY(5deg);
  }

  .showcase-phone-right {
    transform: translateX(-45px) translateZ(-20px) rotateY(-5deg);
  }

  .showcase-teacher-photo {
    width: 100px;
    height: 100px;
  }

  /* Adapt: smaller platform links on tiny screens but keep touch target */
  .showcase-platforms {
    gap: 8px;
  }

  .platform-link {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .about-glass-card {
    padding: 24px 20px;
  }

  /* Quieter: reduce section-title size on very small screens */
  .section-title {
    font-size: clamp(1.7rem, 6vw, 2.5rem);
  }
}

/* ═══════ VERY SMALL (max-width: 360px) ═══════ */
@media (max-width: 360px) {
  :root {
    --section-padding: 36px;
    --container-padding: 16px;
  }

  .mobile-link {
    font-size: 1.2rem;
    padding: 12px 28px;
  }
}

/* ═══════ TOUCH DEVICE OPTIMIZATIONS ═══════ */
@media (hover: none) {
  /* Touch: lift the centered card so its V-fan screenshots render above
     the neighbouring cards (which would otherwise overlap them). */
  .teacher-grid-card.is-active {
    z-index: 5;
  }

  /* Touch: V-screenshots always visible on active card (no hover needed) */
  .teacher-grid-card.is-active .teacher-card-screen.screen-left {
    opacity: 1;
    transform: translate(-72px, 20px) rotate(-15deg) scale(0.95);
  }
  .teacher-grid-card.is-active .teacher-card-screen.screen-right {
    opacity: 1;
    transform: translate(72px, 20px) rotate(15deg) scale(0.95);
  }

  /* Touch: kill the :hover grow on tap — fingers leave the hover state
     stuck and the photo/screens balloon past the static mobile layout. */
  .teacher-grid-card:hover {
    transform: none;
  }
  .teacher-grid-card:hover .teacher-card-photo {
    transform: none;
    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));
  }
  .teacher-grid-card:hover .teacher-card-screen.screen-left {
    transform: translate(-72px, 20px) rotate(-15deg) scale(0.95);
  }
  .teacher-grid-card:hover .teacher-card-screen.screen-right {
    transform: translate(72px, 20px) rotate(15deg) scale(0.95);
  }

  .feature-card:hover {
    transform: none;
  }

  .contact-card:hover {
    transform: none;
  }

  /* Ensure hover glows don't stick on touch */
  .stat-card:hover {
    transform: none;
    box-shadow: none;
  }
}

/* ═══════ HIGH DPI SCREENS ═══════ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Higher quality rendering for retina */
  .nav-logo-img,
  .hero-logo-img,
  .footer-logo {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* ═══════ REDUCED MOTION ═══════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  /* Keep content-visibility but skip animation */
  .hero-glow,
  .particle {
    animation: none;
    opacity: 0.1;
  }

  /* Aurora: static */
  .hero-aurora {
    animation: none;
  }

  /* Rift lines: static, visible */
  .hero-rift .rift-line {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 0.35;
  }

  /* Morph logo: instant transitions */
  .morph-logo {
    transition: none;
  }
}

/* ═══════ LANDSCAPE MOBILE ═══════ */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 100svh;
    padding-top: 80px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
  }

  /* Hero logo slot: landscape adjustment */
  .hero-logo-slot {
    width: 50vw;
    max-width: 200px;
    margin-bottom: 16px;
  }
}
