/* Contour website theme: a terminal window in the browser. Tokens first, then the window, then Markdown content. */
@font-face { font-family:"JetBrains Mono"; font-weight:400; font-style:normal; font-display:swap; src:url(fonts/JetBrainsMono-Regular.woff2) format("woff2"); }
@font-face { font-family:"JetBrains Mono"; font-weight:500; font-style:normal; font-display:swap; src:url(fonts/JetBrainsMono-Medium.woff2) format("woff2"); }
@font-face { font-family:"JetBrains Mono"; font-weight:700; font-style:normal; font-display:swap; src:url(fonts/JetBrainsMono-Bold.woff2) format("woff2"); }

:root {
  /* Every token is written once as light-dark(light, dark); only color-scheme switches the theme. */
  --desk1:light-dark(#e9e4dc, #0b0c10); --desk2:light-dark(#e3d9d4, #1a1320); --desk3:light-dark(#ecd6d2, #2a1216);
  --bg:light-dark(#fbfaf7, #12141a); --bg2:light-dark(#f2f0eb, #181b22); --bg3:light-dark(#e9e6df, #1e222b);
  --line:light-dark(#d9d4ca, #2a2f3b); --sel:light-dark(#e4dfd5, #2a303d);
  --fg:light-dark(#3b4048, #c8d0da); --fg-strong:light-dark(#15181d, #eef2f6);
  --dim:light-dark(#5e636b, #9199a7); --faint:light-dark(#68655f, #848a93); --on-accent:light-dark(#fff, #0b0c10);
  --red:light-dark(#c8372f, #e5534b); --green:light-dark(#367b28, #8fce7a); --yellow:light-dark(#865900, #e5c07b);
  --blue:light-dark(#2f5fc4, #7aa2f7); --cyan:light-dark(#1c7177, #6fc3c9); --magenta:light-dark(#8a45c9, #c58af9);
  --shadow:0 30px 90px light-dark(rgba(60,40,30,.28), rgba(0,0,0,.65)), 0 0 0 1px light-dark(rgba(0,0,0,.08), rgba(255,255,255,.06));
  --mono:"JetBrains Mono", ui-monospace, "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
  color-scheme:dark light; /* follows the system */
}
:root[data-theme="light"] { color-scheme:light; }
:root[data-theme="dark"] { color-scheme:dark; }

:focus-visible { outline:2px solid var(--blue); outline-offset:-2px; }
* { box-sizing:border-box; scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
[hidden] { display:none !important; }
html, body { height:100%; margin:0; }
body {
  font-family:var(--mono); font-size:14px; line-height:1.6; color:var(--fg);
  background:
    radial-gradient(1200px 700px at 85% 110%, var(--desk3), transparent 60%),
    radial-gradient(900px 600px at 5% -10%, var(--desk2), transparent 60%),
    var(--desk1);
  display:flex; flex-direction:column; align-items:center; justify-content:center; overflow:hidden;
  padding-left:max(16px, env(safe-area-inset-left, 0px)); padding-right:max(16px, env(safe-area-inset-right, 0px));
  padding-top:env(safe-area-inset-top, 0px); padding-bottom:env(safe-area-inset-bottom, 0px);
}
img { max-width:100%; }
a { color:var(--blue); text-decoration:none; cursor:pointer; }
a:hover { text-decoration:underline; }
button { font:inherit; color:inherit; background:none; border:0; cursor:pointer; padding:0; }
kbd { font:inherit; font-size:.86em; border:1px solid var(--line); border-bottom-width:2px; border-radius:4px; padding:0 5px; color:var(--fg-strong); background:var(--bg3); }
.no-js .needs-js { display:none !important; }

/* ---------- the window ---------- */
.window {
  width:min(1220px, 100%); height:min(800px, calc(100% - 40px));
  display:flex; flex-direction:column; background:var(--bg); border-radius:11px; overflow:hidden;
  box-shadow:var(--shadow); position:relative;
  transition:width .22s ease, height .22s ease, border-radius .22s ease, transform .2s ease, opacity .2s ease;
}
[data-max] .window { width:100%; height:calc(100% - 16px); }
.window.closed { transform:scale(.92); opacity:0; pointer-events:none; visibility:hidden; transition:transform .2s ease, opacity .2s ease, visibility 0s .2s; }
.titlebar { display:flex; align-items:center; height:34px; flex:none; background:var(--bg3); border-bottom:1px solid var(--line); padding:0 12px; user-select:none; }
.titlebar .title { flex:1; display:flex; align-items:center; justify-content:center; color:var(--dim); font-size:12.5px; white-space:nowrap; overflow:hidden; min-width:0; }
.titlebar .title span { overflow:hidden; text-overflow:ellipsis; }
.titlebar img { width:16px; height:16px; margin-right:8px; flex:none; }
.wc, .wc-spacer { width:55px; flex:none; }
.wc { display:flex; gap:8px; }
.wc button { width:13px; height:13px; border-radius:50%; background:var(--faint); transition:background .15s; }
.wc button.close:hover { background:var(--red); } .wc button.max:hover { background:var(--green); } .wc button.min:hover { background:var(--yellow); }

.strip { display:flex; align-items:stretch; flex:none; height:32px; background:var(--bg2); border-bottom:1px solid var(--line); }
.strip .ws { padding:0 16px; display:flex; align-items:center; color:var(--dim); border-right:1px solid var(--line); white-space:nowrap; }
.strip .ws:hover { color:var(--fg-strong); background:var(--bg3); text-decoration:none; }
.strip .ws[aria-current] { background:var(--bg); color:var(--fg-strong); box-shadow:inset 0 2px 0 var(--red); }
.strip .ws b { color:var(--red); font-weight:700; margin-right:1px; }
.strip .grow { flex:1; }
.strip .tool { padding:0 14px; display:flex; align-items:center; gap:8px; color:var(--dim); border-left:1px solid var(--line); }
.strip .tool:hover { color:var(--fg-strong); background:var(--bg3); text-decoration:none; }

.panes { flex:1; display:flex; min-height:0; position:relative; }
.tabs { width:232px; flex:none; background:var(--bg2); border-right:1px solid var(--line); overflow:auto; padding:10px 0; }
.tabs .sep { color:var(--faint); padding:10px 14px 3px; font-size:12px; white-space:nowrap; overflow:hidden; }
.tabs .tab { display:block; padding:3px 14px; color:var(--dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tabs .tab::before { content:"  "; white-space:pre; color:var(--red); }
.tabs .tab:hover { color:var(--fg-strong); background:var(--bg3); text-decoration:none; }
.tabs .tab[aria-current] { color:var(--fg-strong); background:var(--sel); }
.tabs .tab[aria-current]::before { content:"● "; }
.tabsel { display:none; }
.tabsel summary { cursor:pointer; list-style:none; color:var(--fg-strong); }
.tabsel summary::-webkit-details-marker { display:none; }
.tabsel summary::before { content:"▸ "; color:var(--red); }
.tabsel[open] summary::before { content:"▾ "; }
.tabsel-list { margin-top:6px; max-height:50vh; overflow:auto; }
.tabsel-list a { display:block; padding:3px 0; color:var(--dim); }
.tabsel-list a[aria-current] { color:var(--fg-strong); }

/* ---------- the page ---------- */
.page { flex:1; min-width:0; overflow:auto; padding:26px 38px 60px; scroll-behavior:smooth; outline:0; }
.page > * { max-width:78ch; }
.page h1 { font-size:26px; line-height:1.25; color:var(--fg-strong); margin:0 0 6px; font-weight:700; letter-spacing:-.01em; }
.page h2 { font-size:15px; color:var(--red); margin:34px 0 10px; font-weight:700; }
.page h2::before { content:"## "; color:var(--faint); }
.page h3 { font-size:14px; color:var(--fg-strong); margin:20px 0 6px; }
.page h4, .page h5, .page h6 { font-size:14px; color:var(--dim); margin:16px 0 6px; }
.page h1, .page h2, .page h3, .page h4 { scroll-margin-top:12px; }
.headerlink { color:var(--faint); margin-left:.5ch; opacity:0; transition:opacity .15s; font-weight:400; }
:is(h1, h2, h3, h4, h5, h6):hover > .headerlink, .headerlink:focus { opacity:1; }
.page p { margin:0 0 12px; }
.page .lead { color:var(--fg-strong); font-size:15px; }
.page ul { padding-left:2.4ch; list-style:none; margin:0 0 12px; }
.page ul > li { position:relative; margin-bottom:3px; }
.page ul:not(.cards ul) > li::before { content:"•"; color:var(--red); position:absolute; left:-2ch; }
.page ol { padding-left:3.4ch; margin:0 0 12px; }
.page ol > li { margin-bottom:3px; }
.page ol > li::marker { color:var(--red); }
.page li > p { margin:0; }
.page li > ul, .page li > ol { margin:3px 0 0; }
.page hr { border:0; border-top:1px solid var(--line); margin:22px 0; }
.page blockquote { margin:0 0 14px; padding:2px 14px; border-left:3px solid var(--faint); color:var(--dim); }
.page mark { background:color-mix(in srgb, var(--yellow) 28%, transparent); color:var(--fg-strong); padding:0 3px; border-radius:2px; }
.page ins { text-decoration:none; background:color-mix(in srgb, var(--green) 20%, transparent); }
.page del { color:var(--dim); text-decoration:line-through; background:color-mix(in srgb, var(--red) 14%, transparent); }
.page img { height:auto; }
.page img[align=left] { float:left; margin:0 16px 8px 0; }
.page img[align=right] { float:right; margin:0 0 8px 16px; }
.page img.banner { height:100px; object-fit:cover; object-position:top; }
.page img.shot { width:100%; max-width:78ch; border-radius:8px; border:1px solid var(--line); display:block; margin:6px 0 16px; }
.page video { width:100%; height:auto; border-radius:8px; border:1px solid var(--line); background:#000; margin:6px 0 16px; }
.page figure { margin:0 0 14px; }
.page figcaption { color:var(--dim); font-size:12.5px; }
.page table { display:block; overflow-x:auto; border-collapse:collapse; width:max-content; max-width:100%; margin:0 0 14px; }
.page th { text-align:left; color:var(--dim); font-weight:400; border-bottom:1px solid var(--line); padding:4px 14px 4px 0; }
.page td { border-bottom:1px solid var(--line); padding:5px 14px 5px 0; vertical-align:top; }
.page td:first-child { color:var(--cyan); }
.page .doc, .page .wide, .page .cards { max-width:104ch; }

/* code */
.page code { font:inherit; font-size:.94em; background:var(--bg3); padding:0 5px; border-radius:3px; color:var(--cyan); overflow-wrap:anywhere; }
.page pre, .page .highlight pre { font:inherit; position:relative; margin:0; background:var(--bg2); border:1px solid var(--line); border-radius:6px; padding:12px 14px; overflow:auto; color:var(--fg-strong); line-height:1.5; }
.page .highlight { margin:0 0 14px; }
.page > pre { margin:0 0 14px; }
.page pre code { background:none; padding:0; color:inherit; font-size:inherit; overflow-wrap:normal; }
.page pre button { position:absolute; top:7px; right:8px; color:var(--dim); font-size:12px; padding:1px 7px; border:1px solid var(--line); border-radius:4px; background:var(--bg3); opacity:0; transition:opacity .15s; }
.page pre:hover button, .page pre button:focus-visible { opacity:1; }
.page pre button:hover { color:var(--fg-strong); }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch, .highlight .cp, .highlight .cpf, .highlight .sd { color:var(--dim); font-style:italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kc, .highlight .kt, .highlight .ow { color:var(--magenta); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .si { color:var(--green); }
.highlight .se { color:var(--yellow); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .mb, .highlight .il { color:var(--yellow); }
.highlight .nb, .highlight .bp, .highlight .nc, .highlight .nn, .highlight .nt, .highlight .nd { color:var(--blue); }
.highlight .nf, .highlight .fm, .highlight .na, .highlight .nx { color:var(--cyan); }
.highlight .nv, .highlight .vi, .highlight .vg, .highlight .vc, .highlight .nl, .highlight .no, .highlight .ne { color:var(--red); }
.highlight .o, .highlight .p { color:var(--fg); }
.highlight .gp { color:var(--faint); user-select:none; }
.highlight .go { color:var(--dim); }
.highlight .gh, .highlight .gu { color:var(--blue); font-weight:700; }
.highlight .gd { color:var(--red); } .highlight .gi { color:var(--green); }
.highlight .err { color:var(--red); }
.highlight .linenos, .highlight .normal { color:var(--faint); user-select:none; }
.highlight a { color:inherit; }

/* admonitions */
.admonition, .page details { --tone:var(--yellow); border-left:3px solid var(--tone); background:var(--bg2); padding:9px 14px; margin:0 0 14px; color:var(--fg); border-radius:0 6px 6px 0; }
.admonition.warning, .page details.warning, .admonition.danger, .page details.danger { --tone:var(--red); }
.admonition.tip, .page details.tip, .admonition.success, .page details.success { --tone:var(--green); }
.admonition.important, .page details.important { --tone:var(--magenta); }
.admonition.info, .page details.info, .admonition.example, .page details.example { --tone:var(--blue); }
.admonition > :last-child, .page details > :last-child { margin-bottom:0; }
.admonition-title { margin:0 0 4px; color:var(--tone); font-weight:700; }
.page details > summary { cursor:pointer; list-style:none; color:var(--tone); font-weight:700; }
.page details > summary::-webkit-details-marker { display:none; }
.page details > summary::before { content:"▸ "; }
.page details[open] > summary::before { content:"▾ "; }
.page details[open] > summary { margin-bottom:6px; }

/* home */
.prompt { color:var(--dim); margin:0 0 14px; white-space:nowrap; overflow:hidden; }
.prompt .path { color:var(--blue); } .prompt .sym { color:var(--green); } .prompt .cmd { color:var(--fg-strong); }
.cursor { display:inline-block; width:.6em; height:1.15em; background:var(--fg-strong); vertical-align:text-bottom; animation:blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity:0; } }
.reveal { animation:reveal .35s ease both; }
@keyframes reveal { from { opacity:0; transform:translateY(5px); } }
.cta { display:flex; flex-wrap:wrap; gap:10px; margin:16px 0 22px; }
.btn { display:inline-block; border:1px solid var(--red); color:var(--red); padding:5px 16px; border-radius:5px; font-weight:500; }
.btn:hover { background:color-mix(in srgb, var(--red) 14%, transparent); text-decoration:none; }
.btn.fill { background:var(--red); color:var(--on-accent); } .btn.fill:hover { filter:brightness(1.1); }
.page .cards ul { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:12px; margin:0 0 14px; padding:0; }
.page .cards li { margin:0; }
.cards li > a:only-child, .cards li:not(:has(> a:only-child)) { display:block; height:100%; box-sizing:border-box; border:1px solid var(--line); border-radius:7px; padding:9px 12px; background:var(--bg2); color:var(--dim); font-size:12.5px; line-height:1.45; transition:border-color .15s, transform .15s; }
.cards li > a:only-child:hover { border-color:var(--red); transform:translateY(-2px); text-decoration:none; }
.cards li strong { display:block; margin-bottom:3px; color:var(--fg-strong); font-size:14px; }

/* pymdownx.tabbed (alternate style): CSS-only radio tabs, so they work without JS. The extension numbers its
   inputs, labels and blocks in order, hence the :nth-child rules; six tabs per set is the limit. */
.tabbed-set { position:relative; display:flex; flex-wrap:wrap; margin:0 0 14px; }
.tabbed-set > input { position:absolute; opacity:0; pointer-events:none; }
.tabbed-labels { display:flex; width:100%; overflow-x:auto; }
.tabbed-labels > label { flex:none; padding:5px 16px; color:var(--dim); border-bottom:2px solid transparent; cursor:pointer; white-space:nowrap; }
.tabbed-labels > label:hover { color:var(--fg-strong); }
.tabbed-content { width:100%; border-top:1px solid var(--line); margin-top:-1px; padding-top:14px; }
.tabbed-block { display:none; }
:is(.tabbed-set > input:nth-child(1):checked ~ .tabbed-content > :nth-child(1), .tabbed-set > input:nth-child(2):checked ~ .tabbed-content > :nth-child(2),
  .tabbed-set > input:nth-child(3):checked ~ .tabbed-content > :nth-child(3), .tabbed-set > input:nth-child(4):checked ~ .tabbed-content > :nth-child(4),
  .tabbed-set > input:nth-child(5):checked ~ .tabbed-content > :nth-child(5), .tabbed-set > input:nth-child(6):checked ~ .tabbed-content > :nth-child(6)) { display:block; }
:is(.tabbed-set > input:nth-child(1):checked ~ .tabbed-labels > :nth-child(1), .tabbed-set > input:nth-child(2):checked ~ .tabbed-labels > :nth-child(2),
  .tabbed-set > input:nth-child(3):checked ~ .tabbed-labels > :nth-child(3), .tabbed-set > input:nth-child(4):checked ~ .tabbed-labels > :nth-child(4),
  .tabbed-set > input:nth-child(5):checked ~ .tabbed-labels > :nth-child(5), .tabbed-set > input:nth-child(6):checked ~ .tabbed-labels > :nth-child(6)) { color:var(--fg-strong); border-color:var(--red); }
/* the radios are visually hidden: show focus on the label of the focused one */
:is(.tabbed-set > input:nth-child(1):focus-visible ~ .tabbed-labels > :nth-child(1), .tabbed-set > input:nth-child(2):focus-visible ~ .tabbed-labels > :nth-child(2),
  .tabbed-set > input:nth-child(3):focus-visible ~ .tabbed-labels > :nth-child(3), .tabbed-set > input:nth-child(4):focus-visible ~ .tabbed-labels > :nth-child(4),
  .tabbed-set > input:nth-child(5):focus-visible ~ .tabbed-labels > :nth-child(5), .tabbed-set > input:nth-child(6):focus-visible ~ .tabbed-labels > :nth-child(6)) { outline:2px solid var(--blue); outline-offset:-2px; }

/* ---------- side pane ---------- */
.aside { width:226px; flex:none; border-left:1px solid var(--line); overflow:auto; padding:14px; font-size:13px; }
.aside .sep { color:var(--faint); margin:0 0 6px; white-space:nowrap; overflow:hidden; }
.aside .blk { margin-bottom:20px; }
.aside a { display:block; color:var(--dim); padding:1px 0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.aside a:hover { color:var(--fg-strong); text-decoration:none; }
.aside a.on { color:var(--red); } .aside a.on::before { content:"▸ "; }
.aside img { width:100%; height:auto; border-radius:5px; border:1px solid var(--line); display:block; }
.aside .v { color:var(--fg-strong); }
.aside .none { color:var(--faint); }

/* ---------- status line ---------- */
.status { display:flex; align-items:center; gap:14px; height:27px; flex:none; background:var(--bg2); border-top:1px solid var(--line); padding:0 10px 0 0; font-size:12.5px; color:var(--dim); white-space:nowrap; overflow:hidden; }
.mode { background:var(--red); color:var(--on-accent); font-weight:700; padding:0 10px; height:100%; display:flex; align-items:center; }
.mode.cmd { background:var(--blue); }
.status .loc { overflow:hidden; text-overflow:ellipsis; min-width:0; }
.status .loc b { color:var(--fg-strong); font-weight:500; }
.status .grow { flex:1; }
.status .flash { color:var(--yellow); }
.status .flash:empty, .hint-off { display:none; }
#cw-hints { display:contents; }
[data-nokeys] .hint { display:none; }
[data-nokeys] .hint-off { display:inline; }
.status button:hover { color:var(--fg-strong); }
#cw-outline-toggle { display:none; }

/* ---------- palette, help, launcher ---------- */
.overlay { position:absolute; inset:0; background:rgba(0,0,0,.42); display:none; z-index:5; }
.overlay.on { display:block; }
.palette { position:absolute; top:74px; left:50%; transform:translateX(-50%); width:min(620px, 88%); background:var(--bg2); border:1px solid var(--red); border-radius:8px; box-shadow:0 20px 60px rgba(0,0,0,.5); overflow:hidden; }
.palette .in { display:flex; align-items:center; padding:9px 14px; border-bottom:1px solid var(--line); }
.palette .in span { color:var(--red); margin-right:8px; font-weight:700; }
.palette input { flex:1; min-width:0; font:inherit; color:var(--fg-strong); background:none; border:0; outline:0; }
.palette .list { max-height:330px; overflow:auto; padding:4px 0; }
.palette .it { display:flex; justify-content:space-between; gap:14px; padding:4px 14px; cursor:pointer; white-space:nowrap; }
.palette .it.on { background:var(--sel); color:var(--fg-strong); }
.palette .it small { color:var(--dim); font-size:12px; }
.palette .it .act { color:var(--yellow); }
.palette .none { padding:10px 14px; color:var(--dim); }
.palette .none:empty { display:none; }
.help { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:min(520px, 88%); background:var(--bg2); border:1px solid var(--line); border-radius:8px; padding:18px 22px; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.help h3 { margin:0 0 10px; color:var(--red); font-size:14px; }
.help #cw-help-list > div { display:flex; justify-content:space-between; padding:3px 0; border-bottom:1px dashed var(--line); }
.launcher { position:absolute; display:none; flex-direction:column; align-items:center; gap:10px; color:var(--dim); }
.launcher.on { display:flex; }
.launcher img { width:72px; height:72px; transition:transform .15s; }
.launcher:hover img { transform:scale(1.08); }

/* ---------- responsive ---------- */
@media (width < 1000px) {
  #cw-outline-toggle { display:inline; }
  .aside { display:none; }
  .aside.open { display:block; position:absolute; left:0; right:0; bottom:0; width:auto; max-height:60%; z-index:4; background:var(--bg2); border:0; border-top:1px solid var(--red); box-shadow:0 -14px 40px rgba(0,0,0,.4); }
}
@media (width < 720px) {
  body { font-size:13.5px; }
  .window, [data-max] .window { width:100%; height:calc(100% - 24px); }
  .tabs, .hint, [data-nokeys] .hint-off { display:none; }
  .panes { flex-direction:column; }
  .tabsel { display:block; flex:none; background:var(--bg2); border-bottom:1px solid var(--line); padding:8px 12px; width:100%; }
  .page { padding:18px 16px 50px; }
  .strip { overflow-x:auto; scrollbar-width:none; }
  .strip .ws { padding:0 8px; }
  .strip .tool { padding:0 9px; }
  .strip #cw-search { position:sticky; right:0; background:var(--bg2); }
  .wc, .wc-spacer { display:none; }
  .status { gap:10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation:none !important; transition:none !important; }
  .page { scroll-behavior:auto; }
}

/* ---------- print: just the page ---------- */
@media print {
  html, body { height:auto; overflow:visible; background:#fff; color:#000; padding:0; display:block; }
  .titlebar, .strip, .tabs, .tabsel, .aside, .status, .overlay, .launcher, .headerlink, .cursor { display:none !important; }
  .window.closed { opacity:1; transform:none; pointer-events:auto; visibility:visible; }
  .window, [data-max] .window { width:auto; height:auto; overflow:visible; box-shadow:none; border-radius:0; background:#fff; display:block; }
  .panes { display:block; }
  .page { overflow:visible; padding:0; color:#000; }
  .page > * { max-width:none; }
  .page, .page h1, .page h3, .page td:first-child { color:#000; }
  .page pre, .page .highlight pre { white-space:pre-wrap; background:#f5f5f5; color:#000; border-color:#ccc; }
  .page code { background:#eee; color:#000; }
  a { color:#000; }
}
