/* Enhanced Responsive Design for hjLabs.in */
/* This file addresses responsive design issues across all device sizes */

/* Extra small devices (phones, 320px and up) */
@media (max-width: 575.98px) {

  /* Typography adjustments */
  :root {
    --text-5xl: 2rem;
    /* 32px on xs screens */
    --text-4xl: 1.75rem;
    /* 28px on xs screens */
    --text-3xl: 1.25rem;
    /* 20px on xs screens */
    --text-2xl: 1.125rem;
    /* 18px on xs screens */
    --text-xl: 1rem;
    /* 16px on xs screens */
    --spacing-3xl: 2rem;
    /* 32px on xs screens */
    --spacing-2xl: 1.5rem;
    /* 24px on xs screens */
    --spacing-xl: 1rem;
    /* 16px on xs screens */
  }

  /* Hero section adjustments */
  .fullscreen-container {
    height: auto;
    min-height: 100vh;
    padding: 2rem 1rem;
    font-size: 1.5em;
  }

  .fullscreen-container h1 {
    font-size: 1.8rem !important;
    margin-bottom: 0.5em;
  }

  .fullscreen-container .lead {
    font-size: 1.1rem !important;
  }

  .fullscreen-container .btn {
    margin: 0.5rem;
    width: 100%;
  }

  /* Video background adjustments */
  #video-background iframe {
    min-width: 100vw;
    min-height: 100vh;
    width: auto;
    height: auto;
  }

  /* Card adjustments */
  .modern-card,
  .testimonial-card-modern,
  .pricing-card-modern,
  .stat-card {
    margin-bottom: 1rem;
    padding: var(--spacing-md) !important;
  }

  /* Button adjustments */
  .btn-modern-primary,
  .btn-modern-secondary {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    width: 100%;
    margin-bottom: 0.5rem;
  }

  /* Grid adjustments */
  .col-md-4,
  .col-lg-3,
  .col-lg-4 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .row {
    margin-left: 0;
    margin-right: 0;
  }

  .col {
    padding-left: 0;
    padding-right: 0;
  }

  /* Section adjustments */
  .section-header-modern {
    font-size: var(--text-2xl) !important;
    margin-bottom: 1.5rem !important;
  }

  /* Trust badge adjustments */
  .trust-badge-bar {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem !important;
  }

  .trust-badge-item {
    width: 100%;
    justify-content: center;
  }

  /* Hero impact badges */
  .hero-impact-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 4px 0 !important;
  }

  /* Metrics adjustments */
  .metrics-showcase .row {
    flex-direction: column;
  }

  .metric-item {
    margin-bottom: 1.5rem;
  }

  .metric-value {
    font-size: 2.5rem !important;
  }

  /* Navigation adjustments */
  .navbar {
    padding: 0.5rem 1rem !important;
  }

  .navbar-brand {
    font-size: 1.2rem !important;
  }

  /* Footer adjustments */
  .footer-bottom .row>div {
    text-align: center !important;
  }

  .footer-bottom-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Service card adjustments */
  .service-card-modern {
    margin-bottom: 1.5rem;
  }

  /* Stat card adjustments */
  .stat-number {
    font-size: 2rem !important;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  :root {
    --text-5xl: 2.25rem;
    /* 36px on small screens */
    --text-4xl: 2rem;
    /* 32px on small screens */
    --text-3xl: 1.5rem;
    /* 24px on small screens */
  }

  .fullscreen-container h1 {
    font-size: 2.2rem !important;
  }

  .col-sm-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .col-md-4 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .metric-value {
    font-size: 2.8rem !important;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  :root {
    --text-5xl: 2.5rem;
    /* 40px on medium screens */
    --text-4xl: 2.25rem;
    /* 36px on medium screens */
  }

  .col-md-4 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .col-lg-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .metric-value {
    font-size: 3rem !important;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .col-lg-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }

  .col-lg-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* High-resolution mobile devices */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

  .stat-number,
  .gradient-text {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Orientation adjustments */
@media (orientation: portrait) {
  .fullscreen-container {
    padding: 1.5rem 1rem;
  }

  #video-background iframe {
    width: 100vw;
    height: 177.78vh;
    /* 9:16 aspect ratio for portrait */
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .fullscreen-container {
    height: auto;
    min-height: 100vh;
    justify-content: flex-start;
    padding-top: 4rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

  /* Reduce hover effects on touch devices */
  .modern-card:hover,
  .testimonial-card-modern:hover,
  .pricing-card-modern:hover,
  .service-card-modern:hover {
    transform: none;
    box-shadow: var(--shadow-md);
    border-color: var(--gray-200);
  }

  /* Increase touch target sizes */
  .btn-modern-primary,
  .btn-modern-secondary {
    min-height: 44px;
    /* Minimum touch target size */
    min-width: 44px;
  }

  /* Adjust for safe areas on mobile devices */
  body {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
}

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

  .modern-card,
  .testimonial-card-modern,
  .pricing-card-modern,
  .stat-card {
    transition: none;
  }

  .btn-modern-primary,
  .btn-modern-secondary {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

  .glass-card,
  .glass-card-dark {
    background: white;
    border: 1px solid black;
  }

  .btn-modern-primary {
    border: 2px solid var(--primary-electric-blue);
  }

  .btn-modern-secondary {
    border: 2px solid var(--primary-electric-blue);
  }
}

/* Print styles */
@media print {

  #video-background,
  .trust-badge-bar,
  .social-proof-line,
  .urgency-indicator,
  .navbar,
  .footer {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .modern-card,
  .testimonial-card-modern,
  .pricing-card-modern {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Specific component adjustments for mobile */
.mobile-menu-toggle {
  display: block;
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 4px;
  padding: 0.5rem;
  cursor: pointer;
}

@media (min-width: 768px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* Adjust fullscreen containers for mobile */
@media (max-width: 767.98px) {
  .fullscreen-container {
    padding: 1.5rem 1rem;
  }

  .hero-impact-badge {
    flex-direction: row;
    text-align: left;
  }

  .hero-impact-badge div {
    text-align: left;
  }
}

/* Adjust video background for mobile performance */
@media (max-width: 767.98px) and (max-device-width: 768px) {
  #video-background {
    display: none;
  }

  #overlay {
    background-color: rgba(102, 126, 234, 0.1);
  }

  .fullscreen-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
  }
}

/* Font scaling for accessibility */
@media (max-width: 767.98px) {
  html {
    font-size: 14px;
    /* Slightly larger base font for mobile */
  }
}

/* Adjust for iPhone notch and similar devices */
@supports (padding-top: env(safe-area-inset-top)) {
  .navbar {
    padding-top: calc(env(safe-area-inset-top) + 0.5rem);
  }

  .fullscreen-container {
    padding-top: calc(env(safe-area-inset-top) + 4rem);
  }
}

/* =========================================================================
   GLOBAL RESPONSIVENESS OVERRIDES v4.0
   Forces strict stacking, fluid media, and prevents x-overflow on all pages
   ========================================================================= */

html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

img, video, iframe, canvas {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain;
}

@media (max-width: 768px) {
  /* Force all columns in Bootstrap grid to stack 100% wide */
  .row {
    display: flex !important;
    flex-direction: column !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .col, [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-bottom: 20px !important;
  }

  /* Fluid typography */
  h1, .display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-size: min(2.5rem, 8vw) !important;
    line-height: 1.2 !important;
    word-wrap: break-word !important;
  }

  h2 {
    font-size: min(2rem, 6.5vw) !important;
  }

  p, .lead, li {
    font-size: 1rem !important;
  }

  /* Condense huge section padding */
  section, .fullscreen-container, .jumbotron, .metrics-showcase, .services-showcase, .cta-section-modern {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }

  /* Buttons shouldn't overflow */
  .btn {
    white-space: normal !important;
    height: auto !important;
    padding: 12px 20px !important;
  }

  /* Navigation / Header fixes */
  .navbar-nav {
    flex-direction: column !important;
  }

  .navbar-collapse {
    max-height: 70vh !important;
    overflow-y: auto !important;
  }

  /* Specific UI Component Fixes */
  .trust-badge-bar, .hero-impact-badge-container {
    flex-direction: column !important;
    align-items: center !important;
  }

  .hero-impact-badge {
    width: 100% !important;
    margin-right: 0 !important;
  }
}
