/* main.css - 基础排版（站点头部/导航/正文/页脚） */
/* 装修基础课 v1.2 */

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: var(--lh-base);
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 站点头部 ===== */

.site-header {
  background: linear-gradient(135deg, var(--c-mid) 0%, var(--c-light) 100%);
  color: var(--c-white);
  padding: var(--sp-4) 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.brand {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--c-white);
  text-decoration: none;
  letter-spacing: var(--tracking-wide);
}

.site-nav {
  display: flex;
  gap: var(--sp-4);
  font-size: var(--fs-sm);
}

.site-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  transition: background 0.2s;
}

.site-nav a:hover {
  background: rgba(255,255,255,0.15);
  color: var(--c-white);
}

.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.2);
  margin-top: var(--sp-4);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-decor), var(--c-white));
  transition: width 0.4s ease;
}

/* ===== 通用排版 ===== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--c-text);
  line-height: var(--lh-tight);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-4);
  font-weight: 700;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); border-bottom: 2px solid var(--c-line); padding-bottom: var(--sp-2); }
h3 { font-size: var(--fs-xl); color: var(--c-mid); }
h4 { font-size: var(--fs-lg); color: var(--c-light); }

p {
  margin-bottom: var(--sp-4);
  line-height: var(--lh-base);
}

a {
  color: var(--c-mid);
  text-decoration: none;
  border-bottom: 1px dotted var(--c-mid);
}

a:hover {
  color: var(--c-light);
  border-bottom-style: solid;
}

strong { font-weight: 700; color: var(--c-deep); }
em { font-style: italic; color: var(--c-text-soft); }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(124,92,62,0.08);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  color: var(--c-mid);
}

pre {
  background: #2d2218;
  color: #f0e6d8;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: var(--sp-4) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: var(--lh-tight);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

blockquote {
  background: var(--c-card);
  border-left: 4px solid var(--c-light);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-4) 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--c-text-soft);
}

blockquote p { margin-bottom: 0; }

ul, ol {
  margin: var(--sp-3) 0 var(--sp-4);
  padding-left: var(--sp-5);
}

li { margin-bottom: var(--sp-2); }

table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--sp-4) 0;
  background: var(--c-white);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th {
  background: var(--c-mid);
  color: var(--c-white);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-sm);
}

td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  font-size: var(--fs-sm);
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--c-card); }

hr {
  border: none;
  height: 1px;
  background: var(--c-line);
  margin: var(--sp-6) 0;
}

/* ===== 站点尾部 ===== */

.site-footer {
  background: var(--c-deep);
  color: rgba(255,255,255,0.7);
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  margin-top: var(--sp-10);
  font-size: var(--fs-sm);
}

.site-footer p { margin-bottom: var(--sp-1); }

/* ===== 通用工具 ===== */

.text-mute { color: var(--c-text-mute); }
.text-soft { color: var(--c-text-soft); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }

/* ===== 响应式 ===== */

@media (max-width: 640px) {
  :root {
    --fs-3xl: 1.9rem;
    --fs-2xl: 1.5rem;
    --fs-xl: 1.2rem;
    --fs-hero: 2.2rem;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  .site-nav { width: 100%; justify-content: space-around; }
  body { padding: 0; }
  h2 { font-size: var(--fs-xl); }
  table { font-size: var(--fs-xs); }
  th, td { padding: var(--sp-2) var(--sp-3); }
}
