/* ===== Variables ===== */
:root {
  --bg: #0b1020;
  --surface: #111831;
  --surface-2: #162040;
  --text: #e8eef8;
  --text-muted: #94a3b8;
  --accent: #00d4ff;
  --accent-2: #7c3aed;
  --border: rgba(148, 163, 184, 0.15);
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --max-width: 1200px;
  --header-h: 64px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

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

a:hover {
  text-decoration: underline;
}

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

.container {
  width: min(92%, var(--max-width));
  margin-inline: auto;
}

.container.narrow {
  max-width: 760px;
}

.container.with-toc {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  align-items: start;
  padding-block: 40px;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 16, 32, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13px;
  letter-spacing: 1px;
}

.logo-text {
  font-size: 18px;
}

.main-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

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

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  margin-inline: auto;
}

/* ===== Hero ===== */
.hero {
  padding-block: 100px 80px;
  background: radial-gradient(ellipse at 20% 20%, rgba(0, 212, 255, 0.08), transparent 40%),
              radial-gradient(ellipse at 80% 0%, rgba(124, 58, 237, 0.08), transparent 40%);
}

.hero-content {
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  margin: 0 0 24px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.25);
}

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

/* ===== Sections ===== */
.section {
  padding-block: 72px;
}

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

.section h1,
.section h2 {
  margin-top: 0;
}

.section h2 {
  font-size: 28px;
  margin-bottom: 32px;
}

.lead {
  color: var(--text-muted);
  font-size: 17px;
  margin-top: -16px;
  margin-bottom: 32px;
}

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 212, 255, 0.35);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.card h3 a {
  color: var(--text);
}

.card p {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}

/* ===== Priority grid ===== */
.priority-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.priority-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.priority-item .num {
  display: inline-block;
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 8px;
}

.priority-item h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.priority-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Lists ===== */
.article-list.compact .list-item {
  margin-bottom: 20px;
}

.list-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.list-item h2,
.list-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.list-item h2 a,
.list-item h3 a {
  color: var(--text);
}

.list-item p {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.list-item .meta {
  font-size: 13px;
  color: var(--text-muted);
}

.more-link {
  margin-top: 24px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-muted);
}

.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ===== Category page layout ===== */
.cat-side {
  margin-bottom: 32px;
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-list a {
  display: block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 14px;
}

.category-list a.active,
.category-list a:hover {
  background: var(--accent);
  color: #0b1020;
  border-color: var(--accent);
  text-decoration: none;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  padding-block: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.breadcrumb .sep {
  color: var(--text-muted);
}

/* ===== Article / Product content ===== */
.article-content {
  max-width: 760px;
}

.article-content h1 {
  font-size: clamp(26px, 4vw, 38px);
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.prose {
  font-size: 16px;
  color: #d1d9e8;
}

.prose h2 {
  font-size: 24px;
  color: var(--text);
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 19px;
  margin-top: 28px;
  margin-bottom: 12px;
}

.prose p {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 8px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.prose th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.prose blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--text-muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose time {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ===== TOC ===== */
.toc-aside {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.toc-aside h2 {
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.toc-aside ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-aside li {
  margin-bottom: 8px;
}

.toc-aside a {
  color: var(--text-muted);
  font-size: 14px;
}

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

/* ===== Related products ===== */
.related-products {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.related-products ul {
  list-style: none;
  padding: 0;
}

.related-products li {
  margin-bottom: 10px;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 48px 24px;
  margin-top: 40px;
}

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

.footer-brand p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 8px 0 0;
}

.footer-note {
  font-size: 13px !important;
}

.footer-links h3,
.footer-legal h3 {
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--text);
}

.footer-links ul,
.footer-legal ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li,
.footer-legal p {
  margin-bottom: 8px;
  font-size: 14px;
}

.footer-legal a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.footer-legal img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.footer-bottom {
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Floating capsules ===== */
.float-capsules {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 200;
}

.capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.capsule:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.capsule-icon {
  font-size: 15px;
  line-height: 1;
}

#backTopCapsule {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#backTopCapsule.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: var(--shadow);
}

.modal-card img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(638px, 90vw);
  max-height: min(1016px, 90vh);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

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

  .toc-aside {
    display: none;
  }

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

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
    justify-content: center;
  }

  .nav-menu {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 0;
    display: none;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-menu li {
    border-bottom: 1px solid var(--border);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-menu a {
    display: block;
    padding: 12px 0;
  }

  .hero {
    padding-block: 64px 48px;
  }

  .section {
    padding-block: 48px;
  }

  .card-grid,
  .priority-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .float-capsules {
    right: 12px;
    top: auto;
    bottom: 80px;
    transform: none;
    flex-direction: column;
    gap: 8px;
  }

  .capsule {
    padding: 8px 14px;
    font-size: 13px;
  }
}
