/* --- E-Reader Styles --- */
.reader {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 4rem; /* Extra padding at bottom for better readability */
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    position: relative;
    height: calc(100vh - 60px); /* Fixed height with calc to ensure scrollability */
}

.reader-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--matrix-dark-green);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
    border-radius: 4px;
}

/* Custom Styles for PLC E-book */
.reader-content strong {
    animation: retroFlash 1.5s infinite;
    font-weight: bold;
}

@keyframes retroFlash {
    0% { color: #00ff00; text-shadow: 0 0 5px #00ff00; }
    50% { color: #ff00ff; text-shadow: 0 0 5px #ff00ff; }
    100% { color: #00ff00; text-shadow: 0 0 5px #00ff00; }
}

.retro-flash {
    animation: retroFlash 1.5s infinite;
}

/* Typography */
.reader-content h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.8);
}

.reader-content .author {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: var(--matrix-dark-green);
}

.reader-content h2 {
    font-size: 1.8rem;
    margin: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--matrix-dark-green);
    padding-bottom: 0.5rem;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
}

.reader-content p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

/* Make images responsive and fit within content area */
.reader-content img {
    max-width: 500px;  /* Limit the maximum width */
    width: 100%;       /* Use 100% of the container up to max-width */
    height: auto;      /* Maintain aspect ratio */
    display: block;
    margin: 1.5rem auto;
    border: 1px solid var(--matrix-dark-green);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.chapter {
    margin-bottom: 3rem;
}

/* Special Elements */
.code-block {
    background-color: rgba(0, 20, 0, 0.7);
    border: 1px solid var(--matrix-dark-green);
    padding: 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    border-radius: 3px;
}

.code-block pre {
    font-family: var(--matrix-font);
    color: var(--matrix-green);
    font-size: 0.9rem;
}

.y2k-quote {
    border-left: 3px solid var(--y2k-green);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
}

.y2k-quote p {
    color: #9dffad;
}

/* Animation Elements */
.glitch {
    animation: glitch 1s infinite;
    display: inline-block;
}

.highlight {
    background-color: rgba(0, 255, 65, 0.2);
    padding: 0 3px;
    border-radius: 2px;
}

.animated-section {
    margin: 2rem 0;
    min-height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.typing {
    display: inline-block;
    overflow: hidden;
    border-right: 3px solid var(--matrix-green);
    white-space: nowrap;
    margin: 0 auto;
    animation: 
        typing 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

.flicker {
    animation: flicker 2s infinite alternate;
}

.y2k-scroll {
    display: block;
    font-size: 0.8rem;
    height: 80px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    animation: y2k-scroll 10s linear infinite;
    opacity: 0.7;
}

.consciousness-wave {
    width: 100%;
    height: 60px;
    background: linear-gradient(to right,
        rgba(0, 100, 0, 0.2),
        rgba(0, 255, 65, 0.5),
        rgba(0, 100, 0, 0.2)
    );
    border-radius: 50%;
    animation: wave 5s ease-in-out infinite;
    opacity: 0.6;
}

.falling-text {
    display: inline-block;
    animation: falling 2s ease-in-out infinite;
}

/* Pill visualization */
.pill-container {
    display: flex;
    justify-content: space-around;
    margin: 2rem 0;
}

.red-pill, .blue-pill {
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

.red-pill {
    background-color: rgba(255, 0, 0, 0.3);
    border: 1px solid #ff0000;
    color: #ff5555;
}

.blue-pill {
    background-color: rgba(0, 0, 255, 0.3);
    border: 1px solid #0000ff;
    color: #5555ff;
}

/* Lists styling */
.glow-list {
    list-style-type: none;
    margin: 1.5rem 0;
    padding-left: 1rem;
}

.glow-list li {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
}

.glow-list li:before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--y2k-green);
    text-shadow: 0 0 5px var(--y2k-green);
}

.terminal-list {
    margin: 1.5rem 0;
    padding-left: 2rem;
    list-style-type: decimal-leading-zero;
}

.terminal-list li {
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
}

/* Breaking code animation */
.breaking-code {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.breaking-code span {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0 5px;
    text-shadow: 0 0 10px var(--y2k-green);
    opacity: 0;
    animation: cascade 1.5s forwards;
}

.breaking-code span:nth-child(1) { animation-delay: 0.1s; }
.breaking-code span:nth-child(2) { animation-delay: 0.2s; }
.breaking-code span:nth-child(3) { animation-delay: 0.3s; }
.breaking-code span:nth-child(4) { animation-delay: 0.4s; }
.breaking-code span:nth-child(5) { animation-delay: 0.6s; }
.breaking-code span:nth-child(6) { animation-delay: 0.7s; }
.breaking-code span:nth-child(7) { animation-delay: 0.8s; }
.breaking-code span:nth-child(8) { animation-delay: 0.9s; }
.breaking-code span:nth-child(9) { animation-delay: 1.1s; }
.breaking-code span:nth-child(10) { animation-delay: 1.2s; }
.breaking-code span:nth-child(11) { animation-delay: 1.3s; }
.breaking-code span:nth-child(12) { animation-delay: 1.4s; }

.pulse-text {
    animation: pulse 2s infinite;
    font-size: 1.5rem;
    text-align: center;
    text-shadow: 0 0 10px var(--y2k-green);
}

.final-choice {
    text-align: center;
    font-size: 1.8rem;
    animation: flicker 3s infinite;
    letter-spacing: 3px;
}

.end-marker {
    text-align: center;
    margin-top: 3rem;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--y2k-dark-green);
}

/* Scrollbar styling */
.reader::-webkit-scrollbar {
    width: 16px; /* Wider scrollbar for easier grabbing */
}

.reader::-webkit-scrollbar-track {
    background: rgba(0, 20, 0, 0.3);
    border-left: 1px solid var(--y2k-dark-green);
    box-shadow: inset 0 0 10px rgba(0, 50, 0, 0.5);
}

.reader::-webkit-scrollbar-thumb {
    background: linear-gradient(
        to bottom,
        var(--y2k-green) 0%,
        var(--y2k-dark-green) 50%,
        var(--y2k-green) 100%
    );
    border: 1px solid #00ff41;
    border-radius: 4px;
    box-shadow: 0 0 8px #00ff41;
}

.reader::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        to bottom,
        #00ff41 0%, 
        #00aa36 50%, 
        #00ff41 100%
    );
    box-shadow: 0 0 12px #00ff41;
}

/* Add digital rain characters to the scrollbar */
.reader::-webkit-scrollbar-thumb::after {
    content: "10101";
    display: block;
    text-align: center;
    color: rgba(0, 0, 0, 0.4);
    font-family: 'Courier New', monospace;
    font-size: 8px;
    letter-spacing: -1px;
}

/* Animations */
@keyframes y2k-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100%); }
}

.scrolling-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #333; /* Background color */
    color: white; /* Text color */
    white-space: nowrap; /* Prevent text from wrapping */
    overflow: hidden; /* Hide overflow */
}

.scrolling-banner p {
    display: inline-block;
    padding: 10px 0; /* Padding for the text */
    animation: scroll 10s linear infinite; /* Animation for scrolling */
}

@keyframes scroll {
    0% {
        transform: translateX(100%); /* Start off-screen to the right */
    }
    100% {
        transform: translateX(-100%); /* End off-screen to the left */
    }
}
