/**
 * [INPUT]: 依赖 index.html 的 source-section 静态源码讲解结构与 styles.css 的颜色、圆角和字体变量
 * [OUTPUT]: 对外提供录音链路、源码步骤卡、代码窗口、内存说明和移动端适配样式
 * [POS]: assets 模块的源码讲解视觉层，与 recorder-controls.css 并列补充主视觉系统
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

.source-section {
  padding: clamp(62px, 9vw, 94px) 0 0;
}

.source-heading {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  align-items: end;
  gap: 28px;
  margin-bottom: 26px;
}

.source-heading .eyebrow {
  margin-bottom: 9px;
}

.source-heading h2 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.source-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.source-pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 18px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 23, 25, 0.1);
  border-radius: var(--radius-medium);
  background: rgba(23, 23, 25, 0.1);
  box-shadow: 0 14px 38px rgba(42, 35, 26, 0.08);
  list-style: none;
}

.source-pipeline li {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 108px;
  align-content: center;
  gap: 5px;
  padding: 16px 13px;
  background: rgba(255, 253, 248, 0.9);
}

.source-pipeline li:not(:last-child)::after {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: -9px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--ink);
  content: "›";
  font-size: 15px;
  transform: translateY(-50%);
}

.source-pipeline span {
  color: var(--pink-dark);
  font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.1em;
}

.source-pipeline strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-pipeline small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.source-guide {
  display: grid;
  gap: 18px;
}

.source-step {
  overflow: hidden;
  border: 1px solid rgba(23, 23, 25, 0.1);
  border-radius: var(--radius-large);
  color: var(--white);
  background: #17181b;
  box-shadow: var(--shadow);
}

.source-step header {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 16px;
  padding: 22px 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #202126;
}

.source-step-index {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(251, 114, 153, 0.38);
  border-radius: 15px;
  color: var(--pink);
  background: rgba(251, 114, 153, 0.08);
  font: 800 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.source-step h3 {
  margin: 1px 0 7px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.source-step header p {
  max-width: 690px;
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.65;
}

.source-step pre {
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: #e9e7e2;
  background:
    linear-gradient(90deg, rgba(251, 114, 153, 0.05), transparent 90px),
    #111216;
  font: 12px/1.72 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}

.source-step pre:focus-visible {
  outline: 3px solid rgba(251, 114, 153, 0.5);
  outline-offset: -3px;
}

.source-step code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 22px 24px 24px;
  white-space: pre;
}

.source-memory-note {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(23, 23, 25, 0.1);
  border-radius: var(--radius-medium);
  color: var(--ink);
  background: rgba(86, 216, 190, 0.11);
}

.source-memory-note > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #0b685a;
  background: rgba(86, 216, 190, 0.26);
  font: 800 13px/1 Georgia, serif;
}

.source-memory-note strong {
  display: block;
  margin: 1px 0 4px;
  font-size: 13px;
}

.source-memory-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

@media (max-width: 760px) {
  .source-pipeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .source-pipeline li:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 620px) {
  .source-heading {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .source-pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-pipeline li {
    min-height: 92px;
    padding: 13px;
  }

  .source-step {
    border-radius: 20px;
  }

  .source-step header {
    grid-template-columns: 44px 1fr;
    gap: 12px;
    padding: 18px 16px 17px;
  }

  .source-step-index {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .source-step h3 {
    font-size: 16px;
  }

  .source-step pre {
    font-size: 11px;
  }

  .source-step code {
    width: auto;
    min-width: 0;
    padding: 18px 16px 20px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  .source-memory-note {
    padding: 16px;
  }
}
