/* ==========================================================================
   PHOTIST · 探索产品页「产品目录 / 产品规格书」轻量级悬浮资料面板
   --------------------------------------------------------------------------
   设计原则：
   - 从对应按钮下方就地展开（位置由脚本按按钮区域计算），不居中、不遮罩
   - position: fixed 覆盖内容，不参与文档流，不推动页面、不改变布局
   - 暖白 / 浅米色背景，柔和阴影与适度圆角；鹅黄 #FFE58F 仅用于选中态与下载按钮
   - 展开 / 收起为克制的淡入 + 轻微位移，无弹跳
   - 仅面板内部滚动；不锁定、不重置页面浏览位置
   仅作用于 index.html 的 .matpop，不影响其他页面与全站样式。
   ========================================================================== */

.matpop {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
}
.matpop--specs { width: 600px; }
.matpop[hidden] { display: none !important; }

.matpop-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(76vh, 620px);
  overflow: hidden;
  background: #FFFDF8;
  border-radius: 16px;
  box-shadow: 0 18px 44px -18px rgba(62, 48, 34, .24),
              0 3px 10px -4px rgba(62, 48, 34, .08);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}
.matpop.is-open .matpop-card {
  opacity: 1;
  transform: translateY(0);
}

/* ---- 头部：标题 + 右上角关闭按钮，内部滚动时保持可见 ---- */
.matpop-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #F0ECE5;
}
.matpop-title {
  margin: 0;
  color: #3E332A;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.4;
}
.matpop-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9A8875;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.matpop-close:hover { background: #F5F0E6; color: #3E332A; }
.matpop-close:focus-visible { outline: 2px solid #C69A65; outline-offset: 2px; }

/* ---- 内容区：只有这里滚动，滚动不外溢到背景页面 ---- */
.matpop-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 24px 22px;
}

/* ---- 文件行：左侧名称 + 右侧下载按钮 ---- */
.matpop-filelist { display: grid; }
.matpop-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 2px;
  border-bottom: 1px solid #F0ECE5;
  text-decoration: none;
  color: inherit;
}
.matpop-file:last-child { border-bottom: 0; }
.matpop-file-name {
  color: #3E332A;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
  word-break: break-word;
}
.matpop-dl {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #FFE58F;
  border-radius: 999px;
  background: #FFE58F;
  color: #3B3024;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.matpop-file:hover .matpop-dl { background: #FFDB70; border-color: #FFDB70; }
.matpop-dl:hover { transform: translateY(-1px); }

/* ---- 型号选择：沿用官网中性色 chip，选中态鹅黄；整齐网格排列 ---- */
.matpop-models {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 6px 0 10px;
}
.matpop-chip {
  min-width: 0;
  border: 1px solid #DCD4C8;
  background: #fff;
  color: #66594C;
  border-radius: 999px;
  padding: 9px 4px;
  font: 600 13px var(--font-sans, sans-serif);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease,
              color .2s ease, box-shadow .2s ease;
}
.matpop-chip:hover { border-color: #B9A88F; box-shadow: 0 2px 8px rgba(62, 48, 34, .06); }
.matpop-chip.is-active { background: #FFE58F; border-color: #FFE58F; color: #3B3024; }
.matpop-chip:focus-visible { outline: 2px solid #C69A65; outline-offset: 2px; }

/* 型号文件区：初始不选中任何型号，选择后仅显示对应文件 */
.matpop-panel[hidden] { display: none !important; }
.matpop-empty {
  margin: 0;
  padding: 14px 2px;
  color: #9A8F83;
  font-size: 13px;
  line-height: 1.7;
}

/* ---- 手机端：宽度自适应、左右留边、型号换行、内部滚动 ---- */
@media (max-width: 640px) {
  .matpop,
  .matpop--specs {
    width: calc(100vw - 24px);
    max-width: none;
  }
  .matpop-card {
    max-height: min(78vh, 620px);
    border-radius: 14px;
  }
  .matpop-head { padding: 16px 18px 12px; }
  .matpop-title { font-size: 17px; }
  .matpop-close { width: 34px; height: 34px; }
  .matpop-body { padding: 6px 18px 18px; }
  .matpop-models { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .matpop-chip { padding: 8px 4px; font-size: 12.5px; }
  .matpop-file { gap: 12px; padding: 12px 0; }
  .matpop-file-name { font-size: 14px; }
  .matpop-dl { min-width: 76px; height: 34px; padding: 0 12px; font-size: 12px; }
}

@media (max-width: 360px) {
  .matpop-models { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 尊重系统「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  .matpop-card { opacity: 1; transform: none; transition: none; }
}
