/* ============================================================
   墨韵纸香 — Ink & Parchment Design System
   Literary Portfolio · Game Artbook Aesthetic
   Brand Register · Light Theme
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,400;1,500&family=Noto+Serif+SC:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&family=Noto+Sans+SC:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- A1-identity (品牌核心，不可省略) ---------- */
:root {
  /* Surface — 浅色素雅 · 暖纸调 */
  --bg: #F5F2EC;              /* 羊皮纸暖白 — 页面背景 */
  --surface: #FBF9F4;         /* 象牙白 — 卡片/容器 */
  --fg: #1C1B1A;              /* 暖墨黑 — 主文本（非纯黑） */
  --muted: #6B655C;           /* 暖灰褐 — 副文本/标题 */
  --accent: #9A6B3E;          /* 古铜金 — 品牌强调色（每屏≤2处） */
  --border: #E0DAD0;          /* 暖灰边框 */
  --font-display: "Spectral", "Noto Serif SC", Georgia, serif;
  --font-body: "Inter", "Noto Sans SC", -apple-system, sans-serif;

  /* ---------- A1-structure ---------- */
  --container-max: 1080px;
  --container-gutter-desktop: 64px;
  --container-gutter-tablet: 32px;
  --container-gutter-phone: 20px;
  --section-y-desktop: 80px;
  --section-y-tablet: 48px;
  --section-y-phone: 32px;

  /* Type Scale (8级) */
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 2rem;     /* 32px */
  --text-4xl: 2.5rem;   /* 40px */

  /* Leading & Tracking */
  --leading-body: 1.75;
  --leading-tight: 1.2;
  --tracking-display: -0.015em;

  /* ---------- B-slot (≥2品牌别名，品牌必须声明) ---------- */
  --surface-warm: #EFEAE0;   /* 三级暖表面 */
  --fg-2: #3D3A35;           /* 次级前景 */
  --meta: #9B9489;           /* 三级前景/元数据 */
  --border-soft: #EDE9E0;    /* 内部行分隔符 */

  /* ---------- A2 (有默认值) ---------- */
  --accent-on: #FBF9F4;
  --accent-hover: #8A5D33;
  --accent-active: #7A4F2B;
  --success: #5B7C3D;
  --warn: #B8860B;
  --danger: #9C4221;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Spacing (4px grid, 8级) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Radius (4级) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Elevation (3级) */
  --elev-flat: none;
  --elev-ring: 0 0 0 1px var(--border);
  --elev-raised: 0 1px 2px rgba(60, 50, 30, 0.04), 0 4px 12px rgba(60, 50, 30, 0.06);

  /* Focus & Motion */
  --focus-ring: 0 0 0 3px rgba(154, 107, 62, 0.3);
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* Artbook-specific extensions (C-extension) */
  --paper-grain-opacity: 0.03;
  --ornament-color: var(--accent);
  --reading-width: 38rem;   /* 608px — optimal line length for literary content */
}

/* ---------- Prefers Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Base Reset & Typography ---------- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Paper grain texture — subtle artbook feel */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--paper-grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Typography Hierarchy ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--fg);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  margin: 0;
}

h1 { font-size: var(--text-4xl); font-weight: 600; }
h2 { font-size: var(--text-3xl); font-weight: 500; }
h3 { font-size: var(--text-2xl); font-weight: 500; }
h4 { font-size: var(--text-xl); font-weight: 500; }

p { margin: 0 0 var(--space-4) 0; }

/* Literary content — serif body for reading */
.prose {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.8;
  max-width: var(--reading-width);
  color: var(--fg);
}

/* Drop cap — artbook/literary touch */
.prose > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.8;
  margin: 0.05em 0.12em 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent);
}

/* Ornamental divider */
.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-8) 0;
  gap: var(--space-4);
}
.divider-ornament::before,
.divider-ornament::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}
.divider-ornament span {
  color: var(--accent);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
}

/* ---------- Components ---------- */

/* Button — Primary */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  background: var(--accent);
  color: var(--accent-on);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Button — Secondary */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-standard);
}
.btn-secondary:hover { background: var(--surface-warm); }

/* Card — artbook data sheet style */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: border-color var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard);
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--elev-raised);
}

/* Character card — artbook layout */
.character-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.character-card__visual {
  background: var(--surface-warm);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.character-card__info {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Metadata label — mono small caps style */
.meta-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--meta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Tag / Badge */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--surface-warm);
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}

/* Section label — artbook chapter marker */
.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.section-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

/* Navigation */
.nav-link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--fg-2);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast) var(--ease-standard),
              background var(--motion-fast) var(--ease-standard);
}
.nav-link:hover { color: var(--accent); background: var(--surface-warm); }
.nav-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-link--active { color: var(--accent); font-weight: 500; }

/* Scroll progress — thin top line */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  z-index: 100;
  transition: width 100ms linear;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .character-card {
    grid-template-columns: 1fr;
  }
  .character-card__visual {
    min-height: 240px;
  }
  .prose {
    font-size: var(--text-base);
  }
}
