/* scroll budget: first half = cards rise and straighten, second half = dive + statement */
.flight {
  height: calc(max(100svh, 700px) + 160svh);
}

.hero {
  height: max(100svh, 700px);
  align-content: center;
  grid-template-rows: max-content max-content;
  gap: clamp(24px, 4vh, 45px);
  padding-block: 103px 37px;
}

.hero-layout {
  padding-block: 0;
}

.hero h1 {
  font-size: clamp(58px, 7vw, 106px);
}

.emblem img {
  width: min(49%, 280px);
}

.service-orbit {
  position: relative;
  z-index: 4;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(9px, 2.1vw, 28px);
  max-width: 800px;
  padding-inline: 19px;
  align-items: center;
  transform: translate3d(calc(var(--dive, 0) * -50px), calc(var(--travel, 0) * -18px + var(--dive, 0) * 70px), 0) scale(calc(1 - var(--dive, 0) * .12));
  opacity: calc(1 - var(--dive, 0) * 3);
}
.is-diving .service-orbit { pointer-events: none; }

.service-orbit::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -5%;
  right: -5%;
  bottom: -53%;
  height: 101%;
  border-top: 1px solid #d2c5ff63;
  border-radius: 50% 50% 0 0;
  filter: drop-shadow(0 -5px 14px #8667ffbe);
  pointer-events: none;
}

.web-art { --service-image: url(service-web.webp); }
.editing-art { --service-image: url(service-editing.webp); }
.branding-art { --service-image: url(service-branding.webp); }
.ads-art {
  --service-image: url(service-ads.webp);
  --service-detail-focus: 29%;
}

.service-photo {
  background-color: #211735;
  background-image: var(--service-image);
  background-size: cover;
  background-position: center 47%;
  background-repeat: no-repeat;
}

/* The photo lives in ::before so it can zoom on hover; the reading gradient sits in ::after. */
.orbit-card::before,
.orbit-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.orbit-card::before {
  z-index: -2;
  background: var(--service-image) center 47% / cover no-repeat;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
.orbit-card::after {
  z-index: -1;
  background: linear-gradient(0deg, #100b1bf5, transparent 57%);
}
.orbit-card:is(:hover, :focus-visible)::before { transform: scale(1.08); }

/* Weightless drift: slow, slightly different for each card. Uses the individual
   translate/rotate properties so it stacks on top of the scroll transform. */
@keyframes drift {
  0%   { translate: 0 0; rotate: 0deg; }
  33%  { translate: calc(var(--amp) * 4px) calc(var(--amp) * -9px); rotate: calc(var(--amp) * 1.1deg); }
  66%  { translate: calc(var(--amp) * -3px) calc(var(--amp) * -4px); rotate: calc(var(--amp) * -.8deg); }
  100% { translate: calc(var(--amp) * -1px) calc(var(--amp) * 5px); rotate: calc(var(--amp) * .5deg); }
}

.orbit-card {
  background-color: #211735;
  overflow: hidden;
  isolation: isolate;
  --amp: 1;
  animation: drift var(--drift, 9s) ease-in-out var(--delay, 0s) infinite alternate;
  --tilt: 0deg;   /* resting angle on the arc */
  --rise: 0px;    /* resting height on the arc (edges sit lower) */
  --lift: -52px;  /* how far the card rises once straightened */
  --lag: .075;    /* stagger between cards */
  /* per-card progress: starts a little later for each card, then eases to 1 */
  --p: clamp(0, calc((var(--travel, 0) - var(--i, 0) * var(--lag)) / .66), 1);
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(114px, 19vh, 171px);
  padding: 13px 14px;
  border: 1px solid #cfc3ff67;
  border-radius: 13px;
  box-shadow: 0 10px 25px #06030d77;
  transform: translate3d(0, calc(var(--rise) * (1 - var(--p)) + var(--lift) * var(--p)), 0)
    rotate(calc(var(--tilt) * (1 - var(--p))))
    scale(calc(1 + var(--p) * .035));
  will-change: transform;
}
.is-diving .orbit-card { animation-play-state: paused; }

.orbit-card span {
  font-size: clamp(.875rem, 1.3vw, 1.05rem);
  line-height: 1.15;
  font-weight: 800;
}

.orbit-card:first-child { --tilt: -9deg; --rise: 19px; --drift: 8.6s; --delay: -2s; }
.orbit-card:nth-child(2) { --tilt: -3deg; --rise: -4px; --drift: 10.4s; --delay: -6s; }
.orbit-card:nth-child(3) { --tilt: 3deg; --rise: -4px; --drift: 9.3s; --delay: -4s; }
.orbit-card:last-child { --tilt: 9deg; --rise: 19px; --drift: 11.2s; --delay: -8s; }


.service-detail-list {
  display: grid;
  gap: 20px;
}

.service-detail {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 1.55fr);
  min-height: 205px;
  scroll-margin-top: 25px;
  background: #141022;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.service-detail:target,
.service-detail.is-arrived {
  border-color: var(--lav);
  box-shadow: 0 0 32px #5a46da43;
}
.service-detail.is-arrived { animation: arrived 1.6s ease-out; }
@keyframes arrived {
  0% { box-shadow: 0 0 0 0 #b9b2f5aa, 0 0 32px #5a46da43; }
  35% { box-shadow: 0 0 0 6px #b9b2f530, 0 0 48px #5a46da80; }
  100% { box-shadow: 0 0 0 0 #b9b2f500, 0 0 32px #5a46da43; }
}
.service-detail:focus-visible { outline: 2px solid var(--lav); }
.service-detail:focus:not(:focus-visible) { outline: none; }

.service-detail:focus { outline-offset: 4px; }
.service-photo {
  min-height: 240px;
  background-position: center var(--service-detail-focus, 47%);
}
.service-copy { align-self: center; padding: clamp(20px, 4vw, 56px); }
.service-copy h3 { font-size: clamp(1.65rem, 3.7vw, 3.1rem); letter-spacing: -.06em; line-height: 1.09; }
.service-copy p { max-width: 43ch; color: var(--lav); line-height: 1.6; margin-top: 10px; }

@media (max-width: 760px) {
  .flight { height: calc(max(100svh, 755px) + 115svh); }
  .hero { height: max(100svh, 755px); gap: 21px; padding-block: 87px 33px; }
  .hero-layout { gap: 14px; }
  .hero h1 { font-size: clamp(47px, 11.6vw, 82px); }
  .hero-copy p { margin-block: 10px 14px; }
  .emblem img { width: min(41%, 153px); }
  .emblem { width: min(83%, 490px); }
  .service-orbit { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; padding: 0; max-width: 475px; }
  .service-orbit::before { display: none; }
  .service-orbit .orbit-card { --tilt: 0deg; --rise: 0px; --lift: -8px; --lag: .1; min-height: 120px; padding: 10px; --amp: .55; }
  .service-orbit .orbit-card:nth-child(even) { --lift: -14px; }
  .service-detail { grid-template-columns: minmax(0, 1fr); }
  .service-photo { min-height: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  .flight { height: auto; }
  .service-orbit { transform: none; }
  .orbit-card { transform: none; will-change: auto; animation: none; }
  .orbit-card::before { transition: none; }
  .service-orbit { opacity: 1; }
  .service-detail.is-arrived { animation: none; }
}

/* Short screens: let the page flow instead of pinning the hero. */
@media (max-height: 600px) {
  .flight { height: auto; }
  .hero { position: relative; height: auto; min-height: 0; padding-block: 100px 48px; }
  .orbit-card { --p: 0; }
  .service-orbit { transform: none; opacity: 1; }
}

/* ---------- desktop ring (motion.js adds .is-ring and drives each card's transform) ---------- */
.service-orbit.is-ring{display:block;width:100%;max-width:none;height:300px;padding:0}
.service-orbit.is-ring::before{display:none}
.service-orbit.is-ring .orbit-card{position:absolute;left:50%;top:0;width:178px;height:262px;min-height:0;margin-left:-89px;padding:14px;
  border:0;border-radius:16px;animation:none;will-change:transform;
  box-shadow:0 30px 60px #000000a0,0 0 0 1px #ffffff17}
.service-orbit.is-ring .orbit-card span{font-size:1rem}
