@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap');

:root {
    --max-width: 900px;
    --type-size: 18px;
    --leading: 1.7;
    --bg: #fff;
    --fg: #111;
    --muted: #555;
    font-family: "Roboto Mono", monospace;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
}



body.dark-mode {
    --bg: #111111;
    --fg: #e6e6e6;
    --muted: #555;
}


* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    line-height: var(--leading);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 1rem;

}

.site-header,
.reader-header {
    max-width: var(--max-width);
    margin: 0 auto 1rem;
}

.reader-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.back {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.reader-controls {
    display: flex;
    gap: .4rem;
    align-items: center;
}

.control-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.control {
    display: inline-block;
    border-radius: 8px;
    padding: .25rem .5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    user-select: none;
}

.library {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    gap: 1rem;
}

.book-card {
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.01);
}

.book-card h2 {
    margin: .1rem 0 0;
    font-size: 1.1rem;
}

.book-card a {
    color: inherit;
    text-decoration: none;
}

.toc {
    max-width: var(--max-width);
    margin: 0 auto 1rem;
    padding: .5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.toc a {
    color: var(--muted);
    text-decoration: none;
    font-size: .95rem;
}

.book {
    max-width: var(--max-width);
    margin: 0 auto 2rem;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
    border-radius: 8px;
}

.chapter {
    margin-bottom: 2rem;
}

.book p {
    font-size: var(--type-size);
    margin: .9rem 0;
}

.book h2 {
    margin-top: 0;
    font-size: 1.4rem;
}

a {
    color: #0366d6;
}

.reader-footer {
    display: flex;
    justify-content: space-between;
    max-width: var(--max-width);
    margin: 0 auto 3rem;
    color: var(--muted);
    border-radius: 4px;
}

@media (min-width:900px) {
    .book {
        column-gap: 3rem;
    }

    .chapter {
        break-inside: avoid;
    }

}

a:focus,
.control:focus {
    outline: 3px solid #9ecaff;
    outline-offset: 2px;
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .reader-controls,
    .toc,
    .back {
        display: none;
    }

    .book {
        column-width: auto;
    }
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: none;
    display: flex;
    justify-content: center;
    z-index: 1000;
    align-items: center;
    transition: transform .15s ease, box-shadow .15s ease;
    transition:
        transform 0.3s cubic-bezier(.25, .46, .45, .94),
        box-shadow 0.3s cubic-bezier(.25, .46, .45, .94);
}

.topbar a {
    color: rgb(0, 0, 0);
    text-decoration: none;
    padding: 14px 20px;
    font-size: 14px;
    backdrop-filter: blur(-10px);
}

.topbar:hover {
    transform: scale(1.05);
    box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.414);
}

.topbar a:hover {
    background-color: #a2bdc7ab;
    border-radius: 5px;

}


.book-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    width: 100%;
}

.book-item figure {
    margin: 0;
}

.book-image {
    border: 1px solid black;
    width: 100%;
    height: 500px;
    object-fit: cover;
    display: block;
    border-radius: 15px;
}

.book-image2 {
    border: 1px solid black;
    width: 100%;
    height: 500px;
    object-fit: cover;
    display: block;
    border-radius: 15px;
    opacity: 15%;
}

.book-image:hover {
    transform: scale(1.05);
    box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.414);
}

@media (max-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.header {
    margin-top: 60px;
    font-size: 2.5em;
}

.link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #077fe8;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

h1 {
    margin-top: 60px;
}

.back-link {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
    place-items: center left;
}

.back-link:hover {
    background-color: #f5f5f5;
}


.footer-right {
    border-radius: 4px;

}

button {
    border-radius: 5px;
    background-color: white;
    border-color: white;
    transition:
        transform 0.3s cubic-bezier(.25, .46, .45, .94),
        box-shadow 0.3s cubic-bezier(.25, .46, .45, .94);

}

button:hover {
    transform: scale(1.05);
    box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.414);
}

body {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

body.fade-out {
    animation: fadeOut 0.1s ease-out;
    opacity: 0;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.search {
    max-width: var(--max-width);
    margin: 2rem auto;
    padding: 0 1rem;
}

.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

#searchInput {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 15px;
    font-size: 16px;
    font-family: "Roboto Mono", monospace;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    color: var(--fg);
    outline: none;
    transition: all 0.3s;
}

#searchInput:focus {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 0 3px rgba(0, 102, 214, 0.1);
}

.filterbuttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filterbutton {
    padding: 8px 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    color: var(--fg);
    border-radius: 15px;
    cursor: pointer;
    font-family: "Roboto Mono", monospace;
    font-size: 14px;
    transition: transform 0.3s cubic-bezier(.25, .46, .45, .94),
        box-shadow 0.3s cubic-bezier(.25, .46, .45, .94);
}

.filterbutton:hover {
    transform: scale(1.05);
    box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.414);
}

.filterbutton.active {
    background: #0dc4dc;
    color: white;
    border-color: #0dc4dc;
}

.results {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 1rem;
    font-family: "Roboto Mono", monospace;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    font-size: 18px;
    display: none;
}

.no-results.visible {
    display: block;
}

.book-item.hidden {
    display: none;
}