/* ==========================================================================
   NZEP 资料库 · assets/gallery.css —— 图库页（gallery.html）专用样式
   --------------------------------------------------------------------------
   为什么不写进 nzep.css：那一份是全站共用的**基础样式**，改了所有页面都会受影响
   （而且它是 GBK 编码的，往里加 UTF-8 中文注释会把整个文件搅乱）。
   所以图库这一页的样式全部放这里，只被 gallery.html 引用。

   版式：瀑布流（CSS multi-column，纯 CSS，没有 JS 测高），
   卡片的图片按上传时记下的宽高算 aspect-ratio —— 图还没加载时位置就是对的，
   加载完不会把下面的卡片顶下去（这是瀑布流最容易被用户骂的"跳一下"）。

   手机（≤767px）：两列；平板：三列；宽屏：四列。
   所有可点元素不小于 40×40（用户在手机上点得到）。
   ========================================================================== */

/* ------------------------------------------------------------- 页头与工具条 */
.g-lede { max-width: 46rem; }

.g-tools {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin: .9rem 0 .2rem;
}
.g-search { display: flex; gap: .4rem; flex: 1 1 16rem; min-width: 0; }
.g-search input {
  flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 .6rem;
  font-family: var(--sans); font-size: .84rem; color: var(--text);
  background: #fff; border: 1px solid var(--border-soft); border-radius: 6px; outline: none;
}
.g-search input:focus { border-color: #3366cc; box-shadow: 0 0 0 2px rgba(51,102,204,.15); }
.g-tools .w-btn { min-height: 40px; }

.g-hint { font-size: .76rem; color: var(--text-3); margin: .35rem 0 .9rem; }
.g-hint b { color: var(--text-2); }

/* ------------------------------------------------------------- 上传面板 */
.g-box {
  border: 1px solid var(--border-soft); background: var(--bg-subtle);
  border-radius: 10px; padding: .8rem .85rem; margin: .2rem 0 1.1rem;
}
.g-box.hide { display: none; }
.g-box .row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.g-box input[type="text"], .g-box textarea {
  width: 100%; box-sizing: border-box; font-family: var(--sans); font-size: .84rem;
  color: var(--text); background: #fff; border: 1px solid var(--border-soft);
  border-radius: 6px; padding: .5rem .6rem; outline: none; min-height: 40px;
}
.g-box textarea { min-height: 64px; resize: vertical; line-height: 1.6; }
.g-box input[type="text"]:focus, .g-box textarea:focus {
  border-color: #3366cc; box-shadow: 0 0 0 2px rgba(51,102,204,.15);
}
.g-box .field { margin: 0 0 .5rem; }
.g-box .label { display: block; font-size: .76rem; color: var(--text-3); margin: 0 0 .25rem; }
.g-box .ops { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .55rem; }
.g-box .ops .w-btn { min-height: 40px; }
.g-box .sp { flex: 1 1 auto; }
.g-pick { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.g-pick .pv {
  width: 84px; height: 84px; flex: 0 0 auto; border: 1px solid var(--border-soft);
  border-radius: 8px; background: var(--bg-alt); overflow: hidden;
}
.g-pick .pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-pick .pv.empty { display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: var(--text-3); text-align: center; line-height: 1.3; }

/* ------------------------------------------------------------- 瀑布流 */
.g-grid {
  /* 列宽固定、列数随屏宽变：这是 CSS 版瀑布流（column-count 走的是列高优先，长图会排得难看），
     用 column-width 让浏览器自己决定列数，窄屏自然变成一列或两列。 */
  column-width: 15rem; column-gap: 12px; margin: .2rem 0 1rem;
}
.g-card {
  break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid;
  display: block; margin: 0 0 12px; border: 1px solid var(--border-soft);
  border-radius: 10px; overflow: hidden; background: #fff;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.g-card:hover { border-color: #b9c2cc; box-shadow: 0 3px 14px -8px rgba(0,0,0,.45); }
.g-link { display: block; color: inherit; text-decoration: none; }
.g-link:hover { text-decoration: none; }
.g-ph { display: block; background: var(--bg-alt); overflow: hidden; aspect-ratio: 4 / 3; }
.g-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g-body { display: block; padding: .5rem .6rem .35rem; }
.g-title {
  display: block; font-size: .86rem; font-weight: 600; color: var(--text-strong);
  line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.g-desc {
  display: block; font-size: .78rem; color: var(--text-2); margin-top: .15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.g-desc.none { color: var(--text-3); }
.g-meta {
  display: block; font-size: .72rem; color: var(--text-3); margin-top: .3rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.g-meta i { font-style: normal; padding: 0 .25rem; }
.g-ops {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .6rem .6rem; border-top: 1px solid var(--border-faint);
}
/* 复制链接：手机上 40×40 起（手指点得准），桌面端也不小于 40 高 */
.g-copy {
  flex: 1 1 auto; min-height: 40px; padding: 0 .7rem; cursor: pointer;
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  color: #2a54a8; background: #fff; border: 1px solid var(--border-soft);
  border-radius: 8px; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.g-copy:hover { background: #eef3fb; border-color: #b9cbe8; }
.g-copy:active { transform: translateY(1px); }
.g-copy.big { flex: 0 0 auto; min-width: 7.5rem; }

/* ------------------------------------------------------------- 单张详情 */
.g-detail { max-width: 62rem; }
.g-dfig {
  border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden;
  background: var(--bg-alt); margin: .2rem 0 .8rem; text-align: center;
}
.g-dfig img {
  display: block; margin: 0 auto; max-width: 100%;
  max-height: min(72vh, 620px); width: auto; height: auto; object-fit: contain;
}
.g-dtitle {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 400; color: var(--text-strong);
  line-height: 1.35; margin: 0 0 .35rem; word-break: break-word;
}
.g-ddesc { font-size: .88rem; color: var(--text-2); line-height: 1.7; margin: 0 0 .6rem; white-space: pre-wrap; }
.g-dmeta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  font-size: .78rem; color: var(--text-3); margin: 0 0 .8rem;
}
.g-dav {
  width: 1.5rem; height: 1.5rem; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--border-soft); background: var(--bg-alt); object-fit: cover;
}
.g-dmeta b { color: var(--text-2); font-weight: 600; }
.g-dmeta i { font-style: normal; padding: 0 .2rem; }
.g-dops { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .2rem 0 .7rem; }
.g-dops .w-btn { min-height: 40px; }
.g-danger { color: #b02a1e; border-color: #e0b4ae; }
.g-danger:hover { background: #fdf0ee; border-color: #d0948c; }
.g-dnote {
  font-size: .76rem; color: var(--text-3); word-break: break-all;
  border-top: 1px solid var(--border-faint); padding-top: .55rem;
}
.g-dnote a { color: var(--link); }

/* 空态 / 说明 */
.g-empty {
  color: var(--text-3); font-size: .82rem; padding: 1.4rem .8rem; text-align: center;
  border: 1px dashed var(--border-soft); border-radius: 10px;
}
.g-more { display: flex; justify-content: center; margin: .2rem 0 1rem; }
.g-more .w-btn { min-height: 40px; min-width: 8rem; }

/* ------------------------------------------------------------- 窄屏 */
@media (max-width: 767px) {
  .g-grid { column-width: 9.5rem; column-gap: 10px; }
  .g-card { margin-bottom: 10px; }
  .g-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .g-dtitle { font-size: 1.2rem; }
  .g-dfig img { max-height: 60vh; }
  .g-search { flex: 1 1 100%; }
  .g-tools .w-btn { flex: 1 1 auto; }
}
