/* ==========================================================================
   DECODE INTELLIGENCE — RESPONSIVE DESIGN & MOBILE OPTIMIZATION
   ========================================================================== */

/* Tablet & Smaller Desktops (<= 1024px) */
@media screen and (max-width: 1024px) {
  :root {
    --header-height: 72px;
  }

  .section {
    padding: 6rem 0;
  }

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

  .pipeline-flow {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem 0.75rem;
  }

  .pipeline-track-line {
    display: none; /* Hide linear bar on multi-row responsive flow */
  }

  .execution-card {
    width: 42%;
  }

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

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

  .lead-container {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .lead-info-col {
    padding-right: 0;
  }

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

/* Mobile Devices (<= 768px) */
@media screen and (max-width: 768px) {
  :root {
    --header-height: 68px;
  }

  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .section {
    padding: 4.5rem 0;
  }

  .section-header {
    margin-bottom: 3rem;
  }

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

  /* Header & Mobile Nav Drawer */
  .nav-links {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: rgba(4, 6, 12, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-direction: column;
    align-items: flex-start;
    padding: 2.5rem 2rem;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .nav-link {
    font-size: 1.35rem;
    font-weight: 600;
  }

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

  .nav-actions .btn {
    display: none;
  }

  /* Hero Mobile */
  .hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + 3rem);
    padding-bottom: 3.5rem;
  }

  .hero-title {
    font-size: 2.45rem;
    letter-spacing: -0.025em;
  }

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

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

  .hero-actions .btn {
    width: 100%;
    padding: 0.95rem;
  }

  .hero-proof-strip {
    gap: 1.25rem;
    flex-direction: column;
    align-items: center;
  }

  /* Capabilities Console & Bento Matrix (Tablet) */
  .console-deck {
    grid-template-columns: 280px 1fr;
    min-height: auto;
  }

  .console-stage {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
  }

  .stage-simulator-col {
    height: 420px;
  }

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

  /* Capabilities Console Mobile */
  .console-deck {
    grid-template-columns: 1fr;
  }

  .console-nav-sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem;
    gap: 0.65rem;
    -webkit-overflow-scrolling: touch;
  }

  .console-nav-header {
    display: none;
  }

  .console-tab-item {
    min-width: 210px;
    flex-shrink: 0;
    padding: 0.75rem 1rem;
  }

  .console-stage {
    padding: 1.5rem 1.25rem;
    gap: 1.5rem;
  }

  .spec-title {
    font-size: 1.7rem;
  }

  .stage-simulator-col {
    height: 380px;
  }

  .bento-matrix {
    grid-template-columns: 1fr;
  }

  .bento-cell.featured {
    grid-column: span 1;
  }

  /* Floating UI Ecosystem Mobile (Stacked Cards) */
  .ecosystem-flow-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0.5rem 0.25rem 1rem;
    -webkit-overflow-scrolling: touch;
  }

  .flow-step-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .ecosystem-stage {
    min-height: auto;
    perspective: none;
  }

  .ecosystem-3d-wrapper {
    min-height: auto;
    transform: none !important;
    flex-direction: column;
    gap: 1.25rem;
  }

  .ecosystem-svg-layer {
    display: none;
  }

  .crm-central-hub {
    width: 100%;
    transform: none !important;
    order: 1;
  }

  .floating-window {
    position: relative;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    transform: none !important;
    order: 2;
  }

  /* Pipeline Mobile */
  .pipeline-wrapper {
    padding: 1.75rem 1.25rem;
  }

  .pipeline-flow {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 0.5rem;
  }

  .pipeline-inspector {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .telemetry-col-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .telemetry-stat-unit {
    text-align: left;
  }

  /* Execution Timeline Mobile */
  .execution-timeline::before {
    left: 20px;
  }

  .execution-row {
    flex-direction: column !important;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    padding-left: 50px;
  }

  .execution-card {
    width: 100%;
    padding: 1.75rem;
  }

  .execution-marker {
    left: 20px;
    top: 24px;
    transform: translate(-50%, 0);
    width: 36px;
    height: 36px;
  }

  /* Impact Counters Mobile */
  .impact-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .impact-card {
    padding: 2rem 1.5rem;
  }

  .impact-number {
    font-size: 3rem;
  }

  /* Industries Mobile */
  .industries-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Lead Form Mobile */
  .lead-form-card {
    padding: 2rem 1.5rem;
  }

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

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

  /* Final CTA Mobile */
  .final-cta-card {
    padding: 3.5rem 1.5rem;
  }

  .final-cta-title {
    font-size: 2rem;
  }

  .final-cta-subtitle {
    font-size: 1.05rem;
  }

  /* Footer Mobile */
  .footer-top-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-brand-col {
    padding-right: 0;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Floating elements on Mobile */
  .chatbot-widget {
    bottom: 1.25rem;
    right: 1.25rem;
  }

  .chatbot-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    z-index: 2000;
  }

  .instagram-floating-badge {
    bottom: 1.25rem;
    left: 1.25rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.78rem;
  }
}

/* Small Smart Phones (<= 380px) */
@media screen and (max-width: 380px) {
  .hero-title {
    font-size: 2.1rem;
  }
  
  .pipeline-flow {
    grid-template-columns: 1fr;
  }
}

/* Accessibility & Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
