/* ===== CSS Variables ===== */
:root {
  --accent-color: #673ab7;
  --accent-light: #9575cd;
  --accent-dark: #512da8;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-card: #fff;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
}

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

a:hover {
  color: var(--accent-dark);
}

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

ul {
  list-style: none;
}

/* ===== Layout ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Header ===== */
.header {
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  color: var(--text-primary);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 200px;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

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

.search-box button {
  padding: 8px 16px;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.search-box button:hover {
  background: var(--accent-dark);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%);
  color: #fff;
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 32px;
}

.hero-search {
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-search input {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  box-shadow: var(--shadow);
}

.hero-search input:focus {
  outline: none;
  box-shadow: var(--shadow-hover);
}

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

.hero-categories a {
  padding: 12px 24px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
}

.hero-categories a:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ===== Section Title ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-primary);
}

/* ===== Card Styles ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

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

.card-body {
  padding: 24px;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

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

.card-text {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* ===== Whitepaper List ===== */
.whitepaper-list {
  padding: 48px 0;
}

.whitepaper-item {
  display: flex;
  gap: 24px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: box-shadow 0.2s;
}

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

.whitepaper-thumb {
  width: 120px;
  height: 160px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent-light);
}

.whitepaper-content {
  flex: 1;
}

.whitepaper-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

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

.whitepaper-meta span {
  margin-right: 16px;
}

.whitepaper-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.whitepaper-actions {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

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

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

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

/* ===== Grid Layouts ===== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* ===== Article Sections ===== */
.section {
  padding: 48px 0;
}

.section-alt {
  background: var(--bg-secondary);
}

/* ===== Article List ===== */
.article-list {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.article-list h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.article-list ul li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.article-list ul li:last-child {
  border-bottom: none;
}

.article-list ul li a {
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-list ul li a::before {
  content: "•";
  color: var(--accent-color);
  font-weight: bold;
}

.article-list ul li a:hover {
  color: var(--accent-color);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  padding: 16px 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 8px;
  color: var(--text-muted);
}

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

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

.breadcrumb li:last-child {
  color: var(--text-muted);
}

/* ===== Category Header ===== */
.category-header {
  padding: 48px 0 32px;
  text-align: center;
}

.category-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.category-header p {
  color: var(--text-secondary);
}

/* ===== Sort Bar ===== */
.sort-bar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  font-size: 0.875rem;
}

.sort-bar a {
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.sort-bar a:hover,
.sort-bar a.active {
  color: var(--accent-color);
  background: rgba(103, 58, 183, 0.1);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination a,
.pagination span {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  min-width: 40px;
  text-align: center;
}

.pagination a {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.pagination a:hover {
  background: var(--accent-color);
  color: #fff;
}

.pagination .current {
  background: var(--accent-color);
  color: #fff;
}

.pagination .disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ===== Article Page ===== */
.article-header {
  padding: 48px 0 32px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.article-cover {
  max-width: 600px;
  margin: 0 auto 48px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
}

.article-cover img {
  width: 100%;
  height: auto;
}

.article-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 0 48px;
}

.article-section {
  margin-bottom: 40px;
}

.article-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.article-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

.article-section ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}

.article-section ul li {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 8px;
}

.key-points {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0;
}

.key-points h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--accent-color);
}

.key-points ul {
  list-style: none;
  padding-left: 0;
}

.key-points li {
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
}

.key-points li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

.toc {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0;
}

.toc h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.toc ol {
  padding-left: 20px;
}

.toc li {
  padding: 8px 0;
  color: var(--text-secondary);
}

.toc a {
  color: var(--text-secondary);
}

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

.download-section {
  text-align: center;
  padding: 32px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin: 32px 0;
}

.download-section p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* ===== Related Section ===== */
.related-section {
  padding: 48px 0;
  background: var(--bg-secondary);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

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

.related-card-thumb {
  height: 120px;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.related-card-body {
  padding: 16px;
}

.related-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.related-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== 404 Page ===== */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 20px;
}

.error-content h1 {
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 16px;
}

.error-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
}

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

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

/* ===== Footer ===== */
.footer {
  background: var(--text-primary);
  color: #fff;
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 32px;
}

.footer-brand .logo {
  color: #fff;
  margin-bottom: 16px;
}

.footer-brand p {
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  line-height: 1.7;
}

.footer-column h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.footer-column ul li {
  margin-bottom: 8px;
}

.footer-column ul li a {
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
}

.footer-column ul li a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 0.875rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .header .container {
    flex-wrap: wrap;
  }

  .nav {
    display: none;
  }

  .search-box {
    display: none;
  }

  .hero {
    padding: 48px 0;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-categories {
    gap: 8px;
  }

  .hero-categories a {
    padding: 8px 16px;
    font-size: 0.875rem;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .whitepaper-item {
    flex-direction: column;
  }

  .whitepaper-thumb {
    width: 100%;
    height: 120px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }

  .article-meta {
    flex-wrap: wrap;
    gap: 12px;
  }

  .error-content h1 {
    font-size: 4rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .whitepaper-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .error-actions {
    flex-direction: column;
  }
}
