/* ========================================
   Hero Section – kiwebsites.com
   Default: DARK | body.revealed: LIGHT
   ======================================== */

.hero {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0;
  background: var(--pre-bg);
  transition: background 0.6s ease;
}

/* Subtle animated gradient background */
.hero__bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(223, 34, 50, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(240, 69, 85, 0.06) 0%, transparent 40%);
  animation: heroShift 12s ease-in-out infinite alternate;
  transition: opacity 0.8s var(--ease-out);
}

/* Background image layer */
.hero__bg-image {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('/assets/hero-bg.png') center center / cover no-repeat;
  opacity: 0.3;
  transition: opacity 0.6s ease;
  z-index: 0;
}

body.revealed .hero__bg-image {
  opacity: 0.08;
}

@keyframes heroShift {
  0% {
    transform: scale(1) translateX(0);
  }

  100% {
    transform: scale(1.05) translateX(2%);
  }
}

/* Inner container: side-by-side layout */
.hero__inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}

/* ---- Hero content blur during ripple ---- */
.hero__inner {
  filter: blur(calc(var(--ripple-intensity, 0) * 6px));
  transition: filter 0.2s ease;
}

/* ---- SVG distortion filter applied to main content ---- */
.page-content.is-distorting {
  filter: url(#ripple-filter);
}

/* ---- Text content (left side) ---- */
.hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-5xl) var(--space-3xl) var(--space-5xl) var(--space-4xl);
  max-width: 55%;
}

/* Wrapper for the two text states */
.hero__content-wrapper {
  position: relative;
}

.hero__title {
  font-size: clamp(2.5rem, 5vw, var(--fs-5xl));
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-lg);
  letter-spacing: -0.03em;
}

/* Dark state title (default) */
.hero__text-dark .hero__title {
  color: var(--pre-heading);
}

.hero__text-dark .hero__title-accent {
  background: var(--pre-gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Light state title */
.hero__text-light .hero__title {
  color: var(--gen-heading);
}

.hero__text-light .hero__title-accent {
  color: var(--gen-accent);
}

.hero__subtitle {
  font-size: var(--fs-md);
  max-width: 480px;
  margin: 0 0 var(--space-2xl) 0;
  line-height: var(--lh-relaxed);
}

.hero__text-dark .hero__subtitle {
  color: var(--pre-text-muted);
}

.hero__text-light .hero__subtitle {
  color: var(--gen-text-muted);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  padding: var(--space-md) var(--space-2xl);
  color: #ffffff;
  border-radius: var(--radius-full);
  transition: all 0.3s var(--ease-out);
  align-self: flex-start;
}

.hero__text-dark .hero__cta {
  background: var(--pre-gradient-accent);
  box-shadow: 0 0 30px rgba(223, 34, 50, 0.3);
}

.hero__text-dark .hero__cta:hover {
  box-shadow: 0 0 50px rgba(223, 34, 50, 0.5);
  transform: translateY(-3px);
}

.hero__text-light .hero__cta {
  background: var(--gen-accent);
}

.hero__text-light .hero__cta:hover {
  background: var(--gen-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(223, 34, 50, 0.3);
}

.hero__cta-arrow {
  transition: transform 0.3s var(--ease-out);
}

.hero__cta:hover .hero__cta-arrow {
  transform: translateX(4px);
}

/* ---- Portrait (right side) ---- */
.hero__portrait {
  position: relative;
  flex: 0 0 45%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

body.revealed .hero__portrait::before {
  background: var(--gen-accent);
  opacity: 0.15;
  box-shadow: none;
}

/* Decorative accent circle */
.hero__portrait::after {
  content: '';
  position: absolute;
  bottom: 10%;
  left: 5%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  opacity: 0.3;
  transition: all 0.6s ease;
  pointer-events: none;
}

body.revealed .hero__portrait::after {
  border-color: var(--gen-border);
  box-shadow: none;
}

.hero__portrait-img {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: auto;
  object-fit: cover;
  object-position: top center;
  z-index: 1;
  transition: opacity 0.4s ease;
  mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}

/* Robot visible by default, fades out during transition */
.hero__portrait-robot {
  opacity: calc(1 - var(--text-progress, 0));
  object-fit: contain;
  max-width: 520px;
}

/* Human hidden by default, fades in during transition */
.hero__portrait-human {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  opacity: var(--text-progress, 0);
}

/* Portrait RGB glitch during swap */
.hero__portrait {
  animation: none;
}

@keyframes portraitGlitch {

  0%,
  100% {
    filter: none;
  }

  20% {
    filter: drop-shadow(2px 0 0 rgba(255, 0, 0, 0.7)) drop-shadow(-2px 0 0 rgba(0, 255, 255, 0.7));
  }

  40% {
    filter: drop-shadow(-1px 0 0 rgba(255, 0, 0, 0.5)) drop-shadow(1px 0 0 rgba(0, 255, 255, 0.5));
  }

  60% {
    filter: drop-shadow(3px 0 0 rgba(255, 0, 0, 0.6)) drop-shadow(-3px 0 0 rgba(0, 0, 255, 0.6));
  }

  80% {
    filter: drop-shadow(0 0 0 transparent);
  }
}

/* ---- Scroll Hint ---- */
.hero__scroll-hint {
  position: absolute;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  color: var(--pre-text-muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: scrollPulse 2.5s ease-in-out infinite;
  z-index: 3;
  transition: color 0.6s ease;
}

@keyframes scrollPulse {

  0%,
  100% {
    opacity: 0.5;
    transform: translateX(-50%) translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(5px);
  }
}

body.revealed .hero__scroll-hint {
  color: var(--gen-text-muted);
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: var(--pre-border);
  position: relative;
  overflow: hidden;
  transition: background 0.6s ease;
}

body.revealed .hero__scroll-line {
  background: var(--gen-border);
}

.hero__scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--pre-gradient-accent);
  animation: scrollLine 2s ease-in-out infinite;
}

body.revealed .hero__scroll-line::after {
  background: var(--gen-accent);
}

body.revealed .hero {
  background: var(--gen-bg);
}

body.revealed .hero__bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(223, 34, 50, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(223, 34, 50, 0.04) 0%, transparent 50%);
}

@keyframes scrollBounce {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(8px);
  }
}

@keyframes scrollLine {
  0% {
    top: -100%;
  }

  50% {
    top: 100%;
  }

  100% {
    top: 100%;
  }
}