/* ==========================================
   Keiden Myrai - Responsive Styles
   Mobile-First Responsive Design
   ========================================== */

/* ==========================================
   Large Desktop (1440px and above)
   ========================================== */
@media (min-width: 1440px) {
  :root {
    --container-max-width: 1400px;
  }
}

/* ==========================================
   Desktop (1024px - 1439px)
   ========================================== */
@media (max-width: 1439px) {
  :root {
    --container-max-width: 1100px;
  }
}

/* ==========================================
   Tablet (768px - 1023px)
   ========================================== */
@media (max-width: 1023px) {
  :root {
    --container-padding: 1.5rem;
    --spacing-xl: 2.5rem;
    --spacing-2xl: 3.5rem;
    --spacing-3xl: 5rem;
  }

  /* Typography Adjustments */
  h1 {
    font-size: clamp(2rem, 4vw, 3rem);
  }

  h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  }

  /* Grid Adjustments */
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  /* Hero Adjustments */
  .hero {
    min-height: 80vh;
  }

  .hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
  }

  /* Section Padding */
  .section {
    padding: var(--spacing-2xl) 0;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
  }
}

/* ==========================================
   Mobile Landscape & Portrait (768px and below)
   ========================================== */
@media (max-width: 767px) {
  :root {
    --container-padding: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;
    --spacing-3xl: 3.5rem;
    --header-height: 60px;
  }

  /* Navigation - Mobile Menu */
  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--spacing-xl) var(--container-padding);
    gap: var(--spacing-md);
    transform: translateX(-100%);
    transition: transform var(--transition-medium);
    z-index: 999;
  }

  .nav.active {
    transform: translateX(0);
  }

  .nav-link {
    font-size: 1.25rem;
    padding: var(--spacing-sm) 0;
    width: 100%;
    border-bottom: 1px solid rgba(0, 191, 255, 0.1);
  }
  
  /* Mobile Dropdown */
  .nav-item {
    display: block;
    width: 100%;
  }
  
  .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin-top: var(--spacing-sm);
    padding-left: var(--spacing-md);
    border-left: 2px solid var(--accent-primary);
    background: transparent;
    border: none;
    box-shadow: none;
  }
  
  .nav-dropdown-link {
    padding: var(--spacing-sm) 0;
    font-size: 1.125rem;
    border-bottom: 1px solid rgba(0, 191, 255, 0.05);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  /* Hero Section */
  .hero {
    min-height: 70vh;
    padding-top: calc(var(--header-height) + var(--spacing-lg));
  }

  /* Blog Post Mobile Spacing */
  .post-header {
    padding-top: calc(var(--header-height) + var(--spacing-2xl));
    padding-bottom: var(--spacing-lg);
  }

  /* Ensure blog post content has proper mobile spacing */
  .post-content {
    padding-top: var(--spacing-lg);
  }

  /* Mobile blog post meta adjustments */
  .post-meta {
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
  }

  .hero-title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }

  .hero-subtitle {
    font-size: clamp(0.875rem, 2vw, 1.125rem);
  }

  .hero-description {
    font-size: 1rem;
  }

  /* Buttons */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
  }

  /* Cards */
  .card {
    padding: var(--spacing-md);
  }

  /* Grid Layouts */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  /* Section Padding */
  .section {
    padding: var(--spacing-xl) 0;
  }

  .section-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: var(--spacing-lg);
  }

  /* Footer */
  .footer {
    padding: var(--spacing-lg) 0;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  /* Social Links */
  .social-links {
    gap: var(--spacing-sm);
  }

  .social-link {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
  }

  /* Blog Post Layout */
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-card {
    margin-bottom: var(--spacing-md);
  }

  /* Tags */
  .tags {
    gap: 0.375rem;
  }

  .tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  /* Filters */
  .filters {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .filter-group {
    width: 100%;
  }

  /* Progress Bar */
  .progress-bar {
    height: 6px;
  }

  /* Reduce Animations on Mobile */
  .animate-float,
  .parallax,
  .parallax-slow,
  .parallax-fast {
    animation: none;
    transform: none;
  }
}

/* ==========================================
   Small Mobile (480px and below)
   ========================================== */
@media (max-width: 479px) {
  :root {
    --container-padding: 0.875rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.25rem;
  }

  /* Blog Post Mobile Spacing for Small Screens */
  .post-header {
    padding-top: calc(var(--header-height) + var(--spacing-xl));
    padding-bottom: var(--spacing-md);
  }

  .post-meta {
    gap: var(--spacing-sm);
    margin: var(--spacing-sm) 0;
  }

  /* Typography */
  html {
    font-size: 15px;
  }

  h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  h2 {
    font-size: clamp(1.375rem, 4vw, 1.75rem);
  }

  /* Hero */
  .hero-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  /* Cards */
  .card {
    padding: var(--spacing-sm);
  }

  .card-title {
    font-size: 1.25rem;
  }

  /* Buttons */
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }

  /* Social Links */
  .social-link {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  /* Status Badge */
  .status-badge {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ==========================================
   Extra Small Mobile (320px and below)
   ========================================== */
@media (max-width: 320px) {
  :root {
    --container-padding: 0.75rem;
  }

  html {
    font-size: 14px;
  }

  .hero {
    min-height: 60vh;
  }

  .section {
    padding: var(--spacing-lg) 0;
  }
}

/* ==========================================
   Touch Device Optimizations
   ========================================== */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn {
    min-height: 44px;
  }

  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .social-link {
    min-width: 44px;
    min-height: 44px;
  }

  /* Disable hover effects on touch devices */
  .card:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  /* Make active states more visible on touch */
  .btn:active {
    transform: scale(0.98);
  }

  .card:active {
    transform: scale(0.99);
  }

  .nav-link:active {
    background: rgba(0, 191, 255, 0.1);
  }
}

/* ==========================================
   High Resolution Display Optimization
   ========================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders and shadows */
  .card,
  .btn,
  .tag {
    border-width: 0.5px;
  }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
  .header,
  .footer,
  .mobile-menu-toggle,
  .social-links,
  .btn-group,
  .particles-background {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .section {
    page-break-inside: avoid;
  }

  a {
    text-decoration: underline;
  }

  .card {
    border: 1px solid #000;
    box-shadow: none;
  }
}

/* ==========================================
   Game Card Responsive Layout
   ========================================== */
@media (max-width: 767px) {
  .game-card > div {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-md) !important;
  }
  
  .game-card h3 {
    font-size: 1.25rem;
  }
  
  .game-card .btn {
    width: 100% !important;
  }
}

@media (max-width: 1023px) and (min-width: 768px) {
  .game-card > div {
    grid-template-columns: 220px 1fr !important;
  }
  
  .game-card > div > div:first-child {
    height: 160px !important;
  }
}

/* ==========================================
   Reduced Motion Preference
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-float,
  .animate-pulse,
  .animate-bounce,
  .parallax,
  .parallax-slow,
  .parallax-fast {
    animation: none;
    transform: none;
  }
}

/* ==========================================
   Dark Mode Support (for future)
   ========================================== */
@media (prefers-color-scheme: light) {
  /* Future: Light mode variables could go here */
  /* Currently, the site is dark-themed by design */
}

/* ==========================================
   Landscape Orientation Optimizations
   ========================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
    padding: var(--spacing-lg);
  }

  .hero-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .hero-description {
    font-size: 0.9375rem;
  }

  .section {
    padding: var(--spacing-lg) 0;
  }
}

