/* FILE: css/responsive.css – Fully responsive, clean, single theme button on mobile */

/* ========== BASE SAFETY ========== */
body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

/* Preloader full coverage */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--preloader-bg, #ffffff);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.preloader-card {
  width: 90%;
  max-width: 400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ========== TABLET & SMALL DESKTOP (max-width: 1024px) ========== */
@media (max-width: 1024px) {
  .hero {
    flex-direction: column-reverse;
    text-align: center;
  }
  .hero-subtitle {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .hero-cta {
    justify-content: center;
  }
  .hero-name {
    font-size: 2.8rem;
  }
  .typing-container {
    justify-content: center;
    font-size: 1.2rem;
  }
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .skill-circles {
    gap: 1rem;
  }
  .skill-circle {
    width: 110px;
    height: 110px;
  }
  .skill-circle svg {
    width: 100px;
    height: 100px;
  }
}

/* ========== MOBILE (max-width: 768px) – with single theme button ========== */
@media (max-width: 768px) {
  /* --- Navbar container --- */
  .nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0 1rem;
  }

  /* Hamburger (rightmost) */
  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1002;
    margin-left: auto;
    order: 2;
  }
  .hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
  }
  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* Theme toggle group – single cycling button */
  .theme-toggle-group {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 4px 12px;
    margin-right: 12px;
    order: 1;
  }
  /* Hide all original theme buttons */
  .theme-toggle-group .theme-btn {
    display: none;
  }
  /* The mobile cycle button (added by JS) */
  .mobile-cycle-btn {
    display: flex !important;
    background: transparent;
    border: none;
    font-size: 1.3rem;
    padding: 0 4px;
    cursor: pointer;
    transition: transform 0.2s;
  }
  .mobile-cycle-btn:active {
    transform: scale(0.9);
  }

  /* Mobile slide-in menu */
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: var(--surface);
    backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.8rem;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    z-index: 1000;
    box-shadow: -5px 0 20px rgba(0,0,0,0.2);
    padding: 2rem;
    margin: 0;
    list-style: none;
  }
  .nav-links.active {
    transform: translateX(0);
  }
  .nav-links a {
    font-size: 1.2rem;
    padding: 0.6rem 1rem;
    width: 100%;
    text-align: center;
    display: block;
  }

  /* Preloader fixes */
  #preloader {
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
  .preloader-card {
    width: 85%;
    max-width: 320px;
    padding: 1.5rem 1rem;
  }
  .preloader-icon {
    font-size: 2.8rem;
  }
  .preloader-label {
    font-size: 0.9rem;
  }
  .preloader-progress-container {
    height: 8px;
  }
  .blast-particle {
    font-size: 1.4rem !important;
  }

  /* Other mobile styles */
  .hero-name {
    font-size: 2rem;
  }
  .typing-container {
    font-size: 1rem;
  }
  .skill-circle {
    width: 85px;
    height: 85px;
  }
  .skill-circle svg {
    width: 76px;
    height: 76px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .stat-number {
    font-size: 1.4rem;
  }
  main {
    padding: 1rem;
  }
  .footer {
    padding: 1rem;
  }
}

/* ========== EXTRA SMALL (max-width: 480px) ========== */
@media (max-width: 480px) {
  .nav-links {
    width: 85%;
  }
  .preloader-card {
    width: 90%;
    padding: 1.2rem 0.8rem;
  }
  .preloader-icon {
    font-size: 2.2rem;
  }
  .blast-particle {
    font-size: 1rem !important;
  }
  .hero-name {
    font-size: 1.6rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
  }
  .project-card .project-image {
    height: 120px;
  }
}