/* ==========================================================================
   Shaurals Control Systems Pvt. Ltd.
   Responsive Breakpoints & Mobile Optimization Stylesheet
   Supports: 320px, 375px, 390px, 430px, 768px, 1024px, 1366px+
   ========================================================================== */

/* Universal Responsive Hygiene & Overflow Prevention */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

img, svg, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Ensure long body text and titles wrap cleanly without expanding containers */
h1, h2, h3, h4, h5, h6, p, div {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Exempt navigation links and buttons from aggressive word-breaking */
.nav-link,
.nav-link *,
.nav-word,
.site-header a,
.site-header button,
.btn {
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* Safe Area Inset Support for Modern Mobile Viewports */
.site-header {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Backdrop for Mobile Navigation */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 990; /* Below .site-header (z-index: 1000) so header & hamburger button stay clickable */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   0. Desktop Header Adaptive Layout (1141px - 1320px)
   Ensure balanced spacing and prevent wrapping/breaking on medium desktop displays
   ========================================================================== */
@media (min-width: 1141px) and (max-width: 1320px) {
  .site-header .container,
  .header-container,
  .nav-container {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    gap: 0.5rem;
  }

  .logo-container,
  .brand {
    margin-right: 0.75rem;
  }

  .brand-logo-img {
    height: 40px;
    max-width: 165px;
  }

  .nav-menu {
    gap: 0.65rem;
  }

  .nav-link {
    font-size: 0.88rem; /* approx 14px */
    padding: 0.4rem 0.2rem;
  }

  .header-cta,
  .nav-actions {
    margin-left: 0.75rem;
    gap: 0.5rem;
  }

  .header-cta .btn-quote,
  .nav-actions .btn-quote {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
  }
}

/* ==========================================================================
   1. Header Navigation Switch to Hamburger (max-width: 1140px)
   Threshold where desktop navigation converts to clean mobile dropdown
   ========================================================================== */
@media (max-width: 1140px) {
  /* Navigation Bar & Mobile Dropdown Menu */
  .brand-logo-img {
    height: 44px;
    max-width: 175px;
  }

  .nav-container,
  .header-container,
  .desktop-navigation {
    position: static; /* Allows .nav-menu to span full viewport width below the header */
  }

  .desktop-navigation {
    flex: 0 0 auto;
    margin: 0;
  }

  .mobile-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    cursor: pointer;
    z-index: 1100;
    transition: var(--transition-base);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-toggle:hover,
  .mobile-toggle:focus-visible,
  .mobile-toggle.active {
    background-color: var(--color-bg-subtle);
    border-color: var(--color-brand-blue);
    color: var(--color-brand-blue);
    outline: none;
  }

  .mobile-toggle svg {
    pointer-events: none;
  }

  /* On tablet (641px-1140px), keep CTA visible in header next to hamburger: [LOGO] ... [CTA] [Hamburger] */
  .header-cta,
  .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
  }

  .header-cta .btn-quote,
  .nav-actions .btn-quote {
    display: inline-flex;
    padding: 0.55rem 1.1rem;
    font-size: 0.88rem;
    white-space: nowrap !important;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--color-white);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.75rem 1.5rem 1.5rem 1.5rem;
    box-shadow: 0 16px 36px rgba(11, 25, 44, 0.16), 0 4px 12px rgba(11, 25, 44, 0.08);
    border-top: 1px solid var(--color-border);
    border-bottom: 3px solid var(--color-brand-blue);
    z-index: 1050;
    gap: 0;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;

    /* Dropdown Slide / Fade Animation below header */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  }

  .nav-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-link {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-main);
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
    white-space: nowrap;
    word-break: normal !important;
    overflow-wrap: normal !important;
    text-align: left;
    transition: var(--transition-base);
  }

  .nav-link-support {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    white-space: nowrap;
  }

  .nav-link:hover,
  .nav-link.active {
    color: var(--color-brand-blue);
    padding-left: 0.85rem;
  }

  .nav-link::after {
    display: none;
  }

  /* On tablet, CTA is visible in the header bar, so hide inside drawer */
  .mobile-quote-item {
    display: none;
    margin-top: 1rem;
    padding: 0.5rem 0 0 0;
  }

  .mobile-quote-item .btn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }
}

/* ==========================================================================
   1A. Small Mobile Viewports (max-width: 640px)
   Show only Logo + Hamburger in header; Show Quote CTA inside mobile drawer
   ========================================================================== */
@media (max-width: 640px) {
  .site-header .container,
  .header-container,
  .nav-container {
    padding-left: 1rem;
    padding-right: 1rem;
    height: 72px;
    min-height: 72px;
  }

  .brand-logo-img {
    height: 38px;
    max-width: 150px;
  }

  /* Mobile: Header shows only Logo + Hamburger */
  .header-cta .btn-quote,
  .nav-actions .btn-quote {
    display: none !important;
  }

  /* Mobile: CTA appears full-width inside the open drawer */
  .nav-menu.open .mobile-quote-item,
  .mobile-quote-item {
    display: block !important;
  }
}

/* ==========================================================================
   1B. Tablet Content Grids (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {


  /* Hero Section */
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-tag-badge {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta-group {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-visual-card {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  /* Multi-Column Layouts to 2 Columns */
  .intro-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .solution-flow {
    grid-template-columns: repeat(2, 1fr);
  }

  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .applications-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .why-us-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }

  /* Documentation & Certifications & Careers */
  .doc-grid-2,
  .doc-grid-3,
  .doc-grid-4,
  .cert-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .vision-mission-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .contact-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .app-detail-block,
  .app-detail-block.reverse {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    direction: ltr;
  }

  /* Installation & Support Responsive Layout (Tablet) */
  .support-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .support-process-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .support-step-arrow {
    display: none;
  }

  .support-cta-box {
    flex-direction: column;
    align-items: flex-start;
    padding: 2.75rem 2.25rem;
    gap: 2rem;
  }

  .support-cta-buttons {
    width: 100%;
  }

  .products-support-notice {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* ==========================================================================
   2. Standard Tablets & Large Mobile Devices (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .section {
    padding: 4.5rem 0;
  }

  .page-banner {
    padding: 3.5rem 0 3rem 0;
  }

  .top-bar-info .hide-mobile {
    display: none;
  }

  .cta-banner {
    padding: 2.5rem 1.5rem;
    text-align: center;
  }

  .cta-buttons {
    justify-content: center;
  }

  .solution-flow {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Disable hover tooltip on touch devices to avoid obstructive overlay */
  .whatsapp-tooltip {
    display: none !important;
  }
}

/* ==========================================================================
   3. Mobile Devices & Large Phones (max-width: 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .brand-logo-img {
    height: 42px;
  }

  /* Top Bar Mobile Optimization - Single clean row without overflow */
  .top-bar-badge {
    display: none !important;
  }

  .top-bar-content {
    justify-content: center;
  }

  .top-bar-info {
    justify-content: center;
    gap: 1.25rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  /* Hero Section Mobile Typography & Full-width Actions */
  .hero-section {
    padding: 3.5rem 0 4rem 0;
  }

  .hero-title {
    font-size: clamp(1.75rem, 6.5vw, 2.25rem);
    letter-spacing: -0.015em;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 0.85rem;
  }

  .hero-cta-group .btn {
    width: 100%;
    min-height: 48px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    max-width: 100%;
  }

  .stat-item {
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-sm);
  }

  /* Stack all main product, benefit, application and footer grids */
  .products-grid,
  .benefits-grid,
  .applications-grid,
  .why-card-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.85rem;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Responsive card padding to maximize usable screen space */
  .form-box,
  .app-visual-box,
  .purpose-card,
  .cert-trust-box,
  .cert-card,
  .doc-card,
  .career-card {
    padding: 1.5rem 1.25rem;
  }

  .cert-trust-box {
    margin-top: 2rem;
  }

  /* Documentation & Certifications Action Buttons */
  .doc-card-actions,
  .cert-card-actions {
    flex-direction: column;
    gap: 0.65rem;
  }

  .doc-card-actions .btn,
  .cert-card-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  /* Prevents iOS automatic zoom when focusing input fields */
  .form-control {
    font-size: 16px;
    min-height: 48px;
  }

  /* Intro Diagram Floating Badge */
  .intro-floating-badge {
    position: static;
    bottom: auto;
    right: auto;
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
  }

  /* Floating WhatsApp touch target */
  .whatsapp-float {
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    right: calc(1.25rem + env(safe-area-inset-right, 0px));
    width: 52px;
    height: 52px;
  }

  .whatsapp-float svg {
    width: 28px;
    height: 28px;
  }

  /* Installation & Support Responsive Layout (Mobile) */
  .support-cards-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }

  .support-process-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .support-process-wrapper {
    padding: 2rem 1.25rem;
    margin-bottom: 3rem;
  }

  .support-scope-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 2.5rem;
  }

  .support-cta-box {
    padding: 2.25rem 1.5rem;
    margin-top: 3.5rem;
  }

  .support-cta-buttons {
    flex-direction: column;
    width: 100%;
  }

  .support-action-btn {
    width: 100%;
    justify-content: center;
  }

  .btn-support-link {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   4. Standard Mobile Phones (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .nav-container {
    height: 68px;
  }

  .brand-logo-img {
    height: 38px;
  }

  /* Product Catalog Filter Bar - Touch friendly horizontal scroll */
  .filter-bar {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.65rem;
    margin-bottom: 2rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
    padding: 0.55rem 1.15rem;
    font-size: 0.88rem;
  }

  /* Product Cards on Mobile */
  .product-image-box {
    min-height: 180px;
    padding: 1.5rem 1rem;
  }

  .product-info {
    padding: 1.25rem 1rem;
  }

  .product-actions {
    flex-direction: column;
    gap: 0.6rem;
  }

  .product-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  /* Career Opening Cards on Mobile */
  .career-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .career-qualification {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .career-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .career-footer .btn {
    width: 100%;
    min-height: 48px;
  }

  /* Hero Live Telemetry Simulation Card */
  .hero-visual-card {
    padding: 1.25rem 1rem;
  }

  .telemetry-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .telemetry-metric-item {
    padding: 0.65rem;
  }

  /* Contact Information Cards */
  .contact-info-card {
    padding: 1.25rem 1rem;
    gap: 0.85rem;
  }

  .contact-card-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .contact-info-card .btn-whatsapp {
    width: 100%;
    text-align: center;
  }

  /* Certifications Images */
  .cert-image-container {
    min-height: auto;
    padding: 0.5rem;
  }

  .cert-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }
}

/* ==========================================================================
   5. Small Mobile Phones (max-width: 360px - e.g. iPhone SE, Galaxy Fold)
   ========================================================================== */
@media (max-width: 360px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .brand-logo-img {
    height: 34px;
  }

  .top-bar-info {
    gap: 0.75rem;
    font-size: 0.76rem;
  }

  /* Hero Sizing on Small Mobile */
  .hero-title {
    font-size: 1.55rem;
    line-height: 1.2;
  }

  .hero-tag-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
  }

  .hero-description {
    font-size: 0.92rem;
  }

  .telemetry-metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* Compact Card Padding */
  .form-box,
  .app-visual-box,
  .purpose-card,
  .cert-trust-box,
  .cert-card,
  .doc-card,
  .career-card {
    padding: 1.15rem 0.75rem;
  }

  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
  }

  .stat-item h3 {
    font-size: 1.75rem;
  }

  .spec-row {
    font-size: 0.78rem;
  }

  .support-service-card {
    padding: 1.5rem 1.15rem;
  }

  .support-cta-box {
    padding: 1.85rem 1.15rem;
  }

  .support-action-btn {
    font-size: 0.88rem;
    padding: 0.75rem 0.85rem;
  }
}

/* ==========================================================================
   6. Landscape Mode on Mobile Devices (Short Viewport Heights)
   ========================================================================== */
@media (max-height: 520px) and (orientation: landscape) {
  .nav-menu {
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    padding: 0.5rem 1.25rem 1rem 1.25rem;
  }

  .nav-link {
    min-height: 40px;
    padding: 0.35rem 0.5rem;
    font-size: 0.95rem;
  }

  .mobile-quote-item {
    margin-top: 0.5rem;
  }

  .mobile-quote-item .btn {
    min-height: 40px;
  }

  .hero-section {
    padding: 3rem 0;
  }
}
