/**
 * AutoClipper - Index Page (Channel Selector)
 * Forest theme with avatar frames and magical orbs
 */

/* ========================================
   FOREST BACKGROUND
   ======================================== */

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("/images/bg.jpg");
  background-size: cover;
  background-position: center;
  z-index: -1;
}

/* ========================================
   WOODEN FOOTER
   ======================================== */

.site-footer {
  background: url("/images/footer.png") no-repeat bottom center;
  background-size: auto 34px;
  background-color: transparent;
  border-top: none;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.footer-link {
  color: #fff;
}

.footer-link:hover {
  color: #fff;
}

.footer-link .icon-img {
  filter: invert(1) !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes drift-up {
  0% {
    transform: translateY(100vh) translateX(0) scale(var(--scale, 1));
    opacity: 0;
  }
  5% {
    opacity: var(--max-opacity, 1);
  }
  95% {
    opacity: var(--max-opacity, 1);
  }
  100% {
    transform: translateY(-100px) translateX(var(--drift-x, 50px)) scale(var(--scale, 1));
    opacity: 0;
  }
}

@keyframes drift-diagonal {
  0% {
    transform: translate(var(--start-x, 0), 100vh) scale(var(--scale, 1));
    opacity: 0;
  }
  5% {
    opacity: var(--max-opacity, 1);
  }
  95% {
    opacity: var(--max-opacity, 1);
  }
  100% {
    transform: translate(var(--end-x, 100px), -100px) scale(var(--scale, 1));
    opacity: 0;
  }
}

@keyframes drift-wander {
  0% {
    transform: translateY(100vh) translateX(0) scale(var(--scale, 1));
    opacity: 0;
  }
  5% {
    opacity: var(--max-opacity, 1);
  }
  25% {
    transform: translateY(75vh) translateX(var(--wander-1, 30px)) scale(var(--scale, 1));
  }
  50% {
    transform: translateY(50vh) translateX(var(--wander-2, -20px)) scale(var(--scale, 1));
  }
  75% {
    transform: translateY(25vh) translateX(var(--wander-3, 40px)) scale(var(--scale, 1));
  }
  95% {
    opacity: var(--max-opacity, 1);
  }
  100% {
    transform: translateY(-100px) translateX(var(--wander-4, 0)) scale(var(--scale, 1));
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.7;
    filter: blur(var(--blur, 2px)) brightness(1);
  }
  50% {
    opacity: 1;
    filter: blur(var(--blur, 2px)) brightness(1.3);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ========================================
   LAYOUT
   ======================================== */
.main-content-index {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ========================================
   NATURE ORBS
   ======================================== */

.nature-orbs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
}

/* Gold orbs - warm mystical glow */
.orb--gold {
  background: radial-gradient(
    circle,
    rgba(255, 200, 100, 1) 0%,
    rgba(246, 173, 85, 0.8) 30%,
    rgba(246, 173, 85, 0) 70%
  );
  box-shadow:
    0 0 20px rgba(246, 173, 85, 0.8),
    0 0 40px rgba(246, 173, 85, 0.5),
    0 0 60px rgba(246, 173, 85, 0.3);
}

/* Cyan orbs - ethereal spirit glow */
.orb--cyan {
  background: radial-gradient(
    circle,
    rgba(150, 255, 245, 1) 0%,
    rgba(79, 209, 197, 0.8) 30%,
    rgba(79, 209, 197, 0) 70%
  );
  box-shadow:
    0 0 20px rgba(79, 209, 197, 0.8),
    0 0 40px rgba(79, 209, 197, 0.5),
    0 0 60px rgba(79, 209, 197, 0.3);
}

/* White spirit orbs - rare bright wisps */
.orb--white {
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.6) 30%,
    rgba(255, 255, 255, 0) 70%
  );
  box-shadow:
    0 0 15px rgba(255, 255, 255, 0.9),
    0 0 30px rgba(255, 255, 255, 0.5),
    0 0 50px rgba(200, 220, 255, 0.3);
}

/* Large mythical orbs - extra glow */
.orb--large {
  box-shadow:
    0 0 30px currentColor,
    0 0 60px currentColor,
    0 0 90px currentColor;
}

/* ========================================
   TITLE IMAGE
   ======================================== */

.title-container {
  flex:1;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.title-image {
  width: 80vw;
  max-width: 500px;
  height: auto;
  animation: float 5s ease-in-out infinite;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.4));
}

/* ========================================
   CHANNEL SELECTOR LAYOUT
   ======================================== */

.channel-grid {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: start;
  flex-wrap: wrap;
  flex:2;
  gap: 64px;
}

/* ========================================
   CHANNEL CARD
   ======================================== */

.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  animation: fadeInUp 0.4s ease-out backwards;
}

/* ========================================
   CHANNEL AVATAR WITH FRAME
   ======================================== */

.channel-avatar-container {
  position: relative;
  width: 256px;
  height: 263px;
  background-image: url("/images/avatar.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 48px;
  transition: filter 0.3s ease;
  animation: float 4s ease-in-out infinite;
}

.channel-card:hover .channel-avatar-container {
  filter: drop-shadow(0 0 30px rgba(246, 173, 85, 0.5))
    drop-shadow(0 0 60px rgba(79, 209, 197, 0.3));
}

.channel-avatar {
  width: 163px;
  height: 163px;
  object-fit: cover;
  border-radius: 50%;
  transition: box-shadow var(--transition-normal);
}

.channel-card:hover .channel-avatar {
  box-shadow:
    0 0 20px rgba(79, 209, 197, 0.6),
    0 0 40px rgba(79, 209, 197, 0.4),
    0 0 60px rgba(246, 173, 85, 0.3);
}

/* ========================================
   CHANNEL NAME
   ======================================== */

.channel-name {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  text-align: center;
  line-height: 1.2;
  margin: 0;
  width: 155px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

.initial-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 64px 24px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  font-size: 14px;
  line-height: var(--line-height-normal);
  animation: fadeIn 0.3s ease;
}

.initial-loading .spinner {
  margin-right: 0;
}

.channel-error {
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  padding: 48px 32px;
  font-size: 14px;
  line-height: var(--line-height-relaxed);
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: var(--border-radius-lg);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {

  .channel-avatar-container {
    width: 200px;
    height: 205px;
    padding-top: 37px;
  }

  .channel-avatar {
    width: 127px;
    height: 127px;
  }

  .channel-name {
    font-size: 14px;
    bottom: 10px;
    width: 120px;
  }
}

@media (max-width: 480px) {

  .channel-grid {
    flex-direction: column;
    align-items: center;
    justify-content: start;
    gap:0;
  }
}

@media (min-height:1024px){
  .title-image {
    max-width: 700px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .title-image {
    animation: none;
  }

  .channel-avatar-container {
    animation: none;
  }

  .orb {
    animation: none;
    opacity: 0.5;
  }
}
