/*
 * M307.4 — Mobile section flow, fixed-navigation clearance and update ticker.
 * Scoped to managed homepage phones/tablets only; desktop styles are untouched.
 */
@media (max-width: 767px) {
  /* Reduce the visible gap after the portal block without hiding sections. */
  body.home.shk-managed-home-active #shikshan-homepage .shk-home-section:has(.shk-m243-portals) + .shk-home-section,
  body.home.shk-managed-home-active .shk-managed-homepage .shk-home-section:has(.shk-m243-portals) + .shk-home-section {
    margin-block-start: 12px !important;
    padding-block-start: 12px !important;
  }
  body.home.shk-managed-home-active #shikshan-homepage .shk-home-section:has(.shk-m243-portals),
  body.home.shk-managed-home-active .shk-managed-homepage .shk-home-section:has(.shk-m243-portals) {
    margin-block-end: 0 !important;
    padding-block-end: 0 !important;
  }

  /* Reserve enough real scroll space for the fixed five-item bottom bar. */
  body.home.shk-managed-home-active #shikshan-homepage,
  body.home.shk-managed-home-active .shk-managed-homepage {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.home.shk-managed-home-active .shikshan-global-bottom-nav {
    bottom: calc(5px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Keep latest-update headlines readable instead of clipping at the viewport. */
  body.home.shk-managed-home-active .shk-m291-updates,
  body.home.shk-managed-home-active .shk-m291-update-items {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  body.home.shk-managed-home-active .shk-m291-update-items {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 6px 12px !important;
    overflow: visible !important;
  }
  body.home.shk-managed-home-active .shk-m291-update-items a,
  body.home.shk-managed-home-active .shk-m291-update-items span {
    display: block !important;
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    text-overflow: clip !important;
  }
}
