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

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f4f4f4;
  --text: #171717;
  --muted: #666666;
  --faint: #8f8f8f;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --accent: #171717;
  --accent-fg: #fafafa;
  --header-bg: rgba(250, 250, 250, 0.86);
  --max: 920px;
  --read: 720px;
  --pad: clamp(20px, 4vw, 32px);
  --radius: 8px;
  --font: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface-hover: #161616;
    --text: #ededed;
    --muted: #a1a1a1;
    --faint: #6b6b6b;
    --border: #1f1f1f;
    --border-strong: #2e2e2e;
    --accent: #ededed;
    --accent-fg: #0a0a0a;
    --header-bg: rgba(10, 10, 10, 0.82);
    color-scheme: dark;
  }
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

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

img {
  display: block;
  max-width: 100%;
}

.main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  height: 56px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 max(var(--pad), calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  text-align: left;
}

.site-header > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-title {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-description {
  display: none;
}

.site-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.menu-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.menu {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.menu:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}

.theme-switcher {
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.theme-switcher-button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.theme-switcher-button:hover,
.theme-switcher-button:focus-visible,
.theme-switcher.is-open .theme-switcher-button {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
  outline: none;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 132px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 10px 28px color-mix(in srgb, #000 14%, transparent);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.theme-switcher.is-open .theme-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-menu-item {
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.theme-menu-item:hover,
.theme-menu-item:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  outline: none;
}

.theme-menu-item i {
  visibility: hidden;
  color: var(--text);
  font-size: 10px;
}

.theme-menu-item.active i {
  visibility: visible;
}

.post-list-container,
.post-container {
  width: 100%;
  flex: 1;
}

.post-inner {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin: 0 auto;
  padding: clamp(18px, 4vw, 34px) 0 0;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  min-height: 112px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.post-card:first-child {
  border-top: 0;
}

.post-card:hover {
  background: transparent;
}

.post-left {
  min-width: 0;
}

.post-title {
  color: var(--text);
  font-size: 22px;
  font-weight: 560;
  line-height: 1.32;
  letter-spacing: 0;
}

.post-card:hover .post-title,
.post-nav-item:hover strong,
.archive-item:hover strong,
.tag-item:hover {
  color: var(--muted);
}

.sticky-top-flag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-right: 8px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  vertical-align: 2px;
}

.post-abstract {
  display: block;
  max-width: 68ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.post-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 13px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.post-tag {
  margin-left: 0;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
}

.post-feature-image {
  width: 144px;
  height: 86px;
  flex: 0 0 144px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
}

.pagination-container {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  padding: 26px 0 58px;
}

.prev-page,
.next-page {
  display: inline-flex;
  align-items: center;
  height: 34px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.prev-page:hover,
.next-page:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.post-container {
  padding: clamp(34px, 7vw, 72px) 0 0;
}

.post-detail {
  width: min(var(--read), calc(100% - 2 * var(--pad)));
  margin: 0 auto;
}

.post-detail > .post-title {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 560;
  line-height: 1.12;
}

.post-detail > .post-info {
  margin-top: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.post-content {
  margin-top: 34px;
}

.gt-post-content {
  word-break: normal;
  overflow-wrap: break-word;
}

.gt-post-content p,
.gt-post-content li {
  margin-bottom: 18px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.88;
}

.gt-post-content a {
  color: var(--text);
  border-bottom: 1px solid var(--border-strong);
}

.gt-post-content a:hover {
  border-color: var(--text);
}

.gt-post-content img {
  width: auto;
  max-width: min(100%, 620px);
  max-height: 720px;
  margin: 28px auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  object-fit: contain;
}

.gt-post-content blockquote {
  margin: 20px 0 26px;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
}

.gt-post-content blockquote p {
  margin-bottom: 0;
  color: inherit;
}

.gt-post-content hr {
  height: 1px;
  margin: 34px 0;
  border: 0;
  background: var(--border);
}

.gt-post-content ul,
.gt-post-content ol {
  padding-left: 22px;
  margin-bottom: 18px;
}

.gt-post-content h1,
.gt-post-content h2,
.gt-post-content h3,
.gt-post-content h4,
.gt-post-content h5,
.gt-post-content h6 {
  margin: 34px 0 14px;
  color: var(--text);
  font-weight: 560;
  line-height: 1.25;
}

.gt-post-content h1 { font-size: 28px; }
.gt-post-content h2 { font-size: 24px; }
.gt-post-content h3 { font-size: 20px; }
.gt-post-content h4 { font-size: 18px; }
.gt-post-content h5 { font-size: 16px; }
.gt-post-content h6 { font-size: 14px; }

.gt-post-content code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 13px;
}

.gt-post-content pre code {
  display: block;
  width: 100%;
  overflow: auto;
  padding: 16px;
  background: var(--surface);
  line-height: 1.6;
}

.post-nav {
  width: min(var(--read), calc(100% - 2 * var(--pad)));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 34px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.post-nav-item {
  min-height: 72px;
}

.post-nav-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 12px;
}

.post-nav-item strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.55;
}

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

.archive-container,
.tags-container,
.empty,
.memos-container {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 48px) 0 80px;
}

.archive-container h2,
.tags-container h2,
.list-title,
.list-heading h2 {
  margin: 0 0 22px;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 560;
  line-height: 1.12;
}

.list-heading {
  width: 100%;
  margin: 0 0 26px;
  padding-bottom: 0;
  border-bottom: 0;
}

.list-heading p {
  margin-top: -12px;
  color: var(--muted);
  font-size: 14px;
}

.archive-year {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 28px;
  padding: 0;
}

.archive-year + .archive-year {
  margin-top: 28px;
}

.archive-year-head {
  position: sticky;
  top: 76px;
  align-self: start;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 12px;
}

.archive-year h3 {
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 560;
  line-height: 1;
}

.archive-year-head span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.archive-year-list {
  min-width: 0;
  border-top: 0;
}

.archive-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
  align-items: baseline;
  min-height: 48px;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.archive-item + .archive-item {
  padding-top: 12px;
}

.archive-item span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.archive-item strong {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-item {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.tag-item span {
  color: var(--faint);
}

.memo-timeline {
  position: relative;
  display: grid;
  gap: 18px;
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.memo-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 22px;
  padding: 0 0 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.memo-date {
  position: sticky;
  top: 76px;
  align-self: start;
  padding-top: 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
}

.memo-body {
  min-width: 0;
  padding: 18px 0 0;
}

.memo-meta {
  margin-bottom: 10px;
}

.memo-meta span {
  display: inline-flex;
  height: 22px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
}

.memo-content p,
.memo-content li {
  margin-bottom: 12px;
  color: var(--text);
}

.memo-content img {
  width: min(100%, 560px);
  max-height: 680px;
  margin: 18px 0 0;
}

.memo-content p:last-child,
.memo-content ul:last-child,
.memo-content ol:last-child,
.memo-content blockquote:last-child,
.memo-content pre:last-child {
  margin-bottom: 0;
}

.memo-empty {
  padding: 18px 0;
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: auto auto 0;
  padding: 32px 0 42px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
}

.social-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.social-container a {
  color: var(--muted);
  font-size: 14px;
}

.footer-info,
.footer-info a {
  color: var(--faint);
}

@media (max-width: 720px) {
  .site-header {
    height: auto;
    min-height: 56px;
    grid-template-columns: auto minmax(0, 1fr);
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .site-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .menu-container {
    min-width: 0;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .menu {
    flex: 0 0 auto;
  }

  .post-card {
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: 0;
    padding: 22px 0;
  }

  .post-feature-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .post-title {
    font-size: 19px;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

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

  .archive-year,
  .memo-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .archive-year + .archive-year {
    margin-top: 22px;
  }

  .archive-year-head,
  .memo-date {
    position: static;
    top: auto;
  }

  .archive-year-head {
    padding-top: 0;
  }

  .archive-year-list {
    border-top: 0;
  }

  .archive-item {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
    min-height: 44px;
    padding: 11px 0;
  }

  .memo-card {
    padding-bottom: 20px;
  }

  .memo-date {
    padding-top: 0;
  }

  .memo-body {
    padding-top: 0;
  }

  .site-footer {
    display: grid;
    justify-items: start;
  }
}

@media (max-width: 460px) {
  :root {
    --pad: 18px;
  }

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

  .menu {
    padding: 0 8px;
    font-size: 12px;
  }

  .gt-post-content p,
  .gt-post-content li {
    font-size: 15px;
  }
}
