/* ===== CSS Variables ===== */
:root {
  --accent-color: #673ab7;
  --accent-light: #9575cd;
  --accent-dark: #512da8;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --bg-white: #fff;
  --bg-light: #f5f5f5;
  --bg-gray: #eee;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 4px;
  --radius-lg: 8px;
  --max-width: 1200px;
  --gap: 20px;
  --gap-lg: 30px;
}

/* ===== 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-light);
}

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 var(--gap);
}

.main-wrapper {
  background: var(--bg-white);
  min-height: calc(100vh - 200px);
  padding: var(--gap-lg) 0;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

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

.logo span {
  color: var(--text-primary);
}

.nav {
  display: flex;
  gap: var(--gap-lg);
}

.nav a {
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}

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

/* ===== Breadcrumb ===== */
.breadcrumb {
  background: var(--bg-gray);
  padding: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

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

.breadcrumb span {
  margin: 0 0.5rem;
}

/* ===== Grid System ===== */
.grid {
  display: grid;
  gap: var(--gap);
}

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

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

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

.grid-main-sidebar {
  grid-template-columns: 2fr 1fr;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-image {
  position: relative;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

.card-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent-color);
  color: var(--bg-white);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius);
  text-transform: uppercase;
}

.card-body {
  padding: var(--gap);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.card-title a {
  color: inherit;
}

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

.card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ===== Headline Card ===== */
.headline-card {
  grid-column: span 1;
  position: relative;
  min-height: 400px;
}

.headline-card .card-image {
  position: absolute;
  inset: 0;
}

.headline-card .card-image img {
  height: 100%;
}

.headline-card .card-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: var(--bg-white);
  padding: var(--gap-lg);
}

.headline-card .card-title {
  font-size: 1.5rem;
  color: var(--bg-white);
}

.headline-card .card-title a:hover {
  color: var(--accent-light);
}

.headline-card .card-excerpt {
  color: rgba(255,255,255,0.8);
}

.headline-card .card-meta {
  color: rgba(255,255,255,0.6);
}

/* ===== Feature Card ===== */
.feature-card {
  grid-row: span 2;
  min-height: 400px;
}

.feature-card .card-image {
  height: 60%;
}

/* ===== Sidebar ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}

.widget {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: var(--gap);
  box-shadow: var(--shadow);
}

.widget-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--gap);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent-color);
}

.widget-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.widget-list a {
  color: var(--text-primary);
  font-size: 0.9375rem;
  display: block;
}

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

.widget-list .meta {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ===== Article List ===== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.list-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--gap);
  padding: var(--gap);
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
}

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

.list-item-image {
  width: 120px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
}

.list-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-item-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.list-item-content h4 a {
  color: var(--text-primary);
}

.list-item-content h4 a:hover {
  color: var(--accent-color);
}

.list-item-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Section ===== */
.section {
  margin-bottom: var(--gap-lg);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent-color);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* ===== Category Hero ===== */
.category-hero {
  background: var(--accent-color);
  color: var(--bg-white);
  padding: var(--gap-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--gap-lg);
}

.category-hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.category-hero p {
  opacity: 0.9;
}

/* ===== Article Page ===== */
.article-header {
  margin-bottom: var(--gap-lg);
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--gap);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--gap-lg);
}

.article-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-content h2 {
  font-size: 1.5rem;
  margin: var(--gap-lg) 0 var(--gap);
  color: var(--text-primary);
}

.article-content h3 {
  font-size: 1.25rem;
  margin: var(--gap-lg) 0 var(--gap);
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: var(--gap);
}

.article-content ul,
.article-content ol {
  margin-bottom: var(--gap);
  padding-left: 1.5rem;
}

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

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

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content img {
  border-radius: var(--radius-lg);
  margin: var(--gap-lg) 0;
}

.article-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: var(--gap);
  margin: var(--gap-lg) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== Author Box ===== */
.author-box {
  display: flex;
  gap: var(--gap);
  padding: var(--gap-lg);
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  margin-top: var(--gap-lg);
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info h4 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.author-info p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--gap-lg);
}

.tag {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.tag:hover {
  background: var(--accent-color);
  color: var(--bg-white);
}

/* ===== 404 Page ===== */
.error-page {
  text-align: center;
  padding: 80px var(--gap);
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: var(--gap);
}

.error-title {
  font-size: 1.5rem;
  margin-bottom: var(--gap);
}

.error-text {
  color: var(--text-secondary);
  margin-bottom: var(--gap-lg);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: var(--bg-white);
  font-weight: 500;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.btn:hover {
  background: var(--accent-dark);
  color: var(--bg-white);
}

/* ===== Footer ===== */
.footer {
  background: var(--text-primary);
  color: var(--bg-white);
  padding: var(--gap-lg) 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--gap-lg);
}

.footer-brand .logo {
  margin-bottom: var(--gap);
}

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

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--gap);
}

.footer-links li {
  margin-bottom: 0.5rem;
}

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

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

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

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .grid-main-sidebar {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .nav {
    display: none;
  }

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

  .headline-card {
    min-height: 300px;
  }

  .headline-card .card-title {
    font-size: 1.25rem;
  }

  .feature-card {
    grid-row: span 1;
  }

  .list-item {
    grid-template-columns: 100px 1fr;
  }

  .list-item-image {
    width: 100px;
    height: 70px;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .article-image {
    height: 250px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .error-code {
    font-size: 5rem;
  }
}

@media (max-width: 480px) {
  :root {
    --gap: 15px;
    --gap-lg: 20px;
  }

  .list-item {
    grid-template-columns: 1fr;
  }

  .list-item-image {
    width: 100%;
    height: 150px;
  }

  .author-box {
    flex-direction: column;
    text-align: center;
  }

  .author-avatar {
    margin: 0 auto;
  }
}
