/* ===== 诗词起福 - 主样式表 ===== */

:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #666;
  --text-muted: #999;
  --accent: #8b5e3c;
  --accent-light: #c9a882;
  --border: #e5e0d8;
  --shadow: rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 32px 0 24px;
  text-align: center;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.site-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* ===== Category Navigation ===== */
.category-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  border-color: var(--accent-light);
  color: var(--accent);
}

.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== Poems Grid ===== */
.poems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 32px 0;
}

.poem-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  position: relative;
}

.poem-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.poem-cat {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--accent-light);
  color: #fff;
  border-radius: 4px;
  margin-bottom: 12px;
}

.poem-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.poem-author {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.poem-preview {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-family: var(--font-serif);
  white-space: pre-line;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  max-width: 560px;
  width: 90%;
  padding: 32px;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg);
}

.modal-dynasty {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  margin-bottom: 16px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-author {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.modal-text {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text-primary);
  white-space: pre-line;
  background: var(--bg);
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 40px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .site-title {
    font-size: 1.5rem;
  }

  .poems-grid {
    grid-template-columns: 1fr;
    padding: 20px 0;
  }

  .modal {
    width: 95%;
    padding: 24px 20px;
  }

  .modal-text {
    font-size: 1rem;
    padding: 16px;
  }
}
