/* Skeleton Loading Styles - Eliminates Header/Footer Jump */

/* Hide main content initially until components load */
body:not(.components-loaded) main {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

body.components-loaded main {
  opacity: 1;
}

/* Header Skeleton */
.header-skeleton {
  height: 80px;
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 102, 204, 0.2);
  position: -webkit-sticky; /* Safari compatibility */
  position: sticky;
  top: 0;
  z-index: 1000; /* Match real header z-index */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--container-padding);
  width: 100%;
  will-change: transform; /* Performance optimization */
}

.header-skeleton__logo {
  width: 120px;
  height: 32px;
  background: rgba(0, 102, 204, 0.1);
  border-radius: 4px;
}

.header-skeleton__nav {
  display: none;
  gap: 2rem;
}

.header-skeleton__nav-item {
  width: 80px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.header-skeleton__menu-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Footer Skeleton */
.footer-skeleton {
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 102, 204, 0.2);
  padding: 3rem var(--container-padding) 2rem;
  margin-top: auto;
}

.footer-skeleton__content {
  max-width: var(--container-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.footer-skeleton__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-skeleton__title {
  width: 120px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.footer-skeleton__item {
  width: 80px;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.footer-skeleton__item:nth-child(odd) {
  width: 100px;
}

.footer-skeleton__item:nth-child(3n) {
  width: 60px;
}


/* Hide skeletons when components are loaded */
body.components-loaded .header-skeleton,
body.components-loaded .footer-skeleton {
  display: none;
}

/* Show real components when loaded */
body.components-loaded #header-placeholder,
body.components-loaded #footer-placeholder {
  opacity: 1;
}

body:not(.components-loaded) #header-placeholder,
body:not(.components-loaded) #footer-placeholder {
  opacity: 0;
}

/* Tablet and up - show navigation skeleton */
@media (min-width: 768px) {
  .header-skeleton__nav {
    display: flex;
  }
  
  .header-skeleton__menu-btn {
    display: none;
  }
  
  .footer-skeleton__content {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop adjustments */
@media (min-width: 1024px) {
  .header-skeleton {
    height: 88px;
  }
  
  .header-skeleton__logo {
    width: 140px;
    height: 36px;
  }
  
  .footer-skeleton__content {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

/* Fallback - show content after 3 seconds even if JS fails */
body:not(.components-loaded) {
  animation: fallback-show 0.3s ease-in-out 3s forwards;
}

@keyframes fallback-show {
  to {
    opacity: 1;
  }
}

body:not(.components-loaded) main {
  animation: fallback-show-main 0.3s ease-in-out 3s forwards;
}

@keyframes fallback-show-main {
  to {
    opacity: 1;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  body:not(.components-loaded) main,
  body.components-loaded main {
    transition: none;
  }
}
