* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hero {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 5%;
    background: radial-gradient(ellipse at 30% 50%, #1a1a1a 0%, #000 70%);
}

.hero h1 {
    font-family: 'Montserrat', 'Poppins', sans-serif;
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: 300;
    line-height: 1.1;
    margin-bottom: 2rem;
    letter-spacing: -0.03em;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
}

.btn {
    padding: 14px 28px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-primary {
    background: #e5e5e5;
    color: #000;
}

.btn-primary:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255,255,255,0.1);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid #333;
}

.btn-secondary:hover {
    border-color: #666;
    background: rgba(255,255,255,0.05);
}

.hero-rects-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.rect-anim {
  position: absolute;
  left: -300px;
  width: 90px;
  height: 90px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff6b35 0%, #ffb88c 100%);
  opacity: 0.38;
  box-shadow: 0 4px 32px 0 rgba(255, 107, 53, 0.4);
  animation-timing-function: cubic-bezier(0.25, 1.2, 0.5, 1); /* Bardziej dynamiczny efekt sprężystości */
  animation-fill-mode: forwards;
  transition: all 0.35s ease-out; /* Płynniejsze przejścia dla wszystkich właściwości */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /* Pozwala na widoczność cienia */
  font-family: 'Consolas', 'Monaco', monospace;
  position: relative; /* Dla pozycjonowania ::after */
  will-change: transform, opacity, left, box-shadow; /* Optymalizacja renderowania */
}

.rect-anim.symbol {
  font-size: 36px;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

/* Dodatkowe style dla symboli programistycznych */
.rect-anim.symbol {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
  transition: text-shadow 0.3s ease;
}

/* Efekt świecenia podczas odbicia */
@keyframes text-glow {
  0% { text-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }
  50% { text-shadow: 0 0 25px rgba(255, 255, 255, 0.9); }
  100% { text-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }
}

/* Stosowanie efektu świecenia na symbole podczas odbicia */
.rect-1:hover, .rect-2:hover, .rect-3:hover, .rect-4:hover, .rect-5:hover {
  animation: text-glow 1.2s infinite;
  cursor: default;
}

.rect-1 {
  top: 15%;
  animation: rect-move 6.5s 0.2s forwards;
  will-change: transform, opacity, left;
  background: linear-gradient(135deg, #3572a5 0%, #5796c9 100%); /* Kolory HTML */
  border-radius: 8px;
  transform-origin: center;
  box-shadow: 0 0 15px rgba(53, 114, 165, 0.6);
  font-size: 42px;
  font-weight: 800;
}

.rect-2 {
  top: 30%;
  animation: rect-move-alt 7.2s 1.1s forwards;
  width: 80px;
  height: 80px;
  opacity: 0.5;
  will-change: transform, opacity, left;
  background: linear-gradient(135deg, #f0db4f 0%, #ffca28 100%); /* Kolory JavaScript */
  border-radius: 12px;
  color: #323330;
  text-shadow: none;
  box-shadow: 0 0 20px rgba(240, 219, 79, 0.6);
  font-size: 38px;
  letter-spacing: -0.05em;
}

.rect-3 {
  top: 45%;
  animation: rect-move-var 6.8s 0.7s forwards;
  width: 85px;
  height: 85px;
  opacity: 0.5;
  will-change: transform, opacity, left;
  background: linear-gradient(135deg, #e34c26 0%, #ff6347 100%); /* Kolory dla nawiasów */
  border-radius: 14px;
  font-size: 44px;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 25px rgba(227, 76, 38, 0.6);
  letter-spacing: -0.1em;
}

.rect-4 {
  top: 60%;
  animation: rect-move 8.1s 0.4s forwards;
  width: 65px;
  height: 65px;
  opacity: 0.5;
  will-change: transform, opacity, left;
  background: linear-gradient(135deg, #306998 0%, #5a9fd4 100%); /* Kolory Python */
  border-radius: 50%;
  color: #ffd43b;
  box-shadow: 0 0 20px rgba(48, 105, 152, 0.7);
  font-size: 35px;
  font-weight: bold;
}

.rect-5 {
  top: 75%;
  animation: rect-move-alt 7.7s 1.7s forwards;
  width: 70px;
  height: 70px;
  opacity: 0.5;
  will-change: transform, opacity, left, box-shadow; /* Dodano box-shadow do optymalizacji */
  background: linear-gradient(135deg, #61DAFB 0%, #A5E8FF 100%); /* Kolory React */
  border-radius: 6px;
  color: #282c34;
  box-shadow: 0 0 18px rgba(97, 218, 251, 0.7);
}
.rect-5.symbol {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.15em;
}

@keyframes rect-move {
  /* Etap 1: Wejście z lewej strony */
  0% { left: -300px; opacity: 0; transform: translateX(0) rotate(0) scale(0.6); }
  5% { opacity: 0.5; }
  
  /* Etap 2: Ruch przez cały ekran */
  25% { left: calc(100vw - 100px); opacity: 1; transform: translateX(0) rotate(5deg) scale(1); }
  
  /* Etap 3: Odbicie od prawej krawędzi */
  30% { left: calc(100vw - 100px); transform: translateX(-30px) rotate(-15deg) scale(1.1); box-shadow: 0 4px 45px 0 #ff6b3555; }
  35% { left: calc(100vw - 150px); transform: translateX(0) rotate(0) scale(1); }
  
  /* Pominięcie etapu ruchu w kierunku lewej strony tekstu */
  /* Bezpośrednie przemieszczenie na prawą stronę */
  45% { left: 65%; opacity: 1; transform: translateX(0) rotate(-5deg) scale(1); }
  
  /* Etap 5: Drobne ruchy na docelowej pozycji */
  50% { left: 70%; transform: translateX(10px) rotate(8deg) scale(1.05); box-shadow: 0 4px 45px 0 #ff6b3555; }
  55% { left: 72%; transform: translateX(0) rotate(0) scale(1); }
  
  /* Etap 6: Ostateczne ustawienie */
  65% { left: 82%; opacity: 1; }
  80% { transform: translateY(-5px) rotate(3deg) scale(1.05); } /* Delikatne "dosiadanie" */
  100% { left: 82%; opacity: 0.85; transform: translateY(0) rotate(0) scale(1); }
}

/* Druga wersja animacji - dla rect-2 i rect-5 */
@keyframes rect-move-alt {
  0% { left: -300px; opacity: 0; transform: translateX(0) rotate(0) scale(0.7); }
  5% { opacity: 0.5; }
  
  /* Inna prędkość i ścieżka */
  30% { left: calc(100vw - 120px); opacity: 1; transform: translateX(0) rotate(-10deg) scale(1); }
  
  /* Odbicie z większą energią */
  35% { left: calc(100vw - 120px); transform: translateX(-40px) rotate(18deg) scale(1.2); box-shadow: 0 4px 50px 0 #ff6b3566; }
  40% { left: calc(100vw - 180px); transform: translateX(0) rotate(0) scale(1); }
  
  /* Inna ścieżka do tekstu */
  50% { left: 44%; opacity: 1; transform: translateX(0) rotate(8deg) scale(1); }
  
  /* Silniejsze odbicie od tekstu */
  55% { left: 47%; transform: translateX(35px) rotate(-20deg) scale(1.15); box-shadow: 0 4px 50px 0 #ff6b3566; }
  60% { left: 60%; transform: translateX(0) rotate(0) scale(1); }
  
  /* Ustawienie przy tekście z innym efektem (lekko odsunięte, inna pozycja pionowa) */
  75% { left: 75%; opacity: 1; transform: translateY(0) scale(1); }
  85% { transform: translateY(-8px) rotate(-8deg) scale(1.1); } /* Inne "dosiadanie" */
  100% { left: 75%; opacity: 0.82; transform: translateY(0) rotate(0) scale(1); }
}

/* Trzecia wersja animacji - dla rect-3 */
@keyframes rect-move-var {
  0% { left: -300px; opacity: 0; transform: translateX(0) rotate(0) scale(0.6); }
  5% { opacity: 0.5; }
  
  /* Szybszy ruch przez ekran */
  20% { left: calc(100vw - 80px); opacity: 1; transform: translateX(0) rotate(15deg) scale(1); }
  
  /* Bardziej dynamiczne odbicie */
  25% { left: calc(100vw - 80px); transform: translateX(-50px) rotate(-25deg) scale(1.25); box-shadow: 0 4px 60px 0 #ff6b3577; }
  30% { left: calc(100vw - 160px); transform: translateX(0) rotate(0) scale(1); }
  
  /* Bardziej zawiła ścieżka do tekstu */
  40% { left: 50%; opacity: 1; transform: translateX(0) rotate(-12deg) scale(1); }
  
  /* Bardziej skomplikowane odbicie od tekstu */
  45% { left: 50%; transform: translateX(-30px) rotate(18deg) scale(1.2); box-shadow: 0 4px 55px 0 #ff6b3577; }
  50% { left: 60%; transform: translateX(15px) rotate(-10deg) scale(1.1); }
  55% { left: 65%; transform: translateX(0) rotate(0) scale(1); }
  
  /* Ustawienie przy tekście z bardziej dynamicznym efektem (najbardziej wysunięty) */
  70% { left: 80%; opacity: 1; }
  80% { transform: translateY(-10px) rotate(10deg) scale(1.1); } 
  90% { transform: translateY(-5px) rotate(-5deg) scale(1.05); }
  100% { left: 80%; opacity: 0.8; transform: translateY(0) rotate(0) scale(1); }
}

/* Efekt delikatnego pulsowania cienia dla symboli */
@keyframes shadow-pulse {
  0% { box-shadow: 0 0 15px rgba(255, 255, 255, 0.4); }
  50% { box-shadow: 0 0 25px rgba(255, 255, 255, 0.7); }
  100% { box-shadow: 0 0 15px rgba(255, 255, 255, 0.4); }
}

/* Zastosowanie animacji pulsowania po zakończeniu głównej animacji */
.rect-anim.symbol::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  z-index: -1;
  animation: shadow-pulse 3s ease-in-out infinite;
  animation-delay: 8s; /* Rozpocznie się po zakończeniu głównej animacji */
  will-change: box-shadow; /* Optymalizacja animacji cienia */
}

/* Hero content nad animacją */
.hero-content {
  position: relative;
  z-index: 2;
  margin-left: 40px; /* Zwiększony margines, aby tekst był bardziej odsunięty od lewej krawędzi */
}

/* Lepsza widoczność tekstu na różnych szerokościach ekranu */
.hero h1, .hero h2 {
    text-shadow: 0 2px 15px rgba(0,0,0,0.9); /* Dodajemy cień dla lepszej czytelności na wszystkich tłach */
}

/* Style dla tabletów (naprawienie problemu z przysłanianiem tekstu) */
@media (min-width: 901px) and (max-width: 1200px) {
    .hero {
        overflow-x: hidden; /* Zapobieganie przepełnieniu */
    }
    
    .hero-content {
        padding-right: 2rem;
        background: linear-gradient(90deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.7) 70%, rgba(0,0,0,0) 100%);
        padding: 2rem;
        border-radius: 8px;
        backdrop-filter: blur(5px);
        max-width: 55%;
    }
}

/* Ukrywanie animacji na urządzeniach mobilnych */
@media (max-width: 900px) {
    .flowing-stripes,
    .ambient-glow,
    .hero-rects-bg {
        display: none;
    }
    
    /* Pełna szerokość dla treści na telefonach */
    .hero-content {
        width: 100%;
        text-align: center;
        max-width: 100%;
        position: relative;
        z-index: 5;
    }
    
    /* Wyśrodkowanie przycisków na telefonie */
    .hero-buttons {
        justify-content: center;
    }
    
    /* Specjalna lekka animacja dla urządzeń mobilnych */
    .hero {
        position: relative;
        overflow: hidden;
    }
    
    /* Tylko jeden element animowany zamiast wielu */
    .mobile-symbol {
        display: block;
        position: absolute;
        width: 60px;
        height: 60px;
        border-radius: 8px;
        background: linear-gradient(135deg, rgba(255, 107, 53, 0.6) 0%, rgba(255, 184, 140, 0.4) 100%);
        box-shadow: 0 2px 15px rgba(255, 107, 53, 0.3);
        z-index: 1;
        font-family: 'Consolas', 'Monaco', monospace;
        font-size: 28px;
        color: rgba(255, 255, 255, 0.9);
        display: flex;
        align-items: center;
        justify-content: center;
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
        opacity: 0.7;
        animation: mobile-float 4s ease-in-out infinite;
        will-change: transform;
    }
    
    /* Symbol po prawej stronie u góry strony */
    .mobile-symbol {
        top: 20%;
        right: 15%;
    }
    
    /* Animacja unoszenia się i obracania dla symbolu mobilnego */
    @keyframes mobile-float {
        0% { transform: translateY(0) rotate(0); }
        50% { transform: translateY(-15px) rotate(5deg); }
        100% { transform: translateY(0) rotate(0); }
    }
    
    /* Ukrywanie standardowych rect-anim */
    .rect-anim {
        display: none;
    }
}