/*
 * ZN Life Oracle — Cinematic Tap-to-Awaken Overlay
 * ==========================================================
 * A full-screen revelation that rises from the bottom of reality.
 * Designed to stop people mid-scroll and make them feel something.
 */

/* ── Area card tap target ─────────────────────────────────── */
.znr-area-card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.18s ease;
}

.znr-area-card:active {
    transform: scale(0.97);
}

/* Tap ripple pulse on card */
.znr-area-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--ab, rgba(255,255,255,0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.znr-area-card.zn-oracle--tapped::after {
    opacity: 1;
    animation: znOracleTapPulse 0.4s ease-out forwards;
}

@keyframes znOracleTapPulse {
    0%   { opacity: 0.5; transform: scale(1); }
    100% { opacity: 0;   transform: scale(1.06); }
}

/* ── Oracle hint badge (appears on cards on first visit) ─── */
.zn-oracle-hint {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 10px;
    color: var(--at, #555);
    opacity: 0.55;
    letter-spacing: 0.03em;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: opacity 0.3s;
}

.znr-area-card:hover .zn-oracle-hint,
.znr-area-card:focus .zn-oracle-hint {
    opacity: 1;
}

/* ── Main overlay container ───────────────────────────────── */
#zn-oracle-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: block;
    pointer-events: none;
    overflow: hidden;
}

#zn-oracle-overlay.zn-oracle--active {
    pointer-events: all;
}

/* Dark backdrop — fades in */
#zn-oracle-backdrop {
    position: absolute;
    inset: 0;
    background: var(--oracle-dark, #040f10);
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#zn-oracle-overlay.zn-oracle--active #zn-oracle-backdrop {
    opacity: 0.96;
}

/* Cosmic particle field */
#zn-oracle-cosmos {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.zn-oracle-star {
    position: absolute;
    border-radius: 50%;
    background: var(--oracle-glow, #22c55e);
    opacity: 0;
    animation: znStarFade 3s ease-in-out infinite;
}

@keyframes znStarFade {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50%       { opacity: 0.4; transform: scale(1); }
}

/* Glow ring behind emoji */
#zn-oracle-glow-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--oracle-glow, #22c55e) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
    filter: blur(30px);
    pointer-events: none;
}

#zn-oracle-overlay.zn-oracle--active #zn-oracle-glow-ring {
    opacity: 0.22;
}

/* ── Content panel — absolute, top-anchored at 5vh ──────── */
#zn-oracle-panel {
    position: absolute;
    top: 5vh;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 580px;
    padding: 16px 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transform: translateY(110vh);
    will-change: transform;
    z-index: 1;
}

#zn-oracle-overlay.zn-oracle--active #zn-oracle-panel {
    animation: znPanelRise 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

@keyframes znPanelRise {
    from { transform: translateY(110vh); }
    to   { transform: translateY(0); }
}

#zn-oracle-overlay.zn-oracle--dismissing #zn-oracle-panel {
    animation: znPanelSink 0.45s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes znPanelSink {
    from { transform: translateY(0); }
    to   { transform: translateY(110vh); }
}

/* ── Dismiss touch bar ───────────────────────────────────── */
#zn-oracle-dismiss-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
    margin-bottom: 20px;
    transition: background 0.2s;
}

/* ── Area label ──────────────────────────────────────────── */
#zn-oracle-area-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--oracle-glow, #22c55e);
    margin-bottom: 14px;
    opacity: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: znFadeUp 0.5s ease 0.9s forwards;
}

/* ── Main emoji ──────────────────────────────────────────── */
#zn-oracle-emoji {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 18px;
    opacity: 0;
    display: block;
    animation: znEmojiReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s forwards;
    filter: drop-shadow(0 0 20px var(--oracle-glow, #22c55e));
}

@keyframes znEmojiReveal {
    from { opacity: 0; transform: scale(0.4) rotate(-15deg); }
    to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Breathing pulse on emoji after reveal */
.zn-oracle-emoji--breathe {
    animation: znEmojiReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s forwards,
               znEmojiBreathe 4s ease-in-out 1.5s infinite !important;
}

@keyframes znEmojiBreathe {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 20px var(--oracle-glow, #22c55e)); }
    50%       { transform: scale(1.06); filter: drop-shadow(0 0 35px var(--oracle-glow, #22c55e)); }
}

/* ── The oracle sentence ─────────────────────────────────── */
#zn-oracle-sentence {
    font-size: clamp(1.3rem, 5.2vw, 1.8rem);
    line-height: 1.6;
    color: #ffffff;
    font-family: 'Georgia', 'Cambria', 'Times New Roman', serif;
    font-weight: 400;
    font-style: italic;
    max-width: 500px;
    letter-spacing: 0.01em;
    word-spacing: 0.08em;
    min-height: 2em;
    position: relative;
}

/* Word-by-word reveal — inline to preserve natural word spacing */
.zn-oracle-word {
    display: inline;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.zn-oracle-word.zn-word-visible {
    opacity: 1;
}

/* ── Loading spinner ─────────────────────────────────────── */
#zn-oracle-loading {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-bottom: 12px;
    opacity: 0;
    animation: znFadeUp 0.3s ease 0.8s forwards;
}

#zn-oracle-loading.zn-oracle-loading--hidden {
    display: none;
}

.zn-oracle-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--oracle-glow, #22c55e);
    animation: znDotBounce 1.2s ease-in-out infinite;
}

.zn-oracle-dot:nth-child(2) { animation-delay: 0.15s; }
.zn-oracle-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes znDotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%            { transform: scale(1.2); opacity: 1;   }
}

/* ── Divider line ────────────────────────────────────────── */
#zn-oracle-divider {
    width: 0;
    height: 1px;
    background: var(--oracle-glow, #22c55e);
    opacity: 0.4;
    margin: 24px auto;
    transition: width 1.4s ease 1.2s, opacity 0.5s ease 1.2s;
}

#zn-oracle-overlay.zn-oracle--active #zn-oracle-divider {
    width: 80px;
}

/* ── Tap to close prompt — fixed to overlay bottom ──────── */
#zn-oracle-close-hint {
    position: absolute;
    bottom: 28px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    opacity: 0;
    animation: znFadeUp 0.5s ease 3.5s forwards;
    z-index: 1;
}

/* ── Shared fade-up utility ──────────────────────────────── */
@keyframes znFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Dismission: full overlay fade ───────────────────────── */
#zn-oracle-overlay.zn-oracle--dismissing #zn-oracle-backdrop {
    opacity: 0 !important;
    transition: opacity 0.4s ease 0.1s;
}

#zn-oracle-overlay.zn-oracle--dismissing #zn-oracle-glow-ring {
    opacity: 0 !important;
    transition: opacity 0.3s ease;
}

/* ── Mobile refinements ──────────────────────────────────── */
@media (max-width: 480px) {
    #zn-oracle-panel {
        padding: 0 20px 50px;
    }

    #zn-oracle-emoji {
        font-size: 48px;
    }

    #zn-oracle-sentence {
        font-size: clamp(1.15rem, 5vw, 1.5rem);
    }
}
