/* =========================================================
 * MasterHu Homepage Mobile Styles
 * Author: MasterHu
 * Website: https://masterhu.com.cn
 * License: CC BY-NC 4.0
 * ========================================================= */

/* ==================================================
   Mobile Styles (max-width: 800px)
=================================================== */

@media (max-width: 800px) {
  
  /* ==================================================
   Layout: Body & Global Overrides
=================================================== */
  body {
    background-attachment: scroll;
    font-size: 14px;
  }

  body.nav-open,
  body.modal-open {
    overflow: hidden;
  }

  .mh-bg-filter {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* ==================================================
   Layout: Navigation
=================================================== */
  .mh-nav {
    top: 16px;
    width: 92%;
    height: 56px;
    
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
  }

  .nav-container {
    position: relative;
    z-index: var(--z-index-nav-container);
    
    height: 56px;
    padding: 0 20px;
  }

  .nav-container .gradient-text {
    font-size: 18px;
  }

  /* ==================================================
   Component: Mobile Menu (Nav Links)
=================================================== */
  .nav-links {
    position: absolute;
    top: 100%;
    right: 20px;
    z-index: var(--z-index-nav-menu);
    
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    
    width: auto;
    min-width: 160px;
    height: auto;
    padding: 8px;
    margin-top: 12px;
    
    background: var(--card-bg-color);
    border: var(--glass-border);
    border-radius: 14px; /* Context Menu Radius */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    
    /* Animation: Slide down + Scale from top-right */
    transform-origin: top right;
    transform: translateY(-10px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .nav-links li {
    width: 100%;
    opacity: 0;
  }

  .nav-links a,
  .nav-theme-toggle {
    position: relative;
    z-index: var(--z-index-nav-item);
    
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px; /* Fixed height for consistency */
    padding: 0 16px; /* Consistent horizontal padding */
    box-sizing: border-box; /* Ensure padding doesn't affect width */
    
    color: var(--primary-text-color);
    font-size: 16px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    
    border-radius: 8px;
    transition: background-color 0.2s;
  }
  
  .nav-theme-toggle {
    border: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Reset button styles */
    justify-content: flex-start; /* Align text/icon to left like links */
    font-family: inherit;
    cursor: pointer;
  }
  
  /* Icon alignment fix if toggle has icon */
  .nav-theme-toggle svg {
    margin-right: 8px; /* Match gap of nav links if any */
  }

  /* Active State Feedback */
  .nav-links a:active,
  .nav-theme-toggle:active {
    background-color: var(--card-hover-color);
  }
  .nav-active li {
    opacity: 1;
    animation: nav-link-fade 0.3s ease forwards;
  }

  .nav-links.nav-active {
    opacity: 1;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto;
  }

  /* ==================================================
   Component: Burger Menu
=================================================== */
  .nav-burger {
    display: block;
    position: relative;
    z-index: var(--z-index-nav-burger);
  }

  /* ==================================================
   Layout: Main Structure
=================================================== */
  .mh-layout {
    flex-direction: column;
    padding-top: 50px;
  }

  /* Hide Sidebar on Mobile */
  .mh-sidebar {
    display: none;
  }

  /* Full Width Content */
  .mh-content {
    width: 100%;
  }

  /* ==================================================
   Content: Hero Section
=================================================== */
  .hero-greeting {
    margin: 2vw 0;
    font-size: 10vw;
  }

  .hero-motto {
    font-size: 4vw;
  }

  .snake {
    width: 100%;
  }

  .hero-actions {
    margin-top: 3vw;
  }

  /* ==================================================
     Content: Cards (Site & Project)
  =================================================== */
  .mh-site-card,
  .mh-project-card {
    padding: 10px;
  }

  .mh-site-card {
    width: calc(50% - 18px);
    margin: 9px;
  }

  .mh-project-card {
    width: calc(100% - 30px);
    height: 110px;
    margin: 8px 15px;
  }

  .mh-site-content,
  .mh-project-content {
    width: 100%;
  }

  .mh-site-content p,
  .mh-project-content p {
    font-size: 13px;
  }

  /* Disable hover effects on mobile */
  .mh-site-card:hover .mh-site-content h3,
  .mh-project-card:hover .mh-project-content h3 {
    font-size: 18px;
  }

  .mh-site-card:hover,
  .mh-project-card:hover {
    transform: none;
    box-shadow: none;
  }

  .mh-site-icon,
  .mh-project-icon {
    display: none;
  }

  /* ==================================================
     Content: Skills (Mobile Switch)
  =================================================== */
  .mh-skills #skill-mobile {
    display: block;
  }

  .mh-skills #skill-pc {
    display: none;
  }

  .mh-skills img {
    width: 92%;
    max-width: 360px;
  }

  /* ==================================================
   Component: Modal (Mobile Stack)
=================================================== */
  .mh-modal {
    padding: 16px;
  }

  .modal-main {
    width: 78vw;
    max-width: 360px;
    min-height: auto;
    border-radius: 16px;
  }

  .modal-img {
    display: none;
  }

  .modal-stack {
    display: block;
    gap: 16px;
    padding: 40px 16px 20px;
  }

  .modal-hint {
    display: block;
  }
}
