/* =====================================================
   mobile-fix.css  — حمّله بعد style.css مباشرة
   <link href="./assets/css/mobile-fix.css?ver=1" rel="stylesheet" />
===================================================== */

/* ---------- أساسيات (كل الشاشات) ---------- */
html { -webkit-text-size-adjust: 100%; }
html, body { height: auto; min-height: 100%; }   /* height:100% كانت بتكسر الـ sticky */
body { overflow-x: clip; }                       /* clip مش hidden عشان الـ sticky يفضل شغال */
img, video, iframe { max-width: 100%; }
img { height: auto; }

/* ---------- موبايل / تابلت ---------- */
@media (max-width: 880px) {

  /* نص القصة */
  p, .main-content p {
    font-size: 17px;
    line-height: 1.95;
    text-align: right !important;      /* justify بيعمل فراغات كبيرة في الموبايل */
    margin: 12px 0 18px;
    overflow-wrap: anywhere;
  }
  .main-content, .content-section .main-content {
    max-width: 100%;
    padding-inline: 18px;
  }
  .content-section { padding: 24px 0; }

  /* العناوين اللي عليها inline style (line-height:20px كانت بتخلي السطور تركب) */
  h3 {
    font-size: 24px !important;
    line-height: 1.6 !important;
    margin: 18px 0 8px !important;
  }

  /* الصور */
  .img-x, .main-content img { width: 100% !important; }
  .main-content p img { border-radius: 10px; }

  /* اللوجو */
  .logo2 { left: 12px; top: 12px; }
  .logopic { width: 80px; }

  /* ---------- سيكشن الصورة الثابتة + النص (scroll-content-section) ---------- */
  #section02-img {
    height: 100vh; height: 100svh;      /* svh = ثابت حتى لو شريط المتصفح طلع/نزل */
    object-fit: cover !important;
    object-position: center !important;
  }
  .section02-content {
    min-height: 100vh; min-height: 100svh;
    margin-top: -100vh; margin-top: -100svh;
    background: rgba(0, 0, 0, .55);     /* قراءة أوضح للنص الأبيض */
  }
  .section02-content article { max-width: 100%; }
  .row-img-p {
    width: 100%;
    padding: 70px 18px 40px;            /* كان 250px من فوق */
    min-height: 100vh; min-height: 100svh;
    justify-content: center;
    gap: 0;
  }
  .content-sticky,
  #content-sticky-sec02 { width: 100% !important; min-height: 0 !important; }
  .content-sticky p { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); }

  /* السيكشنز اللي فيها صورة بس (class="per"): شريط صورة عادي بدل sticky
     وبنخفي الـ overlay الفاضي اللي كان بيطلع فوق الفقرة اللي قبله */
  .per {
    position: relative !important;
    height: 42vh !important; height: 42svh !important;
    width: 100%;
    object-fit: cover !important;
  }
  .per + .section02-content { display: none; }

  /* الهامش السفلي (footnotes) */
  .elegant-footnote { font-size: 13px; padding-inline: 4px; }

  /* صور الأقمار الصناعية (2 جنب بعض) */
  .custom-section { grid-template-columns: 1fr; gap: 14px; }

  /* ---------- مشغل الصوت ---------- */
  .custom-audio-player { max-width: 100%; margin: 14px 0; padding: 14px; }
  .audio-controls { gap: 10px; }
  .audio-play { width: 46px; height: 46px; }      /* هدف لمس مريح */
  .audio-volume { width: 40px; height: 44px; }
  .audio-progress { height: 8px; }                /* شريط أسهل في السحب */
  .audio-progress::-webkit-slider-thumb { width: 20px; height: 20px; }
  .audio-progress::-moz-range-thumb { width: 16px; height: 16px; }
  .audio-info h3 { color: #fff !important; }

  /* ---------- معرض الصور (mzg) ---------- */
  .mzg { max-width: 100%; }
  .mzg img { width: 100%; height: auto; display: block; }

  /* ---------- معرض المحاضر + اللايت بوكس ---------- */
  .paper-gallery { padding: 20px 4px; }
  .paper-gallery-grid { grid-template-columns: 1fr; gap: 18px; max-width: 100%; }
  .paper-image { height: 300px; }
  .paper-zoom { opacity: 1; background: transparent; align-items: flex-end; justify-content: flex-end; padding: 10px; }
  .paper-zoom span { width: 40px; height: 40px; font-size: 26px; }
  .paper-card:hover { transform: none; }
  .paper-lightbox { padding: 0; }
  .paper-lightbox-box {
    width: 100%; height: 100vh; height: 100dvh;
    border-radius: 0; border: 0;
  }
  .paper-lightbox-image-wrap { padding: 64px 10px 10px; }
  .paper-nav { width: 44px; height: 44px; background: rgba(0,0,0,.55); }
  .paper-prev { left: 6px; }
  .paper-next { right: 6px; }
  .paper-close { width: 44px; height: 44px; top: 10px; right: 10px; }
  .paper-lightbox-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }

  /* ---------- زر + نافذة الـ PDF ---------- */
  .pdf-link { padding: 12px 22px; font-size: 16px; }
  .pdf-box { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
  .pdf-bar { padding: 10px 14px; }
  .pdf-bar button { width: 44px; height: 44px; }
}

/* ---------- موبايل صغير ---------- */
@media (max-width: 480px) {
  p, .main-content p { font-size: 16.5px; }
  h3 { font-size: 22px !important; }
  .row-img-p { padding-inline: 14px; }
  .main-content, .content-section .main-content { padding-inline: 14px; }
  .paper-image { height: 260px; }
}

/* ---------- تقليل الحركة لمن يفضّل ذلك ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}