@font-face {
  font-family: "Newsreader";
  src: url(/assets/newsreader.woff2) format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url(/assets/newsreader-italic.woff2) format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f8f7f3;
  --fg: #1b1a18;
  --muted: #69655d;
  --faint: #9a958c;
  --rule: #e5e1d9;
  --line: #cdc8be;
  --code: #f0eee8;
  --serif: "Newsreader", ui-serif, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --fg: #e9e6df;
    --muted: #a29e96;
    --faint: #6f6b64;
    --rule: #262522;
    --line: #48453f;
    --code: #1b1a19;
  }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}
body { margin: 0; }
::selection { background: var(--fg); color: var(--bg); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.15s, color 0.15s;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: 680px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px 24px 40px;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

/* Header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 104px;
  font-size: 17px;
}
.top a { text-decoration: none; }
.top .me { font-weight: 500; letter-spacing: -0.005em; }
.top nav { display: flex; gap: 24px; }
.top nav a { color: var(--muted); }
.top nav a:hover, .top nav a[aria-current] { color: var(--fg); }

/* Home */
.home { padding-top: 10vh; }
.name {
  margin: 0 0 20px;
  font-size: 44px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.pages { margin: 48px 0 0; border-top: 1px solid var(--rule); }
.pages a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.pages a::after {
  content: "\2192";
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  color: var(--faint);
  transition: transform 0.15s, color 0.15s;
}
.pages a:hover::after { color: var(--fg); transform: translate(4px, -50%); }
.page { width: 120px; flex: none; font-size: 22px; }
.hint { color: var(--muted); }
.pages a:hover .hint { color: var(--fg); }
.muted { color: var(--muted); }

/* Work, projects, blog lists */
.title {
  margin: 0 0 56px;
  font-size: 44px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.entry { margin: 0 0 44px; }
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}
.entry h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.entry h2 a { text-decoration: none; }
.entry h2 a:hover { text-decoration: underline; text-decoration-color: currentColor; }
.when {
  flex: none;
  color: var(--faint);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.tag { margin-left: 4px; color: var(--muted); font-size: 17px; font-weight: 400; letter-spacing: 0; }
.desc { margin: 10px 0 0; text-wrap: pretty; }
.links { display: flex; gap: 18px; margin: 8px 0 0; font-size: 16px; color: var(--muted); }

/* Posts */
.post .title { margin-bottom: 48px; }
.post h2 { margin: 2.4em 0 0.6em; font-size: 26px; line-height: 1.25; font-weight: 500; letter-spacing: -0.01em; }
.post h3 { margin: 2em 0 0.5em; font-size: 21px; line-height: 1.3; font-weight: 500; }
.post p, .post ul, .post ol { margin: 0 0 1.15em; }
.post ul, .post ol { padding-left: 1.3em; }
.post li { margin: 0.3em 0; }
.post li::marker { color: var(--faint); }
.post strong { font-weight: 600; }
.post blockquote { margin: 1.5em 0; padding-left: 1em; border-left: 2px solid var(--rule); color: var(--muted); }
.post hr { margin: 3em 0; border: 0; border-top: 1px solid var(--rule); }
.post img, .post video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border-radius: 6px;
}
.post audio { display: block; width: 100%; margin: 1.5em 0; }
.post table { width: 100%; margin: 1.5em 0; border-collapse: collapse; font-size: 16px; }
.post th, .post td { padding: 6px 10px; border-bottom: 1px solid var(--rule); text-align: left; }

code { font-family: var(--mono); }
:not(pre) > code {
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: var(--code);
  font-size: 0.82em;
  overflow-wrap: break-word;
}
pre {
  margin: 1.6em 0;
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--code) !important;
  font-size: 14px;
  line-height: 1.6;
  tab-size: 4;
}
.shiki span { color: var(--shiki-light); }
@media (prefers-color-scheme: dark) {
  .shiki span { color: var(--shiki-dark); }
}

.katex { font-size: 1.06em; }
.katex-display { margin: 1.5em 0; padding: 0.3em 0; overflow-x: auto; overflow-y: hidden; }

/* Footer */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 16px;
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }
.foot span { display: flex; gap: 20px; }

@media (max-width: 600px) {
  html { font-size: 17px; }
  .wrap { padding: 24px 20px 32px; }
  .top { margin-bottom: 72px; font-size: 16px; }
  .top nav { gap: 16px; }
  .home { padding-top: 6vh; }
  .name, .title { font-size: 34px; }
  .pages { margin-top: 36px; }
  .page { width: 96px; font-size: 20px; }
  .hint { font-size: 16px; }
  .entry-head { flex-wrap: wrap; row-gap: 0; }
  .tag { display: block; margin: 0; font-size: 16px; }
  .entry h2 { font-size: 19px; }
  .post h2 { font-size: 23px; }
  pre { margin-left: -20px; margin-right: -20px; border-radius: 0; padding: 14px 20px; font-size: 13px; }
  .foot { flex-direction: column; gap: 8px; margin-top: 72px; }
}
