/* --- LAYOUT PRINCIPAL --- */
.krx-hero-section {
  position: relative;
  height: calc(100vh - var(--topbar-height, 40px) - var(--header-height-initial, 99px));
  max-height: calc(100vh - var(--topbar-height, 40px) - var(--header-height-initial, 99px)); /* prevent 1px overflow/rounding */
  min-height: calc(600px - var(--topbar-height, 40px) - var(--header-height-initial, 99px));
  width: 100%;
  overflow: hidden;
  overflow: clip; /* avoid scrollbar flash on some browsers */
  display: flex;
  align-items: center;
  background-color: #111827; /* Fallback color */
  font-family: 'Inter', sans-serif;
}

/* --- BACKGROUND SLIDES & TRANSITIONS --- */
.krx-hero-backgrounds {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.krx-bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* WebP first (via image-set), JPG fallback */
  background-image: var(--krx-hero-jpg);
  background-image: -webkit-image-set(
    var(--krx-hero-webp) 1x,
    var(--krx-hero-jpg) 1x
  );
  background-image: image-set(
    var(--krx-hero-webp) type("image/webp") 1x,
    var(--krx-hero-jpg) type("image/jpeg") 1x
  );
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 1.5s ease-in-out, transform 6s ease-out;
  will-change: opacity, transform;
}

.krx-bg-slide.is-active {
  opacity: 1;
  transform: scale(1);
}

/* --- GRADIENT OVERLAY --- */
.krx-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgb(5 5 5 / 26%) 0%, rgb(5 5 5 / 23%) 45%, rgb(5 5 5 / 30%) 100%);
  z-index: 1;
  pointer-events: none;
}

/* --- CONTENT (Aliniere Stânga) --- */
.krx-hero-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: flex-start;
}

.krx-hero-content {
  max-width: 730px;
  min-height: 530px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.krx-hero-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  border-radius: 2px;
  align-self: flex-start;
}

.krx-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 4rem;
  line-height: 1.1;
  font-weight: 500;
  margin-bottom: 1.5rem;
  margin-left: 0;
  margin-right: 0;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  align-self: flex-start;
}

.krx-hero-desc {
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 3rem;
  max-width: 500px;
  align-self: flex-start;
}

/* Buttons */
.krx-hero-buttons {
  display: flex;
  gap: 1.5rem;
  align-self: flex-start;
  width: auto; /* Auto width for proper left alignment */
}

.krx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 32px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 2px;
  border: 1px solid transparent;
}

.krx-btn-white {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.krx-btn-white:hover {
  background: #D4AF37;
  border-color: #D4AF37;
  color: #fff;
}

.krx-btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(2px);
}

.krx-btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

/* --- NAVIGATION (Dreapta Jos) --- */
.krx-hero-nav {
  position: absolute;
  bottom: 3rem;
  right: 3rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.krx-slide-counter {
  color: rgba(255, 255, 255, 0.6);
  font-family: monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.krx-slide-counter .divider {
  margin: 0 0.5rem;
  opacity: 0.5;
}

.krx-hero-dots {
  display: flex;
  gap: 12px;
}

.krx-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  border-radius: 99px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.krx-dot.is-active {
  width: 32px;
  background: #D4AF37;
}

.krx-dot:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.8);
}

/* --- HERO ENTRANCE ANIMATIONS (Staggered Slide from Left) --- */

/* Initial state - hidden, off to the left */
.krx-hero-animate {
  opacity: 0;
  transform: translateX(-80px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Visible state - triggered by JS */
.krx-hero-animate.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Staggering is controlled in JS (deterministic order). */

/* Title gets extra dramatic effect */
.krx-hero-title.krx-hero-animate {
  transform: translateX(-100px);
  transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Ensure title resets correctly when visible */
.krx-hero-title.krx-hero-animate.is-visible {
  transform: translateX(0);
}

/* Buttons slide up instead of left for variety */
.krx-hero-buttons.krx-hero-animate {
  transform: translateY(30px);
}

/* Legacy support for old class */
.animate-fade-up {
  animation: fadeInUp 1s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
  .krx-hero-section {
    height: 650px; /* Fixed height on mobile to ensure all elements fit */
    min-height: 650px;
  }

  /* Mobile: hide the top badge/tagline */
  .krx-hero-tag {
    display: none;
  }
  .krx-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(5, 5, 5, .5) 0%, rgba(5, 5, 5, .45) 45%, rgba(5, 5, 5, .65) 100%);
    backdrop-filter: blur(2px);
  }
  .krx-hero-container {
    justify-content: center;
    text-align: center;
   
  }
  .krx-hero-content {
    margin: 0 auto;
  }
  .krx-hero-title {
    font-size: 2.5rem;
  }
  .krx-hero-buttons {
    flex-direction: column;
    gap: 1rem;
    width: 100%; /* Full width on mobile for stacked buttons */
  }
  .krx-hero-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 2rem;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;        /* keep counter + dots on ONE line */
    align-items: center;
    justify-content: center;
    gap: 12px;                /* smaller than desktop gap */
    width: calc(100% - 2rem); /* prevent overflow on very small screens */
    max-width: 420px;
  }
  .krx-slide-counter {
    white-space: nowrap;
    flex: 0 0 auto;
    font-size: 11px;
  }
  .krx-hero-dots {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .krx-dot {
    width: 5px;
    height: 5px;
  }
  .krx-dot.is-active {
    width: 26px;
  }
  .krx-btn {
    width: 100%;
  }
  
  /* Mobile: Animate from bottom instead of left (centered content) */
  .krx-hero-animate {
    transform: translateY(40px);
  }
  
  .krx-hero-title.krx-hero-animate {
    transform: translateY(50px);
  }

  .krx-hero-title.krx-hero-animate.is-visible {
    transform: translateY(0);
  }
  
  .krx-hero-buttons.krx-hero-animate {
    transform: translateY(30px);
  }
}
