/* ===== CSS Custom Properties ===== */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --accent: #ff6b35;
  --bg: #ffffff;
  --bg-gray: #f5f6fa;
  --text: #222222;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --max-width: 1200px;
  --nav-height: 60px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }
body { font-family: var(--font-sans); color: var(--text); line-height: 1.7; background: var(--bg-gray); display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; width: 100%; }
main { flex: 1; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { line-height: 1.3; color: var(--text); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin-bottom: 1em; }

/* ===== Container ===== */
.container { max-width: var(--max-width); width: 100%; margin: 0 auto; padding: 0 20px; }
main.container { overflow-x: hidden; }

/* ===== Navigation ===== */
.navbar { background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; height: var(--nav-height); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 100%; overflow: visible; }
.nav-logo { font-size: 1.25rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; }
.nav-logo img { display: block; height: 36px; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-item { position: relative; }
.nav-item > a { display: block; padding: 8px 14px; color: var(--text); font-size: 0.9rem; border-radius: var(--radius); white-space: nowrap; }
.nav-item > a:hover,
.nav-item > a.active { color: var(--primary); background: rgba(26,115,232,0.08); }

/* Dropdown */
.nav-item .dropdown { display: none; position: absolute; top: 100%; left: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 160px; padding: 6px 0; }
.nav-item:hover .dropdown { display: block; }
.dropdown a { display: block; padding: 8px 16px; font-size: 0.85rem; color: var(--text); }
.dropdown a:hover { background: var(--bg-gray); color: var(--primary); }

/* Hamburger */
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; background: none; border: none; padding: 4px; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s; }
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== Hero ===== */
.hero { background: linear-gradient(135deg, #1a73e8 0%, #4a90d9 50%, #6c5ce7 100%); color: #fff; padding: 80px 0 60px; text-align: center; }
.hero h1 { font-size: 2.5rem; color: #fff; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 600px; margin: 0 auto 24px; color: rgba(255,255,255,0.92); }
.btn { display: inline-block; padding: 12px 32px; background: var(--accent); color: #fff; border-radius: 50px; font-size: 1rem; font-weight: 600; border: none; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,107,53,0.4); color: #fff; }
.hero .btn { background: var(--accent); }

/* ===== Section Headers ===== */
.section { padding: 48px 0; }
.section-title { font-size: 1.5rem; margin-bottom: 8px; }
.section-desc { color: var(--text-secondary); margin-bottom: 24px; }

/* ===== Service Cards Grid ===== */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.service-card { background: var(--bg); border-radius: var(--radius); padding: 28px 20px; text-align: center; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.service-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.service-card .icon { font-size: 2.5rem; margin-bottom: 12px; }
.service-card .icon img { width: 48px; height: 48px; object-fit: contain; vertical-align: middle; }
.service-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.service-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 12px; }

/* ===== Article List ===== */
.article-list { display: flex; flex-direction: column; gap: 16px; }
.article-card {
  display: block;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  color: inherit;
  text-decoration: none;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.article-card h3 { font-size: 1.1rem; margin-bottom: 10px; color: var(--text); transition: color 0.2s; overflow-wrap: break-word; }
.article-card:hover h3 { color: var(--primary); }
.article-card .excerpt { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.75; overflow-wrap: break-word; }
.article-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.article-card .meta .tag { display: inline-block; padding: 2px 8px; background: rgba(26,115,232,0.06); color: var(--text-muted); border-radius: 100px; font-size: 0.75rem; }

/* ===== Sidebar ===== */
.page-layout { display: flex; gap: 28px; padding: 32px 0; }
.page-main { flex: 1; min-width: 0; }
.page-sidebar { width: 280px; flex-shrink: 0; min-width: 0; }
.sidebar-widget { background: var(--bg); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); overflow-wrap: break-word; }
.sidebar-widget h4 { font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar-widget ul li { padding: 6px 0; border-bottom: 1px solid var(--bg-gray); }
.sidebar-widget ul li a { font-size: 0.85rem; color: var(--text-secondary); overflow-wrap: break-word; }
.sidebar-widget ul li a:hover { color: var(--primary); }

/* ===== Breadcrumb ===== */
.breadcrumb { padding: 10px 0; font-size: 0.85rem; color: var(--text-muted); overflow-wrap: break-word; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-secondary); }

/* ===== Category Header ===== */
.category-header { margin-bottom: 20px; }
.category-header h1 { font-size: 1.6rem; margin-bottom: 6px; }
.category-header .desc { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 12px; }

/* Tag Filters */
.tag-filters { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 8px; margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tag-filters::-webkit-scrollbar { display: none; }
.tag-filter { padding: 6px 16px; border: 1px solid var(--border); border-radius: 100px; font-size: 0.85rem; cursor: pointer; background: var(--bg); transition: all 0.2s; white-space: nowrap; }
.tag-filter:hover,
.tag-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; }
.pagination a,
.pagination span { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius); font-size: 0.9rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ===== Article Detail ===== */
.article-detail h1 { font-size: 1.8rem; margin-bottom: 8px; }
.article-detail .article-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.article-detail .article-meta .tag { display: inline-block; padding: 2px 10px; background: rgba(26,115,232,0.08); color: var(--primary); border-radius: 100px; margin-left: 6px; }
.article-body { font-size: 0.95rem; line-height: 1.9; overflow-wrap: break-word; word-break: break-word; }
.article-body h2 { font-size: 1.3rem; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--bg-gray); overflow-wrap: break-word; }
.article-body h3 { font-size: 1.1rem; margin: 24px 0 8px; overflow-wrap: break-word; }
.article-body p { margin-bottom: 14px; overflow-wrap: break-word; }
.article-body img { border-radius: var(--radius); margin: 16px 0; max-width: 100%; height: auto; }
.article-body iframe,
.article-body video,
.article-body embed,
.article-body object { max-width: 100%; }
.article-body table { display: block; overflow-x: auto; max-width: 100%; }
.article-body pre,
.article-body code { overflow-wrap: break-word; white-space: pre-wrap; max-width: 100%; }

/* Table of Contents */
.toc { position: sticky; top: calc(var(--nav-height) + 20px); }
.toc ul { padding-left: 0; }
.toc ul li { padding: 4px 0; }
.toc ul li a { font-size: 0.82rem; color: var(--text-secondary); }
.toc ul li a:hover,
.toc ul li a.active { color: var(--primary); }
.toc ul li.toc-h3 { padding-left: 16px; }

/* Article Nav (prev/next) */
.article-nav { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.article-nav a { font-size: 0.9rem; max-width: 45%; overflow-wrap: break-word; }

/* Tip Box */
.tip-box { background: #fff8e1; border-left: 4px solid #ffc107; padding: 14px 18px; margin: 20px 0; border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.9rem; overflow-wrap: break-word; }
.tip-box .copy-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #6b7280; cursor: pointer; vertical-align: middle; margin-left: 6px; transition: all 0.2s; flex-shrink: 0; }
.tip-box .copy-btn:hover { border-color: #10b981; color: #10b981; background: #f0fdf4; }
.tip-box .copy-btn.copied { border-color: #10b981; color: #10b981; background: #d1fae5; }
.tip-box .copy-btn svg { pointer-events: none; }

/* ===== Footer ===== */
.footer { background: var(--text); color: #aaa; padding: 32px 0; margin-top: 48px; text-align: center; font-size: 0.85rem; }
.footer a { color: #ccc; }
.footer p { margin-bottom: 0; }

/* ===== About Page ===== */
.about-section { background: var(--bg); border-radius: var(--radius); padding: 40px 38px; box-shadow: var(--shadow); margin-top: 24px; }
.about-section h1 { font-size: 1.8rem; margin-bottom: 18px; }
.about-section h2 { margin: 36px 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--bg-gray); font-size: 1.25rem; }
.about-section p { color: var(--text-secondary); margin-bottom: 14px; line-height: 1.85; font-size: 0.95rem; }

/* ===== Contact Section ===== */
.contact-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}
.contact-qr {
  flex-shrink: 0;
  text-align: center;
}
.contact-qr img {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 0 auto 8px;
}
.contact-qr span {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.contact-detail {
  text-align: left;
}
.contact-line {
  font-size: 0.95rem;
  color: var(--text);
  padding: 6px 0;
  line-height: 1.8;
}
.contact-line .copyable {
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}
.contact-line .copyable:hover { color: var(--primary); }
.copy-btn {
  font-size: 0.72rem;
  color: var(--primary);
  background: rgba(26,115,232,0.08);
  padding: 3px 10px;
  border-radius: 100px;
  margin-left: 4px;
  font-weight: 500;
  transition: background 0.2s;
}
.contact-line .copyable:hover .copy-btn { background: var(--primary); color: #fff; }
.copy-btn.copied { background: #16a34a; color: #fff; }

/* ===== Footer Friend Links ===== */
.footer-friend-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.footer-friend-title {
  color: #888;
  font-size: 0.82rem;
  margin-right: 4px;
}
.footer-friend-links a {
  color: #aaa;
  font-size: 0.82rem;
  transition: color 0.2s;
}
.footer-friend-links a:hover {
  color: #fff;
}

/* ===== Mobile Menu Overlay ===== */
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; }
.nav-overlay.show { display: block; }


/* ==================== RESPONSIVE ==================== */

/* Tablet: 768px - 1199px */
@media (max-width: 1199px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .page-sidebar { width: 240px; }
  .hero h1 { font-size: 2rem; }
}

/* Small Tablet / Large Phone: 768px - 991px */
@media (max-width: 991px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .page-layout { flex-direction: column; }
  .page-sidebar { width: 100%; max-width: 100%; min-width: 0; }
  .toc { position: static; }
  .tag-filters { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 8px; }
  .tag-filters::-webkit-scrollbar { display: none; }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
  :root { --nav-height: 54px; }

  /* Hamburger visible */
  .hamburger { display: flex; }
  .nav-links { display: none; position: absolute; top: var(--nav-height); left: 0; right: 0; background: var(--bg); flex-direction: column; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: 8px 0; gap: 0; }
  .nav-links.show { display: flex; }

  .nav-item > a { padding: 12px 20px; border-radius: 0; }
  .nav-item .dropdown { display: none; position: static; box-shadow: none; border: none; padding-left: 20px; background: var(--bg-gray); }
  .nav-item.dropdown-open .dropdown { display: block; }

  /* Hero */
  .hero { padding: 48px 0 36px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.95rem; }

  /* Grids */
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .service-card { padding: 20px 12px; }
  .service-card .icon { font-size: 2rem; }

  /* Article list & cards */
  .article-card { padding: 14px 16px; width: 100%; }
  .article-card h3 { font-size: 1rem; }
  .article-card .excerpt { font-size: 0.85rem; }
  .article-detail h1 { font-size: 1.4rem; overflow-wrap: break-word; }
  .article-body { font-size: 0.9rem; }
  .article-body h2 { font-size: 1.15rem; }
  .article-body h3 { font-size: 1rem; }
  .article-nav { flex-direction: column; gap: 10px; }
  .article-nav a { max-width: 100%; }
  .article-detail .article-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

  /* Sidebar */
  .sidebar-widget { padding: 14px; }
  .sidebar-widget ul li a { font-size: 0.82rem; }

  /* Breadcrumb */
  .breadcrumb { font-size: 0.78rem; }

  /* Tag filters */
  .tag-filters { gap: 6px; }
  .tag-filter { padding: 5px 12px; font-size: 0.78rem; }

  /* Misc */
  .section { padding: 32px 0; }
  .about-section { padding: 20px; }

  /* Contact */
  .contact-card { flex-direction: column; gap: 16px; padding: 24px 18px; }
  .contact-detail { text-align: center; }
}
