/* ============================================================
   ARTICLE PAGE — common styles  (article.css)
   Covers: layout, breadcrumb, article-header, body content,
   TOC sidebar, product-recommend, prev/next, related articles,
   float-widget, responsive breakpoints.
   DO NOT duplicate any rule from main.css here.
   ============================================================ */

/* ---------- Page-level layout: main + sidebar ---------- */
.article-page-wrap {
  display: grid;
  grid-template-columns: 1fr 272px;
  gap: 44px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 28px 88px;
  align-items: start;
}

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

/* ---------- Breadcrumb (injected by article-recommend.js) ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 30px;
  padding: 10px 0;
}
.breadcrumb a {
  color: var(--text-2);
  transition: color var(--transition);
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb i { font-size: 9px; color: var(--text-3); }
.breadcrumb .bc-current { color: var(--text-2); }

/* ---------- Article header (injected by article-recommend.js) ---------- */
.article-header { margin-bottom: 38px; }

.article-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.article-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(123,63,228,0.09);
  color: var(--purple);
  border: 1px solid rgba(123,63,228,0.2);
}
.article-tag.tag-latest {
  background: rgba(255,45,91,0.09);
  color: var(--accent);
  border-color: rgba(255,45,91,0.25);
}

.article-title {
  font-size: clamp(24px, 3.5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.22;
  color: var(--text);
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
}
.article-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.article-meta i { color: var(--text-3); font-size: 12px; }

.article-summary {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-2);
  padding: 16px 20px;
  background: rgba(123,63,228,0.04);
  border-left: 3px solid var(--purple);
  border-radius: 0 var(--r) var(--r) 0;
}

/* ---------- Article body content ---------- */
.article-body {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
}

.article-body h2 {
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 52px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  scroll-margin-top: 90px;
}

.article-body h3 {
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
  scroll-margin-top: 90px;
}

.article-body p { margin-bottom: 20px; }

.article-body ul,
.article-body ol {
  padding-left: 24px;
  margin-bottom: 20px;
}
.article-body li {
  margin-bottom: 8px;
  line-height: 1.8;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
.article-body a:hover { color: var(--accent-h); }

.article-body strong { font-weight: 700; color: var(--text); }
.article-body em { font-style: italic; }

.article-body code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.87em;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--purple);
}

.article-body pre {
  background: #0F1829;
  border-radius: var(--r);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 26px 0;
  border: 1px solid rgba(255,255,255,0.06);
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: #B8D0F0;
  font-size: 13px;
  line-height: 1.75;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 26px 0;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}
.article-body th {
  background: rgba(0,0,0,0.04);
  font-weight: 700;
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  white-space: nowrap;
}
.article-body td {
  padding: 9px 14px;
  border: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}
.article-body tr:nth-child(even) td { background: rgba(0,0,0,0.02); }

/* Callout boxes */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r);
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.75;
}
.callout-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}
.callout-tip {
  background: rgba(0,168,107,0.07);
  border: 1px solid rgba(0,168,107,0.2);
  color: var(--text-2);
}
.callout-tip .callout-icon { color: var(--green); }
.callout-warn {
  background: rgba(212,152,0,0.07);
  border: 1px solid rgba(212,152,0,0.22);
  color: var(--text-2);
}
.callout-warn .callout-icon { color: var(--yellow); }
.callout-info {
  background: rgba(0,153,204,0.07);
  border: 1px solid rgba(0,153,204,0.22);
  color: var(--text-2);
}
.callout-info .callout-icon { color: var(--cyan); }

/* ---------- Sidebar TOC ---------- */
.article-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
}
.toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.05);
}
.toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-list a {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  padding: 5px 10px;
  border-radius: 7px;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.5;
  text-decoration: none;
}
.toc-list a:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text);
  border-left-color: var(--border-h);
}
.toc-list a.toc-active {
  background: rgba(255,45,91,0.07);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- Product recommend (injected by article-recommend.js) ---------- */
.product-recommend {
  margin-top: 64px;
  padding: 36px 40px;
  background: linear-gradient(135deg,
    rgba(123,63,228,0.06) 0%,
    rgba(255,255,255,0.95) 50%,
    rgba(255,45,91,0.05) 100%);
  border: 1px solid rgba(123,63,228,0.15);
  border-radius: var(--r-xl);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.product-recommend::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(123,63,228,0.09) 0%, transparent 70%);
  pointer-events: none;
}
.pr-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255,45,91,0.08);
  border: 1px solid rgba(255,45,91,0.2);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 14px;
}
.pr-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 8px;
}
.pr-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 20px;
  max-width: 520px;
}
.pr-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 26px;
  padding: 0;
}
.pr-features li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text);
  margin: 0;
}
.pr-features li i {
  width: 18px; height: 18px;
  border-radius: 5px;
  background: rgba(0,168,107,0.12);
  color: var(--green);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pr-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 0 24px rgba(255,45,91,0.35);
}
.pr-cta:hover {
  background: var(--accent-h);
  box-shadow: 0 0 40px rgba(255,45,91,0.55);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

/* ---------- Prev / Next navigation (injected by article-recommend.js) ---------- */
.article-nav-prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
}
.nav-pn-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  text-decoration: none;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.nav-pn-item:hover {
  border-color: rgba(123,63,228,0.28);
  box-shadow: 0 8px 28px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  text-decoration: none;
}
.nav-pn-dir {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav-pn-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.nav-pn-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.nav-pn-tag {
  font-size: 11px;
  color: var(--purple);
  background: rgba(123,63,228,0.08);
  border: 1px solid rgba(123,63,228,0.15);
  padding: 2px 8px;
  border-radius: 100px;
}
.nav-pn-item.nav-pn-next { text-align: right; }
.nav-pn-item.nav-pn-next .nav-pn-tags { justify-content: flex-end; }
.nav-pn-item.nav-pn-next .nav-pn-dir { justify-content: flex-end; }

/* ---------- Related articles (injected by article-recommend.js) ---------- */
.article-related {
  margin-top: 44px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.related-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.related-title i { color: var(--purple); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  text-decoration: none;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.related-card:hover {
  border-color: var(--border-h);
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  text-decoration: none;
}
.related-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.related-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.related-card-tag {
  font-size: 10.5px;
  color: var(--text-3);
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.07);
  padding: 2px 7px;
  border-radius: 100px;
}

/* ---------- Floating widget (injected by article-recommend.js) ---------- */
.float-widget {
  position: fixed;
  right: 28px;
  bottom: 80px;
  width: 284px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--r-xl);
  padding: 22px 22px 18px;
  box-shadow: 0 16px 56px rgba(0,0,0,0.18);
  z-index: 900;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.float-widget.visible { transform: translateX(0); }
.fw-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition);
  background: none;
  border: none;
}
.fw-close:hover { background: rgba(0,0,0,0.07); color: var(--text); }
.fw-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
}
.fw-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.35;
}
.fw-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 14px;
}
.fw-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 0 18px rgba(255,45,91,0.3);
}
.fw-btn:hover {
  background: var(--accent-h);
  box-shadow: 0 0 28px rgba(255,45,91,0.5);
  text-decoration: none;
  color: #fff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .article-page-wrap {
    grid-template-columns: 1fr 240px;
    gap: 30px;
  }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .article-page-wrap {
    grid-template-columns: 1fr;
    padding: 84px 18px 64px;
    gap: 0;
  }
  .article-sidebar {
    position: static;
    max-height: none;
    order: -1;
    margin-bottom: 24px;
  }
  .toc-card { border-radius: var(--r); }
  .float-widget {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(calc(100% + 10px));
    padding: 16px 18px 20px;
  }
  .float-widget.visible { transform: translateY(0); }
  .product-recommend { padding: 26px 24px; }
  .article-nav-prev-next { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .article-page-wrap { padding: 76px 14px 52px; }
  .product-recommend { padding: 20px 16px; }
  .pr-cta { width: 100%; justify-content: center; }
  .article-body h2 { margin-top: 36px; }
}
