/* Main container */

/* Initial state for .hero-gradient (hidden by default) */
.hero-gradient {
  position: absolute;
  height: 900px;
  width: 100%;
  background: var(--gradient-background);
  z-index: 1;
  opacity: 0; /* Initially hidden */
  transition: opacity 1s ease-in-out; /* Smooth transition for opacity */
}

/* When screen size exceeds 1440px, fade the element in */
@media screen and (min-width: 1440px) {
  .hero-gradient {
    opacity: 1; /* Make visible */
  }
}

.hero_section_background {
  background: var(--black-total);
}
.hero_section {
  position: relative;
  height: 900px;
}

#hero-desktop,
#hero-mobile {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

#hero-mobile {
  display: none;
}

#hero-desktop {
  object-fit: contain;
}

.hero-background {
  position: absolute;
}

.hero_image_overlay {
  position: relative;
  display: flex;
  height: 100%;
  z-index: 2;
}

/* Empty space in center between overlay images (desktop only) */
.empty_overlay {
  flex: 1;
}

.overlay_item {
  /* display: flex; */
  /* Lines on hero section */
  display: none;
  z-index: 1;
}

/* Overlay images */
.overlay_item img,
.overlay_item picture {
  margin-left: -1px;
  margin-right: -1px;
  z-index: 1;
  -webkit-clip-path: inset(0 0 100% 0);
  clip-path: inset(0 0 100% 0);
  -webkit-animation: unfoldFromBottom 1.2s ease-out forwards;
  animation: unfoldFromBottom 1.2s ease-out forwards;
}

/* 1-st and last overlay images */
.overlay_item:nth-child(1),
.overlay_item:nth-child(4) {
  align-items: flex-end;
  -webkit-animation: borderAnimation1 ease 1s 0.6s forwards;
  animation: borderAnimation1 ease 1s 0.6s forwards;
}

/* 2-nd and 3-rd overlay images */
.overlay_item:nth-child(2),
.overlay_item:nth-child(5) {
  align-items: start;
  -webkit-animation: borderAnimation2 ease 1s 0.6s forwards;
  animation: borderAnimation2 ease 1s 0.6s forwards;
}

/* 1-st overlay image */
.overlay_item:nth-child(1) {
  width: 100%;
  max-width: 227px;
  padding-bottom: 177px;
}

/* 2-nd overlay image */
.overlay_item:nth-child(2) {
  width: 100%;
  max-width: 143px;
  padding-top: 125px;
}

/* 3-rd overlay image */
.overlay_item:nth-child(4) {
  width: 100%;
  max-width: 143px;
  padding-bottom: 177px;
}

/* 4-th overlay image */
.overlay_item:nth-child(5) {
  padding-top: 174px;
  width: 100%;
  max-width: 227px;
}

/* Text div */
.hero_image_text {
  color: var(--white);
  position: absolute;
  z-index: 10;
  /* top: 50%;
  left: 50%; */
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  -webkit-animation: fadeIn 0.5s linear forwards;
  animation: fadeIn 0.5s linear forwards;
  -webkit-animation-delay: 1.4s;
  animation-delay: 1.4s;

  > div {
    display: flex;
    flex-direction: column;
    /* gap: 24px; */
    align-items: start;
  }
}

.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 0;
}

.hero-video-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
  z-index: 10;
  color: white;
  width: 100%;
}

.hero-video-content .show-more,
.hero_image_text .show-more {
  background-color: var(--aist-red);
  padding: 21.5px 32px;
  color: var(--black-total);
  margin-top: 40px;
  transition: 0.3s ease all;
  text-transform: uppercase;
  text-align: center;
}

.hero-video-content .show-more:hover,
.hero_image_text .show-more:hover {
  background-color: var(--aist-red-hover);
  color: var(--white);
  transition: 0.3s ease all;
}

.hero_image_text > div {
  display: flex;
  justify-content: center;
}

.hero_image_text .h1 {
  text-align: start;
  text-transform: uppercase;
  width: 100%;
  max-width: 800px;
  word-break: keep-all; /* Prevent word breaking */
  overflow-wrap: break-word; /* Ensure long words wrap correctly */
  white-space: normal; /* Allow normal line breaks */
}

.hero_image_text > div > p {
  max-width: 345px;
  text-align: center;
}

/* Gray border (used in mobile only) */
.hero-mobile-border {
  display: none;
}

@media screen and (max-width: 1100px) {
  .overlay_item:nth-child(1) img {
    max-height: 180px;
  }

  .overlay_item:nth-child(2) img {
    max-height: 180px;
  }

  .overlay_item:nth-child(4) img {
    max-height: 150px;
  }

  .overlay_item:nth-child(5) img {
    max-height: 130px;
  }

  .hero_image_text .h1 {
    font-size: 70px;
  }
}

@media screen and (max-width: 1460px) {
  #hero-desktop {
    object-fit: cover;
  }
}

@media screen and (max-width: 900px) {
  .overlay_item:nth-child(4) {
    display: none;
  }

  .hero-video-content {
    gap: 16px;
  }

  .hero-video-content .show-more,
  .hero_image_text .show-more {
    margin-top: 24px;
  }

  /* Text div */
  .hero_image_text {
    > div {
      gap: 16px;
    }
  }
}

@media screen and (max-width: 767px) {
  /* Main container */
  .hero_section {
    height: 800px;
    /* padding: 0px 16px; */
  }

  /* Hides overlay section images*/
  .overlay_item img,
  .overlay_item picture {
    display: none;
  }

  /* Text div */
  .hero_image_text {
    position: unset;
    transform: none;
    height: 100%;
    justify-content: center;
    gap: 16px;
    /* hero mobile borders */
    /* border-left: 1px solid rgba(255, 255, 255, 0.2); */
    /* border-right: 1px solid rgba(255, 255, 255, 0.2); */
    -webkit-animation: fadeIn 0.5s ease-in forwards;
    animation: fadeIn 0.5s ease-in forwards;
    -webkit-animation-delay: 0s;
    animation-delay: 0s;
    padding: 0px;
  }

  /* Hides image overlay section */
  .hero_image_overlay {
    display: none;
  }

  /* Gray border */
  .hero-mobile-border {
    /* display: block; */
    /* Mobile hero line */
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 200px;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.2);
  }

  .hero_image_text > div > p {
    max-width: 325px;
  }

  /* Main text */
  .hero_image_text > div > .h1 {
    font-size: 40px;
  }

  /* Remove specific animations on mobile */
  .overlay_item img,
  .overlay_item picture,
  .overlay_item:nth-child(1),
  .overlay_item:nth-child(4),
  .overlay_item:nth-child(2),
  .overlay_item:nth-child(5) {
    -webkit-animation: none;
    animation: none;
  }

  .hero_image_text {
    color: var(--white);
    position: absolute;
    z-index: 10;
    top: 70%;
    left: 50%;

    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    opacity: 0;
    -webkit-animation: fadeIn 0.5s linear forwards;
    animation: fadeIn 0.5s linear forwards;
    -webkit-animation-delay: 1.4s;
    animation-delay: 1.4s;

    > div {
      display: flex;
      flex-direction: column;
      gap: 24px;
      align-items: start;
    }
  }

  .hero_image_text.container h1 {
    text-align: start;
  }
}

@media screen and (max-width: 479px) {
  /* Gray border */
  .hero-mobile-border {
    left: 150px;
  }
}

@media screen and (max-width: 390px) {
  #hero-desktop {
    display: none;
  }

  #hero-mobile {
    display: block;
  }

  /* Gray border */
  .hero-mobile-border {
    left: 110px;
  }
}

/* ANIMATIONS */

/* Used on images for them to "unfold" from bottom */
@-webkit-keyframes unfoldFromBottom {
  0% {
    opacity: 0;
    -webkit-clip-path: inset(0 0 100% 0);
    clip-path: inset(0 0 100% 0);
  }
  100% {
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
  }
}
@keyframes unfoldFromBottom {
  0% {
    opacity: 0;
    -webkit-clip-path: inset(0 0 100% 0);
    clip-path: inset(0 0 100% 0);
  }
  100% {
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
  }
}

/* When border exists from only one side */
@-webkit-keyframes borderAnimation1 {
  0% {
    box-shadow: none;
  }
  100% {
    box-shadow: -1px 0 0 0 rgba(255, 255, 255, 0.2);
  }
}
@keyframes borderAnimation1 {
  0% {
    box-shadow: none;
  }
  100% {
    box-shadow: -1px 0 0 0 rgba(255, 255, 255, 0.2);
  }
}

/* Borders from both sides */
@-webkit-keyframes borderAnimation2 {
  0% {
    box-shadow: none;
  }
  100% {
    box-shadow:
      1px 0 0 0 rgba(255, 255, 255, 0.2),
      -1px 0 0 0 rgba(255, 255, 255, 0.2);
  }
}
@keyframes borderAnimation2 {
  0% {
    box-shadow: none;
  }
  100% {
    box-shadow:
      1px 0 0 0 rgba(255, 255, 255, 0.2),
      -1px 0 0 0 rgba(255, 255, 255, 0.2);
  }
}

/* Used on text */
@-webkit-keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
