/* components.css — 内页专用组件（环节 6 追加，颜色/字号/圆角一律 var(--…)）

   直接复用 style.css 里的：.wrap .site-header .nav .nav-toggle .brand .search
   .btn .sec-head .sec-note .cat-grid .cat .dish-grid .dish .faq-list .search-empty
   .site-footer .footer-*

   本文件只放内页新增区块：
     .crumb                    面包屑
     .page-hero                列表页标题区
     .toolbar                  筛选 + 排序条
     .list-grid .list-card     列表页菜谱网格（含 meta 行）
     .related-cats             列表页「接下来看」
     .list-seo                 列表页说明长文
     .article-layout           详情页两栏
     .article-head             菜谱头（参数条）
     .toc                      详情页目录
     .article-body             正文排版
     .related-dishes           同类做法
     .pager                    分页（本站数据只有单页，仅保留样式备用）
*/

/* ---------------------------------------------------------------- 面包屑 */
.crumb{
  padding: 22px 0 0;
  font-size: 12px;
  color: var(--muted-2);
}
.crumb ol{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.crumb li{ display: flex; align-items: center; gap: 8px; }
.crumb li + li::before{
  content: ""; width: 5px; height: 5px;
  border-right: 1px solid var(--muted-2); border-bottom: 1px solid var(--muted-2);
  transform: rotate(-45deg);
}
.crumb a{ color: var(--muted); }
.crumb a:hover{ color: var(--red); }
.crumb [aria-current="page"]{ color: var(--ink); }

/* ------------------------------------------------------------ 列表页标题区 */
.page-hero{
  padding: 26px 0 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}
.page-hero .eyebrow{ margin-bottom: 8px; }
.page-hero h1{
  font-size: clamp(27px, 2.7vw, 38px);
  line-height: 1.28;
  color: var(--red-ink);
  letter-spacing: -.01em;
}
.page-lead{
  margin-top: 11px;
  max-width: 46em;
  font-size: 13.5px; line-height: 1.85; color: var(--body);
}
.page-stats{
  margin-top: 16px;
  display: flex; flex-wrap: wrap; gap: 8px 26px;
  font-size: 12px; color: var(--muted);
}
.page-stats span{ display: inline-flex; align-items: center; gap: 6px; }
.page-stats b{ font: 600 15px/1 var(--font-serif); color: var(--red-ink); }

/* ---------------------------------------------------------------- 筛选排序 */
.toolbar{
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 20px;
  margin-top: 20px; padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.filter-set{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-set > .label{ font-size: 11.5px; color: var(--muted-2); margin-right: 2px; }
.chip{
  display: inline-flex; align-items: center;
  height: 30px; padding: 0 13px; border-radius: var(--pill);
  border: 1px solid var(--line); background: #fff;
  font: 12.5px/1 var(--font-sans); color: var(--body);
  white-space: nowrap;
  cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.chip:hover{ border-color: var(--red); color: var(--red-ink); }
.chip[aria-pressed="true"]{ background: var(--red); border-color: var(--red); color: #fff; }

.sort-set{ display: flex; align-items: center; gap: 8px; }
.sort-set .label{ font-size: 11.5px; color: var(--muted-2); }
.sort-set select{
  height: 30px; padding: 0 30px 0 11px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--body);
  font: 12.5px/1 var(--font-sans); cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 49%, var(--muted-2) 50%), linear-gradient(-45deg, transparent 49%, var(--muted-2) 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: right 13px center, right 9px center;
  background-repeat: no-repeat;
}
.result-count{ margin: 12px 0 0; font-size: 11.5px; color: var(--muted-2); }

/* -------------------------------------------------------------- 菜谱网格 */
.list-grid{
  margin-top: 18px;
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 20px 18px;
}
.list-card{
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .22s ease, transform .22s ease;
}
.list-card:hover{ box-shadow: var(--shadow); transform: translateY(-2px); }
.list-card img{
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  background: var(--cream-2);
}
.list-card .body{ padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.list-card h2{ font-size: 15.5px; line-height: 1.35; }
.list-card p{ margin-top: 6px; font-size: 11.5px; line-height: 1.72; color: var(--muted); flex: 1; }
.meta-row{
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 5px 8px;
  font-size: 10.5px; color: var(--muted-2);
}
.meta-row span{ display: inline-flex; align-items: center; gap: 4px; }
.meta-row span + span::before{
  content: "·"; margin-right: 4px; color: var(--line);
}
.tag{
  display: inline-block;
  padding: 2px 8px; border-radius: var(--pill);
  background: var(--red-soft); color: var(--red-ink);
  font-size: 10.5px; line-height: 1.6;
}
[data-hidden="true"]{ display: none; }

/* ------------------------------------------------------------ 接下来看 */
.related-cats{ margin-top: 34px; }
.related-cats h2{ font-size: 17px; }
.related-cat-grid{
  margin-top: 14px;
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px;
}
.related-cat{
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  transition: border-color .18s ease, background .18s ease;
}
.related-cat:hover{ border-color: var(--red); background: #fff; }
.related-cat b{ font: 600 14.5px/1.3 var(--font-serif); color: var(--ink); }
.related-cat span{ font-size: 11px; line-height: 1.6; color: var(--muted); }

/* ------------------------------------------------------------ 列表说明长文 */
.list-seo{
  margin-top: 32px; padding-top: 24px;
  border-top: 1px solid var(--line);
}
.list-seo h2{ font-size: 17px; }
.list-seo p{
  margin-top: 12px;
  max-width: 62em;
  font-size: 14px; line-height: 2; color: var(--body);
}

/* --------------------------------------------------------------- 分页（备用） */
.pager{ margin-top: 26px; display: flex; justify-content: center; gap: 6px; }
.pager a, .pager span{
  min-width: 34px; height: 34px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 12.5px; color: var(--body); background: #fff;
}
.pager [aria-current="page"]{ background: var(--red); border-color: var(--red); color: #fff; }

/* ============================================================== 详情页 */
.article-layout{
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 254px;
  gap: 40px;
  align-items: start;
}

.article-head{ }
.article-head .eyebrow{ margin-bottom: 9px; }
.article-head h1{
  font-size: clamp(25px, 2.5vw, 35px);
  line-height: 1.32;
  color: var(--red-ink);
  letter-spacing: -.01em;
}
.article-lead{
  margin-top: 12px;
  font-size: 14px; line-height: 1.9; color: var(--body);
  max-width: 40em;
}
.keyfact{
  margin-top: 18px;
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.keyfact > div{ background: var(--surface); padding: 11px 14px; }
.keyfact dt{ font-size: 10.5px; letter-spacing: .1em; color: var(--muted-2); }
.keyfact dd{ margin: 4px 0 0; font: 600 13.5px/1.4 var(--font-sans); color: var(--ink); }

/* 侧栏：参数 + 目录 */
.article-aside{
  position: sticky; top: calc(var(--header-h) + 18px);
  display: flex; flex-direction: column; gap: 16px;
}
.toc{
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.toc h2{ font-size: 13px; letter-spacing: .04em; }
.toc ol{ margin-top: 9px; display: grid; gap: 1px; list-style: none; counter-reset: toc; }
.toc a{
  display: block; padding: 6px 0 6px 20px; position: relative;
  font-size: 12px; line-height: 1.5; color: var(--muted);
  border-left: 1px solid var(--line);
  transition: color .18s ease, border-color .18s ease;
}
.toc a::before{
  counter-increment: toc; content: counter(toc, decimal-leading-zero);
  position: absolute; left: 8px; font-size: 10px; color: var(--muted-2);
}
.toc a:hover{ color: var(--red-ink); border-left-color: var(--red); }
.toc a.is-current{ color: var(--red-ink); border-left-color: var(--red); font-weight: 600; }

.toc-toggle{ display: none; }

/* 正文 */
.article-body{ max-width: 46em; }
.article-body h2{
  margin-top: 34px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 18.5px; line-height: 1.5;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body h2:first-of-type{ margin-top: 26px; }
.article-body p{
  margin-top: 12px;
  font-size: 14.5px; line-height: 2.05; color: var(--body);
}
.article-body a{
  color: var(--red-ink);
  border-bottom: 1px solid rgba(164,28,28,.4);
}
.article-body a:hover{ border-bottom-color: var(--red); }
.article-body figure{
  margin: 22px 0 4px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-2);
}
.article-body figure img{
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
}

/* 同类做法 */
.related-dishes{ margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.related-dishes h2{ font-size: 17px; }
.related-grid{
  margin-top: 14px;
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px;
}
.related-card{
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.related-card:hover{ border-color: var(--red); box-shadow: var(--shadow); }
.related-card img{ width: 100%; aspect-ratio: 2.6 / 1; object-fit: cover; background: var(--cream-2); }
.related-card .body{ padding: 10px 13px 12px; }
.related-card b{ font: 600 14px/1.35 var(--font-serif); color: var(--ink); }
.related-card span{ display: block; margin-top: 4px; font-size: 11px; line-height: 1.7; color: var(--muted); }

/* ----------------------------------------------------------- 响应式 */
@media (max-width: 1180px){
  .list-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
  .article-layout{ grid-template-columns: minmax(0,1fr) 230px; gap: 30px; }
  .related-cat-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 980px){
  .article-layout{ grid-template-columns: minmax(0,1fr); }
  .article-aside{ position: static; order: -1; }
  .toc{ display: none; }
  .toc[data-open="true"]{ display: block; }
  .toc-toggle{
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; height: 40px; padding: 0 14px; margin-top: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    font: 600 12.5px/1 var(--font-sans); color: var(--ink); cursor: pointer;
  }
  .toc-toggle::after{ content: "+"; color: var(--red); font-size: 15px; }
  .toc-toggle[aria-expanded="true"]::after{ content: "−"; }
  .list-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .related-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .keyfact{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 720px){
  .page-hero h1{ font-size: 26px; }
  .toolbar{ padding: 10px 12px; }
  .chip{ height: 28px; padding: 0 11px; font-size: 12px; }
  .list-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 12px; }
  .list-card h2{ font-size: 14px; }
  .list-card p{ font-size: 11px; }
  .related-cat-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .article-head h1{ font-size: 25px; }
  .article-body p{ font-size: 14px; line-height: 1.98; }
  .related-grid{ grid-template-columns: minmax(0,1fr); }
}

/* 细节修正：目录折叠按钮与列表卡链接的指针反馈 */
.toc-toggle{ cursor: pointer; }
.list-card > a{ display: block; }
.list-card > a:focus-visible{ outline: 2px solid var(--red); outline-offset: -2px; }

/* ------------------------------------------------ 对接数据库后的结构覆盖 */
/* 页脚：三列 grid → 一行四栏 flex（品牌 / 菜谱分类 / 热门专题 / 关于本站） */
.footer-inner{
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 28px 32px; align-items: flex-start;
}
.footer-brand{ flex: 1 1 240px; min-width: 200px; }
.footer-col{ flex: 1 1 150px; min-width: 140px; }
.footer-title{
  margin-bottom: 10px;
  font: 600 10.5px/1.4 var(--font-sans);
  letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255,246,238,.66);
}
.footer-nav.footer-col{
  display: flex; flex-direction: column; align-items: flex-start;
  flex-wrap: nowrap; gap: 6px; padding-top: 0; font-size: 12.5px;
}
.footer-meta{ text-align: left; font-size: 11.5px; }
.footer-meta p + p{ margin-top: 6px; }

/* 卡片文字截断：数据库标题/摘要长度不可控，保证同排等高 */
.list-card h2,
.list-card p,
.dish h3,
.dish p,
.related-card b,
.related-card span{
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.list-card h2{ -webkit-line-clamp: 2; }
.list-card p{ -webkit-line-clamp: 3; }
.dish h3{ -webkit-line-clamp: 1; }
.dish p{ -webkit-line-clamp: 2; }
.related-card b{ -webkit-line-clamp: 2; }
.related-card span{ -webkit-line-clamp: 2; }

/* 980px 以下：抽屉按钮已移除，导航改为常显横滚，避免整站无导航 */
@media (max-width: 980px){
  .nav{
    position: static; left: auto; right: auto; top: auto;
    display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;
    gap: 16px; margin-left: auto; padding: 0;
    min-width: 0; max-width: 100%;
    background: transparent; border-bottom: 0;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar{ display: none; }
  .nav a{
    padding: 6px 0; border-bottom: 0; font-size: 13px;
  }
  .nav a::after{ display: block; }

  .footer-inner{ flex-direction: column; gap: 22px; }
  .footer-brand,
  .footer-col{ flex: 1 1 auto; width: 100%; min-width: 0; }
  .footer-nav.footer-col{
    flex-direction: row; flex-wrap: wrap; gap: 6px 18px;
  }
}

@media (max-width: 720px){
  .header-inner{ gap: 14px; }
  .brand-kicker{ display: none; }
  .nav{ gap: 14px; }
  .nav a{ font-size: 12.5px; }
}
