/* Tablet devices (max-width: 768px) */
@media screen and (max-width: 768px) {
  html {
    --nav-offset: 92px;
    --section-pad-y: clamp(2.25rem, 9vw, 3.2rem);
  }

  .navbar {
    display: none;
  }

  .menubar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(95%, 980px);
    height: 4.5rem;
    padding: 0 24px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
    box-shadow: 0 14px 35px rgba(2, 6, 23, 0.14);
    z-index: 1000;
  }

  .logo {
    position: static;
    font-size: 1.1rem;
    font-weight: 600;
  }

  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.6rem;
    background: none;
    border: none;
    color: #0f172a;
    padding: 0;
  }

  #toggle-menu {
    display: none;
  }

  .menu {
    display: none;
    position: fixed;
    top: calc(16px + 4.5rem + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: min(95%, 980px);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1rem 0;
    z-index: 999;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
    max-height: calc(100vh - (16px + 4.5rem + 24px));
    overflow-y: auto;
  }

  .menu-links {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .menu-links li {
    margin: 0;
    padding: 0;
  }

  #toggle-menu:checked~.menu {
    display: flex;
  }

  .menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: #0f172a;
    font-weight: 500;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s ease;
  }

  .menu a:hover {
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
  }

  .off-menu {
    display: none;
    position: fixed;
    inset: 0;
    background-color: transparent;
    z-index: 998;
  }

  #toggle-menu:checked~.off-menu {
    display: block;
  }

  .navlinks {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 0.8rem;
    padding-bottom: 2px;
    white-space: nowrap;
  }

  section {
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    padding: var(--section-pad-y) 1.1rem;
    margin-top: 0;
    position: relative;
    gap: 1.5rem;
  }

  .profile {
    flex-direction: column;
    justify-content: center;
    gap: 1.8rem;
    min-height: auto;
    padding: 2rem 1.2rem;
  }

  .profile .profile-pic1 {
    height: 18rem;
    width: 15.5rem;
    border-radius: 36% 64% 48% 52% / 42% 38% 62% 58%;
    outline-offset: 8px;
    margin-bottom: 1rem;
  }

  .profile-section-text {
    padding: 0;
    height: auto;
    width: 100%;
    max-width: 560px;
    align-items: center;
    text-align: center;
  }

  .profile-lead {
    max-width: 36ch;
    font-size: 0.97rem;
    line-height: 1.7;
  }

  .skill-marquee {
    width: 100%;
  }

  .skill-marquee-track {
    animation-duration: 18s;
  }

  .about-container {
    margin-top: 12px;
    flex-direction: column;
    gap: 1.8rem;
    height: auto;
    padding: 1rem;
  }

  .profile-pic2 {
    height: 280px;
    width: 280px;
  }

  .about-right-box {
    width: 100%;
  }

  .about-info {
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
  }

  .info-box {
    width: 100%;
  }

  .dashboard-cards {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 0 1.1rem;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .stat-card {
    text-align: left;
    min-height: 0;
    padding: 1.4rem 1.2rem;
  }

  .card,
  .projects .cards-container .card,
  .certifications .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .projects .cards-container,
  .certifications .cards-container {
    margin-top: 28px;
  }

  .projects .cards-container .card:hover {
    transform: none;
  }

  .skills-grid {
    width: 100%;
    padding: 0 1.1rem;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .skill-card {
    padding: 1.25rem;
    border-radius: 18px;
  }

  .cards-container {
    top: 0;
    flex-direction: column;
    height: auto;
    align-items: center;
    overflow: visible;
  }

  .contact-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.25rem;
    margin-top: 24px;
    margin-bottom: 10px;
  }

  .contact-form {
    padding: 1.5rem;
  }

  .form-buttons {
    flex-direction: column;
  }

  .btn-submit,
  .btn-reset {
    width: 100%;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  footer {
    padding: 2.4rem 1.5rem;
  }

  .resume-header {
    padding: 14px 12px;
  }
}

/* Card grid responsive breakpoints (4 -> 3 -> 2 -> 1) */
@media screen and (max-width: 1280px) {
  .cards-container {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 20px;
    padding: 18px;
  }
}

@media screen and (max-width: 1024px) {
  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .stat-card {
    min-height: 160px;
  }

  .cards-container {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 18px;
    padding: 16px;
  }

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skill-card {
    padding: 1.35rem;
  }
}

@media screen and (max-width: 800px) {
  .cards-container {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 16px;
    padding: 14px;
  }

  .projects .cards-container .card {
    max-width: 100%;
    min-height: 390px;
  }

  .projects .card .project-description {
    -webkit-line-clamp: 3;
    min-height: 4.9rem;
  }

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

@media screen and (max-width: 480px) {
  .cards-container {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .cards-container .card img {
    height: 180px;
  }

  .skill-card {
    padding: 1.05rem;
    gap: 0.72rem;
  }

  .skill-title {
    font-size: 1rem;
  }

  .skill-tag {
    font-size: 0.78rem;
    padding: 0.35rem 0.62rem;
  }

  .projects .cards-container .card {
    min-height: 360px;
  }

  .stat-label {
    font-size: 0.74rem;
  }

  .stat-card h2 {
    font-size: 1.2rem;
  }

  #problems-solved-total,
  #projects-count,
  #certifications-count {
    font-size: 1.95rem;
  }

  .projects .card .btn-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .projects .card .btn-container .btn-one,
  .projects .card .btn-container .btn-two {
    width: 100%;
    font-size: 0.8rem;
  }
}

/* Mobile devices (max-width: 480px) */
@media screen and (max-width: 480px) {
  html {
    --nav-offset: 76px;
    --section-pad-y: 2rem;
  }

  .menubar {
    height: 3.25rem;
    padding: 0 0.8rem;
  }

  .logo {
    font-size: 0.95rem;
  }

  .hamburger {
    font-size: 1.5rem;
  }

  .menu {
    top: calc(16px + 3.25rem + 8px);
  }

  .off-menu {
    top: calc(16px + 3.25rem + 8px);
    height: calc(100vh - (16px + 3.25rem + 8px));
  }

  .profile {
    padding: 1.35rem 1rem;
  }

  .profile .profile-pic1 {
    height: 15.5rem;
    width: 13.5rem;
    border-radius: 36% 64% 48% 52% / 42% 38% 62% 58%;
    outline-offset: 6px;
  }

  .profile-section-text {
    padding: 1.5rem 1.15rem;
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: 24px;
  }

  .profile-lead {
    max-width: 100%;
    font-size: 0.93rem;
    line-height: 1.65;
  }

  .dashboard-cards,
  .skills-grid,
  .cards-container {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .profile-section-text .title {
    font-size: 1.8rem;
  }

  .btn-container .btn-one,
  .btn-container .btn-two {
    width: auto;
    min-width: 8rem;
    padding: 0.72rem 0.95rem;
    font-size: 0.78rem;
  }

  .section-text .title {
    font-size: 1.5rem;
  }

  .section-text .text-p1 {
    font-size: 14px;
  }

  .about {
    min-height: auto;
  }

  .about .profile-pic2 {
    height: 200px;
    width: 200px;
  }

  .about-right-box {
    width: 95%;
  }

  .info-box {
    width: 90%;
    padding: 0.8rem;
  }

  .about-paragraph {
    padding: 1rem;
    font-size: 14px;
  }

  .contact .contact-details {
    font-size: 16px;
    padding: 1rem;
    width: 100%;
    margin-top: 80px;
  }

  .contact img {
    height: 25px;
    width: 25px;
  }

  .contact-footer {
    font-size: 14px;
    text-align: center;
    padding: 0 1rem;
  }


  .contact-form h3 {
    font-size: 1.1rem;
  }

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

  .btn-submit,
  .btn-reset {
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
  }

  .footer-section h4 {
    font-size: 0.9rem;
  }

  .footer-section a {
    font-size: 0.85rem;
  }

}
