/* Mobile-First Viewport Optimization */
/* Dedicated styles to prevent mobile scrollbar issues */

/* Modern viewport units for better mobile support */
@supports (height: 100svh) {
  body {
    min-height: 100svh; /* Small viewport height - mobile portrait */
  }
}

@supports (height: 100lvh) {
  @media (orientation: landscape) {
    body {
      min-height: 100lvh; /* Large viewport height - mobile landscape */
    }
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-appearance: none) and (not (stroke-color: initial)) {
  /* iOS Safari viewport bug fix */
  body {
    min-height: -webkit-fill-available;
  }
  
  @media (max-width: 575px) {
    .main {
      max-height: calc(100vh - 120px); /* Reserve space for header/footer */
      overflow-y: visible;
    }
  }
}

/* Android Chrome specific optimizations */
@media screen and (max-width: 575px) {
  /* Prevent address bar resize issues */
  body {
    height: 100vh;
    height: 100svh;
    overflow-y: hidden;
  }
  
  /* Ensure grid container fits perfectly */
  .main {
    height: auto;
    max-height: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: visible;
  }
  
  /* Compact layout for small screens */
  .intro {
    margin: var(--space-2) 0;
  }
  
  .social-links {
    margin: var(--space-2) 0;
  }
  
  /* Tighter spacing for text elements */
  .motto-text {
    margin: var(--space-2) 0;
    line-height: var(--line-height-tight);
  }
  
  .subtitle {
    margin: var(--space-1) 0;
  }
}

/* Extra small devices (iPhone SE, etc.) */
@media (max-height: 667px) and (max-width: 375px) {
  .avatar-container {
    width: 80px;
    height: 80px;
  }
  
  .avatar-image {
    min-height: 80px;
    min-width: 80px;
  }
  
  .main {
    padding: var(--space-2) var(--space-4);
    gap: var(--space-2);
  }
  
  .motto-text {
    font-size: var(--font-size-lg);
  }
  
  .subtitle {
    font-size: var(--font-size-sm);
  }
}

/* Very small height devices (landscape mode) */
@media (max-height: 500px) {
  .header {
    padding: var(--space-1) var(--space-4) 0;
  }
  
  .footer {
    padding: 0 var(--space-4) var(--space-1);
  }
  
  /* Ensure footer text stays readable even in extreme landscape */
  .icp-link {
    font-size: var(--font-size-xs); /* Smaller text for extreme cases */
    padding: var(--space-1); /* Reduced padding */
  }
}
  
  .main {
    padding: var(--space-1) var(--space-4);
    gap: var(--space-1);
  }
  
  .avatar {
    margin-bottom: var(--space-2);
  }
  
  .social-links {
    margin: var(--space-1) 0;
  }
}

/* Prevent horizontal overflow */
* {
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure images don't cause overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Debug helper (remove in production) */
.debug-mobile {
  position: fixed;
  top: 0;
  right: 0;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  z-index: 9999;
  display: none;
}

@media (max-width: 575px) {
  .debug-mobile {
    display: block;
  }
}
