/* 
 * RESPONSIVE DESIGN IMPROVEMENTS
 * Implementation-ready CSS fixes for the portfolio website
 * 
 * This file contains prioritized responsive design improvements
 * organized by implementation phase and urgency level
 */

/* =================================================================
   PHASE 1: CRITICAL FIXES (Immediate Implementation Required)
   ================================================================= */

/* 1.1 FIX MOBILE NAVIGATION ACCESSIBILITY */
@media screen and (max-width: 700px) {
  /* Ensure menu icon is properly visible and accessible */
  .menu-icon {
    display: block !important;
    color: lightgray;
    cursor: pointer;
    z-index: 1001;
  }

  /* Make sidebar fully functional on mobile */
  .sidebar {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    bottom: 0;
    transition: all 0.3s ease;
  }

  /* Fix sidebar animation for mobile */
  .sidebar.open-sidebar {
    width: 100%;
    opacity: 1;
    bottom: 0;
    border-radius: 0;
  }

  .sidebar.close-sidebar {
    width: 100%;
    opacity: 0;
    bottom: 100%;
    border-radius: 0;
  }

  /* Improve navigation accessibility */
  .sidebar ul li a {
    font-size: 24px; /* Better readability on mobile */
    padding: 15px 0;
    display: block;
  }

  .sidebar .social-icons a {
    font-size: 28px;
    margin-right: 20px;
  }
}

/* 1.2 IMPLEMENT PROPER BREAKPOINT STRATEGY */

/* Desktop Large (1440px+) */
@media screen and (min-width: 1440px) {
  .container {
    max-width: 1400px;
    margin: 0 auto;
  }

  .hero-info h1 {
    font-size: 72px;
    line-height: 80px;
  }

  .section-title {
    font-size: 48px;
  }

  .project-card {
    max-width: 1400px;
  }
}

/* Desktop Standard (1024px - 1439px) */
@media screen and (max-width: 1439px) and (min-width: 1024px) {
  .info-section,
  .my-projects,
  .skills-section,
  .contact-section {
    width: 90%;
  }

  .project-card {
    max-width: 1000px;
  }
}

/* Tablet Landscape (1024px - 769px) */
@media screen and (max-width: 1023px) and (min-width: 769px) {
  .hero-info h1 {
    font-size: 48px;
    line-height: 58px;
  }

  .info-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }

  .card:nth-child(3) {
    grid-row: span 1;
    height: 300px;
  }

  .card:nth-child(4) {
    grid-column: span 2;
  }
}

/* Tablet Portrait (768px - 481px) */
@media screen and (max-width: 768px) and (min-width: 481px) {
  .hero {
    padding-top: 100px;
  }

  .hero-info h1 {
    font-size: 36px;
    line-height: 44px;
  }

  /* Section 2 specific fixes for tablet portrait */
  .info-section {
    width: 95%;
    margin: 60px auto;
  }

  .info-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 25px;
  }

  .card {
    min-height: 260px;
    padding: 20px 15px;
  }

  .card img,
  .card video {
    width: 70%;
    max-width: 150px;
    max-height: 120px;
    margin-bottom: 15px;
  }

  .card h1 {
    font-size: 20px;
    margin-bottom: 12px;
  }

  .card p {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 15px;
  }

  .card button {
    padding: 10px 20px;
    font-size: 13px;
  }

  /* Third card spans full width on tablet portrait */
  .card:nth-child(3) {
    grid-column: span 2;
    min-height: 280px;
  }
}

/* Extra Small Mobile (360px and below) */
@media screen and (max-width: 360px) {
  /* Section 2 extreme mobile optimizations */
  .info-section {
    width: 98%;
    margin: 30px auto;
  }

  .info-cards {
    gap: 15px;
    margin-top: 15px;
  }

  .card {
    padding: 15px 12px;
    border-radius: 15px;
  }

  .card img,
  .card video {
    width: 50%;
    max-width: 100px;
    max-height: 80px;
    margin-bottom: 12px;
  }

  .card h1 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .card p {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 12px;
  }

  .card button {
    padding: 8px 16px;
    font-size: 12px;
  }

  .section-title {
    font-size: 22px;
    margin-bottom: 30px;
  }
}

/* =================================================================
   SECTION 2 ADDITIONAL ENHANCEMENTS
   ================================================================= */

/* Performance optimizations for Section 2 */
.card img,
.card video {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Improved accessibility for touch devices */
@media (hover: none) and (pointer: coarse) {
  .card {
    min-height: 300px;
    padding: 20px;
  }

  .card button {
    min-height: 44px;
    padding: 12px 24px;
    font-size: 16px;
  }

  .card img,
  .card video {
    min-height: 120px;
  }
}

/* Landscape orientation optimizations */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .info-section {
    margin: 40px auto;
  }

  .card {
    min-height: 200px;
    padding: 15px;
  }

  .card img,
  .card video {
    max-height: 80px;
    margin-bottom: 10px;
  }

  .card h1 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .card p {
    font-size: 12px;
    line-height: 1.4;
  }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .card img,
  .card video {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Reduced motion support for Section 2 */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card img,
  .card video {
    transition: none !important;
    animation: none !important;
  }

  .card:hover {
    transform: none !important;
  }

  .card:hover img,
  .card:hover video {
    transform: none !important;
  }
}

/* Dark mode improvements (if needed) */
@media (prefers-color-scheme: light) {
  .card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
  }

  .card h1 {
    color: #212529;
  }

  .card p {
    color: #6c757d;
  }
}

/* Container query support for component-based responsiveness */
@container (max-width: 400px) {
  .card {
    padding: 15px 10px;
  }

  .card h1 {
    font-size: 18px;
  }

  .card p {
    font-size: 13px;
  }
}

@container (max-width: 300px) {
  .card {
    padding: 12px 8px;
  }

  .card h1 {
    font-size: 16px;
  }

  .card p {
    font-size: 12px;
  }

  .card img,
  .card video {
    max-width: 80px;
    max-height: 60px;
  }
}

/* 1.3 FIX CONTENT OVERFLOW ISSUES */

/* Remove fixed heights that cause overflow */
.card {
  height: auto !important;
  min-height: 300px;
  padding: 20px;
}

.card:nth-child(3) {
  height: auto !important;
  min-height: 400px;
}

.card:nth-child(4) {
  height: auto !important;
  min-height: 350px;
}

/* Fix absolute positioning of text content */
.card h1,
.card p {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  margin-bottom: 15px;
  max-width: 100% !important;
}

.card button {
  position: relative;
  bottom: auto;
  left: auto;
  margin-top: 20px;
}

/* =================================================================
   SECTION 2 RESPONSIVE DESIGN FIXES (About Me Section)
   ================================================================= */

/* Section 2 Container - Base responsive improvements */
.info-section {
  width: 90%;
  margin: 80px auto;
}

/* Info Cards Grid - Core responsive grid system */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  width: 100%;
  margin-top: 30px;
}

/* Card base styles - Enhanced mobile-first approach */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  width: 100%;
  min-height: 280px;
  padding: 25px 20px;
  overflow: hidden;
  background-color: #080020b7;
  border-radius: 20px;
  transition: 0.3s;
  text-align: center;
}

/* Card media elements - Responsive images and videos */
.card img,
.card video {
  width: 80%;
  max-width: 200px;
  height: auto;
  max-height: 150px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
}

/* Card content - Typography and spacing */
.card h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 15px 0;
  color: lightgray;
  line-height: 1.3;
  z-index: 1;
}

.card p {
  font-size: 14px;
  line-height: 1.6;
  color: gray;
  margin: 0 0 20px 0;
  max-width: 100%;
  z-index: 1;
}

/* Card button - Mobile-optimized CTA */
.card button {
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid #727fdeb4;
  background-color: #2200493d;
  box-shadow: 0 0 5px #727fde86;
  cursor: pointer;
  transition: 0.3s;
  font-size: 14px;
  font-weight: 600;
  margin-top: auto;
}

.card button:hover {
  box-shadow: 0 0 15px #727fde86;
  opacity: 0.8;
  transform: translateY(-2px);
}

/* Special card layout adjustments */
.card:nth-child(3) {
  min-height: 350px;
}

.card:nth-child(4) {
  min-height: 320px;
}

/* Enhanced hover effects for desktop */
@media (hover: hover) {
  .card:hover {
    box-shadow: 0 0 20px rgba(211, 211, 211, 0.6);
    transform: translateY(-5px);
  }

  .card:hover img,
  .card:hover video {
    transform: scale(1.05);
  }
}

/* =================================================================
   PHASE 2: PERFORMANCE OPTIMIZATIONS
   ================================================================= */

/* 2.1 RESPONSIVE IMAGE OPTIMIZATION */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure videos maintain aspect ratio */
video {
  max-width: 100%;
  height: auto;
}

/* 2.2 IMPROVE ANIMATION PERFORMANCE */
.project-vidbox video,
.project-vidbox img {
  will-change: transform;
  transform: translateZ(0); /* Force hardware acceleration */
}

/* Optimize scroll animations */
.autoBlur,
.autoDisplay,
.fadeInRight {
  will-change: opacity, transform;
}

/* 2.3 FIX CSS DUPLICATION */
.hero {
  /* Remove duplicate definition - keep only one */
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh;
  align-items: center;
  justify-content: space-between;
  padding-top: 70px;
}

.hero-info {
  flex: 1;
  padding-left: 5%;
}

/* =================================================================
   PHASE 3: ACCESSIBILITY IMPROVEMENTS
   ================================================================= */

/* 3.1 IMPROVE TOUCH TARGETS */
button,
.menu-icon,
.sidebar ul li a,
.social-links a {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 3.2 ENHANCE FOCUS MANAGEMENT */
button:focus,
a:focus,
input:focus,
textarea:focus,
.menu-icon:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* 3.3 IMPROVE SKIP NAVIGATION */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #007bff;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* =================================================================
   RESPONSIVE UTILITIES
   ================================================================= */

/* Fluid typography */
.responsive-text {
  font-size: clamp(1rem, 4vw, 2rem);
}

.responsive-heading {
  font-size: clamp(1.5rem, 6vw, 3rem);
}

/* Container queries for component-based responsiveness */
@container (max-width: 600px) {
  .project-card {
    flex-direction: column;
  }
}

/* =================================================================
   PRINT STYLES
   ================================================================= */
@media print {
  .back-vid,
  .blackhole-box,
  .sidebar,
  .menu-icon {
    display: none !important;
  }

  .hero {
    height: auto;
    page-break-after: always;
  }

  .project-card,
  .card {
    break-inside: avoid;
  }
}

/* =================================================================
   HIGH CONTRAST MODE SUPPORT
   ================================================================= */
@media (prefers-contrast: high) {
  .card,
  .project-card,
  .skill-item {
    border: 2px solid;
  }

  .hero-info h1,
  .section-title {
    color: white;
  }
}

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

  .autoBlur,
  .autoDisplay,
  .fadeInRight {
    transform: none !important;
    opacity: 1 !important;
  }
}

/* =================================================================
   DARK MODE PREFERENCES (if needed)
   ================================================================= */
@media (prefers-color-scheme: dark) {
  /* Current design is already dark-mode friendly */
  /* This can be expanded if light mode support is added */
}
