/* ============================================================
   styles/ad-class.css —— 广告分类页（ad-classification.php）专属样式
   ------------------------------------------------------------
   仅 ad-classification.php 加载（通过 $page['extra_css']，2026-10-31 新增）。
   对应老站 G:\1\css\subpage.css 的 .ad-subcolumn / .ad-subtitle / .image-text，
   老站布局的现代重写：
     · 灰底分类块 + 红顶线标题条（带小箭头）
     · 每块五张白底卡片：图片 + 标题 + 介绍
     · 悬停：图片微放大 1.05，卡片底部蓝色生长线（宽 0 → 100%）
   断点与全站统一：768 / 992 / 1200，媒体查询写在文件末尾。
   ============================================================ */


/* ---------- 1. 分类块（块间距 30px） ----------
   2026-11-02：去灰底、内边距清零 —— 原复刻老站 .ad-subcolumn 的 #F6F6F6
   灰色大块把右栏标题与推荐文章"切断"；改为透明后白卡片直接落在页面
   灰底上，与书画等二级页视觉统一（标题条/卡片/推荐文章同为白色系） */
.ad-class-section {
  padding: 0 0.75rem;                        /* 2026-11-02：恢复左右留白，卡片不贴右栏边缘（去灰块时误清零） */
  margin-bottom: 1.875rem;
}

/* ---------- 2. 分类标题条（老站 .title-l：白底长条 + 3px 红顶线 + 箭头） ---------- */
.ad-class-title {
  display: inline-block;
  margin: 0;
  padding: 0.625rem 2.25rem 0.625rem 1.875rem;   /* 右侧留白给箭头；左缩进对应老站 text-indent:30px */
  border-top: 3px solid #c00;                    /* 红顶线（老站实测 #c00） */
  background-color: var(--color-bg-light);
  font-size: clamp(1rem, 0.94rem + 0.25vw, 1.125rem);  /* 16 → 18px 流式 */
  font-weight: 700;
  line-height: 1.5;
  position: relative;                            /* 箭头定位基准 */
}

/* 标题条右侧小箭头（老站 background-image: arrow1.png，此处用 CSS 三角形，免图片） */
.ad-class-title::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  border-left: 0.375rem solid #c00;
  border-top: 0.3125rem solid transparent;
  border-bottom: 0.3125rem solid transparent;
}


/* ---------- 3. 五张卡片（老站 .image-text） ---------- */
.ad-class-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* 手机：2 栏 */
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.ad-class-card {
  position: relative;                            /* 底部生长线定位基准 */
  min-width: 0;
  background-color: var(--color-bg-light);
}

.ad-class-card a {
  display: block;
  height: 100%;
  padding: 0.75rem 0.75rem 1rem;
}

/* 图片：8:5 等比框，contain 不裁切（原图就是 160×100 = 8:5）；
   overflow:hidden 给悬停放大收口，图片放大不溢出卡片 */
.ad-class-img {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 8 / 5;
  overflow: hidden;
}
.ad-class-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s linear;             /* 老站同款 0.3s linear */
}

/* 标题行：老站 i（14px 加粗）；13→15px 流式，与分类条标题一致 */
.ad-class-name {
  display: block;
  margin-top: 0.375rem;
  font-size: clamp(0.8125rem, 0.75rem + 0.22vw, 0.9375rem);
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  color: var(--color-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 介绍行：老站 em（12px 灰 #999） */
.ad-class-sub {
  display: block;
  margin-top: 0.125rem;
  font-size: clamp(0.75rem, 0.68rem + 0.2vw, 0.8125rem);  /* 12 → 13px 流式 */
  line-height: 1.4;
  text-align: center;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 悬停动效（老站：图片 scale(1.05) + 底部蓝线 0→100%）
   只在真正能悬停的设备上生效，触屏不触发 */
@media (hover: hover) {
  .ad-class-card a:hover .ad-class-img img {
    transform: scale(1.05);
  }
  .ad-class-card a:hover::after {
    width: 100%;
  }
}
/* 底部生长线：默认宽 0，悬停长到 100%（老站 li:after / li:hover:after） */
.ad-class-card a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-tab-active);     /* 老站 #008fcd → 用本站蓝色令牌，全站统一 */
  transition: width 0.3s linear;
}
/* 键盘聚焦也触发底部线（可访问性，与悬停视觉一致） */
.ad-class-card a:focus-visible::after {
  width: 100%;
}


/* ---------- 3.5 小类视图补充（2026-11-01，advertising/category.php 用） ----------
   小类页的作品列表复用全站 list-grid / list-card（subpage.css），
   这里只补灰底块内的间距；空小类的引导文案单独一条。 */
.ad-class-works {
  margin: 1rem 0 0;                          /* 与 .ad-class-grid 同距，贴齐标题条 */
}

.ad-class-empty {
  margin: 1rem 0 0;
  padding: 1.25rem 1.5rem;
  background-color: var(--color-bg-light);                    /* 与卡片同底，落在灰块内 */
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.ad-class-empty a {
  color: var(--color-tab-active);            /* 引导链接用全站蓝色令牌 */
  text-decoration: underline;
}


/* ---------- 3.6 分类单页（无块内标题）补偿（2026-11-01，advertising/category.php 用）
   大/小类单页的区块里没有标题（标题在右栏标题条），
   卡片网格去掉与标题的间距；
   广告分类总页（ad-classification.php）的块内标题不受影响。 */
.ad-class-section--flat .ad-class-grid,
.ad-class-section--flat .ad-class-works {
  margin-top: 0;                             /* 上方已无标题，不留间距 */
}

/* 2026-11-02：灰块取消后，删除原「块内收紧分页条」的覆盖规则
   （width:100%; margin:1.5rem auto 0.25rem），分页条回归全站默认
   —— 上距 3rem、下距 2.25rem、宽 87.7%，与书画等二级页一致 */


/* ---------- 3.7 分类单页标题条（2026-11-01，advertising/category.php 用）
   大/小类页都不使用共用的「红方块图标 + 中文 + 英文」结构，各自独立定义；
   用单类选择器 + 本文件在 subpage.css 之后加载，盖过共用规则，
   不影响其它二级页的标题条。
   共同部分：去掉左侧红方块图标，左右内边距对称（否则文字相对整条偏右）。 */
.right-top--cat,
.right-top--subcat {
  padding-left: 1.25rem;                     /* 原 3.625rem 是给图标留位，图标去掉后收回 */
  padding-right: 1.25rem;
  background-image: none;                    /* 去左侧红方块 */
}

/* 3.7.1 大类页：四个大字整行居中、字距拉开 */
.right-top--cat .right-top-inner {
  flex: 1;                                   /* 占满整行 */
  justify-content: center;                   /* 文字组整行居中 */
}
.right-top--cat .right-top-title {
  letter-spacing: 0.5em;                     /* 四个字拉开间距 */
  margin-right: -0.5em;                      /* 抵消末字后面的字距，视觉真正居中 */
  /* 2026-11-01：大类页标题字号单独放大（封顶 36px，原共用 28px） */
  font-size: clamp(1.5rem, 7cqw, 2.25rem);
}

/* 大类页标题链接配色：默认品牌红、悬停变黑（2026-11-02）
   与小类页相反（小类页黑→红）；仅 .right-top--cat 生效，
   本文件在 subpage.css 之后加载，盖过共用的黑字规则 */
.right-top--cat .right-top-title a {
  color: var(--color-brand-red);
}
.right-top--cat .right-top-title a:hover {
  color: var(--color-black);
}

/* 3.7.2 小类页：标题两侧红线（参照老站 .list-title：36px 标题压在 2px #cd0000 红线上）
   要点：线与字的距离固定 → 用 flex gap；红线长度随文字长短自动伸缩 → 两侧伪元素 flex:1。
   老站该标题下没有灰色分隔线（红线即分隔），这里同样去掉。 */
.right-top--subcat {
  border-bottom: 0;
}
.right-top--subcat .right-top-inner {
  display: flex;
  flex: 1;                                   /* 占满整行，红线才能伸到标题条两端 */
  flex-wrap: nowrap;
  align-items: center;                       /* 改用垂直居中（基线对齐是给中英文并排用的） */
  gap: 1.25rem;                              /* ★ 线与字的固定距离 20px */
}
.right-top--subcat .right-top-inner::before,
.right-top--subcat .right-top-inner::after {
  content: "";
  flex: 1 1 0;                               /* 两侧平分剩余空间：字少线长、字多线短 */
  height: 2px;                               /* 老站红线粗 2px */
  background-color: #cd0000;                 /* 老站红线色 */
}
.right-top--subcat .right-top-title {
  flex: 0 0 auto;
  white-space: nowrap;
  letter-spacing: 0.25em;                    /* 2026-11-01：字距加宽（原 0），约为大类页的一半 */
  /* 字号参照老站 36px：老站右栏 1040px，36px ≈ 3.4cqw（随右栏流体缩放，窄屏下限 20px） */
  font-size: clamp(1.25rem, 3.4cqw, 2.25rem);
}

/* 手机：红线与字的距离收小，给文字留出更多宽度 */
@media (max-width: 767px) {
  .right-top--subcat .right-top-inner { gap: 0.75rem; }
}


/* ---------- 3.8 大类页「更多分类」按钮（2026-11-01）
   借用首页 MORE 组件（styles/more.css），--sm 修饰类整体缩小一号：
   宽度、字号、高度、箭头块、上间距全部收小；悬停动画沿用组件原规则。
   只作用于分类单页，不影响首页的 MORE 按钮。 */
.more-btn--sm {
  width: calc(4.75rem + 2vw);                /* 原 6.25rem + 3vw */
  margin: 2rem auto 0;                       /* 2026-11-01：整块再下移一点（原 1.5rem） */
  font-size: calc(0.75rem + 0.1vw);          /* 原 0.75rem + 0.2vw */
}
.more-btn--sm a {
  line-height: calc(1.375rem + 0.15vw);      /* 按钮高度：原 1.625rem + 0.2vw */
}
.more-btn--sm a i {
  width: calc(1.375rem + 0.4vw);             /* 箭头块：原 1.875rem + 0.5vw */
}


/* ---------- 4. 断点（全站统一：768 / 992 / 1200） ---------- */

/* ≥768px：3 栏，块内边距加大 */
@media (min-width: 768px) {
  .ad-class-section { padding: 0 1.25rem; }  /* 左右留白随屏宽加大 */
  .ad-class-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
}

/* ≥992px：4 栏 */
@media (min-width: 992px) {
  .ad-class-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ≥1200px：5 栏（老站「五张一排」），块间距回到老站 30px */
@media (min-width: 1200px) {
  .ad-class-section { padding: 0 1.5rem; }   /* 左右留白随屏宽加大 */
  .ad-class-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.25rem; }
}
