/* 看得见的物理 · 首页样式（只在 index.html 中引入；首屏动画见 assets/js/home.js） */

/* ---------- 首屏 ---------- */
.hx {
  position: relative; overflow: hidden; color: #fff; display: flex; touch-action: pan-y;
  min-height: clamp(600px, calc(100vh - var(--topbar-h)), 820px);
  background:
    radial-gradient(900px 520px at 72% 42%, #1b2a6b 0%, transparent 70%),
    radial-gradient(700px 400px at 6% 100%, #0b3a46 0%, transparent 70%),
    linear-gradient(180deg, #050918, #0a1230);
}
.hx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hx-inner { position: relative; z-index: 1; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 28px; padding-top: 56px; padding-bottom: 72px; }
.hx-text { align-self: center; max-width: 580px; }
.hx-badge { display: inline-flex; align-items: center; gap: 9px; padding: 5px 14px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); font-size: .86rem; color: rgba(255, 255, 255, .86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hx-badge i { width: 8px; height: 8px; border-radius: 50%; background: #51cf66; box-shadow: 0 0 0 0 rgba(81, 207, 102, .6); animation: hxPulse 2s infinite; }
@keyframes hxPulse { 0% { box-shadow: 0 0 0 0 rgba(81, 207, 102, .6); } 70% { box-shadow: 0 0 0 9px rgba(81, 207, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(81, 207, 102, 0); } }
.hx h1 { font-size: clamp(2.5rem, 4.6vw, 3.9rem); line-height: 1.16; letter-spacing: .03em; margin: 20px 0 16px; text-shadow: 0 4px 30px rgba(0, 0, 0, .35); }
.hx h1 em { font-style: normal; background: linear-gradient(90deg, #74c0fc, #63e6be 55%, #ffd43b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hx-lead { font-size: 1.12rem; color: rgba(255, 255, 255, .76); max-width: 540px; margin: 0; }
.hx-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hx-actions .btn:hover { text-decoration: none; }
.hx-btn-main { border: 0; color: #fff; background: linear-gradient(135deg, #4c6ef5, #15aabf); box-shadow: 0 10px 30px rgba(76, 110, 245, .45); transition: transform .15s, box-shadow .15s, filter .15s; }
.hx-btn-main:hover { color: #fff; background: linear-gradient(135deg, #4c6ef5, #15aabf); filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 14px 34px rgba(76, 110, 245, .55); }
.hx-btn-ghost { color: #fff; background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hx-btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .45); }
.hx-checks { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 6px 20px; color: rgba(255, 255, 255, .66); font-size: .9rem; }
.hx-checks li::before { content: "✓"; color: #63e6be; font-weight: 800; margin-right: 6px; }

.hx-right { display: flex; flex-direction: column; min-height: 540px; }
.hx-stage { flex: 1; min-height: 320px; cursor: grab; }
.hx.hx-drag .hx-stage { cursor: grabbing; }
.hx-cap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  background: rgba(10, 18, 45, .55); border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; padding: 14px 16px 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.hx-cap-body { display: flex; flex-direction: column; gap: 1px; min-height: 84px; }
.hx-cap.in .hx-cap-body { animation: hxCap .55s ease; }
@keyframes hxCap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hx-cap-tag { font-size: .78rem; font-weight: 700; letter-spacing: .06em; color: #74c0fc; }
.hx-cap-title { font-size: 1.16rem; }
.hx-cap-desc { font-size: .9rem; line-height: 1.6; color: rgba(255, 255, 255, .72); }
.hx-cap-link { align-self: center; white-space: nowrap; color: #fff; font-weight: 700; font-size: .9rem; padding: 7px 15px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); }
.hx-cap-link:hover { text-decoration: none; background: rgba(255, 255, 255, .2); }
.hx-cap-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 10px; margin-top: 6px; }
.hx-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.hx-pill { position: relative; overflow: hidden; font: inherit; font-size: .8rem; font-weight: 600; line-height: 1.6; color: rgba(255, 255, 255, .72); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: 2px 11px; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.hx-pill:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.hx-pill.on { color: #fff; background: rgba(116, 192, 252, .18); border-color: rgba(116, 192, 252, .55); }
.hx-pill i { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, #74c0fc, #63e6be); display: none; }
.hx-pill.on i { display: block; }
.hx-hint { font-size: .78rem; color: rgba(255, 255, 255, .45); }

/* ---------- 数字 ---------- */
.hx-stats { position: relative; z-index: 2; margin-top: -44px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 18px 8px; }
.stat { text-align: center; padding: 2px 10px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat b { display: block; line-height: 1.25; }
.stat b span { font-size: 2.15rem; font-weight: 800; letter-spacing: .01em; background: linear-gradient(90deg, #3b5bdb, #0c8599); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.stat b small { font-size: .9rem; font-weight: 700; color: var(--muted); margin-left: 3px; }
.stat > span { font-size: .88rem; color: var(--muted); }

/* ---------- 小标题 ---------- */
.sec-head { margin: 60px 0 18px; }
.sec-head .kicker, .lab-hero .kicker { display: inline-block; font-size: .76rem; font-weight: 800; letter-spacing: .14em; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 1px 11px; margin-bottom: 8px; }
.sec-head h2 { margin: 0; font-size: 1.65rem; }
.sec-head p { margin: 6px 0 0; color: var(--muted); }

/* ---------- 三种方式 ---------- */
.feat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 20px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feat::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--fs); opacity: .5; }
.feat-ico { position: relative; z-index: 1; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--fg); box-shadow: 0 8px 18px var(--fsh); }
.feat-ico svg { width: 26px; height: 26px; }
.feat h3 { margin: 14px 0 6px; font-size: 1.14rem; }
.feat p { margin: 0; color: var(--muted); font-size: .94rem; }
.f-anim { --fg: linear-gradient(135deg, #f76707, #fab005); --fs: #fff3df; --fsh: rgba(247, 103, 7, .3); }
.f-3d { --fg: linear-gradient(135deg, #4c6ef5, #15aabf); --fs: #e8edff; --fsh: rgba(76, 110, 245, .3); }
.f-lab { --fg: linear-gradient(135deg, #0ca678, #38d9a9); --fs: #e6fcf5; --fsh: rgba(12, 166, 120, .3); }

/* ---------- 精选 3D 模型 ---------- */
.gal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.gal-nav { display: flex; gap: 8px; flex: none; }
.gal-nav button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 400 1.5rem/1 var(--font); cursor: pointer; box-shadow: var(--shadow); padding: 0 0 3px; }
.gal-nav button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.gal-nav button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.gal-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 3 * 18px) / 4); gap: 18px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding: 4px 2px 14px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.gal-track::-webkit-scrollbar { height: 8px; }
.gal-track::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.gal-card { scroll-snap-align: start; position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: #0d1626; color: #fff; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; }
.gal-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.gal-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s ease; }
.gal-card:hover img { transform: scale(1.06); }
.gal-card::before { content: "3D"; position: absolute; z-index: 1; top: 10px; left: 10px; font-size: .72rem; font-weight: 800; color: var(--primary); background: rgba(255, 255, 255, .94); padding: 0 8px; border-radius: 6px; box-shadow: var(--shadow); }
.gal-info { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; padding: 36px 14px 11px; background: linear-gradient(rgba(8, 14, 32, 0), rgba(8, 14, 32, .88)); line-height: 1.45; }
.gal-info span { font-size: .78rem; opacity: .82; }
.gal-info b { font-size: 1.05rem; }

/* ---------- 全部章节 ---------- */
.d-mech { --dc: #3b5bdb; --dc-soft: #e8edff; }
.d-sound { --dc: #0c8599; --dc-soft: #e3f7f9; }
.d-light { --dc: #e67700; --dc-soft: #fff3df; }
.d-heat { --dc: #e03131; --dc-soft: #ffeded; }
.d-em { --dc: #7048e8; --dc-soft: #f0ebff; }
.d-info { --dc: #2b8a3e; --dc-soft: #e5f6e9; }
.topic-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.topic-label { color: var(--muted); font-size: .9rem; margin-right: 2px; }
.topic-bar button { font: inherit; font-size: .88rem; font-weight: 600; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.topic-bar button::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dc); margin-right: 7px; vertical-align: 1px; }
.topic-bar button[data-d=""]::before { display: none; }
.topic-bar button:hover { border-color: var(--dc, var(--ink-2)); }
.topic-bar button.on { background: var(--dc, var(--ink)); border-color: var(--dc, var(--ink)); color: #fff; }
.topic-bar button.on::before { background: #fff; }

.book { margin-top: 26px; transition: opacity .25s; }
.book-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.book-head h3 { margin: 0; font-size: 1.28rem; display: flex; align-items: center; gap: 10px; }
.book-head h3::before { content: ""; width: 6px; height: 22px; border-radius: 3px; background: var(--bk); }
.b8a { --bk: linear-gradient(#4c6ef5, #15aabf); }
.b8b { --bk: linear-gradient(#fab005, #f76707); }
.b9 { --bk: linear-gradient(#7048e8, #e64980); }
.book-pub { color: var(--muted); font-size: .9rem; }
.book-meta { margin-left: auto; color: var(--muted); font-size: .88rem; }
.book-meta b { color: var(--ink); }
.book.book-dim { opacity: .5; }

.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
/* 宽屏：6 章的两册排成 3 列 × 2 行，10 章的九年级排成 5 列 × 2 行，不留单独的一张卡片 */
@media (min-width: 1200px) {
  .b8a .chapter-grid, .b8b .chapter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .b9 .chapter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 600px) and (max-width: 1199px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.chapter-card { position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); padding: 18px 20px 16px 22px; box-shadow: var(--shadow); border: 1px solid var(--line); color: var(--ink); min-height: 150px; transition: transform .15s, box-shadow .15s, border-color .15s, opacity .25s, filter .25s; }
.chapter-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dc, var(--primary)); }
a.chapter-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--dc, var(--primary)); }
.chapter-card .no { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 800; color: var(--muted); letter-spacing: .08em; padding-right: 50px; }
.chapter-card .dm { font-style: normal; font-size: .7rem; font-weight: 700; letter-spacing: .04em; line-height: 1.65; color: var(--dc); background: var(--dc-soft); padding: 0 8px; border-radius: 999px; }
.chapter-card h3 { font-size: 1.18rem; margin: 4px 0 8px; padding-right: 50px; }
.chapter-card p { font-size: .9rem; color: var(--muted); margin: 0 0 10px; flex: 1; }
.chapter-card .ico { position: absolute; right: 14px; top: 14px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: var(--dc-soft, var(--surface-2)); font-size: 1.45rem; transition: transform .2s; }
a.chapter-card:hover .ico { transform: rotate(-8deg) scale(1.08); }
.chapter-card .state { font-size: .8rem; font-weight: 700; }
.chapter-card .state.ready { color: var(--green); }
.chapter-card.dim { opacity: .25; filter: grayscale(1); }

/* ---------- 物理实验台 ---------- */
.lab-hero {
  position: relative; overflow: hidden; margin-top: 60px; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; align-items: center;
  color: #fff; border-radius: 22px; padding: 32px 36px; box-shadow: var(--shadow-lg);
  background: radial-gradient(520px 320px at 88% 30%, rgba(99, 230, 190, .35), transparent 70%), linear-gradient(120deg, #0b5f6e, #0b7285 45%, #1098ad);
}
.lab-hero .kicker { color: #fff; background: rgba(255, 255, 255, .16); }
.lab-hero h2 { font-size: 1.7rem; margin: 2px 0 8px; }
.lab-hero p { opacity: .92; margin: 0 0 16px; max-width: 660px; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.lab-chips a { color: #fff; font-size: .86rem; padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .24); }
.lab-chips a:hover { text-decoration: none; background: rgba(255, 255, 255, .24); }
.lab-go { background: #fff; color: #0b7285; border-color: #fff; }
.lab-go:hover { background: #e6fcf5; color: #0b7285; border-color: #e6fcf5; text-decoration: none; }
.lab-art svg { width: 100%; height: auto; display: block; overflow: visible; }
.lab-wave { animation: labWave 3s linear infinite; }
@keyframes labWave { to { transform: translateX(80px); } }
.bub { animation: labBub 3.4s ease-in infinite; opacity: 0; }
.bub.b2 { animation-delay: .8s; } .bub.b3 { animation-delay: 1.7s; } .bub.b4 { animation-delay: 2.5s; }
@keyframes labBub { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .85; } 100% { transform: translateY(-62px); opacity: 0; } }

/* ---------- 小贴士 ---------- */
.tips3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 56px; }
.tip3 { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.tip3-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.4rem; }
.tip3 h4 { margin: 0 0 2px; }
.tip3 p { margin: 0; font-size: .9rem; color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .gal-track { grid-auto-columns: calc((100% - 2 * 18px) / 3); }
}
@media (max-width: 960px) {
  .hx { min-height: 0; }
  .hx-inner { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-top: 40px; padding-bottom: 64px; }
  .hx-text { max-width: none; }
  .hx-right { min-height: 0; }
  .hx-stage { flex: none; height: min(76vw, 420px); min-height: 0; }
  .hx-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .stat:nth-child(4) { border-left: 0; }
  .feat3, .tips3 { grid-template-columns: minmax(0, 1fr); }
  .lab-hero { grid-template-columns: minmax(0, 1fr); }
  .lab-art { display: none; }
}
@media (max-width: 720px) {
  .hx-inner { padding-top: 30px; }
  .hx h1 { font-size: 2.35rem; margin: 16px 0 12px; }
  .hx-lead { font-size: 1rem; }
  .hx-actions .btn { flex: 1 1 auto; }
  .hx-hint { display: none; }
  .hx-cap { grid-template-columns: minmax(0, 1fr); }
  .hx-cap-link { justify-self: start; }
  .hx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: -40px; padding: 14px 4px; }
  .stat, .stat:nth-child(4) { border-left: 1px solid var(--line); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:last-child { grid-column: 1 / -1; }
  .stat b span { font-size: 1.8rem; }
  .sec-head { margin-top: 44px; }
  .sec-head h2 { font-size: 1.4rem; }
  .gal-track { grid-auto-columns: 80%; }
  .lab-hero { padding: 24px 20px; margin-top: 44px; }
  .lab-hero h2 { font-size: 1.4rem; }
  .book-meta { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-badge i, .lab-wave, .bub { animation: none; }
  .bub { opacity: .6; }
}
