/* Tensor companions use counted cells and labels so axis meanings remain explicit. */
.tensor-guide{margin:28px 0 36px;padding:clamp(12px,2.5vw,22px);border:1px solid #dce4f0;border-radius:12px;background:#f8faff;font: .875rem/1.7 'DM Sans',system-ui,sans-serif;color:#344b70;min-width:0}
.tensor-guide-title{font:600 1.05rem/1.5 'Manrope',system-ui,sans-serif;color:#253c60;margin-bottom:16px}
.tensor-guide-panel{border:1px solid #dbe3ed;border-radius:8px;padding:12px;background:#fff;min-width:0;margin:12px 0}
.tensor-guide-panel p{font:inherit;color:inherit;margin:12px 0 0}
.tensor-guide-subtitle{font-weight:600;line-height:1.6;margin-bottom:10px}
.tensor-guide-key{display:flex;flex-wrap:wrap;gap:10px 20px;margin:16px 0}
.tensor-guide-key>div{flex:1 1 130px;min-width:0}
.tensor-guide-key dt{font-weight:700;color:#285192;font-size:.9375rem}
.tensor-guide-key dd{margin:3px 0 0;font-size:.8125rem;line-height:1.6}
.tensor-guide-vector{display:flex;gap:8px;max-width:330px;margin:14px auto}
.tensor-guide-vector>span{flex:1;min-width:0;padding:10px;text-align:center;border:1px solid #cbd8ee;border-radius:5px;background:#eef3ff;font:600 1.1rem/1.5 'SFMono-Regular',Consolas,monospace}
.tensor-guide-axis{font-size:.8125rem;line-height:1.65;text-align:center;color:#536784;margin:10px 0;overflow-wrap:anywhere}
.tensor-guide-table{width:100%;border-collapse:separate;border-spacing:4px;table-layout:fixed;margin:0;font-size:.75rem;line-height:1.6}
.tensor-guide-table caption{font-size:.875rem;font-weight:600;text-align:left;padding:0 4px 10px;color:#344b70}
.tensor-guide-table th{font-weight:500;padding:4px 0;text-align:center;overflow-wrap:anywhere}
.tensor-guide-table th[scope=row]{text-align:left}
.tensor-guide-table td:not(:first-child){background:#eaf2ff;border-radius:4px;text-align:center;padding:7px 0;font:500 .875rem/1.6 'SFMono-Regular',Consolas,monospace}
.tensor-guide-table thead td{background:none}
.tensor-guide-features{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-width:330px;margin:12px auto;text-align:center}
.tensor-guide-features>div{padding:10px 4px;border-radius:6px;background:#e8f4ef;color:#235e4b}
.tensor-guide-features small{display:block;font-size:.75rem}
.tensor-guide-features strong{display:block;font:600 1.3rem/1.7 'SFMono-Regular',Consolas,monospace}
.tensor-guide-collection{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr));gap:12px;margin:16px 0}
.tensor-guide-collection>.tensor-guide-panel{margin:0;padding:10px}
.tensor-guide-indexing{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:10px 14px;align-items:baseline;padding:16px 0;border-top:1px solid #dce4f0;font-size:.8125rem}
.tensor-guide-indexing code{font-size:.8125rem}
.tensor-guide-image{display:grid;grid-template-columns:22px minmax(0,1fr);gap:6px}
.tensor-guide-height{writing-mode:vertical-rl;transform:rotate(180deg);font-size:.75rem;text-align:center}
.tensor-guide-pixels{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.tensor-guide-pixel{padding:9px 3px;text-align:center;background:#fafbfe;border:1px solid #cbd6e6;border-radius:5px;font-size:.75rem}
.tensor-guide-pixel>div{display:flex;justify-content:center;gap:3px;margin-top:5px}
.tensor-guide-pixel b{font-size:.625rem;font-weight:600;min-width:14px;padding:1px 2px;border-radius:2px}
.tensor-guide-selected{outline:2px solid #345ed0;outline-offset:1px}
.tensor-guide-rgb{grid-template-columns:repeat(3,minmax(0,1fr))}
.tensor-guide .tensor-guide-red{background:#fcebea;color:#9a3936}
.tensor-guide .tensor-guide-green{background:#e8f4ef;color:#235e4b}
.tensor-guide .tensor-guide-blue{background:#eaf0ff;color:#274584}
.tensor-guide figcaption{font:inherit;line-height:1.8;margin-top:14px;color:#465c78}
@media(max-width:480px){.tensor-guide-indexing{grid-template-columns:minmax(0,1fr);gap:4px}.tensor-guide-indexing span{margin-bottom:8px}.tensor-guide-key{gap:10px}.tensor-guide-key>div{flex-basis:110px}}
/* A continuous lecture, with quiet marginal labels and room to read. */
.lecture-check-in{margin:2rem 0 2.5rem;padding:1.25rem 1.4rem;border-left:3px solid #8aa7dc;background:#f5f8fd;font:1rem/1.8 'DM Sans',system-ui,sans-serif;color:#2e405c;scroll-margin-top:28px}
.lecture-check-in .check-in-label{margin:0 0 .4rem;color:#536b91;font-size:.8rem;font-weight:600;letter-spacing:.02em}
.lecture-check-in h4{margin:0 0 .65rem;font:600 1.1rem/1.5 'Manrope',system-ui,sans-serif;color:#243b61;text-wrap:balance}
.lecture-check-in .check-in-context{margin:0 0 .8rem}
.lecture-check-in summary{cursor:pointer;color:#3056a5;min-height:44px;padding:.5rem 0;font-weight:600}
.lecture-check-in ol{padding-left:1.4rem;margin:.25rem 0 .75rem}
.lecture-check-in li{padding-left:.25rem;margin:.7rem 0}
.lecture-check-in .check-in-instruction{margin:.8rem 0 0;color:#5b6c85;font-size:.875rem}
@media(max-width:720px){.lecture-check-in{padding:1rem;margin:1.75rem 0 2rem}}
@media print{.lecture-check-in{background:transparent;border-color:#8b96a6;font-size:10pt;break-inside:avoid}}
#main.is-lecture{max-width:1220px}
.is-lecture .lesson-heading,.is-lecture .tabs{max-width:820px}
.is-lecture .breadcrumb{margin-bottom:20px;flex-wrap:wrap;row-gap:4px}
.is-lecture .lesson-heading{margin-bottom:12px}
.is-lecture .lesson-heading h1{margin:10px 0 0;text-wrap:balance}
.is-lecture .tabs{margin:0 0 20px}
.is-lecture .tab{min-height:44px;padding:10px 1px;font-weight:600}
.is-lecture .eyebrow{font-size:.8rem}
.is-lecture .lesson-intro{display:none}
.lecture-chapter{max-width:820px;min-width:0;padding-bottom:30px}
.chapter-byline{font-size:.95rem;color:#637087;line-height:1.7;margin-bottom:12px}
.chapter-byline span{margin:0 8px}
.chapter-contents{margin:0 0 24px;font-size:.95rem}
.chapter-contents>summary{cursor:pointer;color:#3056a5;min-height:44px;line-height:24px;padding:10px 0}
.chapter-contents nav{display:grid;gap:5px;margin-top:12px;max-width:720px}
.chapter-contents button{text-align:left;color:#354b73;font-size:.95rem;line-height:1.65;min-height:44px;padding:8px 0}
.chapter-text{display:flow-root;font-family:Georgia,'Times New Roman',serif;font-size:1.16rem;line-height:1.88;color:#263247;overflow-wrap:break-word}
.chapter-text>p{font:inherit;margin:0 0 1.25em;max-width:72ch}
.chapter-text>h2,.chapter-text>h3{font-family:'Manrope',system-ui,sans-serif;font-size:1.45rem;line-height:1.45;letter-spacing:-.3px;color:#1e2e4b;margin:32px 0 12px;scroll-margin-top:28px;text-wrap:balance}
.chapter-code{margin:30px 0 36px;min-width:0;font-family:'DM Sans',system-ui,sans-serif;max-width:100%}
.chapter-code figcaption{font-size:.875rem;line-height:1.6;color:#4b5b76;display:flex;gap:8px 20px;justify-content:space-between;flex-wrap:wrap;margin-bottom:9px}
.chapter-code figcaption>span{font-weight:600}
.chapter-code figcaption>a{font-size:.8rem;color:#5c7097;text-decoration:none}
.chapter-code pre{margin:0;border:0;border-left:2px solid #d8e1ef;border-radius:0;background:#f6f8fb;color:#273449;font-size:.875rem;line-height:1.85;padding:18px 20px;overflow:auto;max-width:100%;tab-size:4}
.chapter-code pre code{font-size:inherit;white-space:pre;overflow-wrap:normal}
.chapter-equation{margin:28px 0 32px;max-width:100%;overflow-x:auto;font-size:1.05rem}
.chapter-equation .math-display{margin:0;background:transparent;padding:0}
.chapter-equation .katex-display{margin:.5em 0}
.chapter-equation figcaption{font: .9rem/1.75 'DM Sans',system-ui,sans-serif;color:#586b84;text-align:center;margin-top:10px}
.chapter-extras{border-top:1px solid #e0e6ef;margin-top:56px;padding-top:30px;scroll-margin-top:28px}
.chapter-extras>p{font-size:1rem;line-height:1.85;color:#59677c}
.chapter-experiment{padding:13px 0;border-bottom:1px solid #e7ebf2}
.chapter-experiment>summary{font-size:1rem;line-height:1.75;cursor:pointer;color:#3056a5}
.chapter-experiment .code-lab{border:0;padding:18px 0;margin:0;background:transparent}
.chapter-experiment label{display:block;font-size:.875rem;margin-bottom:12px;color:#617089}
.chapter-experiment .code-status{font-size:.875rem}
.chapter-footer{margin-top:42px;color:#68758b;font-size:.875rem;line-height:1.8}
.chapter-footer summary{cursor:pointer;padding:8px 0}
.chapter-footer p{margin:14px 0;font-size:.875rem;line-height:1.8}
.chapter-footer ul{padding-left:20px;columns:2}
.chapter-footer li{break-inside:avoid;margin-bottom:7px}
.chapter-pager{display:flex;gap:20px;justify-content:space-between;padding:32px 0 15px;font-size:1rem}
.chapter-loading{font-size:1rem;color:#637087;line-height:1.8}
.lecture-chapter [hidden]{display:none!important}
@media(max-width:720px){
 body:has(.is-lecture) .topbar{min-height:68px;padding:10px 18px;gap:8px;flex-wrap:nowrap}
 body:has(.is-lecture) .brand{flex-shrink:0}
 body:has(.is-lecture) .top-actions{min-width:0;gap:6px}
 body:has(.is-lecture) .save-status{min-width:0}
 body:has(.is-lecture) .menu-button{min-width:44px;min-height:44px;flex-shrink:0}
 #main.is-lecture{padding-top:20px}
 .is-lecture .breadcrumb{margin-bottom:16px}
 .is-lecture .tabs{margin-bottom:16px}
 .chapter-text{font-size:1.125rem;line-height:1.85}
 .chapter-text>h2,.chapter-text>h3{font-size:1.3rem}
 .chapter-code{margin:26px 0 30px}
 .chapter-code pre{padding:15px 13px;font-size:.875rem}
 .chapter-code figcaption{display:block}
 .chapter-code figcaption>a{display:block;font-size:.8rem;margin-top:3px}
 .chapter-byline{font-size:.9rem;margin-bottom:8px}
 .chapter-footer ul{columns:1}
}
@media print{.topbar,.sidebar,.tabs,.breadcrumb,.chapter-contents,.chapter-extras,.chapter-pager{display:none!important}.shell{display:block}#main.is-lecture{padding:0;max-width:none}.lecture-chapter{max-width:none}.chapter-text{font-size:11pt;line-height:1.5}.chapter-code pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:8pt}.chapter-code pre code{white-space:pre-wrap}.chapter-text>h2{break-after:avoid}}
.lecture-nav-group{margin-bottom:8px}.lecture-nav-title{display:flex;gap:10px;align-items:flex-start;text-decoration:none;color:#68768e;padding:13px 8px;font-size:.875rem;line-height:1.55}.lecture-nav-title>span:first-child{font-weight:700;color:#5874b1;min-width:22px}.lecture-nav-title strong{font-weight:600}.lecture-nav-title.current{color:#273b5a}.lecture-nav-arrow{margin-left:auto;flex-shrink:0;color:#7c89a1}.lecture-topic-list{border-left:1px solid #dfe5ef;margin:0 0 24px 19px;padding:5px 0 0 9px}.chapter-topic-link{display:flex;align-items:flex-start;gap:10px;width:100%;text-align:left;font-size:.875rem;line-height:1.6;color:#68778e;padding:10px 9px;border-radius:7px}.chapter-topic-link .topic-dot{display:block;flex-shrink:0;width:13px;height:13px;border:1px solid #c5d2e6;border-radius:50%;margin-top:5px}.chapter-topic-link.active{background:#eaf0ff;color:#224de3;font-weight:600}.chapter-topic-link.active .topic-dot{border:4px solid #224de3;background:#fff}.chapter-topic-link:hover{color:#224de3;background:#eef3ff}
/* Use the shared sidebar offset and viewport height from styles.css. */
@media(max-width:720px){.chapter-topic-link,.lecture-nav-title{font-size:.95rem}.lecture-topic-list{margin-left:20px}.chapter-topic-link{min-height:44px}}

.chapter-text>h2.chapter-part{font-size:1.75rem;margin:48px 0 4px}
.chapter-source-link{display:flex;align-items:center;width:fit-content;max-width:100%;min-height:44px;font:.875rem/1.6 system-ui,sans-serif;margin-bottom:16px;color:#657b9e}
.chapter-text>.chapter-source-link+h3{margin-top:0}
.chapter-text>:is(h2,h3):first-child{margin-top:0}
.chapter-module-link{font-weight:700;color:#344767;margin-top:14px}.chapter-module-link .topic-dot{display:none}.chapter-contents .contents-part{font-weight:700;margin-top:8px}
@media(max-width:720px){.chapter-text>h2.chapter-part{font-size:1.5rem;margin-top:36px}.chapter-text>h2.chapter-part:first-child{margin-top:0}.chapter-source-link{margin-bottom:12px}}

.chapter-figure{margin:28px 0 34px;text-align:center}.chapter-figure img{max-width:100%;max-height:620px;object-fit:contain;height:auto}.chapter-figure figcaption{font:.8rem/1.65 system-ui,sans-serif;color:#687891;margin-top:10px}

.original-source{margin-top:10px;font: .8rem/1.7 system-ui,sans-serif;color:#657591}.original-source summary{cursor:pointer;padding:5px 0}.original-source pre{margin-top:10px}.chapter-code.source-only{margin:8px 0 16px}

@media(min-width:721px){.chapter-contents{display:none}}

.lecture-nav-title{width:100%;text-align:left}.lecture-topic-list[hidden]{display:none}
.chapter-topic-link.read .topic-dot{background:#224de3;border-color:#224de3}
/* Keep source execution controls quiet within the continuous reading. */
.source-cell{margin:2rem 0 2.6rem;min-width:0}.source-cell .chapter-code{margin-bottom:.6rem}.source-code-lab.code-lab{border:0;background:transparent;padding:0;margin:0;box-shadow:none}.source-code-lab .code-actions{flex-wrap:wrap;gap:.8rem}.source-code-lab .primary{font-size:.875rem;padding:.65rem 1rem;min-height:42px}.source-code-lab .code-status{font: .875rem/1.6 'DM Sans',sans-serif;color:var(--muted);margin:.5rem 0}.source-example-choice{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;font:.875rem/1.6 'DM Sans',sans-serif;margin:.8rem 0 .3rem}.source-example-choice input{width:1rem;height:1rem;accent-color:var(--blue)}.source-code-lab textarea{width:100%;margin:.6rem 0;min-height:10rem}.source-code-lab [hidden]{display:none!important}.notebook-help ol{padding-left:1.3rem;line-height:1.8}.notebook-help li{margin:.6rem 0}.notebook-help .primary{display:inline-block;text-decoration:none;margin:.6rem 0}

.source-runtime-note{font:.875rem/1.7 system-ui,sans-serif;color:#617089;margin:.5rem 0}

/* Short code passages sit directly beside the corresponding spoken explanation. */
.interleaved-code.source-cell{margin:1.2rem 0 .7rem}.chapter-code-step{margin:0;font-family:system-ui,sans-serif}.chapter-code-step figcaption{font-size:.875rem;line-height:1.6;color:#596c87;margin-bottom:.3rem}.chapter-code-step pre{margin:0;padding:.85rem 1rem;border:0;border-left:2px solid #d8e1ef;border-radius:0;background:#f6f8fb;color:#273449;font-size:.875rem;line-height:1.75;max-width:100%;overflow:auto;tab-size:4}.chapter-code-step pre code{white-space:pre;overflow-wrap:normal;font-size:inherit}.step-code-lab .code-actions{position:relative;gap:.4rem 1rem;align-items:center;margin:.25rem 0}.step-code-lab .primary{background:transparent;color:#3056a5;border:0;padding:.35rem 0;min-height:36px}.step-code-lab .text-button,.step-options>summary{font:.875rem/1.6 system-ui,sans-serif}.step-options{position:static;color:#657591}.step-options>summary{cursor:pointer;list-style:none;padding:.35rem 0}.step-options>div{position:absolute;right:0;top:100%;z-index:3;background:white;border:1px solid #d8e1ef;border-radius:8px;box-shadow:0 8px 24px #23364c16;padding:1rem;width:min(320px,75vw);font:.875rem/1.7 system-ui,sans-serif}.step-options p{margin:0 0 .5rem}.step-options button,.step-options a{display:block;padding:.4rem 0}.complete-source-example{font:1rem/1.7 system-ui,sans-serif;margin:1rem 0;color:#465c7b}.complete-source-example>summary{cursor:pointer;padding:.5rem 0}.complete-source-example .source-cell{margin:.5rem 0 1rem}.step-code-lab textarea{min-height:5rem}@media print{.step-code-lab,.complete-source-example{display:none!important}}

/* Editable lesson cells share the Foundations notebook surface. */
.source-code-lab.code-lab{padding:24px;border:1px solid #d5dfef;border-radius:10px;background:#fbfcff;font-family:'DM Sans',system-ui,sans-serif}
.source-code-lab .code-lab-heading{color:#223049;font-size:1rem}
.source-code-lab .code-language{font-size:.875rem}
.source-code-lab .code-cell-title{font-size:.875rem;line-height:1.6;color:#596c87;margin:.65rem 0 1rem}
.source-code-lab .code-editor{min-height:140px;font-size:.875rem;margin:0;line-height:1.8}
.source-code-lab .code-actions{gap:10px 20px;margin-top:16px}
.source-code-lab .primary{background:var(--blue);color:#fff;padding:.8rem 1.15rem;min-height:44px;font:600 .875rem/1.4 'DM Sans',system-ui,sans-serif;border-radius:8px}
.source-code-lab .text-button{font:600 .875rem/1.4 'DM Sans',system-ui,sans-serif;min-height:44px}
.source-code-lab .code-status{margin:14px 0 0}
.source-code-lab .code-output{padding:20px;border-radius:10px;margin:18px 0 0}
.cell-options{margin-top:12px;font:.875rem/1.7 'DM Sans',system-ui,sans-serif;color:#617089}
.cell-options summary{cursor:pointer}.cell-options p{font:inherit;margin:10px 0}.cell-options a{display:inline-block;margin-left:12px}
@media(max-width:720px){.source-code-lab.code-lab{padding:18px}.source-code-lab .code-actions{gap:8px 16px}.source-code-lab .code-editor{padding:14px}}
@media print{.source-code-lab.code-lab{display:block!important}.source-code-lab .code-actions,.cell-options,.code-status{display:none}.source-code-lab .code-editor{color:#000;background:#fff;max-height:none}}
/* Keep the ribbon within reach while reading. */
.bookmark-actions{display:flex;align-items:center;gap:5px;flex-shrink:0}
.bookmark-toggle{display:grid;place-items:center;min-width:44px;min-height:44px;border-radius:7px;color:#63718b}
.bookmark-toggle[hidden]{display:none}
.bookmark-toggle[aria-pressed="true"]{color:var(--blue);background:#edf2ff}
.bookmark-toggle[aria-pressed="true"] path{fill:currentColor}
.bookmarks-open{min-height:44px;padding:8px 6px;font-size:.875rem;font-weight:600;white-space:nowrap}
#bookmarks-count:not(:empty){display:inline-block;min-width:21px;margin-left:4px;padding:2px 5px;border-radius:5px;background:#edf2ff;color:var(--blue);font-size:.75rem;line-height:1.4}
.has-reading-bookmark{box-shadow:-3px 0 var(--blue)}
.chapter-text .has-reading-bookmark{outline-offset:6px}
#bookmarks-dialog{width:min(620px,calc(100vw - 32px));max-height:80dvh;padding:24px}
#bookmarks-dialog .dialog-heading{position:sticky;top:-24px;background:#fff;padding:12px 0;margin-top:-12px;z-index:1}
#bookmarks-title{margin:0;font-size:1.25rem}
.bookmark-group{margin-top:20px}
.bookmark-group h3{font-size:.875rem;line-height:1.6;color:#63718b;margin:0 0 10px}
.bookmark-group ul{list-style:none;margin:0;padding:0}
.bookmark-group li{display:flex;align-items:flex-start;gap:8px;border-top:1px solid var(--line)}
.bookmark-jump{min-width:0;flex:1;text-align:left;padding:16px 10px 16px 0;border-radius:6px}
.bookmark-jump strong{display:block;color:var(--blue);font-size:1rem;line-height:1.5;margin-bottom:5px}
.bookmark-jump span{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;color:#53627b;font-family:Georgia,serif;font-size:1rem;line-height:1.65;overflow-wrap:anywhere}
.bookmark-remove{flex-shrink:0;margin-top:10px;min-width:44px;min-height:44px;border-radius:6px;color:#687387;font-size:1.5rem}
.bookmarks-empty{text-align:center;padding:36px 16px 24px;color:#63718b}
.bookmarks-empty svg{width:32px;height:32px;margin-bottom:16px;color:var(--blue)}
.bookmarks-empty h3{color:var(--ink);font-size:1.125rem;margin-bottom:8px}
.bookmarks-empty p{font-size:1rem;margin:0}
@media(hover:hover){.bookmark-toggle:hover,.bookmarks-open:hover,.bookmark-remove:hover,.bookmark-jump:hover{background:#f0f4fd}}
@media(max-width:720px){
 .top-actions .bookmark-actions{gap:0}
 .top-actions .bookmarks-open{font-size:.875rem;padding:8px 2px}
 body:has(.is-lecture) .topbar{flex-wrap:wrap;position:sticky;top:0}
 body:has(.is-lecture) .top-actions{flex-wrap:wrap;justify-content:flex-end;flex:1}
 body:has(.is-lecture) .top-actions .save-status{flex-basis:100%;order:2;text-align:right}
 #bookmarks-dialog{padding:20px}
}
@media print{.has-reading-bookmark{box-shadow:none}#bookmarks-dialog,#bookmark-status{display:none!important}}
