/* TABLET AND MOBILE RESPONSIVE DESIGN */

@media screen and (max-width: 1400px) {
  section {
    padding: 4vh 5rem;
  }
  
  .about-highlights-grid,
  .expertise-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  #about {
    padding: 4vh 5rem;
  }
}

@media screen and (max-width: 1200px) {
  html {
    /* Disable section snap on smaller screens to avoid jumpy behavior */
    scroll-snap-type: none;
    scroll-padding-top: 0;
  }

  #desktop-nav {
    display: none;
  }

  #hamburger-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 12vh;
  }

  section {
    padding: 4vh 3rem;
  }

  .profile-container {
    flex-direction: column;
    gap: 2rem;
  }

  .profile-card {
    width: 300px;
    height: 300px;
  }

  .title {
    font-size: 2.5rem;
  }

  #about {
    padding: 4vh 3rem;
  }

  .about-highlights-grid,
  .expertise-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .about-stats {
    gap: 1.5rem;
  }

  .stat-item {
    min-width: 150px;
  }

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

  /* Projects carousel - show 2 cards */
  .projects-carousel-track {
    --project-card-w: 340px;
    max-width: calc(var(--project-card-w) * 2 + var(--project-gap) + 3rem);
  }

  .projects-carousel-track .project-card {
    width: 340px;
    min-width: 340px;
  }

  /* Testimonials carousel */
  .testimonial-card {
    min-width: 300px;
    max-width: 300px;
    padding: 1.5rem;
  }

  /* Projects grid for projects.html */
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 0 1.5rem;
  }

  .arrow {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  section {
    padding: 3vh 2rem;
    min-height: auto;
  }

  #about {
    padding: 3vh 1.5rem;
  }

  .about-intro-heading {
    font-size: 1.5rem;
  }

  .about-intro-text {
    font-size: 1rem;
  }

  .about-highlights-grid {
    grid-template-columns: 1fr;
  }

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

  .about-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
  }

  .stat-item {
    min-width: calc(50% - 0.5rem);
    flex: 1;
    padding: 1.25rem 1.5rem;
  }

  .highlight-card,
  .expertise-card {
    padding: 1.75rem;
  }

  nav {
    height: 12vh;
  }

  .logo {
    font-size: 1.5rem;
  }

  .logo-carousel {
    width: auto;
    max-width: 100%;
  }

  .logo-title {
    font-size: 1.5rem;
  }

  .title {
    font-size: 2rem;
  }

  .section__text__p1 {
    font-size: 1rem;
  }

  .section__text__p2 {
    font-size: 1.2rem;
  }

  .profile-card {
    width: 250px;
    height: 250px;
  }

  .role-tag {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    margin: 0.3rem;
  }

  .btn-container {
    flex-direction: row;
    gap: 0.8rem;
    margin: 1.5rem auto;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .btn {
    width: auto;
    max-width: 45%;
    flex: 1;
    min-width: 140px;
    justify-content: center;
    align-items: center;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }

  #socials-container {
    flex-direction: column;
    gap: 1rem;
  }

  .social-link {
    justify-content: center;
    width: 100%;
  }

  #about {
    padding: 3vh 2rem;
  }

  .about-intro-heading {
    font-size: 1.5rem;
  }

  .about-intro-text {
    font-size: 1rem;
  }

  .about-stats {
    flex-direction: column;
    gap: 1rem;
  }

  .stat-item {
    min-width: 100%;
  }

  .stat-number {
    font-size: 2rem;
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .skill-card {
    padding: 0.8rem;
  }

  .experience-sub-title {
    font-size: 1.2rem;
  }

  /* Projects carousel - show 1 card on mobile */
  .projects-carousel-track {
    --project-card-w: 320px;
    max-width: calc(var(--project-card-w) + 2rem);
    padding: 1rem;
  }

  .projects-carousel-track .project-card {
    width: 320px;
    min-width: 320px;
  }

  /* Testimonials on mobile */
  .testimonial-card {
    min-width: 280px;
    max-width: 280px;
    padding: 1.25rem;
  }

  .testimonial-modal-content {
    padding: 2rem;
    margin: 1rem;
  }

  .modal-testimonial-header {
    flex-direction: column;
    text-align: center;
  }

  /* Projects grid for projects.html - 1 card on mobile */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }

  .project-image {
    max-height: 200px;
    height: 180px;
  }

  .project-title {
    font-size: 1.3rem;
  }

  .project-content {
    padding: 1rem;
  }

  .project-link {
    width: 100%;
    text-align: center;
  }

  .contact-container {
    padding: 2rem 1.5rem;
  }

  .contact-info-container {
    flex-direction: column;
    gap: 1.5rem;
  }

  .contact-item {
    width: 100%;
    flex-direction: column;
    text-align: center;
  }

  footer {
    padding: 1.5rem 1rem;
  }

  footer .nav-links {
    flex-direction: column;
    gap: 1rem;
  }
}

@media screen and (max-width: 480px) {
  section {
    padding: 2vh 1rem;
  }

  #about {
    padding: 2vh 1rem;
  }

  .about-introduction {
    margin: 1.5rem auto 2rem;
  }

  .about-intro-heading {
    font-size: 1.3rem;
  }

  .about-intro-text {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .about-stats {
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
  }

  .stat-item {
    min-width: 100%;
    padding: 1rem 1.5rem;
  }

  .stat-number {
    font-size: 2rem;
  }

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

  .about-highlights-grid,
  .expertise-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .highlight-card,
  .expertise-card {
    padding: 1.5rem;
  }

  .highlight-icon {
    font-size: 2rem;
  }

  .highlight-title,
  .expertise-title {
    font-size: 1.1rem;
  }

  .highlight-value {
    font-size: 1.5rem;
  }

  .highlight-description,
  .expertise-description {
    font-size: 0.9rem;
  }

  .about-section-heading {
    font-size: 1.5rem;
  }

  .about-expertise {
    margin: 2rem 0;
  }

  nav {
    height: 9vh;
    padding: 0 1rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo-carousel {
    width: auto;
    max-width: 100%;
  }

  .logo-title {
    font-size: 1.2rem;
  }

  .title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
  }

  .profile-card {
    width: 200px;
    height: 200px;
  }

  .role-tag {
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    display: block;
    margin: 0.5rem auto;
  }

  .btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
  }

  .skill-card {
    padding: 0.5rem;
  }

  .project-card {
    margin-bottom: 1rem;
  }

  .project-title {
    font-size: 1.1rem;
  }

  .project-description {
    font-size: 0.9rem;
  }

  .tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
  }

  .project-link {
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
    width: 100%;
    text-align: center;
  }
}

/* LANDSCAPE MODE FOR MOBILE */
@media screen and (max-height: 600px) and (orientation: landscape) {
  #profile {
    min-height: auto;
    padding: 2rem 1rem;
  }

  .profile-container {
    flex-direction: row;
    gap: 2rem;
  }

  .profile-card {
    width: 200px;
    height: 200px;
  }

  .title {
    font-size: 2rem;
  }

  section {
    min-height: auto;
    padding: 3rem 2rem;
  }
}

/* HIGH RESOLUTION DISPLAYS */
@media screen and (min-width: 1800px) {
  section {
    padding: 4vh 15rem;
  }

  .title {
    font-size: 4rem;
  }

  .profile-card {
    width: 500px;
    height: 500px;
  }

  .bento-grid {
    gap: 2rem;
  }

  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating {
    animation: none;
  }

  .pulse {
    animation: none;
  }

  .typing-effect {
    animation: none;
  }
}

/* DARK MODE SUPPORT (Already dark by default, but adding overrides) */
@media (prefers-color-scheme: light) {
  :root {
    --dark-bg: #ffffff;
    --light-text: #0f172a;
    --glass-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.1);
  }

  body {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--light-text);
  }

  nav {
    background: rgba(255, 255, 255, 0.8);
  }

  .icon {
    filter: none;
  }
}

/* PRINT STYLES */
@media print {
  #particleCanvas,
  nav,
  .arrow,
  footer {
    display: none;
  }

  section {
    page-break-inside: avoid;
    padding: 1rem;
  }

  .glass-card {
    border: 1px solid #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}

/* ACCESSIBILITY IMPROVEMENTS */
@media screen and (min-width: 1200px) {
  /* Enhanced focus states for keyboard navigation */
  a:focus,
  button:focus,
  .btn:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
  }
}

/* TOUCH DEVICE OPTIMIZATIONS */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .social-link,
  .project-link {
    min-height: 44px;
    min-width: 44px;
  }

  .glass-card:hover {
    transform: none;
  }

  .skill-card:hover {
    transform: none;
  }

  .bento-overlay {
    transform: translateY(0);
    opacity: 0.9;
  }
  
  /* Theme toggle - easier to tap on touch devices */
  .theme-toggle {
    min-width: 44px;
    min-height: 44px;
  }
}

/* MOBILE-SPECIFIC OVERRIDES */
@media screen and (max-width: 1023px) {
  /* Force hide corner navigation on mobile/tablet */
  body > li.corner-item,
  body.corners-nav-active > li.corner-item {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Disable corner nav class effects on mobile */
  body.corners-nav-active #desktop-nav {
    position: relative;
    height: auto;
  }
  
  /* Theme toggle positioning for mobile */
  .theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    top: auto;
    left: auto;
    transform: none;
    animation: none;
    z-index: 10001;
  }
  
  .theme-toggle:hover {
    transform: scale(1.1);
  }
}

@media screen and (max-width: 768px) {
  /* Center theme toggle on small screens */
  .theme-toggle {
    right: 50%;
    transform: translateX(50%);
    bottom: 0.75rem;
  }
  
  .theme-toggle:hover {
    transform: translateX(50%) scale(1.1);
  }
  
  /* Skills row adjustments */
  .skills-row-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .skills-row-track {
    padding: 0.75rem;
  }

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

  .contact-form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .contact-main-title {
    font-size: 2rem;
  }

  .contact-subtitle {
    font-size: 1rem;
  }

  .contact-header {
    margin-bottom: 2.5rem;
  }

  /* Footer responsive */
  .footer-top {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

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

  .footer-column ul li a:hover {
    transform: none;
  }
}

@media screen and (max-width: 480px) {
  /* Extra small screens */
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  /* Footer extra small */
  footer {
    padding: 2rem 0 1rem;
  }

  .footer-content {
    padding: 0 1rem;
  }

  .footer-name {
    font-size: 1.25rem;
  }

  .footer-tagline {
    font-size: 0.8rem;
  }
  
  /* Skills modal full screen on mobile */
  .skills-modal-content {
    width: 100%;
    max-height: 95vh;
    border-radius: 0;
    padding: 1rem;
  }
  
  .skills-modal-close {
    right: 8px;
    top: 8px;
    font-size: 1.3rem;
  }
}
