
/* ============================================================
   NOORI ENGINEERING — MOBILE RESPONSIVE FINAL LAYER
   Scope: responsive/mobile behavior only.
   Desktop design is intentionally untouched.
   ============================================================ */

html, body {
  max-width: 100%;
  overflow-x: clip;
}
body {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}
*, *::before, *::after { box-sizing: border-box; }
img, svg, video, canvas { max-width: 100%; }

/* ---------- HEADER / NAVIGATION ---------- */
.site-header {
  width: 100%;
  overflow: visible !important;
  z-index: 3000 !important;
}
.site-header .header-inner {
  min-height: 72px;
}
.site-header .nav-toggle {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  touch-action: manipulation;
}
.site-header .nav-toggle span {
  width: 23px;
}
.site-header .main-nav {
  scrollbar-width: thin;
}
.site-header .main-nav a,
.site-header .main-nav button {
  touch-action: manipulation;
}
.site-header .mega-menu-item,
.site-header .process-stage {
  min-height: 44px;
  touch-action: manipulation;
}

/* Mobile menu is a contained, scrollable panel rather than a page-height
   overlay. This keeps every link reachable on short/narrow phones. */
@media (max-width: 900px) {
  .site-header .header-inner {
    width: calc(100% - 24px) !important;
    max-width: 1200px !important;
    padding: 9px 0 !important;
    gap: 10px !important;
  }
  .site-header .logo {
    min-width: 0;
    max-width: calc(100% - 54px);
    gap: 9px !important;
  }
  .site-header .logo-mark-img {
    width: 48px !important;
    height: 48px !important;
  }
  .site-header .logo-text {
    min-width: 0;
  }
  .site-header .logo-title {
    font-size: clamp(17px, 4.8vw, 20px) !important;
    white-space: nowrap;
  }
  .site-header .logo-sub {
    font-size: clamp(7px, 2.1vw, 9px) !important;
    white-space: nowrap;
  }

  .site-header .main-nav {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: calc(100dvh - 72px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 20px !important;
    gap: 2px !important;
  }
  .site-header .main-nav.mobile-open {
    display: flex !important;
  }
  .site-header .main-nav > a,
  .site-header .nav-item-trigger,
  .site-header .process-nav-trigger {
    min-height: 46px !important;
    width: 100% !important;
    padding: 12px 4px !important;
    font-size: 14px !important;
    line-height: 1.25;
  }
  .site-header .nav-item,
  .site-header .process-nav-item {
    width: 100% !important;
  }
  .site-header .mega-menu,
  .site-header .process-hover-panel {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: 100% !important;
    max-width: none !important;
    margin: 2px 0 7px !important;
    transform: none !important;
    border-radius: 7px !important;
    padding: 8px !important;
    box-shadow: none !important;
  }
  .site-header .mega-menu {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
  }
  .site-header .process-hover-panel {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
  }
  .site-header .mega-menu-item {
    padding: 10px !important;
    font-size: 12px !important;
    line-height: 1.25;
  }
  .site-header .process-stage {
    padding: 10px !important;
    min-height: 48px;
    font-size: 12px !important;
  }
  .site-header .header-actions {
    display: none !important;
  }
}

/* Touch devices should not use desktop hover as the opening mechanism. */
@media (max-width: 900px) and (hover: none) and (pointer: coarse) {
  .site-header .nav-item:not(.open) .mega-menu,
  .site-header .process-nav-item:not(.open) .process-hover-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
  }
  .site-header .nav-item.open .mega-menu,
  .site-header .process-nav-item.open .process-hover-panel {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: grid !important;
  }
}

/* ---------- GLOBAL MOBILE WIDTH / TYPE DISCIPLINE ---------- */
@media (max-width: 768px) {
  main > section,
  .page-section,
  .content-section {
    max-width: 100%;
  }
  h1 {
    overflow-wrap: anywhere;
  }
  p, li {
    overflow-wrap: anywhere;
  }
  .wrap,
  .section-inner,
  .page-inner,
  .container,
  .content-wrap {
    max-width: 100% !important;
  }
  .btn,
  button,
  a {
    -webkit-tap-highlight-color: transparent;
  }
  .btn {
    min-height: 44px;
  }
}

/* ---------- HOMEPAGE ---------- */
@media (max-width: 900px) {
  .category-slideshow .section-inner {
    width: calc(100% - 24px) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .consultancy-teaser .consultancy-panel {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .consultancy-teaser .consultancy-panel > .btn {
    justify-self: start !important;
  }
}
@media (max-width: 600px) {
  .hero,
  .hero-inner {
    max-width: 100% !important;
  }
  .hero-inner {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  .hero-title,
  .hero h1 {
    font-size: clamp(32px, 11vw, 48px) !important;
    line-height: 1 !important;
  }
  .hero-actions,
  .atlas-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn,
  .atlas-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- CATEGORY / MACHINE PAGES ---------- */
@media (max-width: 900px) {
  .category-detail,
  .category-detail .section-inner,
  .category-detail-hero,
  .category-machine-section,
  .category-detail-nav-top,
  .category-detail-nav-bottom {
    max-width: calc(100% - 24px) !important;
  }
  .category-machine-grid,
  .machine-grid,
  .product-grid,
  .process-machine-grid,
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .category-detail-nav-top,
  .category-detail-nav-bottom {
    display: flex;
    flex-wrap: wrap;
  }
  .category-detail-nav-top button,
  .category-detail-nav-bottom button {
    flex: 1 1 140px;
    min-height: 44px !important;
  }
}
@media (max-width: 600px) {
  .category-machine-grid,
  .machine-grid,
  .product-grid,
  .process-machine-grid,
  .cards-grid {
    grid-template-columns: 1fr !important;
  }
  .category-detail,
  .category-detail .section-inner,
  .category-detail-hero,
  .category-machine-section,
  .category-detail-nav-top,
  .category-detail-nav-bottom {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
  }
  .category-detail-hero-photo {
    height: 220px !important;
  }
  .category-detail-nav-top button,
  .category-detail-nav-bottom button {
    flex: 1 1 0;
    min-width: 0;
    font-size: 10px !important;
  }
}

/* ---------- PROCESS PAGES ---------- */
@media (max-width: 900px) {
  body.atlas-subpage .process-subpage,
  .process-subpage {
    padding-top: 34px !important;
    padding-bottom: 34px !important;
  }
  .process-hero,
  .process-content-grid {
    grid-template-columns: 1fr !important;
  }
  .process-hero > *,
  .process-content-grid > * {
    min-width: 0;
  }
  .process-machine-grid {
    width: 100% !important;
  }
}
@media (max-width: 600px) {
  .process-hero h1,
  .process-hero .hero-title,
  .page-hero h1 {
    font-size: clamp(30px, 10vw, 42px) !important;
  }
  .process-machine-card > img,
  .process-machine-card img {
    height: auto !important;
    max-height: 230px !important;
  }
}

/* ---------- GALLERY ---------- */
@media (max-width: 900px) {
  .gallery-wrap {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
  }
  .gallery-filter {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 8px !important;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .gallery-filter button {
    flex: 0 0 auto;
    min-height: 42px;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr !important;
  }
  .gallery-card {
    min-width: 0;
  }
  .gallery-image-button,
  .gallery-card img {
    max-width: 100%;
  }
}

/* ---------- LARGE IMAGE / LIGHTBOX ---------- */
@media (max-width: 700px) {
  .gallery-lightbox,
  .image-lightbox,
  .machine-lightbox,
  .large-image-modal {
    padding: 10px !important;
  }
  .gallery-lightbox img,
  .image-lightbox img,
  .machine-lightbox img,
  .large-image-modal img {
    max-width: calc(100vw - 28px) !important;
    max-height: 76vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }
  .gallery-lightbox .prev,
  .gallery-lightbox .next,
  .image-lightbox .prev,
  .image-lightbox .next,
  .machine-lightbox .prev,
  .machine-lightbox .next {
    min-width: 46px;
    min-height: 46px;
  }
}

/* ---------- WORKFLOW ---------- */
@media (max-width: 900px) {
  .workflow-shell,
  .workflow-section,
  .workflow-main {
    max-width: 100%;
  }
  .workflow-hero {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .workflow-scene-frame {
    width: 100% !important;
    min-height: 480px !important;
    height: auto !important;
    overflow: hidden !important;
  }
  .workflow-scene-plane {
    transform: scale(.82) !important;
    transform-origin: center center;
  }
}
@media (max-width: 600px) {
  .workflow-hero-head h1 {
    font-size: clamp(32px, 10vw, 46px) !important;
    line-height: 1 !important;
  }
  .workflow-scene-frame {
    min-height: 420px !important;
  }
  .workflow-scene-plane {
    transform: scale(.64) !important;
  }
  .workflow-scene-label {
    font-size: 7px !important;
  }
  .workflow-deep-grid,
  .workflow-section-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- CONSULTANCY / ABOUT / CLIENTS ---------- */
@media (max-width: 900px) {
  .atlas-hero-grid,
  .mission-grid,
  .vision-grid,
  .pillar-grid,
  .about-grid,
  .contact-grid,
  .services-grid,
  .domains-grid,
  .client-grid,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 600px) {
  .atlas-hero-grid,
  .mission-grid,
  .vision-grid,
  .pillar-grid,
  .about-grid,
  .contact-grid,
  .services-grid,
  .domains-grid,
  .client-grid,
  .grid {
    grid-template-columns: 1fr !important;
  }
  .atlas-hero,
  .atlas-wrap {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
  }
  .atlas-hero h1 {
    font-size: clamp(30px, 10vw, 44px) !important;
  }
}

/* ---------- FOOTER ---------- */
@media (max-width: 900px) {
  .site-footer > .footer-inner,
  .site-footer > .section-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 600px) {
  .site-footer > .footer-inner,
  .site-footer > .section-inner {
    width: calc(100% - 28px) !important;
    grid-template-columns: 1fr !important;
    gap: 18px !important;
    text-align: center;
  }
  .site-footer .footer-brand,
  .site-footer .footer-links,
  .site-footer .footer-contact {
    justify-items: center;
    align-items: center;
  }
  .site-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  .site-footer > .footer-credit-line {
    max-width: calc(100% - 28px) !important;
    white-space: normal !important;
    text-align: center;
  }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- LIGHTBOX TOUCH-SAFE CONTROLS ---------- */
@media (max-width: 700px) {
  .gallery-lightbox,
  .home-category-lightbox {
    padding: 8px !important;
  }
  .gallery-lightbox__panel,
  .home-category-lightbox__panel {
    width: 100% !important;
    height: min(92dvh, 760px) !important;
    min-height: 0 !important;
  }
  .gallery-lightbox__image,
  .home-category-lightbox__image {
    max-width: calc(100% - 74px) !important;
    max-height: calc(100% - 118px) !important;
  }
  .gallery-lightbox__prev,
  .gallery-lightbox__next,
  .home-category-lightbox__prev,
  .home-category-lightbox__next {
    width: 42px !important;
    height: 50px !important;
    min-width: 42px;
    min-height: 50px;
    touch-action: manipulation;
  }
  .gallery-lightbox__prev,
  .home-category-lightbox__prev { left: 7px !important; }
  .gallery-lightbox__next,
  .home-category-lightbox__next { right: 7px !important; }
  .gallery-lightbox__toolbar,
  .home-category-lightbox__toolbar {
    max-width: calc(100% - 110px);
    overflow-x: auto;
    justify-content: center;
    padding-bottom: 2px;
  }
  .gallery-lightbox__toolbar button,
  .home-category-lightbox__toolbar button {
    min-width: 42px;
    min-height: 42px;
    touch-action: manipulation;
  }
  .gallery-lightbox__caption,
  .home-category-lightbox__caption {
    left: 8px !important;
    right: 8px !important;
    bottom: 58px !important;
    max-width: calc(100% - 16px) !important;
    text-align: center;
  }
  .gallery-lightbox__counter,
  .home-category-lightbox__counter {
    left: 50%;
    right: auto !important;
    transform: translateX(-50%);
    bottom: 10px !important;
  }
}

@media (max-width: 900px){
  .site-header .nav-toggle{
    position:relative !important;
    z-index:3101 !important;
    pointer-events:auto !important;
    cursor:pointer !important;
  }
  .site-header .header-inner{
    position:relative !important;
    z-index:3100 !important;
  }
}


/* ============================================================
   NOORI PRODUCTION MOBILE NAVIGATION + HOMEPAGE MAP FIX
   Final override layer. No desktop layout changes.
   ============================================================ */
@media (max-width: 900px) {
  .site-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
    overflow: visible !important;
  }

  .site-header .header-inner {
    position: relative !important;
    z-index: 10000 !important;
  }

  .site-header .nav-toggle {
    display: flex !important;
    position: relative !important;
    z-index: 10002 !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    margin-left: auto !important;
    padding: 10px !important;
    border: 0 !important;
    background: transparent !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .site-header .nav-toggle span {
    display: block !important;
    width: 26px !important;
    height: 2px !important;
    margin: 0 !important;
    background: var(--white, #fff) !important;
    pointer-events: none !important;
  }

  .site-header .main-nav {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: calc(100dvh - 72px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 2px !important;
    margin: 0 !important;
    padding: 12px 16px 22px !important;
    background: rgba(5, 18, 19, 0.98) !important;
    border-top: 1px solid rgba(45,189,189,.24) !important;
    border-bottom: 1px solid var(--dark-line, #35635C) !important;
    box-shadow: 0 18px 40px rgba(0,0,0,.45) !important;
    z-index: 10001 !important;
    isolation: isolate !important;
  }

  .site-header .main-nav.mobile-open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .site-header .main-nav > a,
  .site-header .main-nav .nav-item,
  .site-header .main-nav .process-nav-item {
    width: 100% !important;
  }

  .site-header .main-nav > a,
  .site-header .nav-item-trigger,
  .site-header .process-nav-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 46px !important;
    padding: 12px 6px !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    text-align: left !important;
    touch-action: manipulation !important;
  }

  .site-header .mega-menu,
  .site-header .process-hover-panel {
    position: static !important;
    display: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 0 6px !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: none !important;
  }

  .site-header .nav-item.open > .mega-menu,
  .site-header .process-nav-item.open > .process-hover-panel {
    display: grid !important;
  }
}

/* Keep the supplied Pakistan technical-map artwork visible on phones.
   The previous mobile URL was valid but could be suppressed by the later
   homepage background rules; this override owns the final mobile layer. */
@media (max-width: 768px) {
  body.homepage {
    background: #061316 !important;
    min-height: 100vh;
  }

  body.homepage::before {
    content: '' !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 0 !important;
    display: block !important;
    pointer-events: none !important;
    background-image: url('mobile/assets/homepage-pakistan-network.webp') !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
  }

  body.homepage main,
  body.homepage .site-header,
  body.homepage footer,
  body.homepage .ai-console,
  body.homepage .ai-console-toggle {
    position: relative !important;
    z-index: 1 !important;
  }
}
