/* 图库：总览 / 范围列表 / 单图详情。只使用 site.css :root 已定义的 light-dark 令牌。 */
.gal-view { width: 100%; max-width: 1000px; min-width: 0; margin-inline: auto; padding-bottom: 24px; }
main.shell.gal-main-wide { width: calc(100% - 48px); max-width: none; }
main.shell.gal-main-wide > .gal-view { max-width: none; }
@media (max-width: 599px) { main.shell.gal-main-wide { width: calc(100% - 24px); } }

/* 范围列表保留实体/分类名称，便于确认搜索范围；总览只用 visually-hidden 标题。 */
.gal-head { padding: 22px 0 24px; border-bottom: 1px solid var(--line-strong); }
.gal-head h1 { font-size: clamp(27px, 3.6vw, 38px); font-weight: 600; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.gal-back { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 10px; border-radius: 3px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.6; text-decoration: none; }
.gal-back:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gal-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--accent); }

/* 服务端 GET 搜索：无 JS 也可提交，清除链接和常用词都是普通链接。 */
.gal-search-block { width: 100%; max-width: 800px; min-width: 0; margin: 30px auto 0; }

/* 右侧不留内边距：提交按钮直接贴到外框内缘，用自身底色填满右端。 */
.gal-search { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 52px; margin: 0; padding: 0 0 0 18px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.gal-search-icon { flex: none; width: 20px; height: 20px; color: var(--accent); }
.gal-search-input { flex: 1 1 auto; min-width: 0; min-height: 50px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--fg); font-size: 16px; font-weight: 400; line-height: 1.4; -webkit-appearance: none; appearance: none; }
.gal-search-input::-webkit-search-cancel-button, .gal-search-input::-webkit-search-decoration { display: none; -webkit-appearance: none; appearance: none; }
.gal-search-input::placeholder { color: var(--faint); opacity: 1; }
.gal-search-input:focus-visible { outline: none; }
/* 焦点只画一圈：整框内描边随输入框/按钮的焦点出现，内部控件不再叠加轮廓。
   用 outline 而不是 inset box-shadow：按钮贴到内缘后，outline 画在子元素之上，
   右端的焦点线不会被按钮 hover 底色盖掉。 */
.gal-search:focus-within { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -1px; }
.gal-search-clear { flex: none; padding: 5px 2px; border-radius: 3px; color: var(--accent); font-size: 12.5px; font-weight: 400; line-height: 1.5; text-decoration: none; white-space: nowrap; }
.gal-search-clear:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gal-search-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* align-self:stretch 让按钮与外框内高一致（52-2=50 / 46-2=44）。
   右两角比外框 6px 少 1px 边框，正好落在内缘上；左角是直边。 */
.gal-search-submit { flex: none; align-self: stretch; display: inline-flex; align-items: center; justify-content: center; min-height: 46px; margin: 0; padding: 0 20px; border: 0; border-radius: 0 5px 5px 0; background: transparent; color: var(--accent); font-size: 14px; font-weight: 400; line-height: 1.4; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.gal-search-submit:hover { background: var(--accent-soft); color: var(--accent); }
.gal-search-submit:focus-visible { outline: none; background: var(--accent-soft); color: var(--accent); }

.gal-quick { margin: 10px 0 0; }
.gal-quick-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; margin: 0; padding: 0; list-style: none; }
.gal-quick a { color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.7; text-decoration: none; }
.gal-quick a:hover, .gal-quick a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gal-quick a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 自然比例照片墙：CSS 多列瀑布流，无 JS、无第三方依赖。图片按原始比例完整展示，
   不裁切、不拉伸；列数只随视口变化，不因图片数量回退放大卡片。 */
.gal-grid { margin: 26px 0 0; padding: 0; list-style: none; column-count: 1; column-gap: 12px; }
.gal-cell { min-width: 0; margin: 0 0 12px; break-inside: avoid; page-break-inside: avoid; }
.gal-cell-link { display: block; min-width: 0; border-radius: 0; color: inherit; text-decoration: none; }
.gal-cell-link:hover, .gal-cell-link:focus-visible { color: inherit; }
.gal-cell-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gal-cell-media { position: relative; display: block; overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 0; background: var(--zone-soft); transition: border-color .15s ease; }
.gal-cell-img { display: block; width: 100%; height: auto; max-width: 100%; }
.gal-cell-empty { display: flex; align-items: center; justify-content: center; min-height: 150px; padding: 8px; color: var(--faint); font-size: 11px; line-height: 1.5; text-align: center; }
.gal-cell-link:hover .gal-cell-media, .gal-cell-link:focus-visible .gal-cell-media { border-color: var(--accent); }

/* 说明与署名是照片底部的暗渐变叠层：触屏默认可见，鼠标/键盘聚焦时出现。 */
.gal-cell-cap { position: absolute; inset: auto 0 0; display: grid; gap: 1px; padding: 20px 9px 7px; background: linear-gradient(to top, rgba(0, 0, 0, .74), rgba(0, 0, 0, .38) 62%, rgba(0, 0, 0, 0)); color: #fff; }
.gal-cell-cap:empty { display: none; }
.gal-cell-caption { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; color: #fff; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.gal-cell-credit { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; overflow: hidden; color: rgba(255, 255, 255, .8); font-size: 10.5px; line-height: 1.45; overflow-wrap: anywhere; }

@media (hover: hover) and (pointer: fine) {
  .gal-cell-cap { opacity: 0; transition: opacity .16s ease; }
  .gal-cell-link:hover .gal-cell-cap, .gal-cell-link:focus-visible .gal-cell-cap, .gal-cell-link:focus-within .gal-cell-cap { opacity: 1; }
}

@media (min-width: 480px) { .gal-grid { column-count: 2; } }
@media (min-width: 768px) { .gal-grid { column-count: 3; } }
@media (min-width: 1024px) { .gal-grid { column-count: 4; } }
@media (min-width: 1280px) { .gal-grid { column-count: 5; } }
@media (min-width: 1600px) { .gal-grid { column-count: 6; } }
@media (min-width: 2000px) { .gal-grid { column-count: 8; } }

.gal-empty { margin: 26px 0 0; padding: 36px 20px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.7; text-align: center; }
.gal-empty-clear { color: var(--accent); font-weight: 400; text-underline-offset: 3px; }

.gal-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 30px 0 0; font-size: 12px; }
.gal-page-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.gal-page { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px; padding: 3px 9px; border: 1px solid transparent; border-radius: 3px; color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.gal-page:hover { border-color: var(--line-strong); background: transparent; color: var(--fg); }
.gal-page.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.gal-page[aria-disabled="true"] { color: var(--faint); }
.gal-page:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gal-image { padding-top: 24px; min-width: 0; }
.gal-figure { display: grid; gap: 12px; margin: 0; min-width: 0; }
.gal-figure-link { display: block; width: 100%; border-radius: 4px; cursor: default; }
.gal-figure-link .gal-figure-img { cursor: zoom-in; }
.gal-figure-link:focus-visible { outline: none; }
.gal-figure-link:focus-visible .gal-figure-img { outline: 2px solid var(--accent); outline-offset: 3px; }
.gal-figure-img { display: block; justify-self: center; width: auto; height: auto; max-width: 100%; max-height: min(78vh, 880px); margin-inline: auto; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: var(--zone-soft); }
.gal-figure-empty { display: flex; align-items: center; justify-content: center; min-height: 240px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--zone-soft); color: var(--faint); font-size: 12px; }
.gal-figure-cap { display: grid; gap: 4px; margin: 0; min-width: 0; }
.gal-figure-caption { color: var(--fg); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.gal-figure-credit { color: var(--faint); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }

.gal-meta { display: grid; gap: 0; max-width: 720px; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--line-strong); }
.gal-meta-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.gal-meta-row dt { margin: 0; color: var(--faint); font-size: 11px; line-height: 1.6; letter-spacing: .06em; }
.gal-meta-row dd { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.gal-meta-row dd a { color: var(--accent-ink); text-underline-offset: 3px; }

/* 列表与详情共用同一份版权声明样式；列表的 aside 只是语义包装，不覆盖这里。 */
.gal-notice-one { width: 100%; max-width: 1000px; margin: 26px auto 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }

.gal-entities { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.gal-entities-title { margin: 0 0 10px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .1em; }
.gal-entities-list { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0; min-width: 0; }
.gal-entity { display: inline-flex; align-items: center; min-height: 30px; max-width: 100%; padding: 3px 10px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 12px; line-height: 1.6; text-decoration: none; overflow-wrap: anywhere; }
.gal-entity:hover { border-color: var(--accent); color: var(--accent-ink); }
.gal-entity:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 620px) {
  .gal-head { padding: 18px 0 18px; }
  .gal-search-block { margin-top: 22px; }
  .gal-search { gap: 6px; min-height: 46px; padding: 0 0 0 14px; }
  .gal-search-icon { width: 18px; height: 18px; }
  .gal-search-input { min-height: 44px; }
  .gal-search-submit { min-height: 42px; padding: 0 14px; font-size: 13px; }
  .gal-quick-list { gap: 2px 14px; }
  .gal-quick a { font-size: 12.5px; }
  .gal-meta-row { grid-template-columns: 68px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .gal-cell-media, .gal-cell-cap, .gal-search-submit { transition: none; }
}

@media (forced-colors: active) {
  .gal-search { border-color: CanvasText; background: Canvas; }
  .gal-search-icon { color: CanvasText; }
  .gal-search:focus-within { outline: 2px solid Highlight; outline-offset: -2px; box-shadow: none; }
  .gal-search-clear, .gal-quick a { color: LinkText; }
  .gal-cell-media, .gal-figure-img, .gal-figure-empty { border: 1px solid CanvasText; }
  /* 系统强制配色会丢弃渐变背景：说明改为图片下方的普通文字，保持可见。 */
  .gal-cell-cap { position: static; opacity: 1; padding: 6px 0 0; background: none; color: CanvasText; }
  .gal-cell-caption { color: CanvasText; }
  .gal-cell-credit { color: CanvasText; }
  .gal-empty-clear { color: LinkText; }
  .gal-cell-link:focus-visible, .gal-page:focus-visible, .gal-entity:focus-visible, .gal-search-clear:focus-visible, .gal-quick a:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
  .gal-figure-link:focus-visible .gal-figure-img { outline: 2px solid Highlight; outline-offset: 3px; }
  .gal-notice-one { border-left-color: CanvasText; }
  .gal-page.is-on { border-color: Highlight; }
}
