/* Copyright (c) 2026 LB IT Cloud SAS. All rights reserved.
   Proprietary source of the LB IT Cloud website. See LICENSE.

   THE KNOWLEDGE LIBRARY — the index, the article page, the thumb, and the script viewer.

   Written in the tokens only, so the five palettes and the dark theme come for free: since
   09/10/2026 theme.css redefines --panel, --line, --ink, --brand and --a1 per palette and per
   theme, and site.css the three fixed accents and the state colours. The code colours are no
   exception any more: the highlighter's tones are the fixed accents, the danger red and the
   brand, all drawn to hold on both grounds, so a script reads in every palette and theme.

   One prefix per job, so a rule can be found by its name: `kb` for the library, `sv` for the
   script viewer. Rules the free tools already define (.panel, .notice, .disclaim, .tbtn) are
   not repeated: an article loads tools.css beside this file.
   --------------------------------------------------------------------------- */

/* THE CHAMFER, on this library's own pieces: the cut site.css gives its plates and tags, with
   the same polygon and the same `corner-shape` variant. Each piece below carries a fill, never a
   border, for the reason site.css gives — a clipped border loses its diagonal. */
.kbitem, .kbchip, .kbcallout, .svnum {
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
@supports (corner-shape: bevel) {
  .kbitem, .kbchip, .kbcallout, .svnum {
    clip-path: none; border-radius: var(--cut) 0 var(--cut) 0; corner-shape: bevel;
  }
}

/* =========================================================================
   1. THE INDEX
   ========================================================================= */

.kbtools { display: flex; flex-direction: column; gap: 14px; margin-bottom: 26px; }
.kbsearch { position: relative; max-width: 560px; }
.kbsearch svg { position: absolute; left: 14px; top: 50%; margin-top: -9px; color: var(--ink-3); pointer-events: none; }
.kbsearch input {
  width: 100%; padding: 13px 14px 13px 44px; border: 1px solid var(--line); border-radius: 0;
  background: var(--panel); font-size: 15px;
}
.kbsearch input:focus { outline: none; border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.kbchips { display: flex; flex-wrap: wrap; gap: 4px; }
/* Small cut tags, like the tabs over the home page's player: the same shape as everything
   else on the site that can be picked, and the touch colour for the one that is. */
.kbchip {
  --cut: 6px;
  padding: 8px 12px; background: var(--fill); color: var(--ink-2);
  font: 600 12.5px/1 var(--display); letter-spacing: .01em;
  transition: background-color .15s ease, color .15s ease;
}
.kbchip:hover { background: var(--brand-line); color: var(--ink); }
.kbchip[aria-pressed="true"] { background: var(--plate); color: var(--on-plate); }
/* Inside the shape, so the cut cannot clip the ring off. */
.kbchip:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
.kbvb:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kbcount { font: 500 11.5px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

.kblist { display: grid; gap: 14px; }
/* An inventory tag, like the home page's cards: a fill cut at two corners, no border. The rule
   down its left edge is drawn inside it, so the cut keeps its diagonal; the accent still comes
   from the item's POSITION, never from the markup. */
.kbitem {
  --cut: 14px;
  display: block; text-decoration: none; color: inherit; background: var(--panel);
  box-shadow: inset 4px 0 0 var(--a1);
  padding: 22px 26px 22px 30px; transition: background-color .15s;
}
.kblist .kbitem:nth-child(4n+2) { box-shadow: inset 4px 0 0 var(--a2); }
.kblist .kbitem:nth-child(4n+3) { box-shadow: inset 4px 0 0 var(--a3); }
.kblist .kbitem:nth-child(4n+4) { box-shadow: inset 4px 0 0 var(--a4); }
.kbitem:hover { background: color-mix(in srgb, var(--panel) 90%, var(--plate)); }
.kbitem:focus-visible { outline: 2px solid var(--brand); outline-offset: -5px; }
@media (prefers-reduced-motion: reduce) { .kbitem, .kbchip { transition: none; } }
.kbitem h3 {
  font-size: 22px; font-weight: 760; font-stretch: 72%; letter-spacing: -.005em; line-height: 1.15;
  margin: 10px 0 8px; color: var(--ink);
}
.kbitem p { font-size: 14.5px; color: var(--ink-2); max-width: 820px; }
.kbtop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.kbtags { display: flex; flex-wrap: wrap; gap: 6px; }
/* A theme is a reference, so it is written in the reference face: small, square, capitals. */
.kbtag {
  display: inline-block; font: 500 10.5px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; background: var(--brand-soft); color: var(--brand);
}
.kbkind { background: var(--a4-soft); color: var(--a4); }
.kbdate { font: 500 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-left: auto; }
.kbempty { padding: 28px; border: 1px dashed var(--line); color: var(--ink-2); }
.kbmore { margin-top: 22px; font-size: 13.5px; color: var(--ink-3); }

/* =========================================================================
   2. THE ARTICLE
   ========================================================================= */

.kbback {
  display: inline-block; font: 500 11.5px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; margin-bottom: 18px;
}
.kbback:hover { text-decoration: underline; text-underline-offset: 4px; }
.kbhero-tags { margin-top: 14px; }
.kbmeta { margin-top: 12px; font: 500 11.5px/1.5 var(--mono); color: var(--ink-3); }

/* The four facts read as the specification lines of the home page's plate: one ruled row, the
   figure above its explanation, a hairline between them — not four boxes. */
.kbfacts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 30px; max-width: 900px;
  border-top: 1px solid var(--line);
}
.kbfact { padding: 12px 14px 0 0; min-width: 0; }
.kbfact + .kbfact { border-left: 1px solid var(--line); padding-left: 14px; }
.kbfact b { display: block; font: 760 20px/1.15 var(--display); font-stretch: 72%; color: var(--brand); }
.kbfact span { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
@media (max-width: 760px) {
  .kbfacts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .kbfact:nth-child(3) { border-left: 0; padding-left: 0; }
}

/* The reading column. ONLY the prose is held to a measure a reader can follow — paragraphs,
   lists, headings, the boxes that read as prose. Tables, cards and the two-column blocks get
   the whole wrap: held to 860 px, three cards came out 273 px wide and 473 px tall, which is a
   column of text in a box, not a card. The measure is 68 characters of the body face; the
   boxes and the headings stop at about the same right edge. */
.kbprose { margin-top: 18px; }
.kbprose > p, .kbprose > ul, .kbprose > ol { max-width: 68ch; }
.kbprose > h3, .kbprose > .kbnote, .kbprose > .kbcallout, .kbprose > .kbcmd { max-width: 700px; }
.kbprose p { font-size: 16.5px; color: var(--ink-2); line-height: 1.65; margin-top: 14px; }
.kbprose h3 { width: fit-content; border-bottom: 2px solid var(--touch); padding-bottom: 3px; font-size: 22px; font-weight: 760; font-stretch: 72%; letter-spacing: -.005em; margin: 32px 0 4px; }
.kbprose ul, .kbprose ol { margin: 14px 0 0; padding-left: 22px; color: var(--ink-2); font-size: 16.5px; line-height: 1.65; }
.kbprose li { margin-bottom: 6px; }
/* A card inside the prose keeps the card's own type scale: without these, the paragraph and
   heading rules above (same specificity, later in the cascade) would resize it. */
/* Three across, not auto-fit: the script's decisions come in sixes, and auto-fit drew four
   columns on a wide screen, which leaves a row of two. */
.kbprose .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 28px; gap: 18px; }
@media (max-width: 1000px) { .kbprose .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kbprose .cards { grid-template-columns: 1fr; } }
.kbprose .card h3 { font-size: 18px; font-weight: 700; font-stretch: 100%; margin: 0 0 9px; }
.kbprose .card p { font-size: 14.5px; line-height: 1.6; margin-top: 0; }
.kbprose strong, .kbprose b { color: var(--ink); }
/* Inline code in the reference face, a little condensed so a registry path does not take the
   line over. The ground is a shade of the ink, so it reads on a panel, on either section ground
   and in either theme. */
.kbprose code, .kbtable code, .kbcol code, .kbcallout code, .notice code, .lead code, .kbrefs code {
  font-family: var(--mono); font-size: .82em; font-stretch: 87.5%;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--line); padding: 0 4px; overflow-wrap: anywhere;
}
.kbnote { margin-top: 22px; }
.kbnote p { font-size: 13.5px; }
.kbnote b { font-size: 13.5px; }
/* A neutral aside, cut like a tag: the accent's pastel as its fill, the accent on its title. */
.kbcallout { --cut: 12px; margin-top: 22px; padding: 16px 20px; background: var(--a1-soft); }
.kbcallout b { display: block; font: 700 15px/1.3 var(--display); color: var(--a1); margin-bottom: 5px; }
.kbcallout p { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; margin-top: 0; }

/* A command to type. It was a dark terminal block in both themes, which is the one surface on
   the page no palette could reach; it is now the panel, ruled, with the datum mark of the
   kickers down its left edge, in the reference face. */
.kbcmd {
  margin: 16px 0 0; padding: 12px 16px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-left: 3px solid var(--touch);
  font: 500 12.5px/1.65 var(--mono); font-stretch: 87.5%; white-space: pre-wrap; word-break: break-all;
}

.kbtablewrap { margin-top: 20px; overflow-x: auto; }
.kbtable { width: 100%; border-collapse: collapse; font-size: 14.5px; background: var(--panel); border: 1px solid var(--line); }
.kbtable th {
  text-align: left; font: 500 10.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-2); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--ground-2);
}
.kbtable td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); line-height: 1.5; }
.kbtable tr:last-child td { border-bottom: 0; }
.kbtable td:first-child { color: var(--ink); }
.kbkeys td:first-child { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .kbtable thead { display: none; }
  .kbtable, .kbtable tbody, .kbtable tr, .kbtable td { display: block; width: auto; }
  .kbtable tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .kbtable tr:last-child { border-bottom: 0; }
  .kbtable td { border-bottom: 0; padding: 3px 0; }
  .kbtable td[data-label]::before {
    content: attr(data-label); display: block; margin-top: 6px;
    font: 500 10.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
  }
}

/* Two columns as two sheets: square, ruled, the accent along the top edge. */
.kbcols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 26px; }
.kbcol { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--a1); padding: 20px 22px; }
.kbcol:nth-child(2) { border-top-color: var(--a2); }
.kbcol h3 { font-size: 19px; margin: 0 0 4px; }
.kbcol p, .kbcol li { font-size: 14.5px; }
@media (max-width: 900px) { .kbcols { grid-template-columns: 1fr; } }

.kbrefs { margin: 18px 0 0; padding-left: 20px; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); max-width: 860px; }
.kbrefs li { margin-bottom: 6px; }

/* =========================================================================
   3. THE THUMB
   ========================================================================= */

/* The same buttons as the thumb site.js draws above the footer (.lbvb in chrome.css): square,
   ruled, the brand only once a side is chosen. */
.kbvote { max-width: 560px; }
.kbvoteq { font: 760 22px/1.2 var(--display); font-stretch: 72%; }
.kbvotebtns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.kbvb {
  display: inline-flex; align-items: center; gap: 10px; padding: 11px 20px;
  border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 14.5px; color: var(--ink);
}
.kbvb:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.kbvb:disabled { cursor: default; opacity: .55; }
.kbvb[aria-pressed="true"] { opacity: 1; background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.kbvotenote { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

/* =========================================================================
   4. THE SCRIPT VIEWER
   One row per section: a button that opens it, its line range, and its own copy button. The
   code is rendered only when opened — a few hundred highlighted lines nobody asked for would
   only slow the page.
   ========================================================================= */

.svmeta { font: 500 11px/1.4 var(--mono); color: var(--ink-3); }
.svpanel { margin-top: 26px; }

.svsec { border: 1px solid var(--line); margin-bottom: 10px; overflow: hidden; background: var(--panel); }
.svhead { display: flex; align-items: center; gap: 10px; padding-right: 12px; }
.svbtn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 13px 14px; background: none; border: 0; cursor: pointer; text-align: left; color: var(--ink); font: inherit; }
.svbtn:hover { background: var(--ground-2); }
.svbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* The section's number is a reference, not a dot: a small cut tag in the reference face. */
.svnum {
  --cut: 6px;
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; padding: 0 6px;
  background: var(--a1-soft); color: var(--a1); font: 600 11.5px/1 var(--mono); flex: none;
}
.svtxt { flex: 1; min-width: 0; }
.svtxt b { display: block; font-size: 14.5px; font-weight: 650; }
.svtxt span { display: block; font-size: 13px; color: var(--ink-3); line-height: 1.45; margin-top: 2px; }
.svlines { font: 500 11px/1.4 var(--mono); color: var(--ink-3); white-space: nowrap; }
.svchev { font-size: 20px; color: var(--ink-3); transition: transform .15s; }
.svsec[data-open="1"] .svchev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .svchev { transition: none; } }
@media (max-width: 700px) { .svlines { display: none; } }

/* The code sits on the page's own ground, one step back from the panel that holds it, in both
   themes. Martian Mono is wide; at 87.5 % of its width a line of PowerShell is about as long as
   it was in Consolas, so the same scripts fit the same box. The colours are tokens: the three
   fixed accents and the danger red were drawn to read on both grounds, the keywords take the
   palette's brand, and nothing is italic — the face has no italic, and a slanted copy of a
   monospace is harder to read than a quieter colour. */
.svcode {
  margin: 0; max-height: 560px; overflow: auto; border-top: 1px solid var(--line);
  background: var(--ground); color: var(--ink); font: 400 12px/1.65 var(--mono); font-stretch: 87.5%; tab-size: 4;
}
.svcode code { display: block; padding: 10px 0; min-width: max-content; }
.svrow { display: block; white-space: pre; padding-right: 16px; }
.svln { display: inline-block; width: 3.5em; padding-right: 1em; margin-right: 1em; text-align: right; color: var(--ink-3); border-right: 1px solid var(--line); user-select: none; }
.svc { color: var(--ink-3); }
.svs { color: var(--a2); }
.svv { color: var(--a3); }
.svp { color: var(--a4); }
.svn { color: var(--danger); }
.svk { color: var(--brand); font-weight: 700; }
.svf { color: var(--ink); font-weight: 650; }

/* The clipboard fallback's textarea: in the page, never on screen. */
.svoff { position: fixed; left: -9999px; top: 0; }
