/* Tablet breakpoint */
@media (max-width: 1024px) {
  :root {
    --container-max: 900px;
  }

  .nav-menu {
    gap: 1.5rem;
  }

  .projects-layout {
    grid-template-columns: 1fr;
  }

  .github-cta {
    position: static;
    margin-top: 2rem;
  }

  .skills-grid {
    gap: 1rem;
  }

  .skill-category {
    min-width: 160px;
  }

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

/* Mobile breakpoint */
@media (max-width: 640px) {
  :root {
    --container-max: 100%;
    --nav-height: 56px;
  }

  .container {
    padding: 0 1rem;
  }

  .nav-container {
    padding: 0 1rem;
  }

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

  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
  }

  .mobile-menu-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .mobile-menu-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    padding: 1rem;
    gap: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-menu li {
    border-bottom: 1px solid var(--border);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-link {
    display: block;
    padding: 0.75rem 0;
  }

  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
  }

  .mobile-menu-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .mobile-menu-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero {
    padding: calc(var(--nav-height) + 1.5rem) 1rem 1.5rem;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero-subtitle {
    font-size: 0.9375rem;
    padding: 0 1rem;
  }

  .social-links {
    gap: 1rem;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }

  .social-link svg {
    width: 20px;
    height: 20px;
  }

  .cta-buttons {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 280px;
  }

  .btn {
    justify-content: center;
  }

  section {
    padding: 3rem 0;
  }

  .about-section,
  .posts-section,
  .contact-section {
    padding: calc(var(--nav-height) + 3rem) 0 3rem;
  }

  .posts-grid,
  .youtube-grid,
  .latest-posts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .skills-grid {
    flex-direction: column;
    gap: 1.5rem;
  }

  .skill-category {
    min-width: 100%;
  }

  .interests-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .post-full {
    padding: calc(var(--nav-height) + 1rem) 1rem 3rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-content h2 {
    font-size: 1.375rem;
  }

  .post-content h3 {
    font-size: 1.125rem;
  }

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

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

  .ai-roast-widget {
    width: calc(100% - 3rem);
    left: 1.5rem;
    right: 1.5rem;
    top: auto;
    bottom: 4rem;
    transform: translateY(1rem);
  }

  .ai-roast-widget.visible {
    transform: translateY(0);
  }

  .ai-roast-widget::before {
    display: none;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.875rem;
  }

  .section-title {
    font-size: 1.25rem;
  }
}

/* Print styles */
@media print {
  .navbar,
  .social-links,
  .cta-buttons,
  .footer,
  .game-canvas,
  .reading-progress-top,
  .reading-progress-ring,
  .reading-progress-mobile,
  .ai-roast-widget,
  .back-to-top {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* Touch devices - disable hover effects */
@media (hover: none) {
  .card:hover,
  .post-card:hover,
  .video-card:hover,
  .project-item:hover,
  .social-link:hover,
  .btn:hover,
  .hover-lift:hover {
    transform: none;
    box-shadow: none;
  }

  .nav-link::after {
    display: none;
  }

  pre:hover .copy-button {
    opacity: 0;
  }
}

/* Large screens */
@media (min-width: 1440px) {
  :root {
    --container-max: 1400px;
  }

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

  .posts-grid,
  .youtube-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
