/**
 * Design Tokens 概览（夜读小说 · 精品内容平台）
 * ----------------------------------------
 * 字体系统：
 *   - 栈：system-ui / PingFang SC / Microsoft YaHei / Hiragino Sans GB（纯系统字体，无 Web Font）
 *   - H1: 36–44px 桌面 / 28–32px 移动，字重 650–700，行高 1.15–1.25，字距 -0.02em
 *   - H2: 20–24px，字重 600–650，行高 1.3
 *   - Body: 15–16px，字重 400–450，行高 1.7
 *   - Meta: 12–13px，字重 400，行高 1.4，颜色 --text-2 / --muted
 *
 * 色阶（浅色/暗色双套）：
 *   --bg, --surface, --surface-2, --text, --text-2, --muted, --border, --ring, --accent, --accent-contrast
 *
 * 圆角：--radius-sm (10px), --radius-md (14px), --radius-lg (18px)
 *
 * 阴影：--shadow-sm, --shadow-md, --shadow-lg（浅色与暗色不同）
 *
 * 间距：基数 4px；section 使用 24/32/48/64；卡片内边距 16–20；容器 max-width 1160，左右 padding 移动 16 / 桌面 24
 *
 * 动效：duration 150–220ms，ease-out；respects prefers-reduced-motion
 */

:root {
  /* 色阶 - 浅色 */
  --bg: #f8f8f8;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --text: #1a1a1a;
  --text-2: #525252;
  --muted: #737373;
  --border: #e5e5e5;
  --border-hover: #d4d4d4;
  --ring: rgba(0, 0, 0, 0.12);
  --accent: #262626;
  --accent-contrast: #ffffff;

  /* 圆角 */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* 动效 */
  --motion-duration: 180ms;
  --motion-ease: ease-out;
}

[data-theme="dark"],
.dark {
  --bg: #0a0a0a;
  --surface: #171717;
  --surface-2: #262626;
  --text: #e5e5e5;
  --text-2: #a3a3a3;
  --muted: #737373;
  --border: #404040;
  --border-hover: #525252;
  --ring: rgba(255, 255, 255, 0.15);
  --accent: #e5e5e5;
  --accent-contrast: #171717;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35), 0 1px 2px -1px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
}

/* 字体栈：中文优先 */
.tk-font, .tk-font body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

/* 排版层级（按规范落地） */
.tk-h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tk-h2 {
  font-size: 1.25rem;
  font-weight: 620;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tk-body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0;
  color: var(--text-2);
}

.tk-meta {
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
}

/* 容器 */
.tk-container {
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 768px) {
  .tk-container { padding-left: 24px; padding-right: 24px; }
}

/* Section 间距 */
.tk-section {
  padding-top: 32px;
  padding-bottom: 32px;
}

@media (min-width: 768px) {
  .tk-section { padding-top: 48px; padding-bottom: 48px; }
}

.tk-section-lg {
  padding-top: 48px;
  padding-bottom: 48px;
}

@media (min-width: 768px) {
  .tk-section-lg { padding-top: 64px; padding-bottom: 64px; }
}

/* 卡片封面占位：2:3 比例 + 轻微渐变 + 噪点纹理 */
.tk-cover {
  aspect-ratio: 2 / 3;
  background: linear-gradient(145deg, var(--surface-2) 0%, var(--border) 100%);
  position: relative;
  overflow: hidden;
}

.tk-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* 动效：统一时长与缓动；尊重 prefers-reduced-motion */
.tk-transition {
  transition-duration: var(--motion-duration);
  transition-timing-function: var(--motion-ease);
}

@media (prefers-reduced-motion: reduce) {
  .tk-transition,
  .tk-transition * {
    transition-duration: 0.01ms !important;
  }
}

/* 卡片 hover：上浮 + 阴影 + 边框（由 utilities 组合，此处仅定义可复用类） */
.tk-card-hover {
  transition: transform var(--motion-duration) var(--motion-ease),
              box-shadow var(--motion-duration) var(--motion-ease),
              border-color var(--motion-duration) var(--motion-ease);
}

.tk-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

@media (prefers-reduced-motion: reduce) {
  .tk-card-hover:hover { transform: none; }
  .scene-card span[aria-hidden="true"] { transform: none !important; }
}

/* 按钮 active 下压 */
.tk-btn-active:active {
  transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
  .tk-btn-active:active { transform: none; }
}

/* 隐藏横向滚动条 */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* 搜索框：去除 type=search 默认装饰，避免 focus 时出现清除按钮导致输入区变窄；统一左右内边距（!important 防止生产环境被其它样式覆盖） */
#nav-search {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}
#nav-search::-webkit-search-cancel-button,
#nav-search::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
#nav-search::-ms-clear {
  display: none;
}

/* 主题切换图标：由 JS 动态更新 #theme-icon 内容（🌙/☀️） */
