/* ==========================================================================
   S.S. CONSTRUCTION - RESPONSIVE STYLESHEET (FIXED MOBILE NAVIGATION)
   ========================================================================== */

/* Prevent horizontal viewport shifting */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Fluid Media Resizing */
img, svg, iframe, video {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   TABLET & DESKTOP MEDIUM (Under 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero-title {
    font-size: 2.6rem !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }

  .stat-item {
    border-left: none !important;
    border-bottom: 1px solid var(--border-light);
    padding: 15px 0 !important;
  }

  .projects-grid,
  .features-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }

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

/* --------------------------------------------------------------------------
   MOBILE SCREENS & PHONES (Under 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Top Bar */
  .top-bar-content {
    flex-direction: column !important;
    text-align: center;
    gap: 6px;
  }

  .top-bar-contact {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .top-bar-contact span {
    margin-left: 0 !important;
  }

  /* Sticky Header */
  .site-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 99999 !important;
    background: #ffffff !important;
  }

  .header-container {
    height: 70px !important;
    position: relative;
  }

  /* Hamburger Toggle Button */
  .nav-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 100002 !important; /* Always in front */
  }

  .hamburger-bar {
    display: block;
    width: 26px;
    height: 3px;
    background: var(--primary-navy);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    margin: 3px 0;
  }

  /* Morph to 'X' */
  .nav-toggle.open .hamburger-bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }
  .nav-toggle.open .hamburger-bar:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open .hamburger-bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* Slide-Out Drawer Navigation */
  .primary-nav {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 290px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #ffffff !important;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.25) !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 85px 20px 30px !important;
    gap: 0 !important;
    transform: translateX(110%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 100001 !important; /* Highest layer */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    visibility: hidden;
  }

  .primary-nav.active {
    transform: translateX(0) !important;
    visibility: visible !important;
  }

  /* Backdrop Overlay: Pure dark tint, NO blur filter to avoid Safari bugs */
  .nav-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: rgba(0, 0, 0, 0.55) !important;
    z-index: 100000 !important; /* Strictly underneath primary-nav */
    display: none;
  }

  .nav-backdrop.active {
    display: block !important;
  }

  /* Navigation Link List */
  .nav-list {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 0 1.5rem !important;
    list-style: none !important;
  }

  .nav-list li {
    width: 100% !important;
    border-bottom: 1px solid var(--border-light) !important;
  }

  .nav-list a {
    display: block !important;
    padding: 15px 8px !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    color: var(--primary-navy) !important;
    text-decoration: none !important;
    position: relative;
    z-index: 100003 !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(8, 127, 193, 0.15);
  }

  .nav-list a.active,
  .nav-list a:hover {
    color: var(--primary-blue) !important;
  }

  .header-action {
    width: 100% !important;
    margin: 0 !important;
  }

  .header-action .btn {
    width: 100% !important;
    text-align: center !important;
    padding: 13px !important;
    font-size: 1rem !important;
  }

  /* Hide floating quick-action buttons when mobile menu is open */
  body.menu-open .floating-quick-actions {
    display: none !important;
  }

  /* Hero Section Mobile Typography */
  .section {
    padding: 55px 0 !important;
  }

  .section-title {
    font-size: 1.85rem !important;
  }

  .hero-section {
    padding: 85px 0 65px !important;
    min-height: auto !important;
  }

  .hero-title {
    font-size: 2.1rem !important;
    line-height: 1.25 !important;
  }

  .hero-text {
    font-size: 1.05rem !important;
    margin-bottom: 1.5rem !important;
  }

  .hero-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .hero-actions .btn {
    width: 100% !important;
    text-align: center;
  }

  /* Grid Layouts to 1 Column */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 1.2fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: repeat(3, 1fr)"],
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .services-grid,
  .stats-grid,
  .projects-grid,
  .features-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .stat-number {
    font-size: 2.2rem !important;
  }

  /* Managing Director Portrait Layout on Homepage */
  div[style*="grid-template-columns: 280px 1fr"] {
    grid-template-columns: 1fr !important;
    padding: 24px !important;
    gap: 1.5rem !important;
    text-align: center;
  }

  .leadership-quote {
    font-size: 1.05rem !important;
    padding-left: 14px !important;
    text-align: left;
  }

  /* Contact Form */
  .form-card {
    padding: 24px 18px !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .form-group-full {
    grid-column: span 1 !important;
  }

  /* CTA Banners */
  section[style*="padding: 75px 0"] div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    text-align: center;
  }

  /* Pre-Footer Quick Consultation Band */
  div[style*="background: #11283d"] .container {
    flex-direction: column !important;
    text-align: center;
    gap: 1.25rem !important;
  }

  div[style*="background: #11283d"] h3 {
    font-size: 1.2rem !important;
  }

  div[style*="background: #11283d"] div[style*="display: flex"] {
    width: 100%;
    flex-direction: column !important;
  }

  div[style*="background: #11283d"] a {
    width: 100%;
    justify-content: center;
  }

  /* Footer */
  .site-footer {
    padding-top: 50px !important;
  }

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

  .footer-bottom .container {
    flex-direction: column !important;
    text-align: center;
    gap: 1rem !important;
  }

  .footer-bottom ul {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem !important;
  }

  /* Floating Quick Action Buttons */
  .floating-quick-actions {
    bottom: 20px !important;
    right: 14px !important;
    gap: 10px !important;
  }

  .quick-action-btn {
    width: 44px !important;
    height: 44px !important;
  }

  .back-to-top {
    bottom: 20px !important;
    left: 14px !important;
    right: auto !important;
    width: 40px !important;
    height: 40px !important;
  }

  .responsive-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
  }

  .data-table th, .data-table td {
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.85rem !important;
  }

  h1 {
    font-size: 1.85rem !important;
  }

  h2, .section-title {
    font-size: 1.5rem !important;
  }

  .badge-live {
    font-size: 0.72rem !important;
    padding: 4px 8px !important;
  }
}