/* =========================================================
   DM Music Distribution — анимации
   Подключается после style.css
   ========================================================= */
:root { --spring: cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.1); } }
@keyframes bar-in { from { height: 0; opacity: 0; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(120%); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(62,224,154,.45); } 100% { box-shadow: 0 0 0 14px rgba(62,224,154,0); } }
@keyframes track-out { to { opacity: 0; transform: scale(.97) translateY(-6px); } }
@keyframes seg-in { from { opacity: .4; transform: scale(.94); } }
@keyframes line-grow { from { transform: scaleX(0); } }

/* --- переходы между страницами (Chrome, Edge, Safari 18+) --- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root) { animation: vt-out .2s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .4s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }
.site-header { view-transition-name: site-header; }
::view-transition-group(site-header) { animation-duration: 0s; }

/* --- появление при прокрутке (класс ставит app.js) --- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease) !important; transition-delay: calc(var(--i, 0) * 80ms) !important; }
.reveal.is-in { opacity: 1; transform: none; }

/* --- появление элементов списков (класс ставит DM.stagger) --- */
.anim-in { animation: fade-up .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* --- шапка --- */
.site-header { transition: background .35s, box-shadow .35s, border-color .35s; }
.site-header.is-scrolled { background: rgba(6, 8, 11, .92); box-shadow: 0 12px 34px -20px rgba(0,0,0,.95); }
.brand svg { transition: transform .5s var(--spring); }
.brand:hover svg { transform: rotate(-8deg) scale(1.08); }
.menu-open .nav a { animation: fade-up .4s var(--ease) both; }
.menu-open .nav a:nth-child(2) { animation-delay: .04s; }
.menu-open .nav a:nth-child(3) { animation-delay: .08s; }
.menu-open .nav a:nth-child(4) { animation-delay: .12s; }
.menu-open .nav a:nth-child(5) { animation-delay: .16s; }
.menu-open .nav a:nth-child(6) { animation-delay: .2s; }

/* --- кнопки и ссылки --- */
.btn { transition: transform .25s var(--ease), background .25s, border-color .25s, color .25s, box-shadow .3s, opacity .25s; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); transition-duration: .08s; }
.btn svg { transition: transform .35s var(--spring); }
.btn:hover .i-arrow { transform: translateX(4px); }
.btn:hover .i-plus { transform: rotate(90deg); }
.icon-btn { transition: background .2s, color .2s, transform .25s var(--spring); }
.icon-btn:hover:not([disabled]) { transform: scale(1.1); }
.icon-btn:active { transform: scale(.92); }
.link { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .35s var(--ease), color .2s; }
.link:hover { text-decoration: none; background-size: 100% 1px; }
.footer-links a, .nav a { transition: color .25s, background .25s; }

/* --- герой --- */
.hero-grid > div:first-child > * { animation: fade-up .8s var(--ease) both; }
.hero-grid > div:first-child > :nth-child(2) { animation-delay: .08s; }
.hero-grid > div:first-child > :nth-child(3) { animation-delay: .16s; }
.hero-grid > div:first-child > :nth-child(4) { animation-delay: .24s; }
.hero-grid > div:first-child > :nth-child(5) { animation-delay: .32s; }
.wave i { animation: bar-in 1s var(--ease) both, wave 1.6s ease-in-out infinite alternate; animation-delay: calc(var(--n, 0) * 50ms + .15s), var(--d); }
.hero::before { animation: fade-in 2s var(--ease) both; }
.hero-meta b, .stat b { font-variant-numeric: tabular-nums; }
.eyebrow::before { transform-origin: left; animation: line-grow .9s .3s var(--ease) both; }

/* --- бегущая строка --- */
.marquee { -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee span { transition: color .3s; }
.marquee span:hover { color: var(--text); }

/* --- заголовки страниц --- */
.page-head .container > *, .dash-head > * { animation: fade-up .7s var(--ease) both; }
.page-head .container > :nth-child(2), .dash-head > :nth-child(2) { animation-delay: .08s; }
.page-head .container > :nth-child(3) { animation-delay: .16s; }

/* --- карточки: подъём при наведении --- */
.feature, .plan, .platform, .stat, .rel, .msg, .empty, .d-track {
  transition: transform .45s var(--ease), border-color .3s, box-shadow .45s var(--ease), background .3s;
}
.feature:hover, .plan:hover, .platform:hover {
  transform: translateY(-5px);
  border-color: var(--line-2);
  box-shadow: 0 24px 48px -28px rgba(0,0,0,.95), 0 0 0 1px rgba(47,224,255,.08);
}
.plan.is-featured:hover { border-color: rgba(47,224,255,.7); box-shadow: 0 24px 60px -28px rgba(47,224,255,.35); }
.feature .ico, .platform i { transition: transform .5s var(--spring); }
.feature:hover .ico { transform: scale(1.12) rotate(-6deg); }
.platform:hover i { transform: scale(1.12) rotate(6deg); }
.step { transition: border-color .4s; }
.step:hover { border-color: var(--accent); }
.stat:hover { transform: translateY(-3px); }
.rel:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -26px rgba(0,0,0,.95); }
.rel-cover { transition: transform .5s var(--ease); }
.rel:hover .rel-cover { transform: scale(1.05) rotate(-1deg); }
.cta-band { transition: border-color .4s, background-position .8s var(--ease); background-size: 140% 140%; background-position: 100% 0; }
.cta-band:hover { border-color: rgba(47,224,255,.35); background-position: 70% 30%; }

/* --- формы --- */
.input, .select, .textarea, .chips { transition: border-color .2s, box-shadow .25s, background .25s; }
.is-invalid { animation: shake .45s var(--ease); }
.check input { transition: background .2s, border-color .2s, transform .2s var(--spring); }
.check input:active { transform: scale(.85); }
.check input:checked::after { animation: pop .3s var(--spring) both; }
.seg span { transition: background .25s, color .25s, box-shadow .25s; }
.seg input:checked + span { animation: seg-in .35s var(--ease); }
.tabs button { transition: background .25s, color .25s, box-shadow .25s; }
.tabs button.is-active { animation: seg-in .35s var(--ease); }
[data-only="register"]:not([hidden]) { animation: fade-up .4s var(--ease) both; }
.chip { transition: background .2s, border-color .2s; }
.chip.is-new { animation: pop .35s var(--spring) both; }
.chip button { transition: background .15s, color .15s, transform .25s var(--spring); }
.chip button:hover { transform: rotate(90deg); }
.alert { animation: fade-up .4s var(--ease) both; }
.progress i { background-color: var(--accent); background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; transition: width .3s var(--ease); }

/* --- загрузка файлов --- */
.drop { transition: border-color .25s, background .25s, transform .3s var(--ease); }
.drop:hover { transform: translateY(-1px); }
.drop-ico { transition: background .3s, color .3s, transform .4s var(--spring); }
.drop:hover .drop-ico { transform: scale(1.08); }
.drop.is-fresh { animation: glow 1s var(--ease); }
.drop.is-fresh .drop-ico { animation: pop .5s var(--spring); }
.drop.is-error { animation: shake .45s var(--ease); }
.cover-preview { transition: border-color .25s, transform .4s var(--ease); }
.cover-preview:hover { transform: scale(1.015); }
.cover-preview img { animation: fade-in .6s var(--ease); transition: transform .6s var(--ease); }
.cover-preview:hover img { transform: scale(1.04); }
.cover-preview.is-fresh { animation: glow 1s var(--ease); }
.cover-preview .ph svg { transition: transform .4s var(--spring); }
.cover-preview:hover .ph svg { transform: translateY(-3px) scale(1.1); }

/* --- треки: плавное раскрытие, добавление, удаление --- */
.track { transition: border-color .3s, box-shadow .3s; }
.track.is-open { border-color: rgba(47,224,255,.22); box-shadow: 0 14px 40px -28px rgba(47,224,255,.35); }
.track-head { transition: background .2s; }
.track-head:hover { background: rgba(255,255,255,.02); }
.track-collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--ease); }
.track.is-open .track-collapse { grid-template-rows: 1fr; }
.track-inner { min-height: 0; overflow: hidden; }
.track-body { display: block !important; opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .4s var(--ease); }
.track.is-open .track-body { opacity: 1; transform: none; transition-delay: .08s; }
.chev { transition: transform .4s var(--ease); }
.track.is-new { animation: fade-up .5s var(--ease) both; }
.track.is-leaving { animation: track-out .3s var(--ease) forwards; pointer-events: none; }
.track-state { transition: background .3s, color .3s; }
.track-num { transition: background .3s, border-color .3s, color .3s; }
.track.is-open .track-num { background: var(--accent-soft); border-color: rgba(47,224,255,.3); color: var(--accent); }
.add-track { transition: border-color .25s, color .25s, background .25s, transform .3s var(--ease); }
.add-track:hover { transform: translateY(-2px); }
.add-track svg { transition: transform .4s var(--spring); }
.add-track:hover svg { transform: rotate(90deg); }
.type-pill.bump { animation: bump .4s var(--spring); }
.submit-bar { animation: slide-up .7s .35s var(--ease) both; }
.rf-nav a { transition: background .2s, color .2s, transform .3s var(--ease); }
.rf-nav a:hover { transform: translateX(3px); }
.rf-nav a b { transition: background .3s, color .3s, border-color .3s; }
.rf-nav a.is-current { color: var(--text); }
.rf-nav a.is-current b { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* --- вход --- */
.auth-box { animation: fade-up .7s var(--ease) both; }
.auth-side > *:not(.wave) { animation: fade-up .8s var(--ease) both; }
.auth-side > :nth-child(2) { animation-delay: .08s; }
.auth-side > :nth-child(3) { animation-delay: .16s; }

/* --- выдвижная панель --- */
.drawer-bg { transition: opacity .35s, backdrop-filter .35s; }
.drawer-open .drawer-bg { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.drawer { transition: transform .5s var(--ease); }
.drawer-open .drawer-body > * { animation: fade-up .5s var(--ease) both; }
.drawer-open .drawer-body > :nth-child(1) { animation-delay: .1s; }
.drawer-open .drawer-body > :nth-child(2) { animation-delay: .15s; }
.drawer-open .drawer-body > :nth-child(3) { animation-delay: .2s; }
.drawer-open .drawer-body > :nth-child(4) { animation-delay: .25s; }
.drawer-open .drawer-body > :nth-child(5) { animation-delay: .3s; }
.drawer-open .drawer-body > :nth-child(n+6) { animation-delay: .35s; }
.d-top img { transition: transform .5s var(--ease); }
.d-top a:hover img { transform: scale(1.03); }

/* --- админка --- */
.admin-tabs button { position: relative; transition: color .25s; }
.admin-tabs button.is-active { border-color: transparent; }
.admin-tabs button::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform .45s var(--ease); }
.admin-tabs button.is-active::after { transform: scaleX(1); }
.count { transition: background .3s, color .3s; }
.count.hot { animation: pop .5s var(--spring); }
.filter-chips button { transition: background .25s, color .25s, border-color .25s, transform .25s var(--spring); }
.filter-chips button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.3); }
.status-actions button { transition: background .2s, box-shadow .3s, transform .25s var(--spring); }
.status-actions button:hover { transform: translateY(-2px); }
.status-actions button.is-current { animation: bump .4s var(--spring); }
.t-rel img { transition: transform .4s var(--ease); }
tbody tr.clickable:hover .t-rel img { transform: scale(1.08); }
.msg { transition: opacity .4s, border-color .3s; }
.msg:hover { border-color: var(--line-2); }

/* --- тост --- */
.toast { transition: opacity .3s, transform .45s var(--spring); }

/* --- без анимаций для тех, кто их отключил в системе --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
