/* Wallpaper Haven - Premium Theme */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
  color: #e0e0e0;
  animation: fadeIn 1.2s ease-in-out;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   HEADER & NAVBAR
   =========================== */
header {
  background: rgba(20, 20, 30, 0.6); /* dark semi-transparent */
  border-bottom: 2px solid #2a2a3e;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;

  /* blur effect */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); /* Safari support */
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  max-width: 1400px;
  margin: 0 auto;
  transition: padding 0.3s ease;
}

/* ===========================
   BRAND
   =========================== */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  font-size: 2.5rem;
  animation: logoSpin 8s linear infinite;
}

.brand-text h1 {
  font-size: 2rem;
  color: #f1f1f1;
  margin: 0;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.brand-subtitle {
  font-size: 0.9rem;
  color: #aaa; /* slightly brighter for better contrast */
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* ===========================
   STATS & ABOUT
   =========================== */
.nav-stats {
  display: flex;
  gap: 30px;
}

.stat-item {
  text-align: center;
  padding: 10px 15px;
  background: #1a1a2e;
  border-radius: 10px;
  border: 1px solid #2a2a3e;
  transition: all 0.3s ease;
}

.stat-item:hover {
  background: #2a2a3e;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* About button aligned with stats */
.aboutbutton {
  display: flex;
  align-items: center;
}

.about-link {
  display: inline-block;
  padding: 10px 20px;
  background: #1a1a2e;
  color: #f1f1f1;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid #2a2a3e;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.about-link:hover {
  background: #0f3460;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.about-link:active {
  background: #16213e;
  transform: translateY(0);
}

.about-link:focus {
  outline: 2px solid #e94560;
  outline-offset: 3px;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 900px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px 20px;
    gap: 20px;
  }

  .nav-stats {
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    justify-content: flex-start;
  }

  .stat-item,
  .aboutbutton {
    flex: 1 1 auto;
    text-align: center;
  }

  .about-link {
    width: 100%;
  }
}



.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  padding: 40px;
  max-width: 1400px;
  margin: 0 auto;
  justify-items: center;
}

.wallpaper {
  background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
  border: 2px solid #2a2a3e;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 4px 15px rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  opacity: 0;
  animation: cardFade 1s forwards;
  position: relative;
  width: 100%;
  max-width: 300px;
  will-change: transform;
  cursor: pointer;
  outline: none;
}

.wallpaper:focus {
  outline: 2px solid #4a4a6e;
  outline-offset: 2px;
}

.wallpaper:nth-child(odd) { animation-delay: 0.1s; }
.wallpaper:nth-child(even) { animation-delay: 0.2s; }
.wallpaper:nth-child(3n) { animation-delay: 0.3s; }

@keyframes cardFade {
  from { 
    opacity: 0; 
    transform: translateY(30px) scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

.wallpaper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.wallpaper:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 8px 25px rgba(255, 255, 255, 0.15);
  border-color: #4a4a6e;
}

.wallpaper:hover::before {
  opacity: 1;
}

.wallpaper img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-bottom: 2px solid #2a2a3e;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 0;
}

.wallpaper:hover img {
  transform: scale(1.1);
}

.download-btn {
  display: block;
  padding: 15px;
  text-align: center;
  background: linear-gradient(145deg, #2a2a3e, #1a1a2e);
  color: #f1f1f1;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 20px 20px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-shadow: 0 0 10px #fff;
  position: relative;
  z-index: 2;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.download-btn:hover {
  background: linear-gradient(145deg, #f1f1f1, #e0e0e0);
  color: #1a1a2e;
  text-shadow: none;
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

footer {
  text-align: center;
  padding: 25px;
  background: linear-gradient(145deg, #0a0a0a, #1a1a2e);
  font-size: 15px;
  color: #999;
  border-top: 2px solid #2a2a3e;
  margin-top: 40px;
  animation: footerGlow 3s ease-in-out infinite alternate;
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  background: linear-gradient(145deg, #2a2a3e, #1a1a2e);
  color: #f1f1f1;
  border: 2px solid #4a4a6e;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 10px #fff;
  position: relative;
  overflow: hidden;
}

.load-more-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.load-more-btn:hover::before {
  left: 100%;
}

.load-more-btn:hover {
  background: linear-gradient(145deg, #4a4a6e, #3a3a5e);
  border-color: #6a6a8e;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.load-more-btn:active {
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.load-more-btn:hover .btn-icon {
  transform: translateY(2px);
}

/* Loading Indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: #aaa;
  font-size: 1rem;
}


.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #333;
  border-top: 2px solid #4a4a6e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Completion Message */
.completion-message {
  color: #4a4a6e;
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 20px;
  padding: 15px 25px;
  background: rgba(74, 74, 110, 0.1);
  border-radius: 15px;
  border: 1px solid rgba(74, 74, 110, 0.3);
  animation: completionFade 0.5s ease-in;
}

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

@keyframes footerGlow {
  from { box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.05); }
  to { box-shadow: 0 -4px 20px rgba(255, 255, 255, 0.1); }
}

/* Responsive Design - Mobile First Approach */

/* Large Desktop */
@media (min-width: 1400px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 50px;
  }
  
  .navbar {
    padding: 25px 50px;
  }
}

/* Desktop */
@media (max-width: 1399px) and (min-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 40px;
  }
}

/* Tablet Landscape */
@media (max-width: 1199px) and (min-width: 992px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 35px;
  }
  
  .navbar {
    padding: 20px 35px;
  }
}

/* Tablet Portrait */
@media (max-width: 991px) and (min-width: 769px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 25px;
  }
  
  .navbar {
    padding: 18px 25px;
    flex-direction: column;
    gap: 15px;
  }
  
  .nav-stats {
    gap: 25px;
  }
  
  .brand-text h1 {
    font-size: 1.9rem;
  }
  
  .logo-icon {
    font-size: 2.2rem;
  }
}

/* Mobile Landscape */
@media (max-width: 768px) and (min-width: 481px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    padding: 20px;
  }
  
  .navbar {
    padding: 15px 20px;
    flex-direction: column;
    gap: 12px;
  }
  
  .nav-stats {
    gap: 20px;
  }
  
  .brand-text h1 {
    font-size: 1.7rem;
  }
  
  .logo-icon {
    font-size: 2rem;
  }
  
  .wallpaper {
    max-width: 100%;
  }
  
  .load-more-btn {
    padding: 12px 25px;
    font-size: 0.9rem;
  }
}

/* Mobile Portrait */
@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px;
  }
  
  .navbar {
    padding: 15px;
    flex-direction: column;
    gap: 10px;
  }
  
  .brand-text h1 {
    font-size: 1.5rem;
  }
  
  .logo-icon {
    font-size: 1.8rem;
  }
  
  .nav-stats {
    gap: 15px;
  }
  
  .stat-item {
    padding: 8px 12px;
  }
  
  .stat-number {
    font-size: 1.2rem;
  }
  
  .load-more-btn {
    padding: 12px 20px;
    font-size: 0.85rem;
  }
  
  .load-more-container {
    padding: 30px 15px;
  }
}

/* Small Mobile */
@media (max-width: 360px) {
  .gallery {
    padding: 10px;
    gap: 12px;
  }
  
  .navbar {
    padding: 12px;
  }
  
  .brand-text h1 {
    font-size: 1.3rem;
  }
  
  .logo-icon {
    font-size: 1.6rem;
  }
  
  .nav-stats {
    gap: 12px;
  }
  
  .stat-item {
    padding: 6px 10px;
  }
  
  .stat-number {
    font-size: 1.1rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
}

/* Touch Device Optimizations */
.touch-device .wallpaper:hover {
  transform: none;
}

.touch-device .wallpaper:active {
  transform: scale(0.98);
}

.touch-device .load-more-btn:hover {
  transform: none;
}

.touch-device .load-more-btn:active {
  transform: scale(0.95);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .wallpaper {
    border: 3px solid #fff;
  }
  
  .download-btn {
    background: #000;
    color: #fff;
    border: 1px solid #fff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .logo-icon {
    animation: none;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a2e;
    --text-primary: #f1f1f1;
    --text-secondary: #e0e0e0;
  }
}

/* Print styles */
@media print {
  .navbar,
  .load-more-container,
  .modal {
    display: none !important;
  }
  
  .gallery {
    display: block !important;
  }
  
  .wallpaper {
    break-inside: avoid;
    margin-bottom: 20px;
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  margin: 2% auto;
  padding: 0;
  width: 90%;
  max-width: 1200px;
  background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

@keyframes modalSlideIn {
  from { 
    opacity: 0; 
    transform: scale(0.8) translateY(-50px); 
  }
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  }
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #fff;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.modal img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.modal-info {
  padding: 25px;
  text-align: center;
  background: linear-gradient(145deg, #2a2a3e, #1a1a2e);
}

.modal-info h3 {
  color: #f1f1f1;
  font-size: 1.5rem;
  margin: 0 0 15px 0;
  letter-spacing: 1px;
}

.modal-download-btn {
  display: inline-block;
  padding: 12px 25px;
  background: linear-gradient(145deg, #4a4a6e, #3a3a5e);
  color: #f1f1f1;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-shadow: 0 0 10px #fff;
}

.modal-download-btn:hover {
  background: linear-gradient(145deg, #f1f1f1, #e0e0e0);
  color: #1a1a2e;
  text-shadow: none;
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

/* Make images clickable */
.wallpaper img {
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.wallpaper img:hover {
  filter: brightness(1.1);
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .modal img {
    max-height: 60vh;
  }
  
  .close {
    top: 10px;
    right: 15px;
    font-size: 30px;
    width: 40px;
    height: 40px;
  }
  
  .modal-info {
    padding: 20px;
  }
  
  .modal-info h3 {
    font-size: 1.2rem;
  }
}


