/**
 * Hero adapted from Marketeam-style prompt → Cowdlly genie.
 * Concentric orbits around genie, rotating CTA border, service ticker.
 */

@property --border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  --hero-accent: #a068ff;
  --hero-ink: #060218;
  --hero-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.hero {
  position: relative;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7, 6, 12, 0.78), rgba(7, 6, 12, 0.94)),
    radial-gradient(ellipse 70% 60% at 75% 45%, rgba(160, 104, 255, 0.2), transparent 55%),
    url("https://images.higgs.ai/?default=1&output=webp&url=https%3A%2F%2Fd8j0ntlcm91z4.cloudfront.net%2Fuser_38xzZboKViGWJOttwIXH07lWA1P%2Fhf_20260624_111401_56af5012-2263-45d3-849a-8688084d7c2a.png&w=1280&q=85")
      center center / cover no-repeat;
  pointer-events: none;
}

.hero-shell {
  position: relative;
  z-index: 1;
  background:
    radial-gradient(circle at 82% 28%, rgba(160, 104, 255, 0.14), transparent 42%),
    rgba(17, 12, 28, 0.55) !important;
  backdrop-filter: blur(8px);
  overflow: visible !important;
}

.hero-content {
  animation: hero-fade-up 1s var(--hero-ease) both;
}

.hero-content > * {
  opacity: 1 !important;
  animation: none !important;
  transform: none !important;
  filter: none !important;
}

.hero-visual {
  opacity: 1 !important;
  animation: hero-scale-in 1.2s var(--hero-ease) 0.25s both !important;
}

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(36px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-scale-in {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Rotating gradient border CTA */
.btn-border-wrap {
  position: relative;
  display: inline-flex;
  border-radius: 999px;
  isolation: isolate;
}

.btn-border-wrap::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: inherit;
  padding: 3px;
  background: conic-gradient(
    from var(--border-angle),
    var(--hero-accent),
    #070319,
    var(--hero-accent),
    #070319,
    var(--hero-accent)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: border-spin 3s linear infinite;
}

@keyframes border-spin {
  to {
    --border-angle: 360deg;
  }
}

.btn-border-wrap .btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--hero-ink) !important;
  background-image: none !important;
  animation: none !important;
  border: 0;
  z-index: 1;
}

.btn-border-wrap .btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-accent);
  transform: translateX(-100%);
  transition: transform 0.4s var(--hero-ease);
  z-index: -1;
}

.btn-border-wrap .btn-primary:hover::after {
  transform: translateX(0);
}

/* Orbits stage — genie in center */
.hero-orbits {
  --orbit-scale: 1;
  position: relative;
  width: min(640px, 100%);
  aspect-ratio: 1;
  margin-inline: auto;
  display: grid;
  place-items: center;
  transform: scale(var(--orbit-scale));
  transform-origin: center center;
}

.hero-orbit,
.hero-node-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  pointer-events: none;
}

.hero-orbit {
  padding: 1px;
  background: linear-gradient(
    180deg,
    rgba(217, 161, 255, 0) 0%,
    rgba(217, 161, 255, 0.75) 43%,
    rgba(217, 161, 255, 0) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.hero-orbit-1,
.hero-node-ring-1 {
  width: 42%;
  height: 42%;
}
.hero-orbit-2,
.hero-node-ring-2 {
  width: 58%;
  height: 58%;
}
.hero-orbit-3,
.hero-node-ring-3 {
  width: 74%;
  height: 74%;
}
.hero-orbit-4,
.hero-node-ring-4 {
  width: 92%;
  height: 92%;
}

/* Rings + nodes share the SAME spin — locked to orbit path */
.hero-orbit-1,
.hero-node-ring-1 {
  animation: spin-ccw 32s linear infinite;
}
.hero-orbit-2,
.hero-node-ring-2 {
  animation: spin-cw 42s linear infinite;
}
.hero-orbit-3,
.hero-node-ring-3 {
  animation: spin-cw 52s linear infinite;
}
.hero-orbit-4,
.hero-node-ring-4 {
  animation: spin-ccw 62s linear infinite;
}

@keyframes spin-cw {
  to {
    transform: rotate(360deg);
  }
}
@keyframes spin-ccw {
  to {
    transform: rotate(-360deg);
  }
}

/* Arm places pill exactly on circumference (top edge of ring) */
.hero-orbit-arm {
  --angle: 0deg;
  position: absolute;
  inset: 0;
  transform: rotate(var(--angle));
}

.hero-orbit-pill {
  --angle: inherit;
  position: absolute;
  top: 0;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 10px 11px;
  border-radius: 999px;
  border: 1px solid rgba(217, 161, 255, 0.45);
  background: rgba(10, 6, 24, 0.92);
  color: #f3e8ff;
  box-shadow: 0 0 0 1px rgba(160, 104, 255, 0.12);
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(calc(-1 * var(--angle)));
}

.hero-orbit-pill svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--hero-accent);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-orbit-pill span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/*
 * Keep icon+label upright while ring rotates:
 * opposite of ring spin AND cancel inherited --angle from the arm.
 */
.hero-node-ring-1 .hero-orbit-pill {
  animation: unspin-cw 32s linear infinite;
}
.hero-node-ring-2 .hero-orbit-pill {
  animation: unspin-ccw 42s linear infinite;
}
.hero-node-ring-3 .hero-orbit-pill {
  animation: unspin-ccw 52s linear infinite;
}
.hero-node-ring-4 .hero-orbit-pill {
  animation: unspin-cw 62s linear infinite;
}

@keyframes unspin-cw {
  from {
    transform: translate(-50%, -50%) rotate(calc(-1 * var(--angle)));
  }
  to {
    transform: translate(-50%, -50%) rotate(calc(-1 * var(--angle) + 360deg));
  }
}
@keyframes unspin-ccw {
  from {
    transform: translate(-50%, -50%) rotate(calc(-1 * var(--angle)));
  }
  to {
    transform: translate(-50%, -50%) rotate(calc(-1 * var(--angle) - 360deg));
  }
}

.hero-orbits .hero-video-wrap {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 5;
  width: min(280px, 44%) !important;
  max-width: none;
  margin: 0 !important;
  translate: none !important;
  transform: translate(-50%, -50%) !important;
  animation: none !important;
}

.hero-orbits .hero-genie-aura,
.hero-orbits .hero-genie-sparkles {
  display: none;
}

.hero-orbits .hero-genie-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  mix-blend-mode: normal;
  background: transparent !important;
}

.hero-orbits .hero-genie-video-source,
.hero-orbits .hero-genie-video-source.is-fallback-visible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  mix-blend-mode: normal !important;
  pointer-events: none;
}

/* Service ticker */
.hero-ticker {
  position: relative;
  margin-top: 22px;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  animation: hero-fade-up 1s var(--hero-ease) 0.55s both;
}

.hero-ticker-track {
  display: flex;
  gap: 48px;
  width: max-content;
  animation: ticker-scroll 22s linear infinite;
}

.hero-ticker-track span {
  flex: 0 0 auto;
  padding: 8px 0;
  color: rgba(243, 232, 255, 0.72);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes ticker-scroll {
  to {
    transform: translateX(-50%);
  }
}

html[dir="rtl"] .hero-ticker-track {
  animation-name: ticker-scroll-rtl;
}

@keyframes ticker-scroll-rtl {
  to {
    transform: translateX(50%);
  }
}

@media (max-width: 1280px) {
  .hero-orbits {
    --orbit-scale: 0.92;
  }
}

@media (max-width: 1024px) {
  .hero-orbits {
    --orbit-scale: 1;
    width: min(440px, 86vw);
  }

  .hero-orbits .hero-video-wrap {
    width: min(200px, 44%) !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}

@media (max-width: 920px) {
  .hero-shell {
    overflow: hidden !important;
  }

  .hero-visual {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: grid;
    place-items: center;
  }

  .hero-orbits {
    --orbit-scale: 1;
    width: min(340px, 90vw);
    max-width: 100%;
  }

  .hero-orbits .hero-video-wrap {
    width: min(150px, 44%) !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  /* Keep inner rings only — outer pills overflow phones */
  .hero-orbit-3,
  .hero-orbit-4,
  .hero-node-ring-3,
  .hero-node-ring-4 {
    display: none;
  }

  /* Lighter orbit motion on phones */
  .hero-orbit-1,
  .hero-node-ring-1 {
    animation-duration: 40s;
  }
  .hero-orbit-2,
  .hero-node-ring-2 {
    animation-duration: 52s;
  }
  .hero-node-ring-1 .hero-orbit-pill {
    animation-duration: 40s;
  }
  .hero-node-ring-2 .hero-orbit-pill {
    animation-duration: 52s;
  }

  .hero-orbit-pill {
    padding: 8px 11px 8px 9px;
    gap: 6px;
  }

  .hero-orbit-pill svg {
    width: 18px;
    height: 18px;
  }

  .hero-orbit-pill span {
    font-size: 0.68rem;
  }

  .hero-ticker {
    margin-top: 14px;
  }

  .hero-content,
  .hero-visual {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .btn-border-wrap {
    width: 100%;
  }

  .btn-border-wrap .btn-primary {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .hero-orbits {
    width: min(300px, 94vw);
  }

  .hero-orbits .hero-video-wrap {
    width: min(132px, 44%) !important;
  }

  .hero-orbit-pill {
    padding: 8px 10px 8px 8px;
    gap: 5px;
    border-radius: 999px;
  }

  .hero-orbit-pill span {
    display: inline;
    font-size: 0.62rem;
  }

  .hero-orbit-pill svg {
    width: 18px;
    height: 18px;
  }

  .hero::before {
    background-position: 70% center;
  }
}

@media (max-width: 400px) {
  .hero-orbits {
    width: min(260px, 96vw);
  }

  .hero-orbits .hero-video-wrap {
    width: min(114px, 44%) !important;
  }

  .hero-orbit-1,
  .hero-node-ring-1 {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-content,
  .hero-visual,
  .hero-orbit,
  .hero-node-ring,
  .hero-orbit-pill,
  .hero-ticker,
  .hero-ticker-track,
  .btn-border-wrap::before {
    animation: none !important;
  }

  .hero-content,
  .hero-visual,
  .hero-ticker {
    opacity: 1;
    transform: none;
  }

  .hero-orbit-pill {
    transform: translate(-50%, -50%) rotate(calc(-1 * var(--angle, 0deg)));
  }
}
