:root {
    --ink: #161616;
    --paper: #faf9f6;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Tahoma, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        radial-gradient(rgba(22, 22, 22, 0.05) 1px, transparent 1px),
        radial-gradient(rgba(22, 22, 22, 0.05) 1px, transparent 1px);
    background-size: 3px 3px;
    background-position: 0 0, 1.5px 1.5px;
}

a {
    color: var(--ink);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

/* ---- layout ---- */

.site {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    min-height: 100vh;
    min-width: 600px;
}

.sidebar {
    flex: 0 0 160px;
    width: 160px;
    padding: 40px 20px;
}

.brand {
    display: block;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 0.03em;
    margin-bottom: 32px;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list li {
    margin-bottom: 10px;
}

.nav-list a {
    font-size: 12px;
    letter-spacing: 0.02em;
}

.nav-list a.current {
    text-decoration: underline;
}

.content {
    flex: 1 1 auto;
    padding: 120px 30px 60px 10px;
    max-width: 900px;
}

.page-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #666;
    margin: 0 0 24px;
}

/* ---- about ---- */

.about-photo {
    width: 220px;
    margin-bottom: 28px;
    border: 2px solid var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
}

.about-text {
    max-width: 520px;
}

/* ---- books grid ---- */

.book-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
}

.book-card {
    width: 180px;
}

.book-cover {
    margin-bottom: 12px;
    border: 2px solid var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
}

.book-card .book-title {
    font-size: 12px;
}

/* ---- reader ---- */

.reader-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 48px;
}

.reader-arrow {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 28px;
    line-height: 1;
    color: #161616;
    cursor: pointer;
    padding: 6px 10px;
}

.reader-arrow:hover:not(:disabled) {
    text-decoration: underline;
}

.reader-arrow:disabled {
    color: #ccc;
    cursor: default;
}

/* pin the reader's own prev/next buttons to the stage edges; the blog's
   prev/next buttons reuse .reader-arrow but stay inline, above */
.reader-stage .reader-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(250, 249, 246, 0.85);
    border: 1px solid var(--ink);
    border-radius: 50%;
    font-size: 22px;
    padding: 0;
}

.reader-stage #prevBtn {
    left: 0;
}

.reader-stage #nextBtn {
    right: 0;
}

.reader-stage .reader-arrow:hover:not(:disabled) {
    background: var(--paper);
    text-decoration: none;
}

.reader-stage .reader-arrow:disabled {
    border-color: #ccc;
}

.reader-pages {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: center;
}

.reader-pages img {
    height: auto;
    width: auto;
    max-height: min(480px, 55vh);
    max-width: calc(50% - 2px);
    object-fit: contain;
    cursor: zoom-in;
}

.reader-pages img:only-child {
    max-width: 100%;
}

/* ---- lightbox ---- */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(22, 22, 22, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.is-open {
    display: flex;
}

.lightbox-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-img {
    max-width: 92vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    cursor: zoom-in;
}

.lightbox-img.is-zoomed {
    cursor: grab;
}

.lightbox-img.is-dragging {
    cursor: grabbing;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 28px;
    background: none;
    border: none;
    color: #faf9f6;
    font-family: inherit;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 10px;
}

.lightbox-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.lightbox-btn {
    background: rgba(250, 249, 246, 0.1);
    border: 1px solid rgba(250, 249, 246, 0.4);
    color: #faf9f6;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 14px;
}

.lightbox-btn:hover {
    background: rgba(250, 249, 246, 0.2);
}

.reader-meta {
    text-align: center;
    margin-top: 16px;
}

.reader-title {
    font-size: 13px;
    margin: 0 0 4px;
}

.reader-indicator {
    font-size: 11px;
    color: #777;
    margin: 0;
}

.back-link {
    display: inline-block;
    font-size: 12px;
    margin-bottom: 24px;
}

/* ---- blog ---- */

.blog-post {
    max-width: 560px;
}

.blog-title {
    font-size: 17px;
    margin: 0 0 4px;
}

.blog-date {
    font-size: 11px;
    color: #777;
    margin: 0 0 20px;
}

.blog-post img {
    margin: 16px 0;
}

.blog-video {
    display: block;
    width: 100%;
    max-width: 560px;
    margin: 16px 0;
}

.blog-gallery {
    display: flex;
    flex-direction: column;
}

.blog-gallery img {
    margin: 16px 0;
}

.blog-post figure {
    margin: 16px 0;
    padding: 0;
}

.blog-post figcaption {
    font-size: 12px;
    font-style: italic;
    color: #888;
    margin-top: 6px;
}

.blog-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}

.blog-nav-label {
    font-size: 11px;
    color: #777;
}

/* ---- events ---- */

.events-heading {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 32px 0 16px;
}

.events-heading:first-of-type {
    margin-top: 0;
}

.event-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
}

.event-card {
    width: 200px;
}

.event-flyer {
    margin-bottom: 12px;
    border: 2px solid var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
}

.event-title {
    font-size: 12px;
    font-weight: bold;
    margin: 0 0 2px;
}

.event-date {
    font-size: 11px;
    color: #777;
    margin: 0 0 6px;
}

.event-desc {
    font-size: 12px;
    margin: 0;
}

/* ---- mobile ---- */

@media (max-width: 640px) {
    .site {
        flex-direction: column;
        min-width: 0;
    }

    .sidebar {
        width: 100%;
        flex: none;
        padding: 20px;
    }

    .content {
        padding: 30px 16px 60px;
        max-width: 100%;
    }

    .reader-stage {
        padding: 0 40px;
    }
}
