/* ========================================== */
/* 1. EXTRA LARGE SCREENS*/
/* ========================================== */

@media screen and (max-width: 1600px) {
  .up-arrow {
    display: none;
  }

  .arrow {
    display: none;
  }
}

@media screen and (max-width: 1400px) {
  body {
    margin: 0 5rem;
  }

  .up-arrow {
    display: none;
  }

  .arrow {
    display: none;
  }
}

/* ========================================== */
/* 2. SMALL LAPTOPS & LARGE TABLETS (1200px)  */
/* ========================================== */
@media screen and (max-width: 1200px) {
  #desktop-nav {
    display: none;
  }
  #hamburger-nav {
    display: flex;
  }

  #profile,
  .about-content-wrapper {
    display: block;
  }
  section,
  .about-content-wrapper {
    height: fit-content;
  }
  section {
    margin: 0 5%;
  }

  .profile-image-wrapper,
  .about-image-wrapper {
    width: 275px;
    height: 275px;
  }

  .profile-image-wrapper
  {
    margin: 0 auto 2rem;
  }

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

  /* FIX: Prevent skills/about cards from overlapping when they stack to 1 column */
  .info-card {
    height: fit-content;
    min-height: 250px;
    padding: 2rem 1.5rem;
  }

  .up-arrow {
    display: none;
  }

  .arrow {
    display: none;
  }
}

/* ========================================== */
/* 3. TABLETS - LANDSCAPE (1024px)            */
/* ========================================== */
@media screen and (max-width: 1024px) {
  .section-title {
    font-size: 2.5rem;
  }
  .card-title {
    font-size: 1.5rem;
  }

  .project-card {
    width: 30vh;
  }

  /* FIX: Stop long titles from breaking out of cards on smaller desktop/tablet screens */
  .project-title {
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    margin: 0.5rem;
  }

  /* FIX: Give the modal a bit more room to breathe on tablets */
  .project-details-expanded {
    width: 80%;
  }
}

/* ========================================== */
/* 4. TABLETS PORTRAIT & LARGE PHONES (768px) */
/* ========================================== */
@media screen and (max-width: 768px) {
  /* Carousel fixes */
  .carousel-viewport {
    overflow: hidden;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .carousel-track {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  /* FIX: Scale cards down and tame the hover zoom */
  .project-card {
    width: 75vw;
    max-width: 350px;
    height: auto;
    padding-bottom: 2rem;
  }
  .project-card.active {
    transform: scale(1.05);
  }
  .project-card:not(.active) {
    transform: scale(0.9);
  }

  /* FIX: Stop project buttons from stacking into a tall tower on tablets */
  .project-card .btn-container {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .project-card .btn {
    width: auto;
    padding: 0.5rem 1rem;
    flex: 1;
    font-size: 0.95rem;
  }

  /* FIX: Further widen the modal and scale the inner images for portrait tablets */
  .project-details-expanded {
    width: 90%;
  }
  .project-expanded-img {
    width: 100%;
    height: 300px;
    border-radius: 0.5rem;
  }

  .project-image-wrapper {
    height: 280px;
  }

  .close-icon {
    right: 0px;
    top: -45px;
  }

  .carousel-controls {
    display: none;
  }
  .carousel-navigation-dots {
    margin-top: 10px;
  }
}

/* ========================================== */
/* 5. STANDARD MOBILE PHONES (600px)          */
/* ========================================== */
@media screen and (max-width: 600px) {
  /* Claim back screen space */
  html {
    scroll-snap-type: none;
  }
  body {
    margin: 0 1.5rem;
  }
  section {
    margin: 0;
  }
  #profile {
    height: 90vh;
    margin-bottom: 0;
  }

  /* Text adjustments */
  .section-title {
    font-size: 2rem;
  }
  .profile-role {
    font-size: 1.25rem;
  }
  .text-container {
    text-align: justify;
  }
  .skill-item {
    font-size: 1rem;
  }
  .project-title {
    font-size: 1.25rem;
  } /* Slightly smaller for mobile */

  /* Hide bouncy arrows */
  .arrow,
  .up-arrow {
    display: none;
  }

  /* General Flex Wrapping */
  .about-cards-wrapper,
  .contact-box,
  .btn-container {
    flex-wrap: wrap;
  }

  .contact-box {
    gap: 0;
    margin-top: 0;
  }

  /* Stack the main profile buttons (but NOT the project buttons, those cascade from 768px!) */
  .btn-container {
    flex-direction: column;
    align-items: center;
  }

  /* Center footer nav on small screens */
  footer .nav {
    height: fit-content;
    margin-bottom: 2rem;
  }
  footer .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    font-size: 1rem;
    padding-left: 0;
  }

  /* FIX: Extreme mobile squishing for images and modal */
  .project-image-wrapper {
    height: 250px;
  }

  .project-details-expanded {
    width: 95%;
  }
  .modal-inner-content {
    padding: 1.5rem 1rem;
  }
  .project-expanded-img {
    height: 180px;
  }
}

/* ========================================== */
/* 6. EXTRA SMALL PHONES (480px)              */
/* ========================================== */
@media screen and (max-width: 480px) {
  .profile-image-wrapper,
  .about-image-wrapper {
    width: 200px;
    height: 200px;
  }

  .project-card {
    width: 70vw; /* CHANGED: Widened from 55vw so your titles have enough room to read clearly */
  }

  .project-card {
    width: 55vw;
  }

  nav {
    height: 8vh;
  }
  .nav-links {
    font-size: 1.2rem;
  }
  .logo {
    font-size: 1.5rem;
  }
}
