/* ==========================================================================
   /services/expert/ — «Экспертные сайты». Concept: «Глубина» — trust builds
   gradually; details come into focus.
   Hero: the nebula itself slowly undulates (an SVG turbulence field drifts
   and bends the image, very slowly) and its light breathes. Three notes are
   pinned to points in it, like a star chart — «подход», «опыт», «причины
   доверять»: a marker, a thin leader, a small label; they come into focus
   one after another. Below: blocks come out of a soft blur.
   The nebula and the notes share one box (--ex-w, --ex-x, --ex-y, the
   artwork's 1173 × 701), so the notes stay on their points at every width.
   The undulation runs on wide screens only and pauses off screen.
   ========================================================================== */

.service-expert {
  --ex-w: clamp(720px, 64vw, 1100px);
  --ex-x: calc(100% + 3vw - var(--ex-w));            /* from the hero's left edge */
  --ex-y: clamp(24px, 3vw, 48px);
  --ex-len: 56px;                                     /* leader length */
}

/* --- Hero: nebula -------------------------------------------------------- */
.ex-sky .ex-neb,
.ex-notes {
  position: absolute;
  top: var(--ex-y);
  left: var(--ex-x);
  width: var(--ex-w);
  aspect-ratio: 1173 / 701;
}
.ex-sky .ex-neb {
  display: block;
  mix-blend-mode: screen;
  transform-origin: 69.4% 31.7%;                      /* the bright core, where the third note sits */
  animation:
    ex-dolly 60s ease-in-out infinite alternate,
    ex-breathe 14s ease-in-out infinite alternate;
}
.ex-sky .ex-neb img { width: 100%; height: auto; transform: scaleY(-1); }   /* flipped: the nebula hangs from the top */
@keyframes ex-dolly { from { transform: scale(1); } to { transform: scale(1.02); } }
@keyframes ex-breathe { from { opacity: .85; } to { opacity: 1; } }

@media (min-width: 961px) and (prefers-reduced-motion: no-preference) {
  .ex-sky .ex-neb img { filter: url(#ex-ripple); }
}

.ex-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 15, 15, .94) 0%, rgba(14, 15, 15, .66) 30%, rgba(14, 15, 15, 0) 52%),
    linear-gradient(180deg, rgba(14, 15, 15, 0) 52%, rgba(14, 15, 15, .5) 74%, rgba(14, 15, 15, .75) 100%);
}

.ex-filters { position: absolute; width: 0; height: 0; overflow: hidden; }

/* --- Hero: the notes, pinned to the nebula -------------------------------- */
.ex-notes {
  z-index: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}
.ex-note { position: absolute; width: 0; height: 0; }
.ex-n1 { left: 45.4%; top: 37.1%; }
.ex-n2 { left: 84.3%; top: 58.6%; }
.ex-n3 { left: 69.4%; top: 31.7%; }

/* the marker: a small ring on the point */
.ex-dot {
  position: absolute;
  top: -5px;
  left: -5px;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(241, 235, 221, .85);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, .35);
}
/* the leader: down from the marker (up for the third note) */
.ex-line {
  position: absolute;
  bottom: 7px;
  left: 0;
  width: 1px;
  height: var(--ex-len);
  background: linear-gradient(0deg, rgba(241, 235, 221, .7), rgba(241, 235, 221, .25));
  transform-origin: 50% 100%;
}
.ex-label {
  position: absolute;
  bottom: calc(7px + var(--ex-len) + 10px);
  left: -1px;
  color: rgba(241, 235, 221, .88);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .18em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(14, 15, 15, .95);
}
.ex-n2 .ex-label { right: -1px; left: auto; text-align: right; }
.ex-n1 .ex-line,
.ex-n2 .ex-line { top: 7px; bottom: auto; background: linear-gradient(180deg, rgba(241, 235, 221, .7), rgba(241, 235, 221, .25)); transform-origin: 50% 0; }
.ex-n1 .ex-label,
.ex-n2 .ex-label { top: calc(7px + var(--ex-len) + 8px); bottom: auto; }

/* each note comes into focus once, one after another: marker, leader, label */
@media (prefers-reduced-motion: no-preference) {
  .ex-dot { opacity: 0; animation: ex-dot-in .9s cubic-bezier(.16, 1, .3, 1) forwards, ex-dot-pulse 4.5s ease-in-out 3s infinite alternate; }
  .ex-line { transform: scaleY(0); animation: ex-line-in .8s cubic-bezier(.45, 0, .2, 1) forwards; }
  .ex-label { opacity: 0; animation: ex-label-in 1.2s cubic-bezier(.33, 0, .2, 1) forwards; }
  .ex-n1 > * { --d: 1s; }
  .ex-n2 > * { --d: 1.9s; }
  .ex-n3 > * { --d: 2.8s; }
  .ex-dot { animation-delay: var(--d), calc(var(--d) + 1.5s); }
  .ex-line { animation-delay: calc(var(--d) + .35s); }
  .ex-label { animation-delay: calc(var(--d) + .8s); }
}
@keyframes ex-dot-in { from { opacity: 0; transform: scale(2.4); } to { opacity: 1; transform: none; } }
@keyframes ex-dot-pulse { from { box-shadow: 0 0 6px rgba(255, 255, 255, .2); } to { box-shadow: 0 0 14px rgba(255, 255, 255, .55); } }
@keyframes ex-line-in { to { transform: scaleY(1); } }
@keyframes ex-label-in {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: 1; filter: blur(0); }
}

/* --- Scope: editorial two-column grid ------------------------------------ */
.ex-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 3.4vw, 48px) clamp(40px, 6vw, 96px);
  max-width: 1120px;
}
.ex-columns li { padding-top: clamp(18px, 1.8vw, 24px); border-top: 1px solid var(--svc-line); }

/* --- Reveal: out of a soft blur ------------------------------------------ */
.svc-motion .service-expert .svc-reveal { transform: translate3d(0, 24px, 0); filter: blur(10px); }
.svc-motion .service-expert .svc-reveal.is-visible { transform: none; filter: blur(0); }
.svc-motion .service-expert .svc-reveal-item {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 1.2s ease, filter 1.4s ease;
  transition-delay: calc(.25s + var(--i, 0) * .22s);
}
.svc-motion .service-expert .is-visible .svc-reveal-item { opacity: 1; filter: blur(0); }

/* --- Tablet / mobile: the nebula with its notes sits above the copy ------ */
@media (max-width: 960px) {
  .service-expert {
    --ex-w: 130vw;
    --ex-x: -24vw;
    --ex-y: 0px;
    --ex-len: 40px;
  }
  .service-expert .svc-hero { align-items: flex-end; padding-top: calc(var(--ex-w) * .598 * .82); }
  .ex-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .service-expert { --ex-w: 165vw; --ex-x: -42vw; --ex-len: 30px; }
  .ex-label { font-size: .6875rem; letter-spacing: .14em; }
  .ex-n3 .ex-label { right: -1px; left: auto; text-align: right; }
  .service-expert .svc-hero { padding-top: calc(var(--ex-w) * .598 * .98); }
}

@media (prefers-reduced-motion: reduce) {
  .ex-sky .ex-neb { animation: none; }
}
