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

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

img {
    max-width: 100%;
    display: block;
}

/* Hero Section */
.hero {
    position: relative;
    overflow: hidden;
    min-height: 60vh;
    color: #0f0;
    font-family: monospace;
    background-color: #000;
    /* Reset any transforms to avoid unwanted distortion */
    transform: none;
}

.abouthero {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    color: #0f0;
    font-family: 'Courier New', monospace;
    background-color: #000;
    /* Reset any transforms to avoid unwanted distortion */
    transform: none;
}

/* CRT curvature effect: darken the edges with a radial gradient */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0) 40%,
        rgba(0, 0, 0, 0.4) 100%
    );
    z-index: 1;
}

/* Scanning line overlay to mimic CRT display */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        180deg,
        rgba(0, 255, 0, 0.05),
        rgba(0, 255, 0, 0.05) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 2;
}

/* Canvas fills the hero and sits below everything */
.hero #bg-canvas {
    /* Position the canvas over the entire viewport so the starfield
       persists as a background for the whole page. Fixed positioning
       ensures it does not scroll with the content. */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Terminal overlay with retro text */
.hero .terminal {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    padding: 1.5rem;
    border: 1px solid #0f0;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
    max-width: 90%;

    /* Subtle flicker animation to mimic CRT display */
    animation: terminal-flicker 3s infinite;
}

@keyframes terminal-flicker {
    0%, 100% {
        opacity: 0.95;
    }
    50% {
        opacity: 1;
    }
    60% {
        opacity: 0.93;
    }
    70% {
        opacity: 0.98;
    }
}

.hero .terminal-text {
    display: block;
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
    color: #0f0;
    text-shadow: 0 0 3px #0f0;
    white-space: pre-wrap;
}

.hero .speak {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    background: #0f0;
    color: #000;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.hero .speak:hover {
    background: #0a0;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.9);
}

.overlay {
    background: rgba(0, 0, 0, 0.5);
    padding: 2rem;
    border-radius: 8px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.2rem;
}

/* Navigation */
.nav {
    color: #fff;
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 1000;
}

.nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
}

.nav ul li {
    margin: 0 1rem;
}

.nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.nav ul li a:hover {
    /* Neon glow effect on hover */
    color: #0f0;
    text-shadow: 0 0 5px #0f0, 0 0 10px #0f0;
}

main {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: auto;
    position: relative;
    z-index: 2;
}

/* Books Section */
.books h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #bff;
text-shadow: 0 0 4px #0ff, 0 0 12px #0ff;
}

.book-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.book {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    width: 300px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.book:hover {
    transform: translateY(-5px);
}

.book img {
    height: 450px;
    object-fit: cover;
}

/* Hover effect for book covers: subtle zoom and glow */
.book img {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.book img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
}

.book h3 {
    font-size: 1.2rem;
    margin: 0.8rem 1rem 0.5rem;
    color: #222;
}

.book p {
    font-size: 0.95rem;
    margin: 0 1rem 1rem;
    color: #555;
}

.btn {
    display: inline-block;
    margin: 0 1rem 1rem;
    padding: 0.5rem 1rem;
    background: #4c5c9c;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #3a4d80;
}

.btn.disabled {
    background: #888;
    cursor: not-allowed;
}

/* Glitch animation for interactive buttons */
.glitch-btn {
    position: relative;
}

.glitch-btn:hover {
    animation: glitch 0.8s linear infinite;
}

@keyframes glitch {
    0% {
        text-shadow: 2px 0 red, -2px 0 cyan;
    }
    20% {
        text-shadow: -2px 0 lime, 2px 0 magenta;
    }
    40% {
        text-shadow: 2px 2px blue, -2px -2px yellow;
    }
    60% {
        text-shadow: -1px 1px purple, 1px -1px lime;
    }
    80% {
        text-shadow: none;
    }
    100% {
        text-shadow: 2px 0 red, -2px 0 cyan;
    }
}

/* Fade-in animation for sections */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.visible {
    opacity: 1;
    transform: none;
}

/* About Section */
.about h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: #333;
}

.about p {
    max-width: 800px;
    margin: auto;
    color: #555;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0 1rem;
}

/* Contact Section */
.contact {
    background: #fff;
    padding: 2rem 1rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.contact h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: #333;
}

.contact p {
    text-align: center;
    margin-bottom: 1rem;
    color: #555;
}

.newsletter-form {
    display: flex;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto 1rem;
}

.newsletter-form input[type=email] {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.newsletter-form button {
    padding: 0.5rem 1rem;
    border: none;
    background: #4c5c9c;
    color: #fff;
    font-size: 1rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.3s ease;
}

.newsletter-form button:hover {
    background: #3a4d80;
}

.contact .note {
    font-size: 0.8rem;
    text-align: center;
    color: #777;
}

/* Footer */
footer {
    background: #222;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
}

/* Reviews ticker */
.reviews-ticker {
    background: #111;
    color: #0f0;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border-top: 1px solid #0f0;
    border-bottom: 1px solid #0f0;
    padding: 0.5rem 0;
    position: relative;
    z-index: 2;
}

.reviews-ticker .reviews-track {
    display: inline-block;
    /* Start the animation off‑screen to the right */
    padding-left: 100%;
    animation: scroll-reviews 60s linear infinite;
}

.reviews-ticker .review {
    margin-right: 3rem;
    display: inline-block;
}

@keyframes scroll-reviews {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}