/* Parallax Animation */
.parallax {
  transition: transform 0.1s ease-out;
}

/* Marquee Animation */
.marquee-container {
  position: relative;
  overflow: hidden;
}

.marquee-content {
  display: flex;
  animation: marquee 30s linear infinite;
}

.marquee-content:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Duplicate content for seamless loop */
.marquee-content::after {
  content: "";
  display: flex;
  flex-shrink: 0;
}

/* Prose Styling for Readability */
.prose-custom {
  font-size: 1.125rem;
  line-height: 1.75;
}

.prose-custom h1,
.prose-custom h2,
.prose-custom h3,
.prose-custom h4 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.prose-custom h1 {
  font-size: 2.5rem;
}

.prose-custom h2 {
  font-size: 2rem;
}

.prose-custom h3 {
  font-size: 1.75rem;
}

.prose-custom h4 {
  font-size: 1.5rem;
}

.prose-custom p {
  margin-bottom: 1.5rem;
}

.prose-custom ul,
.prose-custom ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.prose-custom li {
  margin-bottom: 0.5rem;
}

.prose-custom a {
  color: #facc15;
  text-decoration: underline;
  transition: color 0.3s;
}

.prose-custom a:hover {
  color: #fde047;
}

.prose-custom strong {
  font-weight: 700;
  color: #fbbf24;
}

.prose-custom table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.prose-custom th,
.prose-custom td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(250, 204, 21, 0.1);
}

.prose-custom th {
  font-weight: 700;
  color: #fbbf24;
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  position: relative;
}

/* Layout wrapper fixes */
.flex {
  min-width: 0;
}

/* Prevent flex children from overflowing */
.flex > * {
  min-width: 0;
  flex-shrink: 1;
}

/* Ensure all containers don't overflow */
* {
  box-sizing: border-box;
}

.container, .flex, .grid {
  max-width: 100%;
}

/* Main content responsiveness */
main {
  min-width: 0;
  flex: 1;
}

/* Container responsiveness fixes */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Mobile-first responsive containers */
@media (min-width: 640px) {
  .container {
    max-width: 640px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: none;
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  /* Desktop with sidebar - reduce max width */
  main .container {
    max-width: calc(100vw - 256px - 4rem);
  }
}

@media (min-width: 1280px) {
  .container {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
  
  main .container {
    max-width: calc(100vw - 256px - 5rem);
  }
}

@media (min-width: 1536px) {
  .container {
    padding-left: 3rem;
    padding-right: 3rem;
  }
  
  main .container {
    max-width: calc(100vw - 256px - 6rem);
  }
}

/* Mobile-specific fixes */
@media (max-width: 1023px) {
  /* Full width on mobile without sidebar margin */
  main {
    margin-left: 0 !important;
    width: 100vw;
  }
  
  .container {
    max-width: 100vw;
    padding-left: max(1rem, env(safe-area-inset-left, 1rem));
    padding-right: max(1rem, env(safe-area-inset-right, 1rem));
  }
}

/* Prevent grid and image overflow */
.grid {
  min-width: 0;
}

.grid > * {
  min-width: 0;
}

img {
  max-width: 100%;
  height: auto;
}

/* Ensure sections don't overflow */
section {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Additional overflow protection */
.space-y-16 > *,
.space-y-24 > * {
  max-width: 100%;
  overflow-x: hidden;
}

/* Fix any potential width issues with content blocks */
div, section, article, main {
  max-width: 100%;
}

/* Tailwind container override for this specific layout */
.container.mx-auto {
  max-width: 100% !important;
}

@media (min-width: 1024px) {
  .container.mx-auto {
    max-width: calc(100vw - 280px) !important;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #ca8a04;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #facc15;
}

/* Pulse Animation for Live Badge */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Details/Summary Styling */
details summary {
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

/* Hover Effects */
.transform {
  transition: transform 0.3s ease;
}

.hover\:scale-105:hover {
  transform: scale(1.05);
}

/* Focus States */
input:focus,
button:focus,
a:focus {
  outline: 2px solid #facc15;
  outline-offset: 2px;
}

/* Mobile Sidebar Animations */
#mobile-sidebar {
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

#mobile-sidebar.hidden {
  opacity: 0;
  visibility: hidden;
}

#mobile-sidebar:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

#mobile-sidebar.hidden #sidebar-panel {
  transform: translateX(-100%);
}

#mobile-sidebar:not(.hidden) #sidebar-panel {
  transform: translateX(0);
}

/* Mobile Sidebar Styles */
@media (max-width: 1023px) {
  /* Ensure sidebar is properly sized for mobile */
  #mobile-sidebar #sidebar-panel {
    width: min(320px, 85vw);
    max-width: 85vw;
  }
  
  /* Touch-friendly navigation items */
  #mobile-sidebar nav a {
    min-height: 56px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(250, 204, 21, 0.1);
  }
  
  /* Active/pressed state for better touch feedback */
  #mobile-sidebar nav a:active {
    transform: scale(0.98);
    background-color: rgba(250, 204, 21, 0.15) !important;
  }
  
  /* Better scrolling on mobile */
  #mobile-sidebar nav {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Improve close button touch target */
  #menu-close {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Small mobile screens */
@media (max-width: 480px) {
  #mobile-sidebar #sidebar-panel {
    width: min(280px, 90vw);
    max-width: 90vw;
  }
  
  #mobile-sidebar nav a {
    padding: 16px 20px;
    font-size: 16px;
  }
  
  #mobile-sidebar nav a i {
    font-size: 18px;
    width: 20px;
  }
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Safe area support for notched devices */
@media (max-width: 1023px) {
  #mobile-sidebar #sidebar-panel {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* Improved mobile header styling */
@media (max-width: 640px) {
  header .container {
    padding-left: max(1rem, env(safe-area-inset-left, 1rem));
    padding-right: max(1rem, env(safe-area-inset-right, 1rem));
  }
}

/* Mobile sidebar backdrop animation */
#mobile-sidebar .backdrop-blur-sm {
  transition: opacity 0.3s ease-in-out;
}

#mobile-sidebar.hidden .backdrop-blur-sm {
  opacity: 0;
}

#mobile-sidebar:not(.hidden) .backdrop-blur-sm {
  opacity: 1;
}

/* Smooth transitions for all interactive elements */
#mobile-sidebar * {
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

/* Responsive Typography */
@media (max-width: 768px) {
  .prose-custom {
    font-size: 1rem;
  }

  .prose-custom h1 {
    font-size: 2rem;
  }

  .prose-custom h2 {
    font-size: 1.75rem;
  }

  .prose-custom h3 {
    font-size: 1.5rem;
  }

  .prose-custom h4 {
    font-size: 1.25rem;
  }
}

/* Loading States */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading {
  animation: shimmer 2s infinite;
  background: linear-gradient(to right, #1f2937 0%, #374151 50%, #1f2937 100%);
  background-size: 1000px 100%;
}
