/* @tokens — kit-style: the style of the Shtukbase lens kit for any HTML page of a project.
 *
 * The classes are here: the page base, the header, chips and links, the card, markdown, the board and the gallery,
 * at the end the page column (.kx-page). The values of the variables (colors, shadows, radii, font)
 * are in the skins skins/<id>.css: the “Kit” skin (skins/kit.css) is required and included first.
 * The lenses package builds its lib/kit.css from this file, the skins and its own part (canvas, arrows, views).
 * The canvas, arrows, the record panel and the lens views are not here: only lenses need them.
 */

/* The Shtukbase lens components. Common styles for all templates and for own lenses. */
:root { font-family: var(--font); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--selection); }

/* ---------- shell: the header as in Shtukbase ---------- */
.lx-app { display: flex; flex-direction: column; height: 100%; }
.lx-top { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px 0 12px; background: var(--bg); flex-shrink: 0; z-index: 5; }
.lx-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 auto; overflow: hidden; font-size: 14px; }
.lx-crumbs > * { flex: none; }
.lx-crumbs > .lx-crumb.cur { flex: 0 1 auto; min-width: 40px; overflow: hidden; }
.lx-crumb { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border-radius: 6px; text-decoration: none; color: var(--ink); white-space: nowrap; min-width: 0; }
a.lx-crumb:hover { background: var(--wash); color: var(--ink); }
.lx-crumb.cur { color: var(--ink); cursor: default; }
.lx-crumb .t { overflow: hidden; text-overflow: ellipsis; }
.lx-crumb .pic { font-size: 15px; line-height: 1; }
.lx-crumbs .sep { color: var(--faint); padding: 0 1px; }
.lx-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.lx-searchbox { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; margin-right: 4px; border-radius: 6px; background: var(--wash); color: var(--faint); cursor: text; }
.lx-searchbox:focus-within { background: var(--bg); box-shadow: inset 0 0 0 1px var(--lx-accent), 0 0 0 2px var(--accent-soft); color: var(--lx-muted); }
.lx-search { border: 0; background: none; outline: none; width: 150px; font: inherit; font-size: 13px; color: var(--ink); padding: 0; }
.lx-search::placeholder { color: var(--faint); }
.lx-search::-webkit-search-cancel-button { display: none; }
.lx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 28px; min-width: 28px; padding: 0 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--lx-muted); cursor: pointer; font-size: 13px; white-space: nowrap; user-select: none; transition: background .08s; }
.lx-btn:hover { background: var(--wash); color: var(--ink); }
.lx-btn:active { background: var(--wash2); }
.lx-btn.icon { padding: 0; width: 28px; }
.lx-btn.on { background: var(--accent-soft); color: var(--lx-accent); }
.lx-ico { display: inline-flex; }
.lx-ico svg { display: block; }
.lx-app.side-open .lx-top .lx-btn[title="Details"] { background: var(--wash); color: var(--ink); }

.lx-body { flex: 1; min-height: 0; display: flex; border-top: 1px solid var(--line); }
.lx-work { flex: 1; min-width: 0; position: relative; display: flex; }
.lx-main { flex: 1; min-width: 0; overflow: auto; position: relative; }


/* ---------- chips, links (Shtukbase options) ---------- */
.lx-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 20px; height: 20px; padding: 0 6px; border-radius: 4px; white-space: nowrap;
  background: var(--cb, var(--cb-default)); color: var(--cf, var(--cf-default)); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.lx-chip.dot { border-radius: 10px; padding: 0 8px 0 7px; }
.lx-chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cc, var(--c-default)); flex-shrink: 0; }
.lx-ref { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0 4px 0 2px; border-radius: 4px; text-decoration: none; cursor: pointer;
  font-size: inherit; color: var(--ink); vertical-align: baseline; }
.lx-ref .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.lx-ref:hover { background: var(--wash); }
.lx-ref.missing { color: var(--faint); cursor: default; }
.lx-icon { font-style: normal; flex-shrink: 0; }

/* ---------- card (like a Shtukbase board card) ---------- */
.lx-card { position: relative; background: var(--lx-card); border-radius: var(--lx-radius); padding: 8px 10px; box-shadow: var(--shadow);
  cursor: pointer; transition: box-shadow .1s, opacity .15s, background .08s; min-width: 0; }
.lx-card:hover { background: color-mix(in srgb, var(--lx-card) 94%, var(--ink)); }
:root[data-theme="dark"] .lx-card:hover { background: var(--card-hover); }
.lx-card .hd { display: flex; align-items: flex-start; gap: 6px; }
.lx-card .ttl { font-weight: 500; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.lx-card .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; color: var(--lx-accent); margin-top: 3px; line-height: 1.35; }
.lx-card .sub { color: var(--lx-muted); font-size: 12px; margin-top: 3px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lx-card .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lx-card .cnt { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; padding-left: 6px; }
.lx-card.compact { padding: 5px 8px; }
/* a paragraph card: the text under the title is read in full, so it is not cut and is set larger */
.lx-card.full .sub, .lx-look-atlas .lx-card.full .sub { display: block; overflow: visible; -webkit-line-clamp: none;
  font-size: 12.5px; line-height: 1.5; color: var(--ink); margin-top: 4px; text-wrap: pretty; }
.lx-card.full .ttl, .lx-look-atlas .lx-card.full .ttl { font-size: 14px; font-weight: 600; line-height: 1.35; }
.lx-card.full, .lx-look-atlas .lx-card.full { padding: 10px 12px 11px; }
/* A card with a picture: a large icon on the left, the title and text on the right (the art option); the own record icon is not drawn. */
.lx-card.has-art, .lx-look-atlas .lx-card.has-art { display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 16px; align-items: start; padding: 14px 16px 14px 14px; }
.lx-card.has-art > .art { grid-column: 1; grid-row: 1 / span 8; display: block; width: 84px; height: 84px; margin: 0; user-select: none; pointer-events: none; }
.lx-card.has-art > :not(.art) { grid-column: 2; min-width: 0; }
/* A paragraph card shows its marks in the atlas view too, where ordinary cards hide them. */
.lx-look-atlas .lx-card.full .chips { display: flex; margin-top: 8px; }
.lx-card.has-art .ttl, .lx-look-atlas .lx-card.has-art .ttl { font-size: 15px; font-weight: 650; line-height: 1.3; }
.lx-card.compact .ttl { font-size: 13px; }
.lx-card.sel { box-shadow: 0 0 0 2px var(--lx-accent), var(--shadow-lift); }
.lx-card.hl { box-shadow: 0 0 0 1.5px var(--lx-accent), var(--shadow); }
.lx-focus .lx-card:not(.hl):not(.sel), .lx-card.off { opacity: .6; }
.lx-card.match { box-shadow: 0 0 0 2px var(--c-yellow), var(--shadow); }


/* markdown */
.lx-md { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.lx-md h1, .lx-md h2, .lx-md h3, .lx-md h4 { line-height: 1.3; margin: 1.4em 0 .4em; font-weight: 650; }
.lx-md h1 { font-size: 1.6em; } .lx-md h2 { font-size: 1.3em; } .lx-md h3 { font-size: 1.12em; } .lx-md h4 { font-size: 1em; }
.lx-md > :first-child { margin-top: 0; }
.lx-md p { margin: .5em 0; }
.lx-md ul, .lx-md ol { margin: .4em 0; padding-left: 1.5em; }
.lx-md li { margin: .15em 0; }
.lx-md li.task { list-style: none; margin-left: -1.3em; }
.lx-md code { font-family: var(--mono); font-size: .86em; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; }
.lx-md pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; font-size: 13px; line-height: 1.45; }
.lx-md pre code { background: none; border: 0; padding: 0; }
.lx-md blockquote { margin: .6em 0; padding: .1em 0 .1em 14px; border-left: 3px solid var(--line2); color: var(--lx-muted); }
.lx-md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.lx-md table { border-collapse: collapse; margin: .7em 0; font-size: 13.5px; display: block; overflow-x: auto; }
.lx-md th, .lx-md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.lx-md th { background: var(--bg); font-weight: 600; }
.lx-md img { max-width: 100%; border-radius: 8px; }
.lx-md a { color: var(--lx-accent); text-decoration: none; }
.lx-md a:hover { text-decoration: underline; }
.lx-md a.int { border-bottom: 1px solid color-mix(in srgb, var(--lx-accent) 35%, transparent); }
.lx-md .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.lx-md .callout { background: var(--bg); border-radius: 8px; padding: 8px 12px; }

/* ---------- common grids ---------- */
.lx-empty { color: var(--faint); font-size: 12.5px; padding: 6px 2px; }
.lx-kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line2); border-radius: 4px; padding: 0 4px; color: var(--lx-muted); }

/* ---------- board ---------- */
.lx-board { display: grid; grid-auto-flow: column; grid-auto-columns: 270px; width: max-content; max-width: 100%; margin-inline: auto; gap: 14px; padding: 22px 26px 60px; align-items: start; overflow-x: auto; min-height: 100%; }
.lx-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lx-col > .ch { display: flex; align-items: center; gap: 7px; padding: 6px 4px; font-weight: 600; font-size: 13px; cursor: pointer; border-radius: 8px; }
.lx-col > .ch:hover { background: var(--panel); }
.lx-col > .ch .n { margin-left: auto; color: var(--faint); font-weight: 400; font-size: 12px; }
.lx-col > .cd { color: var(--lx-muted); font-size: 12px; padding: 0 4px 4px; }
.lx-meter { display: flex; gap: 10px; flex-wrap: wrap; color: var(--lx-muted); font-size: 11.5px; margin-top: 7px; }
.lx-meter b { color: var(--ink); font-weight: 600; }

/* ---------- gallery ---------- */
.lx-gallery-wrap { padding: 14px 20px 28px; max-width: 1200px; }
.lx-gallery-layer h2 { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; margin: 14px 0 8px; color: var(--ink); }
.lx-gallery-layer h2 .n { color: var(--lx-muted); font-weight: 400; font-size: 12px; }
.lx-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.lx-gallery a.lx-card { text-decoration: none; display: block; padding: 10px 12px; }
.lx-gallery .big { font-size: 20px; margin-bottom: 4px; }
.lx-gallery .ttl { font-size: 14px; }
.lx-gallery .sub { -webkit-line-clamp: 3; font-size: 12px; }


/* ---------- kit-style addition: a page outside a lens ---------- */
.kx-page { max-width: var(--block-max); margin: 0 auto; padding: 32px 24px 64px; }
.kx-page.wide { max-width: 1120px; }
.kx-section { margin: 28px 0; }
.kx-section > h2 { font-size: 13px; font-weight: 600; color: var(--lx-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; }
.kx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }

/* ---------- the style and theme switch of page.js ---------- */
.kx-switch { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); font-size: 12px; }
.kx-switch.floating { position: fixed; right: 12px; bottom: 12px; z-index: 50; }
.kx-switch select, .kx-switch button { height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; padding: 0 6px; cursor: pointer; }
.kx-switch select:hover, .kx-switch button:hover { background: var(--wash); }
@media print { .kx-switch { display: none; } }
