/* =========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   Kontekst Lora Gaming Website
   ========================================= */

/* Mobile First Base Styles (320px+) */
@media screen and (max-width: 768px) {
  /* Container */
  .container {
    padding: 0 1rem;
  }
  
  /* Typography */
  :root {
    --font-size-5xl: 2.5rem;
    --font-size-4xl: 2rem;
    --font-size-3xl: 1.75rem;
    --font-size-2xl: 1.5rem;
    --section-padding: 3rem 0;
  }
  
  /* Header */
  .nav {
    padding: 0.75rem 0;
  }
  
  .nav-menu {
    position: fixed;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-darker);
    border-top: 1px solid var(--border-color);
    transform: translateY(0);
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 999;
  }
  
  .nav-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .nav-list {
    flex-direction: column;
    padding: 2rem 1rem;
    gap: 0;
  }
  
  .nav-item {
    border-bottom: 1px solid var(--border-color);
  }
  
  .nav-link {
    display: block;
    padding: 1rem 0;
    font-size: var(--font-size-lg);
  }
  
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: var(--bg-light);
    margin-left: 1rem;
    margin-top: 0.5rem;
  }
  
  .nav-actions {
    gap: 0.5rem;
  }
  
  .search-box {
    position: fixed;
    top: 100%;
    left: 1rem;
    right: 1rem;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }
  
  .search-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(-80px);
  }
  
  .search-input {
    width: 100%;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  /* Hero Section */
  .hero {
    min-height: 80vh;
    padding-top: 4rem;
  }
  
  .hero-title {
    font-size: var(--font-size-4xl);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-base);
    margin-bottom: 2rem;
  }
  
  .hero-stats {
    gap: 2rem;
    margin-bottom: 2rem;
  }
  
  .stat-number {
    font-size: var(--font-size-2xl);
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  /* Games Grid */
  .games-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .game-card {
    max-width: 100%;
  }
  
  .game-thumbnail {
    height: 150px;
  }
  
  /* Categories Grid */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .category-card {
    padding: 1.5rem 0.75rem;
  }
  
  .category-icon {
    font-size: 2rem;
  }
  
  /* Blog Grid */
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Newsletter */
  .newsletter-content {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }
  
  .newsletter-form {
    flex-direction: column;
    min-width: 100%;
  }
  
  .newsletter-input {
    margin-bottom: 1rem;
  }
  
  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  /* Game Modal */
  .game-modal-content {
    width: 95vw;
    height: 80vh;
  }
  
  /* Buttons */
  .btn {
    padding: 0.875rem 1.5rem;
    font-size: var(--font-size-base);
    width: 100%;
    max-width: 250px;
  }
  
  .hero-actions .btn {
    margin-bottom: 0.5rem;
  }
}

/* Small Mobile (320px - 480px) */
@media screen and (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }
  
  .hero-title {
    font-size: var(--font-size-3xl);
  }
  
  .categories-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
  
  .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
  }
  
  .stat:last-child {
    border-bottom: none;
  }
  
  .stat-number {
    font-size: var(--font-size-xl);
  }
}

/* Tablet (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-content {
    grid-template-columns: 2fr 1fr 1fr;
  }
  
  .newsletter-content {
    gap: 2rem;
  }
  
  .newsletter-form {
    min-width: 350px;
  }
}

/* Small Desktop (1024px - 1200px) */
@media screen and (min-width: 1024px) and (max-width: 1200px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large Desktop (1200px+) */
@media screen and (min-width: 1200px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .categories-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .hero-title {
    font-size: var(--font-size-5xl);
  }
}

/* High DPI Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2), 
       screen and (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Landscape Mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
  }
  
  .hero-stats {
    margin-bottom: 1.5rem;
  }
  
  .hero-actions {
    flex-direction: row;
    gap: 1rem;
  }
}

/* Tablet Landscape */
@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .hero {
    min-height: 90vh;
  }
  
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Print Styles */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }
  
  .header,
  .newsletter,
  .footer,
  .back-to-top,
  .game-modal {
    display: none !important;
  }
  
  .hero {
    min-height: auto;
    padding: 2rem 0;
  }
  
  .btn {
    border: 1px solid black;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero-background {
    animation: none;
  }
  
  .hero-scroll {
    animation: none;
  }
}

/* Accessibility - High Contrast */
@media (prefers-contrast: high) {
  :root {
    --primary: #FF4500;
    --secondary: #000080;
    --accent: #00FFFF;
    --text-primary: #FFFFFF;
    --text-secondary: #CCCCCC;
    --bg-dark: #000000;
    --bg-card: #1A1A1A;
    --border-color: #444444;
  }
}

/* Focus Styles for Accessibility */
@media (prefers-reduced-motion: no-preference) {
  :focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  
  .btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .game-card:hover {
    transform: none;
  }
  
  .game-card:active {
    transform: translateY(-2px);
  }
  
  .play-overlay {
    opacity: 1;
  }
  
  .play-btn {
    transform: translateY(0);
    padding: 1rem 2rem;
    font-size: var(--font-size-lg);
  }
  
  .category-card:hover {
    transform: none;
  }
  
  .category-card:active {
    transform: translateY(-1px);
  }
  
  .btn:hover {
    transform: none;
  }
  
  .btn:active {
    transform: translateY(1px);
  }
  
  /* Increase tap targets for mobile */
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .social-link {
    width: 48px;
    height: 48px;
  }
  
  .back-to-top {
    width: 56px;
    height: 56px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  /* Already using dark theme by default */
  /* This ensures consistency across browsers */
}

/* Container Queries Support (Future-proofing) */
@supports (container-type: inline-size) {
  .games-section {
    container-type: inline-size;
  }
  
  @container (max-width: 600px) {
    .games-grid {
      grid-template-columns: 1fr;
    }
  }
  
  @container (min-width: 601px) and (max-width: 900px) {
    .games-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  @container (min-width: 901px) {
    .games-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Error States */
.error-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.error-state h3 {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Utility Classes for Responsive Design */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media screen and (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  .show-mobile-flex {
    display: flex !important;
  }
  
  .show-mobile-grid {
    display: grid !important;
  }
}