/* ============================================================
   Dora Design System (CoSpace) — tokens
   来源：design_handoff_personal_site/README.md
   ============================================================ */

@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* colors */
  --brand-mint: #D1EEEE;
  --brand-cream: #FFFDF5;
  --surface-panel: #FFFDF5;
  --surface-card: #FFFFFF;
  --surface-inset: #F9FAFB;
  --action-primary: #059669;
  --action-primary-hover: #047857;
  --brand-teal-600: #0D9488;
  --brand-teal-700: #0F766E;
  --brand-teal-50: #F0FDFA;
  --gradient-project: linear-gradient(135deg, #34D399, #0D9488);
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --text-link: #0D9488;
  --text-on-accent: #FFFFFF;
  --border-subtle: #F3F4F6;
  --border-default: #E5E7EB;
  --clay: #C4684A;          /* 试用按钮（用户指定，非 DS 色） */
  --clay-hover: #AC5539;

  /* typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas,
               'PingFang SC', monospace;

  /* radius / shadow / motion */
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-xl: 0 12px 28px -6px rgba(0, 0, 0, .16);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Base
   ============================================================ */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--brand-mint);
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-teal-600);
  text-decoration: none;
}
a:hover { color: var(--brand-teal-700); }

/* ============================================================
   TopNav — 高 48px，mint 底，仅「首页」
   ============================================================ */

.topnav {
  height: 48px;
  display: flex;
  align-items: center;
  background: var(--brand-mint);
  padding: 0 24px;
}
.topnav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.topnav a:hover { color: var(--brand-teal-700); }
.topnav a.active { color: var(--brand-teal-600); }

/* ============================================================
   首页
   ============================================================ */

.home-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 24px;
  align-items: stretch;
}

/* —— 卡片通用（置顶卡 / 列表项 / 热区）—— */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  transition: transform var(--transition), box-shadow var(--transition);
}
a.card:hover {
  color: var(--text-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* —— 左：置顶文章卡片 —— */
.featured-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.featured-card .cover {
  width: 100%;
  height: 280px;
  background: var(--surface-inset);
}
.featured-card .body {
  padding: 28px 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.featured-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--gray-900);
  text-wrap: pretty;
}
.featured-card .excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* 小标签（置顶文章 / 分类） */
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-teal-600);
}
.eyebrow--muted { color: var(--text-tertiary); }

/* meta 行「日期 · 阅读时长」 */
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.featured-card .meta { margin-top: 8px; }

/* —— 右：AI 共创写作台热区 —— */
.tool-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 28px;
}
.tool-card .inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: -48px;
}
.tool-card .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--gradient-project);
  color: #fff;
}
.tool-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--gray-900);
  text-wrap: pretty;
}
.tool-card .desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  text-wrap: pretty;
}
.try-btn {
  align-self: center;
  width: calc(100% - 2ch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--clay);
  color: var(--text-on-accent);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition);
}
.tool-card:hover .try-btn { background: var(--clay-hover); }

/* —— 文章列表 —— */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.post-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 12px;
}
.post-list-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}
.post-list-head a {
  font-size: 14px;
  font-weight: 500;
}

.post-item {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 16px;
}
.post-item .thumb {
  flex: 0 0 auto;
  width: 180px;
  height: 112px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-inset);
}
.post-item .info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.post-item .info .eyebrow {
  font-weight: 500;
  letter-spacing: 0.06em;
}
.post-item h4 {
  margin: 0;
  font-size: 20px;
  line-height: 1.375;
  font-weight: 600;
  color: var(--gray-900);
  text-wrap: pretty;
}

/* 图片通用：铺满图槽 */
.cover img, .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 无图降级：柔和占位（inset 底 + 居中淡图标） */
.img-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-200);
  background: var(--surface-inset);
}

/* ============================================================
   文章详情页
   ============================================================ */

.article-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.back-link:hover { color: var(--brand-teal-700); }

.article-panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.article-panel .cover {
  width: 100%;
  height: 400px;
  background: var(--surface-inset);
}
.article-panel .cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-inner { padding: 56px 64px 64px; }

.article-inner h1 {
  margin: 14px 0 20px;
  font-size: 38px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--gray-900);
  text-wrap: pretty;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-tertiary);
  padding-bottom: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border-default);
}

/* —— Markdown 正文排版 —— */
.article-body {
  font-size: 17px;
  line-height: 1.8;
  color: var(--gray-700);
}
.article-body p {
  margin: 0 0 24px;
  text-wrap: pretty;
}
.article-body p:last-child { margin-bottom: 0; }
.article-body p:empty { display: none; } /* figure 渲染产生的空段落 */
.article-body h2 {
  margin: 40px 0 16px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--gray-900);
}
.article-body blockquote {
  margin: 0 0 24px;
  padding: 16px 24px;
  border-left: 3px solid var(--brand-teal-600);
  background: var(--brand-teal-50);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--gray-700);
  font-style: normal;
}
.article-body blockquote p { margin: 0; }
.article-body ul {
  margin: 0 0 24px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.article-body figure { margin: 0 0 12px; }
.article-body figure .img-wrap {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-inset);
}
.article-body figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article-body figcaption {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}
.article-body pre {
  margin: 0 0 24px;
  padding: 20px 24px;
  background: var(--gray-900);
  color: var(--gray-100, #F3F4F6);
  border-radius: var(--radius-md);
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}
.article-body pre code {
  font-family: inherit;
  background: none;
  padding: 0;
  color: inherit;
}
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================================
   归档页
   ============================================================ */

.archive-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================================
   响应式（设计稿为桌面稿；窄屏合理折叠）
   ============================================================ */

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .tool-card .inner { margin-top: 0; }
  .post-item { align-items: flex-start; }
  .post-item .thumb { width: 120px; height: 76px; }
  .post-item h4 { font-size: 17px; }
  .article-inner { padding: 32px 24px 40px; }
  .article-inner h1 { font-size: 30px; }
  .article-panel .cover { height: 220px; }
}
