/*
 * Zexi's Blog visual system
 *
 * Docsify supplies the Markdown baseline. This file owns the blog's tokens,
 * page layout, and responsive reading experience so future adjustments stay
 * in one predictable place.
 */

:root {
  --blog-canvas: #fffdf9;
  --blog-surface: #fffaf5;
  --blog-ink: #24221f;
  --blog-muted: #716c65;
  --blog-faint: #a7a19a;
  --blog-line: #e9e2d9;
  --blog-accent: #d94d7a;
  --blog-accent-wash: #fce8ef;
  --blog-shadow: 0 16px 45px rgba(77, 58, 44, 0.08);
  --blog-content-width: 740px;
  --blog-reader-width: 1050px;
  --theme-color: var(--blog-accent);
}

* { box-sizing: border-box; }

html,
body {
  background: var(--blog-canvas);
  color: var(--blog-ink);
}

body,
button,
input,
textarea {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

::selection {
  color: #fff;
  background: var(--blog-accent);
}

/* Docsify shell */
.sidebar,
.sidebar-toggle { display: none !important; }

.content {
  right: 0 !important;
  left: 0 !important;
  background: transparent;
}

.markdown-section {
  max-width: var(--blog-content-width);
  padding: 64px 32px 72px;
  margin: 0 auto;
  color: var(--blog-ink);
  font-size: 17px;
  line-height: 1.9;
}

.markdown-section > :first-child { margin-top: 0; }

.markdown-section a {
  color: var(--blog-accent);
  text-decoration: underline;
  text-decoration-color: rgba(217, 77, 122, 0.3);
  text-underline-offset: 0.18em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.markdown-section a:hover {
  color: #ad315a;
  text-decoration-color: currentColor;
}

.markdown-section p,
.markdown-section li { letter-spacing: 0.012em; }

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4 {
  color: var(--blog-ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.markdown-section h1 {
  max-width: 22em;
  margin: 0 0 0.9em;
  font-size: clamp(2rem, 4vw, 2.85rem);
  line-height: 1.28;
}

.markdown-section h2 {
  margin: 2.6em 0 0.8em;
  padding: 0;
  border: 0;
  font-size: 1.5rem;
  line-height: 1.45;
}

.markdown-section h3 {
  margin: 2em 0 0.65em;
  font-size: 1.16rem;
  line-height: 1.55;
}

.markdown-section h4 {
  margin: 1.7em 0 0.55em;
  font-size: 1rem;
}

.markdown-section h1 .anchor,
.markdown-section h2 .anchor,
.markdown-section h3 .anchor,
.markdown-section h4 .anchor {
  color: inherit;
  text-decoration: none;
}

.markdown-section hr {
  height: 1px;
  margin: 3rem 0;
  border: 0;
  background: var(--blog-line);
}

.markdown-section blockquote {
  margin: 1.8em 0;
  padding: 0.2em 0 0.2em 1.1em;
  color: var(--blog-muted);
  border-left: 2px solid var(--blog-accent);
  font-size: 0.98em;
}

.markdown-section blockquote p { margin: 0.5em 0; }

.markdown-section code {
  color: #a5345c;
  background: #f8eee9;
  border-radius: 0.3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.markdown-section pre {
  margin: 1.8em 0;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--blog-line);
  border-radius: 0.7rem;
  box-shadow: none;
}

.markdown-section pre > code {
  color: inherit;
  background: transparent;
}

.markdown-section table {
  display: table;
  width: 100%;
  margin: 1.8em 0;
  overflow: hidden;
  border: 1px solid var(--blog-line);
  border-radius: 0.6rem;
}

.markdown-section th,
.markdown-section td {
  padding: 0.7em 0.8em;
  border-color: var(--blog-line);
}

.markdown-section th { background: var(--blog-surface); }

.markdown-section img {
  border: 1px solid var(--blog-line);
  border-radius: 0.65rem;
  box-shadow: var(--blog-shadow);
}

/* Article reader */
.article-page .blog-reading-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--blog-content-width)) 210px;
  gap: 72px;
  align-items: start;
  max-width: var(--blog-reader-width);
  padding: 64px 32px 72px;
  margin: 0 auto;
}

.article-page .markdown-section {
  min-width: 0;
  padding: 0;
  margin: 0;
}

.article-breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 2rem;
  overflow: hidden;
  color: var(--blog-faint);
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.article-breadcrumb a {
  flex: none;
  color: var(--blog-muted);
  text-decoration: none;
}

.article-breadcrumb a:hover { color: var(--blog-accent); }

.article-breadcrumb__separator { color: var(--blog-line); }

.article-breadcrumb__current {
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-toc {
  position: sticky;
  top: 2.5rem;
  max-height: calc(100vh - 5rem);
  padding: 0.25rem 0 0.25rem 1.05rem;
  overflow: auto;
  border-left: 1px solid var(--blog-line);
  scrollbar-width: thin;
}

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

.article-toc__item + .article-toc__item { margin-top: 0.2rem; }

.article-toc__item--h3 { padding-left: 0.72rem; }

.article-toc__link {
  display: block;
  padding: 0.3rem 0;
  color: var(--blog-muted);
  font-size: 0.79rem;
  line-height: 1.45;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

.article-toc__link:hover,
.article-toc__link.is-active {
  color: var(--blog-accent);
}

.article-toc__link.is-active { transform: translateX(2px); }

/* Home */
.home-page .markdown-section {
  max-width: 820px;
  min-height: calc(100vh - 152px);
  padding-top: clamp(64px, 12vh, 132px);
}

.home-page .markdown-section h1,
.home-page .markdown-section h2,
.home-page .markdown-section h3,
.home-page .markdown-section h4 { font-weight: 500; }

.home-page .markdown-section h1 a,
.home-page .markdown-section h2 a,
.home-page .markdown-section h3 a,
.home-page .markdown-section h4 a {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.home-page .markdown-section h1 {
  margin-bottom: 0.22em;
  font-size: clamp(3.35rem, 10vw, 5.5rem);
  font-weight: 300;
  letter-spacing: -0.065em;
}

.home-page .markdown-section blockquote {
  margin: 0 0 2.4rem;
  padding: 0;
  border: 0;
  color: var(--blog-muted);
  font-size: 0.94rem;
}

.home-page .markdown-section h2 {
  margin: 2.7rem 0 0.75rem;
  font-size: 1.18rem;
}

.home-page .markdown-section h3 {
  margin: 1.65rem 0 0.55rem;
  color: var(--blog-muted);
  font-size: 0.92rem;
}

.home-page .markdown-section ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.home-page .markdown-section ul li {
  padding: 0.16rem 0;
  font-size: 0.94rem;
  line-height: 1.75;
}

.home-page .markdown-section ul li .tl-date {
  display: inline-block;
  min-width: 2.65rem;
  margin-right: 0.35rem;
  color: var(--blog-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
}

.home-page .markdown-section a {
  color: var(--blog-ink);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
}

.home-page .markdown-section a:hover { color: var(--blog-accent); }

/* Footer and contact icons */
.blog-footer {
  max-width: var(--blog-reader-width);
  padding: 0 32px 48px;
  margin: 0 auto;
  color: var(--blog-faint);
  font-size: 0.76rem;
  text-align: center;
}

.blog-footer__contacts {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}

.blog-footer__icon {
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  color: var(--blog-muted);
  border: 1px solid var(--blog-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.blog-footer__icon:hover {
  color: var(--blog-accent);
  border-color: rgba(217, 77, 122, 0.45);
  background: var(--blog-accent-wash);
  transform: translateY(-2px);
}

.blog-footer__icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.blog-footer__icp {
  color: var(--blog-faint);
  text-decoration: none;
}

.blog-footer__icp:hover { color: var(--blog-accent); }

@media (max-width: 1120px) {
  .article-page .blog-reading-layout {
    display: block;
    max-width: var(--blog-content-width);
    padding: 56px 32px 64px;
  }

  .article-toc { display: none; }
}

@media (max-width: 700px) {
  .markdown-section,
  .article-page .blog-reading-layout {
    padding-right: 20px;
    padding-left: 20px;
  }

  .article-page .blog-reading-layout { padding-top: 40px; }

  .markdown-section {
    font-size: 16px;
    line-height: 1.85;
  }

  .markdown-section h1 { font-size: 2rem; }
  .markdown-section h2 { font-size: 1.36rem; }

  .home-page .markdown-section {
    min-height: calc(100vh - 144px);
    padding-top: clamp(56px, 14vh, 90px);
  }

  .home-page .markdown-section h1 { font-size: clamp(3.1rem, 18vw, 4.5rem); }

  .home-page .markdown-section ul li { font-size: 0.9rem; }

  .blog-footer { padding: 0 20px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
