/* 主页顶部的一张项目卡片（小白录制）。样式独立于主题，不依赖 tailwind 工具类。 */

.xb-card {
  margin: 0 0 28px;
}

.xb-card-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 18px;
  background: var(--background-color-transparent-80);
  border: 1px solid var(--border-color);
  box-shadow: var(--redefine-box-shadow-flat);
}

.xb-card-icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: block;
}

.xb-card-text {
  min-width: 0;
  flex: 1 1 auto;
}

.xb-card-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--second-text-color);
  line-height: 1.4;
}

.xb-card-tag {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .02em;
  padding: 2px 8px;
  border-radius: 999px;
  color: #1A5FD6;
  background: rgba(26, 95, 214, .10);
  border: 1px solid rgba(26, 95, 214, .18);
}

html.dark .xb-card-tag {
  color: #8FBBFF;
  background: rgba(107, 160, 255, .14);
  border-color: rgba(107, 160, 255, .24);
}

.xb-card-desc {
  margin: 5px 0 0;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--third-text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .xb-card-inner {
    padding: 14px 16px;
    gap: 12px;
  }
  .xb-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
  .xb-card-name { font-size: 1rem; }
  .xb-card-desc {
    font-size: .84rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* ---------- 首页背景视频 ---------- */
.xb-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  z-index: 0;
}

/* 视频之上的暗蒙层：压住亮部，保证标题可读 */
.xb-bg-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(120% 110% at 50% 42%, rgba(6, 10, 20, .10), rgba(6, 10, 20, .55)),
    linear-gradient(to top, rgba(6, 10, 20, .78), rgba(6, 10, 20, .10) 55%);
}

/* 背景层与内容层叠放顺序 */
.home-banner-background {
  overflow: hidden;
  z-index: 0;
}

.home-banner-container .content {
  z-index: 2;
}

/* 尊重「减少动态效果」设置：直接停掉视频 */
@media (prefers-reduced-motion: reduce) {
  .xb-bg-video {
    display: none;
  }
}

/* ==========================================================
   导航栏自适应（首页顶部有 banner / 视频时）
   由 html.has-banner-text 标记控制，滚动后自动移除
   ========================================================== */

/* 首页未滚动：去掉橙蓝渐变底，改用自上而下的暗渐变托底，任何背景都压得住 */
html.has-banner-text .navbar-container {
  background: linear-gradient(
    to bottom,
    rgba(6, 10, 20, .52) 0%,
    rgba(6, 10, 20, .26) 62%,
    rgba(6, 10, 20, 0) 100%
  ) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  transition: background .28s ease, backdrop-filter .28s ease;
}

/* 文字一律用白色 + 阴影，深色和亮色图片上都能读 */
html.has-banner-text .navbar-container .logo-title,
html.has-banner-text .navbar-container .logo-title h1,
html.has-banner-text .navbar-container .navbar-list .navbar-item > a,
html.has-banner-text .navbar-container .navbar-list .navbar-item > a i {
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55), 0 0 12px rgba(0, 0, 0, .35);
}

/* 汉堡按钮：只换线条颜色，不动尺寸/定位，避免破坏三条线结构 */
html.has-banner-text .navbar-container .navbar-bar .navbar-bar-middle,
html.has-banner-text .navbar-container .navbar-bar .navbar-bar-middle::before,
html.has-banner-text .navbar-container .navbar-bar .navbar-bar-middle::after {
  background: #fff !important;
  text-shadow: none !important;
  box-shadow: 0 0 6px rgba(0, 0, 0, .45);
}

/* 当前项下划线用白色，保证可见 */
html.has-banner-text .navbar-container .navbar-list .navbar-item > a.active::after,
html.has-banner-text .navbar-container .navbar-list .navbar-item > a:hover::after {
  background: #fff !important;
}

/* 悬浮时不再整块变强调色，改成轻微提亮，避免和背景抢 */
html.has-banner-text .navbar-container .navbar-list .navbar-item > a:hover {
  color: #fff !important;
}

/* 下拉菜单保持主题配色，避免白字白底 */
html.has-banner-text .navbar-container .sub-menu,
html.has-banner-text .navbar-container .sub-menu a {
  color: var(--default-text-color) !important;
  text-shadow: none !important;
}

/* ==========================================================
   离开首页顶部后：恢复正常主题配色，并加实底色保证可读
   ========================================================== */
body:not(.has-banner-text) .navbar-container {
  background: var(--navbar-solid-bg) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.2) !important;
  backdrop-filter: blur(12px) saturate(1.2) !important;
}

:root {
  --navbar-solid-bg: rgba(255, 255, 255, .86);
}

html.dark {
  --navbar-solid-bg: rgba(22, 24, 30, .86);
}

/* ==========================================================
   首屏主视觉：标题 / 分隔线 / 副标题轮播
   ========================================================== */

.xb-hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0 22px;
  text-align: center;
  pointer-events: none;
}

/* 标题：细渐变 + 紧致投影，避免大字模糊阴影糊成一团 */
.xb-hero-title {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: .06em;
  text-indent: .06em;
  color: #fff;
  /* 只在底部带一点点冷调，避免整段字发灰 */
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 64%, #dbe6fa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* 紧贴的硬阴影 + 一层很淡的外扩，保证边缘锐利不糊 */
  filter: drop-shadow(0 1px 1px rgba(2, 6, 14, .72)) drop-shadow(0 3px 10px rgba(2, 6, 14, .38));
  opacity: 0;
  transform: translateY(14px);
  animation: xb-hero-in .9s cubic-bezier(.22, .68, .36, 1) .1s forwards;
}

/* 标题下方细线，两端淡出 */
.xb-hero-rule {
  display: block;
  width: 0;
  height: 1px;
  margin: 1.2rem 0 1.1rem;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95) 22%, rgba(255, 255, 255, .95) 78%, transparent);
  box-shadow: 0 1px 6px rgba(2, 6, 14, .45);
  animation: xb-hero-rule .9s cubic-bezier(.22, .68, .36, 1) .5s forwards;
}

/* 副标题：多条轮播，淡入上移 */
.xb-hero-subs {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 1.9em;
  width: 100%;
}

.xb-hero-sub {
  grid-area: 1 / 1;
  margin: 0;
  max-width: min(90vw, 46rem);
  font-size: clamp(1rem, 2vw, 1.24rem);
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: .16em;
  text-indent: .16em;
  color: rgba(255, 255, 255, .96);
  text-shadow: 0 1px 2px rgba(2, 6, 14, .7), 0 3px 14px rgba(2, 6, 14, .45);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.22, .68, .36, 1);
  will-change: opacity, transform;
}

.xb-hero-sub.is-active {
  opacity: 1;
  transform: translateY(0);
}

.xb-hero-sub.is-leaving {
  opacity: 0;
  transform: translateY(-10px);
}

@keyframes xb-hero-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes xb-hero-rule {
  from { width: 0; opacity: 0; }
  to { width: min(220px, 42vw); opacity: 1; }
}

@media (max-width: 600px) {
  .xb-hero-title { letter-spacing: .04em; text-indent: .04em; }
  .xb-hero-sub { letter-spacing: .08em; text-indent: .08em; }
}

@media (prefers-reduced-motion: reduce) {
  .xb-hero-title,
  .xb-hero-rule { animation: none; opacity: 1; transform: none; width: min(220px, 42vw); }
  .xb-hero-sub { transition: none; }
}

/* ==========================================================
   项目卡片：悬停浮出 QQ 群二维码
   ========================================================== */

.xb-card {
  position: relative;
  z-index: 6;
}

.xb-card:hover,
.xb-card:focus-within,
.xb-card.is-open {
  z-index: 40;
}

.xb-card-inner {
  cursor: pointer;
}

/* 卡片右侧的 QQ 提示，悬停时点亮 */
.xb-card-hint {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: .82rem;
  color: var(--third-text-color);
  background: var(--third-background-color);
  opacity: .55;
  transition: opacity .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}

.xb-card:hover .xb-card-hint,
.xb-card:focus-within .xb-card-hint,
.xb-card.is-open .xb-card-hint {
  opacity: 1;
  color: #fff;
  background: linear-gradient(135deg, #12B7F5, #0A84D6);
  transform: scale(1.04);
}

/* 浮层本体：跟随明暗主题 */
.xb-qq {
  position: absolute;
  right: 8px;
  top: calc(100% + 12px);
  z-index: 2;
  width: 208px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(16, 24, 40, .10);
  box-shadow:
    0 18px 44px rgba(16, 24, 40, .16),
    0 2px 8px rgba(16, 24, 40, .07);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(.96);
  transform-origin: top right;
  transition:
    opacity .22s ease,
    transform .26s cubic-bezier(.22, .68, .36, 1),
    visibility .22s;
}

html.dark .xb-qq {
  background: rgba(20, 24, 33, .95);
  border-color: rgba(255, 255, 255, .13);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, .55),
    0 2px 10px rgba(0, 0, 0, .35);
}

.xb-card:hover .xb-qq,
.xb-card:focus-within .xb-qq,
.xb-card.is-open .xb-qq {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* 顶部小箭头 */
.xb-qq::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 22px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #fff;
  border-left: 1px solid rgba(16, 24, 40, .10);
  border-top: 1px solid rgba(16, 24, 40, .10);
  transform: rotate(45deg);
}

html.dark .xb-qq::before {
  background: #141821;
  border-color: rgba(255, 255, 255, .13);
}

.xb-qq-head {
  padding: 2px 3px 10px;
}

.xb-qq-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xb-qq-meta b {
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--second-text-color);
  letter-spacing: .01em;
}

.xb-qq-meta small {
  font-size: .7rem;
  line-height: 1.4;
  color: var(--third-text-color);
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.xb-qq-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
  padding: 5px;
  border: 1px solid rgba(16, 24, 40, .08);
}

html.dark .xb-qq-img {
  border-color: rgba(255, 255, 255, .10);
}

.xb-qq-tip {
  margin: 9px 0 1px;
  font-size: .72rem;
  line-height: 1.4;
  text-align: center;
  letter-spacing: .1em;
  text-indent: .1em;
  color: var(--third-text-color);
}

/* 触屏：没有 hover，点击卡片展开浮层 */
@media (hover: none) {
  .xb-card:hover .xb-qq {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(.96);
  }
  .xb-card.is-open .xb-qq {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .xb-card-hint {
    display: none;
  }
  /* 窄屏把浮层收进屏内并居中 */
  .xb-qq {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
    transform-origin: top center;
  }
  .xb-qq::before {
    right: calc(50% - 5px);
  }
  .xb-qq-img {
    max-width: 220px;
    margin: 0 auto;
  }
}
