/* AIOUM docs — GitBook-style theme over mdBook: clean side nav, top bar, readable column, page TOC. */
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root { --sidebar-width: 292px !important; --page-padding: 24px !important; --content-max-width: 820px !important; --menu-bar-height: 56px !important; }

/* ---- palettes ---- */
html.light { --bg: #ffffff; --fg: #1b1f2a; --sidebar-bg: #f7f8fa; --sidebar-fg: #3d4452; --sidebar-non-existant: #aaa; --sidebar-active: #0b6fd6; --sidebar-spacer: #e6e8ee;
  --scrollbar: #d3d6de; --icons: #5b6473; --icons-hover: #1b1f2a; --links: #0b6fd6; --inline-code-color: #0b1f3a; --theme-popup-bg: #fff; --theme-popup-border: #e6e8ee; --theme-hover: #f1f3f7;
  --quote-bg: #f3f6fb; --quote-border: #cfe0f7; --table-border-color: #e6e8ee; --table-header-bg: #f7f8fa; --table-alternate-bg: #fafbfc;
  --searchbar-border-color: #d9dce3; --searchbar-bg: #f7f8fa; --searchbar-fg: #1b1f2a; --searchbar-shadow-color: transparent; --searchresults-header-fg: #5b6473; --searchresults-border-color: #e6e8ee; --searchresults-li-bg: #f7f8fa; --search-mark-bg: #ffe9a8;
  --aioum-accent: #0b6fd6; --aioum-mint: #0f9c72; --aioum-code-bg: #f4f6fa; --aioum-line: #e6e8ee; --aioum-dim: #6b7280; --aioum-card: #ffffff; }
html.navy, html.coal, html.ayu { --bg: #0b0c11; --fg: #f4f6fb; --sidebar-bg: #0e1016; --sidebar-fg: #c7cddb; --sidebar-non-existant: #555; --sidebar-active: #46b4ff; --sidebar-spacer: #22263a;
  --scrollbar: #323850; --icons: #8e97ad; --icons-hover: #f4f6fb; --links: #46b4ff; --inline-code-color: #dbe6ff; --theme-popup-bg: #11131a; --theme-popup-border: #22263a; --theme-hover: #171a23;
  --quote-bg: #11131a; --quote-border: #22263a; --table-border-color: #22263a; --table-header-bg: #11131a; --table-alternate-bg: #0e1016;
  --searchbar-border-color: #323850; --searchbar-bg: #11131a; --searchbar-fg: #f4f6fb; --searchbar-shadow-color: transparent; --searchresults-header-fg: #8e97ad; --searchresults-border-color: #22263a;
  --aioum-accent: #46b4ff; --aioum-mint: #3ae3b4; --aioum-code-bg: #11131a; --aioum-line: #22263a; --aioum-dim: #8e97ad; --aioum-card: #11131a; }

/* ---- type ---- */
html, body { font-family: "Manrope", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; }
body { font-size: 16px; line-height: 1.7; color: var(--fg); }
.content main { padding: 8px 0 80px; }
.content h1, .content h2, .content h3, .content h4 { font-weight: 700; letter-spacing: -.02em; line-height: 1.2; color: var(--fg); }
.content h1 { font-size: clamp(30px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.028em; margin: 0 0 18px; }
.content h2 { font-size: 24px; margin: 2.2em 0 .7em; padding-top: 0; border-bottom: 1px solid var(--aioum-line); padding-bottom: .35em; }
.content h3 { font-size: 19px; margin: 1.8em 0 .5em; }
.content h4 { font-size: 16px; margin: 1.4em 0 .4em; }
.content p, .content ul, .content ol { max-width: 72ch; }
.content li { margin: .3em 0; }
.content a { color: var(--links); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--links) 30%, transparent); }
.content a:hover { border-bottom-color: var(--links); }
.content a.header { border: 0; }
.content hr { border: 0; border-top: 1px solid var(--aioum-line); margin: 2.4em 0; }
.content code { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: .86em; }
.content :not(pre) > code { background: var(--aioum-code-bg); border: 1px solid var(--aioum-line); border-radius: 5px; padding: .1em .4em; color: var(--inline-code-color); }
.content pre { background: var(--aioum-code-bg) !important; border: 1px solid var(--aioum-line); border-radius: 10px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6; }
.content pre > code { background: transparent !important; padding: 0; font-size: 13.5px; }
.content pre > .buttons { top: 8px; right: 8px; }
.content table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--aioum-line); border-radius: 10px; overflow: hidden; font-size: 14.5px; margin: 1.2em 0; display: table; }
.content table thead th { background: var(--table-header-bg); font-weight: 600; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--aioum-line); }
.content table td { padding: 10px 14px; border-bottom: 1px solid var(--aioum-line); vertical-align: top; }
.content table tr:last-child td { border-bottom: 0; }
.content table tbody tr:nth-child(2n) { background: transparent; }
.content blockquote { margin: 1.4em 0; padding: 12px 16px; background: var(--quote-bg); border: 1px solid var(--quote-border); border-left: 4px solid var(--aioum-accent); border-radius: 10px; }
.content blockquote p { margin: .3em 0; }
.content img { border-radius: 10px; }

/* ---- top bar ---- */
#menu-bar { height: var(--menu-bar-height); background: var(--bg); border-bottom: 1px solid var(--aioum-line); box-shadow: none !important; }
#menu-bar .menu-title { font-weight: 800; font-size: 16px; letter-spacing: -.01em; color: var(--fg); }
#menu-bar .icon-button { color: var(--icons); }
#menu-bar .icon-button:hover { color: var(--icons-hover); }
#searchbar { border-radius: 8px; font-family: inherit; font-size: 14px; height: 38px; }

/* ---- sidebar (GitBook-style nav) ---- */
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--aioum-line); font-size: 14px; padding: 12px 10px 40px 14px; }
.sidebar .sidebar-scrollbox { padding: 8px 6px; }
.sidebar .part-title { margin: 22px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--aioum-dim); }
.sidebar .part-title.foldable { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; padding: 6px 0; margin-top: 12px; border-radius: 6px; }
.sidebar .part-title.foldable::before { content: ""; width: 0; height: 0; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .12s; }
.sidebar .part-title.foldable.open::before { transform: rotate(90deg); }
.sidebar .part-title.foldable:hover { color: var(--fg); }
.sidebar .chapter li.folded { display: none; }
.sidebar .chapter li { margin: 0; }
.sidebar .chapter li a { display: block; padding: 6px 10px; margin: 1px 0; border-radius: 7px; color: var(--sidebar-fg); line-height: 1.45; text-decoration: none; }
.sidebar .chapter li a:hover { background: var(--theme-hover); color: var(--fg); }
.sidebar .chapter li a.active, .sidebar .chapter li > a.active { background: color-mix(in srgb, var(--sidebar-active) 12%, transparent); color: var(--sidebar-active); font-weight: 600; }
.sidebar .chapter li a strong { display: none; }  /* hide "1." numbering */
.sidebar .chapter li.spacer { margin: 10px 0; height: 1px; background: var(--sidebar-spacer); }
.sidebar-resize-handle { display: none; }

/* ---- nav chapters (prev/next) ---- */
.nav-chapters { border-radius: 10px; color: var(--icons); }
.nav-chapters:hover { background: var(--theme-hover); }
.nav-wrapper .nav-chapters { padding: 12px; }


/* ---- previous / next as cards at the foot of the page (GitBook-style), never side arrows ---- */
.nav-wide-wrapper { display: none !important; }
.content .nav-wrapper { display: flex !important; gap: 14px; margin: 56px 0 0; max-width: 100%; }
.content .nav-wrapper .mobile-nav-chapters { flex: 1 1 0; width: auto !important; max-width: none !important; margin: 0 !important; padding: 14px 16px !important;
  display: flex; flex-direction: column; gap: 4px; background: var(--aioum-card); border: 1px solid var(--aioum-line); border-radius: 12px; text-decoration: none; color: var(--fg); line-height: 1.35; }
.content .nav-wrapper .mobile-nav-chapters:hover { border-color: var(--aioum-accent); background: var(--theme-hover); }
.content .nav-wrapper .mobile-nav-chapters.next { text-align: right; align-items: flex-end; }
.content .nav-wrapper .mobile-nav-chapters i.fa { display: none; }
.content .nav-wrapper .mobile-nav-chapters .lbl { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--aioum-dim); }
.content .nav-wrapper .mobile-nav-chapters .ttl { font-size: 15px; font-weight: 600; color: var(--links); }
.content .nav-wrapper .mobile-nav-chapters.previous .ttl::before { content: "← "; }
.content .nav-wrapper .mobile-nav-chapters.next .ttl::after { content: " →"; }
@media (max-width: 600px) { .content .nav-wrapper { flex-direction: column; } .content .nav-wrapper .mobile-nav-chapters.next { align-items: flex-start; text-align: left; } }

/* ---- inside the app: the site's nav above the book (custom.js adds body.in-app when served at /docs) ---- */
body.in-app { --app-bar-h: 56px; }
.app-bar { position: sticky; top: 0; z-index: 200; height: var(--app-bar-h); display: flex; align-items: center; gap: 18px; padding: 0 clamp(16px, 3vw, 28px); background: #0b0c11; border-bottom: 1px solid #22263a; font-family: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif; }
html.light .app-bar { background: #0b0c11; }
.app-bar .brand { font-weight: 800; font-size: 19px; letter-spacing: .04em; background: linear-gradient(92deg, #3ae3b4, #46b4ff); -webkit-background-clip: text; background-clip: text; color: transparent; text-decoration: none; }
.app-bar nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.app-bar nav::-webkit-scrollbar { display: none; }
.app-bar nav a { padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: #8e97ad; text-decoration: none; white-space: nowrap; }
.app-bar nav a:hover { color: #f4f6fb; }
.app-bar nav a.active { color: #f4f6fb; background: #ffffff0c; }
body.in-app .sidebar { top: var(--app-bar-h); }
body.in-app #menu-bar.sticky { top: var(--app-bar-h); }
@media (max-width: 720px) { .app-bar { gap: 10px; } .app-bar nav a { padding: 7px 9px; font-size: 13px; } }

/* ---- notes on any block (inside the app): click a block (or its tab), write, then Note or Make change ---- */
body.in-app .content main > * { position: relative; }
body.in-app .content main > *:hover { outline: 1px dashed #f2b84b55; outline-offset: 6px; border-radius: 6px; }
.note-tab { position: absolute; left: -46px; top: 0; width: 38px; height: 26px; border-radius: 7px; border: 1px solid #f2b84b88; background: #f2b84b1a; color: #f2b84b; font: 700 12px "Manrope", "Inter", sans-serif; cursor: pointer; display: inline-flex; visibility: hidden; opacity: 0; transition: opacity .15s ease .3s, visibility 0s linear .45s; align-items: center; justify-content: center; z-index: 5; }
body.in-app .content main > *:hover > .note-tab, .note-tab.open, .note-tab:hover { visibility: visible; opacity: 1; transition-delay: 0s; } /* stays for .45s after the pointer leaves, so it can be reached */
.note-tab::after { content: ""; position: absolute; left: 100%; top: -8px; bottom: -8px; width: 12px; } /* bridges the gap to the block so the tab stays while the pointer crosses */
body.in-app .content main > p:hover, body.in-app .content main > ul:hover, body.in-app .content main > ol:hover, body.in-app .content main > blockquote:hover, body.in-app .content main > table:hover { outline: 1px dashed #f2b84b55; outline-offset: 6px; border-radius: 4px; }
.app-bar .notes-hint { margin-left: 10px; font-size: 12px; color: var(--aioum-dim); white-space: nowrap; }
@media (max-width: 900px) { .app-bar .notes-hint { display: none; } }
@media (max-width: 900px) { .note-tab { display: none; } }
.note-editor { margin: 10px 0 14px; padding: 12px 14px; border: 1px solid #f2b84b88; border-radius: 12px; background: #1b1610; font-family: "Manrope", "Inter", sans-serif; }
html.light .note-editor { background: #fff8e6; }
.note-editor textarea { width: 100%; min-height: 84px; padding: 10px; border-radius: 8px; border: 1px solid var(--aioum-line); background: var(--bg); color: var(--fg); font: 14px/1.5 "Manrope", "Inter", sans-serif; resize: vertical; }
.note-editor .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.note-editor .hint { color: var(--aioum-dim); font-size: 12px; margin-left: auto; }
.nbtn { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--aioum-line); background: transparent; color: var(--fg); font: 700 13px "Manrope", "Inter", sans-serif; cursor: pointer; }
.nbtn.note { border-color: #f2b84b; color: #f2b84b; }
.nbtn.change { background: #e8862a; border-color: #e8862a; color: #120a02; }
.nbtn:disabled { opacity: .5; cursor: default; }
.note-card { margin: 8px 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid #f2b84b66; background: #f2b84b12; font: 14px/1.5 "Manrope", "Inter", sans-serif; }
.note-card.change { border-color: #e8862a; background: #e8862a14; }
.note-card.done { opacity: .6; }
.note-card .k { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #f2b84b; margin-right: 8px; }
.note-card.change .k { color: #e8862a; }
.note-card .t { white-space: pre-wrap; margin-top: 4px; }
.note-card .m { color: var(--aioum-dim); font-size: 12px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.note-card .m button { background: none; border: 0; color: var(--aioum-dim); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.app-bar .notes-link.pdf-link { margin-left: 8px; color: #46b4ff; border-color: #46b4ff55; }
.app-bar .notes-link { margin-left: auto; font-size: 13px; font-weight: 700; color: #f2b84b; text-decoration: none; padding: 6px 10px; border: 1px solid #f2b84b55; border-radius: 8px; white-space: nowrap; }

/* ---- print / PDF: only the book ---- */
@media print {
  .app-bar, .note-tab, .note-editor, .note-card, #menu-bar, .sidebar, .nav-wrapper, .nav-wide-wrapper, #sidebar-toggle { display: none !important; }
  .page, .content, .content main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .content main::after { display: none !important; }
  .content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .content h1 { page-break-before: always; }
  .content h1:first-of-type { page-break-before: auto; }
}

/* a phone: a wide table scrolls inside its own box, the page never sideways */
@media (max-width: 720px) { .content table { display: block; overflow-x: auto; max-width: 100%; } }

/* ---- the visual layer, as the app has it: lit surfaces, a glass app bar with a brand hairline, the active page in a brand ring ---- */
html.navy, html.coal, html.ayu { --aioum-surface: linear-gradient(180deg, #151822, #10121a); }
html.light { --aioum-surface: linear-gradient(180deg, #ffffff, #f7f8fa); }
.app-bar { background: linear-gradient(180deg, rgba(11, 12, 17, .96), rgba(11, 12, 17, .86)); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom-color: transparent; position: sticky; }
.app-bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(58, 227, 180, .45) 25%, rgba(70, 180, 255, .45) 60%, transparent); pointer-events: none; }
.sidebar .chapter li a.active, .sidebar .chapter li > a.active { background: linear-gradient(180deg, rgba(58, 227, 180, .12), rgba(70, 180, 255, .07)); box-shadow: inset 0 0 0 1px rgba(58, 227, 180, .35), inset 0 1px 0 rgba(255, 255, 255, .06); color: var(--fg); }
.content pre, .content table, .content blockquote { position: relative; isolation: isolate; background: var(--aioum-surface) !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 14px 34px -22px rgba(0, 0, 0, .9); }
.content pre::before, .content blockquote::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1; background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05) 45%, rgba(255, 255, 255, .02)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
html.light .content pre::before, html.light .content blockquote::before { background: linear-gradient(180deg, rgba(0, 0, 0, .08), rgba(0, 0, 0, .04)); }
.content blockquote { border-left-width: 1px; }
.content blockquote::after { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, #3ae3b4, #46b4ff); }
.content h1 { background: linear-gradient(92deg, var(--fg), var(--fg) 70%, var(--aioum-dim)); -webkit-background-clip: text; background-clip: text; }
.content .nav-wrapper .mobile-nav-chapters { background: var(--aioum-surface); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 14px 34px -22px rgba(0, 0, 0, .9); }
.content .nav-wrapper .mobile-nav-chapters:hover { box-shadow: inset 0 0 0 1px rgba(58, 227, 180, .35), 0 14px 34px -22px rgba(0, 0, 0, .9); border-color: transparent; }
#menu-bar { background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 92%, transparent)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.page { background: radial-gradient(70% 40% at 50% -10%, rgba(70, 180, 255, .12), transparent 70%); }
