@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@200&display=swap");

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #000000;
  --muted: #777777;
  --soft: #a0a0a0;
  --line: #e9e9e9;
  --line-strong: #dddddd;
  --panel: #fafafa;
  --max: 1760px;
  --gutter: clamp(24px, 3.3vw, 64px);
  --font:
    system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  font-family: var(--font);
  font-weight: 300;
  letter-spacing: 0;
  text-rendering: auto;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

html.has-lightbox,
html.has-lightbox body {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(28px, 4vw, 66px);
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 42px var(--gutter) 0;
}

.brand {
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}

.site-nav {
  display: flex;
  gap: clamp(28px, 3.1vw, 48px);
  align-items: center;
}

.nav-link {
  position: relative;
  padding: 0 0 12px;
  font-size: 13px;
  font-weight: 400;
  line-height: 19.5px;
  letter-spacing: 0.7px;
}

.nav-link::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: scaleX(0.7);
  transform-origin: center;
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-link:hover::after,
.nav-link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.lang-muted,
.divider {
  color: #a5a5a5;
}

.theme-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  margin-left: 10px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.theme-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.page-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding-right: var(--gutter);
  padding-left: var(--gutter);
}

.home-hero {
  padding-top: clamp(78px, 8.7vw, 140px);
  padding-bottom: clamp(64px, 8.7vw, 138px);
}

.sync-note {
  margin: 0 0 30px;
  color: var(--soft);
  font-size: 14px;
  font-weight: 300;
}

.home-hero h1,
.blog-hero h1,
.about h1,
.post-header h1 {
  margin: 0;
  font-weight: 300;
}

.home-hero h1 {
  max-width: 1180px;
  font-size: 32px;
  line-height: 48px;
}

.hero-copy {
  max-width: 1180px;
  margin: 19px 0 0;
  color: #000000;
  font-size: 16px;
  font-weight: 300;
  line-height: 24px;
}

.latest,
.blog-index {
  padding-bottom: 96px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 64px;
}

.section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.section-subtitle {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.8;
}

.all-posts-link {
  padding-bottom: 7px;
  border-bottom: 1px solid currentColor;
  font-size: 17px;
  font-weight: 400;
  white-space: nowrap;
}

.article-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.article-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(120px, auto);
  gap: 56px;
  align-items: baseline;
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
}

.article-row[data-hidden="true"] {
  display: none;
}

.article-date {
  color: rgba(0, 0, 0, 0.8);
  font-size: 14px;
  font-weight: 300;
  line-height: 21px;
}

.article-title {
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
}

.article-title a {
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.article-title a:hover {
  text-decoration-line: underline;
}

.article-category {
  color: rgba(0, 0, 0, 0.8);
  font-size: 14px;
  font-weight: 300;
  line-height: 21px;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.empty-state {
  margin: 0;
  padding: 32px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.filter-status {
  margin: -22px 0 28px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
}

.is-hidden {
  display: none;
}

.blog-hero,
.about {
  padding-top: clamp(84px, 8.7vw, 140px);
}

.blog-hero {
  padding-bottom: clamp(58px, 6.7vw, 103px);
}

.blog-hero h1,
.about h1 {
  font-size: 32px;
  line-height: 48px;
}

.blog-hero p,
.about p {
  max-width: 1180px;
  margin: 19px 0 0;
  color: #000000;
  font-size: 16px;
  font-weight: 300;
  line-height: 24px;
}

.about {
  max-width: 1080px;
  padding-bottom: 120px;
}

.site-footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(36px, 5.2vw, 96px);
  padding-top: 76px;
  padding-bottom: 72px;
}

.footer-column {
  display: grid;
  align-content: start;
  gap: 13px;
}

.footer-column h2 {
  margin: 0 0 10px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.footer-column a {
  width: fit-content;
  font-size: 14px;
  font-weight: 300;
  line-height: 21px;
}

.footer-column a:hover {
  text-decoration-line: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.footer-blog a {
  max-width: 360px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 50px;
}

.filter {
  display: grid;
  gap: 12px;
}

.filter span {
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

select {
  width: 100%;
  min-height: 54px;
  padding: 0 48px 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background:
    linear-gradient(45deg, transparent 50%, #222222 50%) right 23px center /
      7px 7px no-repeat,
    linear-gradient(135deg, #222222 50%, transparent 50%) right 18px center /
      7px 7px no-repeat,
    #ffffff;
  color: var(--ink);
  appearance: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.post {
  max-width: var(--max);
  padding-top: clamp(96px, 10vw, 150px);
  padding-bottom: 112px;
}

.post-header {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 820px) minmax(0, 1fr);
  gap: clamp(32px, 4vw, 72px);
  padding-bottom: 80px;
}

.post-header-inner {
  grid-column: 2;
}

.post-category {
  display: inline-block;
  margin-bottom: 30px;
  color: rgba(0, 0, 0, 0.6);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.post-header h1 {
  font-family: "Noto Serif SC", "Songti SC", STSong, serif;
  font-size: 40px;
  font-weight: 200;
  line-height: 50px;
  letter-spacing: -1px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 300;
  line-height: 21px;
}

.post-header p {
  max-width: 830px;
  margin: 30px 0 0;
  color: rgba(0, 0, 0, 0.8);
  font-size: 17px;
  font-weight: 300;
  line-height: 27.2px;
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 820px) minmax(180px, 1fr);
  gap: clamp(32px, 4vw, 72px);
  align-items: start;
}

.post-layout.is-toc-hidden {
  grid-template-columns: minmax(180px, 1fr) minmax(0, 820px) minmax(180px, 1fr);
}

.post-toc-shell {
  position: sticky;
  top: 72px;
  display: grid;
  justify-items: start;
  gap: 20px;
  align-self: start;
}

.toc-toggle {
  display: inline-grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f4f4f4;
  color: rgba(0, 0, 0, 0.62);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.toc-toggle span {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.toc-toggle span::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 5px;
  width: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.toc-toggle:hover {
  background: #eeeeee;
  color: #000000;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.post-toc {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 0 0 16px;
}

.post-layout.is-toc-hidden .post-toc,
.post-layout.is-toc-hidden .toc-empty {
  display: none;
}

.post-layout.is-toc-hidden .toc-toggle {
  color: rgba(0, 0, 0, 0.62);
}

.toc-link {
  color: rgba(0, 0, 0, 0.5);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.toc-link.is-active {
  color: #000000;
  font-weight: 500;
}

.toc-level-3 {
  padding-left: 12px;
}

.toc-empty {
  margin: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.post-body {
  max-width: 820px;
  padding-top: 0;
  color: rgba(0, 0, 0, 0.8);
  font-size: 17px;
  font-weight: 300;
  line-height: 27.2px;
}

.post-body :target {
  scroll-margin-top: 96px;
}

.post-body h2,
.post-body h3 {
  margin: 56px 0 18px;
  color: #000000;
  font-size: 22px;
  font-weight: 400;
  line-height: 36px;
  letter-spacing: 0.6px;
}

.post-body h2 {
  font-size: 22px;
}

.post-body h3 {
  font-size: 22px;
}

.post-body p {
  margin: 0 0 27.2px;
}

.post-body ul,
.post-body ol {
  margin: 0 0 27.2px;
  padding-left: 1.3em;
}

.post-body li {
  margin: 0 0 8px;
}

.post-body a {
  border-bottom: 1px solid var(--line-strong);
}

.image-zoom {
  position: relative;
  display: block;
  max-width: 100%;
  margin: 2em 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-zoom::after {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  color: #000000;
  content: "⌕";
  font-size: 22px;
  line-height: 1;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.image-zoom:hover::after,
.image-zoom:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.image-zoom img {
  display: block;
  max-width: 100%;
  height: auto;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 48px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox img {
  max-width: min(100%, 1280px);
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.18);
  cursor: grab;
  touch-action: none;
  transform-origin: center center;
  transition: transform 80ms linear;
  user-select: none;
  -webkit-user-drag: none;
}

.image-lightbox img.is-dragging {
  cursor: grabbing;
  transition: none;
}

.lightbox-close {
  position: fixed;
  top: 28px;
  right: 32px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000000;
  cursor: pointer;
  font-size: 32px;
  font-weight: 300;
  line-height: 36px;
}

.post-body blockquote {
  margin: 0 0 27.2px;
  padding: 0 0 0 24px;
  color: rgba(0, 0, 0, 0.72);
  border-left: 1px solid var(--line-strong);
}

.post-body blockquote p {
  margin-bottom: 10px;
}

.post-body code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.post-body pre {
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
}

@media (max-width: 760px) {
  :root {
    --gutter: 22px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    gap: 24px;
    padding-top: 28px;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 26px;
    overflow-x: auto;
  }

  .brand {
    font-size: 22px;
  }

  .nav-link {
    font-size: 13px;
  }

  .header-tools {
    font-size: 12px;
  }

  .home-hero {
    padding-top: 58px;
    padding-bottom: 59px;
  }

  .home-hero h1 {
    font-size: 32px;
    line-height: 48px;
  }

  .hero-copy {
    font-size: 16px;
    line-height: 24px;
  }

  .section-head {
    display: block;
    margin-bottom: 36px;
  }

  .all-posts-link {
    display: inline-block;
    margin-top: 28px;
  }

  .article-row {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 18px 0;
  }

  .article-date,
  .article-title {
    font-size: 14px;
  }

  .article-category {
    color: rgba(0, 0, 0, 0.8);
    font-size: 14px;
    text-align: left;
  }

  .blog-hero,
  .about {
    padding-top: 58px;
  }

  .blog-hero {
    padding-bottom: 45px;
  }

  .filters {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 38px;
  }

  .filter span {
    font-size: 14px;
  }

  .post {
    padding-top: 82px;
    padding-bottom: 80px;
  }

  .post-header {
    display: block;
    padding-bottom: 44px;
  }

  .post-category {
    margin-bottom: 22px;
  }

  .post-header h1 {
    font-size: 34px;
    line-height: 43px;
  }

  .post-layout {
    display: block;
  }

  .post-layout.is-toc-hidden {
    display: block;
  }

  .post-toc-shell {
    position: static;
    margin-bottom: 38px;
  }

  .post-toc {
    position: static;
    display: flex;
    gap: 18px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .post-layout.is-toc-hidden .toc-toggle {
    writing-mode: horizontal-tb;
  }

  .toc-level-3 {
    padding-left: 0;
  }

  .post-body {
    font-size: 17px;
    line-height: 27.2px;
  }

  .image-lightbox {
    padding: 22px;
  }

  .lightbox-close {
    top: 18px;
    right: 20px;
  }

  .site-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px 24px;
    padding-top: 54px;
    padding-bottom: 56px;
  }
}

@media (max-width: 520px) {
  .site-footer {
    grid-template-columns: 1fr;
  }
}
