:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #404040;
  --ink-mute: #737373;
  --rule: #e5e5e5;
  --brand: #000054;
  --brand-hover: #2a2a86;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
}

@supports (font-variation-settings: normal) {
  body { font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
}

.wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}
.site-header .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.site-logo {
  height: 30px;
  width: 30px;
}
.site-nav a {
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--brand); }
.site-nav a + a { margin-left: 1.1rem; }

/* Content */
main.page {
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}
h1, h2, h3 {
  letter-spacing: -0.02em;
  line-height: 1.25;
}
h1 { font-size: 2rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 2.4rem 0 0.8rem; }
p, li { line-height: 1.7; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Notebook list */
.notebook-list { margin: 1.5rem 0; padding-left: 1.4em; }
.notebook-list li { margin-bottom: 0.9rem; }
.notebook-list > li > a { font-weight: 600; }
.notebook-list .nb-desc {
  display: block;
  color: var(--ink-mute);
  font-size: 0.95rem;
  margin-top: 0.1rem;
}

/* RICE strategy diagram */
.rice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.75rem 0 2.25rem;
}
.rice-step { flex: 1 1 160px; min-width: 150px; }
.rice-arrow {
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  line-height: 1.25;
  min-height: 3.6rem;
  display: flex;
  align-items: center;
  padding: 0.8rem 1.1rem 0.8rem 1.5rem;
  clip-path: polygon(0 0, 86% 0, 100% 50%, 86% 100%, 0 100%, 14% 50%);
}
.rice-step:first-child .rice-arrow {
  padding-left: 1.1rem;
  clip-path: polygon(0 0, 86% 0, 100% 50%, 86% 100%, 0 100%);
}
.rice-arrow strong { font-weight: 700; }
.rice-notes { margin-top: 0.85rem; font-size: 0.9rem; color: var(--ink-soft); }
.rice-notes p { margin: 0 0 0.7rem; line-height: 1.55; }
.rice-notes ul { margin: 0; padding-left: 1.2em; }
.rice-notes li { margin-bottom: 0.2rem; }
.rice-notes strong { color: var(--brand); }

@media (max-width: 560px) {
  .rice-step { flex-basis: 100%; }
  .rice-arrow, .rice-step:first-child .rice-arrow {
    clip-path: none;
    border-radius: 6px;
    min-height: 0;
  }
}

/* ---- Rendered notebook pages ---- */

/* Problem statement callout (from <!-- problem START/END --> markers) */
.nb-problem {
  background: #f7f7f8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.4rem 1.25rem 1rem;
  margin: 0 0 2rem;
}
.nb-problem h1 { margin-top: 0.7rem; }

/* RICE step heading shown as a chip (from <!-- step START/END --> markers) */
.nb-step h2 {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 1.05rem;
  margin-top: 0.4rem;
}

/* Code input vs output boxes, and horizontal scroll for long lines */
body.jp-Notebook .jp-InputArea-editor {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fbfbfd;
  overflow-x: auto;
  padding: 0.85rem 1.1rem;
}
body.jp-Notebook .jp-OutputArea-output {
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
  max-height: 26rem;  /* long prints (embedding table, vocab) scroll instead of running on */
  padding: 0.7rem 1.1rem;
}
/* keep code/text flush to the box padding (no doubled inner margins or background) */
body.jp-Notebook .jp-InputArea-editor .highlight { background: transparent; }
body.jp-Notebook .highlight pre,
body.jp-Notebook .jp-OutputArea-output pre,
body.jp-Notebook .jp-RenderedText pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

/* Floating table of contents on notebook pages */
.nb-toc {
  position: fixed;
  top: 6.5rem;
  left: max(1.25rem, calc((100% - 720px) / 2 - 230px));
  width: 210px;
  max-height: 72vh;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.4;
}
.nb-toc-title {
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.nb-toc ul { list-style: none; margin: 0; padding: 0; }
.nb-toc li { margin: 0.2rem 0; }
.nb-toc a { color: var(--ink-mute); text-decoration: none; }
.nb-toc a:hover { color: var(--brand); }
.nb-toc .toc-l1 a { font-weight: 600; color: var(--ink-soft); }
.nb-toc .toc-l2 { padding-left: 0.7rem; }

/* The TOC needs gutter room; hide it when the window is too narrow */
@media (max-width: 1100px) {
  .nb-toc { display: none; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem 0;
  margin-top: 3rem;
  color: var(--ink-mute);
  font-size: 0.9rem;
}
