/* Weft theme of the cockpit (worker/public/themes/weft.json): Toile (light) and Nuit (dark). */
:root, [data-mode="toile"] {
  --bg: #f3eee4; --panel: #fbf8f2; --panel-alt: #e9e2d4; --ink: #2a241c; --muted: #5e5446; --line: #cfc5b2;
  --accent: #2f4f7f; --accent-ink: #fbf8f2; --code: #e9e2d4; --hit: #e6d7a8; --focus: #2f4f7f;
  --sans: "Source Sans 3", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 3px;
}
[data-mode="nuit"] {
  --bg: #12151c; --panel: #1a1e27; --panel-alt: #242a36; --ink: #ebe5d9; --muted: #aaa395; --line: #363e4e;
  --accent: #a9bfe6; --accent-ink: #12151c; --code: #242a36; --hit: #4b4430; --focus: #a9bfe6;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 4.5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--code); padding: .1em .3em; border-radius: var(--radius); }
pre { background: var(--code); padding: .9rem 1rem; border-radius: var(--radius); overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; height: 56px;
       padding: 0 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--accent-ink); flex: none;
        background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #2f6431)); }
.logo svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.brand .sub { font-weight: 400; color: var(--muted); }
.menu { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius);
        font-size: 1.1rem; padding: .2rem .55rem; cursor: pointer; }
.search { position: relative; margin-left: auto; width: min(26rem, 100%); }
#q { width: 100%; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
     background: var(--bg); color: var(--ink); font: inherit; }
#hits { position: absolute; right: 0; left: 0; top: 2.6rem; max-height: 70vh; overflow-y: auto; margin: 0;
        padding: .3rem; list-style: none; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: 0 8px 24px rgb(0 0 0 / .18); }
#hits a { display: block; padding: .45rem .6rem; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
#hits a:hover, #hits a:focus, #hits a.on { background: var(--panel); outline: none; }
#hits small { display: block; color: var(--muted); font-size: .82rem; }
#hits mark { background: var(--hit); color: inherit; }

.layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr) 14rem; }
/* side menu as in the cockpit: dark in light mode, the page background in dark mode */
#nav { --sb: color-mix(in srgb, var(--ink) 93%, var(--accent)); --sb-text: color-mix(in srgb, var(--panel) 72%, var(--sb)); --sb-hi: var(--panel);
       background: var(--sb); color: var(--sb-text); }
[data-mode="nuit"] #nav { --sb: var(--bg); --sb-text: var(--muted); --sb-hi: var(--ink); }
#nav { position: sticky; top: 3.5rem; height: calc(100vh - 3.5rem); overflow-y: auto; padding: 1rem 1rem 3rem 1.25rem;
       border-right: 1px solid var(--line); font-size: .9rem; }
#nav h2 { margin: 1.1rem 0 .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sb-text); opacity: .75; }
#nav ul { list-style: none; margin: 0; padding: 0; }
#nav a { display: block; padding: .22rem .5rem; border-radius: 8px; color: var(--sb-text); text-decoration: none; }
#nav a:hover { background: color-mix(in srgb, var(--sb-hi) 10%, transparent); color: var(--sb-hi); }
#nav a[aria-current] { background: color-mix(in srgb, var(--sb-hi) 8%, transparent); color: var(--sb-hi); font-weight: 650; }

main { min-width: 0; padding: 1.5rem 2.5rem 4rem; }
article { max-width: 54rem; }
.crumb { margin: 0; color: var(--muted); font-size: .85rem; }
article h1 { font-size: 2rem; line-height: 1.2; margin: .3rem 0 1rem; }
article h2 { margin-top: 2.2rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
article h3 { margin-top: 1.6rem; }
.headerlink { margin-left: .35rem; color: var(--line); text-decoration: none; font-weight: 400; }
article h1 .headerlink { display: none; }
h2:hover .headerlink, h3:hover .headerlink { color: var(--muted); }
table { display: block; overflow-x: auto; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
th, td { border: 1px solid var(--line); padding: .4rem .6rem; vertical-align: top; text-align: left; }
th { background: var(--panel); }
blockquote { margin: 1rem 0; padding: .6rem 1rem; background: var(--panel); border-radius: var(--radius); color: var(--muted); }
.mermaid { margin: 1.2rem 0; padding: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
           overflow-x: auto; text-align: center; }
footer { max-width: 54rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line);
         color: var(--muted); font-size: .82rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .8rem; margin: 1rem 0; }
.cards a { display: block; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
           color: var(--ink); text-decoration: none; background: var(--panel); }
.cards a:hover { border-color: var(--accent); background: var(--panel-alt); }
.cards strong { display: block; color: var(--accent); margin-bottom: .2rem; }
.cards span { font-size: .88rem; color: var(--muted); }

.toc { position: sticky; top: 3.5rem; height: calc(100vh - 3.5rem); overflow-y: auto; padding: 1.6rem 1rem; font-size: .82rem; }
.toc ul { list-style: none; margin: 0; padding-left: .7rem; }
.toc > .toc > ul { padding-left: 0; }
.toc a { display: block; padding: .15rem 0; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

@media (max-width: 1150px) { .layout { grid-template-columns: 16rem minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 800px) {
  .layout { display: block; }
  .menu { display: block; }
  .brand .sub { display: none; }
  #nav { display: none; position: fixed; inset: 3.5rem 0 0 0; z-index: 4; height: auto; background: var(--bg); }
  #nav.open { display: block; }
  main { padding: 1rem 1.1rem 3rem; }
}
@media print { .top, #nav, .toc { display: none; } .layout { display: block; } }
.mode { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius);
        font: inherit; font-size: .85rem; padding: .3rem .6rem; cursor: pointer; white-space: nowrap; }
.mode:hover { color: var(--ink); border-color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lang, .cockpit { text-decoration: none; }
