/* ============================================================
   Coreshift Wiki — shared design system
   Mirrors the navy/teal language of the project boards + ops playbook.
   Used by: wiki home (/index.html) and every /wiki/<section>/ article.
   ============================================================ */

:root {
  --navy: #0F1E3D;
  --navy-deep: #081530;
  --navy-soft: #1A2A4F;
  --navy-line: #24365C;

  --teal: #14B8A6;
  --teal-dark: #0D9488;
  --teal-light: #CCFBF1;

  --amber: #F59E0B;
  --red: #DC2626;

  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-muted: #475569;
  --text-soft: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --code-bg: #0F1E3D;
  --code-inline-bg: #EEF2F8;
  --code-inline-fg: #0D9488;

  --sidebar-w: 270px;
  --toc-w: 220px;
  --content-max: 800px;

  /* Status pill palette (shared with boards) */
  --pill-prod-bg: #ECFEFF;   --pill-prod-fg: #0D9488;   --pill-prod-ring: #5EEAD4;
  --pill-internal-bg: #EFF3FB; --pill-internal-fg: #1E3A8A; --pill-internal-ring: #C7D2FE;
  --pill-build-bg: #FEF3C7;  --pill-build-fg: #92400E;  --pill-build-ring: #FDE68A;
  --pill-program-bg: #F5F3FF; --pill-program-fg: #6D28D9; --pill-program-ring: #DDD6FE;
  --pill-planning-bg: #F1F5F9; --pill-planning-fg: #475569; --pill-planning-ring: #CBD5E1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); }

/* ── Top header bar (shared) ─────────────────────────────── */
.wiki-head {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid var(--navy-deep);
  position: sticky;
  top: 0;
  z-index: 40;
}
.wiki-head-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--teal);
  color: var(--navy);
  font-size: 18px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub {
  font-size: 10.5px; color: var(--teal);
  text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px;
}
.head-meta {
  margin-left: auto; font-size: 12px; color: #8EA5C8;
  display: flex; gap: 16px; align-items: center;
}
.head-meta a { color: #CADCFC; text-decoration: none; }
.head-meta a:hover { color: #fff; }
.head-meta .dot { width: 1px; height: 14px; background: var(--navy-line); }
.menu-toggle {
  display: none; margin-left: auto;
  background: var(--navy-soft); color: #fff; border: 1px solid var(--navy-line);
  border-radius: 7px; padding: 7px 11px; font-size: 13px; cursor: pointer;
}

/* ── Article layout: sidebar | content | toc ─────────────── */
.wiki-layout {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
}

/* ── Sidebar nav ─────────────────────────────────────────── */
.wiki-side {
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto;
  padding: 28px 14px 40px 24px;
  border-right: 1px solid var(--border);
}
.nav-group { margin-bottom: 22px; }
.nav-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--text-soft); padding: 0 10px; margin-bottom: 7px;
}
.wiki-side a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 7px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background 0.13s, color 0.13s;
}
.wiki-side a .nav-ico { width: 16px; text-align: center; opacity: 0.75; flex-shrink: 0; }
.wiki-side a:hover { background: #fff; color: var(--navy); }
.wiki-side a.active {
  background: var(--teal-light); color: var(--teal-dark); font-weight: 600;
}
.wiki-side a.active .nav-ico { opacity: 1; }
.wiki-side a.external::after { content: "↗"; margin-left: auto; font-size: 11px; opacity: 0.5; }

/* ── Main content column ─────────────────────────────────── */
.wiki-main { padding: 40px 48px 80px; min-width: 0; }
.wiki-content { max-width: var(--content-max); }

.crumbs { font-size: 12px; color: var(--text-soft); margin-bottom: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal-dark); }
.crumbs .sep { color: var(--border-strong); }

/* Markdown typography */
.wiki-content h1 {
  font-size: 30px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--navy); margin: 0 0 8px; line-height: 1.2;
}
.wiki-content > h2 {
  font-size: 21px; font-weight: 700; letter-spacing: -0.01em; color: var(--navy);
  margin: 42px 0 14px; padding-top: 14px; border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.wiki-content h3 {
  font-size: 16.5px; font-weight: 700; color: var(--navy); margin: 28px 0 10px;
  scroll-margin-top: 80px;
}
.wiki-content h4 { font-size: 14px; font-weight: 700; color: var(--text); margin: 22px 0 8px; text-transform: none; }
.wiki-content p { margin: 0 0 15px; color: var(--text); }
.wiki-content ul, .wiki-content ol { margin: 0 0 15px; padding-left: 24px; }
.wiki-content li { margin: 5px 0; }
.wiki-content li > ul, .wiki-content li > ol { margin: 5px 0; }
.wiki-content a { color: var(--teal-dark); text-decoration: none; border-bottom: 1px solid rgba(13,148,136,0.3); }
.wiki-content a:hover { border-bottom-color: var(--teal-dark); }
.wiki-content strong { font-weight: 700; color: var(--navy); }
.wiki-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

.wiki-content blockquote {
  margin: 0 0 16px; padding: 12px 18px;
  background: #fff; border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0; color: var(--text-muted);
}
.wiki-content blockquote p:last-child { margin-bottom: 0; }

/* Inline + block code */
.wiki-content code {
  font-family: 'SF Mono', ui-monospace, 'Menlo', monospace;
  font-size: 12.5px;
  background: var(--code-inline-bg); color: var(--code-inline-fg);
  padding: 2px 6px; border-radius: 5px;
}
.wiki-content pre {
  background: var(--code-bg); color: #CADCFC;
  border-radius: 11px; padding: 18px 20px; margin: 0 0 18px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.6;
  border: 1px solid var(--navy-deep);
}
.wiki-content pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* Tables */
.wiki-content table {
  width: 100%; border-collapse: collapse; margin: 0 0 20px;
  font-size: 13.5px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.wiki-content thead th {
  background: var(--navy); color: #fff; text-align: left;
  padding: 10px 14px; font-weight: 600; font-size: 12.5px;
}
.wiki-content thead th strong { color: #fff; }
.wiki-content tbody td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.wiki-content tbody tr:nth-child(even) { background: #FBFCFE; }
.wiki-content td code, .wiki-content th code { font-size: 11.5px; }

/* Lead paragraph (first <p> after h1) */
.wiki-content .lead { font-size: 16.5px; color: var(--text-muted); margin-bottom: 26px; }

/* Page status banner (for placeholders) */
.wiki-banner {
  display: flex; gap: 12px; align-items: flex-start;
  background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 10px;
  padding: 14px 16px; margin: 0 0 26px; font-size: 13.5px; color: #92400E;
}
.wiki-banner .ico { font-size: 16px; line-height: 1.4; }

/* ── Right TOC ───────────────────────────────────────────── */
.wiki-toc {
  position: sticky; top: 65px;
  height: calc(100vh - 65px); overflow-y: auto;
  padding: 44px 24px 40px 8px;
}
.toc-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--text-soft); margin-bottom: 12px;
}
.wiki-toc a {
  display: block; padding: 4px 0 4px 12px; font-size: 12.5px; line-height: 1.45;
  color: var(--text-soft); text-decoration: none;
  border-left: 2px solid var(--border);
}
.wiki-toc a.lvl-3 { padding-left: 24px; }
.wiki-toc a:hover { color: var(--text); }
.wiki-toc a.active { color: var(--teal-dark); border-left-color: var(--teal); font-weight: 600; }

/* ── Footer (inside content) ─────────────────────────────── */
.wiki-foot {
  max-width: var(--content-max);
  margin-top: 50px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-soft);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.wiki-foot a { color: var(--text-muted); text-decoration: none; }
.wiki-foot a:hover { color: var(--teal-dark); }

/* loading shimmer */
.wiki-loading { color: var(--text-soft); font-size: 14px; padding: 40px 0; }

/* ── Home: daily quote ───────────────────────────────────── */
.wiki-layout.is-home { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.is-home .wiki-main { display: flex; }
.home-stage {
  max-width: 760px;
  margin: 0 auto;
  min-height: calc(100vh - 66px - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.home-eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--teal-dark); margin-bottom: 30px;
  display: flex; align-items: center; gap: 12px;
}
.home-eyebrow::before {
  content: ""; width: 26px; height: 2px; background: var(--teal); display: inline-block; border-radius: 2px;
}
.home-quote-fig { margin: 0; position: relative; }
.home-quote-fig::before {
  content: "\201C";
  position: absolute; top: -54px; left: -10px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 150px; line-height: 1; color: var(--teal); opacity: 0.12;
  pointer-events: none;
}
.home-quote {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 38px; line-height: 1.32; font-weight: 500; letter-spacing: -0.01em;
  color: var(--navy);
  position: relative;
}
.home-author {
  margin-top: 26px;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--teal-dark);
}
.home-author::before { content: "— "; opacity: 0.7; }
.home-welcome {
  margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-soft); max-width: 56ch;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .wiki-layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .wiki-toc { display: none; }
  .wiki-main { padding: 36px 36px 70px; }
}
@media (max-width: 820px) {
  .wiki-layout, .wiki-layout.is-home { grid-template-columns: 1fr; }
  .home-quote { font-size: 28px; }
  .home-quote-fig::before { font-size: 110px; top: -40px; }
  .home-stage { min-height: 0; padding-top: 12px; }
  .menu-toggle { display: block; }
  .head-meta { display: none; }
  .wiki-side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 280px; height: 100vh; background: var(--bg);
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(15,30,61,0.18); padding-top: 24px;
  }
  body.nav-open .wiki-side { transform: translateX(0); }
  .nav-scrim {
    display: none; position: fixed; inset: 0; background: rgba(15,30,61,0.4); z-index: 55;
  }
  body.nav-open .nav-scrim { display: block; }
  .wiki-main { padding: 28px 22px 60px; }
  .wiki-content h1 { font-size: 25px; }
}

/* ── Home: New Toys digest card ─────────────────────────── */
.home-digest { margin: 0 0 30px; padding: 20px 24px 8px; background: #f2f7f8; border: 1px solid #dfeaea; border-radius: 14px; }
.home-digest-body { font-size: 15px; line-height: 1.6; }
.home-digest-body > :first-child { margin-top: 0; }
.home-digest-body h2 { font-size: 19px; margin: 16px 0 8px; }
.home-digest-body h3 { font-size: 16px; margin: 14px 0 6px; }
.home-digest-body ul { margin: 6px 0 12px; padding-left: 20px; }
.home-digest-body li { margin: 4px 0; }


/* Inline images / animated GIFs in articles (Slack onboarding page) */
.wiki-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 14px 0 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.wiki-content img + em {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 18px;
}
