/* Shared styling for the library (index.html) and chapter grids (book.html) */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fafaf8;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    padding: 20px 0;
    border-bottom: 1px solid #e5e5e5;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
}

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

.header-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(245, 245, 247, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    color: #667;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: rgba(230, 230, 235, 0.9);
    transform: scale(1.05);
}

.title-section {
    padding: 60px 0 40px;
    text-align: center;
}

h1 {
    font-family: "Noto Serif Display", serif;
    font-size: 42px;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: #1d1d1f;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 30px;
    padding: 40px 0 80px;
}

.page-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s;
}

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

.page-icon:hover .page-box {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
}

.page-box {
    width: 120px;
    height: 160px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.page-icon-svg {
    width: 60px;
    height: 80px;
}

.scroll-body {
    fill: #f9f9f9;
    stroke: #999;
    stroke-width: 2;
}

.scroll-line {
    stroke: #ccc;
    stroke-width: 1;
}

.page-icon:hover .scroll-body {
    fill: #fff;
    stroke: #333;
}

.page-icon:hover .scroll-line {
    stroke: #999;
}

.page-label {
    font-size: 14px;
    color: #667;
}

/* Placeholder tiles for books without content yet */
.page-icon.coming-soon {
    cursor: default;
    opacity: 0.55;
}

.page-icon.coming-soon .page-box {
    border: 2px dashed #ddd;
    background: transparent;
    box-shadow: none;
}

.page-icon.coming-soon:hover {
    transform: none;
}

.page-icon.coming-soon:hover .page-box {
    box-shadow: none;
}

.page-icon.coming-soon:hover .scroll-body {
    fill: #f9f9f9;
    stroke: #999;
}

.page-icon.coming-soon:hover .scroll-line {
    stroke: #ccc;
}

/* Closed-book icon (library tiles; chapter tiles use the page icon) */
.book-cover {
    fill: #f9f9f9;
    stroke: #999;
    stroke-width: 2;
}

.book-spine {
    stroke: #999;
    stroke-width: 2;
}

.page-icon:hover .book-cover {
    fill: #fff;
    stroke: #333;
}

.page-icon:hover .book-spine {
    stroke: #333;
}

.page-icon.coming-soon:hover .book-cover {
    fill: #f9f9f9;
    stroke: #999;
}

.page-icon.coming-soon:hover .book-spine {
    stroke: #999;
}

@media (max-width: 768px) {
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 20px;
    }

    .page-box {
        width: 90px;
        height: 120px;
    }

    .page-icon-svg {
        width: 45px;
        height: 60px;
    }

    h1 {
        font-size: 32px;
    }
}
