/* ============================================================
   Shule Core Docs — Design System
   Powered by Sino Soft
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  /* Brand */
  --sc-indigo: #1B2E7A;
  --sc-indigo-600: #24399A;
  --sc-teal: #0FB8A6;
  --sc-teal-600: #0DA394;
  --sc-amber: #F5A623;
  --sc-ink: #101828;
  --sc-slate: #5B6472;
  --sc-cloud: #F4F6FB;

  /* Light theme surface tokens */
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #F6F7FB;
  --bg-sidebar: #FBFBFE;
  --bg-code: #F1F3F9;
  --border: #E6E8F0;
  --border-strong: #D6DAE6;
  --text: #16192A;
  --text-muted: #5B6472;
  --text-faint: #8A93A6;
  --link: #1B2E7A;
  --link-hover: #0FB8A6;
  --accent: #0FB8A6;
  --accent-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 45px rgba(16, 24, 40, 0.14);
  --header-h: 72px;
  --sidebar-w: 288px;
  --toc-w: 232px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --gradient-brand: linear-gradient(135deg, var(--sc-indigo) 0%, var(--sc-teal) 100%);
}

html[data-theme="dark"] {
  --bg: #0B1220;
  --bg-elevated: #111A2E;
  --bg-subtle: #0E1626;
  --bg-sidebar: #0C1424;
  --bg-code: #0F1B30;
  --border: #202B44;
  --border-strong: #2B3856;
  --text: #EAEFFB;
  --text-muted: #9AA6C3;
  --text-faint: #6E7A98;
  --link: #7DD9CC;
  --link-hover: #F5A623;
  --accent: #16CDB8;
  --accent-ink: #06231F;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body { overflow-x: hidden; }
img, video, iframe { max-width: 100%; height: auto; }

body {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

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

img { max-width: 100%; }

::selection { background: var(--sc-teal); color: white; }

/* ---------------- Skip link ---------------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: var(--sc-indigo); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------- Top Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}
.header-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: var(--text);
  white-space: nowrap;
}
.header-brand img { height: 32px; width: 32px; display: block; flex-shrink: 0; }
.header-brand .brand-icon-link { display: flex; }
.header-brand .brand-text-stack { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.header-brand .brand-name-full { color: var(--text); font-weight: 700; font-size: 18px; text-decoration: none; }
.header-brand .brand-name-full .core { color: var(--sc-teal); }
.header-brand .brand-powered {
  font-size: 10px; font-weight: 500; color: var(--text-faint);
  letter-spacing: .015em; margin-top: 1px; text-decoration: none;
}
.header-brand .brand-powered:hover { color: var(--sc-teal); text-decoration: underline; }
html[data-theme="dark"] .header-brand .brand-name-full .core { color: var(--accent); }
html[data-theme="dark"] .header-brand .brand-powered:hover { color: var(--accent); }

.header-nav {
  display: flex; align-items: center; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
  flex: 1;
}
.header-nav::-webkit-scrollbar { display: none; }
.header-nav a {
  color: var(--text-muted); font-size: 14.5px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; white-space: nowrap;
}
.header-nav a:hover { color: var(--text); background: var(--bg-subtle); }
.header-nav a.active { color: var(--sc-indigo); background: rgba(15,184,166,0.12); }
html[data-theme="dark"] .header-nav a.active { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  color: var(--text-faint); padding: 8px 12px; border-radius: 10px;
  font-size: 14px; cursor: pointer; min-width: 180px;
}
.search-trigger kbd {
  margin-left: auto; font-size: 11px; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px;
  color: var(--text-faint); font-family: inherit;
}

.theme-toggle, .menu-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
}
.theme-toggle:hover, .menu-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.menu-toggle { display: none; }
.theme-toggle svg.sun { display: none; }
html[data-theme="dark"] .theme-toggle svg.moon { display: none; }
html[data-theme="dark"] .theme-toggle svg.sun { display: block; }

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1500px;
  margin: 0 auto;
}
.layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }

/* ---------------- Sidebar ---------------- */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  padding: 20px 14px 60px;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.sidebar-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); padding: 12px 10px 8px;
}
.nav-tree { list-style: none; margin: 0; padding: 0; }
.nav-tree li { margin: 1px 0; }

.nav-link, .nav-cat-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; background: none; border: none;
  font-family: inherit; font-size: 14.5px; color: var(--text-muted);
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  line-height: 1.4;
}
.nav-link:hover, .nav-cat-toggle:hover { background: var(--bg-subtle); color: var(--text); }
.nav-link.active {
  background: rgba(15,184,166,0.13); color: var(--sc-indigo); font-weight: 600;
}
html[data-theme="dark"] .nav-link.active { color: var(--accent); background: rgba(22,205,184,0.14); }

.nav-cat-toggle { justify-content: space-between; font-weight: 600; color: var(--text); }
.nav-cat-toggle .chev { transition: transform .18s ease; color: var(--text-faint); flex-shrink: 0; }
.nav-cat-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-children {
  list-style: none; margin: 2px 0 6px 8px; padding-left: 12px;
  border-left: 1px solid var(--border);
  display: none;
}
.nav-children.open { display: block; }
.nav-children .nav-children { margin-left: 4px; }

.nav-top-link {
  display: block; padding: 7px 10px; border-radius: 8px;
  font-size: 14.5px; font-weight: 600; color: var(--text); margin: 1px 0;
}
.nav-top-link:hover { background: var(--bg-subtle); }
.nav-top-link.active { background: rgba(15,184,166,0.13); color: var(--sc-indigo); }
html[data-theme="dark"] .nav-top-link.active { color: var(--accent); }

/* ---------------- Main content ---------------- */
.content-col { min-width: 0; padding: 0; overflow-x: hidden; }
.content-inner { max-width: 780px; margin: 0 auto; padding: 40px 32px 100px; }

.breadcrumbs { font-size: 13px; color: var(--text-faint); margin-bottom: 14px; display:flex; gap:6px; flex-wrap:wrap;}
.breadcrumbs a { color: var(--text-faint); }
.breadcrumbs a:hover { color: var(--sc-teal); }

.page-title { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 20px; color: var(--text); }

.doc-body { font-size: 16px; color: var(--text); }
.doc-body h2 {
  font-size: 22px; font-weight: 700; margin: 40px 0 14px; padding-top: 6px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.doc-body h3 {
  font-size: 18px; font-weight: 600; margin: 28px 0 10px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.doc-body p { margin: 0 0 16px; color: var(--text); }
.doc-body strong { color: var(--text); font-weight: 600; }
.doc-body ul, .doc-body ol { margin: 0 0 16px; padding-left: 22px; }
.doc-body li { margin: 6px 0; }
.doc-body hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.doc-body a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.doc-body a:hover { text-decoration-color: var(--sc-teal); }
.doc-body code {
  background: var(--bg-code); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-size: 0.9em;
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
}
.doc-body table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.5px; }
.doc-body th, .doc-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.doc-body th { background: var(--bg-subtle); font-weight: 600; }

.doc-img, .doc-video {
  display: block; width: 100%; height: auto; max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  margin: 8px 0 22px; background: var(--bg-subtle);
}

.callout {
  border: 1px solid var(--border); border-left: 4px solid var(--sc-teal);
  background: var(--bg-subtle); border-radius: 10px; padding: 14px 16px; margin: 0 0 20px;
  font-size: 14.5px; color: var(--text-muted);
}

/* Prev/next footer nav */
.page-pager {
  display: flex; justify-content: space-between; gap: 16px; margin-top: 56px;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.pager-link {
  display: flex; flex-direction: column; gap: 4px; max-width: 46%;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: border-color .15s ease, transform .15s ease;
}
.pager-link:hover { border-color: var(--sc-teal); transform: translateY(-1px); }
.pager-link.next { margin-left: auto; text-align: right; align-items: flex-end; }
.pager-label { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.pager-title { font-size: 15px; font-weight: 600; color: var(--text); }

.edit-this-page {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-faint); margin-top: 36px;
}

/* ---------------- TOC (on this page) ---------------- */
.toc-col {
  padding: 40px 20px;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.toc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: 10px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc-list li { margin: 0; }
.toc-list a {
  display: block; padding: 5px 0 5px 14px; font-size: 13.5px; color: var(--text-faint);
  border-left: 2px solid transparent; margin-left: -2px;
}
.toc-list a:hover { color: var(--text); }
.toc-list a.active { color: var(--sc-teal); border-left-color: var(--sc-teal); font-weight: 600; }
.toc-list .toc-h3 a { padding-left: 26px; font-size: 13px; }

/* ---------------- Landing / hero page ---------------- */
.hero {
  background: var(--gradient-brand);
  color: #fff;
  padding: 72px 32px 90px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 85% 0%, rgba(255,255,255,0.18), transparent 60%);
}
.hero-inner { max-width: 780px; margin: 0 auto; position: relative; }
.hero-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .85; margin-bottom: 14px; }
.hero h1 { font-size: 42px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 16px; }
.hero p.lead { font-size: 17px; max-width: 560px; opacity: .92; margin: 0 0 28px; }
.hero-search {
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 12px; padding: 12px 16px;
  max-width: 460px; cursor: pointer; backdrop-filter: blur(6px);
}
.hero-search span { opacity: .85; font-size: 14.5px; }

.quick-grid {
  max-width: 780px; margin: -40px auto 0; padding: 0 32px 60px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
  position: relative; z-index: 2;
}
.quick-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-md); transition: transform .15s ease, border-color .15s ease;
}
.quick-card:hover { transform: translateY(-2px); border-color: var(--sc-teal); }
.quick-card .qc-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: rgba(15,184,166,0.12); color: var(--sc-teal); margin-bottom: 12px;
}
.quick-card h3 { font-size: 16px; margin: 0 0 6px; color: var(--text); }
.quick-card p { font-size: 13.5px; color: var(--text-muted); margin: 0; }

.section-heading { max-width: 780px; margin: 0 auto; padding: 0 32px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }

.placeholder-box {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 40px 28px; text-align: center; color: var(--text-muted); margin-top: 24px;
}
.placeholder-box .pb-icon { font-size: 30px; margin-bottom: 10px; }

/* ---------------- Search modal ---------------- */
.search-overlay {
  position: fixed; inset: 0; background: rgba(10,14,25,0.5); backdrop-filter: blur(2px);
  z-index: 200; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 0;
}
.search-overlay.open { display: flex; }
.search-modal {
  width: 100%; max-width: 600px; background: var(--bg-elevated); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden;
}
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.search-input-row input {
  flex: 1; border: none; outline: none; background: transparent; font-size: 16px;
  font-family: inherit; color: var(--text);
}
.search-input-row .esc-hint { font-size: 11px; color: var(--text-faint); border: 1px solid var(--border); padding: 2px 6px; border-radius: 5px; }
.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-result {
  display: block; padding: 10px 12px; border-radius: 10px; margin-bottom: 2px;
}
.search-result:hover, .search-result.active { background: var(--bg-subtle); }
.search-result .sr-cat { font-size: 11.5px; color: var(--sc-teal); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.search-result .sr-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin: 2px 0; }
.search-result .sr-excerpt { font-size: 13px; color: var(--text-muted); }
.search-empty { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }
mark { background: rgba(245,166,35,0.35); color: inherit; border-radius: 3px; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border); padding: 28px 32px; text-align: center;
  color: var(--text-faint); font-size: 13px;
}
.site-footer .fbrand { color: var(--text-muted); font-weight: 600; }
.site-footer .footer-link { color: var(--text-faint); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.site-footer .footer-link:hover { color: var(--sc-teal); }
html[data-theme="dark"] .site-footer .footer-link:hover { color: var(--accent); }

/* ---------------- Mobile ---------------- */
.sidebar-backdrop { display:none; position: fixed; inset: 0; background: rgba(10,14,25,0.45); z-index: 45; }
.sidebar-backdrop.open { display: block; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0,1fr); }
  .toc-col { display: none; }
}

@media (max-width: 880px) {
  .header-nav { display: none; }
  .menu-toggle { display: flex; }
  .header-brand .brand-powered { display: none; }
  .content-col {
    min-width: 100vw;
    max-width: 100vw;
    padding: 0;
    overflow-x: hidden;
  }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); width: 84vw; max-width: 320px;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .content-inner { padding: 28px 20px 80px; }
  .hero { padding: 48px 20px 70px; }
  .hero h1 { font-size: 30px; }
  .quick-grid { grid-template-columns: 1fr; padding: 0 20px 40px; }
  .search-trigger { min-width: 0; }
  .search-trigger .st-label { display: none; }
}
