/* ------------------------------------------------------------------
   mies — a less-is-more theme for Hexo
   zero JavaScript · system fonts · automatic dark mode
   ------------------------------------------------------------------ */

:root {
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #86868b;
  --faint: #e8e8ed;
  --code-bg: #f5f5f7;
  --accent: #0866c4;

  --hl-comment: #9a9aa2;
  --hl-keyword: #0550ae;
  --hl-string: #116329;
  --hl-number: #953800;
  --hl-title: #6639ba;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --fg: #d6d6d9;
    --muted: #86868e;
    --faint: #29292e;
    --code-bg: #1b1b20;
    --accent: #58a6ff;

    --hl-comment: #6e7681;
    --hl-keyword: #79b8ff;
    --hl-string: #7ee787;
    --hl-number: #ffab70;
    --hl-title: #d2a8ff;
  }
}

/* ---------- base ---------- */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.75;
}

.container {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  color: var(--accent);
}

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

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  padding: 3rem 0 0.5rem;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.site-nav a:hover {
  color: var(--fg);
}

/* ---------- home post list ---------- */

.post-list {
  margin-top: 1.5rem;
}

.post-item {
  margin: 2.4rem 0;
}

.post-item h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.post-item h2 a {
  color: var(--fg);
  text-decoration: none;
}

.post-item h2 a:hover {
  color: var(--accent);
}

.post-item time {
  color: var(--muted);
  font-size: 0.85rem;
}

.post-item .excerpt {
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

.post-item .excerpt > :first-child {
  margin-top: 0;
}

.post-item .excerpt > :last-child {
  margin-bottom: 0;
}

/* ---------- post ---------- */

.post-header {
  margin: 3rem 0 2rem;
}

.post-title {
  margin: 0 0 0.5rem;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.post-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.post-meta a {
  color: var(--muted);
  text-decoration: none;
}

.post-meta a:hover {
  color: var(--fg);
}

.post-meta .sep {
  margin: 0 0.35rem;
}

.post-tags {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.post-tags a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
}

.post-tags a:hover {
  color: var(--accent);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
  font-size: 0.92rem;
}

.post-nav a {
  color: var(--fg);
  text-decoration: none;
  max-width: 46%;
}

.post-nav a:hover {
  color: var(--accent);
}

.post-nav .next {
  text-align: right;
  margin-left: auto;
}

.post-nav .label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- content (prose) ---------- */

.prose {
  line-height: 1.8;
}

.prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin: 2.2rem 0 0.8rem;
}

.prose h1 {
  font-size: 1.45rem;
}

.prose h2 {
  font-size: 1.25rem;
}

.prose h3 {
  font-size: 1.1rem;
}

.prose h4 {
  font-size: 1rem;
}

.prose p {
  margin: 1rem 0;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--faint);
  color: var(--muted);
}

.prose blockquote p {
  margin: 0.5rem 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.prose li {
  margin: 0.3rem 0;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.prose hr {
  margin: 2.5rem auto;
  border: 0;
  border-top: 1px solid var(--faint);
  width: 100%;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.5rem 0;
}

.prose th,
.prose td {
  padding: 0.45rem 0.9rem 0.45rem 0;
  border-bottom: 1px solid var(--faint);
  text-align: left;
}

.prose th {
  font-weight: 600;
}

/* ---------- code ---------- */

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre {
  font-family: var(--mono);
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.85rem;
}

pre code {
  background: none;
  padding: 0;
  font-size: 1em;
  border-radius: 0;
}

/* hexo highlight.js output */
figure.highlight {
  margin: 1.5rem 0;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.85rem;
}

figure.highlight table {
  margin: 0;
  border-collapse: collapse;
}

figure.highlight td {
  border: none;
  padding: 0;
}

figure.highlight pre {
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  overflow: visible;
  font-size: 1em;
}

figure.highlight .gutter pre {
  color: var(--muted);
  text-align: right;
  padding-right: 1rem;
  user-select: none;
}

figure.highlight figcaption {
  color: var(--muted);
  font-size: 0.85em;
  margin-bottom: 0.5em;
}

figure.highlight figcaption a {
  color: var(--muted);
}

.highlight .comment,
.highlight .quote {
  color: var(--hl-comment);
  font-style: italic;
}

.highlight .keyword,
.highlight .built_in,
.highlight .selector-tag,
.highlight .tag .name {
  color: var(--hl-keyword);
}

.highlight .string,
.highlight .regexp,
.highlight .addition,
.highlight .attribute,
.highlight .meta .string {
  color: var(--hl-string);
}

.highlight .number,
.highlight .literal,
.highlight .symbol,
.highlight .bullet,
.highlight .deletion {
  color: var(--hl-number);
}

.highlight .title,
.highlight .section,
.highlight .attr,
.highlight .type {
  color: var(--hl-title);
}

/* ---------- archive ---------- */

.archive-year {
  margin: 2.4rem 0 0.8rem;
  font-size: 1.1rem;
  font-weight: 650;
}

.archive-item {
  display: flex;
  gap: 1.2rem;
  padding: 0.28rem 0;
}

.archive-item time {
  flex: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: inherit;
}

.archive-item a {
  color: var(--fg);
  text-decoration: none;
}

.archive-item a:hover {
  color: var(--accent);
}

/* ---------- tags page ---------- */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  margin: 1.5rem 0;
}

.tag-item {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
}

.tag-item:hover {
  color: var(--accent);
}

.tag-item .count {
  color: var(--muted);
  font-size: 0.8em;
  margin-left: 0.25em;
  vertical-align: super;
}

/* ---------- pagination ---------- */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 3.5rem 0 0;
  font-size: 0.92rem;
}

.pagination a {
  color: var(--fg);
  text-decoration: none;
}

.pagination a:hover {
  color: var(--accent);
}

.pagination .page-number {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin-top: 5rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--fg);
}

.site-footer .social a {
  margin-left: 1rem;
  text-decoration: none;
}

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

/* ---------- small screens ---------- */

@media (max-width: 32rem) {
  .container {
    padding: 0 1.25rem;
  }

  .site-header {
    padding-top: 2rem;
  }

  .post-header {
    margin-top: 2.2rem;
  }

  .post-title {
    font-size: 1.45rem;
  }
}
