/* ═══════════════════════════════════════════════════════════════
   v1.29 «Ритуал откровения» — эффекты момента предсказания.
   Подключается после futurist.css. Только оформление; логика — reveal.js
   ═══════════════════════════════════════════════════════════════ */

/* Слой эффектов поверх страницы: рисует только во время ритуала */
#oracleFx {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 40;
    pointer-events: none;
    mix-blend-mode: screen;
}

/* ── Заряд шара: вращающееся кольцо-прицел ───────────────────── */

.orb::before,
.orb::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 43%;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
    transition: opacity 0.5s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.orb::before {
    width: 128%;
    aspect-ratio: 1;
    border: 1px dashed rgba(94, 226, 240, 0.65);
}
.orb::after {
    width: 112%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-top-color: var(--ion, #5ee2f0);
    border-bottom-color: rgba(85, 128, 247, 0.8);
    filter: drop-shadow(0 0 8px rgba(94, 226, 240, 0.8));
}
.orb.thinking::before { opacity: 0.9; transform: translate(-50%, -50%) scale(1); animation: rvSpin 7s linear infinite; }
.orb.thinking::after  { opacity: 1;   transform: translate(-50%, -50%) scale(1); animation: rvSpin 1.1s linear infinite reverse; }
.orb.thinking .orb-sphere { animation: rvTremble 0.11s linear infinite; }

@keyframes rvSpin    { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes rvTremble {
    0%   { translate: 0 0; }
    25%  { translate: 1px -1px; }
    50%  { translate: -1px 1px; }
    75%  { translate: 1px 1px; }
    100% { translate: 0 0; }
}

/* После откровения кольцо вспыхивает цветом редкости и гаснет */
.orb.revealed::before { animation: rvFade 1.6s ease-out forwards; }
.orb.rev-rare::before      { border-color: rgba(123, 147, 255, 0.9); }
.orb.rev-legendary::before { border-color: rgba(255, 179, 71, 0.95); border-style: solid; }
@keyframes rvFade {
    0%   { opacity: 1;   transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0;   transform: translate(-50%, -50%) scale(1.35); }
}

.orb.rev-legendary .orb-glow {
    background: radial-gradient(circle, rgba(255, 190, 90, 0.7), rgba(255, 140, 40, 0.3) 48%, transparent 70%) !important;
}
.orb.rev-legendary .orb-sphere {
    box-shadow:
        inset 0 -20px 44px rgba(0, 0, 0, 0.6),
        inset 0 12px 26px rgba(255, 240, 210, 0.3),
        0 0 90px rgba(255, 179, 71, 0.65),
        0 18px 40px rgba(0, 0, 0, 0.55) !important;
}

/* Встряска страницы при легендарном ответе (лёгкая, на 0.5 с) */
body.rv-quake .hero { animation: rvQuake 0.5s ease-out; }
@keyframes rvQuake {
    10% { transform: translate(-3px, 2px); }
    25% { transform: translate(3px, -2px); }
    40% { transform: translate(-2px, -1px); }
    60% { transform: translate(2px, 1px); }
    80% { transform: translate(-1px, 0); }
}

/* ── Появление карточки ответа: «материализация» ─────────────── */

.answer-zone.rv-enter .answer-card {
    animation: rvMaterialize 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rvMaterialize {
    0%   { opacity: 0; transform: translateY(18px) scale(0.96); filter: blur(10px) brightness(2); }
    60%  { opacity: 1; filter: blur(0) brightness(1.35); }
    100% { opacity: 1; transform: none; filter: none; }
}

/* Скан-линия, пробегающая по карточке один раз */
.answer-card { position: relative; }
.answer-zone.rv-enter .answer-card .rv-scan {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--rc, #5ee2f0), transparent);
    box-shadow: 0 0 18px 4px color-mix(in srgb, var(--rc, #5ee2f0) 60%, transparent);
    animation: rvScan 1.3s ease-in-out 0.15s 1 both;
}
@keyframes rvScan {
    0%   { top: 0;    opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ── Кнопки действий под ответом ─────────────────────────────── */

.rv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.rv-actions .btn-ghost { margin-top: 0; }
.rv-actions .rv-share {
    border-color: color-mix(in srgb, var(--rc, #5ee2f0) 70%, transparent);
    color: #fff;
    background: color-mix(in srgb, var(--rc, #5ee2f0) 16%, transparent);
}
.rv-actions .rv-share:hover { background: color-mix(in srgb, var(--rc, #5ee2f0) 28%, transparent); }
.rv-actions button[disabled] { opacity: 0.6; cursor: progress; }

/* Предпросмотр открытки */
.rv-preview {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(2, 5, 12, 0.82);
    backdrop-filter: blur(8px);
}
.rv-preview.open { display: flex; animation: rvFadeIn 0.3s ease both; }
.rv-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-height: 100%;
}
.rv-preview img {
    max-height: calc(100vh - 130px);
    max-width: min(100%, 560px);
    width: auto;
    height: auto;
    border: 1px solid var(--line-hot, rgba(94, 226, 240, 0.46));
    box-shadow: 0 0 60px rgba(94, 226, 240, 0.25), 0 30px 80px rgba(0, 0, 0, 0.7);
}
.rv-preview-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@keyframes rvFadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    #oracleFx { display: none; }
    .orb.thinking::before,
    .orb.thinking::after,
    .orb.thinking .orb-sphere,
    body.rv-quake .hero,
    .answer-zone.rv-enter .answer-card,
    .answer-zone.rv-enter .answer-card .rv-scan { animation: none !important; }
    .orb.thinking::before, .orb.thinking::after { opacity: 0.7; }
}
