/* ================================================================
   shell.css — public site shell (top bar / left sidebar / views)
   Warm editorial system: 暖白底 · 近黑主色 · 衬线标题 · 细线分隔
   Loaded after styles.css + recharge.css.
   ================================================================ */

:root {
  --shell-bg: #FAFAF8;
  --shell-surface: #FFFFFF;
  --shell-surface-alt: #F4F3F0;
  --shell-ink: #1A1A1A;
  --shell-muted: #6B6B6B;
  --shell-faint: #6E6E6E;
  --shell-hairline: #E6E3DD;
  --shell-accent: #9B8B6E;
  --shell-accent-strong: #6E5F45;
  --shell-band: #141414;
  --shell-danger: #B4553F;
  --shell-topbar-h: 60px;
  --shell-sidebar-w: 224px;
  --shell-radius: 2px;
  --shell-font-display: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "PMingLiU", Georgia, "Times New Roman", serif;
  --shell-font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --shell-transition: 280ms ease;
}

.shell-body {
  background: var(--shell-bg);
  color: var(--shell-ink);
}

/* ── Top bar ─────────────────────────────────────────────── */
.shell-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--shell-topbar-h);
  background: rgba(250, 250, 248, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--shell-hairline);
}

.shell-topbar-inner {
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--shell-ink);
}

.shell-brand img {
  width: 30px;
  height: 30px;
  border-radius: var(--shell-radius);
}

.shell-brand-name {
  font-family: var(--shell-font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.shell-brand-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--shell-accent-strong);
  background: var(--shell-surface-alt);
  border: 1px solid var(--shell-hairline);
  border-radius: var(--shell-radius);
  white-space: nowrap;
}

.shell-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-btn {
  height: 34px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--shell-font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--shell-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--shell-transition), color var(--shell-transition), border-color var(--shell-transition);
  white-space: nowrap;
}

.shell-btn-primary {
  color: #FFFFFF;
  background: var(--shell-ink);
  border-color: var(--shell-ink);
}

.shell-btn-primary:hover {
  background: #333333;
  border-color: #333333;
}

.shell-btn-outline {
  color: var(--shell-ink);
  background: transparent;
  border-color: var(--shell-hairline);
}

.shell-btn-outline:hover {
  border-color: var(--shell-ink);
}

.shell-btn-ghost {
  color: var(--shell-danger);
  background: transparent;
  border-color: transparent;
}

.shell-btn-ghost:hover {
  border-color: var(--shell-danger);
}

/* ── Layout ──────────────────────────────────────────────── */
.shell-layout {
  min-height: 100vh;
}

.shell-sidebar {
  position: fixed;
  top: var(--shell-topbar-h);
  bottom: 0;
  left: 0;
  z-index: 900;
  width: var(--shell-sidebar-w);
  padding: 28px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  background: var(--shell-bg);
  border-right: 1px solid var(--shell-hairline);
}

.shell-sidebar-label {
  padding: 0 12px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--shell-faint);
}

.shell-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--shell-muted);
  border-radius: var(--shell-radius);
  transition: background-color var(--shell-transition), color var(--shell-transition);
}

.shell-nav-link svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.8;
}

.shell-nav-link:hover {
  color: var(--shell-ink);
  background: var(--shell-surface-alt);
}

.shell-nav-link.is-active {
  color: var(--shell-ink);
  font-weight: 600;
  background: var(--shell-surface-alt);
}

.shell-nav-link.is-active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  background: var(--shell-accent);
}

.shell-main {
  margin-left: var(--shell-sidebar-w);
  padding: calc(var(--shell-topbar-h) + 36px) 40px 72px;
  min-height: 100vh;
  max-width: 1180px;
}

.shell-view[hidden] {
  display: none !important;
}

.shell-view {
  animation: shell-view-in 240ms ease both;
}

@keyframes shell-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── View headers ────────────────────────────────────────── */
.view-head {
  margin-bottom: 28px;
}

.view-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--shell-accent-strong);
  margin-bottom: 10px;
}

.view-title {
  font-family: var(--shell-font-display);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--shell-ink);
}

.view-desc {
  margin-top: 8px;
  max-width: 620px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--shell-muted);
}

/* ── Docs ────────────────────────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.docs-list {
  position: sticky;
  top: calc(var(--shell-topbar-h) + 28px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-hairline);
  border-radius: var(--shell-radius);
}

.docs-list-item {
  display: block;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--shell-muted);
  border-radius: var(--shell-radius);
  transition: background-color var(--shell-transition), color var(--shell-transition);
}

.docs-list-item:hover {
  color: var(--shell-ink);
  background: var(--shell-surface-alt);
}

.docs-list-item.is-active {
  color: var(--shell-ink);
  font-weight: 600;
  background: var(--shell-surface-alt);
}

.docs-list-status {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--shell-faint);
}

.docs-article {
  min-height: 320px;
  padding: 40px 44px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-hairline);
  border-radius: var(--shell-radius);
}

/* ── Announcements ───────────────────────────────────────── */
.announcement-card {
  max-width: 820px;
  padding: 32px 36px 36px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-hairline);
  border-left: 3px solid var(--shell-accent);
  border-radius: var(--shell-radius);
}

.announcement-date {
  margin-bottom: 18px;
  padding-bottom: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--shell-accent-strong);
  border-bottom: 1px solid var(--shell-hairline);
}

.announcement-date:empty {
  display: none;
}

/* ── Markdown typography ─────────────────────────────────── */
.markdown-body {
  font-family: var(--shell-font-body);
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--shell-ink);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-family: var(--shell-font-display);
  font-weight: 700;
  line-height: 1.35;
  color: var(--shell-ink);
  margin: 1.7em 0 0.7em;
}

.markdown-body h1 { font-size: 27px; letter-spacing: -0.01em; }
.markdown-body h2 {
  font-size: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--shell-hairline);
}
.markdown-body h3 { font-size: 18px; }
.markdown-body h4 { font-size: 16px; }

.markdown-body p {
  margin: 0 0 1.05em;
}

.markdown-body a {
  color: var(--shell-accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-body a:hover {
  color: var(--shell-ink);
}

.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }

.markdown-body ul,
.markdown-body ol {
  list-style: revert;
  margin: 0 0 1.05em;
  padding-left: 1.6em;
}

.markdown-body li {
  margin: 0.35em 0;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin-bottom: 0.3em;
}

.markdown-body blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 18px;
  color: var(--shell-muted);
  border-left: 2px solid var(--shell-accent);
}

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

.markdown-body code {
  padding: 2px 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  color: var(--shell-ink);
  background: var(--shell-surface-alt);
  border: 1px solid var(--shell-hairline);
  border-radius: var(--shell-radius);
}

.markdown-body pre {
  margin: 1.2em 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: #F7F6F3;
  border: 1px solid var(--shell-hairline);
  border-radius: var(--shell-radius);
  line-height: 1.7;
}

.markdown-body pre code {
  padding: 0;
  font-size: 13px;
  background: transparent;
  border: 0;
  white-space: pre;
}

.markdown-body hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--shell-hairline);
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--shell-radius);
}

.markdown-body table {
  width: 100%;
  margin: 1.2em 0;
  border-collapse: collapse;
  font-size: 14px;
}

.markdown-body th,
.markdown-body td {
  padding: 9px 12px;
  text-align: left;
  border: 1px solid var(--shell-hairline);
}

.markdown-body th {
  font-weight: 600;
  background: var(--shell-surface-alt);
}

.markdown-body input[type="checkbox"] {
  margin-right: 6px;
}

/* ── Footer offset (styles.css owns the dark footer skin) ── */
.shell-footer {
  margin-left: var(--shell-sidebar-w);
}

.shell-footer .logo {
  color: #FFFFFF;
  margin-bottom: 0;
}

.shell-footer .logo:hover {
  color: #FFFFFF;
}

.shell-footer .footer-tagline {
  margin-top: 16px;
  max-width: 260px;
  font-size: 13px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.6);
}

.shell-footer .footer-contact-block p {
  margin-bottom: 10px;
  font-size: 13.5px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.62);
}

.shell-footer .footer-contact-block a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.shell-footer .footer-contact-block a:hover {
  color: #FFFFFF;
}

/* ── Focus ───────────────────────────────────────────────── */
.shell-topbar :focus-visible,
.shell-sidebar :focus-visible,
.shell-main :focus-visible,
.shell-footer :focus-visible {
  outline: 2px solid var(--shell-accent);
  outline-offset: 2px;
}

/* ── Responsive: sidebar becomes a top segmented nav ─────── */
@media (max-width: 767.98px) {
  .shell-topbar-inner {
    padding: 0 16px;
    gap: 10px;
  }

  .shell-brand-name {
    font-size: 17px;
  }

  .shell-brand-badge {
    display: none;
  }

  .shell-actions {
    gap: 6px;
  }

  .shell-btn {
    padding: 0 11px;
    font-size: 12.5px;
  }

  .shell-layout {
    padding-top: var(--shell-topbar-h);
  }

  .shell-sidebar {
    position: sticky;
    top: var(--shell-topbar-h);
    bottom: auto;
    width: auto;
    padding: 8px 12px;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--shell-hairline);
  }

  .shell-sidebar-label {
    display: none;
  }

  .shell-nav-link {
    flex: 1;
    justify-content: center;
    padding: 9px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .shell-nav-link.is-active::before {
    top: auto;
    bottom: 0;
    left: 8px;
    right: 8px;
    width: auto;
    height: 2px;
  }

  .shell-main {
    margin-left: 0;
    padding: 28px 16px 56px;
  }

  .shell-footer {
    margin-left: 0;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .docs-list {
    position: static;
  }

  .docs-article {
    padding: 26px 20px;
  }

  .announcement-card {
    padding: 24px 20px 28px;
  }

  .view-title {
    font-size: 25px;
  }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .shell-view {
    animation: none;
  }

  .shell-btn,
  .shell-nav-link,
  .docs-list-item {
    transition: none;
  }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .shell-topbar,
  .shell-sidebar,
  .modal-overlay {
    display: none !important;
  }

  .shell-main,
  .shell-footer {
    margin-left: 0;
    padding-top: 0;
  }
}
