/* Global box sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent scrolling on the homepage */
body,
html {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

/* Base styles for the home page */
body {
  background: url("../../images/bg/class.webp") no-repeat center center fixed;
  background-size: cover;
  font-family: Arial, sans-serif;
  color: #fff;
  position: relative;
}

/* Main container */
#main-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
  aspect-ratio: auto; /* Allow natural aspect ratio */
}

/* Column container */
.column-container {
  display: flex;
  flex: 1;
  height: 100%;
}

/* Individual columns */
.column {
  flex: 1;
  padding: 1.5rem;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#column1 {
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.6), rgba(30, 10, 50, 0.85));
  padding-bottom: 0;
  box-shadow: inset 0 0 50px rgba(255, 105, 180, 0.1);
}

#column2 {
  flex: 1.5;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
    135deg,
    rgba(10, 5, 20, 0.9),
    rgba(84, 22, 144, 0.7),
    rgba(40, 15, 80, 0.85)
  );
  position: relative;
  z-index: 1;
  box-shadow: 
    inset 0 0 80px rgba(142, 45, 226, 0.15),
    0 0 50px rgba(255, 105, 180, 0.1);
}

#column3 {
  flex: 1;
  background: linear-gradient(135deg, rgba(30, 10, 50, 0.85), rgba(0, 0, 0, 0.6));
  box-shadow: inset 0 0 50px rgba(142, 45, 226, 0.1);
}

/* Divider between columns */
.divider {
  width: 3px;
  background: linear-gradient(
    to bottom, 
    transparent 0%, 
    rgba(255, 105, 180, 0.3) 10%,
    rgba(255, 105, 180, 0.8) 50%,
    rgba(142, 45, 226, 0.8) 50%,
    rgba(142, 45, 226, 0.3) 90%,
    transparent 100%
  );
  box-shadow: 
    0 0 15px rgba(255, 105, 180, 0.5),
    0 0 30px rgba(142, 45, 226, 0.3);
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 100%;
  background: inherit;
  filter: blur(8px);
  opacity: 0.6;
}

/* Logo container styling */
.logo-container {
  position: relative;
  width: 100%;
  max-width: 220px; /* Increased from 180px */
  height: 220px; /* Increased from 180px */
  margin: 0 auto 2rem;
  z-index: 50;
}

#site-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation:
    pulse 4s infinite alternate,
    rotate 30s linear infinite;
}

.logo-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: rotate-reverse 30s linear infinite;
  transform-origin: center;
}

/* Navigation menu */
#main-menu {
  width: 100%;
  max-width: 320px; /* Increased from 280px */
  z-index: 49;
}

#main-menu ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem; /* Increased from 0.8rem */
}

#main-menu ul li {
  margin: 0;
  opacity: 0;
  animation: fadeIn 0.6s forwards;
}

#main-menu ul li:nth-child(1) {
  animation-delay: 0.1s;
}
#main-menu ul li:nth-child(2) {
  animation-delay: 0.2s;
}
#main-menu ul li:nth-child(3) {
  animation-delay: 0.3s;
}
#main-menu ul li:nth-child(4) {
  animation-delay: 0.4s;
}
#main-menu ul li:nth-child(5) {
  animation-delay: 0.5s;
}
#main-menu ul li:nth-child(6) {
  animation-delay: 0.6s;
}

.nav-button {
  display: block;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.35), rgba(142, 45, 226, 0.35));
  color: #fff;
  text-decoration: none;
  border: 2px solid rgba(255, 105, 180, 0.6);
  border-radius: 30px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: bold;
  position: relative;
  overflow: hidden;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  box-shadow: 
    0 4px 15px rgba(255, 105, 180, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.nav-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-button:hover {
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.75), rgba(142, 45, 226, 0.75));
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    0 8px 25px rgba(255, 105, 180, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
}

.nav-button:hover::before {
  left: 100%;
}

.nav-button:active {
  transform: translateY(-2px) scale(1.01);
}

/* Matsuda sprite */
.matsu-sprite {
  width: auto;
  height: 100%;
  max-height: 75vh; /* Larger sprite size */
  margin-top: auto;
  filter: drop-shadow(0 0 10px rgba(255, 105, 180, 0.5));
  transition: transform 0.3s ease;
  transform-origin: bottom center;
}

.matsu-sprite.flipped {
  transform: scaleX(-1); /* Flip horizontally */
}

.matsu-sprite:hover {
  transform: scaleX(-1) scale(1.03); /* Keep flipped and slightly scale up on hover */
}

/* Tooltip for menu interactions */
.tooltip {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 1.2rem;
  border-radius: 12px;
  font-size: 1.05rem;
  max-width: 300px;
  z-index: 100;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
  text-align: center;
  left: 50%;
  top: 15%;
  transform: translateX(-50%) translateY(20px);
  border: 2px solid #fff;
  box-shadow:
    0 0 0 2px #ff69b4,
    0 0 15px rgba(255, 105, 180, 0.6);
  font-family: "Aller", sans-serif;
  line-height: 1.4;
  /* Message box style additions */
  text-shadow: 0 0 2px #000;
  backdrop-filter: blur(2px);
}

.tooltip::before {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #fff;
  z-index: 1;
}

.tooltip::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(0, 0, 0, 0.85);
  z-index: 2;
}

.tooltip.visible {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Bubble animations in column 2 */
.bubble-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0; /* Behind content (z-index: 1) but in front of background */
  overflow: visible;
}

.bubble {
  position: absolute;
  background-color: rgba(255, 105, 180, 0.45);
  border: 2px solid rgba(255, 105, 180, 0.7);
  border-radius: 50%;
  opacity: 1;
  pointer-events: none;
  box-shadow:
    0 0 20px rgba(255, 105, 180, 0.8),
    inset 0 0 8px rgba(255, 255, 255, 0.5);
  /* Remove fixed animation properties - will be set via JavaScript */
}

/* Showcase container in column 3 */
.showcase-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.5rem;
  overflow: hidden; /* Prevent content from overflowing */
}

.section-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.8rem; /* Slightly reduced */
  flex-shrink: 0; /* Prevent header from shrinking */
}

.section-header h2 {
  color: #ff69b4;
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  text-shadow: 0 0 5px rgba(255, 105, 180, 0.7);
}

.section-line {
  height: 2px;
  width: 80%;
  background: linear-gradient(to right, transparent, #ff69b4, transparent);
  margin-bottom: 1rem;
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 columns */
  grid-template-rows: repeat(4, auto); /* 4 rows that size to content */
  gap: 0.6rem;
  margin-bottom: 0.8rem; /* Space for reroll button */
  flex: 1; /* Use available space instead of fixed height */
  min-height: 0; /* Allow flexbox to work properly */
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #ff69b4 rgba(0, 0, 0, 0.2);
  visibility: hidden; /* Hide initially to prevent flickering */
  overflow: hidden; /* Hide scrollbar initially */
  align-content: start; /* Align grid content to the top */
}

.showcase-grid.loaded {
  visibility: visible; /* Show when loaded */
  overflow-y: auto; /* Only enable scroll after loaded */
  overflow: hidden;
}

/* Reroll button for featured mods */
.reroll-button {
  align-self: center;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.4), rgba(142, 45, 226, 0.4));
  color: #fff;
  text-decoration: none;
  border: 2px solid rgba(255, 105, 180, 0.6);
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-top: auto;
  box-shadow: 
    0 3px 12px rgba(255, 105, 180, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  letter-spacing: 0.3px;
}

.reroll-button:hover {
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.7), rgba(142, 45, 226, 0.7));
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 6px 20px rgba(255, 105, 180, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
}

.reroll-button:active {
  transform: translateY(-1px) scale(1.03);
}

.reroll-button svg {
  width: 16px;
  height: 16px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.reroll-button:hover svg {
  transform: rotate(180deg);
}

.reroll-button.spinning svg {
  animation: spin 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.showcase-grid::-webkit-scrollbar {
  width: 6px;
}

.showcase-grid::-webkit-scrollbar-thumb {
  background-color: #ff69b4;
  border-radius: 4px;
}

.showcase-grid::-webkit-scrollbar-track {
  background-color: rgba(0, 0, 0, 0.2);
}

.showcase-item {
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid #ff69b4;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  opacity: 0; /* Start invisible to prevent flickering */
  transform: translateY(20px); /* Start slightly offset */
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.showcase-item.animate-in {
  animation: fadeIn 0.6s forwards;
}

.showcase-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(255, 105, 180, 0.4);
  background-color: rgba(255, 105, 180, 0.2);
  border: 1px solid #fff;
}

.showcase-img {
  width: 100%;
  aspect-ratio: 16 / 9; /* 16:9 aspect ratio for mod thumbnails */
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.showcase-title {
  padding: 0.4rem 0.5rem;
  font-size: 0.7rem;
  color: #fff;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.7);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  line-clamp: 2; /* Standard property */
  -webkit-box-orient: vertical;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Community links section */
.community-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: auto;
  padding: 1rem 0;
}

.social-link {
  display: inline-block;
  padding: 0.7rem 1.8rem;
  color: #fff;
  text-decoration: none;
  border-radius: 30px;
  font-weight: bold;
  font-size: 1rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.social-link:hover::before {
  width: 300px;
  height: 300px;
}

.social-link span {
  position: relative;
  z-index: 1;
}

.social-link.reddit {
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.4), rgba(200, 50, 0, 0.4));
  border: 2px solid rgba(255, 69, 0, 0.7);
  box-shadow: 
    0 4px 15px rgba(255, 69, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.social-link.reddit:hover {
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.7), rgba(220, 60, 0, 0.7));
  transform: translateY(-4px) scale(1.05);
  box-shadow: 
    0 8px 25px rgba(255, 69, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 100, 50, 0.9);
}

.social-link.discord {
  background: linear-gradient(135deg, rgba(114, 137, 218, 0.4), rgba(80, 100, 180, 0.4));
  border: 2px solid rgba(114, 137, 218, 0.7);
  box-shadow: 
    0 4px 15px rgba(114, 137, 218, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.social-link.discord:hover {
  background: linear-gradient(135deg, rgba(114, 137, 218, 0.7), rgba(90, 110, 190, 0.7));
  transform: translateY(-4px) scale(1.05);
  box-shadow: 
    0 8px 25px rgba(114, 137, 218, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(140, 160, 230, 0.9);
}

.social-link:active {
  transform: translateY(-2px) scale(1.02);
}

/* Footer text */
.footer-text {
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: auto;
  padding: 1rem 0;
}

.footer-text p {
  margin: 0.2rem 0;
}

/* Visual effects */
.glitch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.05) 3px,
    rgba(0, 0, 0, 0.05) 3px
  );
  pointer-events: none;
  opacity: 0.3;
  z-index: 2;
}

.pixel-noise {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  pointer-events: none;
  z-index: 3;
  animation: noise 0.5s steps(5) infinite;
}

/* Animations */
@keyframes pulse {
  0% {
    filter: drop-shadow(0 0 5px rgba(255, 105, 180, 0.5));
  }
  100% {
    filter: drop-shadow(0 0 15px rgba(255, 105, 180, 0.8));
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotate-reverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0% {
    transform: translateY(100vh);
    opacity: 1;
  }
  80% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-20vh);
    opacity: 0;
  }
}

@keyframes noise {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-5px, 5px);
  }
  40% {
    transform: translate(5px, -5px);
  }
  60% {
    transform: translate(-5px, -5px);
  }
  80% {
    transform: translate(5px, 5px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* Responsive styles */
@media (max-width: 1200px) {
  .showcase-grid {
    grid-template-columns: repeat(2, 1fr); /* Keep 2 columns */
    grid-template-rows: repeat(4, auto); /* Keep 4 rows that size to content */
  }
}

/* Media query for different aspect ratios */
@media (min-aspect-ratio: 16/9) {
  .column-container {
    max-height: 100vh;
  }

  .matsu-sprite {
    max-height: 70vh; /* Adjust for wider screens */
  }
}

@media (max-aspect-ratio: 4/3) {
  .matsu-sprite {
    max-height: 60vh; /* Smaller for narrower screens */
  }
}

/* Mobile layout - only show column 2 */
@media (max-width: 768px) {
  #column1,
  #column3,
  .divider {
    display: none; /* Hide side columns and dividers */
  }

  #column2 {
    width: 100%;
    flex: 1;
    height: auto;
    min-height: 100vh;
    padding: 2rem 1rem;
    justify-content: center;
  }

  .logo-container {
    margin: 0 auto 1.5rem;
    max-width: 200px;
    height: 200px;
  }

  #main-menu {
    width: 100%;
  }

  #main-menu ul {
    gap: 0.8rem;
  }

  .nav-button {
    width: 100%;
    padding: 0.8rem;
    text-align: center;
    font-size: 1.1rem;
  }

  .footer-text {
    margin-top: 2rem;
    padding: 1rem 0;
  }

  .footer-text p {
    font-size: 0.9rem;
  }

  /* Handle screen rotation better */
  @media (orientation: landscape) {
    #column2 {
      padding: 1rem;
    }

    .logo-container {
      max-width: 150px;
      height: 150px;
      margin-bottom: 1rem;
    }

    #main-menu ul {
      gap: 0.5rem;
    }

    .nav-button {
      padding: 0.6rem;
      font-size: 1rem;
    }
  }
}

@media (min-height: 900px) {
  /* For 1080p screens and larger */
  .logo-container {
    max-width: 250px;
    height: 250px;
  }

  #main-menu {
    max-width: 360px;
  }

  .nav-button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
  }

  .tooltip {
    padding: 1.4rem;
    font-size: 1.1rem;
    max-width: 320px;
  }
}

@media (max-height: 768px) {
  /* For smaller screens */
  .logo-container {
    max-width: 180px;
    height: 180px;
    margin-bottom: 1.5rem;
  }

  #main-menu ul {
    gap: 0.7rem;
  }

  .nav-button {
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
  }

  .tooltip {
    padding: 1rem;
    font-size: 0.9rem;
    max-width: 240px;
  }
}
