/**
 * Copyright (c) 2026 KDTech
 * Author: david@KDTech
 * All rights reserved.
 *
 * KDTechGroup website — hero
 *
 * The opening scene: drifting prism light over a faint blueprint grid, the
 * word-by-word headline, the "now building" scramble ticker, the calls to
 * action and the orb stage with its slowly turning prism halo.
 */

.hero {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  padding-block: calc(var(--nav-h) + clamp(40px, 7vw, 88px)) clamp(56px, 7vw, 96px);
  overflow: hidden;
}

/* Blueprint grid, faded toward the edges. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 60% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 60% 40%, #000 30%, transparent 100%);
}

.prism-light {
  position: absolute;
  inset: -10% -10% auto;
  z-index: -1;
  height: 1000px;
  pointer-events: none;
  filter: blur(100px);
  opacity: 0.5;
}

.prism-light span {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: drift 24s ease-in-out infinite alternate;
}

.prism-light span:nth-child(1) {
  inset-inline-start: 50%;
  top: 4%;
  width: 520px;
  height: 460px;
  background: var(--violet);
}

.prism-light span:nth-child(2) {
  inset-inline-start: 68%;
  top: 22%;
  width: 420px;
  height: 380px;
  background: var(--pink);
  opacity: 0.7;
  animation-duration: 28s;
  animation-delay: -8s;
}

.prism-light span:nth-child(3) {
  inset-inline-start: 8%;
  top: 0;
  width: 420px;
  height: 340px;
  background: var(--cyan);
  opacity: 0.45;
  animation-duration: 32s;
  animation-delay: -14s;
}

@keyframes drift {
  50% {
    transform: translate(70px, 50px) scale(1.12);
  }
  100% {
    transform: translate(-60px, 80px) scale(0.92);
  }
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

/* ---------- Copy ---------- */

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.03);
  color: var(--text-2);
  font-size: 13px;
  box-shadow: var(--highlight);
  backdrop-filter: blur(12px);
}

[dir="rtl"] .hero-kicker {
  padding: 6px 6px 6px 16px;
}

.hero-kicker b {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--prism);
  color: #08080d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 84px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-title .line {
  display: block;
}

.hero-title .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) rotate(3deg);
  filter: blur(12px);
}

.is-ready .hero-title .w {
  animation: rise 1000ms var(--ease-out) forwards;
  animation-delay: calc(var(--wi) * 70ms + 200ms);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* The prism line: each word paints its slice of one gradient (set by main.js). */
.hero-title .prism-text.is-split {
  background: none;
  animation: none;
}

.hero-title .prism-text.is-split .w {
  background-image: var(--prism);
  background-size: var(--lw, 100%) 100%;
  background-position: calc(var(--wx, 0px) * -1) 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 560px;
  margin: 28px 0 0;
  color: var(--text-2);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-block-start: 36px;
}

.now-building {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 40px 0 0;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 13px;
}

.now-building .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgb(52 211 153 / 0.6);
  animation: ping 2s ease-out infinite;
}

@keyframes ping {
  70%,
  100% {
    box-shadow: 0 0 0 10px rgb(52 211 153 / 0);
  }
}

.now-building [data-ticker] {
  min-width: 14ch;
  color: var(--text-1);
  font-weight: 500;
  direction: ltr;
}

.hero-fade {
  opacity: 0;
  transform: translateY(14px);
}

.is-ready .hero-fade {
  animation: rise 900ms var(--ease-out) forwards;
  animation-delay: calc(var(--d, 0) * 1ms);
}

/* ---------- Orb ---------- */

.orb-stage {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
}

/* A thin prism ring that turns slowly behind the orb. */
.orb-stage::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  padding: 1px;
  background: conic-gradient(from 0deg, var(--cyan), var(--violet), var(--pink), var(--amber), var(--cyan));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  animation: spin 40s linear infinite;
}

.orb-stage::after {
  content: "";
  position: absolute;
  inset: 22%;
  z-index: -1;
  border-radius: 50%;
  background: var(--prism);
  filter: blur(90px);
  opacity: 0.28;
}

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

.orb-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.orb-hint {
  position: absolute;
  inset-inline: 0;
  bottom: 2%;
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

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

@media (max-width: 960px) {
  .hero {
    min-height: 0;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .orb-stage {
    max-width: 480px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title .w,
  .hero-fade {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
