/* Tables use the article width; narrow layouts stack their labeled cells. */
.learning-reductions {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  contain: inline-size;
  margin-block: 1.25rem;
  border: 1px solid var(--bs-border-color, #ddd);
}
.learning-reductions:focus-visible {
  outline: 2px solid var(--bs-link-color, #2673c9);
  outline-offset: 3px;
}
.learning-reductions table {
  table-layout: fixed;
  width: 100%;
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}
.learning-reductions th,
.learning-reductions td {
  vertical-align: top;
  padding: 0.8rem 1rem;
  overflow-wrap: anywhere;
}
.learning-reductions col:nth-child(1) { width: 36% !important; }
.learning-reductions col:nth-child(2) { width: 44% !important; }
.learning-reductions col:nth-child(3) { width: 20% !important; }
.learning-reductions th:nth-child(1),
.learning-reductions td:nth-child(1) { width: 36%; }
.learning-reductions th:nth-child(2),
.learning-reductions td:nth-child(2) { width: 44%; }
.learning-reductions th:nth-child(3),
.learning-reductions td:nth-child(3) { width: 20%; }
.learning-reductions .math {
  display: inline-block;
  max-width: 100%;
  overflow: visible;
  vertical-align: middle;
}


/* Specification tables: a framed two-column sheet.
   Left: the element. Right: its type, with the example beneath it. */
.learning-specification {
  --spec-line: var(--bs-border-color, #dee2e6);
  --spec-head: var(--bs-tertiary-bg, #f4f5f7);
  --spec-zebra: rgba(127, 127, 127, 0.045);
  --spec-muted: var(--bs-secondary-color, #626970);
  --spec-accent: var(--bs-link-color, #2673c9);
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
  margin-block: 1.5rem 2rem;
  border: 1px solid var(--spec-line);
  border-radius: 8px;
  overflow: visible;
}
.learning-specification table,
.learning-specification thead,
.learning-specification tbody {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
}
.learning-specification colgroup { display: none; }
.learning-specification tr {
  display: grid;
  grid-template-columns: minmax(8.5rem, 27%) minmax(0, 1fr);
  grid-template-areas:
    "name type"
    "name example";
  column-gap: 1.25rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--spec-line);
}
.learning-specification tbody tr:last-child { border-bottom: 0; }
.learning-specification tbody tr:nth-child(even) { background: var(--spec-zebra); }
.learning-specification th,
.learning-specification td {
  display: block;
  width: auto !important;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  overflow-wrap: break-word;
  overflow: visible;
  padding-block: 3px;
  line-height: 1.6;
}
.learning-specification th:nth-child(1),
.learning-specification td:nth-child(1) { grid-area: name; }
.learning-specification th:nth-child(2),
.learning-specification td:nth-child(2) { grid-area: type; }
.learning-specification th:nth-child(3),
.learning-specification td:nth-child(3) { grid-area: example; }

/* Header band */
.learning-specification thead tr {
  grid-template-areas: "name type";
  padding-block: 0.55rem;
  background: var(--spec-head);
}
.learning-specification thead th {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--spec-muted);
}
.learning-specification thead th:nth-child(3) { display: none; }

/* Cells */
.learning-specification td:nth-child(1) {
  font-weight: 650;
  line-height: 1.45;
  padding-top: 0.1rem;
}
.learning-specification td:nth-child(3) {
  margin-top: 0.45rem;
  padding-left: 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--spec-accent) 45%, transparent);
  font-size: 0.9em;
  color: var(--spec-muted);
}
.learning-specification td:nth-child(3)::before {
  content: "Example";
  display: block;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}
.learning-specification td p { margin: 0; }
.learning-specification .math {
  display: inline;
  overflow: visible;
  max-width: none;
}

/* Narrow screens: stack the columns. */
@media (max-width: 640px) {
  .learning-specification tr {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "name" "type" "example";
    row-gap: 0.3rem;
  }
  .learning-specification thead { display: none; }
}
@media print {
  .learning-specification { overflow: visible; }
  .learning-specification tbody tr { break-inside: avoid; }
  .learning-specification td { overflow: visible; }
}

/* Appendix: occupancy map of familiar learning problems. */
.occupancy-map{--l:var(--bs-border-color,#dee2e6);--m:var(--bs-secondary-color,#626970);max-width:100%;overflow:visible;margin:1.5rem 0 .5rem;font-size:.78rem;line-height:1.35}
.occupancy-map table{width:100%;border-collapse:collapse;margin:0;table-layout:fixed}
.occupancy-map table th,.occupancy-map table td{font-size:.78rem!important;line-height:1.35;padding:.3rem .45rem;vertical-align:top;text-align:left;border:0;background:transparent}
.occupancy-map table thead th{font-size:.74rem!important;font-weight:700;color:var(--bs-body-color,#212529);border-bottom:1.5px solid var(--bs-body-color,#212529)}
.occupancy-map thead th:nth-child(1){width:17%}
.occupancy-map thead th:nth-child(2){width:15%}
.occupancy-map .occ-sub{display:block;font-weight:400;font-size:.68rem;color:var(--m);margin-top:.1rem}
.occupancy-map tbody th{font-weight:650}
.occupancy-map tr.occ-first>*{border-top:1px solid var(--l)}
.occupancy-map tbody tr:first-child>*{border-top:0}
.occupancy-map tr.occ-cyclic>th,.occupancy-map tr.occ-cyclic>td{background:rgba(214,120,20,.05)!important}
.occupancy-map td.occ-ct{color:var(--m)}
.occupancy-map td.occ-x{color:var(--m);opacity:.55}
.occupancy-map td.occ-g{color:var(--m)}
.occupancy-map td[title]{cursor:help}
.occupancy-map a{color:inherit;text-decoration:underline;text-decoration-color:rgba(127,127,127,.35);text-underline-offset:2px}
.occupancy-map a:hover{color:var(--bs-link-color,#2673c9);text-decoration-color:currentColor}
.occupancy-map td.occ-t{font-style:italic}
.occupancy-map td.occ-e,.occupancy-map .occ-gap{color:#c0650e;font-weight:700}
.occupancy-map .occ-near{display:block;font-size:.68rem;color:var(--m);font-weight:400}
.occupancy-map .occ-near a{color:inherit;text-decoration:underline;text-decoration-color:rgba(127,127,127,.4)}
.occ-caption{font-size:.8rem;color:var(--bs-secondary-color,#626970);margin-bottom:1.5rem}
.occ-caption .occ-t{font-style:italic}
.occ-caption .occ-e{color:#c0650e;font-weight:700}

/* Appendix derivations: compact component table. */
.derivation-fix{max-width:100%;overflow:visible;margin:.25rem 0 .75rem}
.derivation-fix table{width:100%;margin:0;border-collapse:collapse}
.derivation-fix table th,.derivation-fix table td{font-size:.8rem!important;line-height:1.35;padding:.3rem .7rem .3rem 0;border:0;background:transparent;vertical-align:top}
.derivation-fix thead th{font-weight:650;border-bottom:1.5px solid var(--bs-body-color,#212529)!important}
.derivation-fix tbody tr+tr td{border-top:1px solid var(--bs-border-color,#dee2e6)}
.derivation-fix colgroup{display:none}
.derivation-fix table td:first-child,.derivation-fix table th:first-child{white-space:normal}

/* Expanded code belongs to the page, including long source lines. */
main.content div.sourceCode,
main.content pre.sourceCode,
main.content pre,
main.content pre code {
  overflow: visible;
  max-height: none;
  max-width: 100%;
}
main.content pre,
main.content pre code,
main.content pre code > span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.responsive-row-context { display: none; }
/* Results: experiments in reading order, with one column per method. */
.results-overview { --result-line: var(--bs-border-color, #dee2e6); }
.results-overview table { width: 100%; table-layout: fixed; margin-bottom: .5rem; }
.results-overview colgroup { display: none; }
.results-overview :is(th, td) {
  padding: .65rem .7rem;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
  font-size: .9rem;
  line-height: 1.45;
  background: transparent;
  box-shadow: none;
}
.results-overview :is(th, td):first-child { width: 27%; padding-left: 0; }
.results-overview thead th {
  padding-top: .35rem;
  padding-bottom: .35rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--bs-secondary-color, #626970);
  border-bottom: 1px solid var(--result-line);
}
.results-overview tbody td { border-bottom: 1px solid var(--result-line); }
.results-overview tbody td a { text-underline-offset: .17em; }
.results-overview tbody td:first-child > span[id] { display: block; margin-bottom: .3rem; font-weight: 600; }
@media (max-width: 720px) {
  .responsive-article-table,
  .responsive-article-table tbody,
  .responsive-article-table tr,
  .responsive-article-table :is(th, td) {
    display: block;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
  }
  .responsive-article-table colgroup { display: none; }
  .responsive-article-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .responsive-article-table tbody tr {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding: .7rem 0;
  }
  .responsive-article-table tbody :is(th, td) {
    padding: .35rem 0;
    border: 0 !important;
    overflow-wrap: anywhere;
    font-size: .85rem !important;
    line-height: 1.5;
  }
  .responsive-article-table tbody :is(th, td)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .1rem;
    color: var(--bs-secondary-color, #626970);
    font-size: .7rem;
    font-weight: 600;
    font-style: normal;
  }
  .responsive-article-table tbody td > p:last-child { margin-bottom: 0; }
  main.content .appendix-disclosure-body { padding-left: .25rem; }
}

/* On narrow screens each experiment stacks labelled method results. */
@media (max-width: 720px) {
  .results-overview .responsive-article-table tbody tr { padding: .6rem 0; }
  .results-overview .responsive-article-table tbody td { padding: .35rem 0; }
  .results-overview .responsive-article-table tbody td:first-child::before { display: none; }
}

/* Appendix details: compact headings, with the source content left intact. */
.appendix-fold > .appendix-disclosure {
  margin: .65rem 0;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}
.appendix-disclosure > summary {
  padding: .65rem .1rem;
  cursor: pointer;
  line-height: 1.5;
}
.appendix-disclosure > summary::marker { color: var(--bs-link-color, #2673c9); }
.appendix-disclosure > summary:hover { color: var(--bs-link-color, #2673c9); }
.appendix-disclosure > summary:focus-visible {
  outline: 2px solid var(--bs-link-color, #2673c9);
  outline-offset: 3px;
}
.appendix-disclosure > summary > :is(h2, h3) {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1rem;
  line-height: inherit;
}
.appendix-disclosure > summary .anchorjs-link { display: none; }
.appendix-disclosure-body { min-width: 0; padding: .35rem 0 .65rem 1.1rem; }
.appendix-fold { scroll-margin-top: calc(var(--quarto-body-offset, 0px) + 24px); }
@media print {
  .appendix-disclosure > summary { list-style: none; }
  .appendix-disclosure-body { padding-left: 0; }
}

/* Social CartPole: synchronized tabs in every section, Markdown panels. */
.social-cartpole {
  --cartpole-accent: #246d9e;
  --cartpole-border: var(--bs-border-color, #d9e1e5);
  min-width: 0;
}
.cartpole-method-card {
  position: relative;
  isolation: isolate;
  min-width: 0;
  margin: 1rem 0 1.5rem;
}
/* Quarto widens containers with margin notes. Paint only the article column. */
.cartpole-method-card::before {
  content: "";
  position: absolute;
  inset: 0;
  grid-column: body-content-start / body-content-end;
  z-index: -1;
  pointer-events: none;
  border: 1px solid var(--cartpole-border);
  border-radius: 8px;
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 2px 4px rgb(0 0 0 / 5%), 0 10px 24px -12px rgb(0 0 0 / 20%);
}
.cartpole-method-selector {
  padding: .35rem .7rem 0;
  margin: 0;
  border-bottom: 1px solid var(--cartpole-border);
  font-family: var(--bs-font-sans-serif, system-ui, sans-serif);
  font-size: .7rem;
}
.cartpole-method-selector[hidden],
.cartpole-method[hidden] { display: none !important; }
.cartpole-method-buttons { display: flex; gap: 0 .15rem; flex-wrap: wrap; }
.cartpole-method-buttons button {
  appearance: none;
  padding: .4rem .5rem .5rem;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 3px 3px 0 0;
  color: var(--bs-body-color, #27313a);
  background: transparent;
  font: inherit;
  line-height: 1.4;
  font-weight: 500;
  cursor: pointer;
}
.cartpole-method-buttons button[aria-selected="true"] {
  color: var(--cartpole-accent);
  background: rgb(36 109 158 / 5%);
  border-bottom-color: var(--cartpole-accent);
  font-weight: 600;
}
.cartpole-method-buttons button:hover { background: rgb(36 109 158 / 5%); }
.cartpole-method-buttons button:focus-visible {
  outline: 2px solid var(--cartpole-accent);
  outline-offset: -3px;
}
.cartpole-method {
  --cartpole-panel-inset: 1.15rem;
  margin: 0;
  padding: 1rem var(--cartpole-panel-inset) 1.2rem;
  min-width: 0;
}
/* In Quarto's margin-note grid, inset the article cells, not the full-page grid. */
.cartpole-method.page-columns { padding-inline: 0; }
:is(.cartpole-method.page-columns, .cartpole-method .page-columns)
  > :not(.page-columns):not(.column-margin) {
  margin-inline: var(--cartpole-panel-inset);
  max-width: calc(100% - 2 * var(--cartpole-panel-inset));
}
.cartpole-method-card:not([data-tabs-ready]) > .cartpole-method + .cartpole-method {
  border-top: 1px solid var(--cartpole-border);
}
.cartpole-method > :last-child { margin-bottom: 0; }
/* Pending plans and completed reports share one editable source block.
 * Set data-experiment-status="ready" only after replacing and reviewing fields. */
.cartpole-experiment:not([data-experiment-status="ready"]) > .experiment-results,
.cartpole-experiment[data-experiment-status="ready"] > .experiment-plan {
  display: none;
}
.experiment-plan > p:first-child {
  color: var(--bs-secondary-color, #626970);
  font-family: var(--bs-font-sans-serif, system-ui, sans-serif);
  font-size: .8rem;
}
.cartpole-experiment > div > :last-child { margin-bottom: 0; }
.cartpole-question { scroll-margin-top: calc(var(--quarto-body-offset, 0px) + 24px); }
.cartpole-question h2, .cartpole-method [id] {
  scroll-margin-top: calc(var(--quarto-body-offset, 0px) + 24px);
}
@media (max-width: 560px) {
  .cartpole-method-selector { padding: .25rem .4rem 0; font-size: .68rem; }
  .cartpole-method-buttons { gap: 0 .1rem; }
  .cartpole-method-buttons button { padding: .45rem .4rem; }
  .cartpole-method { --cartpole-panel-inset: .8rem; padding: .85rem var(--cartpole-panel-inset) 1rem; }
}
@media print {
  .cartpole-method-card::before { box-shadow: none; }
  .cartpole-method-selector { display: none !important; }
  .cartpole-method[hidden] { display: block !important; }
}
/* Release scope applies to screen and print; all five methods stay in source. */
.cartpole-method-buttons button[hidden],
.cartpole-method[data-release-deferred="true"],
.results-overview [data-release-deferred="true"] { display: none !important; }
