/* Looper's docs site: group tabs and two navigation rails around a quiet, wide article.
   Solid cream/graphite surfaces follow the portal's; the faces are goaly.ai's: Altform where
   installed, else Hanken Grotesk, its open stand-in there, and IBM Plex Mono for code.
   light-dark() follows the system; <html data-theme> carries the portal's saved choice.
   Styles layout.html, build.py and wiki.js's copy controls: pages are Markdown, with no HTML. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f2f1ee, #12100e);
  --surface: light-dark(#ffffff, #1b1815);
  --surface-2: light-dark(#f8f7f5, #221e1b);
  --ink: light-dark(#1d1916, #f2f1ee);
  --muted: light-dark(#6e675f, #aaa298);
  --line: light-dark(#e4e1db, #322d28);
  --accent: light-dark(#3d63b8, #8eaef3);
  --accent-soft: light-dark(#e8edf8, #242c40);
  /* Code tokens by the role build.py gives them, in goaly.ai's blue, green, orange and pink,
     each dark enough on light code, and light enough on dark, to read as text (4.5:1). */
  --code-keyword: light-dark(#2b59c3, #8fb0f7);
  --code-string: light-dark(#0a7a5c, #7fd8b6);
  --code-number: light-dark(#c2410c, #ffa285);
  --code-function: light-dark(#a8327f, #f2a5dd);
  --code-type: light-dark(#8a5300, #e9c27a);
  --code-builtin: light-dark(#6a46c2, #bba6f7);
  --code-comment: light-dark(#6f675f, #958c82);
  --bar: 56px;
  --rail: 208px;
  --toc: 184px;
  --body: "Altform", "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: var(--body);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 17px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Code shows its characters as they are: the font's ligatures would draw <|im_start|> as arrows. */
code {
  font: 400 0.85em/1.5 var(--mono);
  font-variant-ligatures: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 5px;
  white-space: nowrap;
}

/* ---- top bar and tabs ---- */
.top, .tabs {
  padding-inline: max(24px, calc(50% - 696px));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--bar);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font: 600 17px/1 var(--display);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
/* The goa/y wordmark, drawn in the text colour. */
.brand .logo {
  width: 55px; height: 22px; background: currentColor;
  -webkit-mask: url(img/goaly-wordmark.svg) center / contain no-repeat;
  mask: url(img/goaly-wordmark.svg) center / contain no-repeat;
}
.actions { display: flex; align-items: center; gap: 6px; }
/* The cookbook's source on GitHub; the mark alone on a phone. */
.source {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  color: var(--muted); font: 500 14.5px/1 var(--body); white-space: nowrap;
}
.source:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.source svg { width: 18px; height: 18px; }
#theme {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 999px; background: none; color: var(--ink); cursor: pointer;
}
#theme:hover { background: var(--surface-2); }
#theme svg { width: 18px; height: 18px; }
.tabs { display: flex; gap: 28px; overflow-x: auto; font: 500 15.5px/1 var(--body); }
.tabs a { padding: 14px 0 12px; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 32px;
}
@media (min-width: 900px) {
  .page { grid-template-columns: var(--rail) minmax(0, 1fr); }
}
@media (min-width: 1200px) {
  .page { grid-template-columns: var(--rail) minmax(0, 1fr) var(--toc); }
}

/* ---- the group's pages (left) and "On this page" (right) ---- */
.rail { padding-block: 20px 4px; }
.toc { display: none; font-size: 13.5px; line-height: 1.5; }
@media (min-width: 900px) {
  .rail, .toc {
    position: sticky;
    top: var(--bar);
    align-self: start;
    max-height: calc(100vh - var(--bar));
    overflow-y: auto;
    padding-block: 28px 24px;
  }
}
@media (min-width: 1200px) {
  .toc { display: block; }
}
.rail nav ol, .toc ul { list-style: none; margin: 0; padding: 0; }
.rail nav a {
  display: block; padding: 7px 12px; border-left: 2px solid transparent; border-radius: 0 5px 5px 0;
  color: var(--muted); font-size: 14.5px; line-height: 1.5;
}
.rail nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.rail nav a.active {
  color: var(--accent); font-weight: 600; background: var(--accent-soft);
  border-left-color: var(--accent);
}
@media (max-width: 899px) {
  .rail nav ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .rail nav a { border-left: 0; border-radius: 5px; background: var(--surface-2); }
}
.toc p { margin: 0 0 14px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.toc a { display: block; padding: 6px 0 6px 14px; border-left: 1px solid var(--line); color: var(--muted); }
.toc .sub a { padding-left: 26px; font-size: 12.5px; }
.toc a:hover, .toc a.current { color: var(--accent); border-left-color: var(--accent); }
.toc a.current { font-weight: 500; }

/* ---- article: use the full middle column for text, code and tables ---- */
.doc { min-width: 0; padding-block: 28px 36px; }
.doc a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.doc a:hover { text-decoration-thickness: 2px; }
@media (max-width: 899px) {
  .page { padding-inline: 16px; }
  .top, .tabs { padding-inline: 16px; }
  .doc { padding-block: 24px 28px; }
}
h1 {
  font: 600 34px/1.2 var(--display);
  letter-spacing: -0.025em; margin: 0 0 24px; text-wrap: balance;
}
h2 {
  font: 600 25px/1.3 var(--display);
  letter-spacing: -0.015em; margin: 40px 0 14px; text-wrap: balance;
  scroll-margin-top: calc(var(--bar) + 20px);
}
h3 {
  font: 600 20px/1.4 var(--display);
  letter-spacing: -0.01em; margin: 28px 0 10px; text-wrap: balance;
  scroll-margin-top: calc(var(--bar) + 20px);
}
h4 { font: 600 17px/1.5 var(--body); margin: 24px 0 8px; scroll-margin-top: calc(var(--bar) + 20px); }
p { margin: 0 0 18px; }
strong { font-weight: 600; }

/* A notebook that runs in Colab opens there, in a new tab, from beside its title:
   at the right of the title's line, or under a title too long to share it. */
.doc .titlebar {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 12px 20px; margin: 0 0 24px;
}
.doc .titlebar h1 { margin: 0; }
.doc .colab { margin: 0; }
.doc .colab a {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font: 500 14.5px/1 var(--body); text-decoration: none; white-space: nowrap;
}
.doc .colab a:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
.doc .colab svg { width: 14px; height: 14px; color: var(--muted); }

/* tables */
.tablewrap { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font: 600 15px/1.5 var(--body); padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

/* code, and what a program printed under it */
.doc pre { overflow-x: auto; margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font: 400 14px/1.6 var(--mono); font-variant-ligatures: none; }
.doc pre code { font: inherit; white-space: pre; padding: 0; border: 0; background: none; }
.doc pre.output { margin-top: -6px; border-style: dashed; background: none; color: var(--muted); }
.doc .code-block { position: relative; margin: 20px 0; }
.doc .code-block > pre { margin: 0; }
.code-copy { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.code-copy:hover { background: var(--accent-soft); color: var(--ink); }
.code-copy[data-state="copied"] { color: var(--accent); }
.code-copy[data-state="failed"] { color: var(--ink); }
.code-copy-status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.doc .prompt { margin: 20px 0; }
.doc .prompt details { margin-top: 10px; }
.doc .prompt summary { cursor: pointer; color: var(--accent); font-size: 15px; }
.doc .prompt pre { margin: 10px 0 0; }
.doc .prompt pre code { white-space: pre-wrap; }
.copy-prompt {
  padding: 10px 16px; border: 1px solid var(--accent); border-radius: 5px; cursor: pointer;
  background: var(--accent); color: var(--surface); font: 500 15px/1.2 var(--body);
}
.copy-prompt:hover { filter: brightness(1.08); }

.doc pre .k { color: var(--code-keyword); }
.doc pre .s { color: var(--code-string); }
.doc pre .m { color: var(--code-number); }
.doc pre .f { color: var(--code-function); }
.doc pre .t { color: var(--code-type); }
.doc pre .b { color: var(--code-builtin); }
.doc pre .c { color: var(--code-comment); font-style: italic; }
.doc :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
.doc ul, .doc ol { padding-left: 24px; margin: 0 0 16px; }
.doc li { margin: 5px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media (max-width: 600px) {
  .source { padding: 0 8px; }
  .source span { display: none; }
  h1 { font-size: 29px; }
  h2 { font-size: 23px; }
}
