/* ============================================================
   秦若森 | 简历页样式表（resume.html）
   Theme: A4 打印 / 浅色 / 可一键 PDF
   ----------------------------------------------------------
   说明：本文件用于当前主简历 resume.html，原先
   ~900 行内联 <style> 已抽出，减少双文件维护成本。
   ============================================================ */

/* ============ 全局重置 & 变量 ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --accent: #0ea5e9;
  --accent-bg: #f0f9ff;
  --dark: #1e293b;
  --text: #334155;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;
  --bg: #ffffff;
  --bg-section: #f8fafc;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
}

@page {
  size: A4;
  margin: 12mm 14mm;
}

body {
  font-family:
    "Noto Sans SC",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: var(--text);
  background: #f1f5f9;
  line-height: 1.6;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
}

/* ============ 简历容器 ============ */
.resume {
  width: 210mm;
  min-height: 297mm;
  margin: 20px auto;
  background: var(--bg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 36px 40px 32px;
  position: relative;
  overflow: hidden;
}

@media print {
  /* 保留背景色 & 渐变色 */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    background: white;
    font-size: 12.5px;
    line-height: 1.55;
  }

  .resume {
    width: 100%;
    min-height: auto;
    margin: 0;
    box-shadow: none;
    padding: 0;
    overflow: visible;
  }

  .no-print {
    display: none !important;
  }

  /* 分页控制：关键块不被切断 */
  .header,
  .intent-meta,
  .summary-text,
  .highlight-stats,
  .skill-group,
  .exp-item,
  .project-item,
  .edu-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* section-title 后不被孤立 */
  .section-title,
  .project-group-title {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* section 之间允许分页但避免顶部空白 */
  .section {
    break-inside: auto;
  }

  .project-item {
    margin-bottom: 11px;
  }
}

/* ============ 头部 ============ */
.header {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 22px;
  position: relative;
}

.header::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 120px;
  height: 2px;
  background: var(--accent);
}

.avatar-box {
  flex-shrink: 0;
  width: 92px;
  height: 120px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  background: var(--bg-section);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-lighter);
  font-size: 11px;
  gap: 6px;
  overflow: hidden;
  position: relative;
}

.avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%; /* 人像通常脸在上半部，偏上裁剪避免切脸 */
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 6px;
  /* 默认隐藏，onload 成功后再显示；失败时 onerror 移除 img，占位图自然保留 */
  display: none;
}

.avatar-box .photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-lighter);
}

/* img 加载成功后用 has-photo 类切换显示，避免 broken icon 混入打印输出 */
.avatar-box.has-photo img {
  display: block;
}

.avatar-box.has-photo .photo-placeholder {
  display: none;
}

/* 有真实照片时：去掉"待贴照片"的虚线占位边框，换成实心细描边 + 轻阴影 */
.avatar-box.has-photo {
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.header-info {
  flex: 1;
}

.header-info h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 2px;
  letter-spacing: 2px;
}

.header-info h1 .name-en {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  margin-left: 12px;
  letter-spacing: 0;
}

.header-tagline {
  font-size: 15px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 10px;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 12.5px;
  color: var(--text-light);
}

.header-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.header-meta svg {
  flex-shrink: 0;
}

/* header-meta 内的主页链接：替代原先行内 style，利于 CSP */
.header-meta a {
  color: var(--primary);
  text-decoration: none;
}

.header-meta a:hover {
  text-decoration: underline;
}

/* 强制 header-meta 换行：占满剩余行宽，把后续 span 挤到下一行
   用在联系方式（前 3 个）与职业信息（后 3 个）之间，PDF 布局更紧凑 */
.header-meta-break {
  flex-basis: 100%;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
}

/* ============ 通用区域标题 ============ */
.section {
  margin-bottom: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.section-title .icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* ============ 个人优势 ============ */
.summary-text {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  padding: 10px 14px;
  background: var(--bg-section);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* ============ 技能标签 ============ */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.skill-group h4 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.skill-group h4 span.emoji {
  font-size: 14px;
}

/* 技能组标题上的补充说明小字（如 "(主打方向)" / "(软硬一体)"） */
.skill-group h4 .group-note {
  font-size: 11px;
  color: var(--text-lighter);
  font-weight: 400;
}

/* 跨列技能组（AI 岗专版"其他补充能力"使用） */
.skill-group--full {
  grid-column: 1 / -1;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.skill-tags .tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #dbeafe;
}

.skill-tags .tag.accent {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: #bae6fd;
}

.skill-tags .tag.success {
  background: var(--success-bg);
  color: #059669;
  border-color: #a7f3d0;
}

.skill-tags .tag.warning {
  background: var(--warning-bg);
  color: #d97706;
  border-color: #fde68a;
}

/* ============ 工作经历 ============ */
.exp-item {
  margin-bottom: 14px;
  position: relative;
  padding-left: 16px;
}

.exp-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.exp-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 16px;
  width: 1px;
  height: calc(100% + 2px);
  background: var(--border);
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.exp-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

.exp-header .period {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  background: var(--primary-bg);
  padding: 1px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.exp-company {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 5px;
}

.exp-desc {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
}

.exp-desc li {
  margin-bottom: 2px;
  list-style: none;
  position: relative;
  padding-left: 14px;
}

.exp-desc li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--primary-light);
  font-size: 11px;
}

.exp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.exp-tags span {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--bg-section);
  color: var(--text-light);
  border: 1px solid var(--border);
}

/* ============ 项目经历 ============ */
.project-item {
  margin-bottom: 13px;
  padding: 10px 14px;
  background: var(--bg-section);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.project-item h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 2px;
}

.project-item h3 .project-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--success);
  color: white;
  margin-left: 6px;
  vertical-align: middle;
}

/* badge 变体：主色、强调色（替代行内 style） */
.project-item h3 .project-badge.badge-primary {
  background: var(--primary);
}

.project-item h3 .project-badge.badge-accent {
  background: var(--accent);
}

.project-item .project-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 5px;
}

.project-item .project-desc {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
}

.project-item .project-desc li {
  margin-bottom: 1px;
  list-style: none;
  padding-left: 14px;
  position: relative;
}

.project-item .project-desc li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.project-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.project-techs span {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #dbeafe;
}

/* ============ 教育经历 ============ */
.edu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.edu-item h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

.edu-item .edu-major {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-left: 2px;
}

.edu-item .edu-detail {
  font-size: 12.5px;
  color: var(--text-light);
}

.edu-item .period {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

/* ============ 两栏布局 ============ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
}

/* ============ 操作按钮组（PDF 导出 / 浏览器打印） ============ */
.action-bar {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  z-index: 1000;
}

.action-btn {
  padding: 13px 22px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  font-family: inherit;
  white-space: nowrap;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.action-btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.45);
}

.action-btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.action-btn.secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* 简单的 spinner */
.action-btn .spin {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 尊重用户动效偏好：关闭按钮旋转动画，减轻前庭敏感负担 */
@media (prefers-reduced-motion: reduce) {
  .action-btn,
  .action-btn.primary:hover,
  .action-btn .spin {
    transition: none;
    animation: none;
    transform: none !important;
  }
}

.print-tip {
  max-width: 280px;
  font-size: 11.5px;
  color: var(--text-light);
  background: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  line-height: 1.5;
  text-align: left;
}

/* 避免分页断裂 */
.exp-item,
.project-item {
  page-break-inside: avoid;
}

/* ============ 求职意向 ============ */
.intent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 12.5px;
  color: var(--text);
  padding: 10px 14px;
  background: var(--accent-bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.intent-meta strong {
  color: var(--dark);
  font-weight: 600;
}

.intent-meta span {
  display: inline-flex;
  align-items: center;
}

/* ============ 项目分组标题 ============ */
.project-group-title {
  display: flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 8px;
  padding: 4px 0 6px;
  letter-spacing: 0.3px;
  border-bottom: 1px dashed var(--border);
}

.project-group-title::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
  display: inline-block;
  margin-right: 8px;
}

.project-group-title.enterprise::before {
  background: var(--accent);
}

.project-group-title .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-lighter);
}

/* 独立创业项目卡片细微标识 */
.project-item.independent {
  border-left: 3px solid var(--primary);
}

.project-item.enterprise {
  border-left: 3px solid var(--accent);
}

/* ============ 核心数据一览 ============ */
.highlight-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.highlight-stat {
  text-align: center;
  padding: 8px 6px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.highlight-stat .num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.highlight-stat .label {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* highlight-stat 下方的补充小字（如 "含 1 款 AI SaaS" / "国企大客户" 等） */
.highlight-stat .label-sub {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: var(--text-lighter);
}

/* ============ 移动端自适应 ============ */
@media (max-width: 780px) {
  body {
    font-size: 13px;
    background: #f1f5f9;
  }

  .resume {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 20px 16px 112px;
    box-shadow: none;
    overflow-x: hidden;
  }

  .header {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    text-align: center;
  }

  .header::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .avatar-box {
    width: 84px;
    height: 108px;
  }

  .header-info {
    width: 100%;
    text-align: center;
  }

  .header-info h1 {
    font-size: 24px;
    letter-spacing: 1px;
  }

  .header-info h1 .name-en {
    display: block;
    font-size: 12px;
    margin-left: 0;
    margin-top: 2px;
  }

  .header-tagline {
    font-size: 14px;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
  }

  .header-meta {
    justify-content: center;
    font-size: 12px;
    gap: 4px 14px;
    width: 100%;
    overflow-wrap: anywhere;
  }

  .header-meta span {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }

  .header-meta a {
    overflow-wrap: anywhere;
  }

  .section {
    margin-bottom: 18px;
  }

  .section-title {
    font-size: 14.5px;
  }

  .summary-text {
    font-size: 12.5px;
    padding: 10px 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .skill-tags .tag {
    font-size: 11px;
    padding: 2px 8px;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .exp-item {
    padding-left: 14px;
    margin-bottom: 12px;
  }

  .exp-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    margin-bottom: 4px;
  }

  .exp-header h3 {
    font-size: 13.5px;
  }

  .exp-header .period {
    font-size: 11px;
    padding: 1px 6px;
  }

  .exp-company {
    font-size: 12px;
  }

  .exp-desc,
  .exp-desc li {
    font-size: 12px;
    line-height: 1.65;
  }

  .exp-tags span {
    font-size: 10px;
  }

  .project-item {
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .project-item h3 {
    font-size: 13px;
    line-height: 1.4;
  }

  .project-item .project-sub {
    font-size: 11.5px;
  }

  .project-item .project-desc,
  .project-item .project-desc li {
    font-size: 12px;
    line-height: 1.65;
  }

  .project-techs span {
    font-size: 10px;
  }

  .intent-meta {
    font-size: 12px;
    gap: 4px 14px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow-wrap: anywhere;
  }

  .intent-meta span {
    min-width: 0;
    display: block;
  }

  .highlight-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .highlight-stat .num {
    font-size: 16px;
  }

  .edu-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .edu-item h3 {
    font-size: 13.5px;
  }

  .edu-item .edu-detail {
    font-size: 12px;
  }

  .action-bar {
    bottom: 12px;
    right: 12px;
    left: 12px;
    flex-direction: row;
    justify-content: flex-end;
    gap: 8px;
  }

  .action-btn {
    min-width: 0;
    padding: 10px 12px;
    font-size: 12.5px;
    border-radius: 10px;
    flex: 1 1 0;
    justify-content: center;
    max-width: none;
  }

  .action-btn svg {
    flex-shrink: 0;
  }

  .action-btn .label,
  .action-btn {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .print-tip {
    display: none;
  }
}

@media (max-width: 420px) {
  .resume {
    padding: 16px 12px 104px;
  }

  .header-info h1 {
    font-size: 22px;
  }

  .header-tagline {
    font-size: 13px;
  }

  .header-meta {
    font-size: 11.5px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 5px;
  }

  .header-meta-break {
    display: none;
  }

  .section-title {
    font-size: 14px;
  }
}
