/* ================================================================
   MonkAI – responsive.css
   Breakpoints, mobile navigation, layout adjustments.
   ================================================================ */

/* ---------- Tablet (<= 1024px) ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Portfolio + Team opt out of the generic .grid-3 columns above: both
     define their own capped auto-fit grid in style.css so an incomplete
     last row stays centred instead of orphaning a card on the left.
     Without this they'd inherit .grid-3 (this file loads after style.css
     and specificity ties), and 5 portfolio cards would lay out 2+2+1. */
  .portfolio-grid,
  #team .grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
    justify-content: center;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-content { order: 2; }
  .hero-illustration { order: 1; }
  .hero-svg { width: min(80%, 440px); }
  .hero-text { margin-inline: auto; }
  .hero-buttons { justify-content: center; }

  .contact-wrap {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-brand,
  .footer-social { justify-content: center; align-items: center; }
  .footer-brand { align-items: center; }
  .footer-social { justify-content: center; }
}

/* ---------- Mobile nav threshold ---------- */
@media (max-width: 860px) {
  .hamburger { display: flex; }

  .nav-menu {
    position: fixed;
    top: 64px;
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    background: rgba(5, 8, 22, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    transform: translateY(-110%);
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
    gap: 0.2rem;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  .nav-menu.open {
    transform: translateY(0);
  }
  .nav-link {
    padding: 0.85rem 1rem;
    border-radius: 12px;
  }

  /* Timeline collapses to single column on mobile */
  .timeline::before { left: 14px; }
  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    width: 100%;
    left: 0;
    text-align: left;
    padding: 0.4rem 0 1.6rem 2.4rem;
  }
  .timeline-item:nth-child(odd) .timeline-dot,
  .timeline-item:nth-child(even) .timeline-dot {
    left: 8px;
    right: auto;
  }
}

/* ---------- Mobile (<= 640px) ---------- */
@media (max-width: 640px) {
  :root {
    --section-pad-y: 4rem;
  }

  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  /* Keep cards capped + centred rather than stretched full-bleed. */
  .portfolio-grid,
  #team .grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 340px));
    justify-content: center;
  }

  .form-row { grid-template-columns: 1fr; }
  .form-submit { align-self: stretch; }

  .hero { min-height: auto; padding-block: 5rem 2rem; }
  .hero-svg { width: min(90%, 380px); }

  .scroll-indicator { display: none; }

  .hero-buttons { width: 100%; }
  .btn { width: 100%; justify-content: center; }
  .hero-buttons.center .btn { width: auto; }

  .footer-nav { gap: 0.8rem 1rem; }
  .footer-social { gap: 0.5rem; }

  .back-to-top {
    right: 0.8rem;
    bottom: 0.8rem;
    width: 40px; height: 40px;
  }

  .nav-container { padding: 0.65rem 1rem; }
  .nav-logo { font-size: 1.05rem; }
}

/* ---------- Small mobile (<= 380px) ---------- */
@media (max-width: 380px) {
  h1 { font-size: 2rem; }
  .hero-subtitle { font-size: 1rem; }
}

/* ---------- Print ---------- */
@media print {
  .navbar, .scroll-progress, .particle-canvas,
  .back-to-top, .scroll-indicator, .hero-bg { display: none !important; }
  body { background: #fff; color: #000; }
  .glass-card { background: #fff; border-color: #ddd; box-shadow: none; }
}
