/* ======== 杂志百科 - 豆瓣风格 CSS ======== */

/* ---- Reset & Base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --canvas: #F6F6F1;
  --surface: #FFFFFF;
  --hero-dark: #0A0A0A;
  --text-primary: #111111;
  --text-secondary: #818181;
  --text-inverse: #FFFFFF;
  --accent: #007722;
  --accent-hover: #00661E;
  --border: #E5E5E5;
  --star: #E09015;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; transition: color 0.3s ease; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ======== Header ======== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background 0.3s ease;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.main-nav {
  display: flex;
  gap: 24px;
  flex: 1;
  justify-content: center;
}

.main-nav a {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  position: relative;
}

.main-nav a:hover { color: var(--accent); }

.search-form {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.search-input {
  border: none;
  outline: none;
  padding: 5px 10px;
  font-size: 12px;
  width: 140px;
  background: transparent;
  color: var(--text-primary);
}

.search-input::placeholder { color: #ccc; }

.search-btn {
  padding: 5px 8px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ======== Hero Section ======== */
.hero-section {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  background: var(--hero-dark);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hero-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  mix-blend-mode: difference;
}

.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  color: var(--text-inverse);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.5);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-10px); }
  60% { transform: translateX(-50%) translateY(-5px); }
}

/* ======== Section Common ======== */
.section {
  padding: 60px 0;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 40px;
  cursor: default;
  display: inline-block;
}

/* ======== Magazine Card ======== */
.mag-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.mag-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.mag-link { display: block; }

.mag-cover {
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--border);
}

.mag-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.mag-cover img.loaded { opacity: 1; }

.mag-info { padding: 16px; }

.mag-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mag-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.mag-rating {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stars, .stars-lg, .stars-small {
  display: inline-flex;
  gap: 1px;
  color: var(--star);
  letter-spacing: -1px;
}

.stars-lg { font-size: 22px; }

.rating-num, .rating-score, .rating-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--star);
}

.rating-score { font-size: 22px; }

/* ======== Editors Picks - Parallax Columns ======== */
.editors-section { background: var(--canvas); padding: 80px 0; overflow: hidden; }

.columns-wrap {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.col-right { margin-top: 80px; }

.mag-item { will-change: transform; }

/* ======== Categories Grid ======== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.category-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
}

.category-card:hover { box-shadow: var(--shadow-md); }

.category-link { display: flex; }

.category-cover {
  width: 120px;
  min-width: 120px;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--border);
}

.category-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #ccc;
  background: #f0f0f0;
}

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

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.category-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.category-count {
  font-size: 12px;
  color: #ccc;
}

.category-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.category-mags {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-mag-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.cat-mag-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.cat-mag-rating {
  font-size: 12px;
  color: var(--star);
  flex-shrink: 0;
}

.no-mags { font-size: 12px; color: #ccc; }

/* ======== Arrivals Section ======== */
.arrivals-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* New list */
.new-list { display: flex; flex-direction: column; gap: 16px; }

.new-item { transition: background 0.3s ease; border-radius: 8px; }

.new-item:hover { background: var(--canvas); }

.new-link {
  display: flex;
  gap: 16px;
  padding: 8px;
}

.new-thumb {
  width: 72px;
  min-width: 72px;
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
}

.new-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.new-thumb img.loaded { opacity: 1; }

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ccc;
  background: #f0f0f0;
}

.new-body { flex: 1; min-width: 0; }

.new-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.new-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

.new-rating { display: flex; align-items: center; gap: 4px; }

.new-intro {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Top list */
.top-list { display: flex; flex-direction: column; }

.top-item {
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.3s ease;
  border-radius: 4px;
}

.top-item:last-child { border-bottom: none; }

.top-item:hover { background: var(--canvas); }

.top-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-rank {
  font-size: 18px;
  font-weight: 700;
  color: #ccc;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.top-rank.top-3 { color: var(--star); }

.top-thumb {
  width: 40px;
  min-width: 40px;
  aspect-ratio: 3/4;
  border-radius: 3px;
  overflow: hidden;
  background: var(--border);
}

.top-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.top-thumb img.loaded { opacity: 1; }

.top-body { flex: 1; min-width: 0; }

.top-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-rating-val {
  font-size: 12px;
  color: var(--star);
  margin-top: 2px;
  display: inline-block;
}

/* ======== Detail Page ======== */
.detail-page { padding-top: 48px; padding-bottom: 40px; }

.breadcrumb {
  padding: 20px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.breadcrumb a { color: var(--accent); }

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb .sep { margin: 0 6px; color: #ccc; }

.breadcrumb .current { color: var(--text-secondary); }

.detail-main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.detail-cover-wrap { flex-shrink: 0; }

.detail-cover {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--border);
  aspect-ratio: 3/4;
}

.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: #ccc;
  background: #f0f0f0;
}

.detail-title {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.detail-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-action {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--canvas);
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.btn-action:hover, .btn-action.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.detail-intro {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

.detail-notice {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

/* 兼容 HTML 中的命名 */
.detail-detail-notice {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px dashed #ccc;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px;
  font-size: 12px;
  color: var(--text-secondary);
}

.meta-label { color: #ccc; }

/* Detail sections */
.detail-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* TOC */
.toc-list { display: flex; flex-direction: column; }

.toc-item {
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.toc-item:last-child { border-bottom: none; }

.toc-item:hover { color: var(--accent); }

.toc-num {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
  width: 24px;
  flex-shrink: 0;
}

.toc-title { font-size: 14px; font-weight: 600; }

.toc-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Price grid */
.price-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.price-card {
  padding: 16px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 120px;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.price-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,119,34,0.1);
}

.price-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }

.price-discount { font-size: 12px; color: #ccc; margin-bottom: 4px; }

.price-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--star);
}

.price-periods { font-size: 11px; color: #ccc; margin-top: 4px; }

/* Magazine intro */
.magazine-intro {
  font-size: 15px;
  line-height: 1.8;
  color: #333;
}
.magazine-intro p { margin-bottom: 12px; }
.magazine-intro img { max-width: 100%; height: auto; border-radius: 8px; }

/* Related magazines */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.related-card a { display: block; }

.related-cover {
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  margin-bottom: 8px;
}

.related-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-meta { font-size: 11px; color: var(--text-secondary); }

/* ======== Category Page ======== */
.category-page, .search-page, .top-page, .new-page {
  padding-top: 48px;
  padding-bottom: 40px;
}

.page-header {
  padding: 30px 0;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.page-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.result-count {
  font-size: 12px;
  color: #ccc;
}

.magazine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.grid-card .mag-intro {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
}

.empty-hint { font-size: 12px; color: #ccc; margin-top: 8px; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 30px 0;
}

.page-link {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

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

.page-info { font-size: 13px; color: var(--text-secondary); }

/* ======== Search Page ======== */
.search-header {
  padding: 30px 0;
  text-align: center;
}

.search-form-lg {
  display: flex;
  max-width: 500px;
  margin: 20px auto 0;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.search-input-lg {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 16px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text-primary);
}

.search-btn-lg {
  padding: 10px 20px;
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s ease;
}

.search-btn-lg:hover { background: var(--accent-hover); }

/* ======== Top Ranked Page ======== */
.top-list-full { display: flex; flex-direction: column; }

.top-row { transition: background 0.3s ease; border-radius: 8px; }

.top-row:hover { background: var(--surface); }

.top-row-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
}

.top-rank-num {
  font-size: 20px;
  font-weight: 700;
  color: #ccc;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.top-rank-num.top-3 { color: var(--star); }

.top-row-thumb {
  width: 48px;
  min-width: 48px;
  aspect-ratio: 3/4;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
}

.top-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-row-body { flex: 1; min-width: 0; }

.top-row-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.top-row-meta { font-size: 12px; color: var(--text-secondary); }

.top-row-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.stat { display: flex; align-items: center; gap: 4px; }

/* ======== Static Pages ======== */
.static-page { padding-top: 48px; padding-bottom: 40px; }

.static-content {
  max-width: 720px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.static-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

.static-content p { margin-bottom: 12px; color: var(--text-secondary); }

/* ======== Footer ======== */
.site-footer {
  background: var(--canvas);
  border-top: 1px solid var(--border);
  padding: 40px 24px 0;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-brand h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.footer-brand p { font-size: 12px; color: var(--text-secondary); }

.footer-links { display: flex; gap: 40px; }

.footer-links h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.footer-links a {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

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

.footer-bottom {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p { font-size: 12px; color: #000; }

/* ======== Responsive ======== */
@media (max-width: 900px) {
  .arrivals-grid { grid-template-columns: 1fr; }
  .detail-main { grid-template-columns: 1fr; }
  .columns-wrap { gap: 12px; }
  .main-nav { display: none; }
  .magazine-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .top-row-stats { display: none; }
}

@media (max-width: 600px) {
  .categories-grid { grid-template-columns: 1fr; }
  .category-link { flex-direction: column; }
  .category-cover { width: 100%; aspect-ratio: 16/9; }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-links { flex-direction: column; gap: 20px; }
  .hero-title { font-size: 28px; }
}
