/* ============================================
   每日大赛社区讨论论坛 - 第26套模板
   设计风格：Reddit经典社区进化版（功能主义+现代卡片化）
   配色：Reddit橙+浅灰赛事视觉
   ============================================ */

:root {
  --primary: #FF4500;
  --secondary: #F6F7F8;
  --bg: #FFFFFF;
  --card: #EDEFF1;
  --accent: #0079D3;
  --text: #1C1C1C;
  --text-light: #576F76;
  --text-muted: #878A8C;
  --border: #EDEFF1;
  --success: #46D160;
  --warning: #FF8B60;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 10px 30px rgba(0,0,0,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font-sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", monospace;
  --container-max: 1200px;
  --sidebar-width: 300px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--secondary);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

a:hover {
  color: var(--primary);
}

ul, ol {
  list-style: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.site-logo svg {
  width: 32px;
  height: 32px;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-main a {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s var(--ease-out);
}

.nav-main a:hover,
.nav-main a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.16s var(--ease-out);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary:hover {
  background: #E03D00;
  color: #fff;
}

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

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

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

.btn-ghost:hover {
  background: var(--card);
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: all 0.3s var(--ease-out);
}

/* Layout */
.page-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 1.5rem;
  max-width: var(--container-max);
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.main-content {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card */
.card {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease-out);
}

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

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--secondary);
}

/* Post Card */
.post-card {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  transition: all 0.2s var(--ease-out);
  overflow: hidden;
}

.post-card:hover {
  border-color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.vote-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.5rem;
  background: var(--secondary);
  min-width: 42px;
  gap: 0.25rem;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: all 0.16s var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vote-btn:hover {
  background: var(--card);
}

.vote-btn.upvoted {
  color: var(--primary);
}

.vote-btn.downvoted {
  color: var(--accent);
}

.vote-btn:active {
  transform: scale(1.2);
}

.vote-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.post-content {
  flex: 1;
  padding: 0.75rem 1rem;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.post-meta .tag {
  background: var(--card);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
}

.post-meta .tag-hot {
  background: #FFF3E0;
  color: var(--primary);
}

.post-meta .mod-badge {
  background: #E8F5E9;
  color: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.post-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-title a {
  color: inherit;
}

.post-title a:hover {
  color: var(--accent);
}

.post-excerpt {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-actions button,
.post-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
  font-size: 0.8rem;
}

.post-actions button:hover,
.post-actions a:hover {
  background: var(--card);
  color: var(--text);
}

/* Comment */
.comment {
  padding: 0.75rem 0;
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin-left: 0.5rem;
  margin-top: 0.5rem;
}

.comment-nested {
  margin-left: 1.5rem;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-time {
  color: var(--text-muted);
}

.comment-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Hero Section */
.hero {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.hero-banner {
  position: relative;
  height: 200px;
  overflow: hidden;
}

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

.hero-content {
  padding: 1.5rem;
}

.hero-content h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.hero-content p {
  color: var(--text-light);
  font-size: 1rem;
  max-width: 600px;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.hero-stat {
  text-align: center;
}

.hero-stat .num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.hero-stat .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sidebar Widgets */
.widget {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.widget-header {
  padding: 0.75rem 1rem;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.widget-header.blue {
  background: var(--accent);
}

.widget-body {
  padding: 1rem;
}

.widget-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.widget-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.widget-list-item:hover {
  background: var(--secondary);
}

.widget-list-item .rank {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
  min-width: 24px;
}

.widget-list-item .name {
  font-weight: 500;
  font-size: 0.85rem;
}

.widget-list-item .score {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Announcement */
.announcement {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.announcement-icon {
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.announcement-content h4 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.announcement-content p {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 1rem 0;
  flex-wrap: wrap;
}

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

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

.breadcrumb .sep {
  color: var(--border);
}

/* Section */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.section-title h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title .more {
  font-size: 0.8rem;
  color: var(--accent);
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

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

.faq-question {
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--primary);
  transition: transform 0.2s var(--ease-out);
}

.faq-item.open .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-top: 0.75rem;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

/* Footer */
.site-footer {
  background: var(--text);
  color: #ccc;
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-col h4 {
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  color: #999;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  max-width: var(--container-max);
  margin: 2rem auto 0;
  padding: 1rem 1rem 0;
  border-top: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #666;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Page Content */
.page-content {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.page-content h1 {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary);
}

.page-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.page-content p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

.page-content ul,
.page-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.page-content ul {
  list-style: disc;
}

.page-content ol {
  list-style: decimal;
}

.page-content li {
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

/* Karma Badge */
.karma-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #FF4500, #FF8B60);
  color: #fff;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Topic Tags */
.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.topic-tag {
  background: var(--card);
  color: var(--text-light);
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s var(--ease-out);
}

.topic-tag:hover {
  background: var(--primary);
  color: #fff;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  transition: border-color 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-sans);
  color: var(--text);
}

.search-box button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }

  .nav-main {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .nav-main.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .header-actions .btn {
    display: none;
  }

  .hero-banner {
    height: 140px;
  }

  .hero-content h1 {
    font-size: 1.25rem;
  }

  .hero-stats {
    gap: 1rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content {
    padding: 1.25rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    flex-wrap: wrap;
  }

  .post-card {
    flex-direction: column;
  }

  .vote-bar {
    flex-direction: row;
    padding: 0.5rem 1rem;
  }
}

/* Animations */
@media (prefers-reduced-motion: no-preference) {
  .post-card {
    animation: fadeInUp 0.3s var(--ease-out) both;
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .post-card:nth-child(1) { animation-delay: 0ms; }
  .post-card:nth-child(2) { animation-delay: 50ms; }
  .post-card:nth-child(3) { animation-delay: 100ms; }
  .post-card:nth-child(4) { animation-delay: 150ms; }
  .post-card:nth-child(5) { animation-delay: 200ms; }
}

/* Utility */
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
