/* ============================================================
   Agentum · Learn wiki — docs layout (sidebar + article + TOC).
   Builds on /ds/styles.css tokens and the .ara theme vars from
   /ds/learn.css (which every wiki page also links). Self-hosted
   lecture pages, EN + ES.
   ============================================================ */

/* layout shell — solid full-width content below the topbar (the topbar stays
   over the textured background). Wide sidebar + toc, like a docs wiki. */
/* Solid content area that begins below the 64px topbar. We paint the solid via
   a ::before pinned to top:64px (not margin-top, which would collapse and drag
   the absolutely-positioned nav down with it). The nav floats over the textured
   strip at the very top. */
.docwrap { position: relative; z-index: 1; padding-top: 64px; min-height: 100vh; }
.docwrap::before { content: ""; position: absolute; left: 0; right: 0; top: 64px; bottom: 0;
  background: var(--panel); border-top: 1px solid var(--panel-line); z-index: -1; }
.docs { max-width: 1560px; margin: 0 auto; padding: 40px 34px 72px; display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 232px; gap: 60px; align-items: start; }
@media (max-width: 1180px) { .docs { grid-template-columns: 240px minmax(0,1fr); gap: 44px; } .toc { display: none; } }
@media (max-width: 840px) { .docs { grid-template-columns: 1fr; padding: 28px 22px 48px; } .sidebar { display: none; } }

/* sidebar */
.sidebar { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 104px); overflow-y: auto;
  padding-right: 6px; padding-bottom: 24px; }
.sidebar .sgroup + .sgroup { margin-top: 22px; }
.sidebar .sh { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); padding: 0 10px 8px; }
.sidebar a { display: flex; gap: 9px; align-items: baseline; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 13.5px; line-height: 1.35; transition: color .14s, background .14s; }
.sidebar a:hover { color: var(--text); background: var(--surface-2); }
.sidebar a.on { color: var(--text); background: var(--surface-2); font-weight: 500; }
.sidebar a .sn { font-family: var(--mono); font-size: 11px; color: var(--text-3); flex: none; min-width: 1.4em; }
.sidebar a.on .sn { color: var(--agent-claude); }
.sidebar::-webkit-scrollbar { width: 8px; } .sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }

/* mobile lecture picker (shown < 800px) */
.mobnav { display: none; }
@media (max-width: 800px) { .mobnav { display: block; margin-bottom: 22px; }
  .mobnav select { width: 100%; padding: 11px 12px; border-radius: var(--radius-md); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; } }

/* article — sits directly on the solid wrap; a wider, comfortable reading column */
.article { min-width: 0; padding-bottom: 56px; }
.article p, .article li { max-width: 78ch; }
.crumb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-bottom: 22px; }
.crumb-row a { color: var(--text-3); } .crumb-row a:hover { color: var(--text-2); }
.crumb-row .sep { opacity: .5; }
.article .lead-n { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--agent-claude); }
.article h1 { font-family: var(--uifont); font-size: clamp(34px, 4.4vw, 52px); line-height: 1.07; letter-spacing: -0.03em; font-weight: 500; margin: 14px 0 0; color: var(--text); }
.article .lead { font-size: clamp(18px, 1.6vw, 22px); color: var(--text-2); line-height: 1.6; margin: 22px 0 0; }
.article .rule { height: 1px; background: var(--line); margin: 36px 0; border: 0; }

.article h2 { font-family: var(--uifont); font-size: clamp(23px, 2.5vw, 31px); line-height: 1.2; letter-spacing: -0.02em; font-weight: 500; margin: 50px 0 0; color: var(--text); scroll-margin-top: 88px; }
.article h2:first-of-type { margin-top: 10px; }
.article h3 { font-size: 18px; font-weight: 600; margin: 30px 0 0; color: var(--text); }
.article p { font-size: 17.5px; line-height: 1.75; color: var(--text-2); margin: 18px 0 0; }
.article p strong, .article li strong { color: var(--text); font-weight: 600; }
.article em { color: var(--text); font-style: italic; }
.article a.ilink { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: text-decoration-color .15s; }
.article a.ilink:hover { text-decoration-color: var(--agent-claude); }
.article ul, .article ol { margin: 18px 0 0; padding-left: 24px; }
.article li { font-size: 17.5px; line-height: 1.7; color: var(--text-2); margin: 10px 0 0; }
.article li::marker { color: var(--text-3); }
.article code { font-family: var(--mono); font-size: 0.88em; color: var(--text); background: var(--surface-2); padding: 1.5px 6px; border-radius: var(--radius-xs); border: 1px solid var(--line-2); }

/* callout */
.callout { margin: 24px 0 0; border: 1px solid var(--line-2); border-left: 3px solid var(--agent-claude); background: var(--surface); border-radius: var(--radius-md); padding: 16px 18px; }
.callout .cl-h { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--agent-claude); }
.callout p { margin-top: 8px; font-size: 15px; }

/* analogy callout — friendly framing near the top of each lecture */
.analogy { margin: 24px 0 0; border: 1px solid var(--line-2); background: var(--surface-2); border-radius: var(--radius-md); padding: 18px 20px; }
.analogy .an-h { display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 600; color: var(--text); }
.analogy .an-h .an-ic { font-size: 16px; line-height: 1; }
.analogy p { margin: 10px 0 0; font-size: 15.5px; color: var(--text-2); line-height: 1.62; }

/* mermaid diagram */
.diagram { margin: 28px 0 0; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-md); padding: 32px 26px; overflow-x: auto; }
.diagram pre.mermaid { margin: 0; padding: 0; background: transparent; border: 0; text-align: center; min-height: 80px; font-family: var(--mono); }
.diagram pre.mermaid svg, .diagram svg { width: 100% !important; max-width: 1040px; height: auto; display: block; margin: 0 auto; }
.diagram .dcap { margin-top: 18px; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--text-3); }

/* exercises */
.exercises { margin: 18px 0 0; }
.exercises ol { padding-left: 22px; }
.exercises li { margin-top: 12px; }
.exercises li strong { color: var(--text); }

/* based-on link to the source course */
.basedon { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-3); }
.basedon a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.basedon a:hover { color: var(--text); }

/* sidebar footer: link to the source course */
.sidebar .scourse { margin: 16px 10px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar .scourse a { display: block; padding: 0; color: var(--text-3); font-size: 12px; line-height: 1.5; }
.sidebar .scourse a:hover { color: var(--text-2); background: none; }

/* code block */
.code { margin: 22px 0 0; border: 1px solid var(--line-2); border-radius: var(--radius-md); overflow: hidden; background: #050506; box-shadow: var(--shadow-md); }
.code .ctop { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid rgba(255,255,255,0.08); background: #121215; }
.code .ctop i { width: 9px; height: 9px; border-radius: 999px; background: #2f2f2f; display: inline-block; }
.code .ctop i:nth-child(1){ background:#ff5f57;} .code .ctop i:nth-child(2){ background:#febc2e;} .code .ctop i:nth-child(3){ background:#28c840;}
.code .ctop .cf { margin-left: 6px; font-family: var(--font-term); font-size: 11px; color: #6e6e6e; }
.code pre { margin: 0; padding: 15px 16px; overflow-x: auto; font-family: var(--font-term); font-size: 12.5px; line-height: 1.65; color: #c9c9c9; }
.code .cm { color: #6e6e6e; } .code .kw { color: #d08770; } .code .fn { color: #79c0ff; } .code .st { color: #3fb950; } .code .nu { color: #bc8cff; }

/* resources page */
.res-wrap { max-width: 940px; margin: 0 auto; padding: 40px 40px 72px; }
.res-wrap .lead { margin-top: 18px; }
.code .ctop { justify-content: flex-start; }
.code .copybtn { margin-left: auto; border: 1px solid rgba(255,255,255,0.16); border-radius: 999px; padding: 3px 12px; font-family: var(--font-term); font-size: 11px; color: #a3a3a3; background: transparent; cursor: pointer; transition: color .15s, border-color .15s; }
.code .copybtn:hover { color: #fff; border-color: rgba(255,255,255,0.32); }
.code .copybtn.done { color: #3fb950; border-color: #3fb950; }

/* takeaways */
.takeaways { margin: 24px 0 0; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-md); padding: 20px 22px; }
.takeaways .tk-h { font-family: var(--uifont); font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.takeaways ul { padding-left: 20px; }

/* further reading */
.reading { margin: 16px 0 0; display: flex; flex-direction: column; gap: 0; }
.reading a { display: flex; align-items: baseline; gap: 8px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--text-2); }
.reading a:first-child { border-top: 0; }
.reading a:hover { color: var(--text); }
.reading a .ar { color: var(--text-3); font-family: var(--mono); font-size: 12px; }

/* prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } }
.pager a { border: 1px solid var(--line-2); border-radius: var(--radius-md); padding: 16px 18px; transition: border-color .15s, transform .15s, background .15s; }
.pager a:hover { border-color: var(--border-strong); transform: translateY(-2px); background: var(--surface-hover); }
.pager .pl { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.pager .pt { color: var(--text); font-size: 15px; margin-top: 7px; line-height: 1.3; }
.pager a.next { text-align: right; }

/* TOC */
.toc { position: sticky; top: 88px; align-self: start; font-size: 13px; }
.toc .toc-h { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 12px; }
.toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); color: var(--text-3); line-height: 1.4; transition: color .14s, border-color .14s; }
.toc a:hover, .toc a.on { color: var(--text); border-color: var(--agent-claude); }

/* lectures index grid */
.idx-hero { max-width: 1340px; margin: 0 auto; padding: 44px 40px 0; }
.idx-hero .eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-3); }
.idx-hero h1 { font-family: var(--uifont); font-size: clamp(32px, 4.5vw, 56px); line-height: 1.04; letter-spacing: -0.03em; font-weight: 500; margin: 14px 0 0; color: var(--text); max-width: 18ch; }
.idx-hero p { font-size: clamp(16px,1.4vw,19px); color: var(--text-2); max-width: 60ch; margin: 18px 0 0; line-height: 1.6; }
.idx-grid { max-width: 1340px; margin: 0 auto; padding: clamp(28px,3.5vw,44px) 40px clamp(48px,6vw,72px);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 760px) { .idx-grid { grid-template-columns: 1fr; } }
.idx-card { display: block; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-md); padding: 20px 22px; transition: border-color .15s, transform .15s, background .15s; }
.idx-card:hover { border-color: var(--border-strong); transform: translateY(-2px); background: var(--surface-hover); }
.idx-card .ic-n { font-family: var(--mono); font-size: 11px; color: var(--agent-claude); }
.idx-card h3 { font-family: var(--uifont); font-size: 18px; font-weight: 500; margin: 9px 0 0; color: var(--text); letter-spacing: -0.01em; line-height: 1.25; }
.idx-card p { font-size: 14px; color: var(--text-2); margin: 9px 0 0; line-height: 1.5; }
