/* All of the look lives here. Colours are the variables at the top. */
:root {
  --bg: #fbfaf7; --panel: #f3f1ec; --text: #22201c; --muted: #77726a; --line: #e4e0d8;
  --accent: #b4532a; --read: #9a958c;
  --serif: Charter, "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, system-ui, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1a18; --panel: #232220; --text: #e6e2da; --muted: #9a958c; --line: #34322e;
          --accent: #e08a5f; --read: #6f6b64; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); display: flex; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
h1 { font: 600 22px var(--sans); margin: 0; }
h2 { font: 600 15px var(--sans); margin: 28px 0 8px; }
code { background: var(--panel); padding: 2px 5px; border-radius: 4px; font-size: 13px; }

.side { width: 250px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px;
        height: 100vh; position: sticky; top: 0; overflow-y: auto; }
.brand { display: block; font: 700 18px var(--serif); padding: 4px 8px 12px; }
.nav-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; }
.nav-row:hover { background: var(--line); }
.nav-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row.src { padding-left: 20px; font-size: 13.5px; color: var(--muted); }
.nav-row.err span:first-child::after { content: " ⚠"; }
.count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.folder { margin-top: 10px; }
.folder summary { padding: 5px 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; text-transform: uppercase;
                  letter-spacing: .04em; color: var(--muted); }
.folder summary .count { float: right; }

main { flex: 1; min-width: 0; max-width: 780px; margin: 0 auto; padding: 24px 28px 80px; }
.menu { display: none; font-size: 22px; cursor: pointer; margin-bottom: 8px; }
.list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.list-head .search { flex: 1; display: flex; justify-content: flex-end; }
input[type=text], input[type=url], input[type=search], input[type=password] {
  font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 0; }
button { font: inherit; color: var(--bg); background: var(--accent); border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button.quiet, a.quiet { background: none; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
button.quiet:hover, a.quiet:hover { background: var(--panel); color: var(--text); }
button.link { background: none; color: var(--muted); padding: 5px 8px; margin-top: 16px; }
button.danger:hover { color: #c0392b; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input[type=url], .row input[name=title] { flex: 1; }
.error { color: #c0392b; } .notice { background: var(--panel); padding: 8px 12px; border-radius: 6px; }

.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.item.selected { box-shadow: inset 3px 0 var(--accent); }
.item-link { flex: 1; min-width: 0; padding: 12px 8px; }
.item .title { font: 600 17px/1.3 var(--serif); margin: 2px 0; }
.item.read .title, .item.read .excerpt { color: var(--read); font-weight: 400; }
.meta { color: var(--muted); font-size: 12.5px; }
.excerpt { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.more { display: block; text-align: center; padding: 16px; color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 4px; margin-bottom: 24px; position: sticky; top: 0; background: var(--bg); padding: 6px 0; }
.spacer { flex: 1; }
.reading { max-width: 680px; margin: 0 auto; }
.reading h1 { font: 700 30px/1.2 var(--serif); margin: 6px 0 20px; }
.reading audio { width: 100%; margin-bottom: 20px; }
.content { font: 18px/1.65 var(--serif); overflow-wrap: break-word; }
.content img, .content video, .content iframe { max-width: 100%; height: auto; }
.content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.content blockquote { margin: 1em 0; padding-left: 1em; border-left: 3px solid var(--line); color: var(--muted); }
.content pre { white-space: pre-wrap; font: 14px/1.5 ui-monospace, monospace; background: var(--panel); padding: 12px; border-radius: 6px; }
.content table { max-width: 100%; }
.sources { width: 100%; border-collapse: collapse; } .sources td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.bookmarklet { color: var(--accent); border: 1px dashed var(--accent); padding: 2px 8px; border-radius: 6px; }

body.login { align-items: center; justify-content: center; }
body.login form { display: flex; flex-direction: column; gap: 10px; width: 260px; }

@media (max-width: 760px) {
  .side { display: none; position: fixed; z-index: 2; width: 82%; }
  #nav-toggle:checked ~ .side { display: block; }
  .menu { display: inline-block; }
  main { padding: 14px 14px 60px; }
  .content { font-size: 17px; }
}
