/* ==========================================================================
  1. 自定义图片边框
========================================================================== */
/* 只有带上 .card-img 类的图片才会应用此样式 */
.md-content img.card-img {
  /* 图片圆角 */
  border-radius: 17px;
  
  /* 核心优化 1：双层边框感（利用 border 和 box-shadow 的首层结合） */
  /* 这一层让边缘多了一道极细的深色收边线，哪怕图片是纯白也能瞬间与背景剥离 */
  border: 1px solid rgba(0, 0, 0, 0.12); 
  
  /* 核心优化 2：多层阴影组合 */
  /* 第一层：紧贴图片边缘的硬阴影，负责勾勒清晰轮廓 */
  /* 第二层：向外扩散的软阴影，负责营造下方的物理环境光，拉开空间距离 */
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.05), 
    0 8px 24px rgba(0, 0, 0, 0.06);
  
  /* 保持平滑过渡 */
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 鼠标悬停：让这种“分明感”在交互时更加生动 */
.md-content img.card-img:hover {
  transform: translateY(-3px); 
  border-color: rgba(0, 0, 0, 0.18); /* 悬停时边缘更清晰 */
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.06), 
    0 16px 32px rgba(0, 0, 0, 0.1); /* 阴影范围扩大，空间感拉满 */
}



/* ==========================================================================
  2. 点击图片放大查看-开始
========================================================================== */
/* 2.1 基础状态：文章内的原图 */
.md-content img {
  cursor: zoom-in;
  transform-origin: center center !important;
  will-change: transform;
  transition: 
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), 
    box-shadow 0.4s ease,
    z-index 0s 0.4s;
}

/* 2.2 激活状态：居中放大（支持滚轮缩放与拖拽） */
.md-content img.zoomed {
  cursor: grab; /* 提示用户可以拖拽 */
  outline: none;
  position: relative !important;
  z-index: 9999 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  /* 滚轮缩放和拖拽时，10毫秒的极短过渡，既能消除锯齿又能保证零延迟跟手 */
  transition: transform 0.01s linear, box-shadow 0.4s ease; 
  user-select: none;
  -webkit-user-drag: none; /* 禁用浏览器自带的图片拖拽阴影 */
}

.md-content img.zoomed:active {
  cursor: grabbing; /* 正在拖拽时的掌心紧握状态 */
}

/* 2.3 背景暗化遮罩 */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  z-index: 9998;
  pointer-events: none;
  transition: background-color 0.35s ease, backdrop-filter 0.35s ease, opacity 0.35s ease;
  opacity: 0;
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

/* 暗黑模式 */
[data-md-color-scheme="slate"] .lightbox-overlay.active {
  background-color: rgba(0, 0, 0, 0.85);
}
