lagrange-library 0.3.2

A WASI-rendered Markdown static site facility — multilingual out of the box
// lagrange docs-shell styles. The chrome (shell, header, sidebar, menu,
// dialogs) is hikari's own SCSS — nothing here restyles it. This file
// only covers the docs-specific gaps: the app root's height chain, the
// reading column, the header search (a Search icon button opening a
// search window on every viewport), and the mermaid sub-app host. There is no
// footer band: a static docs site has no status to report.
//
// The root rule is the host's obligation, not decoration: HkFaceShell's
// `.s-admin-shell` is `height:100%` + `overflow:hidden`, so without a
// definite-height `#app` the percentage resolves to auto and the shell
// grows with the document (measured in Chrome: a 913px viewport got a
// 1972px shell, and the sidebar/header never pinned). Chest's theme.scss
// carries the same `#app{height:100dvh;overflow:hidden}` contract.
#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

// The page canvas. hikari's components paint their own surfaces but the
// DOCUMENT behind them is the host's job: left unpainted the browser's
// default white canvas shows through, and in a dark theme the content
// reads near-white-on-white (measured in Chrome — the docs body inherits
// --color-text, so the canvas MUST follow --color-background).
html,
body {
  margin: 0;
  background: rgb(var(--color-background));
  color: rgb(var(--color-text));
}

.lagrange-docs-content {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.lagrange-docs-body {
  // The legacy body HTML ships its own typographic classes; keep the
  // reading measure stable while those rules still apply.
  line-height: 1.7;
}


// ── theme dialog ──────────────────────────────────────────────────────────
// The theme dialog's inner menu caps itself at 22rem and centers — sized
// for the account face's narrow sheet. The docs theme modal is wider, so
// the centered menu left a dead band on each side (user-reported, with the
// empty band circled). Let the docs instance use the modal's width.
.lagrange-docs-search-modal .s-theme-menu,
.hk-modal-content .s-theme-menu {
  max-width: none;
  width: 100%;
}

// ── header search ─────────────────────────────────────────────────────────

// The admin header's page title truncates at 8rem — a limit sized for the
// ACCOUNT-MENU nickname it was built for, not for page titles: a docs page
// title like "Welcome to celestia-island" needs ~11rem, and unlike the
// account face the docs header has no centre wing competing for the row.
// Widen the docs instance; hikari's account faces keep their 8rem.
// !important is load-bearing: the first draft used the selector
// `.s-admin-header .s-admin-header-title` — a class the header element does
// not wear (it is `s-glass-header s-balanced-header`) — so the rule sat in
// the stylesheet WITHOUT matching anything and the title stayed truncated at
// 8rem. Same-selector + important both wins the cascade and proves itself in
// the browser (measured: computed max-width 8rem before, 24rem after).
.s-admin-header-title {
  max-width: 24rem !important;
}

// Both viewports are trigger-first (2026-11-24): a Search icon button in
// the header's action slot, its popup — an anchored panel on desktop, a
// bottom sheet on phones — carrying the field and results in normal flow
// (the popup is the surface: no absolute positioning, no own background).
.lagrange-docs-search {
  position: relative;
  display: inline-flex;
  align-items: center;
}

// The field's own positioned box: the clear button anchors to THIS, not to
// the outer search span — inside the sheet the results list sits between
// them, and the button drifted onto the third hit (2026-11-24).
.lagrange-docs-search-field {
  position: relative;
  display: block;
}

.lagrange-docs-search-input {
  display: block;
  width: 100%;
  /* Clamped: the header's end wing clips (overflow: hidden) once the
     start wing's min-content eats the row, and a fixed 200px field plus
     the two icon buttons overflowed narrow viewports (round 5). */
  min-width: 0;
  padding-inline-end: 1.6rem;
  height: 30px;
  padding: 0 0.6rem;
  border-radius: var(--hk-radius-control, 8px);
  border: 1px solid color-mix(in srgb, rgb(var(--hk-color-text, 30 30 30) / 0.2), transparent);
  background: color-mix(in srgb, rgb(var(--hk-color-text, 30 30 30) / 0.04), transparent);
  color: inherit;
  font-size: 0.85rem;
  outline: none;

  &:focus-visible {
    border-color: rgb(var(--hk-color-primary, 60 120 220));
  }
}

.lagrange-docs-search-clear {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;

  &:hover,
  &:focus-visible {
    opacity: 1;
    background: color-mix(in srgb, rgb(var(--hk-color-text, 30 30 30) / 0.1), transparent);
  }
}

.lagrange-docs-search-busy {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  padding: 0.5rem 0.7rem;
  border-radius: var(--hk-radius-surface, 10px);
  background: rgb(var(--hk-color-surface, 255 255 255));
  border: 1px solid color-mix(in srgb, rgb(var(--hk-color-text, 30 30 30) / 0.12), transparent);
  font-size: 0.8rem;
  opacity: 0.85;
}

.lagrange-docs-search-error {
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.lagrange-docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(420px, 90vw);
  max-height: 60vh;
  overflow: auto;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: var(--hk-radius-surface, 10px);
  background: rgb(var(--hk-color-surface, 255 255 255));
  border: 1px solid color-mix(in srgb, rgb(var(--hk-color-text, 30 30 30) / 0.12), transparent);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
}

.lagrange-docs-search-empty {
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.lagrange-docs-search-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem 0.6rem;
  border-radius: var(--hk-radius-control, 8px);
  text-decoration: none;
  color: inherit;

  &:hover,
  &:focus-visible {
    background: color-mix(in srgb, rgb(var(--hk-color-primary, 60 120 220) / 0.1), transparent);
  }
}

.lagrange-docs-search-hit-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.lagrange-docs-search-hit-heading {
  font-size: 0.75rem;
  opacity: 0.75;
}

.lagrange-docs-search-hit-snippet {
  font-size: 0.78rem;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// Mobile: the trigger is one icon slot, exactly like its neighbours.
.lagrange-docs-search[data-shape="sheet"] {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lagrange-docs-search-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, 86vw);

  .lagrange-docs-search-input {
    width: 100%;
    height: 34px;
    font-size: 0.95rem;
  }

  .lagrange-docs-search-results {
    // In flow inside the panel: the popover owns the surface.
    position: static;
    width: 100%;
    max-height: 55vh;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .lagrange-docs-search-busy {
    position: static;
    padding: 0.4rem 0;
  }

  .lagrange-docs-search-clear {
    inset-inline-end: 8px;
  }
}


// ── header end cluster ────────────────────────────────────────────────────
.lagrange-docs-header-end {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

// ── mermaid sub-app host ──────────────────────────────────────────────────
.lagrange-docs-mermaid {
  width: 100%;
  min-height: 120px;
}