/* Personal site. Plain, dense, readable. Modeled on Wikipedia / Hacker News density. */

:root {
  --text: #1a1a1a;
  --muted: #6a6a6a;
  --link: #0b57d0;
  --link-visited: #4b3fa3;
  --border: #d9d9d9;
  --border-light: #ebebeb;
  --bg: #fff;
  --bg-soft: #f6f6f6;
  --danger: #b3261e;
  --width: 880px;
  --text-width: 720px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

img { max-width: 100%; height: auto; }

.wrap {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 16px;
}

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

/* Header ------------------------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--text); }
.nav a:visited { color: var(--text); }
.nav .brand { font-weight: 700; }

.social { display: flex; align-items: center; gap: 4px; }
.social a {
  display: inline-flex;
  padding: 6px;
  color: var(--muted);
}
.social a:hover { color: var(--text); }
.social a:visited { color: var(--muted); }
.social svg { width: 18px; height: 18px; fill: currentColor; display: block; }

/* Sections ------------------------------------------------------------------ */

main { padding: 20px 16px 32px; flex: 1 0 auto; width: 100%; }

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
.page-title { font-size: 26px; margin: 4px 0 14px; }

section { margin-top: 28px; }
section > h2 {
  font-size: 19px;
  padding-bottom: 5px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.more { margin: 10px 0 0; }

/* Hero ---------------------------------------------------------------------- */

.hero {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 8px;
}
.avatar {
  width: 112px;
  height: 112px;
  flex: none;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}
.hero h1 { font-size: 26px; }
.alias { color: var(--muted); margin: 2px 0 8px; }
.bio { max-width: var(--text-width); }
.bio p { margin: 0 0 8px; }
.bio p:last-child { margin-bottom: 0; }

/* Projects ------------------------------------------------------------------ */

.projects { list-style: none; margin: 0; padding: 0; }
.projects li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.projects li:last-child { border-bottom: 0; }
.project-name { font-weight: 600; }
.project-desc { margin-left: 6px; }
.project-src { margin-left: 6px; color: var(--muted); font-size: 14px; }

/* Article cards --------------------------------------------------------------- */

.cards { display: flex; flex-direction: column; }
.card {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.card:last-child { border-bottom: 0; }
.card:hover { text-decoration: none; }
.card:hover .card-title { text-decoration: underline; }
.card:visited { color: var(--text); }
.card-img {
  width: 160px;
  height: 100px;
  flex: none;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg-soft);
}
.card-noimg { border: 1px solid var(--border-light); }
.card-body { display: flex; flex-direction: column; min-width: 0; }
.card-title { font-weight: 600; color: var(--link); }
.card-desc { margin-top: 2px; }
.card-date { margin-top: auto; padding-top: 4px; color: var(--muted); font-size: 14px; }

/* Article page ------------------------------------------------------------------ */

.post { max-width: var(--text-width); }
.post h1 { font-size: 30px; margin-bottom: 4px; }
.post-meta { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.post-updated { margin-left: 2px; }
.post-cover { display: block; width: 100%; max-height: 400px; object-fit: cover; margin-bottom: 18px; border-radius: 2px; }

.post-body { font-size: 17px; line-height: 1.6; }
.post-body > :first-child { margin-top: 0; }
.post-body h2 { font-size: 23px; margin: 30px 0 10px; }
.post-body h3 { font-size: 19px; margin: 24px 0 8px; }
.post-body h4 { font-size: 17px; margin: 20px 0 6px; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote { margin: 0 0 14px; }
.post-body li { margin: 3px 0; }
.post-body img { display: block; margin: 16px auto; border-radius: 2px; }
.post-body figure { margin: 16px 0; }
.post-body figcaption { color: var(--muted); font-size: 14px; text-align: center; }
.post-body blockquote {
  margin-left: 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border);
  color: #3a3a3a;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-soft);
  padding: 1px 4px;
  border-radius: 2px;
}
.post-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 2px;
}
.post-body pre code { background: none; padding: 0; font-size: inherit; }
.post-body table { border-collapse: collapse; margin: 0 0 14px; font-size: 15px; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.post-body th { background: var(--bg-soft); }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.post-body a { text-decoration: underline; }

/* Footer ------------------------------------------------------------------------ */

.site-footer {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 8px 0 10px;
  font-size: 14px;
  color: var(--muted);
}
.footer-title { margin: 0 0 2px; font-weight: 600; color: var(--text); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-copy { margin: 6px 0 0; }

/* Admin ----------------------------------------------------------------------------- */

.admin .site-header { background: var(--bg-soft); }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; }
.row-head + .row-head, .table + .row-head, .muted + .row-head { margin-top: 32px; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.table th { font-weight: 600; border-bottom: 1px solid var(--border); }
.table td:first-child, .table th:first-child { padding-left: 0; }

.form { display: flex; flex-direction: column; gap: 12px; max-width: var(--text-width); }
.form-narrow { max-width: 440px; }
.form > button { align-self: flex-start; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 15px; }
.form label .muted { font-weight: 400; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
.form input[type="text"], .form input:not([type]), .form input[type="password"], .form input[type="number"], .form textarea {
  font: inherit;
  font-weight: 400;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #fff;
  width: 100%;
}
.form textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.45; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: var(--link); }
.input-row { display: flex; align-items: center; gap: 10px; }
.input-row input { flex: 1; }

button, .button {
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--link);
  background: var(--link);
  color: #fff;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}
.button { display: inline-block; }
.button:hover, .button:visited { color: #fff; text-decoration: none; }
button.secondary { background: #fff; color: var(--text); border-color: var(--border); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--link); font-weight: 400; }
button.link:hover { text-decoration: underline; }
.error { color: var(--danger); margin: 0; }
.ok { color: #1a7f37; margin: 0 0 8px; }
.form h2 { font-size: 18px; margin: 12px 0 0; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.form h2:first-child { margin-top: 0; }
.section-title { font-size: 18px; margin: 32px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.social-table input, .social-table select { font: inherit; padding: 4px 6px; border: 1px solid var(--border); border-radius: 2px; width: 100%; background: #fff; }
.social-table input.narrow { width: 64px; }
.social-table .actions { white-space: nowrap; }
.social-table .actions form { display: inline; }
.danger-zone { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--border-light); }

/* Small screens --------------------------------------------------------------------- */

@media (max-width: 600px) {
  .hero { gap: 14px; }
  .avatar { width: 84px; height: 84px; }
  .hero h1 { font-size: 22px; }
  .card { gap: 10px; }
  .card-img { width: 104px; height: 70px; }
  .card-date { padding-top: 2px; }
  .post h1 { font-size: 25px; }
  .post-body { font-size: 16px; }
  .post-body h2 { font-size: 21px; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .social-table th:nth-child(3), .social-table td:nth-child(3) { display: table-cell; }
  .social-table th:nth-child(1), .social-table td:nth-child(1) { display: none; }
}
