/*
 * Lichermione 技术博客 - AnZhiYu 视觉增强
 * 放置位置：博客根目录/source/css/custom.css
 */

:root {
  --lic-radius-lg: 18px;
  --lic-radius-md: 13px;
  --lic-shadow: 0 10px 35px rgba(15, 23, 42, 0.08);
  --lic-shadow-hover: 0 18px 46px rgba(14, 116, 144, 0.16);
  --lic-border: rgba(23, 107, 135, 0.12);
}

/* 键盘用户始终能看见当前焦点。 */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #0891b2;
  outline-offset: 3px;
}

[data-theme="dark"] {
  --lic-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  --lic-shadow-hover: 0 18px 48px rgba(8, 145, 178, 0.18);
  --lic-border: rgba(103, 232, 249, 0.14);
}

/* 导航：轻量磨砂，滚动时仍保持清晰。 */
#page-header.nav-fixed #nav,
#page-header.not-top-img #nav {
  background: rgba(248, 250, 252, 0.82);
  border-bottom: 1px solid var(--lic-border);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
}

[data-theme="dark"] #page-header.nav-fixed #nav,
[data-theme="dark"] #page-header.not-top-img #nav {
  background: rgba(8, 20, 38, 0.82);
}

/* 首页文章和侧栏统一圆角、阴影与过渡。 */
#recent-posts > .recent-post-item,
.card-widget,
#post,
#page,
.page-content,
.recent-post-item {
  border: 1px solid var(--lic-border);
  border-radius: var(--lic-radius-lg);
  box-shadow: var(--lic-shadow);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

#recent-posts > .recent-post-item:hover,
.card-widget:hover {
  border-color: rgba(14, 116, 144, 0.3);
  box-shadow: var(--lic-shadow-hover);
  transform: translateY(-4px);
}

/* 封面图轻微缩放，增强卡片层次。 */
.recent-post-item .post_cover img {
  transition: transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.recent-post-item:hover .post_cover img {
  transform: scale(1.045);
}

/* 首页专栏区域更紧凑。 */
#home_top {
  border-radius: 22px;
  overflow: hidden;
}

/* 两张首页封面沿用主题的桌面尺寸和小屏切换方式。 */
#home_top #random-banner,
#home_top #todayCard {
  border: 1px solid #72796c;
  border-radius: 16px;
  isolation: isolate;
}

#home_top #random-banner {
  --cover-inset: clamp(26px, 2.6vw, 42px);
  background: radial-gradient(ellipse at 90% 65%, #336364, transparent 62%),
    linear-gradient(115deg, #112d36, #18434a 70%, #254e50);
  color: #fff2d4;
}

#random-banner .banners-title {
  top: 19%;
  left: var(--cover-inset);
  right: var(--cover-inset);
  z-index: 1;
}

.journal-title {
  font: 500 clamp(40px, 3.15vw, 54px)/1.08 Georgia, "Times New Roman", serif;
  letter-spacing: -0.045em;
}

.journal-title em {
  margin-left: 0.18em;
  color: #e6c282;
}

.journal-quote {
  margin-top: 14px;
  color: #e2e8da;
  font: 15px/1.7 "Songti SC", SimSun, serif;
  letter-spacing: 0.045em;
}

#random-banner .journal-random {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 var(--cover-inset) 24px;
  color: #fae3b5;
  font-size: 14px;
  font-weight: 600;
  line-height: 27px;
}

.journal-arrow {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid #b7ad89;
  border-radius: 50%;
  transition: background .2s, color .2s;
}

.journal-random:is(:hover, :focus-visible) .journal-arrow {
  background: #f1d59b;
  color: #173c41;
}

/* 黄铜星盘由刻度、经纬圈和中央指针构成。 */
.sky-dial {
  position: absolute;
  width: clamp(196px, 16vw, 270px);
  aspect-ratio: 1;
  right: -4%;
  top: 53%;
  border: 1px solid #c9b88899;
  border-radius: 50%;
  color: #f3d496;
  transform: translateY(-50%) rotate(-23deg);
  transition: transform .6s ease;
  pointer-events: none;
}

#random-banner:hover .sky-dial {
  transform: translateY(-50%) rotate(-17deg);
}

.sky-dial::before,
.sky-dial::after,
.sky-dial > div {
  position: absolute;
}

.sky-dial::before {
  content: "";
  inset: 3px;
  border-radius: 50%;
  background: repeating-conic-gradient(currentColor 0deg .6deg, transparent .6deg 6deg);
  mask-image: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  opacity: .8;
}

.sky-dial::after {
  content: "";
  inset: 9%;
  border: 1px solid #cfbb8380;
  border-radius: 50%;
}

.sky-dial .dial-orbit,
.sky-dial .dial-equator,
.sky-dial .dial-meridian {
  border: 1px solid #cfbb8390;
  border-radius: 50%;
}

.dial-orbit { inset: 25% -8%; transform: rotate(-18deg); }
.dial-equator { inset: 35% 9%; }
.dial-meridian { inset: 9% 33%; }

.dial-star {
  inset: 35%;
  background: #f0cf8c;
  clip-path: polygon(50% 0, 56% 41%, 88% 12%, 61% 44%, 100% 50%, 61% 56%, 88% 88%, 56% 59%, 50% 100%, 44% 59%, 12% 88%, 39% 56%, 0 50%, 39% 44%, 12% 12%, 44% 41%);
}

#home_top #todayCard {
  background: #14273b;
  border-color: #636b72;
}

#todayCard .archive-link {
  position: absolute;
  inset: 0;
}

#todayCard .todayCard-cover {
  width: 100%;
  height: 100%;
  filter: none;
  transition: transform .5s ease;
}

#todayCard:hover .todayCard-cover { transform: scale(1.025); }
#todayCard::after { display: none; }

#todayCard .archive-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #08151ee6, transparent 45%);
  pointer-events: none;
}

#todayCard .todayCard-info {
  left: 28px;
  bottom: 24px;
}

#todayCard .todayCard-tips {
  color: #f3d79a;
  font-size: 13px;
  letter-spacing: .14em;
  opacity: 1;
}

#todayCard .todayCard-title {
  margin-top: 5px;
  color: #fff2db;
  font: 600 30px/1.2 "Songti SC", SimSun, serif;
  letter-spacing: .05em;
}

#todayCard .banner-button-group { right: 24px; bottom: 26px; }

#todayCard .banner-button {
  gap: 10px;
  height: 38px;
  width: auto;
  padding: 0 16px;
  border: 1px solid #cfba8f9c;
  background: #10212bc9;
  color: #fff0d1;
  font-size: 14px;
}

#todayCard .banner-button:is(:hover, :focus-visible) {
  background: #efdbb0;
  color: #182b32;
}

#todayCard.hide { visibility: hidden; }
#todayCard .archive-link:focus-visible,
#random-banner .journal-random:focus-visible { outline-offset: -5px; }

.categoryItem {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--lic-radius-md);
}

/* 首页专栏扩展为 6 项，避免新增入口后挤压或溢出。 */
@media screen and (min-width: 1201px) {
  #home_top .categoryGroup {
    gap: 0.4rem;
  }

  #home_top .categoryGroup .categoryItem {
    width: calc((100% - 2rem) / 6);
    min-width: 0;
    margin-right: 0;
  }

  #home_top .categoryButtonText {
    padding-left: 10px;
    font-size: 0.86rem;
    white-space: nowrap;
  }

  #home_top a.categoryButton i {
    right: -18px;
    font-size: 4rem;
  }
}

@media screen and (min-width: 769px) and (max-width: 1200px) {
  #home_top .categoryGroup {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    grid-template-rows: repeat(2, minmax(72px, 1fr));
    gap: 0.5rem;
    min-width: 520px;
    height: 340px;
  }

  #home_top .categoryGroup .categoryItem,
  #home_top .categoryGroup .categoryItem:nth-child(3) {
    display: block;
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
  }
}

/* 标签做成柔和的胶囊按钮。 */
.card-tag-cloud a,
.tag-cloud-list a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 3px 2px;
  padding: 3px 9px;
  border: 1px solid var(--lic-border);
  border-radius: 999px;
  transition:
    color 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.card-tag-cloud a:hover,
.tag-cloud-list a:hover {
  color: #fff !important;
  background: #176b87;
  border-color: #176b87;
  transform: translateY(-2px);
}

/* 正文排版：提升中文和代码内容的阅读感。 */
#article-container {
  line-height: 1.85;
}

#article-container img {
  max-width: 100%;
  height: auto;
}

#article-container h2 {
  margin-top: 2.1em;
}

#article-container h3 {
  margin-top: 1.7em;
}

#article-container code {
  border-radius: 6px;
}

#article-container pre,
#article-container .highlight {
  border-radius: 14px;
}

#article-container blockquote {
  border-radius: 0 var(--lic-radius-md) var(--lic-radius-md) 0;
}

/* 目录当前项更醒目。 */
.toc-link.active {
  color: #0e7490 !important;
  font-weight: 700;
}

/* 页脚与背景保持克制。 */
#footer {
  background: transparent;
}

/* 移动端取消卡片悬浮，避免触控时跳动。 */
@media screen and (max-width: 768px) {
  #site-info {
    overflow: hidden;
  }

  #page-header #site-info h1#site-title {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    margin-inline: auto;
    padding: 0 12px;
    font-size: 1.4rem !important;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  #site-subtitle {
    max-width: calc(100vw - 36px);
    margin-inline: auto;
    padding: 0;
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #page-header #nav {
    padding-inline: 16px;
    overflow: hidden;
  }

  #nav-group {
    width: 100vw;
    max-width: 100vw;
  }

  #blog_name {
    min-width: 0;
  }

  #site-name .title {
    max-width: 180px;
    overflow: hidden;
    font-size: 0.95rem;
    text-overflow: ellipsis;
  }

  #nav-right {
    display: flex !important;
    flex-shrink: 0;
    margin-left: auto;
    right: 16px;
  }

  #nav-right #search-button,
  #nav-right #toggle-menu {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
  }

  #page-header #nav #nav-right a,
  #page-header #nav #toggle-menu a {
    color: var(--anzhiyu-fontcolor) !important;
  }

  #page-header #nav #nav-right .nav-button a i,
  #page-header #nav #toggle-menu a i {
    color: #334155 !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #nav-right #randomPost_button {
    display: none;
  }

  #page-header #nav #nav-right > div {
    margin-left: 0.5rem;
  }

  #recent-posts > .recent-post-item:hover,
  .card-widget:hover {
    transform: none;
  }

  #recent-posts > .recent-post-item,
  .card-widget,
  #post,
  #page {
    border-radius: 14px;
  }
}

/* 尊重系统的“减少动态效果”设置。 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
