.agent-toc { display:flex; gap:var(--s4) var(--s6); flex-wrap:wrap; padding-block:var(--s6); border-bottom:1px solid var(--line); font-size:var(--sm); }
.agent-toc a { min-height:44px; display:inline-flex; align-items:center; }
.agent-heading { padding-block:var(--s12) var(--s6); }
.agent-heading h1 { max-width:27ch; font-size:clamp(2.4rem,4.2vw,3.6rem); }
.agent-content .lede { color:var(--ink); font-size:var(--lg); margin-top:var(--s8); }
.agent-content p { max-width:72ch; color:var(--slate); }
.agent-content p+p { margin-top:var(--s5); }
.agent-section { padding-block:var(--s10); border-top:1px solid var(--line); scroll-margin-top:0; }
.agent-section h2 { max-width:30ch; margin-bottom:var(--s6); }
.agent-section h3 { max-width:55ch; margin-block:var(--s8) var(--s4); }
.agent-close { margin-bottom:var(--s10); border-top:3px solid var(--signal); }
.agent-close p:last-child a { color:var(--signal); font-weight:700; }
@media(min-width:1000px) {
  .agent-content > .wrap:not(.worksheet-visual) { padding-inline:var(--s16); }
}
@media(max-width:600px) {
  .agent-heading { padding-top:var(--s8); }
  .agent-heading h1 { font-size:2rem; }
  .agent-content .lede { font-size:1.125rem; line-height:1.6; }
  .agent-toc { gap:var(--s2) var(--s5); }
}
/* Home-page layout: section heading on the left, details on the right. */
@media(min-width:1101px) {
  .agent-heading:has(.worksheet-visual) { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); column-gap:var(--s16); align-items:center; }
  .agent-heading > :not(.worksheet-visual) { grid-column:1; }
  .agent-heading > .worksheet-visual { grid-column:2; grid-row:1 / span 8; width:100%; max-width:none; margin:0; }
  .agent-content > .wrap.agent-heading, .agent-content > .wrap.agent-section { padding-inline:0; }
  .agent-section { display:grid; grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr); column-gap:var(--s16); align-items:start; padding-block:var(--s16); }
  .agent-section > h2 { grid-column:1; grid-row:1 / span 60; max-width:16ch; margin:0; }
  .agent-section > :not(h2) { grid-column:2; }
  .agent-section > h2 + * { margin-top:0; }
}
/* Balanced long-form layout: numbered section label, and the heading stays beside its text while reading. */
@media(min-width:1101px) {
  .agent-content { counter-reset:agent-section; }
  .agent-section { counter-increment:agent-section; }
  .agent-section > h2 { position:sticky; top:7.5rem; align-self:start; }
  .agent-section > h2::before { content:counter(agent-section, decimal-leading-zero); display:block; margin-bottom:var(--s4); font-family:inherit; font-size:var(--xs); font-weight:700; letter-spacing:.12em; color:var(--signal); }
}
@media(min-width:1101px) and (prefers-reduced-motion:no-preference) { .agent-section > h2 { transition:top .2s ease; } }
