/* ============================================================
   朝圣仙门 · 仙剑 UI 细节层（sword-ui）
   - 金线、剑光、菱形导航、图框角饰、卡片角标
   - 与 daynight.css 叠加：夜间反相时整体跟随 UI 滤镜，无需单独改色
   - 动画均可被 prefers-reduced-motion 关闭
   ============================================================ */

body.sect {
  --sword-gold: var(--gold-deep, #9a7428);
  --sword-glow: rgba(154, 116, 40, .22);
}

/* ---------- 左侧玉简 / 品牌 ---------- */
body.sect .sidebar {
  box-shadow: inset -2px 0 0 var(--sword-glow), inset -5px 0 0 rgba(154, 116, 40, .06);
}
body.sect .brand-txt {
  background-image: linear-gradient(90deg, var(--sword-gold), transparent 82%);
  background-size: 100% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
}
body.sect .brand-seal::before {
  content: "";
  position: absolute;
  pointer-events: none;
  right: -6px;
  top: 6px;
  bottom: -11px;
  width: 1px;
  background: linear-gradient(var(--sword-gold), var(--sword-glow), transparent);
}
body.sect .nav-item:not(.active)::before {
  content: "";
  position: absolute;
  pointer-events: none;
  left: 2px;
  top: 50%;
  width: 5px;
  height: 5px;
  border: 1px solid var(--sword-gold);
  opacity: .55;
  transform: translateY(-50%) rotate(45deg);
}
body.sect .nav-item:hover {
  background-image: linear-gradient(105deg, transparent 15%, var(--sword-glow) 48%, transparent 72%);
  background-size: 220% 100%;
  animation: sword-sheen .7s ease-out both;
}
body.sect .nav-item.active {
  border-color: var(--sword-gold);
  box-shadow: inset 2px 0 0 var(--sword-gold), 0 0 12px var(--sword-glow);
}
body.sect .topbar::after {
  background: linear-gradient(90deg, transparent, var(--sword-gold) 48%, var(--sword-glow) 54%, transparent);
  pointer-events: none;
}

/* ---------- 按钮剑光 ---------- */
body.sect :is(.sect-btn, .btn, .mini-btn, .hud-icon-btn) {
  box-shadow: inset 0 1px 0 var(--sword-glow);
}
body.sect :is(.sect-btn, .btn, .mini-btn, .hud-icon-btn):hover {
  outline: 1px solid var(--sword-glow);
  outline-offset: -2px;
  animation: sword-edge .7s ease-out both;
}
body.sect :is(.sect-btn, .btn, .mini-btn, .hud-icon-btn):active {
  filter: brightness(.97);
}
@keyframes sword-edge {
  from { box-shadow: inset 8px 1px 6px -7px var(--sword-gold); }
  to   { box-shadow: inset -8px 1px 6px -7px var(--sword-gold); }
}
@keyframes sword-sheen {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

/* ---------- 山门全图：四角剑纹（保留原有整圈内框） ---------- */
body.sect .sect-map-frame::after {
  background:
    linear-gradient(var(--sword-gold), var(--sword-gold)) left top / 19px 1px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) left top / 1px 19px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) right top / 19px 1px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) right top / 1px 19px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) left bottom / 19px 1px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) left bottom / 1px 19px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) right bottom / 19px 1px no-repeat,
    linear-gradient(var(--sword-gold), var(--sword-gold)) right bottom / 1px 19px no-repeat;
}
body.sect .sect-map-frame::before {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  right: 12%;
  top: 17%;
  width: 17%;
  height: 7%;
  opacity: .22;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 30'%3E%3Cpath fill='%235e513a' d='M5 15 142 11 177 15 142 19 5 15zm128-9 3 18 4-1-2-17zm-14 7-18-5 2 3 14 4z'/%3E%3Cpath stroke='%239a7428' stroke-width='1' d='M15 15h155'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: rotate(-13deg);
}
body.sect .sect-map-heading {
  background: linear-gradient(90deg, var(--sword-gold), var(--sword-glow) 65%, transparent) left bottom / 84% 1px no-repeat;
}
body.sect .sect-node:hover .sect-node-plaque,
body.sect .sect-node:focus-visible .sect-node-plaque {
  box-shadow: 0 0 12px var(--sword-glow), 0 7px 16px -8px rgba(20, 20, 15, .65);
}

/* ---------- 卡片角标 ---------- */
body.sect .sect-card::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--sword-gold);
  border-left: 1px solid var(--sword-gold);
  opacity: .55;
  pointer-events: none;
}
body.sect :is(.sect-card, .hall-hall-card, .hall-online-card, .hall-about-card):hover {
  border-color: var(--sword-gold);
  outline: 1px solid var(--sword-glow);
  outline-offset: -3px;
}

/* ---------- 飞剑 / 剑星 / 远处剑光 ---------- */
body.sect .sword-flight,
body.sect .sword-spark,
body.sect .sword-ambient {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}
body.sect .sword-flight {
  left: var(--sword-x);
  top: var(--sword-y);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--sword-gold), var(--sword-glow), transparent);
  filter: drop-shadow(0 0 4px var(--sword-gold));
  transform-origin: left center;
  animation: sword-arrive .55s ease-in both;
}
body.sect .sword-spark {
  left: var(--sword-x);
  top: var(--sword-y);
  width: 20px;
  height: 20px;
  margin: -10px;
  background:
    radial-gradient(circle, var(--sword-gold) 0 2px, transparent 3px),
    radial-gradient(circle at 20% 25%, var(--sword-gold) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 70%, var(--sword-gold) 0 1px, transparent 2px);
  animation: sword-spark .5s .5s ease-out both;
}
body.sect .toast.sword-unfold:not(.out) {
  animation: sword-unfold .42s .18s ease-out both;
  transform-origin: right center;
}
body.sect .sword-ambient {
  left: 78vw;
  top: 9vh;
  width: 62px;
  height: 2px;
  opacity: 0;
  background: linear-gradient(90deg, var(--sword-gold), transparent);
  animation: sword-distant 3.2s linear both;
}
@keyframes sword-arrive {
  from { transform: translateX(var(--sword-distance)) scaleX(1.4); opacity: 0; }
  20%  { opacity: .85; }
  to   { transform: translateX(0) scaleX(.45); opacity: 0; }
}
@keyframes sword-spark {
  from { opacity: 1; transform: scale(.2); }
  to   { opacity: 0; transform: scale(2.1); }
}
@keyframes sword-unfold {
  from { opacity: 0; transform: translateX(10px) scaleX(.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes sword-distant {
  10%  { opacity: .24; }
  85%  { opacity: .24; }
  to   { opacity: 0; transform: translate(-55vw, 15vh) rotate(-12deg); }
}

/* ---------- 移动端与无障碍 ---------- */
@media (max-width: 720px) {
  body.sect .sect-map-frame::before,
  body.sect .sword-ambient { display: none; }
  body.sect .sect-map-frame::after {
    background-size: 11px 1px, 1px 11px, 11px 1px, 1px 11px,
      11px 1px, 1px 11px, 11px 1px, 1px 11px;
  }
  body.sect .sword-flight { width: 55px; }
}
@media (prefers-reduced-motion: reduce) {
  body.sect .nav-item:hover,
  body.sect :is(.sect-btn, .btn, .mini-btn, .hud-icon-btn):hover,
  body.sect .toast.sword-unfold:not(.out) { animation: none; }
  body.sect .sword-flight,
  body.sect .sword-spark,
  body.sect .sword-ambient { display: none; animation: none; }
}
