/* ========================================
   COMPREHENSIVE MOBILE FIXES
   Import this file LAST in your HTML.
   ======================================== */

/* ---- PREVENT GLOBAL HORIZONTAL SCROLL ---- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
img, picture, video, canvas, svg {
  max-width: 100%;
  display: block;
}

/* ---- TABLET ADJUSTMENTS (1024px) ---- */
@media (max-width: 1024px) {
  .hero-visual { display: none; }
  .hero { padding: 8rem 3rem 4rem; gap: 0; }
}

/* ---- TABLETS & LARGE PHONES (900px) ---- */
@media (max-width: 900px) {
  section { padding: 4rem 1.5rem; }

  .hero {
    flex-direction: column;
    padding: 7rem 1.5rem 4rem;
    min-height: auto;
    gap: 2rem;
  }
  .hero-visual { display: none; }
  .hero-content { max-width: 100%; }

  .about-grid,
  .contact-wrapper {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { gap: 0.75rem; }
  .project-card { min-width: calc(50vw - 2rem); }

  .timeline::before { left: 20px; }
  .timeline-item,
  .timeline-item:nth-child(odd) {
    flex-direction: row;
    justify-content: flex-start;
  }
  .timeline-content {
    width: calc(100% - 60px);
    margin-left: 40px;
  }
  .timeline-dot { left: 20px; transform: none; }

  footer {
    padding: 1.5rem;
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
}

/* ---- PHONES (768px) ---- */
@media (max-width: 768px) {
  .hero-title {
    font-size: clamp(2rem, 12vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
  }
  .hero-sub {
    font-size: 0.95rem;
    max-width: 100%;
  }
  .hero-role-wrapper {
    display: block;
    font-size: 1.1rem;
    min-height: 3.5rem;
  }
  .hero-role-label {
    display: inline;
    margin-right: 0.25em;
  }
  .hero-role-rotate {
    display: inline;
    height: auto;
  }
  .role-text {
    display: inline-block;
    position: relative;
    transform: none !important;
    opacity: 1 !important;
    transition: none;
  }
  .role-text.active { font-weight: 700; }
  .role-text:not(.active) { display: none; }

  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card { min-width: calc(100vw - 3rem); padding: 1.5rem; }
  .projects-arrow { display: none; }
  .timeline-content { padding: 1rem; }
  .scroll-indicator { display: none; }
}

/* ---- SMALL PHONES (480px) ---- */
@media (max-width: 480px) {
  section { padding: 3rem 1rem; }
  h2 { font-size: clamp(1.75rem, 7vw, 2.5rem); }

  .hero { padding: 6.5rem 1rem 3rem; }
  .hero-title { font-size: 2.25rem; }
  .hero-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    margin-bottom: 1.5rem;
  }
  .hero-sub {
    font-size: 0.9rem;
    margin-bottom: 2rem;
  }
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  .btn-grad, .btn-outline {
    width: 100% !important;
    justify-content: center;
  }
  .hero-stack {
    margin-top: 2rem;
    gap: 1rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .stack-chips { gap: 6px; }
  .chip { padding: 0.2rem 0.6rem; font-size: 0.7rem; }
  .scroll-indicator { display: none; }

  .about-stats { grid-template-columns: 1fr; }
  .stat-card { padding: 1.5rem; }
  .stat-num { font-size: 2.25rem; }

  .skills-grid { grid-template-columns: 1fr; }
  .skill-card { padding: 1.5rem; }
  .skill-name { font-size: 0.95rem; }

  .project-card { padding: 1rem; }
  .project-title { font-size: 1.1rem; }
  .project-desc { font-size: 0.85rem; }
  .project-tags { margin-bottom: 1rem; }
  .project-links { flex-wrap: wrap; gap: 0.75rem; }
  .project-img-wrap { aspect-ratio: 16 / 10; margin-bottom: 0.75rem; }

  .testimonials-orbs { display: none; }
  .sprocket { height: 8px; background-size: 16px 8px; margin: 0.3rem 0; }
  .test-card { padding: 1.5rem 1rem; }
  .test-card-bg-quote { font-size: 6rem; }
  .test-card-text {
    font-size: 0.95rem;
    line-height: 1.65;
  }
  .test-card-avatar { width: 44px; height: 44px; font-size: 1rem; }
  .test-card-avatar::before { inset: -2px; }
  .test-card-info h4 { font-size: 0.85rem; }
  .test-card-info p { font-size: 0.75rem; }
  .test-arrow { width: 36px; height: 36px; font-size: 1rem; }
  .test-footer { gap: 1rem; }

  .timeline::before { display: none; }
  .timeline-item,
  .timeline-item:nth-child(odd) {
    flex-direction: column !important;
    margin-bottom: 2rem;
  }
  .timeline-content {
    width: 100%;
    margin-left: 0;
    padding: 1.25rem;
    border-left: 3px solid var(--purple);
    border-radius: var(--radius-sm);
  }
  .timeline-content:hover { transform: translateX(4px) !important; }
  .timeline-dot { display: none; }
  .timeline-year { font-size: 0.7rem; }
  .timeline-title { font-size: 1rem; }
  .timeline-desc { font-size: 0.82rem; }

  .contact-wrapper { gap: 2rem; }
  .contact-right { padding: 1.5rem; }
  .contact-left p { font-size: 0.95rem; }
  .social-link { padding: 0.85rem 1rem; font-size: 0.85rem; }
  .social-sub { font-size: 0.75rem; }
  .form-group input,
  .form-group textarea { padding: 0.6rem 0.85rem; font-size: 0.9rem; }
  .form-submit { padding: 0.75rem; font-size: 0.9rem; }

  .footer-copy { font-size: 0.8rem; }
  .footer-links { gap: 0.75rem; }
  .footer-link { font-size: 0.8rem; }
  .scroll-top {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    bottom: 1rem;
    right: 1rem;
  }

  nav { padding: 0.85rem 1rem; }
  .nav-logo { font-size: 1.15rem; }
}

/* ---- VERY SMALL PHONES (360px) ---- */
@media (max-width: 360px) {
  .hero-title { font-size: 2rem; }
  .hero-actions { gap: 0.75rem; }
  .btn-grad, .btn-outline {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
  }
  .about-grid { gap: 2rem; }
  .stat-card { padding: 1rem; }
  .stat-num { font-size: 1.75rem; }
  .timeline-content { padding: 1rem; }
  .project-card { padding: 0.85rem; min-width: calc(100vw - 1.7rem); }
  .test-card { padding: 1rem 0.75rem; }
  .test-card-bg-quote { display: none; }
  .test-arrow { width: 32px; height: 32px; font-size: 0.875rem; }
  .contact-right { padding: 1.25rem; }
}
