/* books.janson.org — mobile-first, system fonts, no JS. */

:root {
    --bg: #fafaf7;
    --surface: #ffffff;
    --ink: #232323;
    --muted: #6c6c6c;
    --accent: #6b3e2e;
    --rule: #e3e0d6;
    --pick-bg: #fff7ec;
    --soon-bg: #ececec;
    --live-bg: #e0eccf;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.55;
}

main, header, footer {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-top: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1.5rem;
}

.brand {
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.crumbs {
    font-size: 0.92rem;
    color: var(--muted);
}

.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.site-footer {
    margin-top: 3rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

h1 {
    font-size: 1.6rem;
    line-height: 1.2;
    margin: 0.5rem 0 0.75rem;
}

h2 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.5rem;
}

h3 { font-size: 1.05rem; margin: 0 0 0.25rem; }
h4 { font-size: 1rem; margin: 0 0 0.25rem; }

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

.tier {
    margin: 2rem 0;
}

.tier .hint {
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0.25rem 0 0.75rem;
}

.tier.empty .placeholder {
    color: var(--muted);
    font-style: italic;
}

.cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.card.pick {
    display: flex;
    gap: 0.85rem;
    background: var(--pick-bg);
}

.card.pick .rank {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--accent);
    font-size: 1.4rem;
    min-width: 1.5em;
    text-align: right;
}

.card.pick .body { flex: 1 1 auto; min-width: 0; }

.card .title { word-break: break-word; }

/* Title-as-Goodreads-link: inherit the title's typography but keep it
   underlined-on-hover so it's clear the title is clickable. */
.gr-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--muted);
}
.gr-link:hover, .gr-link:focus {
    text-decoration: none;
    border-bottom-color: currentColor;
}
.archive table td .gr-link { border-bottom: none; }
.archive table td:first-child .gr-link { border-bottom: 1px dotted var(--muted); }

.card .meta {
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0.1rem 0 0.4rem;
}

.card .meta .author { color: var(--ink); font-weight: 500; }

.card .motivation {
    margin: 0.4rem 0 0.3rem;
}

.card .library-context {
    color: var(--muted);
    font-size: 0.9rem;
    font-style: italic;
    margin: 0.25rem 0 0.25rem;
    border-left: 2px solid var(--rule);
    padding-left: 0.6rem;
}
.card .library-context .label {
    font-style: normal;
    font-weight: 500;
    color: var(--ink);
}

.card .sources {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

/* Worth a Look — denser */
.card.worth {
    padding: 0.6rem 0.85rem;
}
.card.worth .title { font-size: 0.98rem; }
.card.worth .meta { font-size: 0.86rem; margin: 0.1rem 0 0; }

/* Archive — table inside <details> */
.tier.archive details {
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
}

.tier.archive summary {
    cursor: pointer;
    list-style: none;
    padding: 0.25rem 0;
}

.tier.archive summary::-webkit-details-marker { display: none; }

.tier.archive summary h2 {
    display: inline;
    font-size: 1.1rem;
    margin: 0;
}

.tier.archive summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.5em;
    color: var(--muted);
    transition: transform 0.15s;
}

.tier.archive details[open] summary::before {
    content: "▾";
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}

th {
    background: var(--bg);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.015); }

/* Genre overview index */
.genre-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 480px) {
    .genre-grid { grid-template-columns: repeat(2, 1fr); }
}

.genre-card {
    display: block;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 8px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color 0.15s, transform 0.05s;
}

.genre-card:hover { border-color: var(--accent); }
.genre-card:active { transform: translateY(1px); }

.genre-card h2 {
    font-size: 1.05rem;
    margin: 0 0 0.4rem;
    color: var(--ink);
}

.badge {
    display: inline-block;
    font-size: 0.78rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    color: var(--ink);
}

.badge.live { background: var(--live-bg); }
.badge.soon { background: var(--soon-bg); color: var(--muted); }

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1b18;
        --surface: #26241f;
        --ink: #f0ece2;
        --muted: #b3ad9a;
        --accent: #d8a283;
        --rule: #3a372f;
        --pick-bg: #3a2c20;
        --soon-bg: #2c2a25;
        --live-bg: #2e3b25;
    }
    tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
}
