/* Loader styling */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease;
}

#loader.hide {
  opacity: 0;
  pointer-events: none;
}

/* Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255,255,255,0.3);
  border-top: 5px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

/* Content reveal */
#content {
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease;
}

#content.show {
  opacity: 1;
  visibility: visible;
}

h1 {
  text-align: center;
  margin-bottom: 5rem; /* spacing below so grid doesn't touch */
}

.littletext { font-size: 0.75rem; }

.containersimple {
  padding: 100px 0 40px;
}

/* ---------- Hero ---------- */
.hero-grid { display: grid; grid-template-columns: 1.3fr .9fr; align-items: start; }


/* ---------- Hero Texts Left Column ---------- */

/* default: animations apply */
.hero-texts {
  position: relative; 
  height: 84%;
}

.hero-text {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0;
  margin: 0;
  animation: fadeCycle 30s infinite;
}

.hero-text.top {
  top: 0;
  animation-delay: 0s;
}
.hero-text.center {
  top: 50%;
  transform: translateY(-50%);
  animation-delay: 10s;
}
.hero-text.bottom {
  bottom: 0;
  animation-delay: 20s;
}

@keyframes fadeCycle {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  40%  { opacity: 1; }
  80%  { opacity: 0; }
  100% { opacity: 0; }
}




/* ---------- GALLERY ON HOVER ---------- */

/* Initially hide the gallery-row */
.hero-card-wrapper .gallery-row {
  max-height: 0;              /* collapses container */
  overflow: hidden;           /* hide content */
  flex-direction: row-reverse;
  gap: 8px;
  pointer-events: none;
  opacity: 1;                 /* container itself can stay visible for transition */
  transition: max-height 0.5s ease;  /* smooth expand */
}

/* Each image initially invisible */
.hero-card-wrapper .gallery-row img {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* On hover of hero-card-clear, expand gallery */
.hero-card-wrapper .hero-card-clear:hover + .gallery-row {
  max-height: 600px;          /* or big enough to fit all images */
  pointer-events: auto;
}

/* Sequential fade-in for images */
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(1) {
  transition-delay: 0.1s;
  opacity: 1;
}
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(2) {
  transition-delay: 0.2s;
  opacity: 1;
}
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(3) {
  transition-delay: 0.3s;
  opacity: 1;
}
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(4) {
  transition-delay: 0.4s;
  opacity: 1;
}
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(5) {
  transition-delay: 0.5s;
  opacity: 1;
}
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(6) {
  transition-delay: 0.6s;
  opacity: 1;
}
.hero-card-wrapper .hero-card-clear:hover + .gallery-row img:nth-child(7) {
  transition-delay: 0.7s;
  opacity: 1;
}

.hover-text {
  opacity: 0;           /* hidden initially */
  height: 0;            /* collapses vertical space */
  overflow: hidden;     /* hides content */
  transition: opacity 0.5s ease, height 0s ease 1.2s; /* delay height change after fade */
  
}

.hero-card-wrapper:hover .hover-text {
  opacity: 1;           /* fade in */
  height: auto;         /* expand to natural height */
  transition: opacity 0.5s ease 1.2s, height 0s ease 1.7s; 
  /* fade starts at 1.2s, then height becomes auto at 1.7s so space is allocated after fade */
}

/* Use a class to mark “revealed” */
.hero-card-wrapper.revealed .hover-text {
  opacity: 1;
  height: auto;
  overflow: visible;
}

/* Only for the last gallery-row */
.hero-card-wrapper:last-child .gallery-row.hover-active img {
  opacity: 1; /* trigger fade-in for last gallery images */
}

/* ---------- Footer ---------- */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--bg); text-align: center; }

.footer-grid { 
  display: flex; 
  flex-direction: column;   /* stack vertically */
  align-items: center;      /* center horizontally */
  justify-content: center;  /* center vertically if height expands */
  gap: 0.1rem;                /* spacing between image and text */
}

.footer-grid p {
  margin: 0; line-height: 1.4; /* tweak for tighter look */
}

.brand.small { 
  font-size: 1.6rem; 
}

/* ---------- Responsive ---------- */

@media (max-width: 920px){

  .hero-cards { width: min(100% - 1.8rem, var(--maxw));  margin-inline: auto; }

  .container.hero-grid > h2 { padding-left: 1.4rem; padding-right: 1.4rem; padding-bottom: 2rem; box-sizing: border-box; }

  .hero-grid { grid-template-columns: 1fr; }

}

@media (max-width: 820px){
  .logo-wrapper { display: flex; justify-content: center; align-items: center; width: 100px; margin-left: auto; margin-right: auto; }

  .hero-cards { width: min(100% - 1rem, var(--maxw));  margin-inline: auto; }

  .container.hero-grid > h2 { padding-left: 1rem; padding-right: 1rem; padding-bottom: 1rem; }

  .hero-texts { position: static; }
  .hero-text { 
    position: static;
    opacity: 1 !important;
    animation: none !important;
  }

  .brand.small { 
  font-size: 1rem; 
  }

  .footer-image {width: 16px; }
  
  .hover-text {
    height: auto;      /* let content expand naturally */
    overflow: visible !important; /* show text */
    opacity: 0; 
  }

  /* Active class triggered by JS on scroll */
  .hover-text.active {
    opacity: 1;
  }
}

@media (max-width: 520px){
  p { font-size: 0.85rem; }

  h2 { font-size: 1.4rem; }

  .hero { padding: 4rem 0 2.6rem; }

  .container.hero-grid > h2 { padding-bottom: 0.7rem; }

  .littletext {font-size: 0.65rem; }

  .btn-tres {font-size: 0.8rem; }

}

@media (max-width: 400px){
  p { font-size: 0.85rem; padding-right: 7px; }

  h2 { font-size: 1.25rem; text-align: start; }

  .hero { padding: 4rem 0 2.4rem; }

  .container.hero-grid > h2 { padding-left: 0.8rem; padding-right: 0.8rem; padding-bottom: 0.6rem; }

  .littletext {font-size: 0.7rem; }
}

@media (max-width: 380px){

  h2 { font-size: 1.15rem; }

}