:root {
  --background: #101216;
  --foreground: #d7d7d7;/*md正文*/
  --accent: #8a959e;
  --secondary: #d0d0da;
  --border-color: rgb(138, 149, 158);
  --theme-toggle-border: rgb(138, 149, 158);
  --theme-toggle-hover-bg: rgba(81, 16, 59, 0.62);

}

html[data-theme="light"] {
  --background: #f7f4eb;
  --foreground: #1a1a1a;
  --accent: #222222;
  --secondary: #355c9a;
  --border-color: rgba(34, 34, 34, 0.3);
  --theme-toggle-border: rgba(34, 34, 34, 0.65);
  --theme-toggle-hover-bg: rgba(34, 34, 34, 0.08);
}

body {
  background: var(--background);
  color: var(--foreground);
}

.content {
  flex: 1 0 auto;
}

.pixel-snow {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.72;
}

.flickering-grid-hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  margin: 8px 0 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--background) 92%, white 2%) 0%,
      color-mix(in srgb, var(--background) 97%, black 3%) 100%
    );
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--foreground) 7%, transparent),
    0 10px 30px rgba(0, 0, 0, 0.16);
  --fx: 50%;
  --fy: 50%;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.flickering-grid-hero::before,
.flickering-grid-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.flickering-grid-hero::before {
  background:
    radial-gradient(
      400px circle at var(--fx) var(--fy),
      color-mix(in srgb, var(--accent) 34%, transparent) 0%,
      color-mix(in srgb, var(--secondary) 12%, transparent) 28%,
      transparent 64%
    );
  opacity: 0;
  transition: opacity 0.16s ease;
}

.flickering-grid-hero::after {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--foreground) 8%, transparent) 0%,
      transparent 32%,
      transparent 68%,
      color-mix(in srgb, var(--accent) 10%, transparent) 100%
    );
  mix-blend-mode: screen;
  opacity: 0.75;
}

.flickering-grid-hero.is-hovered {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--foreground) 9%, transparent),
    0 18px 42px rgba(0, 0, 0, 0.24);
}

.flickering-grid-hero.is-hovered::before {
  opacity: 1;
}

.flickering-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

.flickering-grid-hero__content {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 28px 26px;
}

.flickering-grid-hero__content > :first-child {
  margin-top: 0;
}

.flickering-grid-hero__content > :last-child {
  margin-bottom: 0;
}

.typewriter-hero {
  position: relative;
  display: inline-block;
  min-height: 1.2em;
}

.typewriter-hero::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 0.95em;
  margin-left: 0.08em;
  background: currentColor;
  vertical-align: -0.08em;
  animation: typewriter-caret 0.9s steps(1) infinite;
}

@keyframes typewriter-caret {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.home-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 28px;
}

.home-calendar {
  position: fixed;
  top: 500px;
  left: max(24px, calc((100vw - 864px) / 2 - 260px));
  width: 220px;
  z-index: 4;
}

.home-calendar__panel {
  padding: 0 0 0 18px;
  border-left: 1px solid color-mix(in srgb, var(--foreground) 18%, transparent);
}

.home-calendar__title {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 1rem;
}

.home-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.home-calendar__weekday {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1;
}

.home-calendar__day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  color: color-mix(in srgb, var(--foreground) 76%, transparent);
  border: 1px solid color-mix(in srgb, var(--foreground) 14%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--background) 92%, transparent);
  font-size: 0.9rem;
  line-height: 1;
}

.home-calendar__day--empty {
  border-color: transparent;
  background: transparent;
}

.home-calendar__day.is-today {
  color: var(--background);
  background: var(--accent);
  border-color: var(--accent);
}

.home-links__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  line-height: 0;
  opacity: 0.82;
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.home-links__item:hover {
  opacity: 1;
  color: var(--accent);
}

.home-links__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.home-links__icon svg {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
}

.post,
.post-content,
.post-title,
.logo,
.navigation-menu a,
.menu a,
.footer,
.footer a {
  transition: background-color 0.5s ease, color 0.2s ease, border-color 0.2s ease;
}

.header__controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
}

.container {
  position: relative;
  z-index: 1;
}

.header-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--accent);
  color: var(--background);
  cursor: pointer;
  width: 35px;
  height: 35px;
  min-width: 35px;
  min-height: 35px;
  padding: 0;
  flex: 0 0 auto;
  line-height: 0;
  opacity: 1;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.header-icon-button:hover {
  background: var(--accent);
}

.header-icon-button.is-active {
  background: var(--accent);
  opacity: 1;
}

.header-icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-icon-button__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-icon-button__icon svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--accent);
  color: var(--background);
  cursor: pointer;
  width: 35px;
  height: 35px;
  min-width: 35px;
  min-height: 35px;
  padding: 0;
  opacity: 1;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  background: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle__icon svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

.theme-toggle__icon--dark {
  display: none;
}

html[data-theme="light"] .theme-toggle__icon--light {
  display: none;
}

html[data-theme="light"] .theme-toggle__icon--dark {
  display: block;
}

.post {
  border-color: var(--border-color);
}

.site-search {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 20px;
}

.site-search.hidden {
  display: none;
}

.site-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.site-search__panel {
  position: relative;
  z-index: 1;
  width: min(780px, 100%);
  background: color-mix(in srgb, var(--background) 94%, black);
  border: 1px solid var(--theme-toggle-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.site-search__header,
.site-search__results {
  padding: 14px;
}

.site-search__footer {
  padding: 14px;
  border-top: 1px solid color-mix(in srgb, var(--theme-toggle-border) 40%, transparent);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.site-search__input {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--secondary) 60%, transparent);
  background: transparent;
  padding: 10px 14px;
}

.site-search__input-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  flex: 0 0 auto;
}

.site-search__input-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.site-search__field {
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: var(--foreground);
  padding: 0;
  width: 100%;
  font: inherit;
  font-size: 1.125rem;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
}

.site-search__field:hover,
.site-search__field:focus,
.site-search__field:focus-visible,
.site-search__field:active {
  border: none;
  outline: none;
  box-shadow: none;
}

.site-search__field::placeholder {
  color: color-mix(in srgb, var(--foreground) 55%, transparent);
}

.site-search__results {
  min-height: 120px;
  max-height: 380px;
  overflow: auto;
}

.site-search__empty {
  color: color-mix(in srgb, var(--foreground) 72%, transparent);
  text-align: center;
  padding: 42px 20px;
}

.site-search__item {
  display: block;
  padding: 16px 18px;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--theme-toggle-border) 40%, transparent);
  color: var(--foreground);
}

.site-search__item:last-child {
  border-bottom: none;
}

.site-search__item:hover {
  background: color-mix(in srgb, var(--secondary) 16%, transparent);
}

.site-search__item-title {
  color: var(--foreground);
  font-weight: bold;
  margin-bottom: 6px;
}

.site-search__item-title mark {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--foreground);
  padding: 0 2px;
}

.site-search__item-meta {
  color: var(--secondary);
  font-size: 0.92rem;
}

.site-search__item-snippet {
  margin-top: 8px;
  color: color-mix(in srgb, var(--foreground) 82%, transparent);
  font-size: 0.95rem;
  line-height: 1.6;
}

.site-search__item-snippet mark {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--foreground);
  padding: 0 2px;
}

.site-search__action {
  min-width: 88px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--theme-toggle-border);
  background: transparent;
  color: var(--accent);
}

.site-search__action:hover {
  background: var(--theme-toggle-hover-bg);
}

.site-search__action--ghost {
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--foreground) 28%, transparent);
}

.footer {
  margin-top: auto;
}

.footer a {
  text-decoration: none;
}

.hyper-text {
  display: inline-block;
  cursor: default;
  user-select: none;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.post-tags--terms {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
}

.post-tags .tag-chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.post-tags--terms .tag-chip {
  display: inline-block;
}

.post-tags .tag-chip--0 {
  color: #b54747;
}

.post-tags .tag-chip--1 {
  color: #355c9a;
}

.post-tags .tag-chip--2 {
  color: #2f7a4e;
}

.post-tags .tag-chip--3 {
  color: #8c5a1e;
}

.post-tags .tag-chip--4 {
  color: #7a3fa0;
}

.post-tags .tag-chip--5 {
  color: #4f646f;
}

.post-tags .tag-chip:hover {
  opacity: 0.8;
}

.post-layout.has-toc {
  position: static;
  display: block;
}

.post-sidebar {
  position: fixed;
  top: 110px;
  right: max(24px, calc((100vw - 864px) / 2 - 300px));
  width: 260px;
  z-index: 4;
}

.toc-sidebar {
  position: relative;
  top: auto;
  margin: 0;
  padding-left: 18px;
  border-left: 1px solid color-mix(in srgb, var(--foreground) 18%, transparent);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.toc-sidebar::-webkit-scrollbar {
  display: none;
}

.toc-sidebar h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--accent);
}

.toc-sidebar nav {
  display: block;
}

.toc-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-sidebar ul ul {
  margin-top: 8px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid color-mix(in srgb, var(--foreground) 14%, transparent);
}

.toc-sidebar li {
  margin: 0 0 12px;
}

.toc-sidebar li::before {
  display: none !important;
}

.toc-sidebar a {
  color: color-mix(in srgb, var(--foreground) 76%, transparent);
  text-decoration: none;
  line-height: 1.7;
}

.toc-sidebar a:hover {
  color: var(--accent);
}

.navigation-menu a,
.menu__dropdown a {
  text-decoration: none;
}

.navigation-menu a.is-active,
.menu__dropdown a.is-active {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

@media (max-width: 684px) {
  .header__controls {
    margin-left: 12px;
    gap: 5px;
  }

  .theme-toggle {
    width: 35px;
    height: 35px;
    min-width: 35px;
    min-height: 35px;
  }

  .header-icon-button {
    width: 35px;
    height: 35px;
    min-width: 35px;
    min-height: 35px;
  }

  .site-search {
    padding: 24px 12px 12px;
  }

  .site-search__panel {
    width: 100%;
  }

  .site-search__header,
  .site-search__results {
    padding: 12px;
  }

  .site-search__footer {
    padding: 12px;
    justify-content: space-between;
  }

  .site-search__input {
    padding: 10px 12px;
  }

  .site-search__field {
    font-size: 1rem;
  }

  .flickering-grid-hero {
    min-height: 180px;
    margin: 6px 0 24px;
  }

  .flickering-grid-hero__content {
    padding: 20px 18px;
  }
}

@media (max-width: 1400px) {
  .home-calendar {
    display: none;
  }
}

@media (max-width: 1200px) {
  .post-sidebar {
    display: none;
  }
}
