/* ==========================================================================
   COMPREHENSIVE RESPONSIVE DESIGN SYSTEM
   WebDev Mehedi Agency — Universal Multi-Device Optimization
   Supported Viewports:
   - Ultra-Wide 4K / 2K Displays (1600px+)
   - Standard Desktops & Large Laptops (1201px - 1599px)
   - Small Laptops & Landscape Tablets (1025px - 1200px)
   - Tablets Portrait / iPad Pro / iPad Air (768px - 1024px)
   - Phablets & Landscape Phones (576px - 767px)
   - Standard Smart Phones (376px - 575px)
   - Compact Phones & Foldable Devices (320px - 375px)
   - Mobile Landscape Orientation Mode
   ========================================================================== */

/* Universal Responsive Base Safeguards */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

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

/* Ensure mobile form fields never trigger iOS Safari auto-zoom */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* --------------------------------------------------------------------------
   1. Ultra-Wide Desktop Displays (1600px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1600px) {
  .container {
    max-width: 1440px;
  }

  .hero-title {
    font-size: 4.5rem;
  }

  .section-header {
    max-width: 820px;
  }

  .hero-spline-container {
    height: 560px;
  }

  .team-card {
    padding: 36px 28px;
  }
}

/* --------------------------------------------------------------------------
   2. Small Laptops & Landscape Tablets (1025px - 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .hero-title {
    font-size: 3.35rem;
  }

  .agency-story-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .contact-grid {
    gap: 36px;
  }

  .team-grid {
    gap: 18px;
  }

  .team-card {
    padding: 26px 18px;
  }

  .team-img-wrapper {
    max-width: 190px;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  .benchmarks-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

/* --------------------------------------------------------------------------
   3. Tablets & iPad Pro (768px - 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .section {
    padding: 90px 0;
  }

  .navbar {
    width: calc(100% - 32px);
    padding: 0 20px;
    height: 64px;
  }

  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }

  .hero-subtitle {
    justify-content: center;
  }

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

  .hero-stats {
    justify-content: center;
    flex-wrap: wrap;
    gap: 28px;
  }

  .hero-spline-container {
    height: 420px;
    touch-action: pan-y !important;
  }

  .hero-canvas-3d,
  spline-viewer {
    touch-action: pan-y !important;
  }

  /* Tablet Team Grid: Balanced 2-Column with Leader Spanning Top */
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 760px;
    margin: 0 auto 36px;
  }

  .team-card.featured-leader {
    grid-column: span 2;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    transform: none;
  }

  .team-card.featured-leader:hover {
    transform: translateY(-4px);
  }

  .team-card {
    padding: 26px 20px;
  }

  .team-img-wrapper {
    max-width: 180px;
  }

  .agency-story-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .agency-story-text {
    text-align: center;
  }

  .agency-cta-row {
    justify-content: center;
  }

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

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .benchmarks-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .process-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .project-thumb-wrapper {
    height: 240px;
  }
}

/* --------------------------------------------------------------------------
   4. Phablets & Landscape Phones (576px - 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .section {
    padding: 72px 0;
  }

  .container {
    padding: 0 18px;
  }

  .section-header {
    margin-bottom: 40px;
  }

  .section-title {
    font-size: 2.25rem;
  }

  .section-subtitle {
    font-size: 1.05rem;
  }

  .hero-section {
    padding-top: 110px;
    padding-bottom: 50px;
  }

  .hero-title {
    font-size: 2.45rem;
  }

  .hero-subtitle {
    font-size: 1.15rem;
    height: auto;
    flex-direction: column;
    gap: 4px;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    text-align: center;
  }

  .hero-spline-container {
    height: 330px;
    touch-action: pan-y !important;
  }

  .hero-canvas-3d,
  spline-viewer {
    touch-action: pan-y !important;
  }

  /* Single Column Team Stack with Founder at Top */
  .team-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto 32px;
    gap: 24px;
  }

  .team-card.featured-leader {
    order: -1;
    grid-column: span 1;
    width: 100%;
    transform: none;
  }

  .team-card:hover,
  .team-card.featured-leader:hover {
    transform: translateY(-4px);
  }

  .agency-story-card {
    padding: 28px 20px;
  }

  .about-features {
    grid-template-columns: 1fr;
  }

  /* Filter Bars Wrap Neatly */
  .skills-filter-tabs,
  .projects-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .filter-btn {
    padding: 8px 16px;
    font-size: 0.843rem;
  }

  /* All Grids Collapse to 1 Column */
  .skills-grid,
  .services-grid,
  .projects-grid,
  .process-grid,
  .benchmarks-grid {
    grid-template-columns: 1fr;
  }

  .project-thumb-wrapper {
    height: 230px;
  }

  .image-lightbox-modal .lightbox-box {
    padding: 16px;
    width: 95%;
    max-height: 88vh;
  }

  .benchmarks-notice-banner {
    flex-direction: column;
    text-align: center;
    padding: 20px 16px;
  }

  .benchmarks-notice-text {
    flex-direction: column;
    text-align: center;
  }

  .benchmarks-notice-banner .btn {
    width: 100%;
    justify-content: center;
  }

  .benchmark-actions {
    flex-wrap: wrap;
  }

  .btn-benchmark-select {
    width: 100%;
  }

  .timeline-container {
    padding-left: 28px;
  }

  .timeline-dot {
    left: -28px;
  }

  .timeline-company {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .testimonial-card {
    min-width: min(300px, 85vw);
    max-width: 85vw;
  }

  .contact-methods {
    gap: 14px;
  }

  .contact-method-item {
    padding: 14px 16px;
  }

  .budget-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .budget-btn {
    padding: 8px 10px;
    font-size: 0.813rem;
    text-align: center;
  }

  .navbar {
    width: calc(100% - 24px);
    left: 50%;
    transform: translate3d(-50%, 0, 0) !important;
    padding: 0 16px;
    height: 60px;
  }

  .nav-brand {
    font-size: 1.125rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 28px;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  /* Disable dual glowing cursor on touch screens */
  .custom-cursor-dot,
  .custom-cursor-follower {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   5. Standard Mobile Viewports (max-width: 600px)
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  /* Hide inline Hire Us button in navbar to prevent crowding and horizontal overflow */
  .navbar .nav-actions .btn-primary,
  .navbar .nav-cta-btn {
    display: none !important;
  }

  .navbar {
    padding: 0 14px;
  }

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

  .hero-cta-group .btn {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
  }

  .agency-cta-row {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .agency-cta-row .btn {
    width: 100%;
    justify-content: center;
  }

  .benchmark-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .btn-benchmark-select,
  .btn-benchmark-copy {
    width: 100%;
    justify-content: center;
  }

  .project-links,
  .project-actions {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .project-links .btn,
  .project-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 10px 16px !important;
  }

  .modal-box {
    width: 95vw;
    padding: 22px 16px;
    max-height: 88vh;
    overflow-y: auto;
  }

  .image-lightbox-modal .lightbox-box {
    padding: 12px;
    width: 96vw;
  }

  .toast-notification {
    left: 16px;
    right: 16px;
    max-width: calc(100vw - 32px);
    text-align: center;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   6. Compact Smartphones & Foldables (max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .section {
    padding: 64px 0;
  }

  .container {
    padding: 0 14px;
  }

  .section-badge {
    font-size: 0.75rem;
    padding: 5px 14px;
    margin-bottom: 14px;
  }

  .section-title {
    font-size: 1.85rem;
    line-height: 1.25;
  }

  .section-subtitle {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .hero-badge {
    font-size: 0.72rem;
    padding: 6px 14px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
  }

  .hero-title {
    font-size: 2.05rem;
    line-height: 1.15;
    margin-bottom: 18px;
  }

  .hero-subtitle {
    font-size: 1.05rem;
    margin-bottom: 28px;
  }

  .hero-stats {
    gap: 16px 12px;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .stat-label {
    font-size: 0.813rem;
  }

  .hero-spline-container {
    height: 290px;
    touch-action: pan-y !important;
  }

  .glass-card {
    padding: 22px 16px;
  }

  .team-card {
    padding: 22px 16px;
  }

  .team-img-wrapper {
    max-width: 160px;
  }

  .team-name {
    font-size: 1.15rem;
  }

  .team-role {
    font-size: 0.813rem;
  }

  .team-bio {
    font-size: 0.875rem;
  }

  .team-tags {
    gap: 5px;
  }

  .team-tag {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .team-wa-btn {
    font-size: 0.843rem;
    padding: 10px 14px;
    width: 100%;
    justify-content: center;
  }

  .project-thumb-wrapper {
    height: 200px;
  }

  .project-info {
    padding: 20px 16px;
  }

  .project-links,
  .project-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .project-links .btn,
  .project-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .service-card {
    padding: 24px 18px;
  }

  .process-card {
    padding: 24px 18px;
  }

  .budget-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .budget-btn {
    padding: 10px;
    font-size: 0.875rem;
  }

  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    font-size: 0.95rem;
  }

  .mobile-nav-drawer {
    width: 290px;
    max-width: 86vw;
    padding: 70px 24px 24px;
  }

  .mobile-nav-links a {
    font-size: 1.1rem;
  }
}

/* --------------------------------------------------------------------------
   7. Extra Small Devices & Foldables (≤ 360px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .container {
    padding: 0 12px;
  }

  .navbar {
    width: calc(100% - 16px);
    padding: 0 10px;
    height: 56px;
  }

  .nav-brand {
    font-size: 0.95rem;
    gap: 6px;
  }

  .nav-actions {
    gap: 8px;
  }

  .theme-toggle-btn {
    width: 34px;
    height: 34px;
    font-size: 0.875rem;
  }

  .mobile-menu-btn {
    font-size: 1.25rem;
    padding: 2px;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-badge {
    font-size: 0.68rem;
    padding: 5px 10px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .hero-spline-container {
    height: 250px;
    touch-action: pan-y !important;
  }

  .filter-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .testimonial-card {
    min-width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    padding: 20px 14px;
  }

  .glass-card {
    padding: 18px 12px;
  }

  .team-card {
    padding: 18px 12px;
  }

  .team-img-wrapper {
    max-width: 140px;
  }

  .team-tags {
    gap: 4px;
  }

  .team-tag {
    font-size: 0.68rem;
    padding: 3px 6px;
  }

  .timeline-container {
    padding-left: 20px;
  }

  .timeline-dot {
    left: -20px;
  }
}

/* --------------------------------------------------------------------------
   8. Mobile Landscape Orientation Mode
   -------------------------------------------------------------------------- */
@media (max-height: 500px) and (orientation: landscape) {
  .navbar {
    height: 48px;
    top: 10px;
  }

  .hero-section {
    padding-top: 70px;
    padding-bottom: 40px;
    min-height: auto;
  }

  .hero-spline-container {
    height: 220px;
  }

  .section {
    padding: 50px 0;
  }

  .modal-box,
  .image-lightbox-modal .lightbox-box {
    max-height: 84vh;
  }
}
