/* Same tokens as github-markdown-css so the chrome and .markdown-body never clash */
:root {
  --fg: #1f2328;
  --muted: #59636e;
  --accent: #0969da;
  --border: #d1d9e0;
  --bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #f0f6fc;
    --muted: #9198a1;
    --accent: #4493f8;
    --border: #3d444d;
    --bg: #0d1117;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: auto;
}

a:hover {
  opacity: 0.75;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

hr.dashed {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.site-title {
  font-weight: bold;
  color: var(--fg);
  text-decoration: none;
}

.site-nav a {
  margin-left: 16px;
}

.site-nav a:first-child {
  margin-left: 0;
}

.main {
  min-height: 40vh;
}

/* Home / archive post list */
.home {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.post-list-wrap {
  flex: 2;
  min-width: 0;
}

.year-group {
  position: relative;
  margin-top: 40px;
}

.year-group:first-child {
  margin-top: 0;
}

.year-watermark {
  position: absolute;
  top: -0.15em;
  left: -0.03em;
  z-index: 0;
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  opacity: 0.12;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.post-list {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 3px 0;
}

.post-date {
  flex: 0 0 auto;
  width: 3.5em;
  color: var(--muted);
}

.post-title {
  color: var(--accent);
  font-size: 1.2em;
}

.bio {
  flex: 1;
  min-width: 220px;
  color: var(--muted);
}

.bio p {
  margin: 0 0 1em;
}

.avatar {
  display: block;
  width: 100%;
  max-width: 220px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

@media (max-width: 640px) {
  .home {
    flex-direction: column-reverse;
    gap: 24px;
  }
}

.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  color: var(--muted);
}

/* Post / page */
.page-title {
  color: var(--fg);
  font-size: 1.4em;
  margin: 0 0 4px;
}

.post-meta {
  color: var(--muted);
  margin-bottom: 24px;
}

.post-back {
  margin-top: 32px;
}

.post-back a + a {
  margin-left: 16px;
}

.markdown-body {
  font-size: 15px;
}

.site-footer {
  color: var(--muted);
  font-size: 0.9em;
}

/* CC license line at the bottom of each post */
.post-license {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.9em;
}

.post-license a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
}

.post-license a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* License link in the footer: subtle, matches the dashed aesthetic */
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.site-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.links-toggle {
  display: inline-block;
  position: relative;
  margin-left: 16px;
  vertical-align: baseline;
}

.links-toggle summary {
  cursor: pointer;
  color: var(--muted);
}

.links-toggle summary::marker,
.links-toggle summary::-webkit-details-marker {
  content: none;
  display: none;
}

.links-toggle summary::before {
  content: '+ ';
}

.links-toggle[open] summary::before {
  content: '– ';
}

.links-toggle summary:hover {
  color: var(--accent);
}

.links-list {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 160px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.links-hint {
  color: var(--muted);
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--border);
}

/* Any "page" with 2+ h2 sections: TOC. On wide viewports it floats in the left
   gutter (position: fixed, outside .container) so it never squeezes
   .markdown-body's width; on narrower screens it just wraps above the content. */
.page-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
  font-size: 0.85em;
}

.page-toc a {
  color: var(--muted);
  text-decoration: none;
  line-height: 1.5;
}

/* h3 entries are indented under their h2 section */
.page-toc a.toc-lv-3 {
  padding-left: 16px;
  font-size: 0.92em;
}

@media (min-width: 1300px) {
  .page-toc {
    position: fixed;
    top: 80px;
    left: 24px;
    width: 200px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 0;
    padding: 0 16px 0 0;
    border-bottom: none;
    border-right: 1px dashed var(--border);
  }

  .page-toc a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 640px) {
  .page-toc {
    display: none;
  }
}

