/**
 * [INPUT]: 依赖 zzm v4 (v0.2.0) 的 --zzm-* 令牌、.zzm-btn / .zzm-cardlink / .zzm-inklink；index.html 的版式骨架
 * [OUTPUT]: 对外提供中转页版式——左栏（飞书主行动 + 课程卡）、页脚（.cn 备案注入位）、右栏外壳（标题、工具标签页、步骤条、工具脚注）与断点
 * [POS]: site/ 的版式层；只管「东西放在哪」，舞台内部的一切归 demos.css
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

html {
  min-width: 320px;
  background: var(--zzm-paper, #F6F6F4);
}

body {
  min-height: 100vh;
  margin: 0;
}

.zzm-v4 *,
.zzm-v4 *::before,
.zzm-v4 *::after { box-sizing: border-box; }

.zzm-v4 :where(h1, h2, p, ul, ol, figure) { margin: 0; }
.zzm-v4 :where(ul, ol) { padding: 0; list-style: none; }

/* ════════ 骨架：左 38 / 右 62（左栏封顶 720，超宽屏把余量让给工具区） ════════ */

.gateway {
  min-height: 100svh;
  display: grid;
  grid-template-columns: clamp(400px, 38vw, 720px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}

/* ════════ 左栏：品牌钉顶、页脚钉底，中间「飞书 + 课程」作为一组垂直居中 ════════ */

.side {
  grid-area: 1 / 1;
  min-width: 0;
  padding: 40px 48px 24px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 32px;
  background: var(--zzm-surface, #FFFFFF);
  border-right: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, .09));
}

.side-main {
  align-self: center;
  max-width: 560px;
  display: grid;
  gap: 48px;
}

/* ── 品牌位：站点名即本页 h1；副标题用「免费」绿，承接原先的免费徽章 ── */

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.brand-text h1 {
  color: var(--zzm-ink, #161616);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  word-break: keep-all;
}

.brand-text p {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--zzm-tier-free-ink, #157F3C);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.brand-text p::before {
  width: 6px;
  height: 6px;
  content: "";
  background: var(--zzm-tier-free, #16A34A);
  border-radius: 50%;
}

/* ── 飞书入口：大圆图标本身就是按钮；外圈朱色呼吸环＝本屏唯一的「下一步」 ── */

.free {
  min-width: 0;
  display: grid;
  justify-items: center;
  text-align: center;
}

.kb-entry {
  --orb: clamp(136px, 17vh, 196px);
  display: grid;
  justify-items: center;
  gap: 20px;
  color: inherit;
  text-decoration: none;
}

.kb-orb {
  position: relative;
  width: var(--orb);
  height: var(--orb);
  display: grid;
  place-items: center;
  background: var(--zzm-surface, #FFFFFF);
  border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, .09));
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);           /* 同 .zzm-cardlink 静止态 */
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.kb-orb img {
  width: 64%;
  height: 64%;
}

.kb-orb::after {
  position: absolute;
  inset: -10px;
  content: "";
  border: 1.5px solid var(--zzm-accent, #A6402F);
  border-radius: 50%;
  pointer-events: none;
  animation: zzmPulse 2.6s ease-in-out infinite;       /* 设计系统「当前节点呼吸」 */
}

.kb-entry:hover .kb-orb {
  transform: translateY(-3px);
  border-color: rgba(0, 0, 0, .3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .09), 0 1px 2px rgba(0, 0, 0, .04);   /* 同 .zzm-cardlink 悬停态 */
}

.kb-entry:focus-visible { outline: none; }
.kb-entry:focus-visible .kb-orb { box-shadow: 0 0 0 4px rgba(166, 64, 47, .2); }

.kb-go {
  color: var(--zzm-ink, #161616);
  font-size: 16px;
  line-height: 24px;
  font-weight: 650;
}

.kb-entry:hover .kb-go {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.free-copy {
  max-width: 26em;
  margin-top: 8px;
  color: var(--zzm-text-4, #6E6E6A);
  font-size: 14px;
  line-height: 22px;
  word-break: keep-all;          /* 只在标点处换行，不把「免费」拆成两行 */
  text-wrap: balance;
}

@media (prefers-reduced-motion: reduce) {
  .kb-orb::after { animation: none; opacity: .4; }
  .kb-orb { transition: none; }
}

.tools-head h2 { word-break: keep-all; }

/* ── 课程卡：纸面白卡 + 墨键，重量次于飞书入口；Logo 用课程站自己的产品标 ── */

.zzm-v4 .course {
  display: block;
  padding: 24px;
  color: inherit;
  text-decoration: none;
}

.course-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 课程站「知识星图」产品 Logo（自带暗底圆角），与 edu.zhaozimin 的 favicon 同源 */
.course-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.course-kind {
  color: var(--zzm-text-5, #72726E);
  font-size: 12px;
  line-height: 16px;
}

.course-title {
  margin-top: 4px;
  color: var(--zzm-ink, #161616);
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

.course-lead {
  margin-top: 16px;
  color: var(--zzm-text-3, #4A4A46);
  font-size: 14px;
  line-height: 20px;
}

.course-points {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.course-points li {
  position: relative;
  padding-left: 24px;
  color: var(--zzm-text-4, #6E6E6A);
  font-size: 13px;
  line-height: 20px;
}

.course-points li::before {
  position: absolute;
  top: 6px;
  left: 2px;
  width: 10px;
  height: 6px;
  content: "";
  border-left: 1.5px solid var(--zzm-ink, #161616);
  border-bottom: 1.5px solid var(--zzm-ink, #161616);
  transform: rotate(-45deg);
}

.course-foot {
  margin-top: 20px;
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  border-top: 1px solid var(--zzm-hairline, rgba(0, 0, 0, .07));
}

.course-meta {
  white-space: nowrap;
  color: var(--zzm-text-4, #6E6E6A);
  font-size: 13px;
  line-height: 20px;
}

.course-meta b {
  color: var(--zzm-ink, #161616);
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
}

.course-meta span {
  display: block;
  color: var(--zzm-text-5, #72726E);
  font-size: 12px;
  line-height: 16px;
}

/* ── 页脚：桌面钉在左栏底部（不额外占高），窄屏落到整页最底并居中；.cn 在此注入备案号 ── */

.site-foot {
  grid-area: 2 / 1;
  min-width: 0;
  padding: 0 48px 32px;
  display: grid;
  gap: 4px;
  color: var(--zzm-text-5, #72726E);
  background: var(--zzm-surface, #FFFFFF);
  border-right: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, .09));
  font-size: 12px;
  line-height: 16px;
}

.site-foot-line,
.site-foot-beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.site-foot-beian { justify-content: flex-start; }

.site-foot-beian a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.site-foot-beian a:hover { color: var(--zzm-ink, #161616); }
.site-foot-beian img { width: 14px; height: 14px; }

/* ════════ 右栏外壳 ════════ */

.tools {
  grid-area: 1 / 2 / 3 / 3;
  min-width: 0;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  container-type: inline-size;
}

.tools > * {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
}

.tools-head h2 {
  color: var(--zzm-ink, #161616);
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  text-wrap: balance;
}

.tools-head p {
  margin-top: 4px;
  color: var(--zzm-text-4, #6E6E6A);
  font-size: 14px;
  line-height: 20px;
}

/* ── 工具标签：选中者成纸面卡，底边走墨色进度 ── */

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tool-tab {
  position: relative;
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  color: inherit;
  text-align: left;
  font: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--zzm-r-3, 12px);
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease;
}

.tool-tab:hover { background: rgba(0, 0, 0, .035); }

.tool-tab[aria-selected="true"] {
  background: var(--zzm-surface, #FFFFFF);
  border-color: var(--zzm-hairline-2, rgba(0, 0, 0, .09));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.tool-tab:focus-visible,
.steps button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(166, 64, 47, .2);
}

.tool-tab img {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--zzm-r-2, 8px);
}

.tool-tab span { min-width: 0; }

.tool-tab b {
  display: block;
  color: var(--zzm-ink, #161616);
  font-size: 14px;
  line-height: 20px;
  font-weight: 650;
}

.tool-tab small {
  display: block;
  overflow: hidden;
  color: var(--zzm-text-5, #72726E);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tab-meter {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  opacity: 0;
  background: var(--zzm-hairline, rgba(0, 0, 0, .07));
}

.tab-meter::after,
.step-meter::after {
  position: absolute;
  inset: 0;
  content: "";
  background: var(--zzm-ink, #161616);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
}

.tool-tab[aria-selected="true"] .tab-meter { opacity: 1; }

/* ── 面板：舞台 + 步骤 + 脚注 ── */

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-panel[hidden] { display: none; }

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.steps button {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 12px 0 0;
  display: block;
  color: var(--zzm-text-5, #72726E);
  text-align: left;
  font: inherit;
  background: none;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}

.steps b {
  display: block;
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  transition: color .2s ease;
}

.steps span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 16px;
}

.steps button:hover b,
.steps .is-past b { color: var(--zzm-text-3, #4A4A46); }
.steps .is-now b { color: var(--zzm-ink, #161616); }

.step-meter {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--zzm-hairline-2, rgba(0, 0, 0, .09));
}

.tool-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tool-foot p {
  min-width: 0;
  color: var(--zzm-ink, #161616);
  font-size: 14px;
  line-height: 20px;
  font-weight: 650;
}

.tool-foot p span {
  margin-left: 12px;
  color: var(--zzm-text-5, #72726E);
  font-size: 12px;
  font-weight: 400;
}

.tool-foot .zzm-btn { text-decoration: none; }

/* ════════ 断点 ════════ */

@media (max-width: 1180px) {
  .side { padding: 32px 40px 24px; }
  .site-foot { padding: 0 40px 28px; }
  .tools { padding: 32px 40px; }
  .tool-tab small { display: none; }
}

/* 矮屏桌面：先收间距，再收课程要点，保证一屏装下 */
@media (max-height: 880px) and (min-width: 1024px) {
  .side { gap: 24px; padding-top: 32px; padding-bottom: 20px; }
  .site-foot { padding-bottom: 28px; }
  .side-main { gap: 32px; }
  .kb-entry { gap: 16px; }
  .zzm-v4 .course { padding: 20px 24px; }
  .course-lead { margin-top: 12px; }
  .course-points { margin-top: 12px; gap: 4px; }
  .course-foot { margin-top: 16px; padding-top: 12px; }
  .tools { gap: 16px; padding-block: 32px; }
}

@media (max-height: 780px) and (min-width: 1024px) {
  .kb-entry { --orb: 128px; }
  .course-points { display: none; }
}

/* 高屏桌面：字号与间距升一档，舞台允许更高，上下只留窄边 */
@media (min-height: 1000px) and (min-width: 1280px) {
  .side-main { gap: 56px; }
  .kb-entry { --orb: clamp(196px, 18vh, 232px); gap: 24px; }
  .kb-go { font-size: 18px; line-height: 28px; }
  .free-copy { font-size: 15px; line-height: 24px; }
  .zzm-v4 .course { padding: 28px; }
  .course-title { font-size: 20px; line-height: 28px; }
  .course-lead { font-size: 15px; line-height: 24px; }
  .course-points li { font-size: 14px; line-height: 24px; }

  .tools { --chrome: 432px; --stage-ratio: .84; gap: 24px; }
  .tools-head h2 { font-size: 28px; line-height: 36px; }
  .tools-head p { font-size: 15px; line-height: 24px; }
  .tool-tab { padding: 12px 14px; }
  .tool-tab img { width: 40px; height: 40px; }
  .tool-tab b { font-size: 15px; line-height: 20px; }
  .tool-tab small { font-size: 13px; line-height: 20px; }
  .steps b { font-size: 14px; line-height: 20px; }
  .steps span { font-size: 13px; line-height: 20px; }
  .tool-foot p { font-size: 15px; }
  .tool-foot p span { font-size: 13px; }
}

/* 窄屏：先飞书、再课程、最后工具 */
@media (max-width: 1023px) {
  .gateway { display: block; }

  /* 品牌位、飞书入口、课程卡收进同一条居中的 560 栏：平板竖屏不再整体贴左、右侧留白 */
  .side {
    padding: 24px 24px 32px;
    grid-template-rows: none;
    justify-items: center;
    gap: 32px;
    border-right: 0;
    border-bottom: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, .09));
  }

  .brand,
  .side-main {
    width: 100%;
    max-width: 560px;
  }

  .side-main { gap: 40px; }
  .free { padding-top: 16px; }
  .kb-entry { --orb: 168px; }
  .site-foot {
    padding: 24px;
    text-align: center;
    background: var(--zzm-paper, #F6F6F4);
    border-top: 1px solid var(--zzm-hairline, rgba(0, 0, 0, .07));
    border-right: 0;
  }

  .site-foot-line,
  .site-foot-beian { justify-content: center; }
  .tools { padding: 40px 24px 48px; }
  .tool-tab small { display: block; }
}

@media (max-width: 640px) {
  .kb-entry { --orb: 152px; }
  .tools-head h2 { font-size: 22px; line-height: 28px; }

  .zzm-v4 .course { padding: 20px; }
  .course-foot { flex-direction: column; align-items: stretch; }
  .course-cta { width: 100%; }

  .tool-tabs { gap: 4px; }

  .tool-tab {
    padding: 8px 4px 10px;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .tool-tab img { width: 32px; height: 32px; }
  .tool-tab small { display: none; }
  .tab-meter { right: 8px; left: 8px; }

  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }

  .tool-foot { align-items: flex-start; flex-direction: column; gap: 12px; }
  .tool-foot p span { display: block; margin-left: 0; }
}
