/* ==========================================================================
   VHUWON MATHERS — HIGH-PERFORMANCE RESPONSIVE STYLESHEET
   Domain: gautambhuwan.com.np
   Breakpoints: 320px, 480px, 640px, 768px, 1080px, 1280px+
   ========================================================================== */

/* Universal Layout Safeguards (Zero Horizontal Page Blowouts) */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, picture, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

pre, code, .terminal-body {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive, .table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

/* Large Desktops & Wide Displays */
@media (min-width: 1440px) {
  .container {
    max-width: 1280px;
  }
}

/* Medium Laptops & Desktops: Compact Desktop Nav to prevent 12-link wrapping */
@media (min-width: 1081px) and (max-width: 1320px) {
  .nav-links {
    gap: 2px;
  }
  .nav-link {
    padding: 6px 9px;
    font-size: 0.82rem;
  }
  .brand-badge {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  .brand-name {
    font-size: 1.05rem;
  }
  .brand-sub {
    font-size: 0.64rem;
  }
}

/* Tablets & Small Laptops (Max 1080px) -> Switch to Clean Mobile Drawer */
@media (max-width: 1080px) {
  .desktop-nav {
    display: none;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .site-header {
    height: 68px;
  }

  .nav-container {
    height: 68px;
  }

  .section {
    padding: 64px 0;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
  }

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

  .hero-layout {
    flex-direction: column-reverse;
    text-align: left;
    gap: 36px;
  }

  .hero-visual {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }

  .tech-strip-inner {
    justify-content: flex-start;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .tech-tag-item {
    white-space: nowrap;
  }

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

/* Mobile Phones (Max 640px) */
@media (max-width: 640px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .section {
    padding: 48px 0;
  }

  .section-tight {
    padding: 32px 0;
  }

  .card {
    padding: 20px 16px;
  }

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

  .display-title {
    font-size: clamp(2rem, 7.5vw, 2.5rem);
    line-height: 1.15;
  }

  .section-title {
    font-size: clamp(1.5rem, 5.5vw, 1.9rem);
    line-height: 1.25;
  }

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

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

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

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

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

  /* Modals on Mobile */
  .article-modal-card {
    max-width: 95vw;
    max-height: 90vh;
    padding: 20px 16px;
  }

  .modal-header {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* Small Screens (Max 380px) */
@media (max-width: 380px) {
  .brand-sub {
    display: none;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .btn {
    padding: 9px 14px;
    font-size: 0.82rem;
  }

  .section-badge, .status-pill {
    font-size: 0.68rem;
    padding: 3px 8px;
  }
}

/* Print Stylesheet for Resume / Documentation */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body::before, .site-header, .site-footer, .back-to-top, .theme-toggle-btn {
    display: none !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}
