/*
 RUYA MOBILE SCROLL STANDARD V1
 --------------------------------------------------------------
 iPhone / Android / iPad / Android Tablet
 Portrait + Landscape

 Amaç:
 - İçerik sığıyorsa scroll yok.
 - İçerik taşıyorsa yalnız gerekli kadar scroll.
 - Body/document scroll yok.
 - Asıl scroll sahibi .main.
 - Mevcut HOME ve özel fit ekranlar JS tarafından hariç tutulur.
*/

html.ruyaAdaptiveViewportV1,
html.ruyaAdaptiveViewportV1 body{
  box-sizing:border-box !important;

  width:100% !important;

  height:var(--ruya-adaptive-vh,100dvh) !important;
  min-height:0 !important;
  max-height:var(--ruya-adaptive-vh,100dvh) !important;

  margin:0 !important;

  overflow:hidden !important;
  overscroll-behavior:none !important;
}

html.ruyaAdaptiveViewportV1 body{
  position:relative !important;
}

/*
 React root / shell viewport dışına taşamaz.
*/
html.ruyaAdaptiveViewportV1 body > #root,
html.ruyaAdaptiveViewportV1 .shell{
  box-sizing:border-box !important;

  width:100% !important;

  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;

  overflow:hidden !important;
}

/*
 ANA KURAL

 Main'in scrollHeight'i clientHeight'ten küçük/eşitse
 overflow:auto hiçbir hareket üretmez.

 Büyükse yalnız gereken kadar kayar.
*/
html.ruyaAdaptiveViewportV1 .shell > .main{
  box-sizing:border-box !important;

  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;

  overflow-x:hidden !important;
  overflow-y:auto !important;

  overscroll-behavior-x:none !important;
  overscroll-behavior-y:contain !important;

  -webkit-overflow-scrolling:touch !important;

  scroll-padding-top:
    env(safe-area-inset-top)
    !important;

  scroll-padding-bottom:
    calc(16px + env(safe-area-inset-bottom))
    !important;
}

/*
 İçerik yüzünden yatay taşma oluşmasın.
*/
html.ruyaAdaptiveViewportV1 .shell > .main > *{
  max-width:100% !important;
}

/*
 iPhone notch / Dynamic Island / Android cutout.
 Mevcut sayfa paddinglerini değiştirmiyoruz;
 yalnız scroll sınırlarını güvenli hale getiriyoruz.
*/
html.ruyaAdaptiveViewportV1{
  --ruya-safe-top:env(safe-area-inset-top,0px);
  --ruya-safe-right:env(safe-area-inset-right,0px);
  --ruya-safe-bottom:env(safe-area-inset-bottom,0px);
  --ruya-safe-left:env(safe-area-inset-left,0px);
}

/*
 Modal açıkken arka viewport zaten kilitlidir.
 Modalın kendi mevcut scroll davranışı korunur.
*/
html.ruyaAdaptiveViewportV1 .modalBack,
html.ruyaAdaptiveViewportV1 [class*="ModalBack"],
html.ruyaAdaptiveViewportV1 [class*="Overlay"]{
  overscroll-behavior:contain;
}

/*
 Landscape'de yatay taşmayı kesin önle.
*/
@media (orientation:landscape){
  html.ruyaAdaptiveViewportV1 .shell > .main{
    overflow-x:hidden !important;
  }
}

/*
 Çok küçük telefonlar.
 iPhone SE benzeri ekranlarda da aynı matematik.
*/
@media (max-width:390px){
  html.ruyaAdaptiveViewportV1 .shell > .main{
    min-width:0 !important;
  }
}

/*
 Dokunmatik tabletler.
 iPad Pro landscape dahil 1366 CSS px'e kadar.
*/
@media (min-width:781px) and (max-width:1366px) and (pointer:coarse){
  html.ruyaAdaptiveViewportV1 .shell,
  html.ruyaAdaptiveViewportV1 .shell > .main{
    min-height:0 !important;
    max-height:100% !important;
  }
}

/*
 Print kesinlikle etkilenmesin.
*/
@media print{
  html.ruyaAdaptiveViewportV1,
  html.ruyaAdaptiveViewportV1 body,
  html.ruyaAdaptiveViewportV1 body > #root,
  html.ruyaAdaptiveViewportV1 .shell,
  html.ruyaAdaptiveViewportV1 .shell > .main{
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
  }
}
