/* ============================================================
   БАНК ХВБ — трейлер (главная). 3D-сцена из trailer.js слева,
   текст справа.
   ============================================================ */

/* кнопка на главной */
.px-trailer-btn { position: relative; display: inline-flex; align-items: center; gap: 12px; height: 46px; padding: 0 20px 0 8px; border-radius: 999px; cursor: pointer;
    font: 700 14px/1 var(--ui); letter-spacing: .02em; color: var(--cream); background: rgba(242, 232, 213, .06); border: 1px solid rgba(242, 232, 213, .16);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: background .4s var(--ease), border-color .4s, transform .5s var(--ease); }
.px-trailer-btn:hover { background: rgba(242, 232, 213, .12); border-color: rgba(242, 232, 213, .35); transform: translateY(-2px); }
.px-trailer-btn .play { position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); color: #000; }
.px-trailer-btn .play::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(242, 232, 213, .5); animation: playRing 2s ease-out infinite; }
.px-trailer-btn .play svg { width: 12px; height: 12px; margin-left: 2px; }
@keyframes playRing { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.px-trailer-btn:hover .play { animation: playNudge .6s var(--ease); }
@keyframes playNudge { 40% { transform: scale(1.15); } }
/* оверлей */
html.tr-lock, html.tr-lock body { overflow: hidden; }
.tr { position: fixed; inset: 0; z-index: 6000; color: var(--cream); opacity: 0; transition: opacity .5s ease; font-family: var(--ui); overflow: hidden; }
.tr.open { opacity: 1; }
.tr-bg { position: absolute; inset: -4%; background: #05070d center / cover no-repeat; filter: blur(6px) brightness(.3) saturate(.9); animation: trBg 30s ease-in-out infinite alternate; }
.tr::before { content: ''; position: absolute; inset: 0; background: radial-gradient(90% 80% at 30% 60%, transparent 20%, rgba(0, 0, 0, .7)); pointer-events: none; }
@keyframes trBg { to { transform: scale(1.08) translate(-1.5%, -1%); } }

.tr-top { position: absolute; top: 18px; left: clamp(16px, 4vw, 48px); right: clamp(16px, 4vw, 48px); z-index: 5; display: flex; align-items: center; gap: 18px; }
.tr-bars { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tr-bar { appearance: none; border: 0; padding: 8px 0; background: none; cursor: pointer; }
.tr-bar i { display: block; height: 3px; border-radius: 3px; background: linear-gradient(var(--cream), var(--cream)) 0 0 / 0% 100% no-repeat, rgba(242, 232, 213, .18); transition: height .3s var(--ease); }
.tr-bar:hover i { height: 6px; }
.tr-bar.done i { background-size: 100% 100%; }
.tr-bar.cur i { animation-name: trBar; animation-timing-function: linear; animation-fill-mode: forwards; }
.tr.paused .tr-bar.cur i { animation-play-state: paused; }
@keyframes trBar { to { background-size: 100% 100%; } }
.tr-x { appearance: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; color: var(--cream); font-size: 16px; background: rgba(242, 232, 213, .06); border: 1px solid rgba(242, 232, 213, .18); transition: transform .5s var(--ease), background .3s; }
.tr-x:hover { transform: rotate(90deg); background: rgba(242, 232, 213, .16); }

/* слева 3D, справа текст */
.tr-slides { position: absolute; inset: 70px 0 74px; z-index: 3; pointer-events: none; }
.tr.shake .tr-slides { animation: trShake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes trShake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(6px, -3px); } 30%, 50%, 70% { transform: translate(-10px, 4px); } 40%, 60% { transform: translate(10px, -4px); } }
.tr-slide { position: absolute; inset: 0; display: grid; grid-template-columns: 58% 42%; align-items: center; visibility: hidden; opacity: 0; }
.tr-slide.on { visibility: visible; opacity: 1; transition: opacity .6s ease; }
.tr-slide.out { visibility: visible; }
.tr-slide.out-fade { animation: outFade .6s var(--ease) forwards; }
.tr-slide.out-crack { animation: outCrack .7s cubic-bezier(.6, 0, .9, .4) forwards; }
@keyframes outFade { to { opacity: 0; transform: translateY(-24px); } }
@keyframes outCrack { 0% { transform: none; } 30% { transform: scale(1.02); } 100% { opacity: 0; transform: scale(.94) translateY(40px) rotate(-1.5deg); } }

.tr-3d { position: absolute; top: 70px; bottom: 74px; left: 0; width: 58%; z-index: 2; transition: opacity .3s ease, filter .3s ease; }
.tr-3d canvas { display: block; }
.tr-3d.swap { opacity: 0; filter: brightness(2) blur(4px); }
.tr-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 14px; font-weight: 700; color: var(--cream-2); letter-spacing: .04em; animation: loadPulse 1.2s ease-in-out infinite; }
@keyframes loadPulse { 50% { opacity: .4; } }
.tr-say { position: absolute; left: 0; top: 0; min-width: 120px; max-width: 260px; padding: 12px 16px; border-radius: 16px 16px 16px 4px; pointer-events: none;
    font: 700 14px/1.35 var(--ui); color: #111; background: var(--cream); box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .7); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.tr-say.on { opacity: 1; }
.tr-say.typing span::after { content: '▌'; margin-left: 1px; animation: caret .8s steps(1) infinite; color: #777; }
@keyframes caret { 50% { opacity: 0; } }

/* ---------- текст справа ---------- */
.tr-copy { grid-column: 2; position: relative; z-index: 3; min-width: 0; padding: 0 clamp(20px, 4vw, 64px) 0 clamp(8px, 1.5vw, 24px); pointer-events: auto; }
.tr-kicker { font-size: 12px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--cream-2); opacity: 0; transform: translateY(12px); }
.tr-kicker b { color: var(--cream); }
.tr-title { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 3.4vw, 58px); line-height: 1.02; letter-spacing: -.04em; margin: 16px 0 0; color: var(--cream); }
.tr-title .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; max-width: 100%; }
.tr-title .w > span { display: inline-block; transform: translateY(110%); transition: color .3s; }
.tr-title .w:hover > span { color: #f3c46b; }
.tr-text { margin: 18px 0 0; font-size: 16.5px; line-height: 1.55; color: var(--ink-2); max-width: 480px; opacity: 0; transform: translateY(14px); }
.tr-chips { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tr-chips li { position: relative; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--cream); background: rgba(242, 232, 213, .06); border: 1px solid rgba(242, 232, 213, .14);
    opacity: 0; transform: translateY(16px) scale(.96); transition: background .35s, border-color .35s, transform .45s var(--ease), box-shadow .45s; cursor: default; overflow: hidden; }
.tr-chips li::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 246, 228, .2) 50%, transparent 70%); transform: translateX(-100%); transition: transform .8s var(--ease); }
.tr-chips li:hover { background: rgba(242, 232, 213, .14); border-color: rgba(242, 232, 213, .4); transform: translateY(-4px) scale(1.03) !important; box-shadow: 0 14px 30px -14px rgba(242, 232, 213, .4); }
.tr-chips li:hover::before { transform: translateX(100%); }
.tr-slide.on .tr-kicker { animation: rise .7s var(--ease) .15s forwards; }
.tr-slide.on .tr-title .w > span { animation: wordUp .9s var(--ease) forwards; }
.tr-slide.on .tr-title .w:nth-child(2) > span { animation-delay: .08s; } .tr-slide.on .tr-title .w:nth-child(3) > span { animation-delay: .16s; } .tr-slide.on .tr-title .w:nth-child(4) > span { animation-delay: .24s; }
.tr-slide.on .tr-text { animation: rise .9s var(--ease) .45s forwards; }
.tr-slide.on .tr-chips li { animation: rise .7s var(--ease) calc(.7s + var(--k) * .1s) forwards; }
.tr-slide.on .tr-cta { animation: rise .8s var(--ease) 1.1s forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes wordUp { to { transform: none; } }
.tr-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; opacity: 0; transform: translateY(14px); }
.tr-again { appearance: none; border: 0; background: none; color: var(--cream-2); font: 700 13px var(--ui); cursor: pointer; padding: 0 10px; text-decoration: underline; text-underline-offset: 4px; }
.tr-again:hover { color: var(--cream); }

.tr-nav { position: absolute; left: 0; right: 0; bottom: 18px; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 18px; }
.tr-nav button { appearance: none; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--cream); background: rgba(242, 232, 213, .06); border: 1px solid rgba(242, 232, 213, .18); transition: background .3s, transform .45s var(--ease); }
.tr-nav button:hover { background: var(--cream); color: #000; transform: scale(1.08); }
.tr-hint { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.tr.paused .tr-hint { color: var(--cream); }

/* трещины и вспышка */
.tr-crack { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 7; pointer-events: none; opacity: 0; }
.tr.cracked .tr-crack { opacity: 1; }
.tr-crack path { fill: none; stroke: rgba(255, 255, 255, .88); stroke-width: 2; stroke-linejoin: bevel; stroke-dasharray: 2400; stroke-dashoffset: 2400; filter: drop-shadow(0 0 3px rgba(190, 220, 255, .8)); }
.tr-crack .br { stroke-width: 1.2; stroke: rgba(255, 255, 255, .6); }
.tr-crack .ring { stroke-width: 1.4; stroke: rgba(255, 255, 255, .5); }
.tr.cracked .tr-crack path { animation: crackDraw .45s cubic-bezier(.2, .8, .3, 1) var(--d, 0s) forwards; }
@keyframes crackDraw { to { stroke-dashoffset: 0; } }
.tr-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 8; background: radial-gradient(circle at 35% 45%, rgba(255, 246, 225, .85), rgba(243, 196, 107, .18) 40%, transparent 70%); }
.tr.flash .tr-flash { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 820px) {
    .tr-slides { inset: 64px 0 76px; }
    .tr-3d { top: 64px; bottom: auto; width: 100%; height: calc(52% - 40px); }
    .tr-slide { grid-template-columns: 1fr; grid-template-rows: 52% 48%; align-items: start; }
    .tr-copy { grid-column: 1; grid-row: 2; padding: 6px 20px 0; }
    .tr-title { font-size: 28px; }
    .tr-text { font-size: 14.5px; margin-top: 10px; }
    .tr-chips { margin-top: 12px; }
    .tr-chips li { font-size: 12.5px; padding: 8px 12px; }
    .tr-hint { display: none; }
    .tr-say { font-size: 12.5px; padding: 9px 12px; white-space: normal; max-width: 60vw; }
}
