/* Shared visual language for the Hexo shell; standalone tools stay independent. */
:root {
  --cc-page: #f2f6f5;
  --cc-surface: #fff;
  --cc-ink: #263f45;
  --cc-muted: #637779;
  --cc-line: #dce6e3;
  --cc-soft: #e5efeb;
  --cc-accent: #326f75;
}

[data-theme="dark"] {
  --cc-page: #152329;
  --cc-surface: #1c2d33;
  --cc-ink: #deebe7;
  --cc-muted: #a2b9b7;
  --cc-line: #344b50;
  --cc-soft: #293e43;
  --cc-accent: #94c9c5;
}

html[data-theme] {
  --anzhiyu-background: var(--cc-page);
  --anzhiyu-card-bg: var(--cc-surface);
  --anzhiyu-card-border: var(--cc-line);
  --anzhiyu-fontcolor: var(--cc-ink);
  --anzhiyu-secondtext: var(--cc-muted);
  --anzhiyu-theme-deep: var(--cc-accent);
  --anzhiyu-theme-op: color-mix(in srgb, var(--cc-accent) 14%, transparent);
  --anzhiyu-theme-op-deep: color-mix(in srgb, var(--cc-accent) 90%, transparent);
}

#web_bg { background: var(--cc-page); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Article cards use normal flow so long titles cannot collide with metadata. */
#recent-posts > .recent-post-item { border: 1px solid var(--cc-line); background: var(--cc-surface); }
#recent-posts > .recent-post-item > .recent-post-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  height: auto;
  min-height: 162px;
  padding: 28px 24px 20px;
  background-image: none;
}
#recent-posts > .recent-post-item > .recent-post-info > .article-title {
  position: static;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2 !important;
  width: 100%;
  padding: 0;
  color: var(--cc-ink);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: anywhere;
}
#recent-posts > .recent-post-item > .recent-post-info > .article-meta-wrap {
  position: static;
  padding: 0;
  color: var(--cc-muted);
  font-size: 12px;
  line-height: 1.8;
  white-space: normal;
}
#recent-posts .article-meta-wrap .post-meta-date { color: var(--cc-muted); }
#recent-posts .cc-post-dates { column-gap: 18px; row-gap: 6px; }
#recent-posts .cc-post-date-group { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
#recent-posts > .recent-post-item > .recent-post-info > .article-meta-wrap .cc-post-date-group i { margin: 0; }
#recent-posts .article-meta-wrap .tags { display: flex; flex-wrap: wrap; gap: 4px 10px; }
#recent-posts .article-meta-wrap .article-meta__tags { margin: 0; font-size: 12px; }
#recent-posts .article-meta__categories__box { align-items: center; gap: 6px; }
#recent-posts > .recent-post-item .unvisited-post { position: static; width: auto; padding: 1px 6px; border-radius: 6px; color: #fff; background: #214b55b3; font-size: 10px; }
#recent-posts .recent-post-info .newPost { top: 6px; left: 24px; color: var(--cc-accent); }
#recent-posts > .cc-post-filter { margin-bottom: 12px; }
#recent-posts > .cc-post-filter + .recent-post-item { margin-top: 0; }
#recent-posts > .cc-post-filter #category-bar,
#recent-posts > .cc-post-filter .cc-post-sort {
  border-color: var(--cc-line);
  border-radius: 12px;
  background: var(--cc-surface);
  box-shadow: none;
  backdrop-filter: none;
}
#recent-posts > .cc-post-filter #category-bar .catalog-list-item a,
#recent-posts > .cc-post-filter #category-bar a.catalog-more,
#recent-posts > .cc-post-filter #category-bar .category-bar-next { font-size: 13px; font-weight: 500; color: var(--cc-muted); }
#recent-posts > .cc-post-filter #category-bar .catalog-list-item.select a,
#recent-posts > .cc-post-filter #category-bar .catalog-list-item:hover a,
.cc-post-sort__button.is-active { background: var(--cc-accent); color: var(--cc-surface); box-shadow: none; }
.cc-post-sort__button { color: var(--cc-muted); }
#aside-content .card-widget { box-shadow: none; border: 1px solid var(--cc-line); }
#aside-content .card-info { background: #547d78; }
.page #aside-content .sticky_layout { position: static; top: auto; }

/* Reading column and clear, stable table of contents. */
#article-container { max-width: 780px; margin-inline: auto; color: var(--cc-ink); }
#article-container p, #article-container li { line-height: 1.9; }
#article-container strong { color: var(--cc-accent); }
#page-header.post-bg #post-info .post-title { text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }

/* Give desktop titles a wider line while retaining the original left alignment. */
@media (min-width: 769px) {
  #page-header.cc-airship-header { height: auto; min-height: 0; }
  #page-header.cc-airship-header:not(.nav-fixed) > #nav { position: absolute; top: 0; left: 0; right: 0; }
  #page-header.cc-airship-header .cc-post-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    width: 90%;
    max-width: none;
    min-height: 440px;
    margin-inline: auto;
    padding: 76px 0 28px;
  }
  #page-header.cc-airship-header #post-info {
    position: static;
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 0;
    transform: none;
  }
  #page-header.cc-airship-header .cc-airship { position: relative; inset: auto; width: 100%; height: 360px; }
  #page-header.cc-airship-header #post-info .post-title { text-wrap: wrap; }
}
#aside-content #card-toc .toc-content .toc-link { cursor: pointer; line-height: 1.55; }
#aside-content #card-toc .toc-content .toc-link span,
#aside-content #card-toc .toc-content .toc-link:not(.active) span {
  filter: none;
  opacity: 1;
}
#aside-content #card-toc .toc-content .toc-link.active {
  font-size: inherit;
  line-height: 1.55;
  font-weight: 600;
  color: var(--cc-accent);
  background: var(--cc-soft);
}

/* Fit portrait avatars inside the circle instead of clipping their upper half. */
#post .post-copyright .post-copyright__author_box { margin-top: 40px; }
#post .post-copyright .post-copyright__author_img {
  width: 88px;
  height: 88px;
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #292929;
  isolation: isolate;
}
#post .post-copyright .post-copyright__author_img img {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
  object-position: center;
}
#post .post-copyright .post-copyright__author_box .post-copyright__author_img:hover img.post-copyright__author_img_front { transform: none; }

/* Collection pages share the sea palette without a large photographic banner. */
#page-header.cc-collection-header {
  height: 236px;
  background: linear-gradient(115deg, #214b55, #3e7377) !important;
}
#page-header.cc-collection-header::before { display: none; }
#page-header.cc-collection-header #page-site-info { top: 50%; padding: 0 24px; transform: translateY(-20%); }
#page-header.cc-collection-header #site-title { font-size: 32px; }
#page-header.cc-collection-header:not(.nav-fixed) #nav .site-page,
#page-header.cc-collection-header:not(.nav-fixed) #nav #site-name { color: #edf5f1; }

/* The existing tool entry keeps its original green buttons. */
[data-theme="light"] #rightside { --btn-bg: #8fbc8f; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 4px; }

@media (min-width: 1201px) {
  #recent-posts > .cc-post-filter + .recent-post-item + .recent-post-item { margin-top: 0; }
  #recent-posts > .recent-post-item { align-self: stretch; }
  #recent-posts > .recent-post-item > .recent-post-info { flex: 1; justify-content: space-between; }
}

@media (max-width: 768px) {
  #recent-posts > .cc-post-filter { width: calc(100% - 40px); margin-left: 20px; margin-right: 20px; }
  #post .post-copyright .post-copyright__author_box { margin-top: 36px; }
  #post .post-copyright .post-copyright__author_img { width: 80px; height: 80px; top: -40px; }
  #recent-posts > .recent-post-item > .recent-post-info { min-height: 0; gap: 10px; padding: 26px 20px 18px; }
  #content-inner #recent-posts > .recent-post-item > .recent-post-info > .content { display: none; }
  #recent-posts > .recent-post-item > .recent-post-info > .article-meta-wrap .article-meta__tags { margin: 0; font-size: 12px; }
  #recent-posts > .recent-post-item > .recent-post-info > .article-title { -webkit-line-clamp: 3 !important; font-size: 18px; }
  #recent-posts .recent-post-info .newPost { left: 20px; }
  #recent-posts > .recent-post-item > .recent-post-info > .article-meta-wrap .post-meta-date { white-space: normal; }
  #recent-posts > .recent-post-item > .recent-post-info > .article-meta-wrap > .cc-post-dates { display: flex; justify-content: flex-start; column-gap: 18px; width: 100%; }
  #recent-posts > .recent-post-item > .recent-post-info > .article-meta-wrap .article-meta-label { display: none; }
  #post { padding-bottom: 72px; }
  #page-header.post-bg { display: flex; flex-direction: column; align-items: center; height: auto; min-height: 0; padding: 80px 0 24px; }
  .cc-post-hero { display: flex; flex-direction: column; align-items: center; width: 100%; }
  #page-header.post-bg:not(.nav-fixed) > #nav { position: absolute; top: 0; left: 0; right: 0; }
  #page-header.post-bg #post-info { position: relative; top: auto; bottom: auto; left: auto; width: 88%; max-width: 88%; height: auto; margin: 0 auto; transform: none; }
  #page-header.post-bg #post-info .post-title { font-size: 23px; line-height: 1.45; margin: 8px 0 12px; }
  #page-header.post-bg .cc-airship { position: relative; inset: auto; flex: 0 0 auto; width: 90%; height: 230px; margin: 14px auto 0; }
  #page-header.cc-collection-header { height: 200px; }
  #page-header.cc-collection-header #site-title { font-size: 26px; }

  /* Retain the mobile player and character alongside the original tools. */
  body #nav-music {
    display: flex !important;
    z-index: 100;
    left: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 140px);
  }
  .cc-ai-chat, .cc-ai-chat.is-expanded { right: 12px; left: 12px; bottom: max(68px, calc(env(safe-area-inset-bottom) + 56px)); width: auto; }
  .cc-ai-chat .cc-ai-chat-card { width: 100%; max-height: calc(100dvh - 120px); }
}

@media (max-width: 360px) {
  #page-header.post-bg #post-info .post-title { font-size: 21px; }
}
