/* ==========================================================================
   VirtualFactory — Responsive Design Pass & Polish
   Additional breakpoints and touch/mobile improvements across all pages.
   ========================================================================== */

/* --- Global: Small screens (480px and below) --- */
@media (max-width: 480px) {
  :root {
    --space-lg: 20px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
  }

  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.1rem;
  }

  h2 {
    font-size: 0.85rem;
  }

  h3 {
    font-size: 0.7rem;
  }

  p {
    font-size: 0.6rem;
  }

  .container {
    padding: 0 var(--space-md);
  }

  .btn {
    padding: 10px 18px;
    font-size: 0.5rem;
  }
}

/* --- Navigation: Tablet (769px - 1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-links {
    gap: var(--space-md);
  }

  .nav-links a {
    font-size: 0.5rem;
  }
}

/* --- Home Page: Tablet --- */
@media (max-width: 1024px) and (min-width: 769px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    gap: var(--space-xl);
  }
}

/* --- Home Page: Small mobile --- */
@media (max-width: 480px) {
  .hero {
    padding: var(--space-2xl) var(--space-md);
    min-height: auto;
  }

  .hero-logo {
    width: 120px;
    height: 120px;
  }

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

  .hero-tagline {
    font-size: 0.6rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .feature-card {
    padding: var(--space-lg);
  }

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

  .stat-label {
    font-size: 0.45rem;
  }
}

/* --- Nodes Page: Tablet --- */
@media (max-width: 1024px) and (min-width: 901px) {
  .node-card,
  .node-card:nth-child(even) {
    grid-template-columns: 240px 1fr;
  }

  .node-card:nth-child(even) .node-viewer {
    order: 0;
  }

  .node-viewer {
    width: 240px;
    height: 240px;
  }
}

/* --- Nodes Page: Small mobile --- */
@media (max-width: 480px) {
  .category-nav {
    padding: var(--space-sm) var(--space-md);
  }

  .category-btn {
    font-size: 0.45rem;
    padding: 6px 12px;
  }

  .node-viewer {
    width: 100%;
    height: 250px;
    max-width: 100%;
  }

  .node-name {
    font-size: 0.7rem;
  }

  .node-description {
    font-size: 0.55rem;
  }

  .node-meta {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .nodes-container {
    padding: var(--space-lg) var(--space-md);
  }
}

/* --- Getting Started: Small mobile --- */
@media (max-width: 480px) {
  .guide-hero {
    padding: var(--space-2xl) var(--space-md) var(--space-lg);
  }

  .guide-hero h1 {
    font-size: 0.9rem;
  }

  .guide-step {
    padding-left: var(--space-xl);
  }

  .guide-step::before {
    width: 28px;
    height: 28px;
    font-size: 0.5rem;
  }

  .guide-step h3 {
    font-size: 0.65rem;
  }

  .guide-step p {
    font-size: 0.55rem;
  }

  .guide-step .command-block {
    font-size: 0.5rem;
    padding: var(--space-sm);
  }

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

/* --- Connect Page: Small mobile --- */
@media (max-width: 480px) {
  .connect-hero {
    padding: var(--space-2xl) var(--space-md);
    min-height: auto;
  }

  .connect-hero h1 {
    font-size: 0.9rem;
  }

  .server-ip-box {
    padding: var(--space-lg) var(--space-md);
  }

  .server-ip-value {
    font-size: 0.75rem;
    letter-spacing: 1px;
  }

  .connect-card {
    width: 100%;
  }

  .join-steps {
    padding: 0 var(--space-md) var(--space-2xl);
  }

  .join-steps h2 {
    font-size: 0.75rem;
  }
}

/* --- Touch interaction improvements --- */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects that don't work well on touch */
  .card:hover {
    transform: none;
  }

  /* Increase touch targets */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .category-btn {
    min-height: 40px;
    padding: 10px 16px;
  }

  .nav-links a {
    padding: var(--space-md) 0;
  }

  /* Disable auto-rotate pause hint — touch users won't hover */
  .node-viewer {
    cursor: grab;
  }

  .node-viewer:active {
    cursor: grabbing;
  }
}

/* --- Landscape phones --- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--space-xl) var(--space-lg);
  }

  .hero-logo {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
  }

  .connect-hero {
    min-height: auto;
    padding: var(--space-xl) var(--space-lg);
  }
}

/* --- Large screens (1400px+) --- */
@media (min-width: 1400px) {
  .container,
  .nodes-container,
  .nav-inner,
  .footer-inner {
    max-width: 1400px;
  }

  .node-card {
    grid-template-columns: 350px 1fr;
  }

  .node-card:nth-child(even) {
    grid-template-columns: 1fr 350px;
  }

  .node-viewer {
    width: 350px;
    height: 350px;
  }
}

/* --- Reduce motion for accessibility --- */
@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;
  }

  .hero-logo {
    animation: none;
  }

  .server-ip-box {
    animation: none;
  }
}

/* --- Print styles --- */
@media print {
  .main-nav,
  .nav-toggle,
  .node-viewer,
  .hero-logo {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
