/* ==========================================================================
   GALOTTECH — MOBILE RESPONSIVENESS & ADAPTIVE LAYOUTS
   Ultra-polished responsive engine for all viewport sizes (320px to 1440px)
   ========================================================================== */

/* Global Mobile Foundation */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  width: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Base Desktop Helpers */
.mobile-cta-item {
  display: none;
}

/* --------------------------------------------------------------------------
   Large Laptops / Compact Desktops (<= 1140px)
   -------------------------------------------------------------------------- */
@media (max-width: 1140px) {
  .certs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .protocol-steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Tablets / Medium Devices (<= 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero-container {
    grid-template-columns: 1fr;
    gap: 48px;
    text-align: center;
  }

  .hero-content {
    max-width: 100%;
    margin: 0 auto;
  }

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

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

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

  .hero-visual {
    width: 100%;
  }

  .hud-panel {
    max-width: 580px;
    margin: 0 auto;
  }

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

  .cases-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .arch-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

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

/* --------------------------------------------------------------------------
   Mobile Devices & Small Tablets (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Section Padding */
  .section {
    padding: 70px 0;
  }

  .container {
    padding: 0 18px;
  }

  /* Global Button Wrap on Mobile */
  .btn {
    white-space: normal !important;
    text-align: center;
    line-height: 1.35;
    padding: 13px 20px;
  }

  /* Header & Navigation */
  .main-header {
    height: 72px;
  }

  .nav-container {
    height: 72px;
    padding: 0 18px;
  }

  .brand-logo img {
    width: 32px;
    height: 32px;
  }

  .brand-text {
    font-size: 1.2rem;
  }

  .btn-header-cta {
    display: none !important;
  }

  .nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .nav-toggle:hover, .nav-toggle:active {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.35);
    color: var(--cyan);
  }

  /* Mobile Drawer Navigation */
  .nav-links {
    display: none;
    position: fixed;
    top: 72px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(5, 8, 14, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 0 !important;
    border-top: 1px solid rgba(0, 229, 255, 0.2);
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
    border-left: none;
    border-right: none;
    flex-direction: column;
    padding: 24px 20px 48px 20px;
    gap: 12px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.95);
    z-index: 999;
  }

  .nav-links.mobile-open {
    display: flex !important;
    animation: mobileDrawerFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes mobileDrawerFade {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-links li {
    width: 100%;
    list-style: none;
  }

  .nav-links .nav-link {
    display: block;
    width: 100%;
    padding: 13px 16px;
    font-size: 1.05rem;
    color: #ffffff;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    transition: all var(--transition-fast);
  }

  .nav-links .nav-link:hover, .nav-links .nav-link:active {
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.3);
    color: var(--cyan);
  }

  .nav-links .mobile-cta-item {
    display: block !important;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-links .mobile-cta-item .btn {
    width: 100%;
    padding: 15px 20px;
    font-size: 0.98rem;
  }

  /* Hero Section */
  .hero-section {
    padding: 105px 0 50px 0;
    min-height: auto;
  }

  .hero-backdrop-glow {
    width: 100%;
    max-width: 100vw;
    height: 300px;
  }

  .hero-badge {
    font-size: 0.74rem;
    padding: 5px 12px;
    margin-bottom: 20px;
  }

  .hero-title {
    font-size: clamp(2rem, 7.5vw, 2.7rem);
    line-height: 1.15;
    margin-bottom: 18px;
    word-break: break-word;
  }

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

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

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

  .hero-guarantee {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    font-size: 0.78rem;
  }

  /* HUD Panel & Terminal */
  .hud-panel {
    max-width: 100%;
    border-radius: 18px;
  }

  .hud-header {
    padding: 12px 16px;
  }

  .hud-body {
    padding: 18px 16px;
  }

  .hud-metric-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .hud-card {
    padding: 12px 10px;
  }

  .hud-card-label {
    font-size: 0.68rem;
  }

  .hud-card-value {
    font-size: 1.25rem;
    word-break: break-word;
  }

  .hud-terminal {
    height: 120px;
    padding: 10px 12px;
    font-size: 0.7rem;
  }

  .hud-terminal-log {
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.7rem;
    line-height: 1.35;
  }

  /* Hero Stats Strip */
  .hero-stats-strip {
    margin-top: 48px;
    padding-top: 28px;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 14px;
  }

  .hero-stat-num {
    font-size: 1.9rem;
  }

  .hero-stat-label {
    font-size: 0.74rem;
  }

  /* Certifications */
  .certifications-section {
    padding: 60px 0;
  }

  .certs-intro {
    font-size: 0.78rem;
    margin-bottom: 24px;
  }

  .certs-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cert-badge-card {
    padding: 16px 18px;
    min-height: 72px;
    border-radius: 16px;
    gap: 14px;
  }

  .cert-logo-wrapper img {
    height: 28px;
    max-width: 160px;
  }

  .cert-verify-tag {
    font-size: 0.68rem;
    padding: 4px 9px;
  }

  /* Dual Offering Switcher (Services) */
  .service-switcher-wrapper {
    margin-bottom: 32px;
  }

  .service-switcher {
    flex-direction: column;
    width: 100%;
    padding: 6px;
    gap: 6px;
    border-radius: 14px;
  }

  .service-tab-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  .service-showcase-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

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

  .service-card-title {
    font-size: 1.3rem;
  }

  .service-card-desc {
    font-size: 0.92rem;
  }

  .tech-tag-cloud {
    gap: 6px;
  }

  .tech-tag {
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  /* Data Science Chart Visualizer */
  .chart-visualizer-card {
    padding: 20px 14px;
    border-radius: 18px;
  }

  .chart-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .chart-metric-selector {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .chart-toggle-btn {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.82rem;
  }

  .chart-legend-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.76rem;
  }

  .chart-canvas-container {
    height: 240px;
  }

  .chart-insight-strip {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
  }

  .insight-metric {
    padding: 12px 14px;
  }

  .insight-metric-val {
    font-size: 1.25rem;
  }

  /* Calculator */
  .calculator-card {
    padding: 24px 16px;
    border-radius: 18px;
  }

  .calc-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .calc-current-val {
    font-size: 1.15rem;
  }

  .calc-results-panel {
    padding: 22px 16px;
    border-radius: 16px;
  }

  .calc-projected-revenue {
    font-size: clamp(1.8rem, 6vw, 2.3rem);
  }

  .calc-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .calc-metric-box {
    padding: 10px 12px;
  }

  .calc-metric-box-title {
    font-size: 0.68rem;
  }

  .calc-metric-box-value {
    font-size: 1rem;
  }

  #calc-btn-whatsapp {
    white-space: normal !important;
    text-align: center;
    line-height: 1.35;
    padding: 14px 16px;
    font-size: 0.88rem;
  }

  /* Steps & Architecture */
  .protocol-steps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .protocol-step-card {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .arch-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .arch-node-card {
    padding: 22px 18px;
    border-radius: 16px;
  }

  /* Cases */
  .cases-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .case-card {
    padding: 24px 18px;
    border-radius: 18px;
  }

  .case-stat-big {
    font-size: 1.75rem;
  }

  /* Footer */
  .main-footer {
    padding: 60px 0 32px 0;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 40px;
  }

  .footer-brand p {
    max-width: 100%;
  }

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

  /* Modals */
  .modal-overlay {
    padding: 12px;
  }

  .modal-content {
    padding: 28px 18px;
    border-radius: 18px;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-close-btn {
    top: 12px;
    right: 12px;
    padding: 8px;
    font-size: 1.6rem;
  }

  /* Blog & Articles Mobile */
  .blog-hero {
    padding: 95px 0 35px 0;
  }

  .blog-hero-title {
    font-size: clamp(1.8rem, 6.5vw, 2.5rem);
  }

  .blog-hero-desc {
    font-size: 0.98rem;
  }

  .blog-categories {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 16px 12px 16px;
    margin: 0 -16px;
    scrollbar-width: none;
  }

  .blog-categories::-webkit-scrollbar {
    display: none;
  }

  .blog-cat-btn {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 7px 14px;
  }

  .blog-card {
    padding: 22px 16px;
    border-radius: 16px;
  }

  .blog-card-title {
    font-size: 1.25rem;
    line-height: 1.35;
  }

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

  .breadcrumb-nav {
    padding: 85px 0 15px 0;
  }

  .article-header {
    margin-bottom: 28px;
  }

  .article-main-h1 {
    font-size: clamp(1.75rem, 5.5vw, 2.4rem);
    line-height: 1.25;
  }

  .article-meta-bar {
    font-size: 0.78rem;
    gap: 6px 10px;
    flex-wrap: wrap;
  }

  .prose {
    font-size: 1rem;
    line-height: 1.7;
  }

  .prose table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .prose th, .prose td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .prose pre {
    padding: 14px;
    font-size: 0.78rem;
  }

  .article-cta-box {
    padding: 26px 16px;
    border-radius: 16px;
  }

  .article-cta-buttons {
    flex-direction: column;
    width: 100%;
  }

  .article-cta-buttons .btn {
    width: 100%;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   Extra Small Devices (<= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .hud-metric-row {
    grid-template-columns: 1fr;
  }

  .calc-metrics-grid {
    grid-template-columns: 1fr;
  }

  .calc-metric-box[style*="span 2"] {
    grid-column: span 1 !important;
  }

  .hero-stats-strip {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-stat-item {
    align-items: center;
  }
}
