/* 全部技能（/resources，templates/pp/resources.html）自己的排版，11-07 B「派派一家」，从样稿 site/resources.css 搬来。类名前缀 .res-；
   左栏筛选、竖条、已选条件在 b/list.css（.list-，教程页也用），组件在 site.css。
   结构：页头（面包屑 + 标题「共 N 个」+ 右边搜索框和「试试」）→ 左栏筛选（适合谁 · 难度 · 在哪用 · 用哪个 AI）
        + 右边：第一级类型（下划线页签，右边排序）→ 第二级用途（胶囊）→ 已选条件 → 技能卡网格（一次 24 张）→「再看 24 个」。
   1100 以下没有左栏（有 JS 时换成搜索框旁边的「筛选」按钮 + 底部面板；不开 JS 时左栏摆在列表上面）；手机（< 760）搜索 +「筛选」一行吸顶，
   类型 / 用途各一行左右滑，卡片两列紧凑卡。标「→ site.css」的几样别的列表页也用得上，交付时请主会话收进 site.css。 */

.page-res { --side-w: clamp(256px, 6vw + 152px, 304px); }

/* ===================== 页头：左标题，右搜索 ===================== */
.res { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-2xl); align-items: end; }
.res-head { padding: clamp(16px, 1.6vw, 36px) 0 clamp(20px, 1.8vw, 36px); min-width: 0; }
.res-head .crumbs { margin-bottom: var(--space-sm); }
.res-head__title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px var(--space-ms);
  font: var(--display-w) var(--fs-d2)/1.18 var(--display); -webkit-text-stroke: var(--display-stroke) currentColor; letter-spacing: .01em; overflow-wrap: anywhere; }
.res-head__n { font: 400 var(--fs-sm)/1 var(--sans); -webkit-text-stroke: 0; letter-spacing: 0; color: var(--ink-3); white-space: nowrap; }
.res-head__n b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.res-head__desc { margin-top: var(--space-sm); font-size: var(--fs-md); color: var(--ink-2); max-width: 46em; }
.res-find { width: clamp(440px, 15vw + 300px, 720px); padding-bottom: clamp(20px, 1.8vw, 36px); }
.res-search { height: 48px; padding-left: 18px; box-shadow: var(--sh); }
.res-search .search__go { height: 38px; padding: 0 20px; font-size: var(--fs-sm); }
.res-search__x { position: relative; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--sunk); color: var(--ink-2); }
.res-search__x::after { content: ""; position: absolute; inset: -6px; }
@media (hover: hover) { .res-search__x:hover { color: var(--ink); background: var(--line); } }
.res-search__x svg { width: 14px; height: 14px; }
.res-search__x[hidden] { display: none; }
.res-grid mark { background: var(--blue-bg); color: var(--link); border-radius: 4px; padding: 0 1px; box-shadow: inset 0 -2px 0 var(--blue-line); }
/* 搜索框下面一行「试试」：小字链接，不抢搜索框的戏 */
.res-try { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: 10px; padding-left: 18px; font-size: var(--fs-sm); color: var(--ink-3); }
.res-try > span { margin-right: 6px; }
.res-try__w { display: inline-flex; align-items: center; min-height: 28px; padding: 0 8px; border-radius: var(--r-pill); color: var(--ink-2); transition: color .2s, background-color .2s; }
@media (hover: hover) { .res-try__w:hover { color: var(--link); background: var(--blue-bg); } }
.res-fbtn { display: none; }

/* ===================== 主体：左栏 + 右边列表（两栏在 b/list.css 的 .list-body） ===================== */
.res-body { grid-column: 1 / -1; }
.res-main { container-type: inline-size; transition: opacity .2s; }
.res-main.is-busy { opacity: .55; }        /* 原地换的时候网慢：先淡一下（resources.js 150ms 后才加） */

/* 第一级：类型 = 下划线页签（字 16，选中黑字加粗 + 底下 3 像素蓝条），每个前面一个类型色小圆点，和卡片上的类型标签对得上 → site.css「.tabs」 */
.res-bar { display: flex; align-items: center; gap: var(--space-lg); box-shadow: inset 0 -1px 0 var(--line); }
.res-tabs { display: flex; gap: clamp(20px, 1.4vw, 36px); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.res-tabs::-webkit-scrollbar { display: none; }
.res-tab { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 52px; font-size: var(--fs-md); color: var(--ink-2); white-space: nowrap; transition: color .2s; }
.res-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; transition: background-color .2s; }
@media (hover: hover) { a.res-tab:hover { color: var(--ink); } a.res-tab:hover::after { background: var(--line-2); } }
.res-tab[aria-current] { color: var(--ink); font-weight: 600; }
.res-tab[aria-current]::after { background: var(--blue); }
.res-tab .chip__n { font-weight: 400; }
.res-tab__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tg-bd); }
.res-tab.is-off, .res-uses .chip.is-off { opacity: .42; cursor: default; }
.res-sort { flex: none; margin-left: auto; display: flex; align-items: center; }
.res-sort__q { font-size: var(--fs-sm); color: var(--ink-3); }
.res-hot-tip { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: var(--space-sm); font-size: var(--fs-xs); color: var(--ink-3); }
.res-hot-tip svg { width: 14px; height: 14px; }
/* 第二级：用途 = 胶囊（选中蓝底白字；「全部用途」选中是灰底黑字） */
.res-uses { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); }
.res-uses .chip[aria-current][data-v=""] { background: var(--sunk); border-color: var(--line-2); color: var(--ink); font-weight: 600; }
.res-uses .chip[aria-current][data-v=""] .chip__n { color: var(--ink-2); font-weight: 400; }
.res-uses .chip[aria-current]:not([data-v=""]) .chip__n { color: #E6F4FF; }
/* 已选条件（.list-on，b/list.css）在用途下面 */
.res-on { margin-top: var(--space-ms); }

/* 卡片网格：列数按右边这块的宽（不是窗口宽）定，收起左栏也跟着变。卡片宽大致保持在 250～330：
   2560 六列、1920 五列、1440 / 1680 四列、平板三列、手机两列 */
.res-grid { --cols: 2; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); margin-top: var(--space-lg); }
@container (min-width: 660px) { .res-grid { --cols: 3; } }
@container (min-width: 1000px) { .res-grid { --cols: 4; } }
@container (min-width: 1400px) { .res-grid { --cols: 5; } }
@container (min-width: 1640px) { .res-grid { --cols: 6; } }
/* 左栏收起以后（多出 200 多像素）：同样的宽度多放一列，收起才看得出好处——1440 四列变五列、1920 五列变六列、2560 六列变七列 */
@container (min-width: 1240px) { .list-body.is-folded .res-grid { --cols: 5; } }
@container (min-width: 1640px) { .list-body.is-folded .res-grid { --cols: 6; } }
@container (min-width: 2050px) { .list-body.is-folded .res-grid { --cols: 7; } }
.res-grid:empty { display: none; }
/* 列表里标题放两行（名字 | 能做什么，后半句才是普通人看得懂的那句；固定两行高，卡片一样高） → site.css「.skill-card--list」 */
.res-grid .skill-card__title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; min-height: 44px; }

/* 再看 24 个 → site.css「.more」 */
.res-more { display: grid; justify-items: center; gap: var(--space-sm); margin-top: var(--space-xl); }
.res-more[hidden] { display: none; }
.res-more .btn { min-width: 240px; }
.res-more__left { font-size: var(--fs-xs); color: var(--ink-3); }

/* 筛不到：白面板 + g6 角色 + 一句话 + 出路（去掉某个条件还剩几个 / 换个说法）+ 清空；下面「也可以看看这几个」 */
.res-empty { margin-top: var(--space-lg); padding: var(--space-md); }
.res-empty .empty__title { font-size: var(--fs-xl); }
.res-relax { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); background: var(--paper);
  border: 1px solid var(--line-2); font-size: var(--fs-sm); white-space: nowrap; transition: color .2s, border-color .2s; }
@media (hover: hover) { .res-relax:hover { color: var(--link); border-color: var(--blue-line); } }
.res-relax b { font-weight: 600; }
.res-relax small { font-size: var(--fs-xs); color: var(--ink-3); }
.res-empty__go { margin-top: var(--space-ms); }
.res-near { margin-top: var(--space-xl); font: var(--display-w) var(--fs-lg)/1.3 var(--display); -webkit-text-stroke: var(--display-stroke) currentColor; }
.res-near + .res-grid { margin-top: var(--space-md); }

/* ===================== 手机筛选面板（<dialog>，底部弹出） → site.css「.sheet」 ===================== */
.res-sheet { width: 100%; max-width: 640px; max-height: min(86dvh, 760px); margin: auto auto 0; padding: 0; border: 0; border-radius: 24px 24px 0 0;
  background: var(--paper); color: var(--ink); box-shadow: 0 -8px 40px rgb(31 45 61 / .18); overflow: hidden; }
.res-sheet::backdrop { background: rgb(31 31 31 / .38); }
.res-sheet[open] { display: flex; animation: res-up .28s var(--ease); }
.res-sheet.out { transform: translateY(40px); opacity: 0; transition: transform .2s ease-in, opacity .2s ease-in; }
@keyframes res-up { from { transform: translateY(40px); opacity: .4; } }
.res-sheet__in { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.res-sheet__head { flex: none; display: flex; align-items: center; height: 56px; padding: 0 8px 0 20px; border-bottom: 1px solid var(--line); }
.res-sheet__head h2 { font: var(--display-w) var(--fs-lg)/1 var(--display); -webkit-text-stroke: var(--display-stroke) currentColor; }
.res-sheet__x { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink-2); }
.res-sheet__x svg { width: 20px; height: 20px; }
.res-sheet__x:active { background: var(--sunk); }
.res-sheet__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 16px; }
.res-sheet__g { margin: 0; padding: 14px 0 14px; border: 0; min-width: 0; }
.res-sheet__g + .res-sheet__g { border-top: 1px solid var(--line); }
.res-sheet__g legend { float: left; width: 100%; margin-bottom: 10px; padding: 0; font-size: var(--fs-sm); font-weight: 600; }
.res-sheet__g legend + * { clear: both; }
.res-sheet__g legend small { margin-left: 8px; font-weight: 400; font-size: var(--fs-xs); color: var(--ink-3); }
.res-sheet__seg { display: flex; }
.res-sheet__seg label { flex: 1; position: relative; display: flex; }
.res-sheet__seg label > span { flex: 1; display: grid; place-items: center; height: 36px; border-radius: var(--r-pill); font-size: var(--fs-sm); color: var(--ink-2); }
.res-sheet__seg input:checked + span { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgb(31 45 61 / .12); }
.res-sheet__seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.res-sheet__tip { display: none; margin-top: 8px; font-size: var(--fs-xs); color: var(--ink-3); }
.res-sheet__g[data-g="sort"]:has(input[value="hot"]:checked) .res-sheet__tip { display: block; }
.res-sheet .chips { gap: 8px; }
.res-opt { position: relative; height: 36px; cursor: pointer; user-select: none; }
.res-opt:has(input:checked) { background: var(--btn); border-color: var(--btn); color: #fff; }
.res-opt:has(input:checked) .chip__n { color: #E6F4FF; }
.res-opt[data-v=""]:has(input:checked) { background: var(--sunk); border-color: var(--line-2); color: var(--ink); font-weight: 600; }
.res-opt[data-v=""]:has(input:checked) .chip__n { color: var(--ink-2); font-weight: 400; }
.res-opt:has(input:disabled) { opacity: .42; cursor: default; }
.res-opt:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.res-ckchip .list-ck__box { width: 14px; height: 14px; margin-left: -4px; }
.res-ckchip:has(input:checked) { background: var(--blue-bg); border-color: var(--blue-line); color: var(--link); }
.res-ckchip:has(input:checked) .chip__n { color: var(--link); }
.res-ckchip:has(input:checked) .list-ck__box { background: var(--btn); box-shadow: none; }
.res-ckchip:has(input:checked) .list-ck__box svg { opacity: 1; }
.res-sheet__foot { flex: none; display: flex; gap: var(--space-ms); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.res-sheet__foot .btn { height: 44px; }
.res-sheet__foot .btn--primary { flex: 1; }

/* ===================== 1100 以下：没有左栏，换成搜索框旁边的「筛选」按钮 + 底部面板（要 JS；不开 JS 时左栏摆在列表上面） ===================== */
@media (max-width: 1099px) {
  .res-body, .res-body.is-folded { grid-template-columns: minmax(0, 1fr); }
  html.js .res-body .list-side { display: none; }
  html:not(.js) .res-body .list-side { position: static; max-height: none; margin-bottom: var(--space-lg); }
  html:not(.js) .res-body .list-fl { overflow: visible; }
  .res-find { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-ms); }
  .res-search { flex: 1; min-width: 0; }
  html.js .res-fbtn { display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 18px; border: 0; border-radius: var(--r-pill); background: var(--paper);
    box-shadow: var(--sh); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
  .res-fbtn svg { width: 16px; height: 16px; color: var(--ink-2); }
  .res-try { flex-basis: 100%; margin-top: 0; }
}
@media (min-width: 760px) and (max-width: 1099px) {
  .res-find { width: clamp(420px, 52vw, 560px); }
}

/* ===================== 手机（< 760） ===================== */
@media (max-width: 759px) {
  .res { display: block; }
  .res-head { padding: var(--space-md) 0 var(--space-ms); }
  .res-head .crumbs { display: none; }
  .res-head__title { font-size: 26px; }
  .res-head__desc { font-size: var(--fs-sm); }
  /* 搜索 +「筛选」一行吸在屏幕顶上（吸住以后白底、底下一道线，resources.js 加 .is-stuck） */
  .res-find { position: sticky; top: 0; z-index: 15; width: auto; flex-wrap: nowrap; gap: var(--space-sm); margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter);
    transition: background-color .2s, box-shadow .2s; }
  .res-find.is-stuck { background: rgb(255 255 255 / .96); box-shadow: 0 1px 0 var(--line); }
  html:not(.js) .res-find { position: static; flex-wrap: wrap; }
  .res-search { height: 44px; padding-left: 14px; gap: 8px; }
  .res-search .search__go { display: none; }
  .res-search .search__input { font-size: var(--fs-md); }
  html.js .res-fbtn { height: 44px; padding: 0 14px; }
  .res-try { display: none; }
  /* 类型、用途、已选条件：各一行，左右滑（贴到屏幕边） */
  .res-bar, .res-uses, .res-on { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .res-tabs { gap: 20px; }
  .res-tab { height: 46px; font-size: 15px; }
  .res-tab__dot { display: none; }
  .res-sort, .res-hot-tip { display: none; }
  .res-uses, .res-on { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .res-uses::-webkit-scrollbar, .res-on::-webkit-scrollbar { display: none; }
  .res-uses { margin-top: var(--space-ms); }
  .res-uses .chip, .res-on > * { flex: none; }
  .res-on .list-on__label { display: none; }
  .res-uses::after, .res-on::after { content: ""; flex: none; width: 1px; }
  /* 卡片两列（站长 10-21 定的）：封面 + 标题两行 + 类型 · 能在哪用；来源、简介让开，星数挪到封面左下角 → site.css「.skill-card--compact」 */
  .res-grid { gap: 10px; margin-top: var(--space-md); }
  .res-grid .skill-card { border-radius: 16px; }
  .res-grid .skill-card__cover { margin: 6px 6px 0; border-radius: 11px; }
  .res-grid .skill-card__body { padding: 8px 10px 10px; }
  .res-grid .skill-card__title a { padding-block: 2px; }   /* 整张卡都能点（::after 盖满），这里只是让标题链接自己也够 24 高 */
  .res-grid .skill-card__title { font-size: var(--fs-sm); line-height: 20px; min-height: 40px; }
  .res-grid .skill-card__head .stars, .res-grid .skill-card__src, .res-grid .skill-card__sum { display: none; }
  .res-grid .skill-card__tags { padding-top: 6px; gap: 6px; }
  .res-grid .skill-card__ai::before { margin-right: 6px; }
  .res-grid .skill-card__mstars { display: inline-flex; }
  .res-grid .skill-card__fav { top: 6px; right: 6px; width: 30px; padding: 0; justify-content: center; opacity: 1; transform: none; }
  .res-grid .skill-card__fav .pp-swap, .res-grid .skill-card__go { display: none; }
  .res-more .btn { width: 100%; }
  .res-empty { padding: var(--space-sm); }
  .res-empty .empty__actions { flex-wrap: wrap; }
  .res-relax { white-space: normal; }
  .res-sheet { max-width: none; }
}
@media (max-width: 759px) and (hover: hover) { .res-grid .skill-card:hover { transform: none; } }
@media (pointer: coarse) { .res-try__w { min-height: 36px; } .res-tab { min-height: 44px; } }
