/* ==========================================================================
   tech index - Ultra-Responsive Mobile Stylesheet
   Full optimization for Smartphones (iOS & Android), Tablets & Laptops
   ========================================================================== */

/* --------------------------------------------------------------------------
   Touch Device Optimizations (Disable 3D tilt on touchscreens for smooth scroll)
   -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
  .tilt-card {
    transform: none !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  }
  .card-glare {
    display: none !important;
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* --------------------------------------------------------------------------
   Desktop & Laptop Scaling (<= 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .services-grid,
  .for-sale-grid,
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .process-steps {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

/* --------------------------------------------------------------------------
   Tablets (<= 992px)
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .header {
    padding: 14px 0;
  }

  .hero {
    padding: 130px 0 70px;
    min-height: auto;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 45px;
  }

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

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

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

  .hero-stats {
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
  }

  .estimator-box {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 32px;
  }

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

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

  /* Hide desktop navbar on tablets and phones */
  .desktop-nav {
    display: none !important;
  }

  /* --- Mobile Hamburger Button --- */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
  }

  .mobile-menu-toggle:hover {
    background: rgba(0, 242, 254, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
  }

  /* Dedicated Mobile Drawer Overlay */
  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
  }

  .mobile-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Dedicated Mobile Drawer Panel */
  .mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(88vw, 360px);
    height: 100vh;
    height: 100dvh;
    background: #0d131f;
    border-left: 1px solid rgba(0, 242, 254, 0.3);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.85);
    z-index: 2999;
    display: flex;
    flex-direction: column;
    transition: right 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
  }

  [data-theme="light"] .mobile-drawer {
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.2);
  }

  .mobile-drawer.open {
    right: 0;
  }

  /* Drawer Header */
  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
  }

  .drawer-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: var(--transition);
  }

  .drawer-close-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: rotate(90deg);
  }

  /* Drawer Body */
  .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .drawer-menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
  }

  .drawer-link:hover,
  .drawer-link.active {
    background: rgba(0, 242, 254, 0.08);
    border-color: rgba(0, 242, 254, 0.35);
    color: var(--accent-cyan);
    transform: translateX(-4px);
  }

  .drawer-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: var(--transition);
  }

  .drawer-link.active .drawer-icon-box {
    background: var(--grad-primary);
    color: #040914;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
  }

  .drawer-link-title {
    flex-grow: 1;
  }

  .drawer-badge-hot {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 700;
  }

  .drawer-badge-pill {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    font-weight: 700;
  }

  .drawer-arrow {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
  }

  .drawer-link:hover .drawer-arrow {
    transform: translateX(-4px);
    color: var(--accent-cyan);
  }

  /* Drawer Footer */
  .drawer-footer {
    padding: 16px 18px 24px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
  }
}

/* Hide mobile drawer on desktop (> 992px) */
@media (min-width: 993px) {
  .mobile-drawer,
  .mobile-drawer-overlay,
  .mobile-menu-toggle {
    display: none !important;
  }
}


/* --------------------------------------------------------------------------
   Smartphones & Small Tablets (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Header adjustments for phones */
  .header-cta-desktop {
    display: none !important;
  }

  .nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .mobile-menu-toggle {
    flex-shrink: 0;
  }

  .nav-actions {
    gap: 8px;
    flex-shrink: 0;
  }

  .logo {
    gap: 8px;
    margin: 0 auto;
  }

  .logo-icon {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    border-radius: 10px;
  }

  .logo-title {
    font-size: 1.25rem;
  }

  .logo-sub {
    font-size: 0.65rem;
  }

  .section {
    padding: 60px 0;
  }


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

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

  .section-desc {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  /* Hero Section */
  .hero {
    padding: 110px 0 50px;
  }

  .hero-title {
    font-size: clamp(1.65rem, 5.5vw, 2.3rem);
    line-height: 1.35;
    margin-bottom: 18px;
  }

  .typing-container {
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  .typing-text {
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
  }

  .hero-desc {
    font-size: 0.95rem;
    line-height: 1.75;
    margin-bottom: 28px;
  }

  /* Hero Stats: 2x2 Grid with neat cards */
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-top: 24px;
  }

  .stat-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    align-items: center;
  }

  .stat-number-box {
    justify-content: center;
  }

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

  .stat-suffix {
    font-size: 1.25rem;
  }

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

  /* Grids collapse to single column on mobile */
  .services-grid,
  .for-sale-grid,
  .portfolio-grid,
  .testimonials-grid,
  .type-select-grid,
  .addons-grid,
  .why-grid,
  .process-steps {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Portfolio Filter Tabs: Horizontal Scroll on Mobile */
  .portfolio-filter {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 30px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
  }

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

  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  /* Service & Product Cards */
  .service-card {
    padding: 28px 20px;
  }

  .product-card-top {
    height: 130px;
  }

  .product-main-icon {
    font-size: 3rem;
  }

  .product-card-body {
    padding: 20px 16px;
  }

  .product-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  .product-actions .btn {
    min-height: 44px; /* Minimum Apple touch target */
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  /* Estimator Box */
  .estimator-box {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }

  .estimator-summary {
    padding: 22px 18px;
  }

  .total-price {
    font-size: 1.85rem;
  }

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

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

  /* Crucial iOS fix: Form inputs must be >= 16px to prevent automatic zooming */
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
    padding: 12px 14px;
    min-height: 48px;
  }

  .form-textarea {
    min-height: 110px;
  }

  /* Modals on Mobile Devices */
  .modal-backdrop {
    padding: 10px;
    align-items: flex-end; /* Slide-up modal style on phones */
  }

  .modal-container {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 20px 20px 10px 10px;
  }

  .modal-header-banner {
    height: 120px;
  }

  .modal-body {
    padding: 20px 18px 24px;
  }

  .modal-product-title {
    font-size: 1.25rem;
  }

  .modal-features-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions .btn {
    width: 100%;
    min-height: 46px;
  }

  /* Floating WhatsApp Button on Mobile */
  .floating-whatsapp {
    bottom: 20px;
    left: 18px;
  }

  .whatsapp-btn-circle {
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
  }

  .whatsapp-label-tooltip {
    display: none !important;
  }

  /* Footer on Mobile */
  .footer {
    padding: 50px 0 25px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

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

/* --------------------------------------------------------------------------
   Small Phones (<= 480px, e.g. iPhone SE, Galaxy A series, etc.)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    width: 92%;
  }

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

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

  .logo-title {
    font-size: 1.25rem;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .theme-toggle-btn {
    width: 36px;
    height: 36px;
  }

  .header .btn-primary {
    display: none; /* Hide top CTA in compact phone header to prevent clutter */
  }

  .floating-tech-badge {
    display: none;
  }

  .product-actions {
    grid-template-columns: 1fr;
  }

  .product-actions .btn {
    width: 100%;
  }

  .process-step-card {
    padding: 20px 16px;
  }

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

  .why-icon {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   Safe Area Insets for iPhones with Notches & Dynamic Island
   -------------------------------------------------------------------------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .floating-whatsapp {
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: calc(18px + env(safe-area-inset-left));
  }
  .footer {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }
  .nav-links {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }
}
