/* ===== Tablet ===== */
@media (max-width: 1024px) {
  .stages-grid { grid-template-columns: repeat(2, 1fr); }
  .activities-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
  .facilities-grid { grid-template-columns: repeat(2, 1fr); }
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  .learning-path { grid-template-columns: repeat(3, 1fr); }
  .learning-path::before { display: none; }
  .testimonials-grid { grid-template-columns: 1fr 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Mobile Navigation ===== */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed;
    inset-block-start: var(--header-height);
    inset-inline: 0;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - var(--header-height));
    background: var(--bg-main);
    padding: 1.5rem;
    transform: translateY(-150%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 95;
    box-shadow: 0 10px 30px rgba(38, 54, 74, 0.1);
    overflow-y: auto;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .main-nav.open { 
    transform: translateY(0); 
  }

  .main-nav ul { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 0.5rem; 
    padding-top: 1rem;
  }

  .nav-link { 
    padding: 1rem; 
    border-radius: var(--radius-sm); 
    font-size: 1.1rem;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
  }

  /* إظهار زر الإغلاق داخل القائمة */
  .nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.8rem;
    background: rgba(89, 188, 235, 0.1);
    color: var(--color-primary-dark);
    border-radius: var(--radius-sm);
    font-weight: 700;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .header-cta { display: none; }


  .about-grid { grid-template-columns: 1fr; }
  .about-badge { inset-inline-start: 1rem; }
  .parents-grid { grid-template-columns: 1fr; }
  .admission-grid { grid-template-columns: 1fr; }
}

/* ===== Small phones ===== */
/* ===== Hero on Mobile (Centered inside image) ===== */
@media (max-width: 640px) {
  .hero {
    position: relative;
    height: 62svh; /* حوالي نصف الشاشة */
    min-height: 420px;
    max-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: 0;
    background-color: var(--bg-main);
  }

  /* الصورة تملأ كامل مساحة الهيرو */
  .hero-media {
    position: absolute;
    inset: 0;
    height: 100%;
  }

  .hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    animation: none; /* إيقاف التكبير المستمر لأداء أفضل */
  }

  /* تدرج داكن لضمان وضوح النص فوق الصورة */
  .hero-overlay {
    background: linear-gradient(
      180deg,
      rgba(38, 54, 74, 0.45) 0%,
      rgba(38, 54, 74, 0.65) 60%,
      rgba(38, 54, 74, 0.75) 100%
    );
  }

  /* المحتوى فوق الصورة في المنتصف */
  .hero-content {
    position: relative;
    z-index: 2;
    color: #fff;
    max-width: 100%;
    padding: 1.2rem;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
  }

  .hero-eyebrow {
    background: rgba(255, 209, 102, 0.95);
    color: var(--text-main);
    font-size: 0.75rem;
    padding: 0.3rem 0.9rem;
    margin-bottom: 0.8rem;
  }

  .hero-title {
    font-size: clamp(1.35rem, 6.5vw, 1.85rem);
    line-height: 1.35;
    margin-bottom: 0.9rem;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
  }

  .hero-desc {
    font-size: 0.85rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1.3rem;
    max-width: 92%;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  }

  /* الأزرار عمودية بحجم مناسب للمس */
  .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 260px;
    gap: 0.6rem;
  }

  .hero-actions .btn {
    width: 100%;
    padding: 0.75rem 1.2rem;
    font-size: 0.88rem;
    justify-content: center;
  }

  /* إخفاء مؤشر التمرير على الهاتف */
  .hero-scroll { display: none; }
}