/*
 * 产物查看层样式：可点路径样式 + 查看弹层。
 * 依赖 tokens.css 的 --z-toast（1000）与深/浅色主题变量，两者都已在整站引入。
 * 只在 .da-* 命名空间内生效，绝不影响上游既有类。
 */

/* ── 可点路径 ─────────────────────────────────────────────────────────────── */
/* 不改变原文字体/字号（.md-inline 与 .card__title code 各有既有样式），
   只加「可交互」的信号：虚线下划线 + 手型 + 悬停底色。 */
.da-link {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  border-radius: 3px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.da-link:hover {
  background: color-mix(in srgb, var(--accent, #3b82f6) 16%, transparent);
}
.da-link:focus-visible {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 1px;
}
/* 触屏：给足热区，避免行内小字点不中 */
@media (pointer: coarse) {
  .da-link {
    padding: 1px 2px;
  }
}

/* ── 查看弹层 ─────────────────────────────────────────────────────────────── */
.da-ov {
  position: fixed;
  inset: 0;
  z-index: var(--z-toast, 1000);
  display: none;
}
.da-ov.is-open {
  display: block;
}
.da-ov__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.da-ov__panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
  color: var(--fg, #111);
}

/* 桌面：居中大卡片；手机：满屏（.dm-mobile 由 mobile.js 打在 <html> 上） */
@media (min-width: 769px) and (pointer: fine) {
  .da-ov__panel {
    inset: 4vh 6vw;
    border-radius: 12px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
  }
}

.da-ov__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border, rgba(128, 128, 128, 0.25));
  flex: 0 0 auto;
}
.da-ov__titlewrap {
  min-width: 0;
  flex: 1 1 auto;
}
.da-ov__name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.da-ov__path {
  font-size: 11px;
  opacity: 0.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl; /* 长路径优先露出文件名一侧 */
  text-align: left;
}
.da-ov__acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.da-btn {
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border, rgba(128, 128, 128, 0.3));
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.da-btn:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.da-btn--x {
  padding: 7px 9px;
}
/* 手机上「复制路径/原始/下载」三个文字按钮太挤：只留图标级宽度 */
@media (max-width: 480px) {
  .da-btn[data-act='raw'] {
    display: none;
  }
}

.da-ov__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.da-msg {
  padding: 18px 14px;
  font-size: 13px;
  opacity: 0.75;
}
.da-msg--err {
  color: var(--danger, #d33);
  opacity: 1;
  white-space: pre-wrap;
}
.da-meta {
  padding: 8px 14px;
  font-size: 11px;
  opacity: 0.6;
  border-bottom: 1px solid var(--border, rgba(128, 128, 128, 0.18));
  position: sticky;
  top: 0;
  background: var(--bg, #fff);
}
.da-pre {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
}
.da-pre code {
  font: inherit;
}

.da-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 14px auto;
}

.da-list {
  display: flex;
  flex-direction: column;
}
.da-row {
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--border, rgba(128, 128, 128, 0.14));
  background: transparent;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.da-row:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.da-row.is-dir {
  font-weight: 600;
}
