/* werefin.io: terminal theme, dark only. No web fonts, no external assets */

:root {
  color-scheme: dark;
  --bg: #0a0e14;
  --bg-alt: #0f141c;
  --fg: #c7d0d9;
  --dim: #6f7c8a;
  --border: #1e2632;
  --green: #7ee787;
  --cyan: #79c0ff;
  --yellow: #e3b341;
  --red: #ff7b72;
  --magenta: #d2a8ff;
  --sel: #264f78;
  --code-bg: #0d1117;
}


*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-size: 17px;
  line-height: 1.65;
  max-width: 100ch;
  margin-inline: auto;
  padding: 0 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--sel); }

a { color: var(--cyan); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 1.5rem; margin: 0.4rem 0 0.8rem; color: var(--green); }

.dim { color: var(--dim); }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 8px;
  background: var(--bg-alt);
  padding: 4px 8px;
  z-index: 10;
}

/* top bar: the shell prompt + nav */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px 0 14px;
  border-bottom: 1px dashed var(--border);
}

.ps1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ps1:hover { text-decoration: none; }
.ps1 .u { color: var(--green); }
.ps1 .h { color: var(--green); }
.ps1 .p { color: var(--cyan); }
.ps1 .d { color: var(--fg); }

.topbar ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topbar nav a { color: var(--fg); }
.topbar nav a[aria-current="page"] { color: var(--yellow); }
.topbar nav a[aria-current="page"]::before { content: "> "; }


main { flex: 1; padding: 8px 0 32px; }

.block { margin: 28px 0; }

.cmd { margin: 0 0 8px; color: var(--fg); }

.err { color: var(--red); margin: 0 0 8px; }

/* home */

.hello {
  display: flex;
  gap: 20px;
  align-items: center;
}
.handle { margin: 0; font-size: 1.9rem; }
.handle .cursor { margin-left: 0; vertical-align: -0.12em; }
.tagline { margin: 4px 0 8px; }

/* ls -l style post list */

.ls {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.ls li {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 0 14px;
  padding: 3px 0;
}
.ls .perm { color: var(--dim); }
.ls time { color: var(--magenta); }
.ls .rt { color: var(--dim); text-align: right; min-width: 3ch; }

@media (max-width: 600px) {
  .ls .perm { display: none; }
  .ls li { grid-template-columns: auto 1fr auto; }
  .ls .rt { display: none; }
  .hello { flex-direction: column; align-items: flex-start; }
}



/* post */

.post-head { margin-bottom: 24px; border-bottom: 1px dashed var(--border); padding-bottom: 14px; }
.post-head h1 { font-size: 1.7rem; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin: 0 0 8px;
  color: var(--dim);
}
.draft { color: var(--red); font-weight: 700; }

.prose { overflow-wrap: break-word; }
.prose h1 { font-size: 1.6rem; }
.prose h2 { font-size: 1.2rem; color: var(--green); margin-top: 2rem; }
.prose h2::before { content: "## "; color: var(--dim); }
.prose h3 { font-size: 1.05rem; color: var(--cyan); margin-top: 1.6rem; }
.prose h3::before { content: "### "; color: var(--dim); }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 1rem; }
.prose ul { list-style: none; padding-left: 2ch; }
.prose ul > li::before { content: "- "; color: var(--green); margin-left: -2ch; }
.prose ul.contains-task-list > li::before { content: none; }
.prose ol { padding-left: 3ch; }
.prose li { margin: 2px 0; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--border); }
.prose hr { border: 0; border-top: 1px dashed var(--border); margin: 2rem 0; }
.prose blockquote {
  margin-left: 0;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--green);
  color: var(--dim);
}
.prose strong { color: var(--fg); }
.prose em { color: var(--yellow); font-style: italic; }

.prose code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 0.93em;
}
.prose pre {
  background: var(--code-bg);
  color: #e6edf3;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }

.prose table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.prose th { background: var(--bg-alt); }

.prose .footnotes { font-size: 0.9em; color: var(--dim); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 32px 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.pager .next { text-align: right; }

/* comments */
.comment { border-left: 2px solid var(--border); padding: 2px 0 2px 14px; margin: 0 0 16px; }
.comment-head { margin: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.comment-name { color: var(--green); font-weight: 700; }
.comment-name.anon { color: var(--dim); font-weight: 400; }
.comment-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.comment-form { display: grid; gap: 4px; max-width: 64ch; }
.comment-form label { margin-top: 8px; }
.comment-form input, .comment-form textarea {
  font: inherit;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 8px;
  width: 100%;
}
.comment-form textarea { resize: vertical; min-height: 6rem; }
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--green); outline: none; }
.comment-form p { margin: 6px 0 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ok { color: var(--green); }
.note { font-size: 0.9em; }
.err { color: var(--red); }

/* stats */

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 20px;
  margin: 16px 0;
}
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: var(--green); font-weight: 700; }

.table-wrap { overflow-x: auto; margin: 0 0 16px; }
.stats { border-collapse: collapse; width: 100%; }
.stats th, .stats td { padding: 4px 12px 4px 0; text-align: left; border-bottom: 1px dashed var(--border); }
.stats th { color: var(--dim); font-weight: 400; }
.stats .num { text-align: right; padding-right: 0; color: var(--green); }
.stats time { color: var(--magenta); white-space: nowrap; }

/* footer */

.footer {
  border-top: 1px dashed var(--border);
  padding: 14px 0 28px;
  font-size: 0.9em;
}
.footer p { margin: 2px 0; }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: text-bottom;
  background: var(--green);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

/* subscribe + buttons */

.sub { font-size: 1.1rem; color: var(--green); margin: 1.6rem 0 0.4rem; }
.sub::before { content: "## "; color: var(--dim); }
.feed-url {
  background: var(--code-bg);
  color: #e6edf3;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  overflow-x: auto;
  user-select: all;
}
.plain { list-style: none; padding: 0; margin: 0; }
.plain li::before { content: "-> "; color: var(--dim); }

.btn {
  font: inherit;
  color: var(--green);
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 10px;
  cursor: pointer;
}
.btn:hover { border-color: var(--green); }

/* dashboard */

.tabs { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; margin: 8px 0 16px; }
.tab[aria-pressed="true"] { border-color: var(--green); color: var(--yellow); }
.logout { margin-left: auto; }
.admin-list { list-style: none; padding: 0; margin: 0 0 16px; }
.admin-list li { display: grid; grid-template-columns: 11ch 1fr auto; gap: 12px; padding: 3px 0; align-items: baseline; }
.admin-list time { color: var(--magenta); }
.linklike {
  font: inherit;
  color: var(--cyan);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.linklike:hover { text-decoration: underline; }
.badge { font-size: 0.85em; padding: 0 6px; border: 1px solid var(--border); border-radius: 3px; }
.badge.draft { color: var(--yellow); }
.badge.live { color: var(--green); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.editor { border-top: 1px dashed var(--border); margin-top: 8px; }
.editor .fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; align-items: center; max-width: 72ch; }
.editor input, .editor textarea, .admin select {
  font: inherit;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 8px;
  width: 100%;
}
.editor input[type="checkbox"] { width: auto; }
.editor input:focus, .editor textarea:focus { border-color: var(--green); outline: none; }
.editor .check { display: flex; gap: 8px; align-items: center; }
.editor textarea { resize: vertical; min-height: 24rem; line-height: 1.5; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.split .label { margin: 0; }
.preview { border: 1px dashed var(--border); padding: 4px 14px; min-height: 24rem; max-height: 70vh; overflow: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin .comment .actions { margin-top: 6px; }

/* the dashboard needs room: widen the page and stack panes on small screens */
body:has(.admin) { max-width: 140ch; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .editor .fields { grid-template-columns: 1fr; }
  .admin-list li { grid-template-columns: 1fr auto; }
  .admin-list time { display: none; }
}
.mode { color: var(--yellow); border: 1px dashed var(--yellow); padding: 6px 10px; }

/* scale up on big screens; the page width follows, since it's measured in characters */
@media (min-width: 1200px) { body { font-size: 18px; } }
@media (min-width: 1600px) { body { font-size: 20px; } }
@media (max-width: 600px) { body { font-size: 15px; } }
.intro { margin: 0 0 8px; color: var(--dim); }
.lede { margin: -4px 0 12px; color: var(--fg); font-style: italic; opacity: 0.85; }
.blogname { margin: 0 0 8px; }
.blogname strong { color: var(--yellow); }

/* links inside sentences get a subtle underline, so they don't rely on color alone */
p a, li a, .prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
p a:hover, li a:hover, .prose a:hover { text-decoration-color: currentColor; }
.topbar a, .ls a, .ps1 { text-decoration: none; }

/* bigger tap targets on phones */
@media (max-width: 600px) {
  .topbar ul { gap: 2px 18px; }
  .topbar nav a, .footer a, .ls a, .pager a { display: inline-block; padding: 12px 0; }
}
