/* =============================================================================
 * style.css —— 《平面向量》数形结合法
 * -----------------------------------------------------------------------------
 * 设计基准：舞台固定 1920×1080，由 main.js 用 transform: scale() 适配任意屏幕。
 * 所以这里所有尺寸都写 px，不需要响应式断点。
 *
 * ⚠️ 维护提醒（沿用 saike 项目踩过的坑）：
 *   1. 「第 10 节 动画状态」必须留在文件末尾 —— CSS 权重相同时，靠后生效。
 *   2. 默认就该可见的元素（图中的点、向量、坐标结构）不要写进 [data-step] 隐藏规则。
 *   3. 只对 transform / opacity 做过渡，避免布局抖动。
 * ===========================================================================*/

/* ---------------------------------------------------------------- 0. 变量 */
:root {
  --bg-1: #f2f7f9;
  --bg-2: #e3edf1;
  --ink:   #0f3540;
  --ink-2: #46656f;
  --ink-3: #7e97a1;
  --brand:   #0e7c86;
  --brand-d: #0a5f68;
  --brand-l: #e2f1f3;
  --blue:  #2f6fb5;
  --red:   #d6453d;
  --green: #2f9e63;
  --amber: #e08a2e;
  --violet:#7b52ab;
  --card:  #ffffff;
  --line:  #cbdde3;
  --shadow:   0 8px 26px rgba(15, 53, 64, .09);
  --shadow-s: 0 3px 12px rgba(15, 53, 64, .07);
  --radius: 16px;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
          "Source Han Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a1f25;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- 1. 舞台 */
#stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  background: var(--bg-1);
  overflow: hidden;
  color: var(--ink);
}

.slide {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  /* 顶部 100px：给右上角的品牌 logo（#brand，占 44–84px）让位。
     所有页面统一，保证内容不会与 logo 打架。 */
  padding: 100px 72px 54px;
  background:
    radial-gradient(1200px 700px at 78% -12%, #ffffff 0%, rgba(255,255,255,0) 62%),
    linear-gradient(158deg, var(--bg-1) 0%, var(--bg-2) 100%);
}
.slide.active { display: flex; }

/* ---------------------------------------------------------------- 1.5 品牌标识 */
/* 放在 #stage 里、而不是每个 .slide 里：一个元素管 8 页，
   天然保证「每一页都在完全相同的位置」，也不会随翻页重新加载闪烁。
   打印 PDF 时绝对定位只会在第一页出现，所以 @media print 里另用 .slide::after 逐页补。 */
#brand {
  position: absolute;
  top: 44px;
  right: 72px;
  height: 40px;
  width: auto;
  z-index: 10;
  pointer-events: none;   /* 不挡住「点击画面推进」 */
  user-select: none;
  -webkit-user-drag: none;
}
/* 封面是深色底，logo 的亮蓝在深青上偏闷 —— 加一层白色衬底。
   用 box-shadow 的 spread 向外扩，不占布局、不移动 logo 本身的位置，
   这样深色页与浅色页上 logo 的坐标完全一致。 */
#brand.on-dark {
  background: rgba(255, 255, 255, .93);
  border-radius: 6px;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, .93), 0 6px 20px rgba(0, 0, 0, .22);
}

/* 点阵底纹 */
.slide::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(14,124,134,.09) 1.4px, transparent 1.4px);
  background-size: 34px 34px;
  opacity: .5;
  pointer-events: none;
  z-index: 0;
}
.slide > * { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- 2. 通用页头 */
.head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  flex: 0 0 auto;
}
.head__bar {
  width: 9px; height: 48px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--brand), #16a3ad);
}
.head h2 {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--ink);
}
.head__en {
  font-size: 20px;
  color: var(--ink-3);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 8px;
}
.head__tag {
  margin-left: auto;
  font-size: 22px;
  color: var(--brand-d);
  background: var(--brand-l);
  border-radius: 999px;
  padding: 9px 22px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 3. 封面 */
.slide--cover {
  padding: 0;
  background: linear-gradient(132deg, #072a32 0%, #0b4450 48%, #0f6270 100%);
  justify-content: center;
}
.slide--cover::before {
  background-image:
    radial-gradient(circle, rgba(255,255,255,.10) 1.4px, transparent 1.4px);
  background-size: 40px 40px;
  opacity: .45;
}
.cover__inner {
  position: relative;
  padding-left: 150px;
  display: flex;
  align-items: center;
  gap: 60px;
}
.cover__text { max-width: 1000px; }
.cover__kicker {
  font-size: 24px;
  letter-spacing: 7px;
  color: #6fd3dc;
  margin-bottom: 26px;
  font-weight: 600;
}
.cover__title {
  font-size: 132px;
  font-weight: 800;
  line-height: 1.08;
  color: #ffffff;
  letter-spacing: 4px;
  text-shadow: 0 10px 40px rgba(0,0,0,.30);
}
.cover__sub {
  margin-top: 26px;
  font-size: 54px;
  font-weight: 500;
  color: #a9e6ea;
  letter-spacing: 3px;
}
.cover__rule {
  width: 180px; height: 7px;
  border-radius: 4px;
  margin: 46px 0 34px;
  background: linear-gradient(90deg, #2fd0da, rgba(47,208,218,.05));
}
.cover__by {
  font-size: 32px;
  color: #cfeeef;
  letter-spacing: 2px;
  display: flex; align-items: center; gap: 16px;
}
.cover__by b { color: #fff; font-weight: 700; letter-spacing: 4px; }
.cover__fig { flex: 0 0 auto; opacity: .95; }

/* ---------------------------------------------------------------- 4. 方法总览（10 张卡） */
.methods {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 320px;
  gap: 22px;
  flex: 1 1 auto;
  align-content: center;
}
.mcard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
  border: 1.5px solid #e6eff2;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.mcard__no {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: 1px;
  font-family: "Georgia", serif;
  opacity: .5;
  margin-bottom: 20px;
}
.mcard__name {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}
.mcard__note {
  margin-top: 14px;
  font-size: 20px;
  color: var(--ink-3);
  line-height: 1.5;
}
.mcard--star {
  background: linear-gradient(150deg, #0e7c86 0%, #12a0aa 100%);
  border-color: transparent;
  box-shadow: 0 14px 34px rgba(14,124,134,.30);
}
.mcard--star .mcard__no { color: #bff0f3; opacity: .9; }
.mcard--star .mcard__name { color: #fff; font-size: 29px; }
.mcard--star .mcard__note { color: #cdeff2; }
.mcard--star::after {
  content: "本节课主题";
  position: absolute;
  top: 18px; right: -34px;
  transform: rotate(38deg);
  background: #ffd479;
  color: #6b4708;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 6px 44px;
}

/* ---------------------------------------------------------------- 5. 数形结合（论述页） */
.two-col {
  display: flex;
  gap: 44px;
  flex: 1 1 auto;
  min-height: 0;
}
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 38px 42px;
}
.prose {
  font-size: 29px;
  line-height: 2.0;
  color: #173f4a;
  text-align: justify;
}
.prose b { color: var(--brand-d); font-weight: 700; }
.prose em {
  font-style: normal;
  background: linear-gradient(180deg, transparent 62%, #ffe9a8 62%);
  font-weight: 700;
  padding: 0 3px;
}
.quote {
  margin-top: 26px;
  padding: 22px 30px;
  border-left: 7px solid var(--amber);
  background: linear-gradient(90deg, #fff8ea, rgba(255,248,234,.25));
  border-radius: 0 12px 12px 0;
  font-size: 27px;
  color: #7a5312;
  font-weight: 600;
  display: flex; align-items: center; gap: 16px;
}
.quote__mark { font-size: 44px; color: var(--amber); opacity: .55; font-family: Georgia, serif; line-height: 1; }

/* 双身份对照（代数 / 几何） */
.duo { display: flex; flex-direction: column; gap: 20px; flex: 1 1 auto; justify-content: center; }
.duo__row {
  display: flex; align-items: center; gap: 22px;
  background: var(--card);
  border-radius: 14px;
  padding: 22px 28px;
  box-shadow: var(--shadow-s);
  border: 1.5px solid #e6eff2;
}
.duo__ico {
  width: 62px; height: 62px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; flex: 0 0 auto; color: #fff;
}
.duo__t { font-size: 25px; line-height: 1.6; color: var(--ink-2); }
.duo__t b { display: block; font-size: 28px; color: var(--ink); margin-bottom: 4px; }

/* ---------------------------------------------------------------- 6. 方法讲解（箭头流程） */
.core {
  background: linear-gradient(120deg, #0e7c86, #159aa4);
  color: #fff;
  border-radius: var(--radius);
  padding: 34px 44px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.55;
  box-shadow: 0 14px 34px rgba(14,124,134,.24);
  display: flex; align-items: center; gap: 30px;
  flex: 0 0 auto;
}
.core__step {
  background: rgba(255,255,255,.16);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 25px;
  font-weight: 600;
  white-space: nowrap;
}
.core__arrow { font-size: 34px; opacity: .7; flex: 0 0 auto; }

.conds {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 336px;
  gap: 20px;
  margin-top: 30px;
  flex: 1 1 auto;
  min-height: 0;
  align-content: center;
}
.cond {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow-s);
  border: 1.5px solid #e6eff2;
  border-top: 5px solid var(--brand);
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cond__ico { font-size: 46px; margin-bottom: 18px; line-height: 1; color: var(--brand-d); font-family: Georgia, serif; }
.cond__t { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.cond__d { font-size: 21px; color: var(--ink-3); margin-top: 14px; line-height: 1.6; }

.hint-strip {
  margin-top: auto;
  font-size: 25px;
  color: var(--ink-2);
  background: #fff;
  border-radius: 12px;
  padding: 20px 30px;
  box-shadow: var(--shadow-s);
  display: flex; align-items: center; gap: 16px;
}
.hint-strip b { color: var(--brand-d); }

/* ---------------------------------------------------------------- 7. 例题页 */
.qbar {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border-left: 9px solid var(--brand);
  padding: 22px 34px 22px 26px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 0 0 auto;
}
.qbar__no {
  width: 62px; height: 62px; flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), #16a3ad);
  color: #fff;
  font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(14,124,134,.28);
}
.qbar__text { font-size: 28px; line-height: 1.75; color: #143a45; }
.qbar__text .katex { font-size: 1.1em; }

.exam {
  display: flex;
  gap: 34px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 22px;
}
.solve {
  flex: 1 1 auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 36px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.solve__tag {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-d);
  letter-spacing: 3px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.solve__tag::after {
  content: ""; flex: 1 1 auto; height: 2px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.solve__line {
  font-size: 27px;
  line-height: 2.05;
  color: #17414c;
  margin-bottom: 10px;
}
.solve__line .katex { font-size: 1.06em; }
.solve__line b { color: var(--brand-d); }
.figbox {
  flex: 0 0 740px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.figbox svg { max-width: 100%; height: auto; display: block; }

/* 结论条 */
.ans {
  margin-top: auto;
  background: linear-gradient(96deg, #e6f5f6 0%, #f6fcfc 70%);
  border: 2px solid #9fd6da;
  border-left: 9px solid var(--brand);
  border-radius: 12px;
  padding: 20px 28px;
  font-size: 31px;
  font-weight: 700;
  color: var(--brand-d);
  display: flex; align-items: center; gap: 18px;
}
.ans__ico {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; flex: 0 0 auto;
}
.ans .katex { font-size: 1.1em; }

/* ---------------------------------------------------------------- 8. 总结页 */
.sum-grid { display: flex; gap: 30px; flex: 1 1 auto; min-height: 0; }
.sum-card {
  flex: 1 1 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 36px;
  display: flex; flex-direction: column;
  justify-content: center;
  border-top: 6px solid var(--brand);
}
.sum-card:nth-child(2) { border-top-color: var(--amber); }
.sum-card__h {
  font-size: 30px; font-weight: 700; color: var(--ink);
  margin-bottom: 20px; display: flex; align-items: center; gap: 14px;
}
.sum-card__ico {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--brand-l); color: var(--brand-d);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; flex: 0 0 auto;
}
.sum-card:nth-child(2) .sum-card__ico { background: #fdf1de; color: #96601a; }
.sum-card__t { font-size: 26px; line-height: 2.0; color: #1d4551; text-align: justify; }
.sum-card__t b { color: var(--brand-d); }
.sum-card__t em {
  font-style: normal; font-weight: 700;
  background: linear-gradient(180deg, transparent 62%, #ffe9a8 62%);
  padding: 0 3px;
}
.thanks {
  margin-top: 26px;
  text-align: center;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 10px;
  color: var(--brand-d);
  flex: 0 0 auto;
}
.thanks small {
  display: block;
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 10px;
}

/* ---------------------------------------------------------------- 9. HUD 与工具栏 */
/* 舞台内容靠 transform 等比缩放，但 HUD 是 fixed 定位、不随舞台缩放，
   所以用 vw 让它在 4K 屏上不至于小得点不中、在 1366 屏上又不过大。 */
#hud {
  position: fixed;
  right: 1.3em; bottom: 1em;
  z-index: 60;
  font-size: clamp(13px, .8vw, 27px);
  display: flex; align-items: center; gap: .9em;
  font-family: var(--sans);
}
.hud-hint {
  font-size: 1em;
  color: rgba(255,255,255,.72);
  background: rgba(8, 32, 38, .55);
  border-radius: 999px;
  padding: .53em 1.2em;
  backdrop-filter: blur(6px);
  transition: opacity .3s;
}
.hud-hint.is-done { color: #a7e9c9; }
#page-num {
  font-size: 1.07em;
  font-weight: 700;
  color: #fff;
  background: rgba(8, 32, 38, .55);
  border-radius: 999px;
  padding: .5em 1.13em;
  letter-spacing: 1px;
  backdrop-filter: blur(6px);
}
#toolbar {
  position: fixed;
  left: 1.3em; bottom: 1em;
  z-index: 60;
  font-size: clamp(13px, .8vw, 27px);
  display: flex; gap: .53em;
}
#toolbar button {
  font-family: var(--sans);
  font-size: 1em;
  color: #eaf6f7;
  background: rgba(8, 32, 38, .55);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: .6em;
  padding: .6em 1.07em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .18s, transform .12s;
}
#toolbar button:hover { background: rgba(14,124,134,.85); }
#toolbar button:active { transform: translateY(1px); }
#toolbar button:disabled { opacity: .35; cursor: default; }

/* 自检输出 */
#selftest {
  position: fixed; left: 12px; top: 12px; z-index: 999;
  font: 12px/1.45 ui-monospace, Consolas, monospace;
  color: #0f0; background: rgba(0,0,0,.86);
  padding: 10px 14px; border-radius: 8px;
  max-height: 92vh; overflow: auto; white-space: pre;
  display: none;
}

/* =============================================================================
 * 10. 动画状态（必须留在文件末尾 —— 权重相同时靠后者生效）
 * ===========================================================================*/

/* 分步出现的元素：默认隐藏，加 .is-on 显示 */
[data-step] {
  opacity: 0;
  transition: opacity .44s ease;
}
[data-step].is-on { opacity: 1; }

/* 强调（答案、关键结论） */
.is-hot {
  filter: drop-shadow(0 0 10px rgba(224,138,46,.55));
}
text.is-hot { filter: none; }

/* 淡入上浮 */
.rise { opacity: 0; transform: translateY(22px); }
.rise.is-on { opacity: 1; transform: translateY(0); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.3,1); }

/* 卡片逐个入场 */
.pop { opacity: 0; transform: scale(.94); }
.pop.is-on { opacity: 1; transform: scale(1); transition: opacity .4s ease, transform .45s cubic-bezier(.2,.8,.3,1.05); }

/* 方法卡片的错峰入场 */
.mcard[data-step] { transform: translateY(18px); }
.mcard[data-step].is-on { transform: translateY(0); transition: opacity .4s ease, transform .45s cubic-bezier(.2,.7,.3,1); }

/* 封面入场错峰（同一帧加 .is-on，靠 transition-delay 拉开节奏） */
.cover__kicker.rise.is-on { transition-delay: .05s; }
.cover__title.rise.is-on  { transition-delay: .16s; }
.cover__sub.rise.is-on    { transition-delay: .30s; }
.cover__rule.rise.is-on   { transition-delay: .42s; }
.cover__by.rise.is-on     { transition-delay: .54s; }
.cover__fig.rise.is-on    { transition-delay: .24s; }

/* 无动画兜底：?noanim=1 时全部直接落位 */
.no-anim [data-step], .no-anim .rise, .no-anim .pop {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* =============================================================================
 * 11. 打印 / 导出 PDF（现场设备出问题时的保底交付物）
 * -----------------------------------------------------------------------------
 * 用法：浏览器打开 index.html?finish=1 → Ctrl+P → 目标「另存为 PDF」→
 *       边距「无」、勾选「背景图形」→ 保存。得到 8 页、矢量、可投屏的 PDF。
 * 这里把 8 页全部摊开（屏幕上同时只显示 1 页），并强制所有分步元素可见。
 * ===========================================================================*/
@media print {
  @page { size: 20in 11.25in; margin: 0; }   /* 1920×1080 @96dpi，16:9 */

  html, body { overflow: visible; height: auto; background: #fff; }

  #stage {
    position: static;
    transform: none !important;
    width: 1920px; height: auto;
    overflow: visible;
  }
  .slide {
    display: flex !important;
    position: relative;
    inset: auto;
    width: 1920px; height: 1080px;
    break-after: page;
    page-break-after: always;
  }
  .slide:last-child { break-after: auto; page-break-after: auto; }

  /* 分步元素全部落位（打印的是「讲完」的状态） */
  [data-step], .rise, .pop {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* logo：屏幕上由一个 #brand 管 8 页，打印时必须每页各来一个 */
  #brand { display: none; }
  .slide::after {
    content: "";
    position: absolute;
    top: 44px; right: 72px;
    width: 143px; height: 40px;
    background: url("../assets/brand/logo.png") no-repeat right center / contain;
  }

  #hud, #toolbar, #selftest { display: none !important; }
}
