/* Home services: one CSS-3D object per service card + a slow light that travels the card border. */

@property --svc-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.home-svc__card { position: relative; isolation: isolate; }
.home-svc__top { position: relative; }

/* Travelling light: a narrow conic highlight masked to the 1px border ring. */
.home-svc__card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--svc-a), transparent 0 72%, rgb(245 200 66 / 0%) 74%, rgb(245 200 66 / 70%) 84%, rgb(255 244 210 / 90%) 86.5%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: .55;
  pointer-events: none;
  animation: svcFlow 9s linear infinite;
  transition: opacity .4s ease;
}
.home-svc__card:nth-child(2)::before { animation-delay: -1.5s; }
.home-svc__card:nth-child(3)::before { animation-delay: -3s; }
.home-svc__card:nth-child(4)::before { animation-delay: -4.5s; }
.home-svc__card:nth-child(5)::before { animation-delay: -6s; }
.home-svc__card:nth-child(6)::before { animation-delay: -7.5s; }
.home-svc__card:hover::before, .home-svc__card:focus-within::before { opacity: 1; animation-duration: 5s; }

/* Soft pool of light behind each object. */
.home-svc__card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  z-index: -1;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(245 200 66 / 9%) 0%, rgb(28 95 208 / 7%) 40%, transparent 70%);
  pointer-events: none;
}
@keyframes svcFlow { to { --svc-a: 360deg; } }

/* Cards in a row share one height when open; the list (and its glow) fills to the card bottom. */
.home-svc__grid { align-items: stretch; }
.home-svc__card { display: flex; flex-direction: column; }
.home-svc__subs { flex: 1 1 auto; }

/* Reserve three lines for every description so titles and lists line up across a row. */
.home-svc__text { box-sizing: border-box; min-height: calc(4.5em + 16px); }

/* Open state: blue→violet glow rising from the bottom edge with a fading dot texture.
   Lives on the sub-service list, so it fades in/out with the list's own opacity transition. */
.home-svc__subs { position: relative; }
.home-svc__subs > div { position: relative; z-index: 1; }
.home-svc__subs::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(100%, 300px);
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, rgb(170 185 255 / 22%) 0.8px, transparent 1.3px) 0 0 / 12px 12px,
    radial-gradient(70% 90% at 28% 105%, rgb(43 103 236 / 38%) 0%, rgb(43 103 236 / 0%) 70%),
    radial-gradient(60% 85% at 85% 108%, rgb(132 76 240 / 36%) 0%, rgb(132 76 240 / 0%) 70%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgb(0 0 0 / 60%) 45%, transparent 100%);
  mask-image: linear-gradient(to top, #000 0%, rgb(0 0 0 / 60%) 45%, transparent 100%);
}

/* ---------- shared 3D stage ---------- */
.s3d {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 132px;
  height: 132px;
  perspective: 560px;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
.home-svc__card:hover .s3d { transform: scale(1.07); }
.s3d__scene { position: absolute; inset: 0; transform-style: preserve-3d; }
.s3d__scene * { transform-style: preserve-3d; }

.s3d__cube { --s: 56px; position: absolute; left: 50%; top: 50%; width: var(--s); height: var(--s); margin: calc(var(--s) / -2); }
.s3d__cube > i {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(245 200 66 / 55%);
  background: linear-gradient(145deg, rgb(52 64 90 / 92%), rgb(30 38 56 / 92%));
  backface-visibility: visible;
}
.s3d__cube > i:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); }
.s3d__cube > i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.s3d__cube > i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.s3d__cube > i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.s3d__cube > i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); background: linear-gradient(145deg, rgb(72 86 116 / 95%), rgb(44 54 78 / 95%)); }
.s3d__cube > i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }

.s3d__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--d, 104px);
  height: var(--d, 104px);
  margin: calc(var(--d, 104px) / -2);
  border: 1.5px solid rgb(245 200 66 / 60%);
  border-radius: 50%;
}
.s3d__ring > i {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: #ffe08a;
  box-shadow: 0 0 10px 2px rgb(245 200 66 / 65%);
}

/* ---------- Agentic AI: glowing core with three orbit rings ---------- */
.s3d--ai .s3d__scene { animation: s3dSpinY 14s linear infinite; }
.s3d--ai .s3d__core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4 0%, #f5c842 35%, #a07a12 80%);
  box-shadow: 0 0 24px 4px rgb(245 200 66 / 35%);
  animation: s3dSpinYRev 14s linear infinite;
}
.s3d--ai .s3d__ring:nth-of-type(2) { transform: rotateX(72deg); }
.s3d--ai .s3d__ring:nth-of-type(3) { transform: rotateY(60deg) rotateX(72deg); border-color: rgb(120 165 255 / 55%); }
.s3d--ai .s3d__ring:nth-of-type(4) { transform: rotateY(-60deg) rotateX(72deg); }

/* ---------- Product Design: floating interface layers ---------- */
.s3d--design .s3d__scene { transform: rotateX(56deg) rotateZ(-38deg); }
.s3d--design .s3d__layer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84px;
  height: 64px;
  margin: -32px -42px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid rgb(255 255 255 / 16%);
  background: rgb(43 53 72 / 92%);
  box-shadow: 0 10px 18px rgb(0 0 0 / 30%);
}
.s3d--design .s3d__layer b { display: block; height: 6px; border-radius: 3px; background: rgb(255 255 255 / 18%); }
.s3d--design .s3d__layer b:first-child { width: 55%; }
.s3d--design .s3d__layer b:last-child { width: 75%; }
.s3d--design .s3d__layer:nth-child(1) { animation: s3dLayer1 5s ease-in-out infinite; }
.s3d--design .s3d__layer:nth-child(2) { background: rgb(28 95 208 / 55%); border-color: rgb(120 165 255 / 45%); animation: s3dLayer2 5s ease-in-out infinite; }
.s3d--design .s3d__layer:nth-child(3) { background: rgb(245 200 66 / 16%); border-color: rgb(245 200 66 / 75%); animation: s3dLayer3 5s ease-in-out infinite; }
.s3d--design .s3d__layer:nth-child(3) b { background: rgb(245 200 66 / 70%); }
@keyframes s3dLayer1 { 0%, 100% { transform: translateZ(-6px); } 50% { transform: translateZ(-14px); } }
@keyframes s3dLayer2 { 0%, 100% { transform: translateZ(14px); } 50% { transform: translateZ(16px); } }
@keyframes s3dLayer3 { 0%, 100% { transform: translateZ(34px); } 50% { transform: translateZ(48px); } }

/* ---------- Product Engineering: code cube ---------- */
.s3d--eng .s3d__scene { animation: s3dCube 12s linear infinite; }
.s3d--eng .s3d__cube { --s: 60px; }
.s3d--eng .s3d__cube > i:nth-child(1)::after,
.s3d--eng .s3d__cube > i:nth-child(2)::after {
  content: "</>";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
}
.s3d--eng .s3d__cube > i:nth-child(3)::after,
.s3d--eng .s3d__cube > i:nth-child(4)::after {
  content: "";
  position: absolute;
  inset: 14px;
  background: repeating-linear-gradient(180deg, rgb(255 255 255 / 22%) 0 3px, transparent 3px 9px);
}
@keyframes s3dCube { from { transform: rotateX(-24deg) rotateY(0); } to { transform: rotateX(-24deg) rotateY(360deg); } }

/* ---------- Technology Advisory: gyroscope around a gem ---------- */
.s3d--adv .s3d__scene { transform: rotateX(-14deg); }
.s3d--adv .s3d__cube { --s: 26px; animation: s3dGem 8s linear infinite; }
.s3d--adv .s3d__cube > i { border-color: rgb(245 200 66 / 85%); background: linear-gradient(145deg, rgb(245 200 66 / 55%), rgb(160 122 18 / 55%)); }
.s3d--adv .s3d__ring:nth-of-type(1) { --d: 112px; animation: s3dGyroA 9s linear infinite; }
.s3d--adv .s3d__ring:nth-of-type(2) { --d: 88px; border-color: rgb(120 165 255 / 55%); animation: s3dGyroB 7s linear infinite; }
.s3d--adv .s3d__ring:nth-of-type(3) { --d: 64px; animation: s3dGyroC 11s linear infinite; }
@keyframes s3dGem { from { transform: rotateX(45deg) rotateZ(45deg) rotateY(0); } to { transform: rotateX(45deg) rotateZ(45deg) rotateY(360deg); } }
@keyframes s3dGyroA { from { transform: rotateX(0); } to { transform: rotateX(360deg); } }
@keyframes s3dGyroB { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
@keyframes s3dGyroC { from { transform: rotate3d(1, 1, 0, 0); } to { transform: rotate3d(1, 1, 0, 360deg); } }

/* ---------- Growth Marketing: rising 3D bar chart ---------- */
.s3d--growth .s3d__scene { animation: s3dSway 8s ease-in-out infinite; }
.s3d--growth .s3d__bars { position: absolute; left: 22px; bottom: 30px; width: 90px; height: 0; }
.s3d--growth .s3d__bar {
  --w: 16px;
  position: absolute;
  bottom: 0;
  width: var(--w);
  height: var(--h);
  transform-origin: 50% 100%;
  animation: s3dGrow 4.5s ease-in-out infinite;
}
.s3d--growth .s3d__bar:nth-child(1) { --h: 26px; left: 0; animation-delay: 0s; }
.s3d--growth .s3d__bar:nth-child(2) { --h: 42px; left: 23px; animation-delay: .2s; }
.s3d--growth .s3d__bar:nth-child(3) { --h: 58px; left: 46px; animation-delay: .4s; }
.s3d--growth .s3d__bar:nth-child(4) { --h: 78px; left: 69px; animation-delay: .6s; }
.s3d--growth .s3d__bar > i { position: absolute; display: block; }
.s3d--growth .s3d__bar > i:nth-child(1) { inset: 0; transform: translateZ(8px); background: linear-gradient(180deg, #4a5d85, #2f3c58); border: 1px solid rgb(255 255 255 / 12%); }
.s3d--growth .s3d__bar > i:nth-child(2) { top: 0; bottom: 0; left: 0; width: 16px; transform: rotateY(90deg) translateZ(8px); background: linear-gradient(180deg, #34425f, #222c42); }
.s3d--growth .s3d__bar > i:nth-child(3) { top: 0; left: 0; right: 0; height: 16px; transform: rotateX(90deg) translateZ(8px); background: rgb(245 200 66 / 75%); }
.s3d--growth .s3d__bar:nth-child(4) > i:nth-child(1) { background: linear-gradient(180deg, #f5c842, #c99a1a); border-color: rgb(255 240 190 / 50%); }
.s3d--growth .s3d__bar:nth-child(4) > i:nth-child(2) { background: linear-gradient(180deg, #c99a1a, #8f6c0e); }
.s3d--growth .s3d__bar:nth-child(4) > i:nth-child(3) { background: #ffe8a0; }
@keyframes s3dGrow { 0%, 100% { transform: scaleY(.72); } 50% { transform: scaleY(1); } }
@keyframes s3dSway { 0%, 100% { transform: rotateX(-20deg) rotateY(-34deg); } 50% { transform: rotateX(-20deg) rotateY(-14deg); } }

/* ---------- RevOps: stacked revenue rings / funnel ---------- */
.s3d--revops .s3d__scene { transform: translateY(6px) rotateX(64deg); }
.s3d--revops .s3d__stack { position: absolute; inset: 0; animation: s3dSpinZ 16s linear infinite; }
.s3d--revops .s3d__disc {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--d);
  height: var(--d);
  margin: calc(var(--d) / -2);
  border-radius: 50%;
  border: 1.5px solid rgb(245 200 66 / 65%);
  background: radial-gradient(circle, rgb(52 64 90 / 85%) 0%, rgb(30 38 56 / 85%) 70%);
}
.s3d--revops .s3d__disc > i { position: absolute; left: 50%; top: -4px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: #ffe08a; box-shadow: 0 0 10px 2px rgb(245 200 66 / 60%); }
.s3d--revops .s3d__disc:nth-child(1) { --d: 108px; animation: s3dDisc1 5s ease-in-out infinite; }
.s3d--revops .s3d__disc:nth-child(2) { --d: 84px; animation: s3dDisc2 5s ease-in-out infinite; }
.s3d--revops .s3d__disc:nth-child(3) { --d: 60px; border-color: rgb(120 165 255 / 60%); animation: s3dDisc3 5s ease-in-out infinite; }
.s3d--revops .s3d__disc:nth-child(4) { --d: 36px; background: radial-gradient(circle at 35% 30%, #fff3c4, #f5c842 45%, #a07a12); animation: s3dDisc4 5s ease-in-out infinite; }
.s3d--revops .s3d__disc:nth-child(2) > i { transform: rotate(0); left: 15%; top: 12%; }
.s3d--revops .s3d__disc:nth-child(3) > i { left: 85%; top: 80%; }
@keyframes s3dDisc1 { 0%, 100% { transform: translateZ(0); } 50% { transform: translateZ(0); } }
@keyframes s3dDisc2 { 0%, 100% { transform: translateZ(14px); } 50% { transform: translateZ(20px); } }
@keyframes s3dDisc3 { 0%, 100% { transform: translateZ(28px) rotate(40deg); } 50% { transform: translateZ(40px) rotate(40deg); } }
@keyframes s3dDisc4 { 0%, 100% { transform: translateZ(42px); } 50% { transform: translateZ(60px); } }

/* ---------- shared spins ---------- */
@keyframes s3dSpinY { to { transform: rotateY(360deg); } }
@keyframes s3dSpinYRev { to { transform: rotateY(-360deg); } }
@keyframes s3dSpinZ { to { transform: rotateZ(360deg); } }

@media (max-width: 720px) {
  .s3d { top: 10px; right: 10px; transform: scale(.72); transform-origin: top right; }
  .home-svc__card:hover .s3d { transform: scale(.76); }
  /* Start the title below the object so the two never overlap on a narrow card. */
  .home-svc__body { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-svc__card::before, .s3d, .s3d * { animation: none !important; }
}
