/* MT5 延迟优化指南 — 浅色阅读主题 */

:root {
  --bg: #f6f8fc;
  --bg-elevated: #ffffff;
  --surface: #eef3f9;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --accent: #1d6fdc;
  --accent-hover: #1558b8;
  --accent-soft: rgba(29, 111, 220, 0.1);
  --warn: #b45309;
  --radius: 12px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "Fira Code", "Consolas", monospace;
  --max: 46rem;
  --toc-width: 14.5rem;
  --line: 1.8;
  --header-offset: 5.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: var(--line);
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
a:hover {
  color: var(--accent-hover);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
  border-radius: 6px;
  text-decoration: none;
}
.skip:focus {
  left: 0.5rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
  color: var(--accent);
}
.brand span {
  color: var(--accent);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-left: auto;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff !important;
  text-decoration: none !important;
  background: var(--accent);
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(29, 111, 220, 0.25);
}
.nav-cta:hover {
  background: var(--accent-hover);
  color: #fff !important;
}

.nav-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
}
.nav-toc a {
  color: var(--text-muted);
  text-decoration: none;
}
.nav-toc a:hover {
  color: var(--accent);
}

.article-shell {
  max-width: calc(var(--toc-width) + 2.5rem + var(--max));
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.hero {
  padding: 2.5rem 0 1.5rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.article-meta__name,
.article-meta__date {
  color: var(--text-body);
  font-weight: 500;
}
.article-meta__sep {
  color: var(--border);
  user-select: none;
}

.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0;
}

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

/* 左侧粘性目录 */
.article-toc {
  margin: 0 0 2rem;
}

.article-toc__card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.05rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.article-toc__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.article-toc__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.article-toc__icon svg {
  width: 1rem;
  height: 1rem;
}

.article-toc__label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.article-toc__title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.article-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-body);
}

.article-toc__list li + li {
  margin-top: 0.15rem;
}

.article-toc__list a {
  display: block;
  padding: 0.4rem 0.45rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-left: 2px solid transparent;
}

.article-toc__list a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.article-toc__list a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.article-body > section {
  margin-top: 2.75rem;
  padding-top: 0.5rem;
}

.article-body > section:first-child {
  margin-top: 0;
  padding-top: 0;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  scroll-margin-top: var(--header-offset);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.65rem;
  color: var(--text);
}

p {
  margin: 0 0 1rem;
  color: var(--text-body);
}

p strong,
li strong {
  color: var(--text);
  font-weight: 600;
}

ul {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--text-body);
}

li {
  margin-bottom: 0.5rem;
}

.callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  border-left: 3px solid var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

.term {
  color: var(--text-body);
  font-size: 0.92em;
}

.term::after {
  content: " / " attr(data-en);
  font-size: 0.85em;
  color: var(--text-muted);
  font-style: normal;
  font-weight: 400;
}

code.inline {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface);
  color: #0f172a;
  padding: 0.12em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.sub-block {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  border: 1px solid rgba(29, 111, 220, 0.2);
}

.sub-block h3:first-child {
  margin-top: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.site-footer p {
  margin: 0;
  color: var(--text-muted);
}

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  color: var(--accent);
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease,
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.back-to-top svg {
  width: 1.15rem;
  height: 1.15rem;
}

@media (min-width: 640px) {
  .article-body > section {
    margin-top: 3rem;
  }

  .article-body > section:first-child {
    margin-top: 0;
  }
}

@media (min-width: 1024px) {
  .article-shell {
    display: grid;
    grid-template-columns: var(--toc-width) minmax(0, var(--max));
    column-gap: 2.5rem;
    align-items: start;
  }

  .hero {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-top: 2rem;
  }

  .article-toc {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    position: sticky;
    top: var(--header-offset);
    align-self: start;
    max-height: calc(100vh - var(--header-offset) - 1.25rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: 0;
    scrollbar-width: thin;
  }

  .article-toc__head {
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
  }

  .article-toc__title {
    font-size: 0.92rem;
  }

  .article-body {
    grid-column: 2;
    grid-row: 2;
    padding-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .nav-toc {
    display: none;
  }
}

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

  .back-to-top {
    transition: none;
  }
}
