/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Variables */
:root {
  --text: #1a1a1a;
  --text-secondary: #555;
  --bg: #fafaf9;
  --bg-surface: #fff;
  --bg-code: #f3f4f6;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: #eff6ff;
  --max-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e5e5e5;
    --text-secondary: #a0a0a0;
    --bg: #0a0a0a;
    --bg-surface: #141414;
    --bg-code: #1c1c1c;
    --border: #2a2a2a;
    --border-light: #1e1e1e;
    --accent: #60a5fa;
    --accent-hover: #93bbfd;
    --accent-subtle: #172033;
  }
}

/* Base */
html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding: 0 1.5rem;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Header */
header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 450;
  position: relative;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Footer */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-link {
  color: var(--text-secondary);
  font-weight: 450;
}

.footer-link:hover {
  color: var(--text);
}

/* Headings */
h1 {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}

h2 {
  font-size: 1.4rem;
  line-height: 1.3;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.4;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Post list */
.post-list {
  list-style: none;
  margin-top: 1.25rem;
}

.post-list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-light);
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list .post-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.post-list time {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 5.5rem;
}

.post-list a {
  font-weight: 500;
  color: var(--text);
}

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

.post-description {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 0.3rem;
  line-height: 1.5;
}

/* Home */
.home-intro {
  margin-bottom: 3rem;
}

.home-intro p {
  font-family: "Lora", Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text-secondary);
  font-weight: 500;
  font-style: italic;
}

.home h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0;
}

/* Article */
.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.article-header h1 {
  font-size: 2.1rem;
  margin-bottom: 0.75rem;
}

.article-meta {
  color: var(--text-secondary);
  font-size: 0.88rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.article-meta .separator {
  color: var(--border);
}

.tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-weight: 500;
}

.article-tldr {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  border-left: 2px solid var(--border);
  padding: 0.6rem 1.2rem;
  margin-bottom: 2.5rem;
}

.article-tldr strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 0.3rem;
}

/* Article content */
.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content li::marker {
  color: var(--text-secondary);
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  color: var(--text-secondary);
  margin: 2rem 0;
  font-style: italic;
  background: var(--bg-surface);
  border-radius: 0 6px 6px 0;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.article-content strong {
  font-weight: 600;
}

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.35rem;
  font-size: 0.92rem;
}

.article-content th,
.article-content td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border: 1px solid var(--border);
}

.article-content th {
  background: var(--bg-code);
  font-weight: 600;
}

/* Code */
code {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--bg-code);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--bg-code);
  padding: 1.15rem 1.35rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.35rem;
  line-height: 1.55;
  border: 1px solid var(--border-light);
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.84rem;
  border-radius: 0;
}

/* Error page */
.error-page {
  text-align: center;
  padding: 6rem 0;
}

.error-page h1 {
  font-size: 5rem;
  color: var(--border);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.error-page p {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 600px) {
  html { font-size: 16px; }

  h1 { font-size: 1.65rem; }
  .article-header h1 { font-size: 1.75rem; }

  header { padding: 1.5rem 0 1rem; }

  .post-list .post-row {
    flex-direction: column;
    gap: 0.1rem;
  }

  .home-intro p {
    font-size: 1.02rem;
  }

  .post-description {
    padding-left: 0;
  }
}

/* Syntax highlighting - Chroma (github light / github-dark) */
/* Background */ .bg { background-color: var(--bg-code); }
/* PreWrapper */ .chroma { background-color: var(--bg-code); }
/* Other */ .chroma .x {  }
/* Error */ .chroma .err { color: #a61717; background-color: #e3d2d2 }
/* CodeLine */ .chroma .cl {  }
/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #e5e5e5 }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #000000; font-weight: normal }
/* KeywordConstant */ .chroma .kc { color: #000000; font-weight: normal }
/* KeywordDeclaration */ .chroma .kd { color: #000000; font-weight: normal }
/* KeywordNamespace */ .chroma .kn { color: #000000; font-weight: normal }
/* KeywordPseudo */ .chroma .kp { color: #000000; font-weight: normal }
/* KeywordReserved */ .chroma .kr { color: #000000; font-weight: normal }
/* KeywordType */ .chroma .kt { color: #445588; font-weight: normal }
/* Name */ .chroma .n {  }
/* NameAttribute */ .chroma .na { color: #008080 }
/* NameBuiltin */ .chroma .nb { color: #0086b3 }
/* NameBuiltinPseudo */ .chroma .bp { color: #999999 }
/* NameClass */ .chroma .nc { color: #445588; font-weight: normal }
/* NameConstant */ .chroma .no { color: #008080 }
/* NameDecorator */ .chroma .nd { color: #3c5d5d; font-weight: normal }
/* NameEntity */ .chroma .ni { color: #800080 }
/* NameException */ .chroma .ne { color: #990000; font-weight: normal }
/* NameFunction */ .chroma .nf { color: #990000; font-weight: normal }
/* NameFunctionMagic */ .chroma .fm {  }
/* NameLabel */ .chroma .nl { color: #990000; font-weight: normal }
/* NameNamespace */ .chroma .nn { color: #555555 }
/* NameOther */ .chroma .nx {  }
/* NameProperty */ .chroma .py {  }
/* NameTag */ .chroma .nt { color: #000080 }
/* NameVariable */ .chroma .nv { color: #008080 }
/* NameVariableClass */ .chroma .vc { color: #008080 }
/* NameVariableGlobal */ .chroma .vg { color: #008080 }
/* NameVariableInstance */ .chroma .vi { color: #008080 }
/* NameVariableMagic */ .chroma .vm {  }
/* Literal */ .chroma .l {  }
/* LiteralDate */ .chroma .ld {  }
/* LiteralString */ .chroma .s { color: #dd1144 }
/* LiteralStringAffix */ .chroma .sa { color: #dd1144 }
/* LiteralStringBacktick */ .chroma .sb { color: #dd1144 }
/* LiteralStringChar */ .chroma .sc { color: #dd1144 }
/* LiteralStringDelimiter */ .chroma .dl { color: #dd1144 }
/* LiteralStringDoc */ .chroma .sd { color: #dd1144 }
/* LiteralStringDouble */ .chroma .s2 { color: #dd1144 }
/* LiteralStringEscape */ .chroma .se { color: #dd1144 }
/* LiteralStringHeredoc */ .chroma .sh { color: #dd1144 }
/* LiteralStringInterpol */ .chroma .si { color: #dd1144 }
/* LiteralStringOther */ .chroma .sx { color: #dd1144 }
/* LiteralStringRegex */ .chroma .sr { color: #009926 }
/* LiteralStringSingle */ .chroma .s1 { color: #dd1144 }
/* LiteralStringSymbol */ .chroma .ss { color: #990073 }
/* LiteralNumber */ .chroma .m { color: #009999 }
/* LiteralNumberBin */ .chroma .mb { color: #009999 }
/* LiteralNumberFloat */ .chroma .mf { color: #009999 }
/* LiteralNumberHex */ .chroma .mh { color: #009999 }
/* LiteralNumberInteger */ .chroma .mi { color: #009999 }
/* LiteralNumberIntegerLong */ .chroma .il { color: #009999 }
/* LiteralNumberOct */ .chroma .mo { color: #009999 }
/* Operator */ .chroma .o { color: #000000; font-weight: normal }
/* OperatorWord */ .chroma .ow { color: #000000; font-weight: normal }
/* Punctuation */ .chroma .p {  }
/* Comment */ .chroma .c { color: #999988; font-style: italic }
/* CommentHashbang */ .chroma .ch { color: #999988; font-style: italic }
/* CommentMultiline */ .chroma .cm { color: #999988; font-style: italic }
/* CommentSingle */ .chroma .c1 { color: #999988; font-style: italic }
/* CommentSpecial */ .chroma .cs { color: #999999; font-weight: normal; font-style: italic }
/* CommentPreproc */ .chroma .cp { color: #999999; font-weight: normal; font-style: italic }
/* CommentPreprocFile */ .chroma .cpf { color: #999999; font-weight: normal; font-style: italic }
/* Generic */ .chroma .g {  }
/* GenericDeleted */ .chroma .gd { color: #000000; background-color: #ffdddd }
/* GenericEmph */ .chroma .ge { color: #000000; font-style: italic }
/* GenericError */ .chroma .gr { color: #aa0000 }
/* GenericHeading */ .chroma .gh { color: #999999 }
/* GenericInserted */ .chroma .gi { color: #000000; background-color: #ddffdd }
/* GenericOutput */ .chroma .go { color: #888888 }
/* GenericPrompt */ .chroma .gp { color: #555555 }
/* GenericStrong */ .chroma .gs { font-weight: normal }
/* GenericSubheading */ .chroma .gu { color: #aaaaaa }
/* GenericTraceback */ .chroma .gt { color: #aa0000 }
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
/* TextWhitespace */ .chroma .w { color: #bbbbbb }

@media (prefers-color-scheme: dark) {
  /* Background */ .bg { color: #e6edf3; background-color: var(--bg-code); }
  /* PreWrapper */ .chroma { color: #e6edf3; background-color: var(--bg-code); }
  /* Other */ .chroma .x {  }
  /* Error */ .chroma .err { color: #f85149 }
  /* CodeLine */ .chroma .cl {  }
  /* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
  /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
  /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
  /* LineHighlight */ .chroma .hl { color: #6e7681 }
  /* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #737679 }
  /* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #6e7681 }
  /* Line */ .chroma .line { display: flex; }
  /* Keyword */ .chroma .k { color: #ff7b72 }
  /* KeywordConstant */ .chroma .kc { color: #79c0ff }
  /* KeywordDeclaration */ .chroma .kd { color: #ff7b72 }
  /* KeywordNamespace */ .chroma .kn { color: #ff7b72 }
  /* KeywordPseudo */ .chroma .kp { color: #79c0ff }
  /* KeywordReserved */ .chroma .kr { color: #ff7b72 }
  /* KeywordType */ .chroma .kt { color: #ff7b72 }
  /* Name */ .chroma .n {  }
  /* NameAttribute */ .chroma .na {  }
  /* NameBuiltin */ .chroma .nb {  }
  /* NameBuiltinPseudo */ .chroma .bp {  }
  /* NameClass */ .chroma .nc { color: #f0883e; font-weight: normal }
  /* NameConstant */ .chroma .no { color: #79c0ff; font-weight: normal }
  /* NameDecorator */ .chroma .nd { color: #d2a8ff; font-weight: normal }
  /* NameEntity */ .chroma .ni { color: #ffa657 }
  /* NameException */ .chroma .ne { color: #f0883e; font-weight: normal }
  /* NameFunction */ .chroma .nf { color: #d2a8ff; font-weight: normal }
  /* NameFunctionMagic */ .chroma .fm {  }
  /* NameLabel */ .chroma .nl { color: #79c0ff; font-weight: normal }
  /* NameNamespace */ .chroma .nn { color: #79c0ff }
  /* NameOther */ .chroma .nx {  }
  /* NameProperty */ .chroma .py { color: #79c0ff }
  /* NameTag */ .chroma .nt { color: #7ee787 }
  /* NameVariable */ .chroma .nv { color: #79c0ff }
  /* NameVariableClass */ .chroma .vc {  }
  /* NameVariableGlobal */ .chroma .vg {  }
  /* NameVariableInstance */ .chroma .vi {  }
  /* NameVariableMagic */ .chroma .vm {  }
  /* Literal */ .chroma .l { color: #a5d6ff }
  /* LiteralDate */ .chroma .ld { color: #79c0ff }
  /* LiteralString */ .chroma .s { color: #a5d6ff }
  /* LiteralStringAffix */ .chroma .sa { color: #79c0ff }
  /* LiteralStringBacktick */ .chroma .sb { color: #a5d6ff }
  /* LiteralStringChar */ .chroma .sc { color: #a5d6ff }
  /* LiteralStringDelimiter */ .chroma .dl { color: #79c0ff }
  /* LiteralStringDoc */ .chroma .sd { color: #a5d6ff }
  /* LiteralStringDouble */ .chroma .s2 { color: #a5d6ff }
  /* LiteralStringEscape */ .chroma .se { color: #79c0ff }
  /* LiteralStringHeredoc */ .chroma .sh { color: #79c0ff }
  /* LiteralStringInterpol */ .chroma .si { color: #a5d6ff }
  /* LiteralStringOther */ .chroma .sx { color: #a5d6ff }
  /* LiteralStringRegex */ .chroma .sr { color: #79c0ff }
  /* LiteralStringSingle */ .chroma .s1 { color: #a5d6ff }
  /* LiteralStringSymbol */ .chroma .ss { color: #a5d6ff }
  /* LiteralNumber */ .chroma .m { color: #a5d6ff }
  /* LiteralNumberBin */ .chroma .mb { color: #a5d6ff }
  /* LiteralNumberFloat */ .chroma .mf { color: #a5d6ff }
  /* LiteralNumberHex */ .chroma .mh { color: #a5d6ff }
  /* LiteralNumberInteger */ .chroma .mi { color: #a5d6ff }
  /* LiteralNumberIntegerLong */ .chroma .il { color: #a5d6ff }
  /* LiteralNumberOct */ .chroma .mo { color: #a5d6ff }
  /* Operator */ .chroma .o { color: #ff7b72; font-weight: normal }
  /* OperatorWord */ .chroma .ow { color: #ff7b72; font-weight: normal }
  /* Punctuation */ .chroma .p {  }
  /* Comment */ .chroma .c { color: #8b949e; font-style: italic }
  /* CommentHashbang */ .chroma .ch { color: #8b949e; font-style: italic }
  /* CommentMultiline */ .chroma .cm { color: #8b949e; font-style: italic }
  /* CommentSingle */ .chroma .c1 { color: #8b949e; font-style: italic }
  /* CommentSpecial */ .chroma .cs { color: #8b949e; font-weight: normal; font-style: italic }
  /* CommentPreproc */ .chroma .cp { color: #8b949e; font-weight: normal; font-style: italic }
  /* CommentPreprocFile */ .chroma .cpf { color: #8b949e; font-weight: normal; font-style: italic }
  /* Generic */ .chroma .g {  }
  /* GenericDeleted */ .chroma .gd { color: #ffa198; background-color: #490202 }
  /* GenericEmph */ .chroma .ge { font-style: italic }
  /* GenericError */ .chroma .gr { color: #ffa198 }
  /* GenericHeading */ .chroma .gh { color: #79c0ff; font-weight: normal }
  /* GenericInserted */ .chroma .gi { color: #56d364; background-color: #0f5323 }
  /* GenericOutput */ .chroma .go { color: #8b949e }
  /* GenericPrompt */ .chroma .gp { color: #8b949e }
  /* GenericStrong */ .chroma .gs { font-weight: normal }
  /* GenericSubheading */ .chroma .gu { color: #79c0ff }
  /* GenericTraceback */ .chroma .gt { color: #ff7b72 }
  /* GenericUnderline */ .chroma .gl { text-decoration: underline }
  /* TextWhitespace */ .chroma .w { color: #6e7681 }
}
