/* =========================================================
   Responsive breakpoints
   ========================================================= */

/* Tablet / small desktop ---------------------------------- */
@media screen and (max-width: 1024px) {
  #main-nav {
    display: none;
  }

  #hamburger-nav {
    display: flex;
  }

  #hamburger-nav .logo-img {
    height: 42px;
  }

  section {
    padding: 5rem 1.5rem;
  }

  /* Hero stays stacked and centres up */
  #profile {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    min-height: auto;
    padding-top: 3rem;
    text-align: center;
  }

  #profile .section__text,
  #profile .section__text__p1,
  #profile .title {
    text-align: center;
  }

  #profile .section__text {
    order: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #profile .hero-lead {
    margin-left: auto;
    margin-right: auto;
  }

  /* banner after the text, same as desktop: it carries the name
     itself, so it reads badly stacked right on top of the heading */
  #profile .section__pic-container {
    order: 2;
  }

  #profile .btn-container,
  #socials-container {
    justify-content: center;
  }

  /* About */
  .section-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    justify-items: center;
  }

  #about .section__pic-container {
    position: static;
  }

  #about .about-pic {
    max-width: 320px;
  }

  .about-details-container {
    width: 100%;
  }

  /* Skills two-column block -> single column */
  .experience-details-container .about-containers {
    grid-template-columns: 1fr;
  }

  /* Featured projects stack: media first for both directions.
     Repeats the data-media attribute so the stacked layout still
     outranks the per-shape column split from style.css. */
  .project-feature,
  .project-feature.reverse,
  .project-feature[data-media="portrait"],
  .project-feature[data-media="portrait"].reverse,
  .project-feature[data-media="landscape"],
  .project-feature[data-media="landscape"].reverse {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .project-feature.reverse .project-feature-media,
  .project-feature .project-feature-media {
    order: 0;
  }

  .project-feature-body {
    text-align: center;
  }

  .project-feature .project-title,
  .project-desc {
    text-align: center;
  }

  .project-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .project-feature .project-tags,
  .project-feature .project-actions {
    justify-content: center;
  }

  /* Arrows have no hover on touch, so keep them visible once stacked */
  .slider-btn {
    opacity: 1;
    transform: translate(0, -50%);
  }

  /* Secondary project grid -> two up */
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .contact-media {
    order: 2;
  }
}

/* Phones -------------------------------------------------- */
@media screen and (max-width: 600px) {
  section {
    padding: 4rem 1.25rem;
  }

  .title {
    margin-bottom: 2.5rem;
  }

  #profile .title {
    font-size: clamp(2.5rem, 12vw, 3.2rem);
  }

  /* About cards single column */
  .about-containers {
    grid-template-columns: 1fr;
  }

  /* Skill articles single column */
  #experience .article-container {
    grid-template-columns: 1fr;
  }

  #experience .details-container {
    padding: 1.5rem;
  }

  /* Slider frames stay edge to edge; only the portrait cap moves */
  .project-slider[data-orientation="portrait"] {
    --frame-max: 252px;
  }

  .slider-btn {
    width: 34px;
    height: 34px;
  }

  /* Secondary project grid single column */
  .project-grid {
    grid-template-columns: 1fr;
  }

  .contact-form-container {
    padding: 1.6rem 1.3rem;
  }

  .form-submit-btn {
    align-self: stretch;
    text-align: center;
  }

  .btn-container {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .btn-container .btn,
  .cv-dropdown,
  .cv-dropdown-btn {
    width: 100%;
  }

  .cv-dropdown-btn {
    min-width: 0;
  }

  .tech-set {
    gap: 2.5rem;
  }

  .tech-set img {
    height: 28px;
  }
}

/* Mobile slide-in menu drawer ----------------------------- */
@media screen and (max-width: 1024px) {
  .menu-links {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 84vw;
    max-width: 340px;
    height: auto;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 0 0.5rem;
    border-radius: 0 0 0 22px;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    background: var(--bg-elev);
    transform: translateX(100%);
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: transform 0.42s var(--ease);
    z-index: 9999;
  }

  .menu-links.open {
    transform: translateX(0);
    max-height: 100dvh;
    padding: 0 0 0.5rem;
  }

  /* drawer header label (sits top-left, opposite the close button) */
  .menu-links::before {
    content: "MENU";
    order: -1;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: var(--muted-color);
    padding: 1.5rem 1.6rem 1.1rem;
  }

  .menu-links .menu-close {
    position: absolute;
    top: 0.95rem;
    right: 1rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 50%;
    background: var(--bg-subtle);
    color: var(--muted-color);
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s var(--ease), color 0.2s var(--ease),
      transform 0.3s var(--ease);
  }

  .menu-links .menu-close:hover {
    background: var(--accent-tint);
    color: var(--accent-strong);
    transform: rotate(90deg);
  }

  .menu-links li {
    list-style: none;
  }

  .menu-links li + li {
    border-top: 1px solid var(--border-color);
  }

  .menu-links li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    text-align: left;
    padding: 1rem 1.6rem;
    color: var(--text-color);
    transition: background 0.2s var(--ease), color 0.2s var(--ease),
      padding-left 0.2s var(--ease);
  }

  .menu-links li a::after {
    content: "\203A";
    font-size: 1.3rem;
    color: var(--muted-color);
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
      color 0.2s var(--ease);
  }

  .menu-links li a:hover,
  .menu-links li a:active {
    background: var(--accent-tint);
    color: var(--accent-strong);
    padding-left: 2rem;
  }

  .menu-links li a:hover::after,
  .menu-links li a:active::after {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent-strong);
  }

  /* theme toggle pinned to the bottom as a clean footer row */
  .menu-links .theme-toggle {
    order: 10;
    width: 100%;
    justify-content: space-between;
    gap: 0;
    margin: 0.4rem 0 0;
    padding: 1.1rem 1.6rem;
    border-radius: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-subtle);
  }

  .menu-links .theme-toggle:hover {
    background: var(--accent-tint);
  }

  .hamburger-menu {
    position: static;
  }

  .menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(20, 19, 18, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
  }
}
