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

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-secondary: #666666;
  --link: #1a1a1a;
  --link-underline: #999999;
  --border: #e5e5e5;
  --code-bg: #f6f8fa;
}

/* Light syntax highlighting */
:root .chroma { color: #24292e; background-color: #f6f8fa; }
:root .chroma .err { color: #a00; }
:root .chroma .k { color: #d73a49; }
:root .chroma .kc { color: #005cc5; }
:root .chroma .kd { color: #d73a49; }
:root .chroma .kn { color: #d73a49; }
:root .chroma .kp { color: #d73a49; }
:root .chroma .kr { color: #6f42c1; }
:root .chroma .kt { color: #005cc5; }
:root .chroma .na { color: #6f42c1; }
:root .chroma .nc { color: #6f42c1; }
:root .chroma .no { color: #e36209; }
:root .chroma .nd { color: #6f42c1; }
:root .chroma .ne { color: #6f42c1; }
:root .chroma .nf { color: #6f42c1; }
:root .chroma .nl { color: #e36209; }
:root .chroma .nt { color: #22863a; }
:root .chroma .nx { color: #24292e; }
:root .chroma .s { color: #032f62; }
:root .chroma .sa { color: #032f62; }
:root .chroma .sb { color: #032f62; }
:root .chroma .sc { color: #032f62; }
:root .chroma .sd { color: #032f62; }
:root .chroma .s2 { color: #032f62; }
:root .chroma .se { color: #005cc5; }
:root .chroma .sh { color: #032f62; }
:root .chroma .si { color: #032f62; }
:root .chroma .sr { color: #032f62; }
:root .chroma .ss { color: #005cc5; }
:root .chroma .m { color: #005cc5; }
:root .chroma .mb { color: #005cc5; }
:root .chroma .mf { color: #005cc5; }
:root .chroma .mh { color: #005cc5; }
:root .chroma .mi { color: #005cc5; }
:root .chroma .il { color: #005cc5; }
:root .chroma .mo { color: #005cc5; }
:root .chroma .o { color: #e36209; }
:root .chroma .ow { color: #d73a49; }
:root .chroma .c { color: #6a737d; }
:root .chroma .ch { color: #6a737d; }
:root .chroma .cm { color: #6a737d; }
:root .chroma .c1 { color: #6a737d; }
:root .chroma .cs { color: #6a737d; }
:root .chroma .cp { color: #6a737d; }
:root .chroma .cpf { color: #6a737d; }
:root .chroma .gd { color: #b31d28; }
:root .chroma .ge { font-style: italic; }
:root .chroma .gi { color: #22863a; }
:root .chroma .gs { font-weight: bold; }
:root .chroma .gu { color: #6a737d; }
:root .chroma .ln { color: #6a737d; }
:root .chroma .lnt { color: #6a737d; }

[data-theme="dark"] {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-secondary: #666666;
  --link: #1a1a1a;
  --link-underline: #999999;
  --border: #e5e5e5;
  --code-bg: #f5f5f5;
}

[data-theme="dark"] {
  --bg: #111111;
  --fg: #e5e5e5;
  --fg-secondary: #999999;
  --link: #e5e5e5;
  --link-underline: #666666;
  --border: #333333;
  --code-bg: #1a1a1a;
}

/* Dark syntax highlighting */
[data-theme="dark"] .chroma { color: #f8f8f2; background-color: #272822; }
[data-theme="dark"] .chroma .err { color: #960050; background-color: #1e0010; }
[data-theme="dark"] .chroma .k { color: #66d9ef; }
[data-theme="dark"] .chroma .kc { color: #66d9ef; }
[data-theme="dark"] .chroma .kd { color: #66d9ef; }
[data-theme="dark"] .chroma .kn { color: #f92672; }
[data-theme="dark"] .chroma .kp { color: #66d9ef; }
[data-theme="dark"] .chroma .kr { color: #66d9ef; }
[data-theme="dark"] .chroma .kt { color: #66d9ef; }
[data-theme="dark"] .chroma .na { color: #a6e22e; }
[data-theme="dark"] .chroma .nc { color: #a6e22e; }
[data-theme="dark"] .chroma .no { color: #66d9ef; }
[data-theme="dark"] .chroma .nd { color: #a6e22e; }
[data-theme="dark"] .chroma .ne { color: #a6e22e; }
[data-theme="dark"] .chroma .nf { color: #a6e22e; }
[data-theme="dark"] .chroma .nt { color: #f92672; }
[data-theme="dark"] .chroma .l { color: #ae81ff; }
[data-theme="dark"] .chroma .ld { color: #e6db74; }
[data-theme="dark"] .chroma .s { color: #e6db74; }
[data-theme="dark"] .chroma .sa { color: #e6db74; }
[data-theme="dark"] .chroma .sb { color: #e6db74; }
[data-theme="dark"] .chroma .sc { color: #e6db74; }
[data-theme="dark"] .chroma .dl { color: #e6db74; }
[data-theme="dark"] .chroma .sd { color: #e6db74; }
[data-theme="dark"] .chroma .s2 { color: #e6db74; }
[data-theme="dark"] .chroma .se { color: #ae81ff; }
[data-theme="dark"] .chroma .sh { color: #e6db74; }
[data-theme="dark"] .chroma .si { color: #e6db74; }
[data-theme="dark"] .chroma .sr { color: #e6db74; }
[data-theme="dark"] .chroma .s1 { color: #e6db74; }
[data-theme="dark"] .chroma .ss { color: #ae81ff; }
[data-theme="dark"] .chroma .m { color: #ae81ff; }
[data-theme="dark"] .chroma .mb { color: #ae81ff; }
[data-theme="dark"] .chroma .mf { color: #ae81ff; }
[data-theme="dark"] .chroma .mh { color: #ae81ff; }
[data-theme="dark"] .chroma .mi { color: #ae81ff; }
[data-theme="dark"] .chroma .il { color: #ae81ff; }
[data-theme="dark"] .chroma .mo { color: #ae81ff; }
[data-theme="dark"] .chroma .o { color: #f92672; }
[data-theme="dark"] .chroma .ow { color: #f92672; }
[data-theme="dark"] .chroma .c { color: #75715e; }
[data-theme="dark"] .chroma .ch { color: #75715e; }
[data-theme="dark"] .chroma .cm { color: #75715e; }
[data-theme="dark"] .chroma .c1 { color: #75715e; }
[data-theme="dark"] .chroma .cs { color: #75715e; }
[data-theme="dark"] .chroma .cp { color: #75715e; }
[data-theme="dark"] .chroma .cpf { color: #75715e; }
[data-theme="dark"] .chroma .gd { color: #f92672; }
[data-theme="dark"] .chroma .ge { font-style: italic; }
[data-theme="dark"] .chroma .gi { color: #a6e22e; }
[data-theme="dark"] .chroma .gs { font-weight: bold; }
[data-theme="dark"] .chroma .gu { color: #75715e; }

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
}

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

/* Header */
.site-header {
  padding: 2rem 0;
}

.site-header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-header .home {
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
}

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--fg);
  padding: 0;
}

/* Main */
main {
  padding-bottom: 3rem;
}

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.3;
  margin: 2rem 0 1rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; margin-top: 2.5rem; }
h3 { font-size: 1.1rem; }

p {
  margin: 1rem 0;
}

/* Intro */
.intro {
  margin-bottom: 2rem;
}

.intro p {
  font-size: 1.1rem;
}

/* Featured Post */
.featured {
  margin-bottom: 2.5rem;
}

.post-preview h3 {
  margin: 0 0 0.25rem;
}

.post-preview time {
  font-size: 0.85rem;
  color: var(--fg-secondary);
}

.post-preview p {
  margin-top: 0.5rem;
}

/* Archive */
.archive .year-list {
  list-style: none;
}

.archive .year-list > li {
  margin-bottom: 1.5rem;
}

.archive .year {
  font-weight: 500;
}

.post-list {
  list-style: none;
  margin-top: 0.5rem;
}

.post-list li {
  display: flex;
  gap: 1rem;
  padding: 0.25rem 0;
}

.post-list time {
  color: var(--fg-secondary);
  font-size: 0.9rem;
  min-width: 5rem;
}

/* Post */
.post header {
  margin-bottom: 2rem;
}

.post header h1 {
  margin-bottom: 0.5rem;
}

.post header time {
  color: var(--fg-secondary);
  font-size: 0.9rem;
}

.post .tags {
  margin-top: 0.75rem;
}

.post .tags a {
  margin-right: 0.75rem;
  font-size: 0.85rem;
  color: var(--fg-secondary);
}

.post .content {
  margin-top: 2rem;
}

.post .content p {
  margin: 1.25rem 0;
}

.post .content img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
}

.post .content pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.post .content code {
  background: var(--code-bg);
  padding: 0.15rem 0.3rem;
  font-size: 0.9rem;
}

.post .content pre code {
  background: none;
  padding: 0;
}

.post .content ul, .post .content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post .content li {
  margin: 0.5rem 0;
}

.post .content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--fg-secondary);
}

/* Search */
#search {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg-secondary);
  margin-bottom: 1.5rem;
}

#results {
  list-style: none;
  margin-bottom: 2rem;
}

#results li {
  margin-bottom: 1rem;
}

#results a {
  font-weight: 500;
}

/* Tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0;
  margin-top: 1rem;
}

.tag-list .sep {
  color: var(--fg-secondary);
  margin: 0 0.25rem;
}

/* Footer */
.site-footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--fg-secondary);
}

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

/* Responsive */
@media (max-width: 480px) {
  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .post-list time {
    min-width: auto;
  }
}
