/* ==========================================================================
   PeSo · Орбита ROI · элемент первого экрана peso.kz
   Без зависимостей. Разметку строит peso-orbit.js.
   Все цвета вынесены в custom properties на .po, их можно переопределить.
   ========================================================================== */

.po {
  /* бренд */
  --po-accent: #E1523D;
  --po-accent-2: #F0715A;            /* конец градиента ядра, как у плашки «Эксклюзивный селлер» */
  --po-accent-a18: rgba(225, 82, 61, 0.18);
  --po-accent-a20: rgba(225, 82, 61, 0.20);
  --po-accent-a30: rgba(225, 82, 61, 0.30);
  --po-accent-a40: rgba(225, 82, 61, 0.40);
  --po-accent-a50: rgba(225, 82, 61, 0.50);

  /* текст */
  --po-ink: #1E1E28;
  --po-ink-2: #3A3A46;
  --po-muted: #6B6B76;

  /* линии и поверхности */
  --po-surface: #FFFFFF;
  --po-line: #E7D8D4;
  --po-anchor: #E3D3CE;
  --po-dot: #C9BEBA;
  --po-pill-border: #EDE4E1;
  --po-card-border: #F0E6E3;
  --po-chain: #F2DFDA;

  --po-radius: 24px;

  position: relative;
  width: 100%;
  max-width: 592px;
  box-sizing: border-box;
  border-radius: var(--po-radius);
  font-family: inherit;               /* берем шрифт сайта */
  color: var(--po-ink);
  -webkit-font-smoothing: antialiased;
}

.po *,
.po *::before,
.po *::after { box-sizing: border-box; }

/* резерв места до инициализации JS, чтобы первый экран не прыгал (CLS) */
[data-peso-orbit]:not(.po) { display: block; width: 100%; max-width: 592px; aspect-ratio: 592 / 460; }
@media (max-width: 559px) { [data-peso-orbit]:not(.po) { aspect-ratio: 360 / 520; } }

/* ---------- режимы фона (data-bg) ---------- */
.po[data-bg="transparent"] { background: transparent; }
.po[data-bg="pink"] { background: linear-gradient(135deg, #F6D5CF 0%, #FAE6E2 55%, #F4CEC7 100%); }
.po[data-bg="white"] {
  background: #FFFFFF;
  border: 1px solid var(--po-card-border);
  box-shadow: 0 24px 60px rgba(225, 82, 61, 0.10);
}

/* ---------- сцена: координаты в px макета, масштабируется целиком ---------- */
.po-orbit {
  position: relative;
  width: 100%;
  /* aspect-ratio выставляет JS по раскладке: 592/460 или 360/320 */
}
.po-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  /* width, height и transform: scale() выставляет JS */
}

/* ---------- кольца ---------- */
.po-ring { position: absolute; border-radius: 50%; pointer-events: none; }
.po-ring--solid { border: 1px solid var(--po-accent-a18); }
.po-ring--dash { border: 1px dashed var(--po-accent-a40); }

/* ---------- линии связи ---------- */
.po-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.po-link { stroke: var(--po-line); stroke-width: 1.2; }
.po-flow {
  stroke: var(--po-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 9;
  opacity: 0;
  transition: opacity 0.35s ease;
  animation: po-flow 0.8s linear infinite;
}
.po-flow.is-active,
.po-flow--card { opacity: 1; }
.po-anchor { fill: var(--po-anchor); transition: fill 0.35s ease; }
.po-anchor.is-active,
.po-anchor--card { fill: var(--po-accent); }

/* ---------- ядро ROI ---------- */
.po-ping {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--po-accent);
  opacity: 0;
  pointer-events: none;
  animation: po-ping 3s ease-out infinite;
}
.po-core {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--po-accent) 0%, var(--po-accent-2) 100%);
  box-shadow: 0 18px 40px var(--po-accent-a30), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.po-core__label { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; line-height: 1; }
.po-core__value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.po-core__name {
  max-width: 82%;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- чипы площадок ---------- */
.po-pill-slot { position: absolute; width: 0; height: 0; }
.po-pill {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin: 0;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--po-pill-border);
  background: var(--po-surface);
  box-shadow: 0 4px 12px rgba(30, 30, 40, 0.05);
  color: var(--po-ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}
.po-pill.is-active {
  border-color: var(--po-accent);
  box-shadow: 0 10px 24px var(--po-accent-a20);
  color: var(--po-ink);
}
.po-pill:focus-visible { outline: 2px solid var(--po-accent); outline-offset: 3px; }
.po-pill__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--po-dot);                /* серые иконки как в бегущей строке */
  transition: color 0.3s ease;
}
.po-pill__icon svg { width: 16px; height: 16px; display: block; }
.po-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.po-pill.is-active .po-pill__icon { color: var(--po-accent); }

/* ---------- карточка «Сквозной отчет» ---------- */
.po-card {
  position: absolute;
  padding: 16px;
  border-radius: 20px;
  background: var(--po-surface);
  border: 1px solid var(--po-card-border);
  box-shadow: 0 20px 44px rgba(30, 30, 40, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.po-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.po-card__label { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: var(--po-accent); }
.po-live {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--po-accent);
  animation: po-live 1.6s ease-out infinite;
}
.po-card__name {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-chain {
  position: relative;
  margin: 8px 0 0;
  padding: 0 0 0 20px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.po-chain::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 1px;
  background: var(--po-chain);
}
.po-chain::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--po-accent);
  opacity: 0;
  animation: po-pip 3s ease-in-out infinite;
}
.po-chain__row {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.po-chain__row::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--po-accent);
  background: var(--po-surface);
}
.po-chain__row:last-of-type::before { background: var(--po-accent); }
.po-chain__label { flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--po-muted); }
.po-chain__value { margin: 0; font-size: 14px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }

.po-caption {
  position: absolute;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--po-muted);
  white-space: nowrap;
}

/* ---------- мобильная раскладка (ширина элемента < 520px) ---------- */
.po[data-layout="mobile"] .po-orbit { max-width: 400px; margin: 0 auto; }
.po[data-layout="mobile"] .po-pill { height: 32px; padding: 0 12px; gap: 6px; font-size: 12px; }
.po[data-layout="mobile"] .po-core__value { font-size: 30px; }
.po[data-layout="mobile"] .po-core__name { font-size: 10px; }
.po[data-layout="mobile"] .po-card {
  position: relative;
  width: auto;
  max-width: 400px;
  margin: 4px auto 0;
}
.po[data-layout="mobile"] .po-caption {
  position: static;
  display: block;
  max-width: 400px;
  margin: 12px auto 0;
  padding-left: 4px;
}
.po[data-layout="mobile"][data-bg="pink"],
.po[data-layout="mobile"][data-bg="white"] { padding: 12px 12px 16px; }

/* ---------- интро: запускается, когда элемент впервые попал в экран (.is-in) ---------- */
.po:not(.is-in) .po-orbit,
.po:not(.is-in) .po-card,
.po:not(.is-in) .po-caption { visibility: hidden; }

.po.is-in .po-ring--solid,
.po.is-in .po-links { animation: po-fade 0.8s 0.1s both; }
.po.is-in .po-ring--dash { animation: po-fade 0.8s 0.1s both, po-spin 60s linear infinite; }
.po.is-in .po-core { animation: po-pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.po.is-in .po-pill-slot { animation: po-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; animation-delay: var(--po-delay, 0.3s); }
.po.is-in .po-card,
.po.is-in .po-caption { animation: po-up 0.7s 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* вне экрана или в фоновой вкладке все стоит на паузе */
.po.is-paused,
.po.is-paused * { animation-play-state: paused !important; }

@keyframes po-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes po-spin { to { transform: rotate(360deg); } }
@keyframes po-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes po-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes po-flow { to { stroke-dashoffset: -22; } }
@keyframes po-ping { 0% { transform: scale(1); opacity: 0.45; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes po-pip {
  0% { top: 5px; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { top: calc(100% - 11px); opacity: 0; }
}
@keyframes po-live {
  0% { box-shadow: 0 0 0 0 var(--po-accent-a50); }
  100% { box-shadow: 0 0 0 8px rgba(225, 82, 61, 0); }
}

/* ---------- reduced motion: без движения, автопереключение выключает JS ---------- */
@media (prefers-reduced-motion: reduce) {
  .po *,
  .po.is-in * { animation: none !important; }
  .po .po-ping,
  .po .po-chain::after { display: none; }
  .po .po-pill,
  .po .po-flow,
  .po .po-anchor { transition: none; }
}
