/* ========================================
   DZDianNao - Main Stylesheet
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0f172a;
  --accent: #f59e0b;
  --text: #334155;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --bg: #ffffff;
  --bg-light: #f8fafc;
  --bg-dark: #0f172a;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --content-width: 720px;
  --sidebar-width: 300px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg-light);
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }

/* ========================================
   Bilingual Support
   ======================================== */

body[lang="zh"] .lang-en { display: none !important; }
body[lang="en"] .lang-zh { display: none !important; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text);
  border-radius: var(--radius);
  transition: var(--transition);
}
.header-search:hover {
  background: var(--bg-light);
  color: var(--primary);
}

.lang-switch {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}
.lang-switch:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ========================================
   Layout
   ======================================== */

.site-container { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

.main-grid {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 32px;
  align-items: start;
}

@media (max-width: 1024px) {
  .main-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ========================================
   Header & Nav
   ======================================== */

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

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--secondary);
}
.logo:hover { color: var(--primary); }
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1rem;
  font-weight: 700;
}
.logo-text { display: inline; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
}
.main-nav a:hover { background: var(--bg-light); color: var(--primary); }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    flex-direction: column;
    gap: 4px;
  }
  .main-nav.open { display: flex; }
  .main-nav a { display: block; width: 100%; }
  .mobile-menu-btn { display: block; }
}

/* ========================================
   Hero
   ======================================== */

.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, #1e293b 100%);
  color: white;
  padding: 64px 0;
  margin-bottom: 40px;
}
.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero p {
  font-size: 1.15rem;
  color: #94a3b8;
  max-width: 560px;
  margin-bottom: 28px;
  line-height: 1.6;
}
.hero-cta {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
}
.hero-cta:hover { background: var(--primary-dark); color: white; }

@media (max-width: 768px) {
  .hero { padding: 40px 0; }
  .hero h1 { font-size: 1.9rem; }
  .hero p { font-size: 1rem; }
}

/* ========================================
   Section Header
   ======================================== */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--secondary);
}
.section-header a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* ========================================
   Ad Units
   ======================================== */

.ad-unit {
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  position: relative;
}
.ad-unit img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-rent-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.ad-unit-top { margin-bottom: 24px; }
.ad-unit-inline { margin: 32px 0; }
.ad-unit-footer { margin: 32px 0; }

/* ========================================
   Breadcrumb
   ======================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ========================================
   Article Cards
   ======================================== */

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

@media (max-width: 1024px) {
  .article-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .article-grid { grid-template-columns: 1fr; }
}

.article-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border);
}
.article-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.article-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  overflow: hidden;
}
.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.article-card:hover .article-card-image img {
  transform: scale(1.05);
}
.article-card-body { padding: 20px; }
.article-card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 8px;
}
.article-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--secondary);
  margin-bottom: 8px;
}
.article-card-title a { color: inherit; }
.article-card-title a:hover { color: var(--primary); }
.article-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========================================
   Sidebar Widgets
   ======================================== */

.sidebar { position: sticky; top: 88px; }
.widget {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.widget-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.widget-list {
  list-style: none;
  margin: 0;
}
.widget-list li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 16px;
}
.widget-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.6;
  transition: var(--transition);
}
.widget-list li:hover::before {
  opacity: 1;
  transform: scale(1.2);
}
.widget-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--bg-light);
}
.widget-list a:hover { background: var(--primary); color: white; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-light);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text);
  transition: var(--transition);
}
.tag:hover { background: var(--primary); color: white; }

/* ========================================
   Footer
   ======================================== */

.site-footer {
  background: var(--secondary);
  color: #94a3b8;
  padding: 48px 0 20px;
  margin-top: 60px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}
.footer-brand strong {
  display: block;
  font-size: 1.2rem;
  color: white;
  margin-bottom: 10px;
}
.footer-brand p {
  font-size: 0.9rem;
  line-height: 1.6;
}
.footer-links h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}
.footer-links ul {
  list-style: none;
  margin: 0;
}
.footer-links li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 14px;
}
.footer-links li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #64748b;
  transition: var(--transition);
}
.footer-links li:hover::before {
  background: white;
  transform: scale(1.2);
}
.footer-links a { color: #94a3b8; font-size: 0.9rem; }
.footer-links a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 4px; }
}

/* ========================================
   Scroll to Top
   ======================================== */

.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 99;
}
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: var(--primary-dark); }

/* ========================================
   Article Single Page
   ======================================== */

.article-single {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
@media (max-width: 768px) {
  .article-single { padding: 20px; }
}

.article-single__header {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}
.article-single__category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.article-single__title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--secondary);
  margin-bottom: 16px;
}
@media (max-width: 768px) {
  .article-single__title { font-size: 1.6rem; }
}
.article-single__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-light);
}

.article-single__content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}
.article-single__content p { margin-bottom: 1.2em; }
.article-single__content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--secondary);
  margin: 1.8em 0 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--border-light);
}
.article-single__content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--secondary);
  margin: 1.6em 0 0.5em;
}
.article-single__content ul,
.article-single__content ol {
  margin: 0 0 1.2em 1.5em;
}
.article-single__content li { margin-bottom: 0.4em; }
.article-single__content blockquote {
  background: var(--bg-light);
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5em 0;
  color: var(--secondary);
  font-weight: 500;
}
.article-single__content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.article-single__content th,
.article-single__content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.article-single__content thead {
  background: var(--bg-light);
  font-weight: 700;
  color: var(--secondary);
}
.article-single__content tbody tr:last-child td { border-bottom: none; }
.article-single__content tbody tr:hover { background: var(--bg-light); }

/* ========================================
   Table of Contents
   ======================================== */

.toc {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 28px 0;
}
.toc__title {
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 12px;
  font-size: 1rem;
}
.toc ul { list-style: none; margin: 0; }
.toc li { margin-bottom: 8px; }
.toc a {
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc a::before {
  content: "#";
  color: var(--primary);
  font-weight: 700;
}
.toc a:hover { color: var(--primary); }

/* ========================================
   Featured Image Placeholder
   ======================================== */

.featured-image {
  width: 100%;
  aspect-ratio: 21/9;
  margin-bottom: 32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  position: relative;
  overflow: hidden;
}
.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 768px) {
  .featured-image { aspect-ratio: 16/9; }
}

/* ========================================
   Product Card
   ======================================== */

.product-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 1.2em 0;
}
@media (max-width: 640px) {
  .product-card { grid-template-columns: 1fr; text-align: center; }
}
.product-card__image {
  width: 140px;
  height: 100px;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
@media (max-width: 640px) {
  .product-card__image { width: 100%; height: 160px; }
}
.product-card__name {
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 6px;
}
.product-card__specs {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 10px;
}
.product-card__price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
}
.product-card__cta {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
}
.product-card__cta:hover { background: var(--primary-dark); color: white; }

/* ========================================
   Pros & Cons
   ======================================== */

.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 1.5em 0;
}
@media (max-width: 640px) {
  .pros-cons { grid-template-columns: 1fr; }
}
.pros-cons__box {
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
}
.pros-cons__box--pros { background: rgba(34, 197, 94, 0.06); border-left: 4px solid #22c55e; }
.pros-cons__box--cons { background: rgba(239, 68, 68, 0.06); border-left: 4px solid #ef4444; }
.pros-cons__title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 1rem;
}
.pros-cons__box--pros .pros-cons__title { color: #15803d; }
.pros-cons__box--cons .pros-cons__title { color: #b91c1c; }
.pros-cons__list { list-style: none; margin: 0; }
.pros-cons__list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.pros-cons__list li::before {
  position: absolute;
  left: 0;
  top: 2px;
  font-weight: 700;
}
.pros-cons__box--pros .pros-cons__list li::before { content: "✓"; color: #22c55e; }
.pros-cons__box--cons .pros-cons__list li::before { content: "✗"; color: #ef4444; }

/* ========================================
   Affiliate Disclaimer & AI Notice
   ======================================== */

.affiliate-disclaimer {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 28px 0;
}
.ai-notice {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 24px;
}

/* ========================================
   Category Pages
   ======================================== */

.category-hero {
  background: linear-gradient(135deg, var(--secondary) 0%, #1e293b 100%);
  color: white;
  padding: 48px 0 40px;
  margin-bottom: 32px;
}
.category-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.category-hero p {
  color: #94a3b8;
  font-size: 1.05rem;
  max-width: 640px;
}
.category-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  margin-top: 14px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
@media (max-width: 1024px) {
  .category-grid { grid-template-columns: 1fr; }
}

.empty-state {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-light);
}
.empty-state strong {
  display: block;
  color: var(--secondary);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* ========================================
   Small Enhancements
   ======================================== */

.article-card-image {
  position: relative;
  overflow: hidden;
}
.article-card-image::after {
  content: "🖼";
  position: absolute;
  font-size: 2rem;
  opacity: 0.15;
}
.section-header a:hover { text-decoration: underline; }


/* ========================================
   Bootstrap 5 Overrides & Helpers
   ======================================== */

:root {
  --bs-primary: #2563eb;
  --bs-link-color: #2563eb;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-section {
  background-image: url('/images/home-hero.jpg');
  background-size: cover;
  background-position: center;
  min-height: 520px;
}

.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
}

.hover-shadow:hover {
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15) !important;
}

/* 让 Bootstrap 卡片图片保持 16/10 */
.card-img-wrapper {
  aspect-ratio: 16/10;
  overflow: hidden;
}
.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Keep sticky sidebar spacing */
.sidebar {
  position: sticky;
  top: 88px;
}

/* Footer link hover */
footer a.text-secondary:hover {
  color: #ffffff !important;
}
