:root {
  --bg: #0a0b0d;
  --bg2: #0f1013;
  --line: #1e2126;
  --fg: #dcdde1;
  --muted: #7c838d;
  --acc: #8ee0a8;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* ---------- essays layout ---------- */
.wrap { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }

aside {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 28px 22px;
  font-family: var(--mono); font-size: 13px;
  display: flex; flex-direction: column;
}
aside .brand { color: var(--fg); font-weight: 600; display: block; margin-bottom: 28px; }
aside .label { color: var(--muted); text-transform: lowercase; margin-bottom: 10px; }
aside nav { display: flex; flex-direction: column; gap: 4px; }
aside nav a {
  display: block; padding: 8px 10px; margin: 0 -10px;
  color: var(--fg); border-radius: 6px; line-height: 1.4;
}
aside nav a small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
aside nav a:hover { background: var(--bg2); text-decoration: none; }
aside nav a.on { background: var(--bg2); color: var(--acc); }
aside .links { margin-top: auto; padding-top: 28px; display: flex; gap: 16px; }
aside .links a { color: var(--muted); }
aside .links a:hover { color: var(--acc); }

main { padding: 56px 64px 96px; max-width: 760px; }
article h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
article time { display: block; color: var(--muted); font-family: var(--mono); font-size: 13px; margin-bottom: 40px; }
article h2 { font-size: 1.3rem; margin: 2.2em 0 0.6em; line-height: 1.3; }
article h3 { font-size: 1.1rem; margin: 1.8em 0 0.5em; }
article p { margin: 0 0 1.2em; }
article ul, article ol { padding-left: 1.4em; margin: 0 0 1.2em; }
article li { margin-bottom: 0.4em; }
article blockquote { margin: 1.4em 0; padding-left: 1em; border-left: 2px solid var(--line); color: var(--muted); }
article code { font-family: var(--mono); font-size: 0.9em; background: var(--bg2); padding: 2px 5px; border-radius: 4px; }
article pre { background: var(--bg2); border: 1px solid var(--line); padding: 14px 16px; border-radius: 8px; overflow-x: auto; }
article pre code { background: none; padding: 0; }
article img { max-width: 100%; height: auto; border-radius: 6px; }
article hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
article strong { color: #fff; }

/* footnotes */
sup.fn { font-size: 0.7em; line-height: 0; margin-left: 1px; }
sup.fn a { color: var(--acc); padding: 0 1px; }
sup.fn a:hover { text-decoration: none; background: var(--bg2); border-radius: 3px; }
.notes { margin-top: 3.5em; padding-top: 1.5em; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--muted); }
.notes h2 { font-size: 0.85rem; font-family: var(--mono); text-transform: lowercase; color: var(--muted); margin: 0 0 1em; }
.notes ol { padding-left: 1.6em; }
.notes li { margin-bottom: 0.6em; }
.notes li:target, sup.fn:target a { background: rgba(142, 224, 168, 0.12); border-radius: 3px; }
.notes a.back { color: var(--muted); margin-left: 4px; }
.notes a.back:hover { color: var(--acc); text-decoration: none; }

@media (max-width: 760px) {
  .wrap { grid-template-columns: 1fr; }
  aside { position: static; height: auto; max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  aside .links { margin-top: 20px; padding-top: 0; }
  main { padding: 32px 20px 72px; }
  article h1 { font-size: 1.6rem; }
}

/* ---------- home ---------- */
.intro { max-width: 560px; margin: 0 auto; padding: 18vh 24px 80px; }
.intro h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.intro .cur { color: var(--acc); animation: blink 1.1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.intro .about { color: var(--muted); margin: 0 0 56px; }
.intro h2 { font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--muted); margin: 0 0 10px; }
.intro .essays { list-style: none; padding: 0; margin: 0 0 56px; }
.intro .essays li { display: flex; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.intro .essays li:last-child { border-bottom: 1px solid var(--line); }
.intro .essays a { color: var(--fg); }
.intro .essays a:hover { color: var(--acc); text-decoration: none; }
.intro .essays small { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.intro .links { font-family: var(--mono); font-size: 13px; display: flex; gap: 18px; margin: 0; }
.intro .links a { color: var(--muted); }
.intro .links a:hover { color: var(--acc); }
@media (max-width: 760px) { .intro { padding-top: 10vh; } }

/* ---------- admin ---------- */
body.admin { font-family: var(--mono); font-size: 14px; }
.box { max-width: 820px; margin: 0 auto; padding: 48px 24px; }
.box.narrow { max-width: 360px; padding-top: 25vh; }
.box header { display: flex; gap: 6px; align-items: baseline; margin-bottom: 32px; }
.box header .inline { margin-left: auto; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li a { color: var(--fg); }
.list li small { color: var(--muted); margin-left: auto; white-space: nowrap; }
input, textarea, button {
  font: inherit; color: var(--fg); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--acc); }
.login { display: flex; flex-direction: column; gap: 10px; }
.editor { display: flex; flex-direction: column; gap: 12px; }
.editor .row { display: flex; gap: 12px; align-items: center; }
.editor textarea { min-height: 60vh; line-height: 1.6; resize: vertical; tab-size: 2; }
.editor code { color: var(--muted); }
.btn, button.btn, button {
  cursor: pointer; background: var(--acc); color: #0a0b0d; border-color: var(--acc);
  display: inline-block; padding: 8px 14px; border-radius: 6px; font-weight: 600;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
button.link { background: none; border: 0; color: var(--muted); padding: 0; font-weight: 400; cursor: pointer; }
button.link:hover { color: var(--acc); }
button.link.danger:hover { color: #e07070; }
.err { color: #e07070; margin: 0; }
.editor .small, .muted.small { font-size: 12px; }
