/* 全屏菜单（参考 freshman.tv：纸面案卷索引页）—— DOM 由 js/menu.js 注入 */

/* ── 触发按钮 ── */
.dw-menu-btn {
  position: fixed;
  right: calc(var(--hud-pad) + 84px);
  top: 70px;
  z-index: 60;
  appearance: none;
  border: 0;
  background: none;
  padding: 3px 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.25s ease;
}
.dw-menu-btn:hover { color: var(--accent); }

/* ── 覆盖层：纸面 ── */
.dw-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #c7c4bc;
  display: flex;
  flex-direction: column;
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path 0.6s cubic-bezier(0.76, 0, 0.24, 1), visibility 0s linear 0.6s;
  overflow: hidden;
}
.dw-menu.is-open {
  clip-path: inset(0 0 0% 0);
  visibility: visible;
  transition: clip-path 0.6s cubic-bezier(0.76, 0, 0.24, 1);
}
/* 纸张噪点 */
.dw-menu::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.14;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* ── 头部 ── */
.dw-menu__head {
  flex: none;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px 14px;
}
.dw-menu__langs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(20, 20, 20, 0.55);
}
.dw-menu__langs button {
  appearance: none;
  border: 0;
  background: none;
  padding: 3px 5px;
  font: inherit;
  color: rgba(20, 20, 20, 0.55);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}
.dw-menu__langs button:hover { color: #141414; }
.dw-menu__langs button.is-active { color: #141414; }
/* 当前语言：手绘红圈 */
.dw-menu__langs button .ring {
  position: absolute;
  inset: -5px -7px;
  pointer-events: none;
  opacity: 0;
}
.dw-menu__langs button.is-active .ring { opacity: 1; }
.dw-menu__langs button .ring path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.dw-menu__brand {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  user-select: none;
}
/* 菜单里的签名 logo：纸面用深红，开启时描画 */
.dw-menu__brand .sig-logo { width: 56px; }
.dw-menu__brand .sig-logo path { stroke: #c81e1e; stroke-dashoffset: 101; }
.dw-menu.is-open .dw-menu__brand .sig-logo path { animation: sigDraw 0.4s ease-out 0.35s both; }
.dw-menu.is-open .dw-menu__brand .sig-logo path:nth-child(2) { animation-delay: 0.7s; }
.dw-menu.is-open .dw-menu__brand .sig-logo path:nth-child(3) { animation-delay: 1.05s; animation-duration: 0.3s; }
@media (prefers-reduced-motion: reduce) {
  .dw-menu__brand .sig-logo path { stroke-dashoffset: 0; animation: none !important; }
}
.dw-menu__close {
  appearance: none;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(20, 20, 20, 0.7);
  cursor: pointer;
  transition: color 0.2s ease;
}
.dw-menu__close:hover { color: var(--accent); }
.dw-menu__close i {
  font-style: normal;
  color: var(--accent);
  margin-right: 6px;
}

/* ── 条目 ── */
.dw-menu__list {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.dw-menu__row {
  position: relative;
  border-bottom: 1px dashed rgba(20, 20, 20, 0.28);
  padding: 0.6vh 40px;
  cursor: pointer;
}
.dw-menu__row:first-child { border-top: 1px dashed rgba(20, 20, 20, 0.28); }
/* hover：黑条横贯整行（freshman 式），从左扫入 */
.dw-menu__row::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #141414;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.38s cubic-bezier(0.65, 0, 0.35, 1);
}
.dw-menu__row:hover::before { transform: scaleX(1); }
.dw-menu__row:hover .dw-menu__item { color: #e9e6df; }
.dw-menu__item {
  position: relative;
  z-index: 1;
  display: inline-block;
  max-width: 100%;
  padding: 0 0.18em 0.02em 0.14em;
  text-decoration: none;
  font-family: 'Baskerville', Georgia, serif;
  font-weight: 600;
  font-size: clamp(44px, 11.5vh, 104px);
  line-height: 1.04;
  letter-spacing: 0.005em;
  color: #161616;
  white-space: nowrap;
  opacity: 0;
  translate: 0 30px;
}
.dw-menu.is-open .dw-menu__item {
  opacity: 1;
  translate: 0 0;
  transition: opacity 0.5s ease var(--d, 0.15s), translate 0.5s ease var(--d, 0.15s), color 0.25s ease;
}
/* 交错散排 */
.dw-menu__row:nth-child(2) .dw-menu__item { margin-left: 13%; }
.dw-menu__row:nth-child(3) .dw-menu__item { margin-left: 39%; }
.dw-menu__row:nth-child(4) .dw-menu__item { margin-left: 7%; }
.dw-menu__row:nth-child(5) .dw-menu__item { margin-left: 27%; }
.dw-menu__row:nth-child(6) .dw-menu__item { margin-left: 48%; }

.dw-menu__item .w {
  position: relative;
  display: inline-block;
}

/* 中文小注记（字前眉标） */
.dw-menu__item .zh {
  position: absolute;
  left: 0.16em;
  top: -0.9em;
  padding: 0 6px 0 8px;
  background: #c7c4bc;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(20, 20, 20, 0.5);
}
/* 计数上标（freshman 的 (39) 式） */
.dw-menu__item sup {
  font-family: var(--font-mono);
  font-size: 0.16em;
  letter-spacing: 0.1em;
  color: var(--accent);
  vertical-align: 2.2em;
  margin-left: 0.4em;
}

/* 红笔涂鸦：hover 时钢笔现场画出，移开倒放收回 */
.dw-menu__scribble {
  position: absolute;
  right: 0.02em;
  top: 15%;
  width: 1.65em;
  height: 78%;
  pointer-events: none;
  overflow: visible;
}
.dw-menu__scribble path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100 102;
  stroke-dashoffset: 101;
  transition: stroke-dashoffset 0.3s ease-in;
}
.dw-menu__row:hover .dw-menu__scribble path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.45s ease-out 0.16s;
}
.dw-menu__row:hover .dw-menu__scribble path:nth-child(2) {
  transition-delay: 0.5s;
  transition-duration: 0.28s;
}

/* ── 底部 ── */
.dw-menu__foot {
  flex: none;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 40px 22px;
  font-family: var(--font-mono);
  color: rgba(20, 20, 20, 0.72);
}
.dw-menu__foot-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  letter-spacing: 0.14em;
}
.dw-menu__foot-col small {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(20, 20, 20, 0.45);
}
.dw-menu__foot-col.is-right { text-align: right; }
.dw-menu__foot-col.is-center { text-align: center; }
.dw-menu__foot .dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: 1px;
  animation: dwMenuPulse 2.2s ease-in-out infinite;
}
@keyframes dwMenuPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (max-width: 860px) {
  .dw-menu-btn { right: calc(var(--hud-pad) + 66px); top: 52px; }
  .dw-menu__head { padding: 18px 18px 10px; }
  .dw-menu__row { padding: 0.6vh 18px; }
  .dw-menu__item { font-size: clamp(34px, 7.4vh, 60px); }
  .dw-menu__row:nth-child(n) .dw-menu__item { margin-left: 0; }
  .dw-menu__foot { padding: 12px 18px 18px; }
  .dw-menu__foot-col.is-center { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dw-menu { transition: none; }
  .dw-menu__item { transition: none !important; opacity: 1; translate: 0 0; }
  .dw-menu__row::before { transition: none; }
  .dw-menu__scribble path { transition: none !important; }
  .dw-menu__foot .dot { animation: none; }
}
