/* AI Project Universe V5.1 — Academic Evidence clarity + AcademIQ native mobile scroll */

@media (max-width: 54rem) {
  /* Academic Evidence / AI Portfolio Hub: remove every glass/blur layer on mobile. */
  html[data-scroll-theme="academic-evidence"],
  html[data-scroll-theme="academic-evidence"] body {
    width: 100% !important;
    min-height: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: hsl(var(--background)) !important;
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    -webkit-overflow-scrolling: touch;
  }

  html[data-scroll-theme="academic-evidence"] #root,
  html[data-scroll-theme="academic-evidence"] #root > div,
  html[data-scroll-theme="academic-evidence"] main,
  html[data-scroll-theme="academic-evidence"] main > div {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
  }

  html[data-scroll-theme="academic-evidence"] [class*="backdrop-blur"],
  html[data-scroll-theme="academic-evidence"] [style*="backdrop-filter"],
  html[data-scroll-theme="academic-evidence"] aside {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* The bundled React app has a translucent fixed mobile bar and a full-screen
     legacy menu. They are replaced by the solid compact V5.1 navbar. */
  html[data-scroll-theme="academic-evidence"] #root [class*="md:hidden"][class*="fixed"],
  html[data-scroll-theme="academic-evidence"] #root [class*="fixed"][class*="inset-0"][class*="top-16"],
  html[data-scroll-theme="academic-evidence"] [data-apu-academic-legacy-nav="true"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }

  html[data-scroll-theme="academic-evidence"] [data-apu-mobile-sidebar="true"] {
    display: none !important;
  }

  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-project-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 2147482000 !important;
    min-height: 60px !important;
    padding-top: max(9px, env(safe-area-inset-top)) !important;
    border-bottom: 1px solid #393939 !important;
    background: #161616 !important;
    background-image: none !important;
    color: #fbfbfb !important;
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .22) !important;
    isolation: isolate;
  }

  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-project-mark {
    background: #8d8d8d !important;
    color: #fff !important;
  }

  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-project-toggle {
    border-color: #4d4d4d !important;
    background: #262626 !important;
    color: #fff !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-nav-drawer {
    position: sticky !important;
    top: 60px !important;
    z-index: 2147481999 !important;
    width: 100% !important;
    max-height: min(62dvh, 440px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    border-bottom: 1px solid #393939 !important;
    background: #1b1b1b !important;
    background-image: none !important;
    color: #fff !important;
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 14px 28px rgba(0, 0, 0, .28) !important;
  }

  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-nav-drawer a {
    border: 1px solid #393939 !important;
    background: #242424 !important;
    color: #f1f1f1 !important;
    opacity: 1 !important;
  }

  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-nav-drawer a[aria-current="page"],
  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-nav-drawer a.is-active {
    border-color: #939393 !important;
    background: #646464 !important;
    color: #fff !important;
  }

  html[data-scroll-theme="academic-evidence"] main {
    padding-top: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  html[data-scroll-theme="academic-evidence"] img,
  html[data-scroll-theme="academic-evidence"] svg,
  html[data-scroll-theme="academic-evidence"] canvas {
    max-width: 100% !important;
  }

  /* AcademIQ: a single native document scroller with a compact solid navbar. */
  html[data-scroll-theme="student-performance"],
  html[data-scroll-theme="student-performance"] body {
    width: 100% !important;
    min-height: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  html[data-scroll-theme="student-performance"] .sp-app,
  html[data-scroll-theme="student-performance"] .sp-main,
  html[data-scroll-theme="student-performance"] .sp-view,
  html[data-scroll-theme="student-performance"] .sp-view.is-active {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html[data-scroll-theme="student-performance"] .sp-app {
    display: block !important;
  }

  html[data-scroll-theme="student-performance"] .sp-sidebar {
    display: none !important;
  }

  html[data-scroll-theme="student-performance"] .sp-main {
    padding: 18px 12px max(64px, env(safe-area-inset-bottom)) !important;
  }

  html[data-scroll-theme="student-performance"] .apu-v5-mobile-project-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 2147482000 !important;
    background: #131313 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
  }

  html[data-scroll-theme="student-performance"] .apu-v5-mobile-nav-drawer {
    position: sticky !important;
    top: 58px !important;
    z-index: 2147481999 !important;
    max-height: min(62dvh, 420px) !important;
    background: #191919 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
  }

  html[data-scroll-theme="student-performance"] .sp-page-head,
  html[data-scroll-theme="student-performance"] .sp-section-head,
  html[data-scroll-theme="student-performance"] .sp-footer {
    min-width: 0 !important;
  }

  html[data-scroll-theme="student-performance"] .sp-table-wrap {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 430px) {
  html[data-scroll-theme="academic-evidence"] .apu-v5-mobile-project-brand strong,
  html[data-scroll-theme="student-performance"] .apu-v5-mobile-project-brand strong {
    max-width: 170px;
  }

  html[data-scroll-theme="academic-evidence"] main,
  html[data-scroll-theme="student-performance"] .sp-main {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-scroll-theme="student-performance"],
  html[data-scroll-theme="student-performance"] body {
    scroll-behavior: auto !important;
  }
}
