
@import url("https://fonts.googleapis.com/css2?family=Baloo+Thambi+2:wght@600;700;800&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

/* The portal's compass cursor, so the course notes feel like the same site */
html, html * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='13' fill='white' stroke='%230b2654' stroke-width='2.5'/%3E%3Cpath d='M16 5l4 11h-8z' fill='%230056d2'/%3E%3Cpath d='M16 27l-4-11h8z' fill='%230b2654'/%3E%3Ccircle cx='16' cy='16' r='2' fill='white'/%3E%3C/svg%3E") 16 16, auto !important; }
a[href], a[href] *, button, button *, summary, summary *, [role="button"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='13' fill='%230056d2' stroke='%230b2654' stroke-width='2.5'/%3E%3Cpath d='M16 5l4 11h-8z' fill='%23fde68a'/%3E%3Cpath d='M16 27l-4-11h8z' fill='white'/%3E%3Ccircle cx='16' cy='16' r='2' fill='%230b2654'/%3E%3C/svg%3E") 16 16, pointer !important; }
input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]), textarea { cursor: text !important; }
::selection { background: transparent; color: #0056d2; }

/* The site's look: its blue, an ink colour for outlines and the hard offset shadow on buttons and cards.
   Readers may switch light or dark; the ink and soft tints follow. No gradients anywhere. */
html:not(.dark)[data-accent-color], html:not(.dark) { --accent-9: #0056d2; --accent-10: #0048b0; --accent-11: #0048b0; --accent-a10: #0048b0; }
:root { --gd-ink: #0d1626; --gd-blue: #0056d2; --gd-soft: #f0f6ff; --gd-ok: #15803d; --gd-ok-soft: #e6f6ec;
        --sy-f-text: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        --gd-f-head: "Baloo Thambi 2", "Noto Sans Tamil", Inter, system-ui, sans-serif;  /* Shibuya sets its own --sy-f-heading */
        --sy-f-mono: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace; }
html.dark { --gd-ink: #dbe4f0; --gd-blue: #3b82f6; --gd-soft: rgba(59, 130, 246, .12); --gd-ok: #4ade80; --gd-ok-soft: rgba(74, 222, 128, .12); }

/* Header "More" menu (portal links that don't fit across the top) */
.portal-more { position: relative; }
.portal-more summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .25rem; padding: 0 .5rem; font-weight: 500; }
.portal-more summary::-webkit-details-marker { display: none; }
.portal-more summary::after { content: "\25BE"; font-size: .8em; }
.portal-more-menu { list-style: none; margin: .25rem 0 0; padding: .4rem; min-width: 12.5rem; border-radius: 12px; z-index: 40;
  background: var(--sy-c-background); border: 1px solid var(--sy-c-border); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
@media (min-width: 768px) {
  /* the theme makes the link row scrollable (overflow: auto), which clips a dropdown: let it overflow */
  .sy-head-links { overflow: visible; }
  .portal-more-menu { position: absolute; top: 100%; right: 0; }
}
.portal-more-menu li { display: block; margin: 0; }
.portal-more-menu a { display: block; padding: .45rem .7rem; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.portal-more-menu a:hover { background: var(--accent-a3, rgba(37, 99, 235, .1)); }

/* Header brand */
.sy-head-brand img { border-radius: 50%; }
.sy-head-brand strong { font-weight: 800; letter-spacing: -0.01em; }

/* Reading comfort */
.yue { font-size: 1.0625rem; line-height: 1.8; }
.yue p { margin: 0 0 1.15em; }
.yue li + li { margin-top: .4em; }
.yue h1 { font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.yue h1::after { content: ""; display: block; width: 64px; height: 5px; margin-top: .7rem; border-radius: 4px; background: var(--gd-blue); }
.yue h2 { font-weight: 800; margin-top: 2.6rem; }
.yue h3 { font-weight: 700; margin-top: 2rem; }
.sy-head-brand strong, .sy-head-links a, .globaltoc .caption, .yue h1, .yue h2, .yue h3 { font-family: var(--gd-f-head) !important; }
kbd { background: var(--sy-c-surface) !important; box-shadow: none !important; border: 1px solid var(--sy-c-border); }
.yue img { border-radius: 10px; }
.yue div[class*="highlight-"] { margin: 1.3em 0 1.5em; }
.yue mark { border-radius: 4px; padding: 0 .2em; }

/* Course diagrams: inline SVG coloured from theme variables */
figure.diagram { margin: 1.75rem 0; padding: 1rem; border-radius: 14px; border: 1px solid var(--sy-c-border);
  background: var(--sy-c-background); overflow-x: auto; }
figure.diagram svg { display: block; width: 100%; height: auto; min-width: 520px; margin: 0 auto; }
figure.diagram figcaption { margin-top: .6rem; font-size: .9rem; color: var(--sy-c-light); text-align: center; }
.dg text { fill: var(--sy-c-text); font-family: var(--sy-f-text); font-size: 15px; }
.dg text.small { font-size: 13px; fill: var(--sy-c-light); }
.dg text.bold { font-weight: 700; }
.dg text.code { font-family: var(--sy-f-mono); font-size: 14px; }
.dg text.title { font-size: 14px; font-weight: 700; letter-spacing: .04em; fill: var(--sy-c-light); }
.dg .box { fill: var(--sy-c-surface); stroke: var(--sy-c-border); stroke-width: 1.5; }
.dg .blue { fill: rgba(37, 99, 235, .10); stroke: #2563eb; stroke-width: 1.5; }
.dg .green { fill: rgba(16, 185, 129, .12); stroke: #10b981; stroke-width: 1.5; }
.dg .amber { fill: rgba(245, 158, 11, .14); stroke: #f59e0b; stroke-width: 1.5; }
.dg .red { fill: rgba(239, 68, 68, .10); stroke: #ef4444; stroke-width: 1.5; }
.dg .purple { fill: rgba(139, 92, 246, .12); stroke: #8b5cf6; stroke-width: 1.5; }
.dg .ghost { fill: none; stroke: var(--sy-c-border); stroke-width: 1.5; stroke-dasharray: 6 5; }
.dg .bar { fill: #2563eb; } .dg .bar.dim { fill: var(--sy-c-border); } .dg .bar.green { fill: #10b981; stroke: none; }
.dg .bar.amber { fill: #f59e0b; stroke: none; }
.dg .arrow { fill: none; stroke: var(--sy-c-light); stroke-width: 1.8; }
.dg .arrow.dashed { stroke-dasharray: 6 5; }
.dg .arrow.blue { stroke: #2563eb; fill: none; } .dg .arrow.green { stroke: #10b981; fill: none; }
.dg .arrow.red { stroke: #ef4444; fill: none; }
.dg .head { fill: var(--sy-c-light); } .dg .head.blue { fill: #2563eb; stroke: none; }
.dg .head.green { fill: #10b981; stroke: none; } .dg .head.red { fill: #ef4444; stroke: none; }
.dg .line { stroke: var(--sy-c-border); stroke-width: 1.5; } .dg .line.cut { stroke: #ef4444; stroke-width: 2; stroke-dasharray: 5 4; }
.dg .circle-a { fill: rgba(37, 99, 235, .12); stroke: #2563eb; stroke-width: 1.5; }
.dg .circle-b { fill: rgba(16, 185, 129, .12); stroke: #10b981; stroke-width: 1.5; }

/* Imported GitBook content: video embeds and collapsible solutions */
.video-embed { position: relative; aspect-ratio: 16 / 9; margin: 1.25rem 0; border-radius: 12px; overflow: hidden;
  background: #000; box-shadow: 0 10px 30px rgba(15, 27, 51, .18); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
details.solution { margin: .75rem 0 1.75rem; border: 1px solid var(--sy-c-border); border-radius: 10px; background: var(--sy-c-surface); }
details.solution > summary { cursor: pointer; padding: .6rem 1rem; font-weight: 600; color: var(--sy-c-link); }
details.solution > summary::before { content: "Show "; }
details.solution[open] > summary::before { content: ""; }
details.solution[open] > summary { border-bottom: 1px solid var(--sy-c-border); }
details.solution > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details.source { margin: .6rem 0; border: 1px solid var(--sy-c-border); border-radius: 10px; background: var(--sy-c-surface); }
details.source > summary { cursor: pointer; padding: .55rem 1rem; font-weight: 600; font-family: var(--sy-f-mono); font-size: .9rem;
  color: var(--sy-c-text); }
details.source > summary::before { content: ""; }
details.source[open] > summary { border-bottom: 1px solid var(--sy-c-border); }
details.source > :not(summary) { margin: .5rem .75rem; }


/* Chapter extras (extras.js): recording, FAQ, real-world failures, community */
.portal-extras { margin: 2rem 0; display: grid; gap: 1.25rem; }
.portal-extras section { padding: 1.1rem 1.25rem; border-radius: 14px; border: 1px solid var(--sy-c-border); background: var(--sy-c-surface, transparent); }
.portal-extras h2 { margin: 0 0 .6rem !important; font-size: 1.1rem; }
.portal-extras .px-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.portal-extras .px-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.portal-extras .px-stamps { list-style: none; margin: .7rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.portal-extras .px-stamps button { font: inherit; font-size: .82rem; cursor: pointer; padding: .25rem .65rem; border-radius: 999px; border: 1px solid var(--sy-c-border); background: transparent; color: inherit; }
.portal-extras .px-stamps button:hover { border-color: var(--accent-9); color: var(--accent-11); }
.portal-extras details { margin: .4rem 0; } .portal-extras summary { cursor: pointer; font-weight: 600; }
.portal-extras .px-link { display: block; padding: .6rem 0; text-decoration: none; }
.portal-extras .px-link small { display: block; color: var(--sy-c-light); }

/* Colab + whiteboard buttons under the chapter title (extras.js) */
.portal-tools { display: flex; gap: .6rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.portal-tools .pt-btn { padding: .45rem 1rem; border-radius: 999px; border: 1px solid var(--sy-c-border); text-decoration: none; font-weight: 600; font-size: .92rem; }
.portal-tools .pt-btn:hover { border-color: var(--accent-9); color: var(--accent-11); }

/* Chapter completion (progress.js) */
.page-progress { margin: 2.5rem 0 1rem; padding: 1.1rem 1.25rem; border-radius: 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap; border: 1px solid var(--sy-c-border); background: var(--sy-c-surface); }
.page-progress.is-done { border-color: rgba(16, 185, 129, .45); background: rgba(16, 185, 129, .08); }
.page-progress .pp-text strong { display: block; font-size: 1rem; color: var(--sy-c-heading); }
.page-progress .pp-text span { font-size: .88rem; color: var(--sy-c-light); }
.page-progress .pp-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pp-btn[disabled] { opacity: .6; cursor: wait; }
.pp-btn.ghost { background: var(--sy-c-background); color: var(--sy-c-text) !important; }
.pp-btn.next { background: var(--gd-ok); }
.done-chip { display: inline-flex; align-items: center; gap: .35rem; margin: -.25rem .4rem 1rem 0; padding: .3rem .8rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; background: rgba(16, 185, 129, .12); color: #059669; border: 1px solid rgba(16, 185, 129, .35); }
.globaltoc a.reference.is-done::after { content: "✓"; margin-left: .4rem; font-weight: 800; color: #10b981; }
.sidebar-progress { margin: 0 0 1.25rem; padding: .75rem .9rem; border-radius: 12px; font-size: .82rem; font-weight: 600;
  color: var(--sy-c-text); background: var(--sy-c-surface); border: 1px solid var(--sy-c-border); }
.sidebar-progress .bar { height: 6px; border-radius: 999px; background: var(--sy-c-border); overflow: hidden; margin-top: .45rem; }
.sidebar-progress .bar span { display: block; height: 100%; border-radius: 999px; background: var(--gd-blue); }

/* Collapsible sidebar parts (toc.js): each part heading opens and closes its chapters */
.globaltoc .toc-toggle { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; padding: .15rem .25rem; border-radius: 6px; }
.globaltoc .toc-toggle:hover { color: var(--sy-c-link); }
.globaltoc .toc-toggle:focus-visible { outline: 2px solid var(--sy-c-link); outline-offset: 2px; }
.globaltoc .toc-count { margin-left: auto; font-size: .72rem; font-weight: 600; color: var(--sy-c-light); }
.globaltoc .toc-chev { flex: none; width: 14px; height: 14px; transition: transform .15s; }
.globaltoc .toc-toggle[aria-expanded="false"] .toc-chev { transform: rotate(-90deg); }
.globaltoc ul[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .globaltoc .toc-chev { transition: none; } }

/* Quiz card injected by quiz.js */
.quiz-chip { display: inline-flex; align-items: center; gap: .4rem; margin: -.25rem 0 1rem; padding: .3rem .8rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; text-decoration: none !important; background: var(--accent-a3, rgba(37, 99, 235, .1));
  color: var(--sy-c-link); border: 1px solid var(--sy-c-border); }
.quiz-chip:hover { border-color: var(--sy-c-link); }
.quiz-card { margin: 2.5rem 0 1rem; padding: 1.3rem 1.4rem; border-radius: 18px; color: var(--sy-c-text);
  background: var(--gd-soft); border: 2px solid var(--gd-ink); box-shadow: 5px 5px 0 var(--gd-ink); }
.quiz-card h2 { margin: 0 0 .25rem !important; padding: 0 !important; border: 0 !important; color: var(--sy-c-heading) !important; font-size: 1.4rem; }
.quiz-card > p { margin: 0 0 1rem; color: var(--sy-c-light); }
.quiz-card .quiz-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 1rem; border-radius: 14px; background: var(--sy-c-background); border: 1.5px solid var(--sy-c-border); }
.quiz-card .quiz-item + .quiz-item { margin-top: .6rem; }
.quiz-card .quiz-item strong { display: block; color: var(--sy-c-heading); }
.quiz-card .quiz-item small { color: var(--sy-c-light); }
.quiz-card .quiz-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.quiz-card a.quiz-btn.ghost { background: var(--sy-c-background); color: var(--sy-c-text) !important; }
.quiz-card .quiz-all { display: inline-block; margin-top: .9rem; color: var(--sy-c-link) !important; font-size: .9rem; font-weight: 700; }

/* Private notes (notes.js) */
.pn-fab { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60; border-radius: 999px; }
.pn-fab .pn-count { min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: #fff; color: #1d4ed8; font-size: .78rem; text-align: center; }
.pn-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(420px, 100vw); display: flex; flex-direction: column;
  background: var(--sy-c-background); color: var(--sy-c-text); border-left: 1px solid var(--sy-c-border);
  box-shadow: -18px 0 50px rgba(15, 23, 42, .18); }
.pn-drawer[hidden] { display: none; }
.pn-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--sy-c-border); }
.pn-head strong { color: var(--sy-c-heading); }
.pn-close { font-size: 1.5rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--sy-c-light); padding: .2rem .4rem; }
.pn-composer { padding: .9rem 1.1rem; border-bottom: 1px solid var(--sy-c-border); }
.pn-drawer textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .93rem; padding: .6rem .7rem; border-radius: 10px; resize: vertical;
  color: var(--sy-c-text); background: var(--sy-c-surface); border: 1px solid var(--sy-c-border); }
.pn-drawer textarea:focus { outline: 2px solid #2563eb; outline-offset: 1px; }
.pn-row { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
.pn-status { margin-right: auto; font-size: .82rem; color: var(--sy-c-light); }
.pn-btn { font-size: .88rem; padding: .4rem .85rem; }
.pn-btn[disabled] { opacity: .6; cursor: wait; }
.pn-link { font: inherit; font-size: .8rem; background: none; border: 0; padding: 0; cursor: pointer; color: var(--sy-c-link); }
.pn-link.danger { color: #dc2626; }
.pn-quote-pending { margin-bottom: .6rem; }
.pn-quote-pending small { display: block; font-size: .78rem; color: var(--sy-c-light); margin: .25rem 0; }
.pn-drawer blockquote { margin: 0 0 .5rem; padding: .4rem .7rem; border-left: 3px solid #2563eb; border-radius: 0 8px 8px 0;
  background: rgba(37, 99, 235, .08); font-size: .86rem; white-space: pre-wrap; max-height: 9rem; overflow: auto; }
.pn-list { flex: 1; overflow-y: auto; padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.pn-note { padding: .75rem .85rem; border-radius: 12px; border: 1px solid var(--sy-c-border); background: var(--sy-c-surface); transition: box-shadow .3s; }
.pn-note.pn-flash { box-shadow: 0 0 0 3px rgba(37, 99, 235, .45); }
.pn-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.pn-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; margin-top: .5rem; font-size: .78rem; color: var(--sy-c-light); }
.pn-meta a { color: var(--sy-c-link); }
.pn-empty { font-size: .9rem; color: var(--sy-c-light); }
.pn-foot { padding: .75rem 1.1rem; border-top: 1px solid var(--sy-c-border); font-size: .88rem; font-weight: 600; }
.pn-select { position: absolute; z-index: 65; font: inherit; font-size: .82rem; font-weight: 700; padding: .35rem .7rem; border-radius: 999px;
  border: 0; cursor: pointer; color: #fff; background: #1d4ed8; box-shadow: 0 6px 18px rgba(29, 78, 216, .35); }
.pn-select[hidden] { display: none; }
.pn-marker { margin-left: .5rem; vertical-align: middle; font: inherit; font-size: .72rem; font-weight: 700; padding: .1rem .5rem;
  border-radius: 999px; cursor: pointer; color: var(--sy-c-link); background: rgba(37, 99, 235, .1); border: 1px solid rgba(37, 99, 235, .3); }
@media (max-width: 640px) {
  .pn-drawer { top: auto; height: 78vh; width: 100vw; border-left: 0; border-top: 1px solid var(--sy-c-border); border-radius: 16px 16px 0 0; }
  .pn-fab { right: .9rem; bottom: .9rem; }
}
@media print { .pn-fab, .pn-drawer, .pn-select, .pn-marker { display: none !important; } }

/* Footer social icons (inline SVG, no third-party icon service) */
.portal-socials { display: flex; gap: .75rem; align-items: center; }
.portal-socials a { color: var(--sy-c-foot-text, var(--sy-c-light)); display: inline-flex; }
.portal-socials a:hover { color: var(--sy-c-link); }

/* "Stuck?" box at the bottom of every chapter: Q&A forum + 1:1 call */
.portal-help { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.25rem; flex-wrap: wrap;
  margin: 2rem 0 1rem; padding: 1rem 1.15rem; border: 1px solid var(--sy-c-border); border-radius: 10px; }
.portal-help p { margin: 0; color: var(--sy-c-light); font-size: .92rem; }
.portal-help p strong { color: var(--sy-c-text); }
.portal-help-links { display: flex; gap: .5rem; flex-wrap: wrap; }
.portal-help-links a { padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--sy-c-border); font-weight: 600;
  font-size: .9rem; text-decoration: none; color: var(--accent-9); }
.portal-help-links a:hover { border-color: var(--accent-9); }
.portal-help-links a.primary { background: var(--accent-9); border-color: var(--accent-9); color: #fff; }
.portal-socials svg { width: 20px; height: 20px; }

/* One button style, the same as the rest of the site: a solid block, an ink outline, a hard offset shadow,
   and it presses down when you point at it. */
.pp-btn, .quiz-card a.quiz-btn, .pn-btn, .pn-fab, .portal-help-links a, .portal-tools .pt-btn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--gd-ink) !important; box-shadow: 3px 3px 0 var(--gd-ink);
  background: var(--gd-blue); color: #fff !important; text-decoration: none !important;
  font: 800 .95rem/1.1 var(--gd-f-head); letter-spacing: .01em; transition: transform .12s ease, box-shadow .12s ease; }
.portal-help-links a:not(.primary), .portal-tools .pt-btn { background: var(--sy-c-background); color: var(--sy-c-text) !important; }
.pp-btn:hover, .quiz-card a.quiz-btn:hover, .pn-btn:hover, .pn-fab:hover, .portal-help-links a:hover, .portal-tools .pt-btn:hover,
@media (prefers-reduced-motion: reduce) { .pp-btn, .quiz-card a.quiz-btn, .pn-btn, .pn-fab { transition: none; } }

/* The end of a chapter reads as numbered steps: practise, then finish and move on. */
article[role=main], article { counter-reset: flow; }
.quiz-card, .page-progress { counter-increment: flow; position: relative; }
.quiz-card::before, .page-progress::before { content: "Step " counter(flow); display: block; margin: 0 0 .4rem;
  font: 800 .72rem/1 var(--sy-f-text); letter-spacing: .12em; text-transform: uppercase; color: var(--gd-blue); }
.page-progress::before { flex-basis: 100%; margin-bottom: 0; }
.page-progress { border: 2px solid var(--gd-ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--gd-ink); }
.page-progress.is-done { border-color: var(--gd-ink); background: var(--gd-ok-soft); }
.page-progress .pp-text strong { font-family: var(--gd-f-head); font-size: 1.15rem; }
.done-chip { background: var(--gd-ok-soft); color: var(--gd-ok); border-color: currentColor; }
.globaltoc a.reference.is-done::after { color: var(--gd-ok); }
.quiz-chip { border-radius: 999px; border: 1.5px solid var(--gd-ink); background: var(--gd-soft); color: var(--sy-c-text); font-weight: 700; }
