/* featureMSEA Tutorial */

:root {
  --ink:          #18212e;
  --muted:        #64748b;
  --line:         #e2e8f0;
  --paper:        #ffffff;
  --faint:        #f8fafc;
  --primary:      #059669;
  --primary-dark: #047857;
  --amber:        #d97706;
  --code-bg:      #0f172a;
}

/* ── Reset / Base ───────────────────────────────── */
html, body {
  background: var(--paper);
  color: var(--ink);
}

a {
  color: var(--primary-dark);
  text-decoration-color: rgba(5, 150, 105, 0.3);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}
a:hover {
  color: var(--primary);
  text-decoration-color: rgba(5, 150, 105, 0.55);
}

/* ── Sidebar ────────────────────────────────────── */
.sidebar-book {
  background: var(--faint);
  border-right: 1px solid var(--line);
  padding-bottom: 2rem;
}

/* book title in sidebar */
.sidebar-book > div > h1 {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  padding: 1.2rem 1rem 0.9rem;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.sidebar-book > div > h1 a {
  color: var(--ink) !important;
  text-decoration: none;
}
.sidebar-book > div > h1 small { display: none; }

/* search */
.sidebar-book .form-control {
  border-radius: 6px;
  border-color: var(--line);
  font-size: 0.85rem;
  margin: 0.75rem 0.75rem 0.5rem;
  width: calc(100% - 1.5rem);
}
.sidebar-book .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

/* TOC heading */
.sidebar-book nav > h2 {
  display: none;
}

/* hide index/home entry — bookdown ignores .unlisted when building its own TOC */
ul.book-toc > li:first-child { display: none; }

/* TOC list */
ul.book-toc {
  padding: 0.35rem 0.6rem 0.5rem;
}
ul.book-toc li {
  margin: 1px 0;
}
ul.book-toc li a {
  display: block;
  border-radius: 6px;
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.35;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
ul.book-toc li a:hover {
  background: rgba(5, 150, 105, 0.08);
  color: var(--primary-dark);
}
ul.book-toc li a.active {
  background: var(--primary-dark);
  color: #fff;
  font-weight: 600;
}
ul.book-toc .header-section-number {
  color: inherit;
  opacity: 0.55;
  font-size: 0.8em;
  margin-right: 0.3em;
}
ul.book-toc li a.active .header-section-number {
  opacity: 0.75;
}

/* GitHub link */
.book-extra {
  padding: 0.5rem 1rem 0;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}
.book-extra a {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}
.book-extra a:hover { color: var(--primary-dark); }

/* on-page TOC (right sidebar in wide view) */
#toc h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
#toc nav a {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  border-left: 2px solid var(--line);
  padding-left: 0.65rem;
  transition: color 0.15s, border-color 0.15s;
}
#toc nav a:hover,
#toc nav a.active {
  color: var(--primary-dark);
  border-left-color: var(--primary);
}

/* ── Content ────────────────────────────────────── */
#content {
  background: var(--paper);
  padding: 1rem 1.5rem 4rem 2.5rem;
}

/* ── Typography ─────────────────────────────────── */
#content h1,
#content h2,
#content h3,
#content h4 {
  font-family: "Poppins", "Inter", sans-serif;
  color: var(--ink);
  letter-spacing: -0.01em;
}

#content h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  font-weight: 700;
  border-bottom: none;
  padding-bottom: 0.75rem;
  margin: 1.5rem 0 1.4rem;
  position: relative;
}
#content h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 3.5rem; height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--amber));
}

/* hide the anchor icon on headings — cleaner look */
#content .anchor { display: none; }


#content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  border-top: 1px solid var(--line);
  margin-top: 2.75rem;
  padding-top: 1.25rem;
}
#content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-top: 1.75rem;
}

#content p,
#content li {
  color: #334155;
  line-height: 1.75;
}

#content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* ── Tables ─────────────────────────────────────── */
#content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.9rem;
  margin: 1.5rem 0;
}
#content table thead tr {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff;
}
#content table thead th {
  border: none;
  font-weight: 600;
  padding: 0.7rem 1rem;
  text-align: left;
}
#content table td {
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 0.65rem 1rem;
  vertical-align: top;
}
#content table tbody tr:nth-child(even) td {
  background: var(--faint);
}

/* ── Code ───────────────────────────────────────── */
#content pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}
#content pre code {
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 0.875rem;
  line-height: 1.65;
  padding: 0;
}
#content code {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #b45309;
  font-size: 0.875em;
  padding: 0.1rem 0.38rem;
}

/* ── Syntax highlighting (dark-background overrides) ── */
/* The bs4_book defaults target light backgrounds; these override for --code-bg (#0f172a). */
#content pre code span.kw { color: #569cd6; }          /* keyword        — blue        */
#content pre code span.fu { color: #dcdcaa; }          /* function        — yellow      */
#content pre code span.op { color: #d4d4d4; }          /* operator        — light gray  */
#content pre code span.st { color: #ce9178; }          /* string          — warm orange */
#content pre code span.co { color: #6a9955; font-style: italic; } /* comment — muted green */
#content pre code span.va { color: #9cdcfe; }          /* variable        — sky blue    */
#content pre code span.dv { color: #b5cea8; }          /* decimal value   — pale green  */
#content pre code span.fl { color: #b5cea8; }          /* float           — pale green  */
#content pre code span.bn { color: #b5cea8; }          /* base number     — pale green  */
#content pre code span.cn { color: #4fc1ff; }          /* constant        — bright blue */
#content pre code span.dt { color: #4ec9b0; }          /* data type       — teal        */
#content pre code span.ot { color: #569cd6; }          /* other           — blue        */
#content pre code span.cf { color: #c586c0; }          /* control flow    — purple      */
#content pre code span.bu { color: #dcdcaa; }          /* builtin         — yellow      */
#content pre code span.im { color: #dcdcaa; font-weight: bold; } /* import — yellow     */
#content pre code span.at { color: #9cdcfe; }          /* attribute       — sky blue    */
#content pre code span.ss { color: #ce9178; }          /* special string  — warm orange */
#content pre code span.ch { color: #ce9178; }          /* character       — warm orange */
#content pre code span.sc { color: #ce9178; }          /* special char    — warm orange */
#content pre code span.vs { color: #ce9178; }          /* verbatim string — warm orange */
#content pre code span.pp { color: #c586c0; }          /* preprocessor    — purple      */
#content pre code span.in { color: #6a9955; font-style: italic; } /* information  */
#content pre code span.wa { color: #cca700; font-style: italic; } /* warning       — amber    */
#content pre code span.cv { color: #6a9955; font-style: italic; } /* comment-verbatim        */
#content pre code span.do { color: #6a9955; font-style: italic; } /* documentation comment   */
#content pre code span.an { color: #6a9955; }          /* annotation      — muted green */
#content pre code span.er { color: #f44747; font-weight: bold; }  /* error         — red      */
#content pre code span.al { color: #f44747; font-weight: bold; }  /* alert         — red      */

/* Links inside code blocks (downlit cross-references) inherit the token color */
#content pre code span a {
  color: inherit;
  text-decoration-color: rgba(255, 255, 255, 0.18);
  text-decoration-thickness: 1px;
}
#content pre code span a:hover {
  color: inherit;
  text-decoration-color: rgba(255, 255, 255, 0.55);
}

/* ── Blockquotes ────────────────────────────────── */
#content blockquote {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  font-style: normal;
  margin: 1.5rem 0;
  padding: 0.85rem 1rem;
}
#content blockquote p {
  color: #166534;
  margin: 0;
}

/* ── Images ─────────────────────────────────────── */
#content img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  margin: 1.5rem auto;
}
#content p.caption {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
  margin-top: -0.75rem;
}

/* ── Home page ──────────────────────────────────── */
#home > h1 { display: none; }

/* ── Footer ─────────────────────────────────────── */
footer.bg-primary { display: none; }

/* hide the prev nav block that points back to the invisible index page */
.chapter-nav div.prev:has(a[href="index.html"]) { display: none; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .hero-banner,
  .feature-grid { grid-template-columns: 1fr; }
  .hero-banner {
    min-height: auto;
    padding: 5.5rem 1.35rem 2rem;
  }
}
@media (max-width: 560px) {
  .hero-logo-pkg { height: 48px; left: 1rem; top: 1rem; }
  .hero-logo-lab { height: 30px; }
  .lab-link { top: 1.1rem; right: 1rem; }
  .hero-actions { flex-direction: column; }
  .hero-button { width: 100%; text-align: center; }
}
@media print {
  .sidebar-book { display: none; }
}
