/* ==========================================================================
   D-NOTIFY: CINEMATIC SCENE & NARRATIVE ENHANCEMENTS
   ========================================================================== */

/* PART 1: CINEMATIC SCENE NAVIGATION */
.content-stack {
    flex: 1;
    position: relative;
    overflow: hidden;
    perspective: 1200px;
    transform-style: preserve-3d;
}

.content-stack::before,
.content-stack::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    background: #020617;
    z-index: 100;
    transition: height 0.6s cubic-bezier(0.65, 0, 0.35, 1);
    pointer-events: none;
}

.content-stack::before {
    top: 0;
}

.content-stack::after {
    bottom: 0;
}

.content-stack.cinematic-transition::before,
.content-stack.cinematic-transition::after {
    height: 50px;
}

.scene {
    position: absolute;
    inset: 0;
    padding: 3.5rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform-origin: center;
    transform-style: preserve-3d;
    will-change: transform, opacity, filter;
}

.scene.active {
    opacity: 1;
    visibility: visible;
}

.scene::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
    z-index: 1;
}

.scene.active::before {
    opacity: 1;
}

#scene-form.active::before {
    display: none;
}

.scene-content {
    position: relative;
    z-index: 2;
    transform-style: preserve-3d;
}

.scene-content::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(147, 218, 151, 0.12) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
}

.scene.active .scene-content::after {
    opacity: 1;
    animation: cinematicFlare 10s ease-in-out infinite;
}

@keyframes cinematicFlare {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.1;
    }

    25% {
        transform: translate(5%, 3%) scale(1.1);
        opacity: 0.2;
    }

    50% {
        transform: translate(-3%, 5%) scale(0.95);
        opacity: 0.05;
    }

    75% {
        transform: translate(2%, -2%) scale(1.05);
        opacity: 0.15;
    }
}

.scene-transition-overlay {
    position: fixed;
    inset: 0;
    background: #020617;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.85;
}

.display-heading {
    font-family: var(--font-heading);
    font-size: 3.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.05;
    background: linear-gradient(135deg, #e5e7eb 0%, #93DA97 25%, #5E936C 50%, #3E5F44 75%, #e5e7eb 100%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.25));
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.scene-description {
    font-size: 1.15rem;
    color: #0ba179;
    max-width: 640px;
    margin-bottom: 2.5rem;
    line-height: 1.8;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
}

.scene.active .scene-description {
    animation: revealText 1s ease 0.5s forwards;
}

@keyframes revealText {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PART 2: NARRATIVE SYSTEM */
.narrative-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    position: relative;
}

.narrative-layout::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(147, 218, 151, 0.15) 0%, rgba(94, 147, 108, 0.1) 40%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    animation: narrativeGlow 4s ease-in-out infinite alternate;
}

@keyframes narrativeGlow {
    0% {
        opacity: 0.2;
        transform: translateY(-50%) scale(1);
    }

    100% {
        opacity: 0.4;
        transform: translateY(-50%) scale(1.1);
    }
}

.narrative-guide {
    position: relative;
    z-index: 2;
}

.guide-image-container {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 3/4;
    border-radius: 24px;
    border: none;
    overflow: hidden;
    margin: 0 auto;
    position: relative;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 0 0 1px rgba(147, 218, 151, 0.3), 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 100px rgba(147, 218, 151, 0.15);
    transform-style: preserve-3d;
}

.guide-image-container::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 27px;
    background: linear-gradient(135deg, rgba(147, 218, 151, 0.8) 0%, rgba(94, 147, 108, 0.5) 25%, rgba(62, 95, 68, 0.5) 50%, rgba(147, 218, 151, 0.8) 75%, rgba(94, 147, 108, 0.5) 100%);
    background-size: 300% 300%;
    z-index: -1;
    animation: holoFrame 6s linear infinite;
}

@keyframes holoFrame {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 300% 50%;
    }
}

.guide-image-container::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.03) 2px, rgba(0, 0, 0, 0.03) 4px);
    pointer-events: none;
    z-index: 5;
}

.guide-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, filter 0.5s ease;
}

.guide-name {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #93DA97;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-shadow: 0 0 12px rgba(147, 218, 151, 0.35);
}

.guide-name::before {
    content: "";
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #93DA97);
}

.guide-name::after {
    content: "DIGITAL GUIDE";
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: #64748b;
    padding: 4px 10px;
    background: rgba(147, 218, 151, 0.1);
    border: 1px solid rgba(147, 218, 151, 0.2);
    border-radius: 20px;
}

.speech-bubble {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    padding: 2.5rem 3rem;
    border-radius: 24px;
    box-shadow: 0 0 0 1px rgba(147, 218, 151, 0.15), 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: left;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.speech-bubble::before {
    content: "";
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 5rem;
    font-family: Georgia, serif;
    color: rgba(147, 218, 151, 0.1);
    line-height: 1;
    pointer-events: none;
}

.speech-bubble::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #93DA97 20%, #5E936C 50%, #3E5F44 80%, transparent 100%);
    background-size: 200% 100%;
    animation: borderFlow 3s linear infinite;
}

@keyframes borderFlow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.speech-content {
    font-size: 1.15rem;
    line-height: 1.9;
    color: #e2e8f0;
    position: relative;
    z-index: 2;
    min-height: 100px;
}

.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.3em;
    background: linear-gradient(180deg, #93DA97, #5E936C);
    margin-left: 4px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s ease infinite;
    box-shadow: 0 0 10px rgba(147, 218, 151, 0.8);
}

@keyframes cursorBlink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.narrative-progress {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.narrative-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.4);
    border: 1px solid rgba(100, 116, 139, 0.3);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.narrative-dot.active {
    background: #93DA97;
    border-color: #93DA97;
    box-shadow: 0 0 15px rgba(147, 218, 151, 0.6);
    transform: scale(1.3);
}

.narrative-dot.completed {
    background: rgba(147, 218, 151, 0.5);
    border-color: rgba(147, 218, 151, 0.5);
}

.nav-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: flex-start;
}

#btn-next,
#btn-finish {
    position: relative;
    overflow: hidden;
}

#btn-next {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.9));
    border: 1px solid rgba(100, 116, 139, 0.4);
    color: #e2e8f0;
    padding: 1rem 2rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
}

#btn-next:hover:not(:disabled) {
    border-color: rgba(147, 218, 151, 0.5);
    box-shadow: 0 0 25px rgba(147, 218, 151, 0.2);
    transform: translateX(5px);
}

#btn-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#btn-finish {
    background: linear-gradient(135deg, #3E5F44 0%, #5E936C 50%, #93DA97 100%);
    background-size: 200% 200%;
    border: none;
    color: white;
    padding: 1.1rem 2.5rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(147, 218, 151, 0.3), 0 10px 30px rgba(62, 95, 68, 0.4);
    animation: finishPulse 2s ease infinite;
    display: none;
}

@keyframes finishPulse {

    0%,
    100% {
        background-position: 0% 50%;
        box-shadow: 0 0 0 1px rgba(147, 218, 151, 0.3), 0 10px 30px rgba(62, 95, 68, 0.4);
    }

    50% {
        background-position: 100% 50%;
        box-shadow: 0 0 0 1px rgba(147, 218, 151, 0.5), 0 15px 40px rgba(62, 95, 68, 0.6), 0 0 60px rgba(147, 218, 151, 0.3);
    }
}

#btn-finish:hover {
    transform: translateY(-3px) scale(1.02);
}

.skip-narrative {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    font-size: 0.8rem;
    color: #ef4444;
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid #ef4444;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.05);
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.skip-narrative:hover {
    color: #f87171;
    border-color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

@keyframes pulse-talk {
    0% {
        filter: drop-shadow(0 0 8px rgba(147, 218, 151, 0.4));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(147, 218, 151, 0.8));
        transform: scale(1.02);
    }

    100% {
        filter: drop-shadow(0 0 8px rgba(147, 218, 151, 0.4));
        transform: scale(1);
    }
}

.avatar-talking {
    animation: pulse-talk 0.4s infinite ease-in-out;
}

.soundwave-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 3px;
    height: 30px;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.soundwave-container.active {
    opacity: 1;
}

.soundwave-bar {
    width: 4px;
    background: linear-gradient(180deg, #93DA97, #5E936C);
    border-radius: 2px;
    animation: soundwave 0.5s ease infinite;
}

.soundwave-bar:nth-child(1) {
    height: 8px;
    animation-delay: 0s;
}

.soundwave-bar:nth-child(2) {
    height: 16px;
    animation-delay: 0.1s;
}

.soundwave-bar:nth-child(3) {
    height: 24px;
    animation-delay: 0.2s;
}

.soundwave-bar:nth-child(4) {
    height: 12px;
    animation-delay: 0.3s;
}

.soundwave-bar:nth-child(5) {
    height: 20px;
    animation-delay: 0.15s;
}

@keyframes soundwave {

    0%,
    100% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }
}

.importance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #fbbf24;
    margin-bottom: 1rem;
}

/* PART 3: AVATAR CARDS */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    width: 100%;
    max-width: 1000px;
}

.avatar-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 24px;
    padding: 2.5rem 1.5rem 2rem;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.avatar-card::before {
    content: "";
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: radial-gradient(circle at center, rgba(147, 218, 151, 0.1) 0%, transparent 40%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.avatar-card:hover::before {
    opacity: 1;
    animation: spotlightMove 3s ease infinite;
}

@keyframes spotlightMove {
    0% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(10%, 10%);
    }

    100% {
        transform: translate(0, 0);
    }
}

.avatar-card:hover {
    transform: translateY(-15px) scale(1.03);
    border-color: rgba(147, 218, 151, 0.4);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 60px rgba(147, 218, 151, 0.15);
}

.avatar-card.active {
    border-color: #93DA97;
    background: linear-gradient(180deg, rgba(62, 95, 68, 0.3) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.avatar-image {
    width: 130px;
    height: 130px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    border: 3px solid rgba(147, 218, 151, 0.3);
    overflow: hidden;
    background: linear-gradient(180deg, #1e293b, #0f172a);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.8), 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
}

.avatar-card:hover .avatar-image {
    border-color: rgba(147, 218, 151, 0.6);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.8), 0 0 30px rgba(147, 218, 151, 0.3);
}

.avatar-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #e2e8f0;
    margin-bottom: 0.5rem;
}

.avatar-role {
    font-size: 0.8rem;
    color: #64748b;
}

.avatar-glow {
    position: absolute;
    inset: -2px;
    border-radius: 26px;
    opacity: 0;
    background: linear-gradient(135deg, #93DA97, #5E936C, #3E5F44, #93DA97);
    background-size: 300% 300%;
    z-index: -1;
    transition: opacity 0.4s ease;
}

.avatar-card.active .avatar-glow {
    opacity: 1;
    animation: glowRotate 4s linear infinite;
}

@keyframes glowRotate {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 300% 50%;
    }
}

.section-heading {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
    position: relative;
    display: inline-block;
}

.section-heading::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #93DA97, #5E936C);
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .narrative-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .narrative-layout::before {
        display: none;
    }

    .guide-image-container {
        max-width: 200px;
        aspect-ratio: 1;
    }

    .guide-name {
        justify-content: center;
    }

    .guide-name::before {
        display: none;
    }

    .nav-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .avatar-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto;
    }
}

/* ==========================================================================
   PART 4: NEURAL LOADING OVERLAY
   ========================================================================== */
.neural-overlay {
    position: fixed;
    inset: 0;
    background: #020617;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}

.neural-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(45, 212, 191, 0.05), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(37, 99, 235, 0.05), transparent 40%);
    z-index: 1;
}

.loader-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.neural-core {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-ring {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
    animation: coreRotate 4s linear infinite;
}

.core-ring:nth-child(1) {
    width: 100%;
    height: 100%;
    border-top-color: #2dd4bf;
    border-bottom-color: #2dd4bf;
    animation-duration: 3s;
}

.core-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    border-left-color: #3b82f6;
    border-right-color: #3b82f6;
    animation-duration: 2s;
    animation-direction: reverse;
}

.core-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    border-top-color: #8b5cf6;
    border-bottom-color: #8b5cf6;
    animation-duration: 4s;
}

.core-pulse {
    width: 20px;
    height: 20px;
    background: #2dd4bf;
    border-radius: 50%;
    box-shadow: 0 0 30px #2dd4bf, 0 0 60px #3b82f6;
    animation: corePulse 1.5s ease-in-out infinite alternate;
}

@keyframes coreRotate {
    to {
        transform: rotate(360deg);
    }
}

@keyframes corePulse {
    from {
        transform: scale(0.8);
        opacity: 0.5;
    }

    to {
        transform: scale(1.2);
        opacity: 1;
    }
}

.loader-info {
    text-align: center;
    width: 300px;
}

.loader-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.loader-subtitle {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: #64748b;
    margin-bottom: 2rem;
}

.loader-progress-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
}

.loader-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2dd4bf, #3b82f6);
    box-shadow: 0 0 15px #2dd4bf;
    transition: width 0.3s ease;
}

.loader-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #2dd4bf;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.neural-scan-line {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, transparent, rgba(45, 212, 191, 0.05), transparent);
    animation: scanMove 3s linear infinite;
    z-index: 3;
}

@keyframes scanMove {
    to {
        top: 200%;
    }
}