/* style.css — 电子乐器 首页 / 内页布局
   分区高度与 03-ui/compare-log.md 的「量稿 → 分区预算」一一对应 */

/* ============ M1 hero ============ */
.hero {
  position: relative;
  min-height: var(--hero-h);
  display: flex; align-items: flex-start;
  background: var(--dark);
  color: var(--ink-invert);
  overflow: hidden;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 64% 50%; }
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, #141414 0%, rgba(20,20,20,.96) 34%, rgba(20,20,20,.78) 50%, rgba(20,20,20,.3) 72%, rgba(20,20,20,.12) 100%),
    linear-gradient(180deg, rgba(20,20,20,.55) 0%, rgba(20,20,20,0) 34%, rgba(20,20,20,.28) 100%);
}
.hero-inner { position: relative; z-index: 1; padding-top: 42px; padding-bottom: 40px; }
.hero-title { max-width: 620px; font-size: var(--fs-4xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.14; }
.hero-lead {
  max-width: 596px; margin-top: 26px;
  font-size: 17px; line-height: 1.72; color: rgba(244, 244, 244, .8);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ============ 分类卡（M2–M8） ============ */
.categories { padding-top: 20px; padding-bottom: 12px; }
.cat-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 20px; }
.cat-grid > .cat-card { grid-column: span 3; }
.cat-grid > .cat-card--wide { grid-column: span 4; }
.cat-card--wide .card-media { aspect-ratio: 4.8 / 1; }

/* ============ M9 编辑精选 ============ */
.featured { padding-top: 15px; padding-bottom: 12px; }
.featured .wrap, .latest { position: relative; }
.sec-more--float { position: absolute; top: 2px; right: 0; }
.featured .sec-head { margin-bottom: 14px; }
.feature-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.feature-grid > .feature-card { grid-column: span 4; }

/* ============ M10 + M11 双栏 ============ */
.split { display: grid; grid-template-columns: minmax(0, .54fr) minmax(0, 1fr); gap: 20px; align-items: start; padding-bottom: 14px; }
.split .sec-title { font-size: 19px; }
.latest .entry-list li + li { border-top: 1px solid var(--line-2); }

.knowledge .sec-head { padding-top: 14px; }
.path { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding-top: 8px; }
.path-step { position: relative; text-align: center; }
.path-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-bottom: 12px; border-radius: 50%;
  background: var(--accent-soft); color: #fff; font-size: 13px; font-weight: 800;
}
.path-num::before { content: attr(data-n); }
.path-step:not(:last-child)::before {
  content: ""; position: absolute; top: 14px; left: calc(50% + 26px); right: calc(-50% + 26px);
  height: 2px; background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}
.path-step:not(:last-child)::after {
  content: ""; position: absolute; top: 10px; right: calc(-50% + 21px);
  width: 9px; height: 9px; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent);
  transform: rotate(45deg);
}
.path-box { padding: 14px 14px 16px; background: var(--surface-warm); border-radius: var(--radius-sm); }
.path-box h3 { font-size: 15px; font-weight: 800; color: var(--ink); }
.path-box p { margin-top: 8px; font-size: var(--fs-sm); line-height: 1.62; color: var(--ink-2); }

/* ============ M12 信号链 ============ */
.chain { padding-top: 20px; padding-bottom: 12px; }
.chain .sec-head { margin-bottom: 20px; }
.chain-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.chain-item { position: relative; text-align: center; }
.chain-thumb { display: flex; align-items: center; justify-content: center; height: 66px; }
.chain-thumb img { width: 104px; height: 54px; object-fit: cover; border-radius: 6px; }
.chain-thumb .ico { width: 46px; height: 46px; color: var(--ink); }
.chain-item h3 { margin-top: 12px; font-size: 14px; font-weight: 800; color: var(--ink); }
.chain-item p { max-width: 250px; margin: 7px auto 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-3); }
.chain-item:not(:last-child)::before {
  content: ""; position: absolute; top: 33px; left: calc(50% + 62px); right: calc(-50% + 62px);
  height: 2px; background: var(--accent-soft);
}
.chain-item:not(:last-child)::after {
  content: ""; position: absolute; top: 29px; right: calc(-50% + 57px);
  width: 9px; height: 9px; border-top: 2px solid var(--accent-soft); border-right: 2px solid var(--accent-soft);
  transform: rotate(45deg);
}

/* ============ M13 编辑说明 ============ */
.note { padding-bottom: 8px; }
.note-box {
  position: relative; display: flex; align-items: center;
  min-height: var(--note-h); padding: 26px 380px 26px 34px;
  background: var(--wash); border-radius: var(--radius); overflow: hidden;
}
.note-title-row { display: flex; align-items: center; gap: 12px; }
.note-icon { flex: none; width: 26px; height: 26px; color: var(--accent-dark); }
.note-body { max-width: 720px; }
.note-body h2 { font-size: 21px; font-weight: 800; color: var(--ink); }
.note-body p { margin-top: 10px; font-size: 13px; line-height: 1.66; color: #4a3d31; }
.note-media { position: absolute; top: 0; right: 0; bottom: 0; width: 340px; }
.note-media img { width: 100%; height: 100%; object-fit: cover; }
.note-media::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, var(--wash) 0%, rgba(244, 220, 188, 0) 42%);
}

/* ============ 内页：分类页 ============ */
.page-hero { padding: 30px 0 26px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-3); }
.crumbs li { display: flex; align-items: center; gap: 8px; }
.crumbs li + li::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.crumbs a:hover { color: var(--accent); }
.page-hero h1 { margin-top: 12px; font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.page-hero p { max-width: 860px; margin-top: 12px; font-size: var(--fs-base); line-height: 1.72; color: var(--ink-2); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  padding: 14px 18px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.toolbar .fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .flabel { flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); letter-spacing: .04em; white-space: nowrap; }
.toolbar label.flabel { cursor: pointer; }
.chip {
  flex: 0 0 auto; white-space: nowrap;
  height: 30px; padding: 0 13px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.chip:hover { border-color: var(--accent-soft); color: var(--accent-dark); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.toolbar select {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font-size: var(--fs-sm); color: var(--ink-2); font-family: inherit;
}
.toolbar .result { margin-left: auto; font-size: var(--fs-sm); color: var(--ink-3); }
.chip--link { display: inline-flex; align-items: center; }
.chip--link:hover { border-color: var(--accent-soft); color: var(--accent-dark); }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; }
.pager a, .pager span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2);
}
.pager a:hover { border-color: var(--accent-soft); color: var(--accent-dark); }
.pager .pager-nav { padding: 0 16px; }
.pager .is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .is-gap { border-color: transparent; background: transparent; color: var(--ink-3); }

.list-section { padding-top: 20px; padding-bottom: 16px; }
.list-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; margin-top: 4px; }
.list-grid > .cat-card { grid-column: span 3; }
.list-grid > .cat-card .card-media { aspect-ratio: 2 / 1; }
.empty-state { padding: 30px; text-align: center; color: var(--ink-3); font-size: var(--fs-base); }
.empty-state .btn { margin-top: 12px; }

.desc-block {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0 40px; align-items: start;
  padding: 26px 30px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.desc-block h2 { font-size: var(--fs-xl); line-height: 1.35; }
.desc-block p { margin-top: 2px; font-size: var(--fs-base); line-height: 1.86; color: var(--ink-2); }
.desc-section { padding: 22px 0 26px; }

.related-head { margin-bottom: 14px; }
.related-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding-bottom: 30px; }
.rel-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 20px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 15.5px; font-weight: 700;
}
.rel-card svg { width: 15px; height: 15px; color: var(--accent); }
.rel-card:hover { color: var(--accent-dark); }

/* ============ 内页：详情页 ============ */
.article-head { padding: 26px 0 18px; }
.article-head h1 { margin-top: 12px; font-size: 38px; font-weight: 800; letter-spacing: -.02em; max-width: 900px; }
.article-lead { max-width: 780px; margin-top: 14px; font-size: var(--fs-md); line-height: 1.78; color: var(--ink-2); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; font-size: var(--fs-sm); color: var(--ink-3); }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 44px; align-items: start; padding-bottom: 26px; }
.article-body { grid-column: 1; grid-row: 1; }
.toc { grid-column: 2; grid-row: 1; }
.article-body { max-width: 780px; }
.article-body .body-lead { font-size: 16.5px; line-height: 1.86; color: var(--ink-2); padding-bottom: 6px; }
.article-body h2 { margin-top: 34px; font-size: 24px; font-weight: 800; letter-spacing: -.01em; scroll-margin-top: 108px; }
.article-body h2::before { content: ""; display: block; width: 34px; height: 3px; margin-bottom: 12px; border-radius: 2px; background: var(--accent); }
.article-body p { margin-top: 12px; font-size: 15.5px; line-height: 1.92; color: var(--ink-2); }
.sec-figure { margin: 22px 0 0; }
.sec-figure img { width: 100%; height: auto; border-radius: var(--radius-sm); background: var(--surface-2); }

.toc { position: sticky; top: 108px; padding: 18px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.toc h2 { font-size: var(--fs-sm); font-weight: 800; letter-spacing: .06em; color: var(--ink-3); }
.toc ol { margin-top: 10px; counter-reset: toc; }
.toc li + li { margin-top: 2px; }
.toc a { display: block; padding: 6px 0 6px 22px; position: relative; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; }
.toc a::before { counter-increment: toc; content: counter(toc); position: absolute; left: 0; top: 7px; font-size: 11px; font-weight: 700; color: var(--accent); }
.toc a:hover { color: var(--accent-dark); }
.toc a[aria-current="true"] { color: var(--accent-dark); font-weight: 700; }
.toc-toggle {
  display: none; align-items: center; justify-content: center; gap: 6px;
  margin-left: auto; width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2);
}
.toc-toggle svg { width: 15px; height: 15px; }

.spec-wrap { padding: 6px 0 28px; }
.spec-wrap h2 { font-size: var(--fs-xl); margin-bottom: 14px; }
.spec-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.spec-table caption { text-align: left; font-size: var(--fs-sm); color: var(--ink-3); padding-bottom: 10px; }
.spec-table th, .spec-table td { padding: 14px 20px; text-align: left; font-size: 14px; vertical-align: top; }
.spec-table thead th { background: var(--surface-warm); font-size: var(--fs-sm); font-weight: 800; color: var(--ink); letter-spacing: .04em; }
.spec-table tbody tr + tr { border-top: 1px solid var(--line-2); }
.spec-table tbody th { width: 150px; font-weight: 800; color: var(--ink); }
.spec-table tbody td { color: var(--ink-2); line-height: 1.7; }

.related-list { padding-bottom: 30px; }
.related-list h2 { font-size: var(--fs-xl); margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.related-grid .rel-card { font-size: 14.5px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-size: var(--fs-sm); font-weight: 700; color: var(--accent-dark); }
.back-link svg { width: 15px; height: 15px; flex: none; }

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .cat-grid > .cat-card, .cat-grid > .cat-card--wide { grid-column: span 6; }
  .cat-grid > .cat-card { min-height: 0 !important; }
  .feature-grid > .feature-card { grid-column: span 6; }
  .feature-grid > .feature-card:first-child { grid-column: span 12; }
  .list-grid > .cat-card { grid-column: span 6; }
  .split { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 20px; }
  .article-body, .toc { grid-column: 1; grid-row: auto; }
  .article-body { max-width: none; }
  .toc { position: static; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .toc h2 { order: 1; }
  .toc-toggle { display: inline-flex; order: 2; }
  .toc ol { order: 3; flex-basis: 100%; display: none; margin-top: 4px; }
  .toc.is-open ol { display: block; }
  .note-box { padding-right: 34px; }
  .note-media { display: none; }
  .related-cats { grid-template-columns: repeat(2, 1fr); }
  .desc-block { grid-template-columns: 1fr; }
  .desc-block p { margin-top: 10px; }
}

@media (max-width: 900px) {
  :root { --gutter: 22px; --header-h: 68px; }
  .nav-toggle { display: block; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    display: none; flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 0 14px; background: rgba(24, 25, 26, .98);
    border-bottom: 1px solid var(--line-invert);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .site-nav.is-open { display: flex; }
  .site-nav .nav-item { display: block; }
  .site-nav .nav-item.has-drop .nav-drop {
    display: block; position: static; max-height: none; overflow: visible;
    min-width: 0; padding: 0 0 6px; background: transparent;
    border: 0; box-shadow: none;
  }
  .site-nav a { padding: 13px var(--gutter); border-radius: 0; font-size: 16px; }
  .nav-drop a { padding: 9px var(--gutter) 9px calc(var(--gutter) + 14px); font-size: 14px; color: var(--ink-invert-3); }
  .site-nav a.is-active::after,
  .site-nav a[aria-current="page"]::after { left: var(--gutter); right: auto; width: 22px; bottom: 8px; }
  .brand-name { font-size: 19px; }

  .hero { min-height: 0; }
  .hero-inner { padding-top: 30px; padding-bottom: 34px; }
  .hero-title { font-size: 34px; }
  .hero-lead { margin-top: 18px; font-size: 14.5px; }
  .hero-actions { margin-top: 22px; }
  .hero-media img { object-position: 70% 50%; }
  .hero-media::after { background: linear-gradient(90deg, #141414 0%, rgba(20,20,20,.94) 46%, rgba(20,20,20,.72) 100%); }

  .feature-grid > .feature-card, .feature-grid > .feature-card:first-child { grid-column: span 12; }
  .path { grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
  .path-step:nth-child(2)::before, .path-step:nth-child(2)::after { display: none; }
  .chain-row { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .chain-item:nth-child(2)::before, .chain-item:nth-child(2)::after { display: none; }
  .article-head h1, .page-hero h1 { font-size: 30px; }
  .article-body h2 { font-size: 21px; }
  .spec-table tbody th { width: 100px; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .cat-grid > .cat-card, .cat-grid > .cat-card--wide,
  .list-grid > .cat-card, .feature-grid > .feature-card { grid-column: span 12; }
  .cat-card .card-media, .feature-card .card-media { aspect-ratio: 2 / 1; }
  .cat-card-go { display: none; }
  .path, .chain-row { grid-template-columns: 1fr; }
  .path-step::before, .path-step::after, .chain-item::before, .chain-item::after { display: none; }
  .path-step { text-align: left; }
  .path-num { margin-bottom: 8px; }
  .hero-title { font-size: 28px; }
  .note-box { padding: 22px; }
  .related-cats { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .toolbar .fgroup { width: 100%; }
  .toolbar .flabel { width: 100%; }
  .toolbar .result { margin-left: 0; width: 100%; }
  .article-body h2 { margin-top: 28px; }
  .desc-block { grid-template-columns: 1fr; padding: 20px; }
  .desc-block p { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
