/* KKRD reader — mobile-first, minimal, made for reading. */

:root {
    --bg: #f7f5f0;
    --surface: #fffdf8;
    --text: #1b1a17;
    --muted: #6b675e;
    --line: #e2ddd2;
    --accent: #c0392b;
    --mark: #ffe08a;
    --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17161b;
        --surface: #201f26;
        --text: #e9e6df;
        --muted: #9a958a;
        --line: #302e38;
        --accent: #ff6b5e;
        --mark: #6b5a1e;
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 1.0625rem/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow-wrap: break-word;
}

/* ---- chrome ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.brand {
    display: inline-block;
    padding: 0.85rem 1.1rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-decoration: none;
}
.wrap {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 1.1rem 1.1rem 3rem;
}
.foot {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 1.5rem 1.1rem 2.5rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}
.foot a { color: var(--muted); }

a { color: var(--accent); }

/* ---- search ---- */
.search {
    display: flex;
    gap: 0.5rem;
    margin: 0.25rem 0 1.25rem;
}
.search input {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 0.9rem;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0.6rem;
}
.search input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.search button {
    padding: 0.8rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 0.6rem;
    cursor: pointer;
}

.count {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---- list ---- */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.list-item {
    border-bottom: 1px solid var(--line);
}
.list-item > a {
    display: block;
    padding: 0.85rem 0.25rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}
.list-item > a:hover { color: var(--accent); }
.list-item.is-struska > a {
    font-weight: 400;
    font-style: italic;
    color: var(--muted);
}
.snip {
    margin: 0 0 0.85rem;
    padding: 0 0.25rem;
    color: var(--muted);
    font-size: 0.92rem;
}
mark {
    background: var(--mark);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* ---- post detail ---- */
.post { margin-bottom: 2rem; }
.post-title {
    margin: 0.5rem 0 1.25rem;
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
}
.badge {
    display: inline-block;
    margin: 0 0 1rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 1rem;
}
.post-body {
    white-space: pre-wrap;
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: 1.15rem;
    line-height: 1.75;
}

/* ---- pager (book-like navigation) ---- */
.pager {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.pager-btn {
    flex: 1;
    padding: 0.9rem 0.75rem;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0.7rem;
}
.pager-btn[rel="next"] { text-align: center; }
.pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.pager-btn.is-off {
    opacity: 0.35;
    pointer-events: none;
}

@media (min-width: 34rem) {
    .post-title { font-size: 1.9rem; }
    .post-body { font-size: 1.2rem; }
}
