/** CSS Layout: Section Layouts, Grid Systems, Flex Utilities, Responsive Breakpoints */

/* ==========================================================================
   Section Layout
   ========================================================================== */
section {
  padding: 6rem 2rem;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  scroll-margin-top: 4rem;
}

/* ==========================================================================
   Grid Layouts
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

/* ==========================================================================
   Flex Layouts
   ========================================================================== */
.contact-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.hero-btns {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-left: 1.2rem;
  opacity: 0;
  animation: fadeUp 0.6s 1.8s ease forwards;
}

/* ==========================================================================
   Container Patterns
   ========================================================================== */
.term-body {
  padding: 1.5rem;
}

.output {
  padding-left: 1.2rem;
  margin-bottom: 1.4rem;
}

/* ==========================================================================
   Responsive Breakpoints (Desktop-first)
   ========================================================================== */

/*
 * Responsive Breakpoints (Desktop-first)
 * - Desktop: default (1024px+)
 * - Tablet: max-width 1024px
 * - Mobile: max-width 640px
 * - Minimum: max-width 375px (iPhone SE)
 */

/* Tablet: max-width 1024px */
@media (max-width: 1024px) {
  section {
    max-width: 760px;
    padding: 5rem 1.5rem;
  }

  /* Projects - 2 columns but tighter */
  .projects-grid {
    gap: 0.875rem;
  }

  /* Navigation adjustments */
  .nav-links {
    gap: 1.5rem;
  }

  /* Slightly smaller ASCII art */
  .ascii {
    font-size: clamp(0.35rem, 1.5vw, 0.6rem);
  }
}

/* Mobile: max-width 640px */
@media (max-width: 640px) {
  /* Navigation */
  .nav {
    padding: 0.6rem 0.75rem;
  }

  .nav-logo {
    font-size: 0.8rem;
  }

  .nav-links {
    gap: 0.5rem;
  }

  /* Hide navigation links on mobile - use command palette instead */
  .nav-links a {
    display: none !important;
  }

  /* Show only command palette button on mobile */
  .nav-links .kbd-hint {
    display: flex !important;
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
  }

  /* Mobile text for command palette hint */
  .kbd-hint .kbd-hint-desktop {
    display: none !important;
  }

  .kbd-hint .kbd-hint-mobile {
    display: block !important;
  }

  /* Keep theme toggle accessible on mobile */
  .nav-links .theme-toggle {
    display: flex !important;
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
  }

  /* Sections */
  section {
    padding: 4rem 1rem;
  }

  /* Projects grid - stack to single column */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Blog post mobile improvements */
  .blog-post {
    padding-top: 5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .blog-post-title {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .blog-post-meta {
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
  }

  .blog-post-content {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .blog-post-content h2 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    color: var(--accent2);
  }

  .blog-post-content p {
    margin-bottom: 1rem;
  }

  .blog-post-content code {
    font-size: 0.8em;
    word-break: break-word;
  }

  .blog-post-content pre {
    padding: 0.75rem;
    font-size: 0.75rem;
  }

  .blog-post-content ul,
  .blog-post-content ol {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
  }

  .blog-post-tags {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .blog-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  .blog-post-nav {
    flex-direction: column;
    gap: 0.75rem;
  }

  .blog-post-nav .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Hide ASCII art on small screens */
  .ascii,
  .ascii-webgl {
    display: none;
  }

  /* Adjust hero for mobile */
  #hero {
    min-height: auto;
    padding-top: 4rem;
    padding-bottom: 3rem;
  }

  /* Smaller hero buttons - full width */
  .hero-btns {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding-left: 1.2rem;
  }

  .cli-btn {
    width: 100%;
    text-align: center;
    min-height: 44px;
  }

  /* Adjust terminal font size */
  .term-body {
    padding: 1rem;
  }

  .output {
    padding-left: 0.75rem;
  }

  .output p {
    font-size: 0.9rem;
  }

  /* Contact rows full width with better spacing */
  .contact-grid {
    gap: 0.75rem;
  }

  .contact-row {
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 44px;
  }

  .contact-row .lbl {
    width: auto;
    font-weight: 500;
  }

  /* Project cards adjustments */
  .proj {
    padding: 1rem;
  }

  .proj-name {
    font-size: 0.85rem;
  }

  .proj-desc {
    font-size: 0.85rem;
  }

  /* Ensure text remains readable */
  body {
    font-size: 13px;
    line-height: 1.6;
  }
}

/* Extra small devices: max-width 375px */
@media (max-width: 375px) {
  /* Micro-mobile adjustments */
  .nav-logo {
    font-size: 0.75rem;
  }

  .nav-links {
    gap: 0.5rem;
  }

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

  section {
    padding: 3rem 0.75rem;
  }

  .hero-btns {
    padding-left: 0.75rem;
  }

  /* Ensure touch targets remain accessible */
  .nav-links a,
  .cli-btn,
  .proj-link,
  .contact-row {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Smaller typography */
  body {
    font-size: 12px;
  }

  .proj {
    padding: 0.875rem;
  }

  .proj-name {
    font-size: 0.8rem;
  }

  .proj-desc {
    font-size: 0.8rem;
  }

  .output p {
    font-size: 0.85rem;
  }

  .contact-row .val {
    font-size: 0.75rem;
  }

  /* Project tags wrap better */
  .proj-tags {
    gap: 0.3rem;
  }

  .proj-tag {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
  }
}
