/* Minimal, readable, and easy to tweak */
:root {
    --bg: #ffffff;
    --fg: #111111;
    --muted: #666;
    --card: #f4f4f4;
    --border: #e5e5e5;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] {
    --bg: #0f1115;
    --fg: #f2f4f8;
    --muted: #9aa3b2;
    --card: #171a21;
    --border: #2a2f3a;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Helvetica,
        Arial;
    background: var(--bg);
    color: var(--fg);
}
.header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 16px 12px;
}
.title {
    margin: 0 0 10px;
    font-size: 24px;
    letter-spacing: -0.02em;
}
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.search {
    flex: 1 1 260px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--fg);
    outline: none;
}
.buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}
.btn {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--fg);
    cursor: pointer;
}
.btn.active {
    background: var(--card);
}
.meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 16px 60px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
}

.tile {
    position: relative;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    cursor: pointer;
    box-shadow: none;
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease;
}
.tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.tile picture {
    width: 100%;
    height: 100%;
    display: block;
}
.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}
.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 4px 7px;
    border-radius: 999px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.modal.active {
    display: flex;
}
.modal-card {
    width: min(920px, 100%);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 280px 1fr;
}
@media (max-width: 720px) {
    .modal-card {
        grid-template-columns: 1fr;
    }
}
.modal-close {
    position: absolute;
    margin: 14px;
    right: 0;
    top: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--fg);
    cursor: pointer;
}
.modal-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--card);
    display: none;
}
.modal-body {
    padding: 18px 18px 20px;
}
.modal-title {
    margin: 0 0 6px;
    font-size: 20px;
}
.modal-author {
    color: var(--muted);
    margin-bottom: 10px;
}
.modal-badge {
    margin-bottom: 12px;
}
.modal-review {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.45;
}
/* ===== Theme toggle pinned to top-right of viewport ===== */
/* Pin the theme toggle to the top-right of the viewport */
#themeToggle,
.theme-toggle {
    position: fixed !important;
    top: 14px !important;
    right: 14px !important;
    z-index: 99999 !important;
    margin: 0 !important;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-bottom: 80px;
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 16px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2d8a2d;
}

.dark-mode .section-title {
    border-color: #4ade4a;
}

/* About Section */
.about-section p {
    margin-bottom: 16px;
}

/* Writing Section */
.writing-list li {
    margin-bottom: 24px;
}

.writing-list li:last-child {
    margin-bottom: 0;
}

.about-section .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 4px;
    padding-left: 16px;
}

.about-section ul {
    list-style: none;
    margin-bottom: 24px;
}

.about-section li {
    padding-left: 16px;
    position: relative;
    margin-bottom: 8px;
}

.about-section li::before {
    content: "-";
    position: absolute;
    left: 0;
}

.site-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

:root {
    --content-max: 1100px; /* match your bookshelf max width */
}

/* Center your whole page content */
.page-wrapper {
    width: 100%;
}

.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 18px 16px;
}

/* If you still use header-inner, keep it consistent */
.header-inner {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 18px 16px 12px;
}
