/* ===========================
   墨游 - 开放小说分享平台
   核心样式表
   =========================== */

/* ---------- 变量 / 主题 ---------- */
:root {
  /* 亮色主题（阅读模式） */
  --bg-primary: #f8f5f0;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hero: #1a1a2e;
  --text-primary: #2c2c2c;
  --text-secondary: #6b6b6b;
  --text-muted: #999999;
  --text-on-dark: #f0ebe0;
  --accent: #c8553d;
  --accent-hover: #a8442f;
  --accent-light: #f4e4e0;
  --border: #e8e2d8;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1100px;
  --reading-width: 720px;
  --font-ui: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-read: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --transition: all 0.25s ease;
}

[data-theme="dark"] {
  --bg-primary: #1a1a24;
  --bg-secondary: #22222e;
  --bg-card: #22222e;
  --bg-hero: #0f0f1a;
  --text-primary: #e0ddd5;
  --text-secondary: #a0a0aa;
  --text-muted: #6b6b75;
  --text-on-dark: #f0ebe0;
  --accent: #d4654a;
  --accent-hover: #c8553d;
  --accent-light: #2a2025;
  --border: #33333d;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.4);
}

/* ---------- 重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

img { max-width: 100%; display: block; }

/* ---------- 布局容器 ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 48px 0; }

/* ---------- 导航栏 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand .brand-seal {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.navbar-nav a {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.navbar-nav a:hover, .navbar-nav a.active {
  color: var(--accent);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-ui);
  transition: var(--transition);
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--accent);
}

.btn-sm { padding: 8px 18px; font-size: 0.85rem; }

/* ---------- Hero 区域 ---------- */
.hero {
  background: var(--bg-hero);
  color: var(--text-on-dark);
  text-align: center;
  padding: 80px 24px 70px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(200,85,61,0.08), transparent 60%);
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -50%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(100,140,200,0.06), transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 16px;
  font-family: var(--font-read);
}

.hero .hero-subtitle {
  font-size: 1.15rem;
  opacity: 0.8;
  margin-bottom: 8px;
  line-height: 1.8;
}

.hero .hero-tagline {
  font-size: 0.9rem;
  opacity: 0.5;
  margin-bottom: 32px;
  letter-spacing: 1px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero .btn-primary {
  background: var(--accent);
}

.hero .btn-outline {
  border-color: rgba(240,235,224,0.4);
  color: var(--text-on-dark);
}

.hero .btn-outline:hover {
  background: rgba(240,235,224,0.1);
  border-color: var(--text-on-dark);
}

/* ---------- 章节标题 ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  padding-left: 16px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--accent);
  border-radius: 2px;
}

.section-link {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.section-link:hover { color: var(--accent); }

/* ---------- 小说卡片 ---------- */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.story-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.story-cover {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-read);
  position: relative;
}

.story-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(0,0,0,0.15));
}

.story-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.story-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.story-excerpt {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--accent-light);
  color: var(--accent);
}

/* ---------- 特性区块 ---------- */
.features {
  background: var(--bg-secondary);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
}

.feature-item {
  text-align: center;
  padding: 24px 16px;
}

.feature-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.feature-item h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---------- CTA 区域 ---------- */
.cta {
  background: var(--bg-hero);
  color: var(--text-on-dark);
  text-align: center;
  padding: 56px 24px;
}

.cta h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  font-family: var(--font-read);
}

.cta p {
  opacity: 0.7;
  margin-bottom: 28px;
  font-size: 1rem;
}

/* ---------- 页脚 ---------- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px 24px 24px;
  text-align: center;
}

.footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.footer .footer-links {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 16px;
}

.footer .footer-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer .footer-links a:hover { color: var(--accent); }

/* ---------- 浏览页 ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  font-family: var(--font-ui);
}

.filter-select:focus { outline: none; border-color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: 0.95rem; }

/* ---------- 阅读页 ---------- */
.read-header {
  text-align: center;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.read-header h1 {
  font-size: 2rem;
  font-family: var(--font-read);
  margin-bottom: 12px;
  color: var(--text-primary);
}

.read-header .read-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.read-header .read-meta span { margin: 0 8px; }

.read-content {
  font-family: var(--font-read);
  font-size: 1.05rem;
  line-height: 2.1;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  min-height: 400px;
}

.read-content p {
  margin-bottom: 1.5em;
  text-indent: 2em;
}

.read-content p:first-child { text-indent: 2em; }

.read-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.read-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.font-btn:hover, .font-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.chapter-nav .btn { min-width: 120px; }

/* ---------- 上传表单页 ---------- */
.upload-hero {
  background: var(--bg-hero);
  color: var(--text-on-dark);
  padding: 48px 24px;
  text-align: center;
}

.upload-hero h1 {
  font-size: 2rem;
  font-family: var(--font-read);
  margin-bottom: 8px;
}

.upload-hero p { opacity: 0.7; font-size: 0.95rem; }

.upload-form {
  max-width: 680px;
  margin: 0 auto;
}

.form-group { margin-bottom: 24px; }

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-label .required { color: var(--accent); }

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-ui);
  transition: var(--transition);
}

.form-textarea {
  resize: vertical;
  min-height: 200px;
  font-family: var(--font-read);
  line-height: 1.8;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-disclaimer {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.7;
}

.form-disclaimer strong { color: var(--accent); }

.form-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

/* ---------- Toast 通知 ---------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-hero);
  color: var(--text-on-dark);
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--shadow-hover);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- 关于页 ---------- */
.about-content {
  max-width: 720px;
  margin: 0 auto;
}

.about-content h2 {
  font-size: 1.4rem;
  margin: 32px 0 16px;
  color: var(--text-primary);
  font-family: var(--font-read);
}

.about-content p {
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.about-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 16px;
}

.about-content ul li {
  font-size: 0.95rem;
  line-height: 2;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
}

.about-content ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero { padding: 56px 20px 48px; }
  .navbar-nav { display: none; }
  .section { padding: 32px 0; }
  .section-title { font-size: 1.2rem; }
  .story-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .read-content { font-size: 1rem; }
  .read-header h1 { font-size: 1.5rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .story-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; letter-spacing: 2px; }
  .navbar-brand { font-size: 1.2rem; }
  .chapter-nav { flex-direction: column; gap: 12px; }
  .chapter-nav .btn { width: 100%; }
}
