/* ==========================================================================
   NEXUS // DEV & ART - FULL RESPONSIVE & MOBILE / TABLET SCALABILITY
   Breakpoints:
   - Desktops & Large Displays (> 1200px)
   - Laptops & Tablets Landscape (992px - 1199px)
   - Tablets Portrait (768px - 991px)
   - Large Mobile (480px - 767px)
   - Small Mobile (< 480px)
   ========================================================================== */

/* ── Fluid Container & Layout Scaling ───────────────────────────────────────── */
:root {
  --container-pad: 1.5rem;
}

@media (min-width: 1400px) {
  :root {
    --max-width: 1280px;
    --container-pad: 2rem;
  }
}

.container {
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
  width: 100%;
  box-sizing: border-box;
}

/* ── Tablets Landscape & Small Laptops (992px - 1199px) ─────────────────────── */
@media (max-width: 1199px) {
  :root {
    --header-height: 64px;
    --container-pad: 1.5rem;
  }

  .nav-links {
    gap: 0.85rem;
  }

  .nav-link {
    font-size: 0.82rem;
  }

  .hero-grid-layout {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .hero-title {
    font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  }

  .hero-card-viewport {
    height: 250px;
  }

  .lab-container {
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
  }

  .about-grid {
    grid-template-columns: 300px 1fr;
    gap: 2rem;
  }
}

/* ── Tablets Portrait & Mid Screens (768px - 991px) ─────────────────────────── */
@media (max-width: 991px) {
  :root {
    --header-height: 62px;
    --container-pad: 1.25rem;
  }

  /* Navigation Drawer Switch */
  .nav-links, .search-trigger-btn {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-drawer {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-medium);
    padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 999;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-drawer.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-link {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
    transition: all var(--transition-fast);
  }

  .mobile-nav-link:hover, .mobile-nav-link.active {
    color: var(--accent-cyan);
    background: hsla(186, 100%, 50%, 0.08);
    border-color: rgba(0, 240, 255, 0.2);
  }

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

  .hero-grid-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-interactive-card {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    order: -1;
  }

  .hero-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

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

  /* 3D Lab Stacking */
  .lab-container {
    grid-template-columns: 1fr;
  }

  .lab-viewport {
    height: 320px;
    min-height: 320px;
  }

  /* About Grid */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .author-portrait-card {
    max-width: 440px;
    margin: 0 auto;
  }

  /* Projects & News */
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.35rem;
  }

  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.35rem;
  }

  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.25rem;
  }

  .arsenal-categorized-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
  }

  /* Contact & Terminal */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sandbox-card {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-container {
    flex-direction: column;
    gap: 2rem;
  }

  .footer-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
  }

  .section {
    padding: 3.5rem 0;
  }
}

/* ── Mobile Phones (Under 768px) ────────────────────────────────────────────── */
@media (max-width: 767px) {
  :root {
    --header-height: 60px;
    --container-pad: 1rem;
  }

  .brand-subtitle {
    display: none;
  }

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

  .brand-icon {
    width: 34px;
    height: 34px;
  }

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

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .page-hero-banner {
    padding: 2.75rem 0 1.75rem;
  }

  .page-hero-title {
    font-size: clamp(1.5rem, 5.5vw, 2.1rem);
  }

  .page-hero-subtitle {
    font-size: 0.92rem;
  }

  .blog-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .category-tabs {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .tab-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.65rem;
    min-height: 38px;
  }

  .search-input-box {
    width: 100%;
    max-width: 100%;
  }

  .footer-nav {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .reader-modal-container {
    max-height: 94vh;
    border-radius: var(--radius-md);
  }

  .reader-modal-header {
    padding: 0.85rem 1rem;
  }

  .reader-modal-body {
    padding: 1rem;
  }

  .reader-modal-footer {
    padding: 0.85rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .engagement-bar {
    justify-content: space-between;
  }
}

/* ── Small Mobile Screens (Under 480px) ──────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --container-pad: 0.85rem;
  }

  html {
    font-size: 14px;
  }

  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.1rem; }

  .section {
    padding: 2.75rem 0;
  }

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

  .hero-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .hero-stat-card {
    padding: 0.65rem 0.75rem;
  }

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

  .hero-card-viewport {
    height: 220px;
  }

  .lab-viewport {
    height: 220px;
    min-height: 220px;
  }

  .comparison-slider-container {
    height: 180px;
  }

  .author-portrait-card {
    padding: 1rem;
  }

  .author-avatar {
    width: 88px;
    height: 88px;
  }

  .arsenal-categorized-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

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

  .about-specs-grid {
    grid-template-columns: 1fr;
  }

  .footer-nav {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .toast-notification {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.65rem;
  }
}

/* ── Hardware Accelerated Touch Scrolling & Polish ──────────────────────────── */
* {
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea, button {
  touch-action: manipulation;
}

.table-wrap, .data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Chat Mobile & Tablet Polish */
@media (max-width: 768px) {
  .chat-window-card {
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px); /* modern browsers */
    min-height: 300px; /* lower min-height for keyboard */
    border-radius: var(--radius-md);
  }
  .chat-main-header {
    padding: 0.65rem 0.85rem;
  }
  .chat-header-title {
    font-size: 0.95rem;
  }
  .chat-messages-stream {
    padding: 0.85rem;
    gap: 0.65rem;
  }
  .chat-input-wrapper {
    padding: 0.65rem 0.85rem;
  }
  .chat-text-input {
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
  }
  .chat-send-btn {
    padding: 0.65rem 0.95rem;
    font-size: 0.85rem;
  }
}
