/* BEagent user guide: one readable column on BEagent's paper ground, near-black ink, Aged gold links and a
   Boilermaker Gold rule at the top. The colour tokens and the serif face are copied from beagent.css's :root, which
   this page does not load (its body rules lay out the app). The page's policy allows only this file, so every
   style is here.

   One mark for each kind of thing, and no colour but the links' (Uhan3, 2026-10-19: the bands behind the labels, the
   boxes round the messages and the gold numbers read as clutter). A label on BEagent's screen is bold, a message
   BEagent shows is in quotes, a file or a field name is in the code face; numbers and list markers are grey. The only
   motion is the outline's folds, which open and close slowly, by CSS alone (the page allows no script). */

:root {
  --bg: #fcfbf8;
  --ink: #111111;
  --ink-2: #464138;
  --muted: #555960;
  --faint: #928c84;
  --line: #e4e0d6;
  --line-soft: #efebe3;
  --white: #ffffff;
  --accent: #8e6f3e;
  --accent-dark: #6b5430;
  --accent-tint: #fbf6ea;
  --gold: #cfb991;
  --serif: Georgia, "Noto Serif SC", "Songti SC", "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --gutter: 16px;
  --measure: 68ch;
  --toc-w: 270px;
  /* How long a fold takes to open or close (Uhan3, 2026-10-19: the outline folded away too fast). */
  --fold: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  /* A short list (a section's subsections, the terms) folds a little faster. */
  --fold-short: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Lets a fold's height move to and from auto. A browser without it opens and closes the folds at once. */
  interpolate-size: allow-keywords;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  border-top: 4px solid var(--gold);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  /* Lining figures, as on the page: old-style ones make "S03" read as "So3" */
  font-variant-numeric: lining-nums;
  font-size: 17px;
  /* A touch more room between lines (Uhan3, 2026-10-31; it was 1.85). */
  line-height: 1.95;
  overflow-wrap: break-word;
}

/* One column: the measure plus a 16 px gutter on each side. On a wide screen the numbered outline stands to its left
   (Uhan3, 2026-10-16), from 1100 px, where both fit. */
.masthead,
main,
.guide-end {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ------------------------------------------------------------------ the folds */

/* A fold (the outline, a section of the outline, the terms) slides open and shut: its content's height moves between
   nothing and its own, and the content stays drawn until the fold has shut. */
details::details-content {
  height: 0;
  overflow: clip;
  transition: height var(--fold-short), content-visibility var(--fold-short) allow-discrete;
}
details[open]::details-content { height: auto; }
details.toc::details-content { transition: height var(--fold), content-visibility var(--fold) allow-discrete; }

/* ------------------------------------------------------------------ the outline */

/* The outline: a box above the text on a narrow screen, folded with its own summary; on a wide screen a column that
   stays in view, folded away to a small "Contents" button with the same summary (Uhan3, 2026-10-19). The page opens
   with each section's subsections folded (guide.html). */
details.toc {
  margin: 12px var(--gutter) 0;
  padding: 0 16px;
  font-size: 15px;
  line-height: 1.6;
}

/* Back to BEagent, above Contents: black on gold, as the guide's end has it (Uhan3, 2026-10-31), a size smaller. */
.guide-back {
  display: block;
  width: max-content;
  margin: 20px var(--gutter) 0;
  padding: 8px 18px;
  border-radius: 999px;
  background-color: var(--gold);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}
.guide-back:hover { background-color: #c0a77b; color: var(--ink); }
.toc-title { display: none; }
.toc > summary { display: flex; align-items: center; gap: 10px; list-style: none; }
.toc > summary::-webkit-details-marker { display: none; }
/* The fold's chevron: right while folded, down while open (left on a wide screen, where the column folds away). */
.toc-fold {
  flex: none;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--fold);
}
.toc[open] > summary .toc-fold { transform: rotate(45deg); }
.toc-list, .toc-list ol { margin: 0; padding: 0; list-style: none; }
.toc-list { padding-bottom: 12px; }
.toc-list li + li { margin-top: 0; }
.toc-list > li { margin-top: 6px; }
.toc-list ol { margin: 2px 0 4px; padding-left: 1.9em; font-size: 0.93em; }
.toc a {
  display: flex;
  gap: 0.55em;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
}
.toc a:hover { background: var(--accent-tint); color: var(--accent-dark); }
/* A fold clips what it holds, so the focus ring of a row in the outline is drawn inside the row. */
.toc a:focus-visible, .toc summary:focus-visible { outline-offset: -2px; }
.toc ol ol a { color: var(--ink-2); }
.toc-num { flex: none; min-width: 1.6em; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc ol ol .toc-num { min-width: 2em; }

/* A section with subsections folds (Uhan3, 2026-10-16): its row, drawn as a link's, is the fold's summary, with a
   chevron at its right that points down while the subsections show and right once they are folded. None of the
   page's boxed-details look reaches it. */
.toc details.toc-group { margin: 0; padding: 0; border: none; border-radius: 0; }
.toc-group > summary {
  display: flex;
  gap: 0.55em;
  margin: 0;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--ink);
  list-style: none;
}
.toc-group > summary::-webkit-details-marker { display: none; }
.toc-group > summary:hover { background: var(--accent-tint); color: var(--accent-dark); }
.toc-group[open] > summary { margin: 0; border-bottom: none; }
.toc-group > summary::after {
  content: "";
  flex: none;
  align-self: center;
  width: 6px;
  height: 6px;
  margin: -3px 4px 0 auto;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg);
  transition: transform var(--fold-short);
}
.toc-group:not([open]) > summary::after { margin-top: 0; transform: rotate(-45deg); }
.toc-group > summary:hover::after { border-color: currentColor; }

@media (min-width: 1100px) {
  /* Two columns, the outline's and the text's, centred together. Folded, the outline's column closes to nothing and
     the text slides to the middle, at the folds' pace. */
  .page {
    display: grid;
    grid-template-columns: var(--toc-w) minmax(0, calc(var(--measure) + 2 * var(--gutter)));
    justify-content: center;
    column-gap: 40px;
    padding: 0 24px;
    transition: grid-template-columns var(--fold), column-gap var(--fold);
  }
  .page:has(> .side > details.toc:not([open])) {
    grid-template-columns: 0px minmax(0, calc(var(--measure) + 2 * var(--gutter)));
    column-gap: 0px;
  }
  .page > .content { grid-column: 2; }
  .content .masthead, .content main, .content .guide-end { margin-left: 0; margin-right: 0; }
  .content .masthead, .content main { margin-top: 0; margin-bottom: 0; }
  /* Back to BEagent and the outline stay in view together. */
  .page > .side {
    grid-column: 1;
    position: sticky;
    top: 0;
    z-index: 2;
    align-self: start;
    padding-top: 24px;
  }
  .guide-back { margin: 0 0 14px; transition: transform var(--fold); }
  /* Folded, it moves just left of the text with the Contents button under it. */
  .page:has(> .side > details.toc:not([open])) .guide-back { transform: translateX(calc(-100% - 20px)); }
  details.toc {
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
  }
  details.toc > summary {
    width: max-content;
    margin: 0 0 10px;
    padding: 6px 12px 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    line-height: 1.3;
    text-transform: uppercase;
    transition: transform var(--fold), border-color var(--fold), background-color var(--fold);
  }
  details.toc > summary:hover { background-color: var(--accent-tint); color: var(--accent-dark); }
  details.toc[open] > summary { margin-bottom: 10px; border-bottom-color: transparent; }
  details.toc[open] > summary .toc-fold { transform: rotate(135deg); }
  /* Folded, the button keeps its height and moves just left of the text, outlined, as the column closes under it. */
  details.toc:not([open]) > summary {
    border-color: var(--line);
    background-color: var(--white);
    transform: translateX(calc(-100% - 20px));
  }
  details.toc:not([open]) > summary:hover { background-color: var(--accent-tint); }
  /* The list fills the column, which clips it; it scrolls when it is longer than the window. Its own width stays the
     open column's, so its lines never rewrap on the way. Folding, it fades out first, while the column closes;
     opening, it fades in once the column has room for it. */
  details.toc::details-content {
    height: auto;
    max-height: calc(100vh - 24px - 50px - 40px - 16px);
    overflow: hidden auto;
    opacity: 1;
    transition: opacity 0.35s ease 0.25s, content-visibility var(--fold) allow-discrete;
  }
  details.toc:not([open])::details-content {
    opacity: 0;
    transition: opacity 0.25s ease, content-visibility var(--fold) allow-discrete;
  }
  details.toc > nav { width: var(--toc-w); }
}

/* No fold moves when the system asks for less motion: each rule above that sets a transition is named here, at its own
   weight or more (tests/webapp/test_guide.py holds the list to the sheet). */
@media (prefers-reduced-motion: reduce) {
  .page, details::details-content, details.toc::details-content, details.toc:not([open])::details-content,
  details.toc > summary, .toc-fold, .toc-group > summary::after, .guide-back { transition: none; }
}

/* ------------------------------------------------------------------ the text */

/* A section's number, and a subsection's (2.1), grey, as in the outline. */
.num { margin-right: 0.5em; color: var(--muted); font-variant-numeric: tabular-nums; }

h3 {
  margin: 2.1em 0 0.7em;
  font-size: 1.12em;
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 16px;
}

.masthead { padding-top: 28px; }
main { padding-bottom: 72px; }

/* The way back to BEagent, under the last section: a rounded gold button, as the app's own are, and why to close the
   tab instead when BEagent is still open in another. */
.guide-end { padding-bottom: 72px; margin-top: -40px; }
.guide-end p { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.guide-home {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.guide-home:hover { background: #c0a77b; color: var(--ink); }

h1 {
  margin: 0 0 4px;
  font-size: 2.3em;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.readtime { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.lead { margin: 0; color: var(--ink-2); font-size: 1.12em; }

h2 {
  margin: 2.8em 0 0.9em;
  padding-top: 0.9em;
  border-top: 1px solid var(--line);
  font-size: 1.4em;
  font-weight: 400;
  line-height: 1.25;
}

section { scroll-margin-top: 16px; }

p, ul, ol, dl, details, table { margin: 0 0 1.25em; }

ul, ol { padding-left: 1.4em; }
li + li { margin-top: 0.7em; }
ol > li::marker { color: var(--muted); }
ul > li::marker { color: var(--faint); }

a {
  color: var(--accent);
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-dark); text-decoration-color: currentColor; }

/* A label on BEagent's screen: bold, in the text's ink. */
b.ui { color: var(--ink); font-weight: 700; }

/* A message BEagent shows: in curly quotes, in the text's own face and ink. */
q.msg { quotes: "\201C" "\201D"; }

/* A file, a field or a value: the code face, a little smaller, in the text's ink. */
code {
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

/* Which model goes with which design and method (5.2): a plain ruled table, its names in the code face. */
table.models {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86em;
  line-height: 1.55;
}
table.models th, table.models td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.models th {
  color: var(--muted);
  font-size: 0.86em;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
table.models code { font-size: 0.95em; }

/* A note: set off by a thin grey rule at its left. */
.note { padding-left: 14px; border-left: 2px solid var(--line); }

dt { margin-top: 1.25em; }
dt:first-child { margin-top: 0; }
dd { margin: 0.4em 0 0; padding-left: 1.4em; }

/* The terms (11): a plain outlined fold. */
details {
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
summary {
  padding: 12px 0;
  color: var(--accent);
  cursor: pointer;
}
summary:hover { color: var(--accent-dark); }
details[open] > summary { margin-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
details dl { padding-bottom: 6px; }
details dt { font-weight: 700; }

:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
  border-radius: 2px;
}

/* The Claude Code sign-in's consent page (consent.html, 2agent M9) uses this sheet too: its two buttons, plain, with
   Approve filled in the links' colour. */
.consent-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.consent-actions button {
  padding: 8px 22px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background-color: var(--white);
  color: var(--accent-dark);
  font: inherit;
  cursor: pointer;
}
.consent-actions .consent-approve { background-color: var(--accent); color: var(--white); }
.consent-actions button:disabled { opacity: 0.5; cursor: default; }

/* The Claude Code install page (claude-code.html): the sentence to say, in a box of its own, since it is the one thing
   a person needs from the page; a command to run by hand in a quieter box; and the line for Claude, small and quiet. */
.say {
  margin: 1.8em 0 1.4em;
  padding: 18px 22px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-tint);
}
.say p { margin: 0; }
.say .say-label { margin-bottom: 8px; color: var(--accent-dark); font-size: 0.95em; }
.say .say-line { overflow-x: auto; white-space: nowrap; }
.say-line code { color: var(--ink); font-size: 0.82em; }
.cmd {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}
#for-claude { color: var(--faint); font-size: 0.82em; }

@media (min-width: 1024px) {
  body { font-size: 18px; }
  .masthead { padding-top: 48px; }
}

@media (max-width: 400px) {
  body { font-size: 16px; }
  h1 { font-size: 2em; }
}
