:root {
  --paper: #f7f5ef;
  --surface: #eef1f1;
  --code: #f0f2f1;
  --ink: #1f2d3d;
  --muted: #667783;
  --accent: #3e6278;
  --line: #d4d9da;
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --content: min(860px, calc(100vw - 48px));
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: #c8d7dc; color: var(--ink); }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 8px 13px;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.notebook-header {
  height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 239, 0.96);
}

.notebook-header-inner,
.notebook-footer > div {
  width: var(--content);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark,
.library-link {
  font-size: 13px;
  font-weight: 600;
}

.wordmark span { margin: 0 4px; color: var(--accent); font-weight: 400; }
.library-link { color: var(--accent); border-bottom: 1px solid currentColor; }

.notebook-shell {
  width: var(--content);
  margin: 0 auto;
  padding: 42px 0 80px;
}

.notebook-utility {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.notebook-utility span { color: var(--line); }
.notebook-utility a:hover { text-decoration: underline; text-underline-offset: 3px; }

.notebook-title-block {
  padding: 56px 0 46px;
  border-bottom: 1px solid var(--line);
}

.notebook-repository {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.notebook-title-block h1 {
  max-width: 760px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 54px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.notebook-description {
  max-width: 690px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.notebook-meta {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.notebook-content {
  padding-top: 48px;
  overflow-wrap: anywhere;
}

.notebook-content .jp-Cell,
.notebook-content .cell {
  margin: 0 0 28px;
  padding: 0;
}

.notebook-content .jp-MarkdownCell,
.notebook-content .text_cell { color: var(--ink); }

.notebook-content h1,
.notebook-content h2,
.notebook-content h3,
.notebook-content h4 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.25;
}

.notebook-content h1 { margin: 62px 0 22px; font-size: 34px; }
.notebook-content h2 { margin: 54px 0 18px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 28px; }
.notebook-content h3 { margin: 38px 0 15px; font-size: 22px; }
.notebook-content h4 { margin: 30px 0 12px; font-family: var(--sans); font-size: 17px; font-weight: 600; }

.notebook-content p { margin: 0 0 18px; }
.notebook-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.notebook-content ul,
.notebook-content ol { padding-left: 24px; }
.notebook-content li { margin: 5px 0; }

.notebook-content blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.notebook-content pre {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.62;
  white-space: pre;
}

.notebook-content .jp-InputArea,
.notebook-content .input_area {
  overflow-x: auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--code);
}

.notebook-content .jp-OutputArea,
.notebook-content .output_wrapper {
  margin-top: 12px;
  overflow-x: auto;
}

.notebook-content .jp-OutputArea-output,
.notebook-content .output { padding: 6px 0; }

.notebook-content img,
.notebook-content svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
}

.notebook-content table {
  width: 100%;
  margin: 22px 0;
  border-collapse: collapse;
  font-size: 13px;
}

.notebook-content th,
.notebook-content td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: right;
}

.notebook-content th { background: var(--surface); font-weight: 600; }

.notebook-content .jp-InputPrompt,
.notebook-content .jp-OutputPrompt,
.notebook-content .prompt { display: none; }

.code-disclosure,
.output-disclosure {
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--code);
}

.code-disclosure summary,
.output-disclosure summary {
  display: flex;
  justify-content: space-between;
  padding: 11px 14px;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  list-style: none;
}

.code-disclosure summary::-webkit-details-marker,
.output-disclosure summary::-webkit-details-marker { display: none; }
.code-disclosure summary span:last-child,
.output-disclosure summary span:last-child { color: var(--muted); font-weight: 400; }
.code-disclosure[open] summary,
.output-disclosure[open] summary { border-bottom: 1px solid var(--line); }
.code-disclosure .jp-InputArea,
.code-disclosure .input_area { border: 0; }

.output-disclosure {
  margin-top: 12px;
  background: var(--paper);
}

.output-disclosure .jp-OutputArea-output,
.output-disclosure .output_subarea {
  max-height: 520px;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
}

.notebook-footer {
  height: 76px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.notebook-footer a { color: var(--accent); }

/* Notebook library */
.library-page .notebook-shell { padding-top: 68px; }

.library-intro {
  max-width: 700px;
  padding-bottom: 60px;
}

.library-intro h1 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 60px);
  font-weight: 400;
  line-height: 1.05;
}

.library-intro p { margin: 0; color: var(--muted); font-size: 17px; }

.library-group {
  padding: 46px 0 54px;
  border-top: 1px solid var(--line);
}

.library-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.library-group h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 400;
}

.library-group-header > a {
  color: var(--accent);
  font-size: 12px;
  border-bottom: 1px solid currentColor;
}

.library-list { border-top: 1px solid var(--line); }

.library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.library-item h3 { margin: 0 0 5px; font-size: 17px; font-weight: 600; }
.library-item p { margin: 0; color: var(--muted); font-size: 14px; }
.library-item > a { color: var(--accent); font-size: 13px; font-weight: 500; }
.library-item:hover h3 { color: var(--accent); }

@media (max-width: 680px) {
  :root { --content: calc(100vw - 32px); }
  .notebook-header { height: 62px; }
  .notebook-shell { padding: 30px 0 58px; }
  .notebook-title-block { padding: 44px 0 36px; }
  .notebook-content { padding-top: 34px; }
  .notebook-content h1 { font-size: 29px; }
  .notebook-content h2 { font-size: 25px; }
  .notebook-content .jp-InputArea,
  .notebook-content .input_area { padding: 14px; }
  .library-link { display: none; }
  .library-page .notebook-shell { padding-top: 48px; }
  .library-intro { padding-bottom: 46px; }
  .library-group { padding: 38px 0 44px; }
  .library-group-header { display: block; }
  .library-group-header > a { display: inline-block; margin-top: 8px; }
  .library-item { grid-template-columns: 1fr; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

