@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

/* ===== CSS 变量 ===== */
:root {
  --c-white: #ffffff;
  --c-surface: #f5f5f5;
  --c-dark: #1f1f1f;
  --c-mid: #4a4a4a;
  --c-border: #d8d8d8;
  --c-accent: #c0392b;
  --c-accent-soft: rgba(192,57,43,0.12);
  --c-overlay: rgba(31,31,31,0.6);

  --shadow-sm: 0 2px 6px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.12);
  --shadow-lg: 0 14px 36px rgba(0,0,0,0.16);
  --shadow-xl: 0 28px 64px rgba(0,0,0,0.22);

  --radius: 10px;
  --nav-h: 64px;
  --announce-h: 36px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;

  scroll-behavior: smooth;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--c-surface);
  color: var(--c-dark);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ===== 公告条 ===== */
.announce-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-dark);
  color: var(--c-white);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  height: var(--announce-h);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1rem;
}

/* ===== 主导航 ===== */
.site-header {
  position: sticky;
  top: var(--announce-h);
  z-index: 90;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-link { display: flex; align-items: center; flex-shrink: 0; }
.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-dark);
  letter-spacing: -0.02em;
}
.brand-logo { height: 36px; width: auto; }

/* 药丸胶囊导航 */
.site-nav {
  flex: 1;
  display: flex;
  justify-content: center;
}
.site-nav > p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 4px 6px;
}
.site-nav > p > a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--c-mid);
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.site-nav > p > a:hover,
.site-nav > p > a:focus-visible {
  background: var(--c-dark);
  color: var(--c-white);
}

/* 汉堡按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-dark);
  border-radius: 2px;
  transition: transform 0.25s;
}

/* 移动导航 */
.mobile-nav {
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  padding: 1rem 1.5rem;
}
.mobile-nav > nav > p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mobile-nav > nav > p > a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-dark);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  min-height: 40px;
  display: flex;
  align-items: center;
  transition: background 0.2s, color 0.2s;
}
.mobile-nav > nav > p > a:hover {
  background: var(--c-dark);
  color: var(--c-white);
}

/* ===== Hero ===== */
.hero-section {
  min-height: 70vh;
  background: var(--c-white);
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(192,57,43,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  position: relative;
  z-index: 1;
  width: 100%;
}

/* 左侧文案 */
.hero-left { display: flex; flex-direction: column; gap: 1.25rem; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: 999px;
  padding: 6px 14px;
  align-self: flex-start;
}

.hero-h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--c-dark);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--c-mid);
  line-height: 1.7;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--c-mid);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* 按钮 */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-white);
  background: var(--c-dark);
  border-radius: 999px;
  padding: 12px 28px;
  min-height: 44px;
  border: 2px solid var(--c-dark);
  transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--c-accent);
  border-color: var(--c-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-dark);
  background: transparent;
  border-radius: 999px;
  padding: 12px 28px;
  min-height: 44px;
  border: 2px solid var(--c-dark);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-outline:hover, .btn-outline:focus-visible {
  background: var(--c-dark);
  color: var(--c-white);
  transform: translateY(-2px);
}

/* 右侧卡片堆叠 */
.hero-right {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-card-stack {
  position: relative;
  width: 280px;
  height: 320px;
}
.hcard {
  position: absolute;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}
.hcard-back {
  width: 220px;
  height: 260px;
  background: var(--c-surface);
  bottom: 0;
  right: 0;
  z-index: 1;
  box-shadow: var(--shadow-sm);
  transform: rotate(6deg);
}
.hcard-mid {
  width: 240px;
  height: 280px;
  background: var(--c-white);
  bottom: 10px;
  right: 10px;
  z-index: 2;
  box-shadow: var(--shadow-md);
  transform: rotate(2deg);
}
.hcard-front {
  width: 260px;
  height: 300px;
  background: var(--c-white);
  bottom: 20px;
  right: 20px;
  z-index: 3;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  transform: rotate(-1deg);
  transition: transform 0.3s, box-shadow 0.3s;
}
.hcard-front:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: var(--shadow-xl);
}
.hcard-icon {
  font-size: 3rem;
  line-height: 1;
  color: var(--c-accent);
}
.hcard-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-dark);
}
.hcard-meta {
  font-size: 0.78rem;
  color: var(--c-mid);
}

/* ===== 正文主区域 ===== */
.site-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.content-wrap {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto 1fr;
  gap: 0 2rem;
  position: relative;
}

/* 装饰 figure（结构抽签要求：section > figure） */
.deco-figure {
  grid-column: 1 / -1;
  position: relative;
  height: 4px;
  margin-bottom: 2rem;
  pointer-events: none;
}
.deco-layer {
  position: absolute;
  height: 100%;
  border-radius: 999px;
}
.deco-layer--1 { left: 0; width: 60%; background: var(--c-border); z-index: 1; }
.deco-layer--2 { left: 10%; width: 40%; background: var(--c-mid); z-index: 2; opacity: 0.4; }
.deco-layer--3 { left: 20%; width: 20%; background: var(--c-accent); z-index: 3; }

/* 侧边 aside（位于内容左侧） */
.content-aside {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: calc(var(--announce-h) + var(--nav-h) + 1.5rem);
  align-self: start;
}
.aside-inner {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.aside-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-mid);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.aside-link {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-dark);
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.aside-link:hover {
  background: var(--c-surface);
  color: var(--c-accent);
}
.aside-inner > p { margin-bottom: 2px; }

/* 正文容器 */
.content-body {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

/* ===== page.content 内部的 section 样式 ===== */
.content-body section {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
  scroll-margin-top: calc(var(--announce-h) + var(--nav-h) + 1.5rem);
}
.content-body section:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* 标题层级 */
.content-body h2 {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-dark);
  margin-bottom: 0.5rem;
}
.content-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--c-dark);
  margin: 1.5rem 0 0.5rem;
}
.content-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-dark);
  margin: 1.25rem 0 0.4rem;
}

/* h2 后紧跟 hr（结构抽签要求） */
.content-body h2 + hr,
.content-body h3 + hr {
  border: none;
  border-top: 2px solid var(--c-border);
  margin: 0.75rem 0 1.25rem;
}
.content-body hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 1.5rem 0;
}

/* 段落与列表 */
.content-body p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-dark);
  margin-bottom: 1rem;
}
.content-body ul,
.content-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.content-body li {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 0.4rem;
}
.content-body a {
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.content-body a:hover { opacity: 0.8; }

/* 强调 */
.content-body strong { font-weight: 700; }
.content-body em { font-style: italic; color: var(--c-mid); }

/* 表格 */
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.content-body th,
.content-body td {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
}
.content-body th {
  background: var(--c-surface);
  font-weight: 700;
}
.content-body tr:nth-child(even) td { background: rgba(245,245,245,0.5); }

/* code */
.content-body code {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.88em;
}
.content-body pre {
  background: var(--c-dark);
  color: var(--c-white);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.content-body pre code {
  background: none;
  border: none;
  color: inherit;
  font-size: 0.9rem;
}

/* ===== 页脚 ===== */
.site-footer {
  background: var(--c-dark);
  color: var(--c-white);
  text-align: center;
  padding: 3rem 1.5rem 2rem;
}
.footer-cta {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.footer-cta-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin: 0;
}
.site-footer .btn-primary {
  background: var(--c-white);
  color: var(--c-dark);
  border-color: var(--c-white);
}
.site-footer .btn-primary:hover {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-white);
}
.footer-copy {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.5rem;
}
.footer-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.35);
  display: block;
  line-height: 1.6;
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ===== 站点包装 ===== */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .content-wrap {
    grid-template-columns: 1fr;
  }
  .deco-figure { grid-column: 1; }
  .content-aside {
    grid-column: 1;
    grid-row: auto;
    position: static;
  }
  .aside-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
  }
  .aside-title { width: 100%; }
  .aside-inner > p { margin: 0; }
  .aside-link { padding: 6px 12px; border: 1px solid var(--c-border); border-radius: 999px; }
  .content-body { grid-column: 1; grid-row: auto; }
}

@media (max-width: 768px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-left { align-items: center; }
  .hero-right { display: none; }
  .hero-actions { justify-content: center; }
  .hero-tags { justify-content: center; }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 1rem; }
  .site-main { padding: 1.5rem 1rem; }
  .content-body section { padding: 1.5rem 1rem; }
  .hero-inner { padding: 2.5rem 1rem; }
  .hero-h1 { font-size: 1.75rem; }
  .announce-bar { font-size: 0.72rem; }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  :root { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
