:root {
  --draft-bg: #091613;
  --draft-surface: rgba(11, 24, 22, 0.82);
  --draft-line: rgba(118, 204, 188, 0.2);
  --draft-text: #e7f0ed;
  --draft-muted: #8ba39e;
  --draft-green: #58d6c1;
  --draft-blue: #69a9ff;
  --card-bg: var(--draft-surface);
  --font-color: var(--draft-text);
  --text-highlight-color: var(--draft-text);
  --hr-border: var(--draft-line);
}

html[data-theme='dark'],
body {
  background: var(--draft-bg);
  color: var(--draft-text);
}

body {
  letter-spacing: 0.012em;
}

#web_bg {
  background:
    radial-gradient(circle at 82% 8%, rgba(55, 143, 151, 0.18), transparent 34rem),
    linear-gradient(180deg, #091613 0%, #0b1a17 100%);
}

#page-header::before {
  background: linear-gradient(180deg, rgba(2, 9, 9, 0.08) 0%, rgba(4, 13, 12, 0.28) 72%, rgba(9, 22, 19, 0.82) 100%);
}

#page-header.full_page {
  height: 115vh;
  min-height: 820px;
  background-color: var(--draft-bg);
  background-position: center top;
  background-size: contain;
  background-repeat: no-repeat;
}

#nav {
  top: 0;
  height: 64px;
  padding: 0 4vw;
  background: linear-gradient(180deg, rgba(3, 11, 10, 0.72), transparent);
  line-height: 64px;
  transform: translateY(0) !important;
}

#page-header.nav-fixed #nav,
#page-header.nav-visible #nav,
#page-header.nav-hidden #nav {
  top: 0 !important;
  transform: translateY(0) !important;
}

#nav .site-page,
#nav .site-name {
  color: rgba(237, 247, 244, 0.9) !important;
}

#blog-info {
  height: 64px;
}

#blog-info .nav-site-title {
  display: inline-flex;
  align-items: center;
  height: 64px;
}

#site-info {
  top: 46vh !important;
  transform: none !important;
  width: min(620px, calc(100% - 40px));
  text-align: center;
}

#site-info #site-title {
  margin: 0;
  color: rgba(237, 247, 244, 0.78);
  font-family: Georgia, 'Noto Serif SC', 'Songti SC', serif;
  font-size: clamp(1.9rem, 3.5vw, 3.2rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.05;
  text-shadow: 0 0 18px rgba(7, 16, 15, 0.34);
}

#site-info #site-subtitle {
  margin-top: 0.55rem;
  color: rgba(220, 235, 230, 0.52);
  font-size: clamp(0.72rem, 1vw, 1rem);
  letter-spacing: 0.03em;
  text-shadow: 0 0 12px rgba(7, 16, 15, 0.28);
}

#site-info #site_social_icons,
#scroll-down {
  display: none;
}

.drafts-kicker {
  margin-bottom: 0.42rem;
  color: var(--draft-green);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  opacity: 0.58;
  text-transform: uppercase;
}

.drafts-channels {
  position: absolute;
  top: auto;
  bottom: 3rem;
  left: 50%;
  width: min(1120px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 0;
  overflow: hidden;
  border: 1px solid var(--draft-line);
  background: var(--draft-line);
  transform: translateX(-50%);
  z-index: 2;
}

.drafts-channel {
  position: relative;
  min-height: 128px;
  padding: 1.25rem;
  background: rgba(5, 17, 16, 0.82);
  color: var(--draft-text) !important;
  transition: background 180ms ease, color 180ms ease;
}

.drafts-channel:hover {
  background: rgba(25, 63, 58, 0.86);
}

.drafts-channel-index {
  display: block;
  margin-bottom: 1.75rem;
  color: var(--draft-green);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
}

.drafts-channel-name {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  left: auto;
  display: block;
  font-size: 1rem;
  font-weight: 400;
  white-space: nowrap;
  text-align: right;
}

.drafts-channel small {
  position: absolute;
  right: 1.5rem;
  bottom: 1.2rem;
  display: block;
  margin: 0;
  text-align: right;
  color: var(--draft-muted);
  font-size: 0.72rem;
}

.layout {
  max-width: 1120px;
  padding: 2.75rem 28px 5rem;
}

#body-wrap.page .layout {
  padding-top: 0;
}

/* Keep the landing and index pages spacious; reading aids belong to posts. */
#body-wrap.page #aside-content {
  display: none;
}

/* Category and tag indexes are intentionally not exposed from the landing UI. */
#body-wrap.page #sidebar .site-data > a:nth-child(2),
#body-wrap.page #sidebar .site-data > a:nth-child(3) {
  display: none;
}

#nav a[href="/categories/"],
#nav a[href="/tags/"],
#sidebar a[href="/categories/"],
#sidebar a[href="/tags/"] {
  display: none !important;
}

#body-wrap.page .layout > #recent-posts,
#body-wrap.page .layout > #page,
#body-wrap.page .layout > #archive,
#body-wrap.page .layout > #tag,
#body-wrap.page .layout > #category {
  width: 100%;
}

#body-wrap.post .layout {
  max-width: 1240px;
  align-items: flex-start;
}

#body-wrap.post {
  background: #f3f4f3;
}

#body-wrap.post #page-header::before {
  background: rgba(8, 18, 16, 0.38);
}

#body-wrap.post .layout #post,
#body-wrap.post #aside-content .card-widget {
  border: 1px solid rgba(22, 40, 36, 0.08);
  background: #fff;
  color: #4e5654;
  box-shadow: 0 12px 36px rgba(25, 34, 32, 0.08);
}

.layout > div:first-child:not(.recent-posts),
.layout #post,
.layout #page,
.layout #archive,
.layout #tag,
.layout #category {
  border: 1px solid var(--draft-line);
  border-radius: 0;
  background: rgba(9, 22, 20, 0.72);
  box-shadow: none;
}

#recent-posts > .recent-post-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--draft-line);
  background: var(--draft-line);
}

#recent-posts > .recent-post-items .recent-post-item {
  min-height: 280px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(9, 22, 20, 0.96);
  box-shadow: none;
}

#recent-posts .recent-post-info {
  padding: 2.25rem;
}

#recent-posts .article-title {
  color: var(--draft-text);
  font-family: Georgia, 'Noto Serif SC', 'Songti SC', serif;
  font-size: 1.45rem;
  line-height: 1.45;
}

#recent-posts .article-meta-wrap,
#recent-posts .content {
  color: var(--draft-muted);
}

#article-container {
  color: #4e5654;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 1.04rem;
  line-height: 2;
  letter-spacing: 0.018em;
}

#article-container p,
#article-container ul,
#article-container ol,
#article-container blockquote,
#article-container table,
#article-container pre {
  margin-top: 1.1em;
  margin-bottom: 1.1em;
}

#article-container h1,
#article-container h2,
#article-container h3,
#article-container h4,
#article-container h5,
#article-container h6,
#post-info .post-title,
#page-site-info #site-title {
  color: var(--draft-text);
  font-family: Georgia, 'Noto Serif SC', 'Songti SC', serif;
  font-weight: 700;
}

#article-container h1,
#article-container h2,
#article-container h3,
#article-container h4,
#article-container h5,
#article-container h6 {
  margin-top: 2.2em;
  margin-bottom: 0.8em;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

#article-container h1 {
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

#article-container h2 {
  padding-left: 0.7rem;
  border-left: 3px solid var(--draft-green);
  font-size: 1.58rem;
}

#article-container h3 { font-size: 1.3rem; }
#article-container h4 { font-size: 1.14rem; }
#article-container h5 { font-size: 1.06rem; }
#article-container h6 { font-size: 1rem; }

#body-wrap.post #article-container h1,
#body-wrap.post #article-container h2,
#body-wrap.post #article-container h3,
#body-wrap.post #article-container h4,
#body-wrap.post #article-container h5,
#body-wrap.post #article-container h6 {
  color: #263632 !important;
}

#article-container blockquote {
  border-left: 2px solid var(--draft-green);
  background: rgba(88, 214, 193, 0.055);
  color: #5d6b67;
}

#body-wrap.post #article-container blockquote {
  background: #f1fbf8;
}

#article-container img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
}

#article-container table {
  display: block;
  overflow-x: auto;
  border-color: var(--draft-line);
}

#aside-content {
  width: 284px;
}

#aside-content .card-widget {
  border: 1px solid var(--draft-line);
  border-radius: 0;
  background: rgba(7, 18, 17, 0.9);
  box-shadow: none;
}

#aside-content #card-toc .item-headline {
  color: var(--draft-text);
  letter-spacing: 0.08em;
}

#aside-content .toc-content {
  max-height: calc(100vh - 180px);
}

#aside-content .toc-link {
  color: var(--draft-muted);
  line-height: 1.65;
}

#aside-content .toc-link.active,
#aside-content .toc-link:hover {
  color: var(--draft-green);
}

#body-wrap.post #aside-content {
  width: 320px;
  align-self: flex-start;
  position: -webkit-sticky;
  position: sticky;
  top: 88px;
  height: fit-content;
  z-index: 5;
}

/* Keep the reading index in view while the article moves underneath it. */
#body-wrap.post #aside-content > .sticky_layout {
  position: static !important;
  align-self: flex-start;
}

#body-wrap.post #aside-content #card-toc {
  padding: 1.35rem 1.2rem;
}

#body-wrap.post #aside-content #card-toc .item-headline {
  color: #263632;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

#body-wrap.post #aside-content .toc-content {
  max-height: calc(100vh - 150px);
  margin-top: 1rem;
  overflow-y: auto;
}

#body-wrap.post #aside-content .toc {
  margin: 0;
  padding-left: 0;
}

#body-wrap.post #aside-content .toc-child {
  display: block !important;
  margin-left: 0.8rem;
  padding-left: 0.65rem;
  border-left: 1px solid #d8dfdc;
}

#body-wrap.post #aside-content .toc-link {
  display: block;
  margin: 0.18rem 0;
  padding: 0.32rem 0.55rem;
  color: #6b7471;
  line-height: 1.55;
}

#body-wrap.post #aside-content .toc-level-4 .toc-link,
#body-wrap.post #aside-content .toc-level-5 .toc-link,
#body-wrap.post #aside-content .toc-level-6 .toc-link {
  font-size: 0.92rem;
}

#body-wrap.post #aside-content .toc-link.active {
  background: #16c7b0;
  color: #fff;
}

#body-wrap.post #aside-content .toc-link:hover {
  background: #e8f7f4;
  color: #0c8f80;
}

@media (max-width: 900px) {
  #body-wrap.post #aside-content {
    position: static;
  }

  #body-wrap.post #aside-content > .sticky_layout {
    position: static !important;
  }
}

#article-container a {
  color: var(--draft-blue);
  text-decoration-color: rgba(105, 169, 255, 0.35);
  text-underline-offset: 0.2em;
}

#footer {
  background: var(--draft-bg) !important;
  color: var(--draft-muted);
}

#footer::before {
  background: transparent;
}

@media (max-width: 768px) {
  #page-header.full_page {
    height: 122vh;
    min-height: 760px;
  }

  #site-info {
    width: calc(100% - 32px);
  }

  #site-info #site-title {
    font-size: clamp(1.85rem, 9vw, 2.7rem);
  }

  #site-info #site-subtitle {
    font-size: clamp(0.68rem, 3vw, 0.9rem);
  }

  .drafts-kicker {
    font-size: 0.5rem;
  }

  .drafts-channels {
    top: auto;
    bottom: 1.5rem;
    width: calc(100vw - 28px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drafts-channel {
    min-height: 108px;
    padding: 1rem;
  }

  .drafts-channel-name {
    right: 1rem;
    white-space: normal;
  }

  .drafts-channel small { right: 1rem; }

  .drafts-channel-index {
    margin-bottom: 1.15rem;
  }

  .layout {
    padding: 2rem 14px 3rem;
  }

  #body-wrap.page .layout {
    padding-top: 0;
  }

  #recent-posts > .recent-post-items {
    grid-template-columns: 1fr;
  }

  #recent-posts > .recent-post-items .recent-post-item {
    min-height: auto;
  }

  #recent-posts .recent-post-info {
    padding: 1.6rem;
  }

  #article-container {
    font-size: 1rem;
    line-height: 1.9;
  }
}

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