:root {
  --background: #f7f6f1;
  --text: #2b312c;
  --heading: #1f271f;
  --link: #2f6f4f;
  --link-hover: #24553d;
  --rule: #d7ddd2;
  --muted: #5b675b;
  --card: #fffdf7;
  --code-bg: #f1efe6;
  --code-border: #ddd6c8;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}

.site-header,
.page-main,
.home-main,
.site-footer {
  width: min(100% - 48px, 900px);
  margin-left: auto;
  margin-right: auto;
}

.site-header {
  margin-top: 36px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.site-title {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 380px;
  color: var(--heading);
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  text-decoration: none;
}

.site-title:hover {
  color: var(--heading);
}

.site-tagline {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 20px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}

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

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

.page-main {
  padding-top: 20px;
  padding-bottom: 72px;
}

.page-main h1 {
  margin: 0 0 18px;
  color: var(--heading);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
}

.page-main h2 {
  margin: 36px 0 12px;
  color: var(--heading);
  font-size: 23px;
  line-height: 1.25;
  font-weight: 800;
}

.page-main h3 {
  margin: 28px 0 8px;
  color: var(--heading);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 800;
}

.page-main > h1,
.page-main > h2 {
  text-align: center;
}

.page-main > p {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

p {
  margin: 0 0 22px;
}

ol,
ul {
  margin-top: 0;
  margin-bottom: 24px;
  padding-left: 28px;
}

li {
  margin-bottom: 2px;
}

/* Blog list */

.post-list {
  max-width: 760px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.post-list > li {
  margin-bottom: 18px;
  padding: 1.05rem 1.15rem 1.15rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--card);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.post-list > li:hover {
  border-color: #c5d0c1;
  box-shadow: 0 10px 24px rgb(31 39 31 / 7%);
  transform: translateY(-1px);
}

.post-list h2 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
}

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

.post-list h2 a:hover {
  color: var(--link);
  text-decoration: underline;
}

.post-summary {
  margin: 10px 0 14px;
  color: var(--text);
}

.post-list .post-meta {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0;
}

/* Project list */

.project-list {
  max-width: 760px;
  margin: 0 auto 32px;
  padding: 0;
  list-style: none;
}

.project-list > li {
  margin-bottom: 18px;
  padding: 1.05rem 1.15rem 1.15rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--card);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.project-list > li:hover {
  border-color: #c5d0c1;
  box-shadow: 0 10px 24px rgb(31 39 31 / 7%);
  transform: translateY(-1px);
}

.project-list h3 {
  margin: 0 0 6px;
  font-size: 21px;
  line-height: 1.25;
}

.project-list h3 a {
  color: var(--heading);
  text-decoration: none;
}

.project-list h3 a:hover {
  color: var(--link);
  text-decoration: underline;
}

.project-list p {
  margin: 0 0 14px;
  color: var(--text);
}

/* Blog post */

.post {
  max-width: none;
}

.post-header {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 36px;
}

.post-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.post-nav-left {
  text-align: left;
}

.post-nav-center {
  text-align: center;
}

.post-nav-right {
  text-align: right;
}

.post-navigation a {
  text-decoration: none;
}

.post-navigation a:hover {
  text-decoration: underline;
}

.post-header h1 {
  margin: 0 0 10px;
}

.post-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.post-taxonomy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.post-categories,
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-categories li,
.post-tags li {
  margin: 0;
}

.post-tags a,
.tag-cloud a {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 0;
  border-radius: 999px;
  background: #f1f3ec;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
}

.post-categories li {
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #f1f3ec;
  font-size: 13px;
  line-height: 1.3;
}

.post-categories li {
  color: var(--heading);
  font-weight: 600;
}

.post-tags li,
.post-tags a {
  color: var(--muted);
}

.post-tags a:hover,
.tag-cloud a:hover,
.tag-cloud a[aria-current="true"] {
  color: var(--link-hover);
  background: #e8efe6;
}

/* Tag index */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto 22px;
  padding: 0;
  list-style: none;
}

.tag-cloud li {
  margin: 0;
}

.tag-results-count {
  color: var(--muted);
  font-size: 14px;
}

.tag-results [hidden] {
  display: none;
}

.item-type {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.post-content {
  font-size: 17px;
  line-height: 1.75;
}

.post-content > p,
.post-content > ul,
.post-content > ol,
.post-content > blockquote,
.post-content > h2,
.post-content > h3,
.post-content > h4,
.post-content > h5,
.post-content > h6 {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.post-content h2 {
  margin-top: 38px;
}

.post-content h3 {
  margin-top: 28px;
}

.post-content p {
  margin-bottom: 20px;
}

.post-content img,
.blog-post img,
article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.75rem auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 10px 24px rgb(31 39 31 / 6%);
}

/* Code */

.post-content :not(pre) > code,
.page-main :not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 0.1em 0.3em;
  white-space: normal;
}

.post-content .highlight,
.page-main .highlight {
  max-width: 720px;
  margin: 1.5rem auto;
}

.post-content .highlight pre,
.page-main .highlight pre,
.post-content pre,
.page-main pre {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  padding: 1rem;
  border-radius: 8px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  line-height: 1.55;
}

.post-content .highlight code,
.page-main .highlight code,
.post-content pre code,
.page-main pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
}

/* Rouge syntax highlighting */

.highlight .c,
.highlight .c1,
.highlight .cm {
  color: #5b675b;
  font-style: italic;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp {
  color: #4f5f2f;
  font-weight: 700;
}

.highlight .s,
.highlight .s1,
.highlight .s2 {
  color: #6f5628;
}

.highlight .m,
.highlight .mi,
.highlight .mf {
  color: #7a4f2a;
}

.highlight .nt {
  color: #2f6f4f;
  font-weight: 700;
}

.highlight .na {
  color: #5c6f38;
}

.highlight .nb,
.highlight .nc,
.highlight .nf {
  color: #24553d;
  font-weight: 600;
}

/* Homepage */

.home-main {
  padding-top: 72px;
  padding-bottom: 96px;
}

.home-hero {
  display: block;
}

.home-top {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 48px;
  margin-bottom: 40px;
}

.home-portrait {
  width: 220px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 10% 1%;
  border-radius: 5%;
  filter: grayscale(100%);
}

.home-intro {
  max-width: 760px;
  margin: 0 auto;
}

.home-top h1 {
  margin: 0;
  color: var(--heading);
  font-size: 4.35rem;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
}

.home-intro p {
  margin: 0 0 18px;
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.7;
}

/* Footer */

.site-footer {
  margin-top: 3rem;
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--rule);
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Mobile */

@media (max-width: 900px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .home-main {
    padding-top: 56px;
  }

  .home-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 32px;
  }

  .home-portrait {
    width: min(100%, 340px);
    align-self: center;
  }

  .home-top h1 {
    font-size: 3.7rem;
  }
}

@media (max-width: 640px) {
  .site-header,
  .page-main,
  .home-main,
  .site-footer {
    width: min(100% - 32px, 760px);
  }

  .site-header {
    margin-top: 28px;
  }

  .site-title {
    font-size: 21px;
  }

  .site-nav {
    font-size: 15px;
    gap: 6px 14px;
  }

  .page-main h1 {
    font-size: 28px;
  }

  .post-list h2,
  .project-list h3 {
    font-size: 20px;
  }

  .home-top h1 {
    font-size: 3rem;
  }

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