/* ==========================================================================
   MERTVIY — NOTIFICATION STACK
   Порт взаимодействия Kokonut UI (MIT) на чистый JS:
   стопка уведомлений, свайп с пружиной, отступ 10px, порог 100px.
   ========================================================================== */

.project-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}

.notif-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.notif-hint {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-hint svg { width: 13px; height: 13px; flex: 0 0 13px; stroke: var(--accent); }

/* ---------- Стопка ---------- */
.notif-stack {
  position: relative;
  min-height: 92px;
  touch-action: pan-y;
}

.notif-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notif {
  position: absolute;
  inset-inline: 0;
  top: 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .035)),
    rgba(16, 17, 23, .86);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  will-change: transform, opacity;
  transform-origin: top center;
  /* положение и масштаб в стеке задаёт JS, свайп двигает только --x */
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0) scale(var(--s, 1));
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

/* Плавная переукладка стека; во время свайпа её выключаем */
.notif.is-laid { transition: transform .34s cubic-bezier(.23, 1, .32, 1), opacity .24s ease; }
.notif.is-dragging { transition: none; }

.notif:active { cursor: grabbing; }

.notif.is-top { box-shadow: 0 14px 38px rgba(0, 0, 0, .55); }

/* Нижние карточки не ловят мышь: взаимодействуем только с верхней */
.notif:not(.is-top) { pointer-events: none; }

.notif-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), .14);
  border: 1px solid rgba(var(--accent-rgb), .30);
}

.notif-icon svg { width: 17px; height: 17px; stroke: var(--accent); fill: none; }

.notif-icon.cyan { background: rgba(82, 227, 255, .12); border-color: rgba(82, 227, 255, .30); }
.notif-icon.cyan svg { stroke: var(--accent-2); }
.notif-icon.violet { background: rgba(167, 139, 250, .14); border-color: rgba(167, 139, 250, .32); }
.notif-icon.violet svg { stroke: #a78bfa; }

.notif-body { flex: 1 1 auto; min-width: 0; }

.notif-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.notif-app {
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-time { font-size: .62rem; color: var(--muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.notif-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 600;
  font-size: .8rem;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 2px;
}

.notif-text {
  font-size: .76rem;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.notif-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .07);
  color: var(--muted);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.notif-close svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.notif-close:hover { background: rgba(255, 255, 255, .14); color: var(--text); }

.notif:not(.is-top) .notif-close { visibility: hidden; }

/* Пустое состояние: все уведомления разобраны */
.notif-empty {
  position: absolute;
  inset-inline: 0;
  top: 0;
  padding: 20px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.notif-stack.is-empty .notif-empty { opacity: 1; pointer-events: auto; }

.notif-reset {
  margin-top: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  font-family: "Unbounded", sans-serif;
  font-size: .72rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.notif-reset:hover { border-color: var(--line-hover); background: rgba(255, 255, 255, .08); }

@media (max-width: 900px) {
  .project-stage { grid-template-columns: minmax(0, 1fr); }
  .notif-block { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .notif { transition: opacity .01s !important; }
  .notif-reset, .notif-close { transition: none; }
}

/* ==========================================================================
   NOTIF V2 — дополнение к стопке (append-only, владелец уведомлений)
   Существующие правила выше не тронуты.
   Вылет карточки (.is-exit) и пружина (.is-dragging) задаются инлайн из
   js/notifications.js: там же живут константы Kokonut (200ms, .23,1,.32,1).
   ========================================================================== */

/* Геометрия стопки до первого кадра JS, чтобы четыре карточки не мигнули
   друг поверх друга. Те же числа, что считает JS: peek 10px, шаг масштаба .04.
   Инлайновые значения из JS перекрывают эти правила. */
.notif:nth-child(2) { --y: 10px; --s: .96; }
.notif:nth-child(3) { --y: 20px; --s: .92; }
.notif:nth-child(4) { --y: 30px; --s: .88; }

/* ==========================================================================
   MERTVIY — INTEGRATION FIXES (Lead)
   ========================================================================== */

/* Крестик 24px после scale стопки (.92) ужимается до 22px и выпадает из
   минимума 24×24 (WCAG 2.5.8). Поднимаем сам хват до 28px: даже в глубине
   стопки он остаётся ≥ 25px, а иконка остаётся прежней. */
.notif-close {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

@media (prefers-reduced-motion: reduce) {
  .notif-close { transition: none; }
}

