/* ============================================================
 * 前端模板公共样式（apps/server/templates/*.html 共用）
 * 分类页 / 列表页模板的内嵌 <style> 只保留该页特有部分，
 * 通用组件（bar / hero / card-lift / logo-box / empty / pager）统一收在此处。
 * 本文件由 server 经 /api/static/common.css 提供（与 templates/*.html
 *   同目录的 assets/ 下）；web 经 nuxt.config 的 <link> 全局加载。
 *   改此文件无需重建 web/server，刷新浏览器即生效；模板 v-html 注入的 DOM 同样命中这些类。
 * 页面级样式见 templates.css（@import 引入，同目录，对应各模板原先内嵌的 <style>）。
 * ============================================================ */

@import url('/api/static/templates.css');

/* ---- 顶部红橙统计/标题条 ---- */
.tpl-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  background: #dd2020;
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 14px;
}
.tpl-bar h1,
.tpl-bar b { color: #fff; }
.tpl-bar h1 { font-size: 26px; margin: 0; font-weight: 700; }
.tpl-bar b { font-weight: 700; }
.tpl-bar a { color: #fff; text-decoration: none; }
.tpl-bar a:hover { color: #ffe0d6; }

/* ---- 分类页标题区（居中 hero，与 main.css 的 .tpl-hero 渐变横幅区分） ---- */
.tpl-cat-hero { text-align: center; margin: 14px 0 22px; padding-bottom: 14px; border-bottom: 1px solid #efe9e6; }
.tpl-cat-hero h1 { font-size: 26px; margin: 0 0 8px; color: #3a1410; }
.tpl-cat-hero p { color: #827a73; margin: 0; font-size: 14px; max-width: 880px; margin: 0 auto; line-height: 1.7; }

/* ---- 卡片 hover 抬升（各卡片微差阴影，统一此值） ---- */
.tpl-card-lift:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(221, 32, 32, .12); }

/* ---- 120px 正方形 logo/封面容器（内联 img 保持比例不裁剪） ---- */
.tpl-logo-box {
  width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.tpl-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

/* ---- 空状态 ---- */
.tpl-empty { text-align: center; color: #827a73; padding: 60px 0; font-size: 14px; }

/* ---- 分页器（页面模板 {{> 分页}} 或内嵌结构共用） ---- */
.tpl-pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 18px 0 8px; flex-wrap: wrap; color: #6b6259; font-size: 14px; }
.tpl-pager .pg-info { margin-left: 8px; color: #827a73; font-size: 12.5px; }
.tpl-pager a,
.tpl-pager span { display: inline-block; min-width: 34px; padding: 6px 12px; border-radius: 8px; border: 1px solid #efe9e6; background: #fff; color: #3a1410; text-decoration: none; transition: background .18s, border-color .18s; text-align: center; }
.tpl-pager a:hover { background: #f3f6f4; border-color: #e0d8d4; color: #3a1410; }
.tpl-pager .pg-current { background: #dd2020; border-color: #dd2020; color: #fff; font-weight: 600; cursor: default; }
.tpl-pager .pg-disabled { opacity: .45; cursor: not-allowed; color: #b0a89f; background: #f6f3f1; }

/* ---- 全宽 banner 图（page-* / category-* 模板通用） ----
   布局层 <main class="container"> 已是 100% 宽，banner 直接挂在容器下（default.vue 顶部渲染），
   width:100% 即铺满视口，无需任何 CSS 破出技巧。
   高度上限 max-height:300px 防超高图撑版；圆角归零（全宽 banner 不需要）。 */
.tpl-banner {
  display: block;
  width: 100%;
  margin-bottom: 18px;
  max-height: 120px;
  object-fit: cover;
  border-radius: 0;
}

/* ---- 幻灯片轮播（模板 {{> slideshow slideshows.key}} 渲染） ---- */
.tpl-slideshow-wrap { margin-top: 20px; margin-bottom: 22px; }
.tpl-slideshow {
  position: relative; overflow: hidden; border-radius: 12px;
  background: #f4f0ed; width: 100%;
}
/* 固定宽度时居中 */
.tpl-slideshow--fixed { margin-left: auto; margin-right: auto; }
.tpl-slideshow__track {
  display: flex; transition: transform .5s cubic-bezier(.25,.46,.45,.94);
  will-change: transform; height: 100%;
}
.tpl-slideshow .tpl-slide {
  flex: 0 0 100%; position: relative; display: block;
  overflow: hidden; background: #f4f0ed; aspect-ratio: 21 / 9;
}
/* 指定固定高度时，slide 填满容器高度（覆盖 aspect-ratio） */
.tpl-slideshow[data-height] .tpl-slide { aspect-ratio: auto; height: 100%; }
.tpl-slideshow .tpl-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-slideshow .tpl-slide-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 20px 16px 12px;
  color: #fff; font-weight: 600; font-size: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
}

/* 箭头 */
.tpl-slideshow__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 2; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.85); color: #3a1410;
  font-size: 18px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; opacity: 0; transition: opacity .25s, background .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.tpl-slideshow:hover .tpl-slideshow__arrow { opacity: 1; }
.tpl-slideshow__arrow:hover { background: #fff; }
.tpl-slideshow__arrow--prev { left: 10px; }
.tpl-slideshow__arrow--next { right: 10px; }

/* 指示点 */
.tpl-slideshow__dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  z-index: 2; display: flex; gap: 7px;
}
.tpl-slideshow__dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid #fff; background: transparent;
  cursor: pointer; transition: background .25s, transform .2s; padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.tpl-slideshow__dot.active { background: #fff; transform: scale(1.2); }

/* 单张 banner（data-count="1"）：纯图片展示——仿旧站 banner 观感。
   旧站 .banner-area 下图片靠 .text-center + img{max-width:100%} 居中按原尺寸显示，无灰底背景；
   当前 .tpl-slideshow 默认 width:100% + 灰底，会把窄图拉伸铺满全宽并露出全宽灰条。
   修复：容器去灰底；图片按原比例居中、不强制拉伸（width:auto + max-width:100% + margin:0 auto）。
   useSlideshow 对 total<=1 也不初始化轮播行为，与服务端模板输出的 data-count 配合。 */
.tpl-slideshow[data-count="1"] { background: transparent; }
.tpl-slideshow[data-count="1"] .tpl-slideshow__arrow,
.tpl-slideshow[data-count="1"] .tpl-slideshow__dots { display: none; }
.tpl-slideshow[data-count="1"] .tpl-slide { aspect-ratio: auto; background: transparent; }
.tpl-slideshow[data-count="1"] .tpl-slide img {
  width: auto; max-width: 100%; height: auto;
  object-fit: contain; display: block; margin: 0 auto;
}

/* ---- 内页主栏 + 侧栏两列布局（替代旧 Bootstrap .row/.col-lg-8/.col-lg-4） ---- */
.tpl-2col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.tpl-2col > .tpl-col-main { min-width: 0; }
.tpl-2col > .tpl-col-side { min-width: 0; }
@media (max-width: 900px) {
  .tpl-2col { grid-template-columns: 1fr; }
  .tpl-2col > .tpl-col-side { order: -1; }
}
