/* ============================================================
   styles.festival.css — 文石系统 · 节日/节气换肤层（最高优先级）
   由 theme.js 在 <html> 上挂 data-festival 属性驱动
   只改视觉（主色 / 点缀 / 装饰 / 问候），不动数据与布局结构
   调试：URL 加 ?festival=mid-autumn|national|off&term=白露|off
   ============================================================ */

/* ---------- 公共：装饰与问候元素 ---------- */
.festival-decor {
  position: absolute;
  right: 4px;
  bottom: 64px;
  width: 118px;
  height: auto;
  pointer-events: none;
  z-index: 0;
  opacity: 0.96;
  user-select: none;
  -webkit-mask-image: radial-gradient(72% 72% at 50% 50%, #000 42%, rgba(0, 0, 0, 0) 74%);
  mask-image: radial-gradient(72% 72% at 50% 50%, #000 42%, rgba(0, 0, 0, 0) 74%);
}

.festival-topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}

.festival-topbar-chip .fchip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.term-chip {
  margin: 8px 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f7f3e8;
  border: 1px solid #e9dfc6;
  color: #8a6d2f;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-chip .term-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c9a24b;
  flex: none;
}

/* 顶栏节日化：丝绸底图铺进顶栏，金色诗句内嵌（替代独立横幅条） */
.festival-topbar-slogan {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 22px;
  text-align: center;
  font-family: "STZhongsong", "STSong", "Noto Serif SC", "SimSun", serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 6px;
  color: rgba(244, 220, 150, 0.95);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 1360px) {
  .festival-topbar-slogan {
    display: none;
  }
}

html[data-festival] .topbar,
html[data-term] .topbar {
  overflow: visible; /* 下拉菜单会伸出顶栏之外，不能裁剪；背景图由 ::before inset:0 自行约束 */
  border-bottom-color: rgba(201, 162, 75, 0.35);
}

html[data-festival] .topbar > *,
html[data-term] .topbar > * {
  position: relative;
  z-index: 1;
}

html[data-festival] .topbar::before,
html[data-term] .topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* 带图节气：晨雾底图 + 左侧深绿 scrim 保证文字可读 */
html[data-term] .topbar::before {
  background-image: linear-gradient(90deg, rgba(24, 38, 30, 0.58) 0%, rgba(24, 38, 30, 0.28) 42%, rgba(24, 38, 30, 0) 68%), var(--term-bg, none);
}

html[data-festival] .topbar h1,
html[data-festival] .topbar h1#viewTitle,
html[data-term] .topbar h1,
html[data-term] .topbar h1#viewTitle {
  color: #f5eed9 !important;
}

html[data-festival] .topbar .topbar-crumb,
html[data-term] .topbar .topbar-crumb {
  color: rgba(240, 228, 190, 0.72) !important;
}

html[data-festival] .topbar .topbar-search,
html[data-term] .topbar .topbar-search {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.78);
}

html[data-festival] .topbar .topbar-search kbd,
html[data-term] .topbar .topbar-search kbd {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.72);
}

html[data-festival] .topbar .topbar-search:hover,
html[data-term] .topbar .topbar-search:hover {
  border-color: rgba(255, 255, 255, 0.42);
  color: #fff;
}

/* 带图节气侧栏：白→晨雾绿→深露绿晕染，装饰图融入 */
html[data-term] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f2f5f0 55%, var(--term-tint, #1a2a22) 100%) !important;
}

/* 秋分：暖金秋色晕染（中段改暖米，避开绿灰） */
html[data-term="秋分"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f7f2e7 55%, #6e4f28 100%) !important;
}

/* 寒露：冷青晕染 */
html[data-term="寒露"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #edf2f1 55%, #243a40 100%) !important;
}

/* 霜降：暖红晕染 */
html[data-term="霜降"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f7ece7 55%, #5a2318 100%) !important;
}

/* 立冬：冷灰蓝晕染 */
html[data-term="立冬"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #eef1f4 55%, #3a4a58 100%) !important;
}

/* 冬至：深夜蓝晕染 */
html[data-term="冬至"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #eaeef5 55%, #1c2a45 100%) !important;
}

html[data-term] .festival-decor {
  width: 168px;
  right: 2px;
  bottom: 58px;
  opacity: 0.94;
}

html[data-term] .festival-topbar-slogan {
  color: #f2f7ef;
  text-shadow: 0 1px 10px rgba(12, 22, 16, 0.6);
}

/* 带图节气双行标语：主行诗句 + 副行今日问候 */
.term-slogan {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  line-height: 1.25;
}

.term-slogan .slogan-main {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 7px;
  color: #fdf8e7;
  text-shadow: 0 1px 10px rgba(12, 22, 16, 0.65);
}

.term-slogan .slogan-sub {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 3px;
  color: rgba(242, 247, 239, 0.78);
  text-shadow: 0 1px 6px rgba(12, 22, 16, 0.55);
}

@media (max-width: 1360px) {
  .term-slogan .slogan-sub {
    display: none;
  }
}

html[data-festival="mid-autumn"] .topbar {
  background: linear-gradient(90deg, #0c1124 0%, #141b38 52%, #1c2444 100%);
}

html[data-festival="mid-autumn"] .topbar::before {
  background-image: linear-gradient(90deg, rgba(12, 17, 36, 0.92) 0%, rgba(12, 17, 36, 0.5) 52%, rgba(12, 17, 36, 0.16) 100%), url("./assets/banner-mid-autumn2.png");
}

html[data-festival="national"] .topbar {
  background: linear-gradient(90deg, #2a0705 0%, #3d0d09 52%, #57150e 100%);
}

html[data-festival="national"] .topbar::before {
  background-image: linear-gradient(90deg, rgba(42, 7, 5, 0.92) 0%, rgba(42, 7, 5, 0.52) 52%, rgba(42, 7, 5, 0.18) 100%), url("./assets/banner-national2.png");
}

@media (max-width: 1180px) {
  .festival-topbar-chip {
    display: none;
  }
}

@media (max-width: 960px) {
  .festival-decor {
    width: 84px;
    bottom: 96px;
    opacity: 0.5;
  }
}

/* ---------- 中秋 · 金月流云 ---------- */
html[data-festival="mid-autumn"] {
  --theme-primary: #b3862c;
  --theme-primary-hover: #c69a41;
  --theme-primary-active: #946f21;
  --theme-primary-soft: #faf3e0;
  --accent: #b3862c;
  --accent-strong: #946f21;
}

html[data-festival="mid-autumn"] .brand-mark {
  background: linear-gradient(135deg, #c9a24b, #e2c275) !important;
  box-shadow: 0 4px 10px rgba(179, 134, 44, 0.28) !important;
}

html[data-festival="mid-autumn"] .primary-btn {
  box-shadow: 0 2px 6px rgba(179, 134, 44, 0.26) !important;
}

html[data-festival="mid-autumn"] .primary-btn:hover {
  box-shadow: 0 4px 10px rgba(179, 134, 44, 0.32) !important;
}

html[data-festival="mid-autumn"] .festival-topbar-chip {
  background: #faf3e0;
  color: #8a6d2f;
  border: 1px solid #eadfbc;
}

html[data-festival="mid-autumn"] .term-chip {
  background: #faf6ea;
  border-color: #eadfbc;
  color: #8a6d2f;
}

html[data-festival="mid-autumn"] .term-chip .term-dot {
  background: #c9a24b;
}

html[data-festival="mid-autumn"] .user-avatar-btn {
  background: linear-gradient(135deg, #c9a24b, #e2c275);
  border-color: rgba(179, 134, 44, 0.4);
}

/* 中秋侧栏：底部晕染成夜幕，月亮插画经蒙版融入（不再是突兀卡片） */
html[data-festival="mid-autumn"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f6f3ec 55%, #2a3358 86%, #131a38 100%) !important;
}

html[data-festival="mid-autumn"] .festival-decor {
  width: 196px;
  right: -10px;
  bottom: -12px;
  border-radius: 0;
  box-shadow: none;
}

/* 国庆侧栏：底部晕染成深红，灯笼插画同样融入 */
html[data-festival="national"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f9f2ee 55%, #5c1712 86%, #2e0a07 100%) !important;
}

html[data-festival="national"] .festival-decor {
  width: 170px;
  right: -8px;
  bottom: -10px;
  border-radius: 0;
  box-shadow: none;
}

/* ---------- 国庆 · 红金 ---------- */
html[data-festival="national"] {
  --theme-primary: #b93028;
  --theme-primary-hover: #cf443b;
  --theme-primary-active: #97241e;
  --theme-primary-soft: #fdeeed;
  --accent: #b93028;
  --accent-strong: #97241e;
}

html[data-festival="national"] .brand-mark {
  background: linear-gradient(135deg, #b93028, #d4a017) !important;
  box-shadow: 0 4px 10px rgba(185, 48, 40, 0.25) !important;
}

html[data-festival="national"] .primary-btn {
  box-shadow: 0 2px 6px rgba(185, 48, 40, 0.24) !important;
}

html[data-festival="national"] .primary-btn:hover {
  box-shadow: 0 4px 10px rgba(185, 48, 40, 0.3) !important;
}

html[data-festival="national"] .festival-topbar-chip {
  background: #fdecec;
  color: #b93028;
  border: 1px solid #f3c9c5;
}

html[data-festival="national"] .term-chip {
  background: #fdf4f3;
  border-color: #f3c9c5;
  color: #b93028;
}

html[data-festival="national"] .term-chip .term-dot {
  background: #d4a017;
}

html[data-festival="national"] .user-avatar-btn {
  background: linear-gradient(135deg, #b93028, #d4a017);
  border-color: rgba(185, 48, 40, 0.4);
}

/* 品牌行节日小图标（月亮/灯笼，跟在「文石系统」文字后） */
.festival-brand-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  margin-left: -4px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.22));
  animation: festival-icon-float 3.6s ease-in-out infinite;
}

@keyframes festival-icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .festival-brand-icon { animation: none; }
}
