:root {
    --ink: #1f2421;
    --muted: #5f6b66;
    --border: #dde3df;
    --bg: #fbfaf7;
    --card: #ffffff;
    --accent: #2f5d50;
    --accent-hover: #244840;
    --danger: #8a3b2e;
    --danger-bg: #fbeceb;
    --ok-bg: #eaf3ee;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg) url('/images/background.jpg') repeat;
    background-size: 420px auto;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container { flex: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

header.site {
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

header.site .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

header.site .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

header.site .brand img {
    height: 40px;
    width: 40px;
    border-radius: 8px;
    object-fit: cover;
}

header.site nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.95rem;
}

header.site form { display: inline; }
header.site button.link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent);
    cursor: pointer;
}
header.site button.link:hover { text-decoration: underline; }

main { padding: 2.5rem 0 4rem; }

.status, .errors {
    max-width: 1040px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

.status .box {
    background: var(--ok-bg);
    border: 1px solid #bcd9c9;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.errors .box {
    background: var(--danger-bg);
    border: 1px solid #e3bcb5;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.errors ul { margin: 0; padding-left: 1.25rem; }

h1 { font-size: 1.75rem; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; }

.lede { color: var(--muted); max-width: 60ch; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1.5rem 0 2rem;
}

.toolbar select, .toolbar input[type="search"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.book-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.book-card .cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 6px;
    background: var(--border);
}

.book-card h3 { margin: 0.25rem 0 0; font-size: 1.05rem; }
.book-card .author { color: var(--muted); font-size: 0.9rem; margin: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.25rem 0; }
.tag {
    background: var(--ok-bg);
    color: var(--accent);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.book-detail { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; }
.book-detail .cover {
    width: 100%;
    border-radius: 8px;
    background: var(--border);
}
.book-detail .blurb { white-space: pre-line; }
.book-detail .attribution { color: var(--muted); font-size: 0.9rem; }
.book-detail .editorial {
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
    color: var(--muted);
    font-style: italic;
}

.disclosure {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.5rem;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--danger); }

form.stacked label {
    display: block;
    font-weight: 600;
    margin: 1rem 0 0.35rem;
    font-size: 0.9rem;
}
form.stacked input[type="text"],
form.stacked input[type="email"],
form.stacked input[type="password"],
form.stacked input[type="url"],
form.stacked textarea,
form.stacked select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}
form.stacked .hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
form.stacked fieldset { border: 1px solid var(--border); border-radius: 6px; margin-top: 1rem; }
form.stacked .field-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.25rem; }
form.stacked .actions { margin-top: 1.5rem; }
form.stacked .checkbox-group label { font-weight: 400; display: inline; margin: 0; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 440px;
}

table.moderation { width: 100%; border-collapse: collapse; }
table.moderation th, table.moderation td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.moderation .reject-form { margin-top: 0.5rem; }
table.moderation textarea { width: 100%; min-height: 3rem; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 2rem;
}
.pagination .page-numbers { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pagination .page-link {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent);
    line-height: 1;
}
.pagination a.page-link:hover { background: var(--card); border-color: var(--accent); text-decoration: none; }
.pagination .page-link.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-link.disabled { color: var(--muted, #99a29c); border-color: var(--border); }

.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    background: var(--card);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    padding: 2.5rem 1.5rem 1.5rem;
}

.footer-brand { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.5rem; }
.footer-tagline { color: var(--muted); font-size: 0.9rem; max-width: 32ch; margin: 0; }

.footer-heading {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    margin: 0 0 0.75rem;
}

.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 0.5rem; font-size: 0.9rem; }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}
.footer-bottom p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (max-width: 640px) {
    .footer-grid { grid-template-columns: 1fr; }
}

.legal-content h2 { margin-top: 2rem; }
.legal-content { max-width: 70ch; }
.legal-notice {
    background: var(--ok-bg);
    border: 1px solid #bcd9c9;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
