:root {
  --page-background: #ffffff;
  --panel-background: #ffffff;
  --text-color: #4d4d4d;
  --heading-color: #111111;
  --link-color: #2a2a2a;
  --link-border: #dfdfdf;
  --link-border-hover: #111111;
  --muted-color: #8c8c8c;
  --line-color: #efefef;
  --pill-border: #e4e4e4;
  --pill-hover-background: #111111;
  --pill-hover-color: #f2f2f2;
  --code-background: #f5f5f5;
  --pre-background: #fafafa;
  --pre-border: #ececec;
  --blockquote-border: #2f2f2f;
  --blockquote-color: #595959;
  --image-border: rgba(17, 17, 17, 0.08);
  --image-background: transparent;
  --image-shadow: 0 10px 28px rgba(17, 17, 17, 0.04);
  --photo-tile-background: transparent;
  --photo-tile-border: transparent;
  --photo-tile-shadow: none;
  --avatar-border: #f0f0f0;
  --theme-control-border: #dfdfdf;
  --theme-control-background: rgba(255, 255, 255, 0.92);
  --theme-control-text: #777777;
  --theme-control-active-background: #111111;
  --theme-control-active-text: #f2f2f2;
  --shadow: 0 8px 20px rgba(17, 17, 17, 0.04);
  --body-font: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", sans-serif;
}

html[data-theme="dark"] {
  --page-background: #111315;
  --panel-background: #171b1f;
  --text-color: #d2cdc5;
  --heading-color: #f2ede5;
  --link-color: #ece5dc;
  --link-border: #40454b;
  --link-border-hover: #f2ede5;
  --muted-color: #9c968d;
  --line-color: #2b3137;
  --pill-border: #353c43;
  --pill-hover-background: #f2ede5;
  --pill-hover-color: #111315;
  --code-background: #1a1f24;
  --pre-background: #171c20;
  --pre-border: #2c3239;
  --blockquote-border: #c9c2b8;
  --blockquote-color: #bcb6ae;
  --image-border: rgba(242, 237, 229, 0.12);
  --image-background: #171b1f;
  --image-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  --photo-tile-background: #171b1f;
  --photo-tile-border: rgba(242, 237, 229, 0.08);
  --photo-tile-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  --avatar-border: #2e353c;
  --theme-control-border: #3a424a;
  --theme-control-background: rgba(23, 27, 31, 0.92);
  --theme-control-text: #b7b1a8;
  --theme-control-active-background: #f2ede5;
  --theme-control-active-text: #111315;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

html {
  background: var(--page-background);
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  color: var(--text-color);
  background: var(--page-background);
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 2px solid var(--link-border);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

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

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 14px;
}

figure {
  margin: 1.4rem 0;
}

figcaption {
  margin-top: 0.65rem;
  color: var(--muted-color);
  font-size: 0.92rem;
  text-align: center;
}

blockquote {
  margin: 1.2rem 0;
  padding: 0 0 0 0.9rem;
  border-left: 3px solid var(--blockquote-border);
  color: var(--blockquote-color);
  font-size: 0.97em;
  line-height: 1.75;
}

pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--pre-border);
  border-radius: 14px;
  background: var(--pre-background);
}

code {
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: var(--code-background);
  font-size: 0.92em;
}

.wrapper,
.site-header,
.site-footer {
  padding-left: 20px;
  padding-right: 20px;
}

.site-header {
  position: relative;
  margin-top: 46px;
  margin-bottom: 40px;
  text-align: center;
}

.theme-menu {
  position: absolute;
  top: 0;
  right: 20px;
  z-index: 10;
  font-family: var(--ui-font);
}

.theme-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid var(--theme-control-border);
  border-radius: 999px;
  background: var(--theme-control-background);
  color: var(--theme-control-text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.theme-menu__trigger:hover {
  color: var(--heading-color);
}

.theme-menu__trigger:focus-visible {
  outline: 2px solid var(--heading-color);
  outline-offset: 2px;
}

.theme-menu__glyph::before {
  display: block;
  font-size: 1.05rem;
  line-height: 1;
  content: "◐";
}

html[data-theme-preference="light"] .theme-menu__glyph::before {
  content: "☼";
}

html[data-theme-preference="dark"] .theme-menu__glyph::before {
  content: "☾";
}

.theme-menu__panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 8rem;
  padding: 0.35rem;
  border: 1px solid var(--theme-control-border);
  border-radius: 14px;
  background: var(--theme-control-background);
  box-shadow: var(--shadow);
}

.theme-menu.is-open .theme-menu__panel {
  display: flex;
}

.theme-menu__panel[hidden] {
  display: none;
}

.theme-toggle__button {
  padding: 0.5rem 0.7rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--theme-control-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-align: left;
  cursor: pointer;
}

.theme-toggle__button:hover {
  color: var(--heading-color);
  background: rgba(127, 127, 127, 0.08);
}

.theme-toggle__button.is-active {
  background: var(--theme-control-active-background);
  color: var(--theme-control-active-text);
}

.theme-toggle__button:focus-visible {
  outline: 2px solid var(--heading-color);
  outline-offset: 2px;
}

.site-avatar-link {
  border-bottom: none;
}

.site-avatar {
  width: 80px;
  height: 80px;
  object-fit: cover;
  padding: 0;
  margin-bottom: 0.95rem;
  border: 1px solid var(--avatar-border);
  border-radius: 999px;
  box-shadow: none;
}

.site-title {
  border-bottom: none;
  color: var(--heading-color);
  font-family: var(--body-font);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-subtitle {
  margin: 0.55rem auto 0;
  max-width: 600px;
  color: var(--muted-color);
  font-family: var(--ui-font);
  font-size: 0.97rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.15rem 0 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  color: var(--muted-color);
  font-family: var(--ui-font);
  font-size: 0.88rem;
  font-weight: 600;
}

.site-nav a:hover {
  border-color: var(--heading-color);
  background: var(--pill-hover-background);
  color: var(--pill-hover-color);
}

.post-content img,
.post-content video,
.e-content img,
.e-content video {
  border: 1px solid var(--image-border);
  background: var(--image-background);
  box-shadow: var(--image-shadow);
}

.page,
.post-content,
.post-preview,
.post,
.archive,
.posts,
.pagination-links {
  max-width: 680px;
  margin: 0 auto;
}

.photos-page {
  max-width: 860px;
  margin: 0 auto;
}

.post-header,
.post-content,
.post-preview,
.archive-year,
.pagination-links,
.photos-grid,
.page {
  padding-left: 20px;
  padding-right: 20px;
}

.post-date,
.post-date-wrapper > time {
  border-bottom: none;
  color: var(--muted-color);
  font-family: var(--ui-font);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  opacity: 0.8;
  text-transform: uppercase;
}

.post-title {
  margin-top: 0.45rem;
  margin-bottom: 0.85rem;
  color: var(--heading-color);
  font-size: 1.95rem;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.post-title a {
  border-bottom: none;
}

.post-preview .post-title {
  font-size: 1.52rem;
  margin-bottom: 0.7rem;
}

.post-preview__summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.post-content p,
.e-content p {
  margin-top: 1em;
  margin-bottom: 1em;
}

.post-content ul,
.post-content ol,
.e-content ul,
.e-content ol {
  padding-left: 1.45rem;
}

.post-content li,
.e-content li {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.article-break {
  width: min(640px, calc(100% - 40px));
  height: 1px;
  margin: 2.2rem auto;
  border: none;
  background: var(--line-color);
}

.pagination-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  font-family: var(--ui-font);
}

.pagination-link {
  border-bottom: none;
  color: var(--muted-color);
  font-size: 0.92rem;
  font-weight: 600;
}

.pagination-link:hover {
  color: var(--heading-color);
}

.pagination-links.post-navigation {
  margin-top: 3rem;
}

.post-navigation__slot {
  flex: 1 1 0;
  min-width: 0;
}

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

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

.archive-year {
  margin-bottom: 2.8rem;
}

.archive-section {
  margin-bottom: 3.4rem;
}

.archive-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  margin: 0 0 2.05rem;
  padding-left: 20px;
  padding-right: 20px;
  font-family: var(--ui-font);
}

.archive-nav__label {
  margin-right: 0.15rem;
  color: var(--muted-color);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--muted-color);
  font-size: 0.9rem;
  font-weight: 600;
}

.archive-nav a:hover {
  color: var(--heading-color);
  border-color: var(--link-border-hover);
  background: transparent;
}

.archive-section__title {
  margin: 0 0 1.05rem;
  color: var(--heading-color);
  font-size: 1.4rem;
  line-height: 1.2;
}

.archive-year h3 {
  margin: 0 0 0.8rem;
  color: var(--heading-color);
  font-size: 1.15rem;
}

.archive-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-list li {
  margin: 0.7rem 0;
  color: var(--muted-color);
  font-family: var(--ui-font);
}

.archive-list time {
  display: inline-block;
  min-width: 10rem;
  margin-right: 0.75rem;
  color: var(--muted-color);
  font-size: 0.92rem;
}

.archive-kind {
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--panel-background);
  color: var(--muted-color);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.photos-grid {
  column-count: 3;
  column-gap: 10px;
}

.photos-grid__item {
  display: inline-block;
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--photo-tile-border);
  border-radius: 0;
  break-inside: avoid;
  background: var(--photo-tile-background);
  box-shadow: var(--photo-tile-shadow);
}

.photos-grid__item img {
  width: 100%;
  margin: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.photos-grid__caption {
  display: none;
}

.page-post--photo .post-content img,
.page-post--photo .e-content img {
  border-radius: 0;
  box-shadow: none;
  border: none;
  background: transparent;
}

.about-connect {
  margin-top: 2.2rem;
}

.about-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.4rem;
  margin: 0.75rem 0;
}

.about-line__label {
  display: inline-flex;
  align-items: center;
  color: var(--muted-color);
  font-family: var(--ui-font);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.about-line > a {
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.about-line--social {
  align-items: center;
}

.about-social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  min-width: 0;
}

.about-social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--link-color);
}

.about-social-link:hover {
  color: var(--heading-color);
}

.about-social-link__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  color: currentColor;
  opacity: 0.9;
}

.about-social-link__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.site-footer {
  margin-top: 5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-color);
  margin-bottom: 2rem;
  color: var(--muted-color);
  text-align: center;
}

.site-footer__note {
  max-width: 520px;
  margin: 0 auto;
  color: var(--muted-color);
  font-family: var(--ui-font);
  font-size: 0.9rem;
  line-height: 1.7;
}

.site-footer__note a {
  color: var(--muted-color);
  border-color: rgba(140, 140, 140, 0.28);
}

.site-footer__note a:hover {
  color: var(--heading-color);
  border-color: var(--link-border);
}

@media (max-width: 820px) {
  body {
    font-size: 17px;
  }

  .post-title {
    font-size: 1.7rem;
  }

  .post-preview .post-title {
    font-size: 1.38rem;
  }

  .photos-grid {
    column-count: 2;
  }

  .archive-list time {
    display: block;
    margin-bottom: 0.2rem;
  }

  .archive-nav {
    gap: 0.35rem 0.75rem;
  }

  .about-line {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
}

@media (max-width: 540px) {
  .site-header {
    margin-top: 34px;
    margin-bottom: 32px;
    padding-top: 0.25rem;
  }

  .theme-menu {
    position: absolute;
    top: 0;
    right: 16px;
    margin: 0;
    width: auto;
  }

  .theme-menu__trigger {
    width: 2.35rem;
    height: 2.35rem;
  }

  .site-avatar {
    margin-bottom: 0.8rem;
  }

  .site-title {
    font-size: 1.72rem;
  }

  .archive-nav {
    align-items: flex-start;
  }

  .archive-nav__label {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.1rem;
  }

  .site-nav {
    position: relative;
    margin-top: 1rem;
    padding-left: 16px;
    padding-right: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-padding-inline: 16px;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav.is-scrollable::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 18px;
    background: linear-gradient(to right, var(--page-background), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1;
  }

  .site-nav.is-scrollable:not(.is-at-start)::before {
    opacity: 1;
  }

  .site-nav.is-scrollable::after {
    content: "↔";
    position: absolute;
    right: 4px;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--pill-border);
    border-radius: 999px;
    background: var(--theme-control-background);
    color: var(--muted-color);
    box-shadow: var(--shadow);
    font-family: var(--ui-font);
    font-size: 0.8rem;
    line-height: 1;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.92;
    transition: opacity 0.15s ease;
    z-index: 1;
  }

  .site-nav.is-scrollable.is-at-end::after {
    opacity: 0;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.45rem;
    width: max-content;
    min-width: 100%;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 0.1rem;
  }

  .site-nav a {
    min-width: auto;
    padding: 0.45rem 0.82rem;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .post-title {
    font-size: 1.55rem;
  }

  .photos-grid {
    column-count: 1;
  }

  .pagination-links {
    flex-direction: column;
    align-items: flex-start;
  }

  .pagination-links.post-navigation {
    flex-direction: row;
    align-items: stretch;
  }

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