/* LEGO Color Palette */
:root {
  --lego-red: #D62828;
  --lego-yellow: #F7D400;
  --lego-blue: #0075C9;
  --lego-green: #2E7D32;
  --lego-black: #111;
  --lego-white: #fff;
  --lego-orange: #FF8F00;
  
  /* Gradients for depth */
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.2);
  --shadow-heavy: rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--lego-white);
  background: var(--lego-black);
  overflow-x: hidden;
  position: relative;
}

/* Brick Wall Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 120%;
  height: 120%;
  z-index: -1;
  background-image: url('assets/banner-lego.jpg');
  background-size: 400px 300px;
  background-repeat: repeat;
  opacity: 0.4;
  animation: brickParallax 20s linear infinite;
}

@keyframes brickParallax {
  0% { transform: translateY(0); }
  100% { transform: translateY(80px); }
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Sticky Header */
.sticky-header {
  position: fixed;
  top: -100px;
  left: 0;
  right: 0;
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  transition: transform 0.3s ease;
  border-bottom: 1px solid var(--glass-border);
}

.sticky-header.visible {
  transform: translateY(100px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.mini-logo {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--lego-yellow);
}

.header-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

.header-logo-fallback {
  display: none;
  font-size: 2rem;
  margin-right: 10px;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 20px;
}

.hero-content {
  z-index: 1;
}

/* Hero Builder Characters */
.hero-builder {
  position: absolute;
  z-index: 0;
  opacity: 0.8;
  pointer-events: none;
}

#heroBuilder1 {
  bottom: 10%;
  right: 5%;
}

#heroBuilder2 {
  bottom: 15%;
  left: 8%;
}

.builder-img {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

/* Floating Builder Characters */
.floating-builder {
  position: absolute;
  z-index: 0;
  opacity: 0.7;
  pointer-events: none;
}

#floatingBuilder1 {
  top: 20%;
  left: 10%;
}

#floatingBuilder2 {
  top: 60%;
  right: 15%;
}

#floatingBuilder3 {
  top: 30%;
  left: 5%;
}

#floatingBuilder4 {
  top: 50%;
  right: 8%;
}

.floating-builder-img {
  width: 80px;
  height: auto;
  filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.2));
}

.logo-container {
  margin-bottom: 2rem;
}

.hero-logo-img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  box-shadow: 
    0 10px 30px var(--shadow-heavy),
    0 0 0 3px var(--lego-yellow),
    inset 0 -5px 10px rgba(0, 0, 0, 0.2);
}

.hero-logo-fallback {
  display: none;
  font-size: 8rem;
  animation: float 3s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 900;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--lego-yellow), var(--lego-red), var(--lego-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 2px 2px 4px var(--shadow-medium);
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  margin-bottom: 3rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 300;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.cta-button {
  background: linear-gradient(135deg, var(--glass-bg), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  color: var(--lego-white);
  padding: 1rem 2rem;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

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

.cta-button.primary {
  background: linear-gradient(135deg, var(--lego-yellow), var(--lego-orange));
  color: var(--lego-black);
  box-shadow: 
    0 8px 25px rgba(247, 212, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cta-button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 12px 35px rgba(247, 212, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cta-button.secondary {
  border: 2px solid var(--lego-blue);
  color: var(--lego-blue);
}

.cta-button.secondary:hover {
  background: var(--lego-blue);
  color: var(--lego-white);
  transform: translateY(-2px);
}

.header-cta {
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* Ticker */
.ticker-wrapper {
  background: var(--lego-red);
  padding: 15px 0;
  overflow: hidden;
  position: relative;
}

.ticker {
  white-space: nowrap;
}

.ticker-content {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--lego-white);
  animation: scroll 15s linear infinite;
  letter-spacing: 2px;
}

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

/* Minifigs */
.minifigs-container {
  height: 120px;
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
  border-top: 2px solid var(--lego-yellow);
  border-bottom: 2px solid var(--lego-yellow);
}

.minifig {
  position: absolute;
  top: 20px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.minifig:hover {
  transform: scale(1.1);
}

/* Why Section */
.why-section {
  padding: 80px 0;
  position: relative;
  z-index: 1;
}

.section-title {
  text-align: center;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  margin-bottom: 3rem;
  color: var(--lego-yellow);
  text-shadow: 2px 2px 4px var(--shadow-medium);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.card {
  background: linear-gradient(135deg, var(--glass-bg), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(15px);
  padding: 2.5rem 2rem;
  border-radius: 20px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 
    0 15px 50px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
}

.card h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--lego-yellow);
}

.card p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
}

/* Join Section */
.join-section {
  padding: 80px 0;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
}

.join-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.join-button {
  background: linear-gradient(135deg, var(--glass-bg), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  color: var(--lego-white);
  padding: 1.2rem 2.5rem;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 8px 25px var(--shadow-medium);
}

.join-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px var(--shadow-heavy);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
}

/* Footer */
.footer {
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legal {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--lego-yellow);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--lego-white);
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--lego-green);
  color: var(--lego-white);
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 8px 25px var(--shadow-heavy);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 1001;
  font-weight: 600;
}

.toast.show {
  transform: translateX(0);
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-10px) rotate(1deg); }
  66% { transform: translateY(5px) rotate(-1deg); }
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .hero-ctas {
    flex-direction: column;
    align-items: center;
  }
  
  .cta-button {
    width: 100%;
    max-width: 280px;
  }
  
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .join-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .join-button {
    width: 100%;
    max-width: 280px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 1rem;
  }
  
  .header-content {
    padding: 10px 15px;
  }
  
  .hero-logo-img {
    width: 120px;
    height: 120px;
  }
  
  .ticker-content {
    font-size: 1.2rem;
  }
  
  #heroBuilder1 {
    bottom: 5%;
    right: 2%;
  }
  
  #heroBuilder2 {
    bottom: 8%;
    left: 3%;
  }
  
  .builder-img {
    width: 80px;
  }
  
  .floating-builder {
    display: none; /* Hide floating builders on mobile to reduce clutter */
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }
  
  .hero {
    padding: 15px;
  }
  
  .card {
    padding: 2rem 1.5rem;
  }
  
  .hero-logo-img {
    width: 100px;
    height: 100px;
  }
}

/* Image fallback handling */
.hero-logo-img[src=""],
.hero-logo-img:not([src]),
.header-logo-img[src=""],
.header-logo-img:not([src]) {
  display: none;
}

.hero-logo-img[src=""]:nth-child(1) ~ .hero-logo-fallback,
.hero-logo-img:not([src]):nth-child(1) ~ .hero-logo-fallback,
.header-logo-img[src=""]:nth-child(1) ~ .header-logo-fallback,
.header-logo-img:not([src]):nth-child(1) ~ .header-logo-fallback {
  display: block;
}
