/* 
  Responsive Design for Athena-sama Website
  Mobile-first approach with progressive enhancement
*/

/* === MOBILE FIRST (320px+) === */
@media screen and (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  /* New mobile layout for side panels */
  .side-panels {
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 2rem;
    justify-content: flex-start;
    padding-top: 10vh;
  }
  
  .side-panel {
    width: 100%;
    max-width: 320px;
    margin-top: 0;
  }
  
  .left-panel,
  .right-panel {
    align-self: center;
    margin-top: 0;
  }
  
  /* VRM container for mobile */
  .vrm-container-fixed {
    width: 250px;
    height: 350px;
    top: 60%;
    z-index: 50; /* Lower than panels on mobile */
  }
  
  .panel-item {
    padding: 1rem;
    font-size: 0.9rem;
  }
  
  .panel-item h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
  }
  
  .panel-arrow {
    display: none; /* Hide arrows on mobile */
  }
  
  .main-content {
    margin-top: 90vh; /* Push content further down on mobile */
    padding: 1.5rem;
    border-radius: 15px;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .blog-section,
  .youtube-section {
    padding: 1.5rem;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem;
  }
  
  .social-link {
    padding: 0.8rem 1.5rem;
    text-align: center;
    width: 100%;
    max-width: 200px;
  }
  
  .profile-modal {
    margin: 1rem;
    max-height: 90vh;
  }
  
  .modal-header {
    padding: 1.5rem;
  }
  
  .modal-content {
    padding: 1.5rem;
  }
  
  /* Header adjustments for mobile */
  .nav-links {
    gap: 0.8rem;
  }
  
  .nav-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  .nav-logo h2 {
    font-size: 1.1rem;
  }
}

/* === SMALL TABLETS (481px - 768px) === */
@media screen and (min-width: 481px) and (max-width: 768px) {
  .side-panels {
    padding: 0 20px;
    gap: 3rem;
  }
  
  .side-panel {
    width: 300px;
  }
  
  .vrm-container-fixed {
    width: 350px;
    height: 500px;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .main-content {
    margin-top: 75vh;
  }
  
  .footer-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
  }
  
  .panel-item {
    padding: 1.2rem;
  }
}

/* === TABLETS (769px - 1024px) === */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .header-container {
    grid-template-columns: 1fr 1fr 1fr;
    max-width: 900px;
  }
  
  .content-grid {
    grid-template-columns: 1fr 1fr;
    max-width: 900px;
    margin: 0 auto;
  }
  
  .main-content {
    margin-top: 8rem;
    max-width: 900px;
  }
  
  .athena-visible-area {
    -webkit-mask: radial-gradient(
      ellipse 250px 350px at center,
      rgba(0,0,0,1) 60%,
      rgba(0,0,0,0.8) 80%,
      rgba(0,0,0,0) 100%
    );
    mask: radial-gradient(
      ellipse 250px 350px at center,
      rgba(0,0,0,1) 60%,
      rgba(0,0,0,0.8) 80%,
      rgba(0,0,0,0) 100%
    );
  }
}

/* === SMALL DESKTOP (1025px - 1200px) === */
@media screen and (min-width: 1025px) and (max-width: 1200px) {
  .header-container {
    max-width: 1000px;
    padding: 0 2rem;
  }
  
  .main-content {
    max-width: 1000px;
    margin-top: 10rem;
  }
  
  .content-grid {
    max-width: 1000px;
  }
}

/* === LARGE DESKTOP (1201px+) === */
@media screen and (min-width: 1201px) {
  .header-container {
    max-width: 1200px;
  }
  
  .main-content {
    max-width: 1200px;
    margin-top: 12rem;
  }
  
  .content-grid {
    max-width: 1200px;
  }
  
  /* Enhanced VRM visibility for large screens */
  .athena-visible-area {
    -webkit-mask: radial-gradient(
      ellipse 350px 450px at center,
      rgba(0,0,0,1) 65%,
      rgba(0,0,0,0.9) 85%,
      rgba(0,0,0,0) 100%
    );
    mask: radial-gradient(
      ellipse 350px 450px at center,
      rgba(0,0,0,1) 65%,
      rgba(0,0,0,0.9) 85%,
      rgba(0,0,0,0) 100%
    );
  }
}

/* === ULTRA-WIDE SCREENS (1600px+) === */
@media screen and (min-width: 1600px) {
  html {
    font-size: 18px;
  }
  
  .header-container {
    max-width: 1400px;
    padding: 0 3rem;
  }
  
  .main-content {
    max-width: 1400px;
    margin-top: 15rem;
  }
  
  .content-grid {
    max-width: 1400px;
    padding: 4rem;
  }
  
  .athena-visible-area {
    -webkit-mask: radial-gradient(
      ellipse 400px 500px at center,
      rgba(0,0,0,1) 70%,
      rgba(0,0,0,0.9) 85%,
      rgba(0,0,0,0) 100%
    );
    mask: radial-gradient(
      ellipse 400px 500px at center,
      rgba(0,0,0,1) 70%,
      rgba(0,0,0,0.9) 85%,
      rgba(0,0,0,0) 100%
    );
  }
}

/* === LANDSCAPE MOBILE === */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .header-container {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
  }
  
  .daily-message,
  .athena-profile,
  .fortune-panel {
    padding: 0.8rem;
  }
  
  .main-content {
    margin-top: 2rem;
  }
  
  .content-grid {
    padding: 1.5rem;
    gap: 1.5rem;
  }
  
  .status-info {
    bottom: 5px;
    right: 5px;
    padding: 0.5rem;
    font-size: 0.7rem;
  }
}

/* === HIGH DPI DISPLAYS === */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
  .loading-spinner {
    border-width: 2px;
  }
  
  .social-link,
  .profile-button,
  .blog-link {
    border-width: 1px;
  }
}

/* === TOUCH DEVICES === */
@media (hover: none) and (pointer: coarse) {
  .hover-lift:hover,
  .hover-glow:hover {
    transform: none;
    box-shadow: none;
  }
  
  .blog-item:hover {
    transform: none;
  }
  
  .social-link:hover,
  .profile-button:hover {
    transform: none;
  }
  
  /* Larger touch targets */
  .profile-button,
  .modal-close,
  .social-link {
    min-height: 44px;
    min-width: 44px;
  }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  .time-gradient {
    transition: none;
  }
  
  .loading-spinner {
    animation: none;
  }
  
  .sparkle-effect::before {
    animation: none;
  }
  
  .animate-pulse {
    animation: none;
  }
}

/* === HIGH CONTRAST === */
@media (prefers-contrast: high) {
  .daily-message,
  .athena-profile,
  .fortune-panel,
  .blog-section,
  .youtube-section {
    border: 2px solid #000;
    background: #fff;
  }
  
  .site-header,
  .site-footer {
    background: #fff;
    border: 2px solid #000;
  }
  
  .social-link {
    background: #000;
    color: #fff;
    border: 2px solid #000;
  }
}

/* === DARK MODE PREFERENCE === */
@media (prefers-color-scheme: dark) {
  .time-gradient.night {
    background: linear-gradient(135deg, #0a0e27 0%, #2d1b3d 100%);
  }
  
  .status-info {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  
  .loading-screen {
    background: linear-gradient(135deg, #2d1b3d, #0a0e27);
  }
}

/* === PRINT ADJUSTMENTS === */
@media print {
  * {
    color: #000 !important;
    background: #fff !important;
  }
  
  .header-container,
  .content-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .social-link {
    color: #000 !important;
    text-decoration: underline !important;
  }
  
  .blog-link::after {
    content: " (" attr(href) ")";
  }
}

/* === FOCUS MANAGEMENT === */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 1rem;
  }
  
  .profile-modal {
    width: 100%;
    max-width: none;
    margin: 0;
  }
}

/* === PERFORMANCE OPTIMIZATIONS === */
@media (max-width: 768px) {
  .sparkle-effect::before {
    display: none;
  }
  
  .particle-container {
    opacity: 0.3;
  }
  
  .glass-effect {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }
}