/* Ahqaf Today 2.1.4 — isolated mobile layer.
   Extracted from the proven final mobile overrides in site.css.
   Desktop is unaffected because all rules are inside max-width media queries. */

/* =========================================================
   Ahqaf Today 2.0.44 — mobile root overflow fix
   Fixes homepage opening wider than the phone viewport.
   Desktop geometry remains untouched.
   ========================================================= */
@media (max-width:980px){

  html,
  body{
    width:100%;
    max-width:100%;
    overflow-x:hidden;
  }

  /* This historical desktop-only advertisement extension was
     applied globally and made the homepage 268px wider than
     the phone viewport. Reset it on phones/tablets. */
  .ahqaf-final-horizontal-ad{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;

    left:auto !important;
    right:auto !important;

    margin-left:0 !important;
    margin-right:0 !important;

    transform:none !important;
    box-sizing:border-box !important;
  }

  /* Keep the homepage master areas bounded by the viewport. */
  .ahqaf-green-top,
  .ahqaf-green-top > *,
  .ahqaf-final-lead,
  .ahqaf-final-left,
  .ahqaf-final-center,
  .ahqaf-final-latest,
  .ahqaf-final-writers{
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }

  /* No media element may establish a wider scroll canvas. */
  .ahqaf-green-top img,
  .ahqaf-final-horizontal-ad img,
  .home-ad-wide img,
  .ahqaf-inline-content-ad img,
  video,
  iframe{
    max-width:100% !important;
  }
}


/* =========================================================
   AHQAF TODAY 2.0.45 — ROOT RESPONSIVE FIX
   Definitive mobile override. Cancels legacy rules that forced
   the 4-column desktop grid even inside max-width:760px.
   Desktop >= 981px remains unchanged.
   ========================================================= */
@media (max-width:980px){
  html,body{width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:hidden!important}
  .wrap,.main,.main>.wrap{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important}

  .ahqaf-green-top{
    display:flex!important;flex-direction:column!important;
    grid-template-columns:none!important;grid-template-rows:none!important;grid-template-areas:none!important;
    width:100%!important;max-width:100%!important;min-width:0!important;
    gap:14px!important;overflow:visible!important;direction:rtl!important
  }
  .ahqaf-green-top>*{
    position:static!important;width:100%!important;max-width:100%!important;min-width:0!important;
    margin-left:0!important;margin-right:0!important;left:auto!important;right:auto!important;
    transform:none!important;box-sizing:border-box!important;direction:rtl!important
  }

  .ahqaf-green-top>.ahqaf-final-center,.ahqaf-green-top>.ahqaf-final-latest{
    display:block!important;height:auto!important;min-height:0!important;max-height:none!important;
    margin:0!important;padding:0!important;overflow:visible!important
  }

  .ahqaf-final-lead,.ahqaf-final-lead .lead-shell,.ahqaf-final-lead .lead-stage{width:100%!important;max-width:100%!important;min-width:0!important}
  .ahqaf-final-lead .lead-stage{height:300px!important;min-height:300px!important;max-height:300px!important}

  .ahqaf-final-latest>.panel{display:block!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;margin:0 0 14px!important}
  .ahqaf-final-latest .latest-item{height:auto!important;min-height:78px!important;max-height:none!important;display:grid!important;grid-template-columns:78px minmax(0,1fr)!important;gap:10px!important;align-items:center!important;padding:9px!important}
  .ahqaf-final-latest .latest-item .thumb{width:78px!important;height:58px!important;min-width:78px!important;max-width:78px!important;object-fit:cover!important}
  .ahqaf-final-latest .latest-item h4{height:auto!important;max-height:3.2em!important;overflow:hidden!important;display:-webkit-box!important;-webkit-box-orient:vertical!important;-webkit-line-clamp:2!important;font-size:14px!important;line-height:1.6!important}
  .ahqaf-latest-placeholder{display:none!important}

  .ahqaf-green-top>.ahqaf-final-latest>.ahqaf-latest-x,.ahqaf-latest-x{width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;margin:0!important;overflow:visible!important}
  .ahqaf-latest-x .x-highlight-body{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important}

  .ahqaf-final-center>.legacy-section{width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;margin:0 0 14px!important;overflow:visible!important}
  .ahqaf-final-center .lead-news-grid,.ahqaf-final-center .sports-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important;height:auto!important;gap:10px!important;padding:10px!important;overflow:visible!important}
  .ahqaf-final-center .mini-story,.ahqaf-final-center .sport-story{min-width:0!important;height:auto!important;max-height:none!important}
  .ahqaf-final-center .mini-img,.ahqaf-final-center .sport-img{width:100%!important;height:145px!important;min-height:145px!important;max-height:145px!important;object-fit:cover!important}

  .ahqaf-final-writers{display:block!important;width:100%!important}
  .ahqaf-final-writers>*,.writers-panel,.writers-poll,.sidebar-actions{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
  .writers-mini{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .writer-mini{min-width:0!important}

  .ahqaf-final-left{display:block!important;width:100%!important}
  .ahqaf-final-left>*{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
  .ahqaf-final-left .tower-ad{height:220px!important;min-height:220px!important;max-height:220px!important;margin-bottom:14px!important;overflow:hidden!important}
  .ahqaf-final-left .tower-ad img{width:100%!important;height:100%!important;object-fit:cover!important}

  .ahqaf-green-top>.ahqaf-market-row,.ahqaf-market-row{display:grid!important;grid-template-columns:1fr!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;gap:12px!important;overflow:visible!important}
  .ahqaf-market-row .ahqaf-market-box{width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;box-sizing:border-box!important}

  .ahqaf-green-top>.ahqaf-video-fixed-mid,.ahqaf-video-fixed-mid{width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;max-height:none!important;margin:0!important;overflow:hidden!important}
  .ahqaf-video-fixed-mid .video-today-media{width:100%!important;height:220px!important;min-height:220px!important;max-height:220px!important}

  .ahqaf-final-horizontal-ad,.ahqaf-green-top>.ahqaf-final-horizontal-ad,.ahqaf-green-top>.ahqaf-video-fixed-mid,.ahqaf-lower-wide,.ahqaf-services-home,.regions-home{
    width:100%!important;max-width:100%!important;min-width:0!important;left:auto!important;right:auto!important;
    margin-left:0!important;margin-right:0!important;transform:none!important;box-sizing:border-box!important
  }
  .ahqaf-final-horizontal-ad{height:180px!important;min-height:180px!important;max-height:180px!important}

  .home-split,.ahqaf-split-ads{grid-template-columns:1fr!important}
  .ahqaf-ency-home-sections{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .regions,.regions-six{grid-template-columns:repeat(2,minmax(0,1fr))!important}

  img,video,iframe,svg,canvas{max-width:100%!important}
  .ticker{max-width:100%!important;overflow:hidden!important}
}

@media (max-width:600px){
  .main>.wrap{padding-left:8px!important;padding-right:8px!important}
  .ahqaf-final-lead .lead-stage{height:245px!important;min-height:245px!important;max-height:245px!important}
  .ahqaf-final-center .lead-news-grid,.ahqaf-final-center .sports-grid,.writers-mini,.ahqaf-ency-home-sections,.regions,.regions-six{grid-template-columns:1fr!important}
  .ahqaf-final-center .mini-img,.ahqaf-final-center .sport-img{height:185px!important;min-height:185px!important;max-height:185px!important}
  .ahqaf-final-latest .latest-item{grid-template-columns:72px minmax(0,1fr)!important}
  .ahqaf-final-latest .latest-item .thumb{width:72px!important;min-width:72px!important;max-width:72px!important;height:54px!important}
  .ahqaf-video-fixed-mid .video-today-media{height:190px!important;min-height:190px!important;max-height:190px!important}
  .ahqaf-ency-home-intro{flex-direction:column!important;align-items:flex-start!important}
}
