/* robotparts.dev analyses (docs/peps/0002-analyses.md): the /analysis/ list and the /analysis/<slug>/ report.
   Colours are the site's tokens (static/site.css: --bg, --ink, --rule, --accent, …), so light and dark follow it.
   WHY a report reads like W&B's: a narrow contents column on the left (drag-resizable, Zach's standing rule), the
   article in a readable measure, and panels (views, dashboards) allowed wider than the prose. */

/* ---- the list ---- */
.an-listhead { max-width: 64rem; margin: 4px 0 12px; }
.an-listhead h1 { margin: 0 0 4px; }
.an-lede { margin: 0 0 6px; color: var(--ink2); max-width: 52rem; }
.an-mut { color: var(--ink3); font-size: 13px; }
#analysis-list { --data-height: min(72vh, 900px); }
.an-fallback { margin: 8px 12px; padding-left: 18px; }
.an-how { margin: 16px 0; max-width: 64rem; }
.an-how summary { cursor: pointer; color: var(--accent); }
.an-how pre { overflow-x: auto; background: var(--bg2); padding: 8px 10px; border-radius: 3px; }

/* ---- the report: contents | article ---- */
.an-layout { position: relative; display: flex; align-items: flex-start; gap: 0; min-width: 0; }
.an-toc { position: sticky; top: 8px; flex: none; width: var(--data-panel-width, 13rem); max-height: calc(100vh - 16px); overflow-y: auto;
  padding: 8px 14px 16px 0; border-right: 1px solid var(--rule2); font-size: 13px; box-sizing: border-box; }
.an-toc-h { margin: 0 0 6px; font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.an-toc ul { list-style: none; margin: 0; padding: 0; }
.an-toc li { margin: 0; }
.an-toc a { display: block; padding: 3px 6px; border-radius: 3px; color: var(--ink2); text-decoration: none; overflow-wrap: anywhere; }
.an-toc a:hover { background: var(--hover); color: var(--ink); }
.an-toc .an-toc-sub a { padding-left: 18px; font-size: 12.5px; }
.an-main { flex: 1 1 auto; min-width: 0; padding: 4px 0 40px 28px; }
#analysis-body { max-width: 72rem; }
.an-md { max-width: 46rem; line-height: 1.55; }
.an-md h2, .an-md h3 { scroll-margin-top: 12px; }
.an-md h2 { margin: 28px 0 8px; padding-top: 4px; border-top: 1px solid var(--rule2); }
.an-md table { border-collapse: collapse; margin: 10px 0; font-size: 13.5px; display: block; overflow-x: auto; max-width: 100%; }
.an-md th, .an-md td { border: 1px solid var(--rule2); padding: 4px 8px; text-align: left; vertical-align: top; }
.an-md th { background: var(--bg2); font-weight: 600; }
.an-md pre { overflow-x: auto; background: var(--bg2); padding: 8px 10px; border-radius: 3px; }
.an-md code, .an-head code, .an-callout code { font-family: var(--mono); font-size: .92em; }

/* ---- the header: status, question, parts, decision, the file ---- */
.an-head { max-width: 72rem; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.an-head h1 { margin: 6px 0 4px; font-size: 26px; line-height: 1.2; }
.an-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0; color: var(--ink3); font-size: 12.5px; }
.an-q { margin: 4px 0 12px; font-size: 16px; color: var(--ink2); max-width: 52rem; }
.an-status, .an-pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--rule); color: var(--ink2); background: var(--bg); }
.an-status-decided { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.an-status-open { border-color: var(--accent); color: var(--accent); }
.an-status-superseded { text-decoration: line-through; }
.an-src-example { background: var(--band); border-color: var(--band); color: #222; }
.an-src-yours { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.an-pill-chosen { margin-left: 6px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 11px; }
.an-vis { font-style: italic; }
.an-parts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; padding: 0; }
.an-part { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--rule2); border-radius: 4px; background: var(--bg); min-width: 0; max-width: 100%; }
.an-part img, .an-nophoto { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 3px; flex: none; }
.an-nophoto { background: var(--bg2); }
.an-part-name { font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.an-part.an-chosen { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.an-verdict { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.an-file { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; color: var(--ink3); }
.an-file-path { min-width: 0; overflow-wrap: anywhere; }
.an-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.an-btn { font: inherit; font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); color: var(--ink); cursor: pointer; text-decoration: none; }
.an-btn:hover { background: var(--hover); }
.an-warn { color: var(--warn); }
.an-problems { margin: 0 0 16px; padding: 8px 12px; border: 1px solid var(--warn); border-left-width: 4px; border-radius: 3px; color: var(--ink); max-width: 72rem; }
.an-problems ul { margin: 4px 0 0; padding-left: 18px; font-family: var(--mono); font-size: 12.5px; }
.an-err { color: var(--warn); font-family: var(--mono); font-size: 12.5px; padding: 8px; }

/* ---- embeds: a view or a dashboard, wider than the prose ---- */
.an-embed { margin: 14px 0 18px; min-width: 0; }
.an-embed-box { min-width: 0; }
.an-embed-cap { margin-top: 4px; font-size: 11.5px; color: var(--ink3); }
.an-embed data-dashboard { display: block; }

/* ---- callouts (Obsidian's > [!type]) ---- */
.an-callout { margin: 14px 0; padding: 10px 14px; border: 1px solid var(--rule2); border-left: 4px solid var(--ink3); border-radius: 3px; background: var(--bg); max-width: 46rem; }
.an-callout-title { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-weight: 600; }
.an-callout-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); }
.an-callout-body { line-height: 1.5; }
.an-callout-body > :first-child { margin-top: 6px; }
.an-callout-body > :last-child { margin-bottom: 0; }
.an-callout summary { cursor: pointer; list-style: none; }
.an-callout-example { border-left-color: var(--band); }
.an-callout-illustrative { border-left-color: var(--ink3); border-style: dashed; border-left-style: solid; }
.an-callout-illustrative .an-callout-label { color: var(--ink2); }
.an-callout-warning { border-left-color: var(--warn); }
/* the AI's read: judgement, set apart from the numbers (PEP 0002 §11) */
.an-callout-ai { border: 1px dashed var(--accent); border-left: 4px solid var(--accent); }
.an-callout-ai .an-callout-label { color: var(--accent); }
.an-src-stock { border-color: var(--accent); color: var(--accent); }
.an-pill-private { border-color: var(--warn); color: var(--warn); }

/* ---- the part page's Analysis tab ---- */
.an-tab { margin: 0 0 24px; }
.an-tab .an-title { font-size: 21px; margin: 6px 0 4px; line-height: 1.25; }
.an-tab .an-toc { top: 0; }
.an-none { color: var(--ink2); }
.an-mentions { list-style: none; padding: 0; margin: 6px 0; }
.an-mention { padding: 8px 0; border-bottom: 1px solid var(--rule2); overflow-wrap: anywhere; }
.an-mention .an-status, .an-mention .an-pill { margin-left: 4px; }
.an-q-small { color: var(--ink2); font-size: 13px; }
.an-also summary { cursor: pointer; color: var(--accent); margin: 6px 0; }
/* the build's copy of a stock analysis (build/site_part_analysis.py static_report; judge r1 finding 6): what a reader
   without JavaScript gets, shown until the kit's element has drawn. WHY absolute, not display:none: the element still
   needs its real width while it draws (static/analysis.js shown()), but must neither show nor take space until then */
#stock-analysis { position: relative; }
#stock-analysis > data-analysis:not([data-drawn]) { position: absolute; top: 0; left: 0; right: 0; height: 0; overflow: hidden; visibility: hidden; }
.an-static .an-actions { flex-basis: 100%; } /* the drawn header's buttons wrap to their own line; so does the copy's one link */
.an-static-view { border-collapse: collapse; margin: 10px 0; font-size: 13.5px; }
.an-static-view caption { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink2); padding: 0 0 4px; }
.an-static-view th, .an-static-view td { border: 1px solid var(--rule2); padding: 4px 8px; text-align: left; vertical-align: top; }
.an-static-view th { background: var(--bg2); font-weight: 600; }
/* WHY scripting-only: with JavaScript the copy is replaced by the kit's drawing, whose view box is 380 px for a compare
   view and 420 px for a chart (data-ui's _embed; a table, cards or a list take their content's height), so the copy
   holds the same box and the swap does not move what is below it; without JavaScript every row shows unboxed */
@media (scripting: enabled) {
  .an-static .an-embed[data-first="compare"] > .an-embed-box { height: 380px; overflow: auto; }
  .an-static .an-embed:not([data-first="compare"], [data-first="table"], [data-first="cards"], [data-first="list"]) > .an-embed-box { height: 420px; overflow: auto; }
}
/* the verdict box: the report's decision (W&B reports' conclusion, MADR's "Chosen option") */
.an-callout-decision { border: 1px solid var(--accent); border-left: 6px solid var(--accent); background: var(--accent-bg); max-width: 52rem; padding: 12px 16px; scroll-margin-top: 12px; }
.an-callout-decision .an-callout-title { font-size: 17px; }
.an-callout-decision .an-callout-label { color: var(--accent); }

/* ---- a phone: the contents fold above the article, nothing wider than the screen ---- */
@media (max-width: 760px) {
  .an-layout { flex-direction: column; }
  .an-toc { position: static; width: 100%; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule2); padding: 4px 0 8px; }
  .an-toc ul { display: flex; flex-wrap: wrap; gap: 2px 4px; }
  .an-toc .an-toc-sub a { padding-left: 6px; }
  .an-main { padding: 10px 0 32px; width: 100%; }
  .an-head h1 { font-size: 22px; }
  .an-part { flex: 1 1 100%; }
}
