/* ============================================================
   Milestone Strip — светлая тема (var(--app-surface), --brand-*)
   ============================================================ */

/* Контейнер полосы */
.milestone-strip {
  background: var(--app-surface, #fff);
  border: 1px solid var(--border-color, #cdcdcc);
  border-radius: 6px;
  /* box-shadow: 0 1px 4px rgba(55, 57, 54, 0.08); */
  margin-bottom: 12px !important;
  position: relative;
  overflow: visible;
  padding: 4px 24px;
  --ms-title-size: 10px;
  --ms-date-size: 10px;
  --ms-year-size: 13px;
  --ms-quarter-size: 9px;
}

/* ── Ось таймлайна ── */
.ms-timeline { position: relative; width: 100%; height: 64px; }
.milestone-strip.has-quarters .ms-timeline { height: 80px; }

.ms-axis {
  position: absolute; left: 0; right: 0; top: 31px; height: 2px;
  background: var(--brand-charcoal-25, #cdcdcc); border-radius: 1px;
}

/* Пройденный участок оси (0..сегодня) поверх серой оси */
.ms-axis-progress {
  position: absolute; left: 0; top: 31px; height: 2px;
  width: var(--ms-today-pct, 0%);
  background: var(--brand-teal, #009479); border-radius: 1px;
  pointer-events: none;
}

/* Вертикальные засечки */
.ms-tick { position: absolute; transform: translateX(-50%); }
.ms-tick-year  { top: 26px; height: 12px; width: 1px; background: var(--brand-charcoal-50, #9b9c9a); }
.ms-tick-quarter { top: 28px; height: 8px; width: 1px; background: var(--brand-charcoal-25, #cdcdcc); }

/* Подписи засечек */
.ms-tick-label { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ms-tick-label-year {
  top: 45px; font-size: var(--ms-year-size); font-weight: 700;
  color: var(--brand-charcoal, #373936);
}
.ms-tick-label-quarter {
  top: 56px; font-size: var(--ms-quarter-size); font-weight: 500;
  color: var(--brand-charcoal-75, #6a6b68);
}

/* ── Маркер вехи ── */
.ms-marker {
  position: absolute; top: 32px; width: 16px; height: 16px;
  transform: translate(-50%, -50%); cursor: pointer; z-index: 2;
}
.ms-marker-dot {
  width: 100%; height: 100%;
  background: var(--brand-yellow, #ffb635);
  box-shadow: 0 2px 5px rgba(55, 57, 54, 0.35);
  transition: transform 0.15s ease;
  transform: rotate(45deg);
}
.ms-marker:hover .ms-marker-dot { transform: rotate(45deg) scale(1.2); }
.ms-marker-label {
  position: absolute; bottom: calc(100% + 3px); left: 50%; right: auto;
  transform: translateX(-50%);
  display: flex; align-items: baseline; justify-content: center; gap: 3px;
  max-width: 190px; white-space: nowrap; pointer-events: none; overflow: hidden;
  text-align: center;
}
.ms-marker-date {
  font-size: var(--ms-date-size); color: var(--brand-charcoal-75, #6a6b68);
  white-space: nowrap; flex-shrink: 0;
}
.ms-marker-title {
  font-size: var(--ms-title-size); font-weight: 600; color: var(--brand-charcoal, #373936);
  overflow: hidden; text-overflow: ellipsis;
}
.ms-marker:hover .ms-marker-title { text-decoration: underline; }

/* Подпись «N дн.» под точкой маркера, по центру оси */
.ms-marker-days {
  position: absolute;
  top: calc(100% + -5px);
  left: 200%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--brand-charcoal-75, #6a6b68);
  white-space: nowrap;
  pointer-events: none;
  text-align: center;
}
/* ── Выполненная веха: зелёный кружок с галочкой ── */
.ms-marker[data-status="done"] .ms-marker-dot {
  position: absolute; top: -4px; 
  width: 24px; height: 24px;
  background: var(--brand-teal, #009479);
  box-shadow: 0 2px 5px rgba(0, 148, 121, 0.40);
  border-radius: 50%;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ms-marker[data-status="done"]:hover .ms-marker-dot { transform: scale(1.2); }
.ms-marker[data-status="done"] .ms-marker-dot::after {
  content: "";
  display: block;
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  flex-shrink: 0;
}

/* ── Полоска текущей даты ── */
.ms-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(193, 32, 76, 0.45);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
}
.ms-today::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-magenta, #c1204c);
  box-shadow: 0 0 0 3px rgba(193, 32, 76, 0.15);
}
/* .ms-today-label {
  position: absolute;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  top: 50px;
  left: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--brand-magenta, #c1204c);
  white-space: nowrap;
  letter-spacing: 0.03em;
} */

/* ── Подпись маркера: всегда только дата, заголовок — в тултипе ── */
.ms-marker .ms-marker-title { display: none; }
/* Веха с налезающей датой: дату прячем (полная инфа остаётся в тултипе) */
.ms-marker.ms-label-hidden .ms-marker-date { display: none; }

/* .ms-marker.ms-label-hidden .ms-marker-dot {
  background: transparent;
  border: 2px solid var(--brand-yellow, #ffb635);
  box-sizing: border-box;
  box-shadow: none;
  opacity: 0.55;
  transform: scale(0.55);
} */
/* .ms-marker.ms-label-hidden:hover .ms-marker-dot {
  background: var(--brand-yellow, #ffb635);
  border-color: transparent;
  box-shadow: 0 2px 5px rgba(55, 57, 54, 0.35);
  opacity: 1;
  transform: scale(1);
} */

/* ── Tooltip ── */
.ms-tooltip {
  position: fixed;
  z-index: 9999;
  padding: 5px 10px;
  border-radius: 5px;
  background: var(--brand-charcoal, #373936);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.ms-tooltip.ms-tooltip-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Панель деталей вехи ── */
.ms-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(55, 57, 54, 0.25);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.ms-detail-panel {
  background: var(--app-surface, #fff);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(55, 57, 54, 0.18);
  min-width: 320px;
  max-width: 480px;
  width: 100%;
  transform: translateY(-24px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.ms-detail-panel.is-open {
  transform: translateY(0);
  opacity: 1;
}

.ms-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--brand-charcoal-25, #cdcdcc);
  gap: 12px;
}

.ms-detail-title {
  color: var(--brand-charcoal, #373936);
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.ms-detail-close {
  background: none;
  border: none;
  color: var(--brand-charcoal-75, #6a6b68);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.12s;
  flex-shrink: 0;
}

.ms-detail-close:hover {
  color: var(--brand-charcoal, #373936);
}

.ms-detail-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ms-detail-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ms-detail-row-desc {
  align-items: flex-start;
}

.ms-detail-label {
  color: var(--brand-charcoal-75, #6a6b68);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 100px;
  flex-shrink: 0;
}

.ms-detail-value {
  color: var(--brand-charcoal, #373936);
  font-size: 13px;
}

/* ============================================================
   Разовая анимация появления — волна слева направо (по left%)
   Базово (без .ms-animate-in) всё видимо: reduced-motion / без
   класса → ничего не скрыто и не «залипает».
   ============================================================ */
@keyframes msFade { from { opacity: 0; } to { opacity: 1; } }
/* Подъём dot с СОХРАНЕНИЕМ его базового transform (ромб rotate(45deg)) */
@keyframes msDotUp {
  from { transform: translateY(6px) rotate(45deg); }
  to   { transform: translateY(0)   rotate(45deg); }
}
/* done-кружок: базовый transform = none, поднимаем без поворота */
@keyframes msDotUpDone {
  from { transform: translateY(6px); }
  to   { transform: translateY(0); }
}
@keyframes msGrowX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Маркер: только opacity (translate(-50%,-50%) не трогаем) */
.ms-animate-in .ms-marker {
  animation: msFade 0.34s ease both;
  animation-delay: var(--ms-delay, 0ms);
}
/* Лёгкий подъём — на dot (backwards: после анимации возвращается к базовому
   transform, поэтому hover-scale продолжает работать) */
.ms-animate-in .ms-marker .ms-marker-dot {
  animation: msDotUp 0.34s ease backwards;
  animation-delay: var(--ms-delay, 0ms);
}
.ms-animate-in .ms-marker[data-status="done"] .ms-marker-dot {
  animation-name: msDotUpDone;
}
/* Тики/подписи: только opacity (translateX(-50%) не трогаем) */
.ms-animate-in .ms-tick-year,
.ms-animate-in .ms-tick-label-year,
.ms-animate-in .ms-tick-quarter,
.ms-animate-in .ms-tick-label-quarter {
  animation: msFade 0.34s ease both;
  animation-delay: var(--ms-delay, 0ms);
}
/* Прогресс-ось: рост scaleX слева (ширина остаётся var(--ms-today-pct)) */
.ms-animate-in .ms-axis-progress {
  transform-origin: left center;
  animation: msGrowX 0.6s ease both;
  animation-delay: 60ms;
}
/* Серая ось — «холст»: в волне не участвует (видна сразу) */

@media (prefers-reduced-motion: reduce) {
  .ms-animate-in * { animation: none !important; }
}
