/* 曲率块:两张卡片前后堆叠(comb.js 生成)。
 * 后面那张向上露出一条边、缩小一点、压暗,点它就翻到前面来。
 * 姿态用 transform(静止位置),翻转动画由 comb.js 用 Web Animations 在上面叠加;
 * 入场动画(reveal.css)用独立的 translate / scale 属性,两者互不覆盖。
 * 梳子颜色:G3 用 --accent-fg,圆弧用珊瑚红。数字和标注用 currentColor / --t2,随深浅主题切换。 */

/* ── 堆叠 ── */
.cstack { --peek: 56px; position: relative; display: grid; padding-top: var(--peek); }
.cstack > .cstack__card { grid-area: 1 / 1; transform-origin: 50% 0; transition: transform .35s var(--ease-out, ease); }
.cstack.is-flipping > .cstack__card { transition: none; }
/* box-sizing 必须是 border-box:否则 height:100% 之外再加内边距,玻璃面会比卡片高出一圈,
 * 底部被 G3 裁切线切掉(手机上最后一行字就是这样被切的)。 */
.cstack > .cstack__card > .mica__face { box-sizing: border-box; display: flex; flex-direction: column; height: 100%; padding: 26px; }
.cstack > [data-pos="front"] { z-index: 2; }
.cstack > [data-pos="back"] { z-index: 1; cursor: pointer; transform: translateY(calc(var(--peek) * -1)) scale(.94); }
.cstack > [data-pos="back"]:hover { transform: translateY(calc(var(--peek) * -1 - 6px)) scale(.94); }
/* 压暗:一层盖在玻璃上的底色,跟着 G3 轮廓裁切。不用 opacity / filter,免得破坏里面的 backdrop-filter */
.cstack__card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  clip-path: var(--g3);
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s;
}
.cstack > [data-pos="back"]::after { opacity: .5; }
.cstack > [data-pos="back"]:hover::after { opacity: .36; }
.cstack__card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 28px; }

.cstack__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cstack__head h3 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cstack__hint { display: none; flex: none; padding: 5px 12px; border-radius: 999px; font-size: 12px; color: var(--accent-fg); background: var(--accent-bg); }
.cstack > [data-pos="back"] .cstack__hint { display: inline-block; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 760px) {
  .cstack { --peek: 52px; }
  .cstack > .cstack__card > .mica__face { padding: 22px 20px; }
  .cstack__head h3 { font-size: 16px; }
}

/* ── 曲率梳 ── */
/* 两张卡等高:矮的那张把内容在卡片里垂直居中,不让空白全堆在底部 */
.comb-pair { flex: 1; align-content: center; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 14px; justify-items: center; }
.comb-pair figure { margin: 0; width: 100%; max-width: 300px; }
.comb-pair svg { display: block; width: 100%; height: auto; overflow: visible; }
.comb-pair figcaption { margin-top: 10px; font-size: var(--fs-aux); color: var(--t2); text-align: center; }
.comb-pair figcaption b { display: block; font-weight: 500; color: var(--t1); font-size: var(--fs-body); }
.comb-pair .outline { fill: none; stroke: currentColor; stroke-opacity: .22; stroke-width: 1.5; }
.comb-pair .tips { fill: none; stroke: currentColor; stroke-opacity: .5; stroke-width: 1; stroke-dasharray: 2 3; }
.comb-pair .comb-arc { stroke: #ff7a6b; stroke-width: 1.4; stroke-linecap: round; }
.comb-pair .comb-g3 { stroke: var(--accent-fg); stroke-width: 1.4; stroke-linecap: round; }
.comb-pair .tipline { fill: none; stroke-width: 1.4; }
@media (max-width: 560px) { .comb-pair { gap: 10px; } }

/* ── 曲率曲线 ── */
.axis-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; align-items: center; margin-top: 18px; }
.axis { display: block; width: 100%; max-width: 440px; height: auto; justify-self: center; overflow: visible; }
.axis-base { stroke: currentColor; stroke-opacity: .22; }
.axis-guide { stroke: currentColor; stroke-opacity: .12; stroke-dasharray: 3 4; }
.axis-arc { fill: none; stroke: #ff7a6b; stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 7 5; }
.axis-g3 { fill: none; stroke: var(--accent); stroke-width: 2.75; stroke-linecap: round; stroke-linejoin: round; }
.axis-txt { font-size: 10.5px; fill: currentColor; fill-opacity: .5; }
.axis-txt--g3 { fill: var(--accent-fg); fill-opacity: .95; }
.axis-side p { margin: 12px 0 0; color: var(--t2); font-size: var(--fs-aux); }
.axis-legend { display: flex; gap: 18px; font-size: var(--fs-aux); color: var(--t1); }
.axis-legend i { display: inline-block; width: 22px; height: 0; border-top: 2.5px solid; vertical-align: middle; margin-right: 8px; }
.axis-legend .arc { color: #ff7a6b; border-top-style: dashed; }
.axis-legend .g3 { color: var(--accent); }
@media (max-width: 760px) {
  .axis-wrap { grid-template-columns: 1fr; gap: 14px; }
  /* 峰值倍数图上已经标了,手机上省掉这句,两张卡的高度差就小很多 */
  .axis-side p:last-child { display: none; }
}

/* ── 翻到前面时重播:梳齿从根部长出来,曲线从左往右描出来 ── */
.cstack[data-play] [data-pos="front"] .tipline {
  stroke-dasharray: var(--len);
  animation: comb-tooth .7s var(--ease-out, ease-out) calc(var(--i) * 16ms + 350ms) backwards;
}
.cstack[data-play] [data-pos="front"] .tips { animation: comb-fade .6s ease-out 1.2s backwards; }
.cstack[data-play] [data-pos="front"] .axis-g3 {
  stroke-dasharray: var(--len);
  animation: comb-draw 1.3s var(--ease-out, ease-out) .35s backwards;
}
.cstack[data-play] [data-pos="front"] .axis-arc { animation: comb-fade .8s ease-out .7s backwards; }
.cstack[data-play] [data-pos="front"] .axis-txt { animation: comb-fade .6s ease-out 1s backwards; }
@keyframes comb-tooth { from { stroke-dashoffset: var(--len); } }
@keyframes comb-draw  { from { stroke-dashoffset: var(--len); } }
@keyframes comb-fade  { from { opacity: 0; } }
