* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Remove dynamic viewport height on mobile - causes jumping */

body {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFFFFF 100%);
    overflow-x: hidden;
    overflow-y: auto;
    color: #000000;
    position: relative;
    /* Optimize for smooth scrolling */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Enable momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
}

/* Ensure sections don't hide behind fixed header */
html {
    scroll-padding-top: 60px;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 50px;
    }
}

@media (max-width: 480px) {
    html {
        scroll-padding-top: 45px;
    }
}

/* Prevent body scroll when navigation is open */
body.nav-open {
    overflow: hidden !important;
}

/* Lenis smooth scroll optimization */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

/* GSAP ScrollTrigger optimizations */
body.hero-active {
    overflow-x: hidden;
    overflow-y: auto;
}

body.hero-active .main-container {
    z-index: 100;
}

body:not(.hero-active) .main-container {
    z-index: 0 !important;
    pointer-events: none;
}

/* Allow scrolling on mobile */
@media (max-width: 768px) {
    body.hero-active {
        overflow-y: auto;
    }
}

/* Enhanced 3D performance - simplified */
.main-container {
    transform-style: preserve-3d;
    will-change: auto;
    /* Let browser decide */
}

.enchanted-codex {
    transform-style: preserve-3d;
    perspective: 2000px;
    perspective-origin: center center;
}

/* Main Container Layout */
.main-container {
    position: relative;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    visibility: visible;
    opacity: 1;
    z-index: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease, z-index 0s;
}

/* Desktop: keep hero container full-height */
@media (min-width: 768px) {
  .main-container {
    height: 100vh;
    min-height: 100vh;
    z-index: 1;
  }
}

/* Mobile: ensure hero doesn't overlap other sections */
@media (max-width: 767px) {
    .main-container {
        z-index: 1;
        position: relative;
    }
    
    /* Ensure sections appear above hero on mobile */
    .aboutsection,
    .powers-section,
    .achievements-section,
    #about,
    #powers,
    #achievements,
    #gallery,
    #faq,
    #team,
    #contact,
    .footer-section {
        position: relative;
        z-index: 2;
        background: #FFFFFF;
    }
}

/* Desktop: sections below hero - proper stacking order */
@media (min-width: 768px) {
    .aboutsection,
    .powers-section,
    #about,
    #powers,
    #gallery,
    #faq,
    #team,
    #contact {
        position: relative;
        z-index: 10;
        background: #FFFFFF;
    }
    
    /* Achievements section needs higher z-index for pinning */
    .achievements-section,
    #achievements {
        position: relative;
        z-index: 50;
        background: #FFFFFF;
    }
    
    /* Ensure sections don't overlap during hero animation */
    body.hero-active .aboutsection,
    body.hero-active .powers-section,
    body.hero-active #about,
    body.hero-active #powers {
        z-index: 2;
    }
    
    /* Keep achievements high even during hero */
    body.hero-active .achievements-section,
    body.hero-active #achievements {
        z-index: 50;
    }
    
    /* Sections after achievements should be below it */
    body.hero-active #gallery,
    body.hero-active #faq,
    body.hero-active #team,
    body.hero-active #contact {
        z-index: 2;
    }
}

/* Left Content Area */
.content-area {
    width: 50%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
    -webkit-overflow-scrolling: touch;
    z-index: 5;
}

@media (min-width: 768px) {
  .content-area {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: flex !important;
  }
  
  /* Force all child elements to be visible */
  .content-area * {
    visibility: visible !important;
  }
}

/* Ensure content-area is visible on large screens */
@media (min-width: 768px) {
    .content-area {
        display: flex !important;
        width: 50%;
    }

    .book-area {
        width: 50%;
        display: flex !important;
    }

    .page-content {
        flex-direction: column;
    }

    .main-container {
        flex-direction: row;
    }
}

@media (max-width: 1024px) {
     .content-slide .final-text{
        display: none;
    }
    .slide-title {
    font-size: clamp(1rem, 2vw, 2rem);
   
    }
    .slide-text {
    font-size: clamp(1rem, 2vw, 1rem);
    }
    .content-area {
        padding: 40px;
        display: flex;
    }

    .enchanted-codex {
        width: min(340px, 70vw);
        height: min(460px, 70vh);
    }

    .page-content {
        padding: 20px 22px;
        flex-direction: column;
    }

    .mystical-scene {
        width: 160px;
        height: 130px;
    }

    .cover-title {
        font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    }

    .cover-subtitle {
        font-size: clamp(0.9rem, 2.2vw, 1rem);
    }

    .chapter-number {
        font-size: 1.5rem;
    }

    .page-ornament {
        font-size: 1rem;
        letter-spacing: 6px;
    }
}

@media (max-width: 767px) {
    .main-container {
        position: relative;
        height: 100vh;
        min-height: 100vh;
    }

    .content-area {
        display: none !important;
    }

    .book-area {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        display: flex !important;
    }

    .enchanted-codex {
        width: min(380px, 86vw);
        height: min(520px, 80vh);
    }

    .mystical-scene {
        width: 150px;
        height: 125px;
    }

    .page-content {
        padding: 18px 20px;
        flex-direction: column;
    }
}

/* Mobile First Responsive Adjustments */
@media (max-width: 480px) {
    .main-container {
        position: relative;
        height: 100vh;
        min-height: 100vh;
    }

    .content-area {
        display: none !important;
    }

    .book-area {
        display: flex !important;
        width: 100%;
        height: 100vh;
        min-height: 100vh;
    }

    .page-content {
        flex-direction: column;
    }
}

.text-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 10;
}

/* Ensure text content is visible on desktop */
@media (min-width: 768px) {
    .text-content {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

.content-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transform: translateX(-50px);
    align-content: center;
    pointer-events: none;
    z-index: 1;
    will-change: opacity, transform;
}

.content-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    z-index: 10;
}

/* Initial state for first slide - visible but GSAP can animate it */
.content-slide[data-slide="cover"] {
    display: block !important;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    z-index: 10;
}

/* Desktop specific rules */
@media (min-width: 768px) {
    /* Ensure content area is ALWAYS visible on desktop */
    .content-area {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

.slide-content {
    text-align: left;
}

.main-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #B10000, #000000, #B10000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Cinzel', serif;
    line-height: 1.2;
}

.main-subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: #B10000;
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
    margin-bottom: 40px;
    opacity: 0.9;
}

.mystical-symbol-left {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 30px 0;
}

.chapter-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(177, 0, 0, 0.1);
    border: 2px solid #B10000;
    border-radius: 25px;
    color: #B10000;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slide-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 25px;
    color: #000000;
    font-family: 'Cinzel', serif;
    line-height: 1.2;
}

.slide-text {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    line-height: 1.8;
    color: #000000;
    font-family: 'Cormorant Garamond', serif;
    margin-bottom: 30px;
    opacity: 0.9;
}

.slide-keywords {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.keyword {
    padding: 8px 16px;
    background: transparent;
    border: 1.5px solid rgba(177, 0, 0, 0.3);
    border-radius: 6px;
    color: #B10000;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Cormorant Garamond', serif;
    transition: all 0.3s ease;
    display: inline-block;
}

.keyword:hover {
    background: rgba(177, 0, 0, 0.05);
    border-color: #B10000;
    color: #000000;
}

.final-slide {
    text-align: center;
}

.final-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 25px;
    background: linear-gradient(45deg, #B10000, #000000, #B10000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Cinzel', serif;
}

.final-text {
    font-size: 1.3rem;
    line-height: 1.7;
    color: #000000;
    font-family: 'Cormorant Garamond', serif;
    margin-bottom: 10px;
    opacity: 0.9;
}

.cta-button {
    padding: 16px 36px;
    background: #B10000;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.cta-button:hover {
    background: #8B0000;
    transform: translateY(-2px);
}

.cta-button:active {
    transform: translateY(0);
}

.cta-glow {
    display: none;
}

/* Right Book Area */
.book-area {
    width: 50%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 3000px;
}

.enchanted-codex {
    position: relative;
    width: min(400px, 80vw);
    height: min(530px, 78vh);
    transform-style: preserve-3d;
}

/* Ancient Codex Cover */
.codex-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform-origin: left center;
    cursor: pointer;
    transition: transform 1.2s cubic-bezier(0.23, 1, 0.32, 1);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.cover-spine {
    position: absolute;
    left: -25px;
    top: 0;
    width: 25px;
    height: 100%;
    background: linear-gradient(to bottom, #FFFFFF 0%, #FFFFFF 50%, #FFFFFF 100%);
    transform: rotateY(-90deg);
    transform-origin: right center;
    border-radius: 0 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spine-runes {
    color: #B10000;
    font-size: 1.2rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.cover-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 30%, rgba(177, 0, 0, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, #FFFFFF 0%, #FFFFFF 50%, #FFFFFF 100%);
    border-radius: 12px;
    border: 3px solid #B10000;
    position: relative;
    overflow: hidden;
}

.cover-ornaments {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.corner-ornament {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid #B10000;
    opacity: 0.7;
}

.corner-ornament.top-left {
    top: 20px;
    left: 20px;
    border-right: none;
    border-bottom: none;
    border-radius: 12px 0 0 0;
}

.corner-ornament.top-right {
    top: 20px;
    right: 20px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 12px 0 0;
}

.corner-ornament.bottom-left {
    bottom: 20px;
    left: 20px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 12px;
}

.corner-ornament.bottom-right {
    bottom: 20px;
    right: 20px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 12px 0;
}

/* Removed cover glow for cleaner look */

.cover-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #000000;
    z-index: 2;
}

.mystical-symbol {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.symbol-ring {
    position: absolute;
    border: 2px solid #B10000;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.symbol-ring.outer {
    width: 120px;
    height: 120px;
    animation: rotateClockwise 20s linear infinite;
}

.symbol-ring.middle {
    width: 80px;
    height: 80px;
    animation: rotateCounterClockwise 15s linear infinite;
}

.symbol-ring.inner {
    width: 40px;
    height: 40px;
    animation: rotateClockwise 10s linear infinite;
}

.symbol-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #B10000;
    
    animation: pulse 3s ease-in-out infinite;
}

@keyframes rotateClockwise {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes rotateCounterClockwise {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(-360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.cover-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #B10000, #000000, #B10000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Cinzel', serif;
}

.cover-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #8B0000 !important;
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
    opacity: 0.9;
}

/* Mystical Pages Styles */
.codex-pages {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    pointer-events: none;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(232, 213, 183, 0.05) 0%, transparent 50%),
        linear-gradient(135deg, #FFFFFF 0%, #FFFFFF 100%);
    border-radius: 12px;
    transform-origin: left center;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 2px solid #B10000;
    opacity: 1;
    transform: rotateY(0deg);
    overflow: hidden;
    pointer-events: auto;
}

/* Ensure backface is never visible */
.page::after,
.codex-cover::after {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.page-content {
    padding: 25px 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #000000;
    position: relative;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.chapter-number {
    font-size: 2rem;
    font-weight: 700;
    color: #B10000;
    font-family: 'Cinzel', serif;
    
}

.page-ornament {
    font-size: 1.2rem;
    color: #8B0000;
    letter-spacing: 8px;
}

.page-visual {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    
    position: relative;
}

.mystical-scene {
    width: 180px;
    height: 150px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(177, 0, 0, 0.3);
    background: #FFFFFF;
}

/* Awakening Scene - Clean Design */
.awakening-scene {
    background: #FFFFFF;
    position: relative;
}

.floating-orbs {
    position: absolute;
    width: 100%;
    height: 100%;
}

.orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #B10000, #8B0000);
    border: 2px solid rgba(177, 0, 0, 0.4);
}

.orb-1 {
    width: 50px;
    height: 50px;
    top: 15%;
    left: 15%;
}

.orb-2 {
    width: 38px;
    height: 38px;
    top: 55%;
    right: 20%;
}

.orb-3 {
    width: 32px;
    height: 32px;
    bottom: 25%;
    left: 55%;
}

/* Removed floatOrb animation - GSAP handles this now */

.energy-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(177, 0, 0, 0.25);
    border-radius: 50%;
}

.energy-waves::before,
.energy-waves::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid rgba(177, 0, 0, 0.3);
    border-radius: 50%;
    animation: expandWave 3s ease-out infinite;
}

.energy-waves::before {
    animation-delay: -1s;
}

.energy-waves::after {
    animation-delay: -2s;
}

/* Removed expandWave animation - GSAP handles this now */

/* Quest Scene - Clean */
.quest-scene {
    background: #FFFFFF;
    position: relative;
}

.morphing-path {
    position: absolute;
    top: 70%;
    left: 10%;
    right: 10%;
    height: 6px;
    background: linear-gradient(90deg, transparent, #B10000 20%, #8B0000 50%, #B10000 80%, transparent);
    border-radius: 3px;
    animation: pathFlow 4s ease-in-out infinite;
}

@keyframes pathFlow {

    0%,
    100% {
        transform: scaleX(0.3);
        opacity: 0.5;
    }

    50% {
        transform: scaleX(1);
        opacity: 1;
    }
}

.constellation {
    position: absolute;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle at 30% 30%, #B10000, #8B0000);
    border-radius: 50%;
    border: 1px solid rgba(177, 0, 0, 0.5);
}

.star-1 {
    top: 20%;
    left: 30%;
    animation-delay: 0s;
}

.star-2 {
    top: 35%;
    right: 25%;
    animation-delay: -0.5s;
}

.star-3 {
    top: 50%;
    left: 50%;
    animation-delay: -1s;
}

.star-4 {
    bottom: 40%;
    left: 20%;
    animation-delay: -1.5s;
}

.star-5 {
    bottom: 25%;
    right: 35%;
    animation-delay: -2s;
}

/* Removed twinkle animation - GSAP handles this now */

/* Transformation Scene - Clean */
.transformation-scene {
    background: #FFFFFF;
    position: relative;
}

.metamorphosis-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 150px;
    transform: translate(-50%, -50%);
}

.transformation-rings {
    position: absolute;
    width: 100%;
    height: 100%;
}

.ring {
    position: absolute;
    border: 3px solid #B10000;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.7;
}

.ring-1 {
    width: 150px;
    height: 150px;
    animation: rotateClockwise 8s linear infinite;
}

.ring-2 {
    width: 100px;
    height: 100px;
    animation: rotateCounterClockwise 6s linear infinite;
}

.ring-3 {
    width: 50px;
    height: 50px;
    animation: rotateClockwise 4s linear infinite;
}

.phoenix-essence {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 30% 30%, #B10000, #8B0000, #000000);
    border-radius: 50%;
    animation: phoenixPulse 3s ease-in-out infinite;
    border: 2px solid rgba(177, 0, 0, 0.6);
}

@keyframes phoenixPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
    }
}

/* Mastery Scene - Clean */
.mastery-scene {
    background: #FFFFFF;
    position: relative;
}

.cosmic-mandala {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180px;
    height: 180px;
    transform: translate(-50%, -50%);
}

.mandala-layer {
    position: absolute;
    border: 3px solid rgba(177, 0, 0, 0.3);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.layer-1 {
    width: 180px;
    height: 180px;
    animation: rotateClockwise 20s linear infinite;
    border-style: dashed;
}

.layer-2 {
    width: 120px;
    height: 120px;
    animation: rotateCounterClockwise 15s linear infinite;
    border-style: dotted;
}

.layer-3 {
    width: 60px;
    height: 60px;
    animation: rotateClockwise 10s linear infinite;
}

.mandala-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: #B10000;
    animation: pulse 4s ease-in-out infinite;
}

.energy-streams {
    position: absolute;
    width: 100%;
    height: 100%;
}

.stream {
    position: absolute;
    width: 3px;
    height: 70px;
    background: linear-gradient(to bottom, transparent, #B10000 30%, #8B0000 70%, transparent);
    top: 50%;
    left: 50%;
    transform-origin: bottom center;
    animation: streamFlow 3s ease-in-out infinite;
}

.stream-1 {
    transform: translate(-50%, -100%) rotate(0deg);
    animation-delay: 0s;
}

.stream-2 {
    transform: translate(-50%, -100%) rotate(90deg);
    animation-delay: -0.75s;
}

.stream-3 {
    transform: translate(-50%, -100%) rotate(180deg);
    animation-delay: -1.5s;
}

.stream-4 {
    transform: translate(-50%, -100%) rotate(270deg);
    animation-delay: -2.25s;
}

@keyframes streamFlow {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -100%) rotate(var(--rotation, 0deg)) scaleY(0.5);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -100%) rotate(var(--rotation, 0deg)) scaleY(1.2);
    }
}

.page-text {
    text-align: center;
}

.chapter-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #B10000;
    font-family: 'Cinzel', serif;
    font-weight: 600;
}

.mystical-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #000000;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    margin-bottom: 25px;
    opacity: 0.9;
}

.floating-words {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.floating-words .word {
    height: fit-content;
}

.word {
    padding: 8px 16px;
    background: rgba(177, 0, 0, 0.1);
    border: 1px solid rgba(177, 0, 0, 0.12);
    border-radius: 20px;
    color: #B10000;
    font-size: 0.9rem;
    font-weight: 500;
    animation: floatWord 4s ease-in-out infinite;
}

@media (max-width: 1440px) {
    .floating-words { gap: 16px; margin-top: 16px; }
    .floating-words .word { padding: 6px 12px; font-size: 0.85rem; }
}

@media (max-width: 1200px) {
    .floating-words { gap: 14px; margin-top: 14px; }
    .floating-words .word { padding: 6px 10px; font-size: 0.82rem; }
}

@media (max-width: 1024px) {
    .floating-words { gap: 12px; margin-top: 12px; }
    .floating-words .word { padding: 5px 10px; font-size: 0.8rem; }
}

@media (max-width: 768px) {
    .floating-words { gap: 10px; margin-top: 10px; }
    .floating-words .word { padding: 5px 10px; font-size: 0.75rem; border-radius: 16px; }
}

@media (max-width: 480px) {
    .floating-words { gap: 8px; margin-top: 8px; }
    .floating-words .word { padding: 4px 8px; font-size: 0.7rem; border-radius: 14px; }
}

.word:nth-child(1) {
    animation-delay: 0s;
}

.word:nth-child(2) {
    animation-delay: -1.3s;
}

.word:nth-child(3) {
    animation-delay: -2.6s;
}

@keyframes floatWord {

    0%,
    100% {
        transform: translateY(0px);
        opacity: 0.7;
    }

    50% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Legacy Scene - Clean */
.legacy-scene {
    background: #FFFFFF;
    position: relative;
}

.eternal-flame {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 65px;
    height: 100px;
}

.flame-core {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 24px;
    height: 70px;
    background: linear-gradient(to top, #B10000 0%, #8B0000 40%, rgba(177, 0, 0, 0.8) 70%, transparent 100%);
    border-radius: 50% 50% 0 0;
    transform: translateX(-50%);
    filter: blur(1px);
    animation: flameFlicker 2s ease-in-out infinite;
}

@keyframes flameFlicker {
    0%, 100% { 
        transform: translateX(-50%) scaleY(1);
        opacity: 1;
    }
    50% { 
        transform: translateX(-50%) scaleY(1.1);
        opacity: 0.9;
    }
}

.flame-layers {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
}

.flame-layer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50% 50% 0 0;
    background: linear-gradient(to top, rgba(177, 0, 0, 0.6) 0%, rgba(139, 0, 0, 0.4) 50%, transparent 100%);
    filter: blur(2px);
    animation: layerFlicker 3s ease-in-out infinite;
}

.layer-1 {
    width: 40px;
    height: 80px;
    animation-delay: 0s;
}

.layer-2 {
    width: 32px;
    height: 68px;
    animation-delay: -1s;
}

.layer-3 {
    width: 24px;
    height: 56px;
    animation-delay: -2s;
}

@keyframes layerFlicker {
    0%, 100% { 
        transform: translateX(-50%) scaleY(1) scaleX(1);
        opacity: 0.7;
    }
    50% { 
        transform: translateX(-50%) scaleY(1.15) scaleX(0.95);
        opacity: 0.9;
    }
}

.legacy-sparks {
    position: absolute;
    width: 100%;
    height: 100%;
}

.spark {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle at 30% 30%, #B10000, #8B0000);
    border-radius: 50%;
    animation: sparkFloat 3s ease-in-out infinite;
    border: 1px solid rgba(177, 0, 0, 0.5);
}

.spark-1 { bottom: 30%; left: 30%; animation-delay: 0s; }
.spark-2 { bottom: 40%; right: 35%; animation-delay: -0.5s; }
.spark-3 { bottom: 50%; left: 25%; animation-delay: -1s; }
.spark-4 { bottom: 60%; right: 30%; animation-delay: -1.5s; }
.spark-5 { bottom: 70%; left: 40%; animation-delay: -2s; }
.spark-6 { bottom: 55%; right: 40%; animation-delay: -2.5s; }

@keyframes sparkFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-30px) scale(0.8);
        opacity: 0.6;
    }
    100% {
        transform: translateY(-60px) scale(0.5);
        opacity: 0;
    }
}

/* Final Destiny Page - Clean */
.page-destiny {
    background: #FFFFFF;
    border: 3px solid #B10000;
    position: relative;
}

.destiny-aura {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(177, 0, 0, 0.2) 0%, transparent 70%);
    border-radius: 20px;
    z-index: -1;
    animation: destinyPulse 3s ease-in-out infinite alternate;
}

@keyframes destinyPulse {
    0% {
        opacity: 0.2;
        transform: scale(1);
    }

    100% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

.cosmic-portal {
    position: absolute;
    top: 30%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
}

.portal-rings {
    position: absolute;
    width: 100%;
    height: 100%;
}

.portal-ring {
    position: absolute;
    border: 4px solid rgba(177, 0, 0, 0.3);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: portalSpin 8s linear infinite;
}

.portal-ring.ring-1 {
    width: 200px;
    height: 200px;
    border-style: solid;
    animation-duration: 8s;
}

.portal-ring.ring-2 {
    width: 150px;
    height: 150px;
    border-style: dashed;
    animation-duration: 6s;
    animation-direction: reverse;
}

.portal-ring.ring-3 {
    width: 100px;
    height: 100px;
    border-style: dotted;
    animation-duration: 4s;
}

.portal-ring.ring-4 {
    width: 50px;
    height: 50px;
    border-style: solid;
    animation-duration: 2s;
    animation-direction: reverse;
}

@keyframes portalSpin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.portal-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 30% 30%, #B10000, #8B0000, #000000);
    border-radius: 50%;
    animation: coreEnergy 2s ease-in-out infinite;
    border: 2px solid rgba(177, 0, 0, 0.6);
}

@keyframes coreEnergy {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
    }
}

.final-text {
    position: absolute;
    bottom: 0%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 90%;
}

.destiny-title {
    font-size: 2.8rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #B10000, #000000, #B10000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    
    animation: titleGlow 4s ease-in-out infinite;
}

@keyframes titleGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }
}

.destiny-description {
    font-size: 1.3rem;
    color: #000000;
    margin-bottom: 25px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    opacity: 0.9;
    line-height: 1.6;
}

.enchanted-cta {
    position: relative;
    padding: 12px 28px;
    background: transparent;
    color: #B10000;
    border: 2px solid rgba(177, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.enchanted-cta:hover {
    background: rgba(177, 0, 0, 0.05);
    border-color: #B10000;
    transform: translateY(-2px);
}

.enchanted-cta:active {
    transform: translateY(0);
}

.cta-text {
    position: relative;
    z-index: 2;
}

.cta-magic {
    display: none;
}

.floating-essence {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.essence-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #B10000;
    border-radius: 50%;
    animation: floatEssence 6s ease-in-out infinite;
}

.essence-particle:nth-child(1) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.essence-particle:nth-child(2) {
    top: 30%;
    right: 20%;
    animation-delay: -1.2s;
}

.essence-particle:nth-child(3) {
    bottom: 40%;
    left: 25%;
    animation-delay: -2.4s;
}

.essence-particle:nth-child(4) {
    bottom: 30%;
    right: 30%;
    animation-delay: -3.6s;
}

.essence-particle:nth-child(5) {
    top: 60%;
    left: 70%;
    animation-delay: -4.8s;
}

@keyframes floatEssence {

    0%,
    100% {
        transform: translateY(0px) scale(1);
        opacity: 0.4;
    }

    25% {
        transform: translateY(-20px) scale(1.2);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-10px) scale(0.8);
        opacity: 1;
    }

    75% {
        transform: translateY(-30px) scale(1.1);
        opacity: 0.6;
    }
}

/* Mystical Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    color: #B10000;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.6s ease;
    font-family: 'Cinzel', serif;
}

.scroll-rune {
    font-size: 1.8rem;
    animation: runeGlow 3s ease-in-out infinite alternate;
}

.scroll-text {
    font-size: 1.1rem;
    font-style: italic;
    
}

@keyframes runeGlow {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Wisdom Scene - Clean */
.wisdom-scene {
    background: #FFFFFF;
    position: relative;
}

.ancient-tree {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 160px;
    transform: translate(-50%, -50%);
}

.tree-trunk {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 24px;
    height: 90px;
    background: linear-gradient(to bottom, #8B0000 0%, #B10000 50%, #000000 100%);
    border-radius: 12px 12px 0 0;
    transform: translateX(-50%);
    border: 1px solid rgba(177, 0, 0, 0.5);
}

.tree-branches {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100px;
}

.branch {
    position: absolute;
    background: linear-gradient(to right, #8B0000, #B10000);
    border-radius: 6px;
    transform-origin: left center;
}

.branch-1 {
    width: 40px;
    height: 4px;
    top: 10px;
    left: 50%;
    transform: translateX(-50%) rotate(-30deg);
}

.branch-2 {
    width: 35px;
    height: 3px;
    top: 25px;
    left: 60%;
    transform: translateX(-50%) rotate(20deg);
}

.branch-3 {
    width: 30px;
    height: 3px;
    top: 40px;
    left: 40%;
    transform: translateX(-50%) rotate(-45deg);
}

.branch-4 {
    width: 25px;
    height: 2px;
    top: 55px;
    left: 65%;
    transform: translateX(-50%) rotate(35deg);
}

.wisdom-leaves {
    position: absolute;
    width: 100%;
    height: 100%;
}

.leaf {
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 30% 30%, #B10000, #8B0000);
    border-radius: 50% 0;
    transform: rotate(45deg);
    animation: leafSway 4s ease-in-out infinite;
    border: 1px solid rgba(177, 0, 0, 0.4);
}

.leaf-1 {
    top: 15px;
    left: 30%;
    animation-delay: 0s;
}

.leaf-2 {
    top: 30px;
    right: 25%;
    animation-delay: -1s;
}

.leaf-3 {
    top: 45px;
    left: 20%;
    animation-delay: -2s;
}

.leaf-4 {
    top: 60px;
    right: 30%;
    animation-delay: -3s;
}

.leaf-5 {
    top: 25px;
    left: 60%;
    /*  */
    animation-delay: -1.5s;
}

@keyframes leafSway {

    0%,
    100% {
        transform: rotate(45deg) translateY(0px);
    }

    50% {
        transform: rotate(45deg) translateY(-5px);
    }
}

/* Unity Scene - Clean */
.unity-scene {
    background: #FFFFFF;
    position: relative;
}

.harmony-circles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.circle {
    position: absolute;
    border: 3px solid #B10000;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(177, 0, 0, 0.2), rgba(177, 0, 0, 0.05));
    animation: circleFloat 6s ease-in-out infinite;
}

.circle-1 {
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0s;
}

.circle-2 {
    width: 30px;
    height: 30px;
    top: 20%;
    left: 30%;
    animation-delay: -1.2s;
}

.circle-3 {
    width: 25px;
    height: 25px;
    top: 25%;
    right: 25%;
    animation-delay: -2.4s;
}

.circle-4 {
    width: 35px;
    height: 35px;
    bottom: 30%;
    left: 25%;
    animation-delay: -3.6s;
}

.circle-5 {
    width: 28px;
    height: 28px;
    bottom: 25%;
    right: 30%;
    animation-delay: -4.8s;
}

@keyframes circleFloat {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

.connection-lines {
    position: absolute;
    width: 100%;
    height: 100%;
}

.line {
    position: absolute;
    height: 3px;
    background: linear-gradient(90deg, transparent, #B10000 30%, #8B0000 50%, #B10000 70%, transparent);
    animation: lineGlow 4s ease-in-out infinite;
    border-radius: 2px;
}

.line-1 {
    width: 60px;
    top: 50%;
    left: 20%;
    transform: translateY(-50%) rotate(30deg);
    animation-delay: 0s;
}

.line-2 {
    width: 50px;
    top: 30%;
    right: 30%;
    transform: translateY(-50%) rotate(-45deg);
    animation-delay: -1s;
}

.line-3 {
    width: 55px;
    bottom: 35%;
    left: 25%;
    transform: translateY(50%) rotate(60deg);
    animation-delay: -2s;
}

.line-4 {
    width: 45px;
    bottom: 30%;
    right: 25%;
    transform: translateY(50%) rotate(-30deg);
    animation-delay: -3s;
}

@keyframes lineGlow {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* Legacy Scene */
.legacy-scene {
    background: radial-gradient(ellipse at center, #8B0000 0%, #FFFFFF 100%);
}

.eternal-flame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 65px;
    height: 100px;
    transform: translate(-50%, -50%);
}

.flame-core {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 20px;
    height: 40px;
    background: linear-gradient(to top, #8B0000, #8B0000);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transform: translateX(-50%);
    animation: flameCore 2s ease-in-out infinite;
}

@keyframes flameCore {

    0%,
    100% {
        transform: translateX(-50%) scaleY(1);
    }

    50% {
        transform: translateX(-50%) scaleY(1.2);
    }
}

.flame-layers {
    position: absolute;
    width: 100%;
    height: 100%;
}

.flame-layer {
    position: absolute;
    bottom: 0;
    left: 50%;
    background: linear-gradient(to top, rgba(255, 69, 0, 0.8), rgba(255, 20, 147, 0.4));
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transform: translateX(-50%);
    animation: flameFlicker 3s ease-in-out infinite;
}

.layer-1 {
    width: 30px;
    height: 60px;
    animation-delay: 0s;
}

.layer-2 {
    width: 40px;
    height: 80px;
    animation-delay: -1s;
}

.layer-3 {
    width: 50px;
    height: 100px;
    animation-delay: -2s;
}

@keyframes flameFlicker {

    0%,
    100% {
        transform: translateX(-50%) scaleY(1) scaleX(1);
        opacity: 0.8;
    }

    25% {
        transform: translateX(-50%) scaleY(1.1) scaleX(0.9);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) scaleY(0.9) scaleX(1.1);
        opacity: 0.9;
    }

    75% {
        transform: translateX(-50%) scaleY(1.2) scaleX(0.8);
        opacity: 1;
    }
}

.legacy-sparks {
    position: absolute;
    width: 100%;
    height: 100%;
}

.spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #8B0000;
    border-radius: 50%;
    animation: sparkFly 4s ease-out infinite;
}

.spark-1 {
    top: 40%;
    left: 45%;
    animation-delay: 0s;
}

.spark-2 {
    top: 35%;
    right: 40%;
    animation-delay: -0.7s;
}

.spark-3 {
    top: 50%;
    left: 35%;
    animation-delay: -1.4s;
}

.spark-4 {
    top: 45%;
    right: 35%;
    animation-delay: -2.1s;
}

.spark-5 {
    top: 30%;
    left: 50%;
    animation-delay: -2.8s;
}

.spark-6 {
    top: 25%;
    right: 45%;
    animation-delay: -3.5s;
}

@keyframes sparkFly {
    0% {
        transform: translateY(0px) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-30px) scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-60px) scale(0.3);
        opacity: 0;
    }
}

/* Scroll Spacer - Optimized for GSAP ScrollTrigger */
.scroll-spacer {
    height: 800vh;
    /* Provides smooth scroll progression for 8 pages */
    position: relative;
    z-index: 1;
    width: 100%;
    pointer-events: none;
}

/* Comprehensive Responsive Design */

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .text-content {
        max-width: 100%;
        padding: 0;
    }

    .enchanted-codex {
        width: min(280px, 90vw);
        height: min(380px, 60vh);
    }

    .mystical-symbol {
        width: 80px;
        height: 80px;
    }

    .mystical-scene {
        width: 130px;
        height: 110px;
    }

    .cosmic-portal {
        width: 110px;
        height: 110px;
    }

    .slide-keywords {
        flex-direction: column;
        gap: 10px;
    }

    .keyword {
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    .chapter-badge {
        font-size: 0.8rem;
        padding: 6px 15px;
    }
}
@media screen and (max-width: 767.92px) {
    .content-area {
        display: none !important;
    }
}

/* Medium Mobile Devices (481px - 766px) */
@media (max-width: 767.92px) {
    .main-container {
        position: relative;
        height: 100dvh;
        min-height: 100dvh;
    }

    .cosmic-porta {
        top: 50%;
    }

    .final-text {
        margin-bottom: 20px;
    }

    .floating-words {
        gap: 10px;
    }

    .page-header {
        display: none;
    }

    .word {
        padding: 6px 10px;
        font-size: 0.6rem;
    }

    .mystical-symbol {
        width: 60px;
        height: 60px;
        margin-bottom: 40px;
    }

    .page-content {
        flex-direction: column;
        padding: 15px 10px;
        gap: 15px;
    }

    .content-area {
        display: none !important;
        width: 100%;
        height: auto;
        min-height: 50vh;
        padding: 30px 20px;
        order: 2;
    }

    .book-area {
        width: 100%;
        /* height: 45vh; */
        order: 1;
    }

    .enchanted-codex {
        width: min(350px, 80vw);
        height: min(450px, 70vh);
    }

    .mystical-scene {
        width: 140px;
        height: 115px;
    }

    .cosmic-portal {
        width: 110px;
        height: 110px;
    }

    .page-text {
        align-items: center;
    }
}


@media (min-width: 768px) and (max-width: 1024px) {
    .main-container {
        position: fixed;
        height: 100vh;
        margin-top: 0;
    }

    .content-area {
        padding: 40px 30px;
    }

    .book-area {
        padding-right: 20px;
    }

    .enchanted-codex {
        width: min(320px, 42vw);
        height: min(450px, 75vh);
    }

    .mystical-symbol {
        width: 90px;
        height: 90px;
    }

    .cover-title {
        font-size: 2rem;
    }

    .mystical-scene {
        width: 160px;
        height: 130px;
    }
}

/* Large Tablets and Small Laptops (1025px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .content-area {
        padding: 50px;
    }
}

/* Landscape Mobile Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .main-container {
        flex-direction: row;
    }

    .content-area,
    .book-area {
        width: 50%;
        height: 100vh;
    }

    .content-area {
        padding: 20px;
        order: 1;
    }

    .book-area {
        order: 2;
    }

    .enchanted-codex {
        width: min(300px, 40vw);
        height: min(400px, 90vh);
    }
}

/* Enhanced Performance Optimizations for GSAP */
.page,
.codex-cover {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform-origin: left center;
}

.content-slide {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

.mystical-scene,
.floating-runes,
.magic-particles {
    will-change: transform;
    contain: layout style paint;
    transform: translateZ(0);
}

.rune,
.orb,
.star,
.ring,
.flame-layer,
.portal-ring {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* GPU acceleration for smooth animations */
.enchanted-codex,
.hero-container {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Optimize repaints */
.page-content,
.cover-content {
    contain: layout style;
}

/* GSAP animation states */
.page {
    opacity: 0;
    transform: rotateY(-180deg) translateZ(-100px);
}

.page.gsap-active {
    opacity: 1;
    transform: rotateY(0deg) translateZ(0px);
}

.content-slide {
    opacity: 0;
    transform: translateX(-50px);
    display: none;
}

.content-slide.active,
.content-slide.gsap-active {
    opacity: 1;
    transform: translateX(0);
    display: block;
}

/* Smooth scrolling with performance consideration */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fallback mode for graceful degradation */
.fallback-mode .enchanted-codex {
    animation: none !important;
    transform: none !important;
}

.fallback-mode .page {
    opacity: 1 !important;
    transform: none !important;
}

/* Intersection observer optimizations */
.in-viewport {
    will-change: transform, opacity;
}

.in-viewport:not(.animating) {
    will-change: auto;
}

/* Memory optimization for large elements */
.scroll-spacer {
    contain: size layout;
}

/* Optimize text rendering */
.cover-title,
.chapter-title,
.destiny-title {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce layout thrashing */
.floating-words .word {
    contain: layout style;
}

/* Canvas optimization */
#particles-canvas {
    will-change: contents;
    image-rendering: optimizeSpeed;
}

.visual-element {
    width: 200px;
    height: 150px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.visual-element.sunrise {
    background: linear-gradient(to bottom, #8B0000 0%, #8B0000 50%, #8B0000 100%);
}

.visual-element.sunrise::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: #8B0000;
    border-radius: 50%;
}

.visual-element.journey {
    background: linear-gradient(45deg, #B10000 0%, #8B0000 100%);
}

.visual-element.journey::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.visual-element.growth {
    background: linear-gradient(to top, #8B0000 0%, #8B0000 100%);
}

.visual-element.growth::before {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 60px solid #FFFFFF;
}

.visual-element.innovation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.visual-element.innovation::before {
    content: '💡';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
}

.page-text {
    text-align: center;
}

.page-text h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;


}

.page-text p {
    font-size: 1.1rem;
    line-height: 1.3;
    color: #4a4a4a;
    font-style: italic;
}

/* Final Page Styles */
.page-final {
    background: radial-gradient(ellipse at center, #FFFFFF 0%, #FFFFFF 100%);
    color: white;
    border: 3px solid #B10000;
}

.final-content {
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.glow-effect {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, #B10000, #8B0000, #B10000);
    border-radius: 12px;
    opacity: 0.3;
    filter: blur(15px);
    z-index: -1;
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }

    100% {
        opacity: 0.6;
        transform: scale(1.02);
    }
}

.final-text h1 {
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: #B10000;

}

.final-text p {
    font-size: 1.1rem;
    margin-bottom: 16px;
    opacity: 0.9;
    line-height: 1.6;
}

.cta-button {
    padding: 10px 24px;
    background: transparent;
    color: #B10000;
    border: 2px solid rgba(177, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(10px);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.cta-button:hover {
    transform: translateY(-2px);
    background: rgba(177, 0, 0, 0.05);
    border-color: #B10000;
    color: #8B0000;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #B10000;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.scroll-text {
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-style: italic;
}

.scroll-arrow {
    font-size: 1.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Scroll Spacer */
.scroll-spacer {
    height: 500vh;
    position: relative;
    z-index: 1;
}

/* Responsive Design */
@media (max-width: 767.92px) {
    
    .content-slide .final-text{
        display: none !important;
    }
    .slide-title {
    font-size: clamp(1rem, 2vw, 2rem);
   
    }
    .slide-text {
    font-size: clamp(1rem, 2vw, 1rem);
    }
    .storybook-wrapper {
        width: 320px;
        height: 400px;
    }

    .cover-content h1 {
        font-size: 1rem;
    }

    .page-text h2 {
        font-size: 1rem;
    }

    .page-text p {
        font-size: 1rem;
    }

    .enchanted-cta {
        padding: 10px 15px !important;
    }

    .final-text h1 {
        font-size: 1.5rem;
    }

    .cta-text {
        font-size: 0.8rem;
    }

    .visual-element {
        width: 150px;
        height: 120px;
    }
}

/* Performance Optimizations */
.page,
.book-cover {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/*
 Extended scroll space for smooth scrolling */
.scroll-spacer {
    height: 800vh;
    /* Increased for smoother scroll progression */
    width: 1px;
    position: relative;
    z-index: 1;
}

/* Performance optimizations for smooth scrolling */
.main-container {
    will-change: transform;
    backface-visibility: hidden;
}

.page {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.content-slide {
    will-change: transform, opacity;
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Ensure only one content slide is visible at a time */
.content-slide:not([style*="display: block"]) {
    display: none !important;
}

/* Ensure proper stacking order */
.content-slide[data-slide="cover"] {
    z-index: 10;
}

.content-slide[data-slide="final"] {
    z-index: 15;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: auto;
    /* Let GSAP handle smooth scrolling */
}

/* Enhanced 3D perspective for better page flips */
.enchanted-codex {
    perspective: 2000px;
    perspective-origin: center center;
}

/* Improved mystical scene animations */
.mystical-scene * {
    will-change: transform;
    backface-visibility: hidden;
}

/* Optimized particle rendering */
.essence-particle,
.orb,
.spark {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Smooth transitions for all interactive elements */
.keyword,
.cta-button,
.enchanted-cta {
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Enhanced glow effects */
.cover-glow,
.destiny-aura {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Additional Typography Scaling */
.chapter-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.mystical-text {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.destiny-title {
    font-size: clamp(2rem, 4.5vw, 2.8rem);
}

.destiny-description {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
}

.final-title {
    font-size: clamp(2.2rem, 4.5vw, 3rem);
}

.final-text {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
}

.cta-button,
.enchanted-cta {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 28px);
}

/* Ensure sections don't hide behind header */
.aboutsection,
.powers-section,
.achievements-section,
.gallery-section,
.faq-section,
.team-section,
.contact-section {
    scroll-margin-top: 60px;
}

@media (max-width: 768px) {
    .aboutsection,
    .powers-section,
    .achievements-section,
    .gallery-section,
    .faq-section,
    .team-section,
    .contact-section {
        scroll-margin-top: 50px;
    }
}

@media (max-width: 480px) {
    .aboutsection,
    .powers-section,
    .achievements-section,
    .gallery-section,
    .faq-section,
    .team-section,
    .contact-section {
        scroll-margin-top: 45px;
    }
}

/* Responsive Spacing */
@media (max-width: 480px) {
    .content-area {
        padding: 15px;
    }

    /* Ensure all sections are visible and scrollable */
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Make sure sections stack properly */
    .aboutsection,
    .powers-section,
    .achievements-section,
    .gallery-section,
    .faq-section,
    .team-section,
    .contact-section {
        width: 100%;
        min-height: auto;
        position: relative;
        display: block;
    }
}

.slide-content {
    text-align: center;
}

.main-subtitle,
.slide-text {
    margin-bottom: 20px;
}

.mystical-symbol-left {
    margin: 20px auto;
}


/* Scroll Spacer for About Section */
.scroll-spacer {
    /* Provide enough scroll room for all hero page flips */
    height: 800vh;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* High refresh rate display optimizations */
@media (min-resolution: 120dpi) {

    .page,
    .content-slide {
        transform: translateZ(0);
    }
}

/* 
Scroll Spacer - Optimized for GSAP ScrollTrigger */
.scroll-spacer {
    height: 700vh;
    /* Provides smooth scroll progression for 8 pages */
    position: relative;
    z-index: 1;
    width: 100%;
    pointer-events: none;
}
