/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f4f8;
  margin: 0;
  padding: 1rem;
  color: #333;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape */
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  background-color: transparent;
  box-sizing: border-box;
  justify-content: center;
}

.logo-link {
  display: inline-block;
}

.site-logo {
  height: 40px;
  width: auto;
  max-width: 100%;
}

/* Main Content Containers */
.container {
  max-width: 1100px;
  width: 100%;
  margin: 1.5rem auto;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.container img {
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.container img:active {
  transform: scale(0.98);
}

.content {
  flex: 1;
  width: 100%;
}

h2 {
  color: #1e97e7;
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  line-height: 1.3;
}

h2 a {
  color: inherit;
  text-decoration: none;
}

h2 a:hover, h2 a:focus {
  text-decoration: underline;
}

p {
  margin-bottom: 1.5rem;
}

code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Buttons */
.btn {
  background-color: #1a73e8;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  text-decoration: none;
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  touch-action: manipulation; /* Improve touch responsiveness */
  position: relative;
  overflow: hidden;
}

.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;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover, .btn:focus {
  background-color: #155fc3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  color: white;
}

.btn:active {
  transform: translateY(0);
}

/* Links */
a {
  color: #1a73e8;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover, a:focus {
  text-decoration: underline;
  color: #155fc3;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.lightbox.hidden {
  opacity: 0;
  visibility: hidden;
}

.lightbox-content {
  position: relative;
  max-width: 95%;
  max-height: 95%;
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lightbox:not(.hidden) .lightbox-content {
  transform: scale(1);
}

.lightbox-content img:first-child {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover, .lightbox-close:focus {
  background: rgba(0, 0, 0, 0.4);
  transform: rotate(90deg);
}

/* Special Pages Section */
.special-pages-section {
  max-width: 1100px;
  width: 100%;
  margin: 1.5rem auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
}

.special-pages-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #1e97e7, #f68530);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.special-pages-section:hover::before {
  transform: scaleX(1);
}

.special-pages-section.hidden {
  display: none;
}

.special-pages-header {
  padding: 1.2rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 600;
  color: #1e97e7;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
  position: relative;
  overflow: hidden;
}

.special-pages-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(30, 151, 231, 0.1), transparent);
  transition: left 0.5s;
}

.special-pages-header:hover::before {
  left: 100%;
}

.special-pages-header:hover, .special-pages-header:focus {
  background-color: rgba(0, 0, 0, 0.03);
  color: #1e97e7;
}

.special-pages-arrow {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.special-pages-arrow.rotated {
  transform: rotate(180deg);
}

.special-pages-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.special-pages-section.expanded .special-pages-content {
  max-height: 2000px; /* Adjust based on content */
}

.special-pages-content .container {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid #e0e0e0;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.special-pages-section.expanded .special-pages-content .container {
  transform: translateY(0);
  opacity: 1;
}

.special-pages-section.expanded .special-pages-content .container:nth-child(1) {
  transition-delay: 0.1s;
}

.special-pages-section.expanded .special-pages-content .container:nth-child(2) {
  transition-delay: 0.2s;
}

.special-pages-content .container:last-child {
  border-bottom: none;
}

/* Tag Labels */
.tag-label {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #1e97e7, #f68530);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(30, 151, 231, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(30, 151, 231, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(30, 151, 231, 0);
  }
}

.tag-label.beta {
  background: linear-gradient(135deg, #1e97e7, #f68530);
}

.tag-label.comming-soon {
  background: linear-gradient(135deg, #1e97e7, #f68530);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #e0e0e0;
  }

  .container {
    background: #1e1e1e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }

  h2 {
    color: #6cb8f7;
  }

  .btn {
    background-color: #2791e7;
  }

  .btn:hover, .btn:focus {
    background-color: #1c54b2;
    text-decoration: none;
  }

  a {
    color: #6cb8f7;
  }

  .lightbox-content {
    background: #1e1e1e;
  }
  
  .special-pages-section {
    background: #1e1e1e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }
  
  .special-pages-header:hover, .special-pages-header:focus {
    background-color: rgba(255, 255, 255, 0.05);
  }
  
  .special-pages-content .container {
    border-bottom: 1px solid #333;
  }
  
  code {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

/* Tablet and Desktop Styles */
@media (min-width: 768px) {
  body {
    padding: 2rem;
  }
  
  .container {
    flex-direction: row;
    text-align: left;
    padding: 2rem;
    margin: 2rem auto;
  }
  
  .container img {
    width: 200px;
    height: 200px;
    max-width: none;
  }
  
  .btn {
    width: auto;
    margin: 1rem 0 0 0;
  }
  
  .site-header {
    justify-content: flex-start;
    padding: 0 1rem;
  }
  
  .special-pages-header {
    padding: 1.5rem 2rem;
  }
  
  .tag-label {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: inline-block;
  }
}

/* Large Desktop Styles */
@media (min-width: 1024px) {
  .container {
    gap: 2rem;
  }
  
  .container img {
    width: 250px;
    height: 250px;
  }
  
  h2 {
    font-size: 1.6rem;
  }
}

/* Small Mobile Adjustments */
@media (max-width: 360px) {
  body {
    padding: 0.8rem;
  }
  
  .container {
    padding: 1.2rem;
    margin: 1rem auto;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  .special-pages-header {
    padding: 1rem;
    font-size: 0.95rem;
  }
  
  .tag-label {
    position: relative;
    bottom: auto;
    right: auto;
    display: inline-block;
    margin-bottom: 1rem;
  }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .container img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .tag-label {
    animation: none;
  }
}