* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

:root {
    --cream: #faf8f5;
    --dark-cream: #f0ede6;
    --burgundy: #800020;
    --gold: #b8860b;
    --text-dark: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.1);
    --butterfly-gold: #FFD700;
    --butterfly-gold-dark: #DAA520;
    --butterfly-gold-light: #FFF8DC;
}

/* === 3D BUTTERFLY SPLASH SCREEN === */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1.5s ease-out;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #2a2520 0%, #1a1510 40%, #000000 100%);
}

#splash-screen canvas {
    display: block;
}

#main-content {
    display: none;
    position: relative;
    z-index: 1;
}

body {
    font-family: 'Crimson Text', serif;
    background: radial-gradient(ellipse at center, #1a1510 0%, #0f0a08 50%, #000000 100%);
    color: var(--text-dark);
    line-height: 1.9;
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-touch-callout: none;
}

/* === ANIMATED BACKGROUND === */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.gradient-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 75%, rgba(218, 165, 32, 0.18) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 25%, rgba(255, 215, 0, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 45% 65%, rgba(255, 193, 37, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(218, 165, 32, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 35%, rgba(255, 215, 0, 0.08) 0%, transparent 65%);
    animation: butterflyShimmer 30s ease-in-out infinite alternate;
}

@keyframes butterflyShimmer {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        filter: hue-rotate(0deg) brightness(1);
    }
    25% {
        transform: translate(-4%, 3%) scale(1.06) rotate(3deg);
        filter: hue-rotate(15deg) brightness(1.15);
    }
    50% {
        transform: translate(3%, -4%) scale(1.12) rotate(-2deg);
        filter: hue-rotate(25deg) brightness(0.95);
    }
    75% {
        transform: translate(-2%, 5%) scale(1.04) rotate(4deg);
        filter: hue-rotate(20deg) brightness(1.08);
    }
    100% {
        transform: translate(-6%, 6%) scale(1.1) rotate(-3deg);
        filter: hue-rotate(30deg) brightness(1.2);
    }
}

/* Particle canvas */
#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Floating golden particles */
.golden-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 215, 0, 0.8) 30%,
        rgba(218, 165, 32, 0.6) 70%,
        transparent 100%);
    border-radius: 50%;
    pointer-events: none;
    animation: goldenFloat linear infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes goldenFloat {
    0% {
        transform: translateY(110vh) translateX(0) scale(0.6);
        opacity: 0;
    }
    10% {
        opacity: 0.9;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-15vh) translateX(var(--drift)) scale(0.2);
        opacity: 0;
    }
}

/* Golden sparkle particles */
.sparkle-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 248, 220, 0.9) 25%,
        rgba(255, 215, 0, 0.7) 60%,
        transparent 100%);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkleFloat linear infinite;
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.9),
        0 0 30px rgba(255, 215, 0, 0.6);
}

@keyframes sparkleFloat {
    0% {
        transform: translateY(105vh) translateX(0) scale(0.8) rotate(0deg);
        opacity: 0;
    }
    8% {
        opacity: 1;
    }
    50% {
        transform: translateY(40vh) translateX(var(--sparkle-drift)) scale(1.3) rotate(var(--rotation));
        opacity: 0.95;
    }
    92% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-20vh) translateX(var(--sparkle-final)) scale(0.3) rotate(calc(var(--rotation) * 3));
        opacity: 0;
    }
}

/* Golden dust trails */
.dust-trail {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, 
        rgba(255, 248, 220, 0.95) 0%,
        rgba(255, 215, 0, 0.75) 50%,
        transparent 100%);
    border-radius: 50%;
    pointer-events: none;
    animation: dustFloat linear infinite;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
}

@keyframes dustFloat {
    0% {
        transform: translateY(108vh) translateX(0) scale(1);
        opacity: 0;
    }
    15% {
        opacity: 0.85;
    }
    85% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-12vh) translateX(var(--dust-drift)) scale(0.25);
        opacity: 0;
    }
}

/* === HEADER - REARRANGED LAYOUT === */
.book-header {
    text-align: center;
    padding: clamp(2rem, 8vw, 4rem) 5%;
    background: linear-gradient(180deg, rgba(128, 0, 32, 0.08) 0%, transparent 100%);
    border-bottom: 3px solid var(--burgundy);
    position: relative;
    z-index: 2;
    animation: fadeInDown 1.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Title moved to top */
.book-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 6.5vw, 3.5rem);
    color: var(--burgundy);
    margin-bottom: 1rem;
    font-weight: 700;
    animation: fadeIn 1.3s ease-out 0.1s both;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.15);
    order: 1;
}

.book-subtitle {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1.1rem, 3.8vw, 2rem);
    color: var(--gold);
    font-style: italic;
    margin-bottom: 2rem;
    animation: fadeIn 1.3s ease-out 0.2s both;
    order: 2;
}

/* Image after title */
.book-cover-display {
    max-width: min(380px, 85vw);
    margin: 0 auto 2rem;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 25px 70px var(--shadow),
        0 0 50px rgba(255, 215, 0, 0.25);
    pointer-events: none;
    transition: transform 0.5s ease;
    animation: floatIn 1.6s ease-out 0.3s both;
    order: 3;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(100px) scale(0.75) rotateY(-20deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateY(0deg);
    }
}

.book-cover-display:hover {
    transform: scale(1.08) rotateY(10deg) rotateX(3deg);
}

.book-cover-display img {
    width: 100%;
    height: auto;
    display: block;
}

.author-name {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1.05rem, 3.2vw, 1.5rem);
    color: var(--text-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.6vw, 3px);
    animation: fadeIn 1.3s ease-out 0.4s both;
    margin-bottom: 0;
    order: 4;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-btn {
    display: inline-block;
    margin: 2rem 0;
    padding: clamp(0.9rem, 2.2vw, 1.2rem) clamp(2rem, 5vw, 3.5rem);
    background: var(--burgundy);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-family: 'EB Garamond', serif;
    font-size: clamp(1.05rem, 2.8vw, 1.3rem);
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.4vw, 2px);
    box-shadow: 
        0 6px 20px rgba(128, 0, 32, 0.4),
        0 0 30px rgba(255, 215, 0, 0.2);
    animation: pulse 2.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 6px 20px rgba(128, 0, 32, 0.4),
            0 0 30px rgba(255, 215, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 8px 25px rgba(128, 0, 32, 0.5),
            0 0 40px rgba(255, 215, 0, 0.3);
    }
}

.back-btn:hover {
    background: var(--gold);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 12px 35px rgba(184, 134, 11, 0.4),
        0 0 50px rgba(255, 215, 0, 0.4);
    animation: none;
}

/* === CONTENT SECTIONS === */
.content-container {
    max-width: 950px;
    margin: 0 auto;
    padding: clamp(2rem, 6vw, 4rem) 5%;
}

.dedication, .foreword, .introduction, .preface, .chapter {
    margin-bottom: clamp(3rem, 8vw, 5rem);
    background: linear-gradient(135deg, rgba(250, 248, 245, 0.98) 0%, rgba(240, 237, 230, 0.98) 100%);
    padding: clamp(2rem, 6.5vw, 4rem);
    border-radius: 25px;
    box-shadow: 
        0 15px 50px var(--shadow),
        0 0 30px rgba(255, 215, 0, 0.12);
    position: relative;
    z-index: 2;
    animation: slideInUp 0.9s ease-out both;
    backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 215, 0, 0.15);
}

.dedication:hover, .foreword:hover, .introduction:hover, .preface:hover, .chapter:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.25),
        0 0 40px rgba(255, 215, 0, 0.25);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(70px) rotateX(12deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}

.dedication { animation-delay: 0.1s; }
.foreword { animation-delay: 0.2s; }
.introduction { animation-delay: 0.3s; }
.preface { animation-delay: 0.4s; }
.chapter { animation-delay: 0.5s; }

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 5.5vw, 2.5rem);
    color: var(--burgundy);
    text-align: center;
    margin-bottom: 2.5rem;
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.6vw, 3px);
    border-bottom: 3px solid var(--gold);
    padding-bottom: 1.2rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--burgundy);
    transition: width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dedication:hover .section-title::after,
.foreword:hover .section-title::after,
.introduction:hover .section-title::after,
.preface:hover .section-title::after,
.chapter:hover .section-title::after {
    width: 100%;
}

.content-text {
    text-align: justify;
    text-indent: 2em;
    margin-bottom: 1.8rem;
    line-height: 2;
    font-size: clamp(1.02rem, 2.8vw, 1.15rem);
}

.content-text:first-of-type::first-letter {
    font-size: clamp(3rem, 9vw, 4rem);
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--burgundy);
    float: left;
    line-height: 0.75;
    margin: 0.1em 0.15em 0 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.signature {
    text-align: right;
    font-style: italic;
    margin-top: 2rem;
    color: var(--gold);
    font-size: clamp(1.15rem, 3.2vw, 1.4rem);
}

.inline-image-container {
    margin: 2.5rem 0;
    text-align: center;
}

.inline-image-container img {
    max-width: min(420px, 92%);
    width: 100%;
    height: auto;
    margin: 2.5rem auto;
    display: block;
    border-radius: 20px;
    box-shadow: 
        0 15px 40px rgba(0,0,0,0.25),
        0 0 30px rgba(255, 215, 0, 0.18);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.inline-image-container img:hover {
    transform: scale(1.08) rotate(3deg);
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.3),
        0 0 40px rgba(255, 215, 0, 0.25);
}

.watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: clamp(3rem, 12vw, 6rem);
    color: rgba(128, 0, 32, 0.04);
    font-weight: 900;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

/* === CTA SECTION === */
.purchase-cta {
    text-align: center;
    padding: clamp(2.5rem, 7vw, 4rem) 5%;
    background: linear-gradient(180deg, transparent 0%, rgba(128, 0, 32, 0.08) 100%);
    position: relative;
    z-index: 2;
    animation: slideInUp 0.9s ease-out 0.6s both;
}

.cta-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 5.5vw, 2.5rem);
    color: var(--burgundy);
    margin-bottom: 2rem;
}

.purchase-links {
    display: flex;
    gap: clamp(1.2rem, 3.5vw, 2rem);
    justify-content: center;
    flex-wrap: wrap;
    max-width: 850px;
    margin: 0 auto;
}

.purchase-link {
    padding: clamp(1.1rem, 2.8vw, 1.5rem) clamp(2rem, 4.5vw, 3rem);
    background: var(--burgundy);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-family: 'EB Garamond', serif;
    font-size: clamp(1.05rem, 2.8vw, 1.3rem);
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 6px 20px rgba(128, 0, 32, 0.4),
        0 0 30px rgba(255, 215, 0, 0.2);
    flex: 1 1 auto;
    min-width: min(260px, 100%);
}

.purchase-link:hover {
    background: var(--gold);
    transform: translateY(-6px) scale(1.03);
    box-shadow: 
        0 12px 35px rgba(184, 134, 11, 0.4),
        0 0 50px rgba(255, 215, 0, 0.4);
}

/* Back to Books button positioned last */
.purchase-cta .back-btn {
    margin-top: 3rem;
    order: 10;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .dedication, .foreword, .introduction, .preface, .chapter {
        padding: clamp(1.5rem, 6vw, 2rem);
    }

    .content-container {
        padding: clamp(1.5rem, 6vw, 2rem) 5%;
    }

    .purchase-links {
        flex-direction: column;
        align-items: stretch;
    }

    .purchase-link {
        width: 100%;
    }

    .golden-particle, .sparkle-particle, .dust-trail {
        width: 4px;
        height: 4px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: clamp(0.95rem, 4vw, 1rem);
    }

    .book-header {
        padding: clamp(1.5rem, 8vw, 2rem) 5%;
    }

    .section-title {
        font-size: clamp(1.4rem, 7vw, 1.8rem);
    }

    .watermark {
        font-size: clamp(2rem, 15vw, 3rem);
    }
}

/* Protection - keeping original */
* {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}


/* === 3D BACKGROUND BUTTERFLIES === */
#bg-butterflies-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#bg-butterflies-canvas canvas {
    display: block;
    opacity: 0.7; /* Slightly transparent for background effect */
}
