@media screen and (max-width: 1024px) {
  .container {
    width: 100%;
    padding: 50px 30px;
  }

  .nav-container {
    width: 100%;
    padding: 0 40px;
  }

  #about .section-title {
    margin-top: 1rem;
  }

  .hero-content {
    width: 100%;
    max-width: none;
    padding: 0 30px;
  }

  .section {
    padding: 10px 0;
  }

  .section-title {
    margin-bottom: 2rem;
  }

  #projects .section-title {
    margin-bottom: 6.5rem;
    margin-top: 1rem;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
  }

  .timeline-item {
    padding-left: 60px;
  }

  .contact-content {
    flex-direction: column;
    gap: 2rem;
  }

  .skills-list {
    min-width: unset;
    max-width: unset;
  }

  .skills-widget .skills-tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .carousel-controls {
    display: none !important;
  }

  .carousel-counter {
    display: none !important;
  }

  .project-carousel-3d {
    touch-action: pan-y;
    padding: 50px 20px;
    transform: translateY(-40px);
  }

  .project-carousel-3d .carousel-card > div:last-child {
    min-height: 400px;
    height: 400px;
    display: flex;
    flex-direction: column;
  }

  .project-carousel-3d.dragging {
    cursor: grabbing;
  }

  .project-carousel-3d.dragging * {
    pointer-events: none;
  }

  /* Move the "View Code" button to bottom and fix header layout */
  .project-carousel-3d
    .carousel-card
    div[style*="display: flex; justify-content: space-between"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  /* Position the GitHub link at the bottom */
  .project-carousel-3d .carousel-card a[href*="github"] {
    order: 10;
    align-self: center;
    margin-top: auto;
  }

  #projects .container {
    padding: 0 0 50px 0;
  }
}

@media screen and (max-width: 768px) {
  .nav-menu {
    position: fixed;
    left: -100%;
    top: 70px;
    flex-direction: column;
    background-color: white;
    width: 100%;
    text-align: center;
    transition: 0.15s;
    box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
    padding: 2rem 0;
    z-index: 999;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-toggle {
    display: flex;
  }

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

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

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .about-content {
    grid-template-columns: 1fr;
    text-align: center;
    flex-direction: column;
  }

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

  .timeline::after {
    left: 31px;
  }

  .timeline-item {
    width: 100%;
    padding-left: 50px;
    padding-right: 15px;
  }

  .timeline-item:nth-child(even) {
    left: 0%;
  }

  .timeline-marker {
    left: 15px !important;
    width: 12px;
    height: 12px;
  }

  .timeline::after {
    left: 21px;
    width: 2px;
  }

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

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

  .container {
    width: 100%;
    padding: 20px;
  }

  .nav-container {
    width: 100%;
    padding: 0 28px;
  }

  .hero-content {
    width: 100%;
    max-width: none;
    padding: 20px;
  }

  .timeline {
    width: 100%;
    max-width: none;
    padding: 0 15px;
  }

  .footer {
    padding: 1.5rem 0;
  }

  .footer .container {
    padding: 0 15px;
  }

  .hero h1 {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  .hero .subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .hero-buttons {
    gap: 1rem;
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 250px;
    justify-content: center;
  }

  .skills-widget .skills-tabs {
    justify-content: center;
    gap: 0.3rem;
  }

  .skills-widget .skill-tab {
    flex: 1;
    min-width: 80px;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  .skills-widget .skills-list {
    justify-content: center;
  }

  .skill-badge {
    font-size: 0.8rem !important;
    padding: 0.5rem 1rem !important;
  }

  .timeline-item .content h3 {
    font-size: 1.3rem;
  }

  .timeline-item .content p {
    font-size: 0.95rem;
  }

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

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

  .project-card {
    margin-bottom: 1rem;
  }

  .contact-form {
    padding: 1rem;
  }

  .footer {
    padding: 1rem 0;
  }

  .footer .container {
    padding: 0 10px;
  }

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

  .container,
  .nav-container,
  .hero-content,
  .section {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .form-group input,
  .form-group textarea {
    font-size: 14px;
  }
}
