@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&family=Inter:wght@300;400;600&display=swap');

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

:root {
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff00aa;
    --neon-yellow: #ffe600;
    --dark-bg: #0a0a0f;
    --dark-surface: #12121a;
    --dark-card: #1a1a2e;
    --text-primary: #e0e0e8;
    --text-muted: #8888a0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;

    &::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background:
            radial-gradient(ellipse at 20% 50%, rgba(0, 240, 255, 0.03) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(255, 0, 170, 0.03) 0%, transparent 50%);
        pointer-events: none;
        z-index: 0;
    }
}

/* ── HEADER ── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .logo {
        font-family: 'Orbitron', sans-serif;
        font-weight: 900;
        font-size: 1.2rem;
        letter-spacing: 0.3em;
        text-transform: uppercase;
        color: var(--neon-cyan);
        text-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    }

    nav {
        display: flex;
        gap: 2rem;

        a {
            font-family: 'Share Tech Mono', monospace;
            font-size: 0.85rem;
            color: var(--text-muted);
            text-decoration: none;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            transition: color 0.3s, text-shadow 0.3s;

            &:hover {
                color: var(--neon-cyan);
                text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
            }
        }
    }
}

/* ── MAIN ── */
main {
    flex: 1;
    position: relative;
    z-index: 1;
}

/* ── HERO ── */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 5rem 2rem;
    align-items: center;

    @media (max-width: 768px) {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
        padding: 3rem 1.5rem;
    }
}

.book-cover {
    justify-self: center;
    position: relative;

    .cover-frame {
        width: 300px;
        height: 440px;
        background: linear-gradient(145deg, var(--dark-card), #0d0d18);
        border: 1px solid rgba(0, 240, 255, 0.2);
        border-radius: 4px;
        overflow: hidden;
        box-shadow:
            0 0 40px rgba(0, 240, 255, 0.1),
            0 20px 60px rgba(0, 0, 0, 0.5);
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transition: transform 0.4s, box-shadow 0.4s;

        &:hover {
            transform: perspective(800px) rotateY(-3deg) scale(1.02);
            box-shadow:
                0 0 60px rgba(0, 240, 255, 0.2),
                0 20px 80px rgba(0, 0, 0, 0.6);
        }

        &::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-yellow));
        }

        .cover-art {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .cover-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 2rem 1.5rem 1.5rem;
            background: linear-gradient(transparent, rgba(10, 10, 15, 0.95));

            .cover-title {
                font-family: 'Orbitron', sans-serif;
                font-weight: 900;
                font-size: 1.6rem;
                color: var(--neon-cyan);
                text-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
                letter-spacing: 0.15em;
            }

            .cover-author {
                font-family: 'Share Tech Mono', monospace;
                font-size: 0.8rem;
                color: var(--neon-magenta);
                margin-top: 0.3rem;
                letter-spacing: 0.1em;
            }
        }
    }
}

.book-info {
    .tag {
        font-family: 'Share Tech Mono', monospace;
        font-size: 0.75rem;
        color: var(--neon-magenta);
        letter-spacing: 0.2em;
        text-transform: uppercase;
        margin-bottom: 0.8rem;
    }

    h1 {
        font-family: 'Orbitron', sans-serif;
        font-size: 2.8rem;
        font-weight: 900;
        line-height: 1.1;
        margin-bottom: 0.3rem;
        background: linear-gradient(135deg, var(--neon-cyan), #ffffff, var(--neon-magenta));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;

        @media (max-width: 768px) {
            font-size: 2rem;
        }
    }

    .subtitle {
        font-family: 'Share Tech Mono', monospace;
        font-size: 1rem;
        color: var(--neon-yellow);
        margin-bottom: 1.5rem;
        letter-spacing: 0.05em;
    }

    .description {
        font-size: 1.05rem;
        color: var(--text-muted);
        line-height: 1.8;
        margin-bottom: 2rem;
        max-width: 500px;
        font-weight: 300;
    }

    .meta {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        font-family: 'Share Tech Mono', monospace;
        font-size: 0.85rem;

        .meta-row {
            display: flex;
            gap: 0.5rem;

            .label {
                color: var(--neon-cyan);
                min-width: 80px;
            }

            .value {
                color: var(--text-muted);
            }
        }
    }
}

/* ── EXCERPT ── */
.excerpt-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;

    .section-label {
        font-family: 'Orbitron', sans-serif;
        font-size: 0.8rem;
        color: var(--neon-magenta);
        letter-spacing: 0.3em;
        text-transform: uppercase;
        margin-bottom: 1.5rem;
        text-align: center;

        &::before,
        &::after {
            content: '───';
            color: rgba(255, 0, 170, 0.3);
            margin: 0 1rem;
        }
    }

    .excerpt-block {
        background: var(--dark-surface);
        border-left: 3px solid var(--neon-cyan);
        padding: 2rem 2.5rem;
        border-radius: 0 8px 8px 0;
        position: relative;
        font-size: 1.05rem;
        line-height: 2;
        color: var(--text-muted);
        font-weight: 300;
        font-style: italic;

        &::before {
            content: '"';
            position: absolute;
            top: -10px;
            left: 15px;
            font-family: 'Orbitron', sans-serif;
            font-size: 4rem;
            color: rgba(0, 240, 255, 0.15);
            line-height: 1;
        }

        p {
            margin-bottom: 1rem;

            &:last-child {
                margin-bottom: 0;
            }
        }

        .chapter-ref {
            display: block;
            text-align: right;
            font-style: normal;
            font-family: 'Share Tech Mono', monospace;
            font-size: 0.8rem;
            color: var(--neon-yellow);
            margin-top: 1.5rem;
            letter-spacing: 0.1em;
        }
    }
}

/* ── FOOTER ── */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(0, 240, 255, 0.1);
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    padding: 2rem;
    text-align: center;

    .footer-content {
        max-width: 800px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .footer-title {
        font-family: 'Orbitron', sans-serif;
        font-size: 0.8rem;
        color: var(--neon-cyan);
        letter-spacing: 0.3em;
        text-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    }

    .footer-copy {
        font-family: 'Share Tech Mono', monospace;
        font-size: 0.75rem;
        color: var(--text-muted);
        letter-spacing: 0.05em;
    }

    .footer-line {
        width: 60px;
        height: 2px;
        background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
        margin: 0 auto;
        border-radius: 1px;
    }
}

/* ── SCANLINE EFFECT ── */
@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    html { scroll-behavior: auto; }
    .cover-frame:hover {
        transform: none;
    }
}

/* ── MOBILE ── */
@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;

        .logo {
            font-size: 0.95rem;
            letter-spacing: 0.15em;
        }

        nav {
            gap: 1rem;
            flex-wrap: wrap;
            justify-content: center;

            a {
                font-size: 0.8rem;
                padding: 0.25rem 0;
                /* touch-friendly tap target */
                min-height: 44px;
                display: inline-flex;
                align-items: center;
            }
        }
    }

    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
        padding: 2rem 1.25rem;
    }

    .book-cover .cover-frame {
        width: 220px;
        height: 320px;
        /* disable hover transform on touch */
        &:hover {
            transform: none;
        }
    }

    .book-info {
        .tag { font-size: 0.7rem; }

        h1 { font-size: 1.75rem; }

        .subtitle { font-size: 0.9rem; margin-bottom: 1rem; }

        .description {
            font-size: 0.95rem;
            line-height: 1.7;
            max-width: 100%;
            margin-bottom: 1.5rem;
        }

        .meta {
            align-items: flex-start;
            font-size: 0.8rem;
            text-align: left;

            .meta-row {
                justify-content: flex-start;
            }
        }
    }

    .excerpt-section {
        padding: 2rem 1rem 3rem;

        .section-label {
            font-size: 0.65rem;
            letter-spacing: 0.15em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            &::before, &::after { margin: 0 0.4rem; }
        }

        .excerpt-block {
            padding: 1.5rem 1.25rem;
            font-size: 0.95rem;
            line-height: 1.8;

            &::before {
                font-size: 3rem;
                top: -5px;
                left: 10px;
            }
        }
    }

    footer {
        padding: 1.5rem 1rem;

        .footer-title { font-size: 0.7rem; letter-spacing: 0.15em; }
        .footer-copy { font-size: 0.7rem; }
    }
}

/* ── RESPONSIVE IMAGES ── */
img {
    max-width: 100%;
    height: auto;
}

/* ── 404 PAGE ── */
/* Scoped to <body class="error-page"> on /404.html so it doesn't conflict
   with the main novella layout above. The Google Fonts @import at the top
   of this file already covers Orbitron + Inter; 404 reuses the same set. */
.error-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    text-align: center;

    .container {
        padding: 2rem;
    }

    h1 {
        font-family: 'Orbitron', sans-serif;
        font-size: 5rem;
        color: var(--neon-cyan);
        text-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
        margin-bottom: 0.5rem;
    }

    p {
        color: var(--text-muted);
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }

    a {
        color: var(--neon-magenta);
        text-decoration: none;
        font-weight: 600;
        border: 1px solid var(--neon-magenta);
        padding: 0.75rem 2rem;
        transition: all 0.3s;

        &:hover {
            background: var(--neon-magenta);
            color: var(--dark-bg);
        }
    }
}
