/* mobile-opt.css
   Mobile-focused performance overrides.
   Applies only for small viewports or when .mobile-optimized is present.
*/

@media (max-width: 640px), (pointer: coarse) {
  /* images: natural sizing, no forced rasterization */
  .gallery-card img,
  .screenshot,
  #modalImage {
    image-rendering: auto;
    will-change: auto;
    max-height: none;
    height: auto;
  }

  /* removes sticky-top navbar */
  .navbar.sticky-top {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
  }

  .release-section {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .release-card {
    margin-left: 0px !important;
    margin-right: 0px !important;
  }

  .release-card .card-body {
    padding: 2px !important;
    font-size: 15px !important;
  }

  .tag-badge {
    font-size: 10px !important;
  }

  /* modal backdrop: no blur, lighter overlay */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(6, 10, 25, 0.55) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* modal content: no blur, rounded corners */
  .modal-content.bg-transparent {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-radius: 12px;
  }

  /* shorten dialog open/close */
  .modal.fade .modal-dialog {
    transition: transform 120ms ease, opacity 120ms ease !important;
  }

  /* modal image: fast fade */
  #modalImage {
    transition: opacity 120ms linear !important;
    opacity: 1 !important;
  }

  .device-card {
    box-shadow: 1px 1px 18px 5px rgba(146, 148, 248, 0.2) !important;
  }

  /* page fade transitions: shorter */
  body.fade-in,
  body.fade-out {
    transition: opacity 100ms ease !important;
  }

  /* disable full-page blur on modal open, keep darkening only */
  #site-root.blurred {
    filter: brightness(0.88) !important;
    transition: filter 0.18s ease !important;
    pointer-events: none;
    user-select: none;
  }

  /* navbar: reduce blur & drop shadow for better perf */
  .navbar-glass {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(12, 22, 48, 0.8) !important;
    box-shadow: none !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    transition: none !important; /* kill navbar transitions */
  }

  /* nav toggle */
  .navbar-collapse,
  .navbar-collapse.collapse,
  .navbar-toggler,
  .nav-open,
  .navbar {
    transition: none !important; /* transition removed */
  }

  /* report button: lighter and smaller */
  .btn-report {
    right: 10px !important;
    bottom: 10px !important;
    padding: 8px 10px !important;
    box-shadow: 0 4px 12px rgba(6, 10, 25, 0.45) !important;
  }

  /* scroll reveal transitions: keep but shorten */
  section,
  .hero,
  .container {
    transition: opacity 180ms ease, transform 180ms ease !important;
    will-change: opacity, transform;
  }

  /* accessibility: reduced motion */
  @media (prefers-reduced-motion: reduce) {
    * {
      transition: none !important;
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
    }
  }
}

/* mobile-layout-overrides */

/* primary mobile layout rules */
@media (max-width: 720px) {
  .btn-glow,
  .btn-outline-light {
    width: 100%;
    padding: 11px 12px;
    font-size: 0.95rem;
  }

  .btn-report {
    width: auto !important;
  }

  /* features into two columns at most; individual cards take full width */
  #features .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  #features .col-lg-4 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .feature-card .card-body {
    padding: 0.9rem;
  }

  /* gallery: keep 2 columns, smaller images */
  #gallery .col-6 {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
  .gallery-card img {
    height: 150px;
    object-fit: cover;
  }

  /* download / system cards: more compact */
  .download-card .card-body,
  .about-card .card-body,
  .card .card-body {
    padding: 0.85rem;
  }

  /* footer stacks vertically */
  footer .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* modal: avoid huge margins on phones */
  .modal-dialog {
    margin: 0.5rem;
    max-width: 98%;
  }
  .modal-body {
    padding: 0.5rem;
  }

  /* touch targets and spacing for quick actions */
  .btn-download {
    padding: 10px 10px;
    font-size: 0.95rem;
  }

  /* make small text a bit smaller to avoid wrapping issues */
  .text-muted {
    font-size: 0.92rem;
  }

  /* slightly reduce blob sizes for phones */
  .b1,
  .b2,
  .b3 {
    opacity: 0.18;
    filter: blur(44px);
  }
}

/* very small phones */
@media (max-width: 420px) {
  /* features must be single column */
  #features .col-md-6,
  #features .col-lg-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Helper class usable via JS to force mobile-optimized behavior outside the media query */
body.mobile-optimized .modal-backdrop {
  background: rgba(6, 10, 25, 0.55) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body.mobile-optimized .modal-content.bg-transparent {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body.mobile-optimized section,
body.mobile-optimized .hero,
body.mobile-optimized .container {
  transition: opacity 180ms ease !important;
  transform: none !important;
}
body.mobile-optimized .gallery-card img,
body.mobile-optimized .screenshot {
  will-change: auto !important;
}
body.mobile-optimized .navbar-glass {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(12, 22, 48, 0.8) !important;
  box-shadow: none !important;
}
