html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 767px) {
  .project-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .project-subtitle {
    font-size: clamp(1.25rem, 6vw, 1.8rem) !important;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .modal-title {
    font-size: clamp(1.8rem, 9vw, 3rem) !important;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
}

/* Collapse navbar earlier so desktop zoom (150-175%) doesn't cause wrapped header rows. */
@media (max-width: 1200px) {
  .navbar-header {
    float: none;
  }

  .navbar-left,
  .navbar-right {
    float: none !important;
  }

  .navbar-toggle {
    display: block;
  }

  .navbar-collapse {
    border-top: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .navbar-collapse.collapse {
    display: none !important;
  }

  .navbar-nav {
    float: none !important;
    margin: 7.5px -15px;
    letter-spacing: 0;
  }

  .navbar-nav > li {
    float: none;
  }

  .navbar-nav > li > a {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .navbar-collapse.collapse.in {
    display: block !important;
  }

  .navbar-custom {
    padding: 10px 0 !important;
  }

  .navbar-custom .navbar-brand {
    font-size: 1.5em !important;
  }
}

/* 1440p tuning: scale layout and typography to keep the same visual weight as 1080p. */
@media (min-width: 1440px) {
  .container {
    width: min(90vw, 1360px);
  }

  .navbar-custom .navbar-brand {
    font-size: 2.25em;
  }

  .navbar-custom .navbar-nav li a {
    font-size: 1.1em;
  }

  header .container {
    padding-top: 240px;
    padding-bottom: 130px;
  }

  header .intro-text .name {
    font-size: 5.5em;
  }

  header .intro-text .skills {
    font-size: 2em;
  }

  .profile-image,
  .circle_300px,
  .switch-place {
    width: 340px;
    height: 340px;
  }

  .switch-place {
    top: -365px;
    margin-bottom: -340px;
    border-radius: 340px;
  }

  section {
    padding: 120px 0;
  }

  section h2 {
    font-size: 3.5em;
  }

  .project-title {
    font-size: clamp(3.5rem, 4vw, 5.5rem) !important;
    line-height: 1.15;
  }

  .project-subtitle {
    font-size: clamp(1.9rem, 2vw, 2.8rem) !important;
    line-height: 1.25;
  }

  #projects .projects-item .projects-link {
    max-width: 460px;
  }

  .card {
    padding: 28px;
  }
}

/* 4K tuning: further upscale so composition matches lower-resolution proportions. */
@media (min-width: 2160px) {
  .container {
    width: min(88vw, 1680px);
  }

  .navbar-custom .navbar-brand {
    font-size: 2.6em;
  }

  .navbar-custom .navbar-nav li a {
    font-size: 1.25em;
  }

  header .container {
    padding-top: 280px;
    padding-bottom: 160px;
  }

  header .intro-text .name {
    font-size: 6.5em;
  }

  header .intro-text .skills {
    font-size: 2.4em;
  }

  .profile-image,
  .circle_300px,
  .switch-place {
    width: 400px;
    height: 400px;
  }

  .switch-place {
    top: -425px;
    margin-bottom: -400px;
    border-radius: 400px;
  }

  section {
    padding: 140px 0;
  }

  section h2 {
    font-size: 4em;
  }

  .project-title {
    font-size: clamp(4rem, 3.5vw, 6.2rem) !important;
    line-height: 1.15;
  }

  .project-subtitle {
    font-size: clamp(2.2rem, 1.8vw, 3.2rem) !important;
    line-height: 1.25;
  }

  #projects .projects-item .projects-link {
    max-width: 520px;
  }

  .card {
    padding: 34px;
  }
}
