:root {
  --bg: #f7f6f2;
  --panel: #ffffff;
  --ink: #1d1f21;
  --muted: #6b6f74;
  --line: #e3e1da;
  --accent: #0f766e;
  --accent-soft: #e0f2ef;
  --quote: #f1efe8;
  --mark: #fde68a;
  --target: #fff7d6;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --panel: #1d2024;
    --ink: #e6e4df;
    --muted: #9a9ea5;
    --line: #2e3238;
    --accent: #5eead4;
    --accent-soft: #163330;
    --quote: #24282d;
    --mark: #7c5e10;
    --target: #2f2a17;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 1.5rem 0 0.4rem; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.meta { color: var(--muted); font-size: 0.92rem; margin: 0.2rem 0 1rem; }

/* header and footer */
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1.2rem; padding-top: 0.7rem; padding-bottom: 0.7rem; }
.brand { font-weight: 700; color: var(--ink); }
.brand span { color: var(--muted); font-weight: 400; }
.top nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: 0.95rem; }
footer { color: var(--muted); font-size: 0.85rem; padding-top: 2rem; padding-bottom: 2rem; border-top: 1px solid var(--line); margin-top: 3rem; }

/* forms */
input[type="search"], input[type="date"], select {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.6rem; max-width: 100%;
}
input[type="search"] { width: 100%; font-size: 1.05rem; padding: 0.7rem 0.85rem; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-top: 0.7rem; font-size: 0.92rem; color: var(--muted); }
.filters label { display: inline-flex; align-items: center; gap: 0.35rem; }
.toggle { color: var(--muted); font-size: 0.9rem; margin-left: 0.6rem; cursor: pointer; }

/* search results */
.results { list-style: none; padding: 0; margin: 0; }
.results li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; }
.rhead { font-size: 0.85rem; margin-bottom: 0.2rem; }
.rtext { color: var(--ink); display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.rtext:hover { text-decoration: none; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

/* messages */
.day { display: flex; flex-direction: column; gap: 0.55rem; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.9rem; scroll-margin-top: 1rem; }
.msg:target, .sys:target { background: var(--target); border-color: var(--accent); }
.msg header { display: flex; gap: 0.7rem; align-items: baseline; font-size: 0.87rem; margin-bottom: 0.15rem; }
.who { font-weight: 600; }
.when, .time { color: var(--muted); font-size: 0.85rem; }
.body { overflow-wrap: anywhere; }
.deleted .body { color: var(--muted); font-style: italic; }
.media { display: inline-block; font-size: 0.8rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 0.35rem; }
.mention { font-weight: 600; }
.quote { margin: 0.25rem 0 0.45rem; padding: 0.35rem 0.7rem; background: var(--quote); border-left: 3px solid var(--accent); border-radius: 4px; font-size: 0.9rem; color: var(--muted); }
.qwho { font-weight: 600; font-size: 0.82rem; }
.qtext { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.qlink { font-size: 0.8rem; }
/* A linked quote is clickable all over: the link's ::after covers the block, and links
   inside the quoted text are lifted above it so they still open on their own. */
.quote.linked { position: relative; cursor: pointer; transition: background-color 0.15s; }
.quote.linked:hover { background: var(--accent-soft); }
.quote.linked .qlink::after { content: ""; position: absolute; inset: 0; }
.quote.linked .qtext a { position: relative; z-index: 1; }
.sys { display: none; color: var(--muted); font-size: 0.85rem; text-align: center; }
body:has(#show-sys:checked) .sys { display: block; }
body:has(#only-links:checked) .day > .msg:not(.haslink),
body:has(#only-links:checked) .day > .sys { display: none; }
.empty-links { display: none; }
body:has(#only-links:checked) .day:not(:has(.haslink)) { display: none; }
body:has(#only-links:checked):not(:has(.day .haslink)) .empty-links { display: block; }

/* days */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; font-size: 0.92rem; }
ul.days { list-style: none; padding: 0; margin: 0; }
ul.days li { display: grid; grid-template-columns: minmax(5.5rem, max-content) 1fr 3rem; align-items: center; gap: 0.7rem; padding: 0.18rem 0; }
.recent ul.days li { grid-template-columns: 1fr 3rem; }
.bar { height: 0.55rem; border-radius: 3px; background: var(--accent-soft); position: relative; }
.bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 3px; opacity: 0.75; }
.n { color: var(--muted); font-size: 0.88rem; text-align: right; font-variant-numeric: tabular-nums; }

/* links */
.linkbar { position: sticky; top: 0; background: var(--bg); padding: 0.5rem 0; z-index: 1; }
.kinds { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.kinds button { font: inherit; font-size: 0.85rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; cursor: pointer; }
.kinds button span { color: var(--muted); }
.kinds button.on { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.kinds button.on span { color: inherit; opacity: 0.8; }
.linkbar .filters input[type="search"] { flex: 1 1 16rem; font-size: 0.95rem; padding: 0.45rem 0.7rem; }
ul.links { list-style: none; padding: 0; margin: 0; }
ul.links li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; }
.ltitle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; overflow-wrap: anywhere; }
.ltitle a { font-weight: 600; }
.kind { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stars, .lang { font-size: 0.82rem; color: var(--muted); }
.ldesc { font-size: 0.92rem; margin-top: 0.1rem; }
.lmeta { font-size: 0.83rem; color: var(--muted); margin-top: 0.2rem; }
ul.mlinks { padding-left: 1.2rem; }
ul.mlinks li { margin-bottom: 0.3rem; overflow-wrap: anywhere; }
ul.mlinks .ldesc { color: var(--muted); font-size: 0.88rem; }

/* members */
table.members { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.members th, table.members td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
table.members th { color: var(--muted); font-weight: 600; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

.prose { max-width: 680px; }

/* projects */
ol.projects { list-style: none; padding: 0; margin: 0; }
li.project { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.95rem; margin-bottom: 0.65rem; }
li.project .ltitle a { font-size: 1.05rem; }
.psummary { margin: 0.3rem 0 0.35rem; }
ul.features { margin: 0 0 0.4rem; padding-left: 1.2rem; font-size: 0.9rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0 0.45rem; }
.tag, .catchip { font: inherit; font-size: 0.76rem; line-height: 1.5; color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 4px; padding: 0 0.4rem; cursor: pointer; }
.catchip { color: var(--muted); background: var(--quote); }
.tag:hover, .catchip:hover { text-decoration: underline; }
.tag.on { cursor: default; text-decoration: none; }
li.project .quote { font-size: 0.86rem; }
li.project .lmeta { overflow-wrap: anywhere; }
