/* =================================================================
   COMPREHENSIVE MOBILE ENHANCEMENTS & PREMIUM UI STYLES FOR PORTFOLIO
   ================================================================= */

/* 1. VIEWPORT & BASE MOBILE SETTINGS */
@media (max-width: 1200px) {
  .container {
    padding: 0 20px !important;
  }
}

@media (max-width: 768px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
  }

  body {
    font-size: 16px !important;
    line-height: 1.7 !important;
    background-color: #000000;
  }

  * {
    max-width: 100%;
  }
}

/* 2. TYPOGRAPHY & FONT SCALING (INCREASED READABILITY & WEIGHT) */
@media (max-width: 768px) {
  h1 {
    font-size: 2.3rem !important;
    line-height: 1.25 !important;
    font-weight: 800 !important;
    word-break: break-word;
    letter-spacing: -0.8px !important;
  }

  h2 {
    font-size: 1.8rem !important;
    line-height: 1.3 !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
  }

  h3 {
    font-size: 1.45rem !important;
    font-weight: 700 !important;
    word-break: break-word;
    letter-spacing: -0.3px !important;
  }

  h4, h5 {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
  }

  p {
    font-size: 16px !important;
    line-height: 1.75 !important;
    font-weight: 500 !important; /* Slightly thicker for screen legibility */
    color: #dbdbdb !important; /* Brightened for high contrast */
    letter-spacing: 0.1px !important;
  }

  body.light-mode p {
    color: #333333 !important;
    font-weight: 500 !important;
  }

  .big {
    font-size: 2.2rem !important;
  }

  .big-2 {
    font-size: 1.8rem !important;
  }
  
  /* Resume/Timeline formatting */
  .resume-wrap {
    padding: 24px !important;
    border-radius: 16px !important;
  }
  
  .resume-wrap .date {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
  }
}

@media (max-width: 576px) {
  h1 {
    font-size: 2.0rem !important;
  }

  h2 {
    font-size: 1.6rem !important;
  }

  h3 {
    font-size: 1.3rem !important;
  }

  p {
    font-size: 15px !important;
    font-weight: 500 !important;
  }
}

/* 3. NAVBAR & NAVIGATION */
@media (max-width: 992px) {
  .navbar {
    padding: 12px 0 !important;
    background: rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  body.light-mode .navbar {
    background: rgba(255, 255, 255, 0.95) !important;
  }

  .navbar-brand {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
  }

  .navbar-brand svg {
    max-width: 90px !important;
    height: auto !important;
  }
}

/* 4. HERO SECTION (AVATAR PULSATING GLOW ANIMATION) */
@media (max-width: 768px) {
  .hero {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 100px 0 60px 0 !important;
    min-height: 100vh !important;
    box-sizing: border-box;
  }

  .home-slider .slider-item {
    min-height: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
  }

  .home-slider .slider-item .row {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
  }

  /* PORTRAIT PROFILE AVATAR WITH DYNAMIC PULSATING GLOW */
  .one-third.img {
    display: block !important;
    width: 150px !important;
    height: 150px !important;
    min-height: unset !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center top !important;
    margin: 0 auto 24px auto !important;
    border: 3.5px solid #FFD700 !important;
    order: -1 !important;
    animation: avatarGlow 3s infinite ease-in-out !important;
  }

  body.light-mode .one-third.img {
    border-color: #28a745 !important;
    animation: avatarGlowLight 3s infinite ease-in-out !important;
  }

  @keyframes avatarGlow {
    0% {
      box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.5);
    }
    70% {
      box-shadow: 0 0 0 16px rgba(255, 215, 0, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
  }

  @keyframes avatarGlowLight {
    0% {
      box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    70% {
      box-shadow: 0 0 0 16px rgba(40, 167, 69, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
  }

  .one-forth {
    width: 100% !important;
    min-height: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .hero .text {
    padding: 10px 15px !important;
    width: 100% !important;
    text-align: center !important;
  }

  .hero .text h1 {
    font-size: 2.4rem !important;
    margin: 8px 0 !important;
  }

  .hero .text h2 {
    font-size: 1.45rem !important;
    margin: 8px 0 !important;
  }

  .hero .text h3 {
    font-size: 1.15rem !important;
    margin: 8px 0 !important;
    white-space: normal !important;
  }

  #typing-animation {
    font-size: 1.5rem !important;
    font-weight: 700;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 12px !important;
    width: 100% !important;
    max-width: 320px;
    margin: 24px auto 0 auto !important;
  }

  .hero-buttons a {
    width: 100% !important;
    padding: 12px 20px !important;
    font-size: 1rem !important;
    text-align: center;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 46px !important;
    border-radius: 30px !important;
    font-weight: 700 !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease !important;
  }
}

@media (max-width: 576px) {
  .one-third.img {
    width: 130px !important;
    height: 130px !important;
  }

  .hero .text h1 {
    font-size: 2.1rem !important;
  }
}

/* 5. ABOUT SECTION (GLASSMORPHIC CARDS) */
@media (max-width: 992px) {
  .about-mf .box-shadow-full {
    padding: 2.5rem 1.8rem !important;
  }
}

@media (max-width: 768px) {
  .about-mf {
    padding: 3rem 0 !important;
  }

  .about-mf .box-shadow-full {
    padding: 2rem 1.2rem !important;
    background: rgba(26, 26, 26, 0.75) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
  }

  body.light-mode .about-mf .box-shadow-full {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  }

  .img-about.img {
    margin-bottom: 24px !important;
  }

  .about-img,
  .about-info {
    width: 100% !important;
    text-align: center !important;
  }

  .about-img img {
    margin: 0 auto !important;
    max-width: 200px !important;
    border-radius: 16px !important;
    border: 2px solid rgba(255, 255, 255, 0.1);
  }

  .about-info p {
    font-size: 16px !important;
    line-height: 1.7 !important;
  }

  .about-info li {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 0;
  }

  body.light-mode .about-info li {
    border-bottom-color: rgba(0, 0, 0, 0.05);
  }

  .about-info span {
    font-size: 15.5px !important;
  }

  /* Technical Skills Cards */
  .tech-mf .skill-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .tech-mf .skill-card {
    padding: 18px !important;
    background: rgba(26, 26, 26, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
  }

  body.light-mode .tech-mf .skill-card {
    background: rgba(248, 249, 250, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.04) !important;
  }

  .tech-mf .skill-card h4 {
    font-size: 1.15rem !important;
    margin-bottom: 8px !important;
    font-weight: 700 !important;
  }

  .tech-mf .skill-card p {
    font-size: 15px !important;
    line-height: 1.65 !important;
  }
}

/* 6. SKILL & PROGRESS BARS */
@media (max-width: 768px) {
  .skill-item {
    margin-bottom: 20px;
  }

  .skill-name {
    font-size: 15px !important;
    display: flex;
    justify-content: space-between;
    flex-direction: row !important;
    margin-bottom: 6px;
    font-weight: 600;
  }

  .skill-bar {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1) !important;
  }

  body.light-mode .skill-bar {
    background: rgba(0, 0, 0, 0.08) !important;
  }

  .skill-fill {
    height: 8px;
    border-radius: 4px;
  }
}

/* 7. PROJECT CARDS (CLEAN MODERN LAYOUT) */
@media (max-width: 768px) {
  .blog-entry {
    margin-bottom: 32px !important;
    background: rgba(26, 26, 26, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    overflow: hidden;
  }

  body.light-mode .blog-entry {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05) !important;
  }

  .blog-entry .text {
    padding: 20px !important;
  }

  .blog-entry h3.heading {
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
  }

  .blog-entry p {
    font-size: 15.5px !important;
    line-height: 1.65 !important;
    margin-bottom: 12px !important;
  }

  .block-20 {
    min-height: 210px !important;
  }

  .tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px !important;
  }

  .badge {
    font-size: 0.85rem !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
  }

  .project-buttons {
    display: flex;
    gap: 10px !important;
  }

  .project-buttons a {
    flex: 1;
    font-size: 0.9rem !important;
    padding: 10px 14px !important;
    min-height: 40px !important;
    border-radius: 8px !important;
    font-weight: 600;
  }
}

/* 8. CONTACT SECTION */
@media (max-width: 768px) {
  .contact-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .contact-info .box {
    padding: 24px 16px !important;
    text-align: center;
    background: rgba(26, 26, 26, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 16px !important;
  }

  body.light-mode .contact-info .box {
    background: #f8f9fa !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
  }

  .contact-info .icon {
    font-size: 2.2rem !important;
    margin-bottom: 12px;
  }

  .contact-info h3 {
    font-size: 1.25rem !important;
    font-weight: 700;
  }

  .contact-info p {
    font-size: 15.5px !important;
  }
}

/* 9. COUNTER SECTION */
@media (max-width: 768px) {
  #section-counter .block-18 {
    padding: 24px 18px !important;
    border-radius: 16px !important;
    background: rgba(26, 26, 26, 0.7) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  body.light-mode #section-counter .block-18 {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
  }

  #section-counter .block-18 .text strong.number {
    font-size: 2.2rem !important;
    font-weight: 800;
  }

  #section-counter .block-18 .text span {
    font-size: 15.5px !important;
  }
}

/* 10. FOOTER & SOCIAL ICONS */
@media (max-width: 768px) {
  .ftco-footer {
    padding: 3rem 0 !important;
    border-top: 1px solid rgba(255,255,255,0.05);
  }

  body.light-mode .ftco-footer {
    border-top-color: rgba(0,0,0,0.06);
  }

  .ftco-footer-social {
    display: flex;
    justify-content: center;
    gap: 16px !important;
  }

  .ftco-footer-social a {
    min-height: 48px !important;
    min-width: 48px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  body.light-mode .ftco-footer-social a {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
  }

  .ftco-footer-social .icon {
    font-size: 24px !important;
  }

  .signature-img {
    height: 90px !important;
    margin: 20px auto 10px auto;
  }

  .normal-txt {
    font-size: 15px !important;
  }
}

/* 11. BUTTONS & TOUCH TARGETS */
@media (max-width: 768px) {
  .btn {
    min-height: 46px !important;
    font-size: 1rem !important;
    border-radius: 25px !important;
  }

  .resume-download-btn {
    font-size: 1rem !important;
    padding: 12px 24px !important;
    border-radius: 30px !important;
    min-height: 46px !important;
  }
}

/* 12. IMAGES & MEDIA */
@media (max-width: 768px) {
  img {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* 13. SECTIONS & SPACING */
@media (max-width: 768px) {
  .ftco-section {
    padding: 4rem 0 !important;
  }

  .ftco-no-pb {
    padding-bottom: 0 !important;
  }

  .ftco-no-pt {
    padding-top: 0 !important;
  }
}

/* 14. GLITCH & BOUNDARY FIXES FOR INTRO OVERLAY (#cinematicIntro) */
#cinematicIntro {
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 10000 !important;
}

.intro-text {
  width: 90% !important;
  max-width: 340px !important;
  margin: 0 auto;
  text-align: center;
  overflow: hidden;
  box-sizing: border-box;
}

#starCanvas {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .intro-text .main {
    font-size: 32px !important;
    letter-spacing: 2px !important;
    line-height: 1.3 !important;
    margin: 12px 0 !important;
    animation: fadeInIntro 2s 1s forwards !important;
  }

  .intro-text .line {
    font-size: 16px !important;
    letter-spacing: 2px !important;
    animation: fadeInIntroSimple 1.5s forwards !important;
  }

  .intro-text .tag {
    font-size: 10.5px !important;
    letter-spacing: 1px !important;
    white-space: normal !important;
    line-height: 1.6 !important;
    margin: 8px 0 !important;
    padding: 0 10px;
    animation: fadeInIntroSimple 2s 2s forwards !important;
  }

  .intro-signature {
    max-width: 160px !important;
    height: auto !important;
    margin-top: 15px !important;
  }

  @keyframes fadeInIntro {
    from {
      opacity: 0;
      transform: translateY(15px);
      letter-spacing: 3px;
    }
    to {
      opacity: 1;
      transform: translateY(0);
      letter-spacing: 2px;
    }
  }

  @keyframes fadeInIntroSimple {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* 15. FINAL EXTREME SMALL SCREEN RECOVERY */
@media (max-width: 400px) {
  h1 {
    font-size: 1.7rem !important;
  }

  h2 {
    font-size: 1.4rem !important;
  }

  body {
    font-size: 15px !important;
  }

  p {
    font-size: 15px !important;
  }

  .mobile-bottom-nav {
    bottom: 8px;
    left: 8px;
    right: 8px;
    height: 58px;
  }
  
  body {
    padding-bottom: 78px !important;
  }

  .pwa-install-banner {
    bottom: 78px;
  }

  .pwa-status-toast {
    bottom: 78px;
  }
}

/* 16. ADDITIONAL RESPONSIVE CARD TEXT FIXES (PUBLICATION SECTIONS) */
@media (max-width: 768px) {
  #publication-section .col-md-4 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 20px !important;
  }

  #publication-section .blog-entry .text p {
    font-size: 15px !important;
    line-height: 1.6 !important;
  }

  .co-authors {
    font-size: 14.5px !important;
  }

  .view-paper {
    font-size: 14.5px !important;
  }
}

/* =================================================================
   17. TACTILE CARD HOVER & ENTRANCE TRANSITION ANIMATIONS (NEW)
   ================================================================= */
@media (max-width: 1024px) {
  /* Soft interactive transitions on cards */
  .blog-entry,
  .skill-card,
  .contact-info .box,
  .resume-wrap {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease !important;
  }

  /* Tactile scale-up and glow on card tap/hover */
  .blog-entry:active, .blog-entry:hover,
  .skill-card:active, .skill-card:hover,
  .contact-info .box:active, .contact-info .box:hover,
  .resume-wrap:active, .resume-wrap:hover {
    transform: translateY(-4px) scale(1.01) !important;
    border-color: rgba(255, 215, 0, 0.35) !important;
    box-shadow: 0 12px 30px rgba(255, 215, 0, 0.08) !important;
  }

  body.light-mode .blog-entry:active, body.light-mode .blog-entry:hover,
  body.light-mode .skill-card:active, body.light-mode .skill-card:hover,
  body.light-mode .contact-info .box:active, body.light-mode .contact-info .box:hover,
  body.light-mode .resume-wrap:active, body.light-mode .resume-wrap:hover {
    border-color: rgba(40, 167, 69, 0.35) !important;
    box-shadow: 0 12px 30px rgba(40, 167, 69, 0.08) !important;
  }
  
  /* Tap scale effect for buttons */
  .btn:active,
  .hero-buttons a:active {
    transform: scale(0.97) !important;
  }
}
