:root { color-scheme: light dark; --bg:#f7f7f5; --fg:#1d1d1b; --muted:#66665f; --card:#fff; --line:#e2e2db; --accent:#245c4a; --danger:#a33; }
@media (prefers-color-scheme: dark) { :root { --bg:#141513; --fg:#ecece6; --muted:#aaa9a0; --card:#1d1f1c; --line:#343630; --accent:#8fd0b7; --danger:#f08b8b; } }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:15px/1.55 ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; }
a { color:var(--accent); }
.topbar { position:sticky; top:0; z-index:10; display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:16px; padding:12px 22px; background:color-mix(in srgb,var(--bg) 90%,transparent); border-bottom:1px solid var(--line); backdrop-filter:blur(10px); }
.brand { font-weight:800; letter-spacing:-.03em; font-size:1.05rem; }
.topnav { display:flex; gap:4px; flex-wrap:wrap; justify-content:center; }
.topnav a { padding:5px 10px; border-radius:999px; text-decoration:none; color:var(--muted); font-size:.86rem; }
.topnav a:hover { background:color-mix(in srgb,var(--accent) 10%,transparent); }
.topnav a.active { background:color-mix(in srgb,var(--accent) 16%,transparent); color:var(--accent); font-weight:700; }
.wrap { max-width:940px; margin:0 auto; padding:28px 20px 64px; }
.page-head { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:20px; }
h1 { margin:0; font-size:clamp(1.6rem,4vw,2.3rem); letter-spacing:-.03em; }
.page-actions { display:flex; gap:8px; }
.button, button { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:8px 13px; border:1px solid var(--accent); border-radius:9px; background:var(--accent); color:#fff; font:inherit; font-size:.86rem; text-decoration:none; cursor:pointer; }
.button.ghost { background:transparent; color:var(--accent); }
button.link { padding:0; border:0; background:transparent; color:var(--accent); font-size:.85rem; }
button.danger { color:var(--danger); }
table { width:100%; table-layout:fixed; border-collapse:collapse; }
th, td { padding:9px 8px; text-align:left; vertical-align:top; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
th { color:var(--muted); font-size:.75rem; text-transform:uppercase; letter-spacing:.07em; }
td.date, .date { color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
td.tools { display:flex; gap:8px; align-items:center; }
td.notes { color:var(--muted); }
.editor { display:grid; gap:12px; max-width:720px; }
.editor label { display:grid; gap:4px; color:var(--muted); font-size:.82rem; }
.editor input, .editor textarea { width:100%; padding:9px 10px; border:1px solid var(--line); border-radius:8px; background:var(--card); color:var(--fg); font:inherit; }
.editor textarea { min-height:330px; resize:vertical; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
.editor .row { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.editor .check { display:flex; align-items:center; gap:8px; }
.post .meta { color:var(--muted); font-size:.8rem; }
.post .body { white-space:pre-wrap; overflow-wrap:anywhere; font-size:1rem; }
.login-card { max-width:380px; margin:8vh auto; padding:24px; background:var(--card); border:1px solid var(--line); border-radius:14px; }
.login-card p { margin-top:0; color:var(--muted); }
.login-card form { display:grid; gap:10px; }
.login-card input { width:100%; padding:9px 10px; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--fg); }
.error { color:var(--danger); }
.empty { color:var(--muted); }
@media (max-width:640px) {
  .topbar { grid-template-columns:1fr auto 1fr; padding:10px 12px; gap:6px; }
  .brand { font-size:.88rem; }
  .topnav { gap:1px; }
  .topnav a { padding:4px 6px; font-size:.7rem; }
  .wrap { padding:22px 14px 48px; }
  .page-head { align-items:flex-start; }
  .editor .row { grid-template-columns:1fr; }
  th, td { padding:7px 5px; font-size:.82rem; }
  .library th:nth-child(5), .library td:nth-child(5) { display:none; }
}

/* Journal index: plain date + plain-text tag links */
.journal-list .tags a { color: var(--accent); text-decoration: none; }
.journal-list .tags a:hover { text-decoration: underline; }
.journal-list .date a { color: var(--fg); text-decoration: none; }
.journal-list .date a:hover { color: var(--accent); }
.meta { color: var(--muted); font-size: .82rem; }

/* Blog: clean reading layout */
.blog-list { max-width: 760px; display: grid; gap: 0; }
.blog-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.blog-row h2 { margin: 0 0 3px; font-size: 1.15rem; letter-spacing: -.02em; }
.blog-row h2 a { color: var(--fg); text-decoration: none; }
.blog-row h2 a:hover { color: var(--accent); }
.blog-row .tools { display: flex; align-items: center; gap: 10px; flex: none; font-size: .82rem; }
.blog-row .meta { margin: 0; }
.post { max-width: 720px; }
.post .body { line-height: 1.75; }
.library-detail { max-width: 760px; }
.library-detail h2 { margin: 24px 0 8px; font-size: 1rem; }
.library-detail .body { white-space: pre-wrap; }
.library-detail .cover { max-width: 150px; border-radius: 8px; float: right; margin: 0 0 14px 18px; }
.quotes { padding-left: 20px; color: var(--muted); }
.quotes li { margin: 6px 0; }
@media (max-width: 640px) {
  .library th:nth-child(3), .library td:nth-child(3) { display: none; }
  .blog-row { gap: 10px; }
  .blog-row .tools { flex-direction: column; align-items: flex-end; gap: 4px; }
  .library-detail .cover { float: none; display: block; margin: 0 0 14px; }
}

/* Header: logo + Projects dropdown only */
.topbar { grid-template-columns: 1fr auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: -.02em; }
.projects { position: relative; justify-self: end; }
.projects-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: .86rem; }
.projects-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 160px; padding: 6px 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.projects-menu[hidden] { display: none; }
.projects-menu a { display: block; padding: 7px 12px; color: var(--fg); text-decoration: none; white-space: nowrap; font-size: .86rem; }
.projects-menu a:hover { background: var(--bg); color: var(--accent); }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
.chevron { width: 13px; height: 13px; }

/* Search + New action at the right edge of the page title */
.page-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.search { position: relative; display: block; }
.search input { width: 190px; padding: 7px 9px 7px 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); font: inherit; font-size: .84rem; }
.search .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 15px; height: 15px; }
.button .icon { width: 15px; height: 15px; }
@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr auto; padding: 10px 12px; }
  .page-head { flex-wrap: wrap; }
  .page-tools { width: 100%; justify-content: flex-end; }
  .search { flex: 1; min-width: 120px; }
  .search input { width: 100%; }
}
