/*
  The boot page (index.html's #boot-failed, public/boot.js; docs/design/parity/w4-recovery.md
  "boot-failure-screen"): what shows when the bundle itself failed to load, so it cannot use the
  bundle's styles. Its three colours are tokens.css's own, held equal by a law (src/app/boot.test.ts):
  the window's background, its text and its muted text. Same origin, so the strict style-src takes it.
  Only the page's background and the block are styled here: the bundle's own styles own the rest.
*/

:root {
  --boot-surface-0: #050609;
  --boot-fg: #e5e7eb;
  --boot-fg-muted: #9299ab;
}

html {
  background: var(--boot-surface-0);
}

#boot-failed:not([hidden]) {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--boot-surface-0);
  color: var(--boot-fg);
  font: 14px system-ui, sans-serif;
}

#boot-failed p {
  margin: 0;
}

#boot-failed span {
  display: flex;
  gap: 8px;
}

#boot-failed button {
  font: inherit;
  font-size: 12px;
  color: var(--boot-fg-muted);
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
}

#boot-failed button:hover {
  color: var(--boot-fg);
}

/*
  The window's seats before the bundle (index.html's boot-shell; the first render replaces it). Pure CSS,
  so the layout of this width is there in the first paint, with no script and nothing measured: a law
  (src/app/boot.test.ts) holds its widths to lib/config.ts. No words: nothing here can be false.
*/
:root {
  --boot-seat: #1a1b23;
  --boot-rail: 60px;
  --boot-sidebar: var(--boot-kept-sidebar, 300px);
}

[data-slot="boot-shell"] {
  position: fixed;
  inset: 0;
  display: flex;
  pointer-events: none;
}

[data-slot="boot-shell"] i,
[data-slot="boot-shell"] b {
  display: block;
  flex: none;
}

[data-shell="rail"] {
  width: var(--boot-rail);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  box-sizing: border-box;
}

/* The sidebar's toggle stands here: no seat of a thing to be read. */
[data-shell="rail"] i:first-child {
  background: none;
}

[data-shell="rail"] i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--boot-seat);
}

[data-shell="rail"] b {
  flex: 1;
}

[data-shell="sidebar"] {
  width: var(--boot-sidebar);
  flex: none;
  padding: 16px 44px 16px 8px;
  box-sizing: border-box;
}

[data-shell="sidebar"] i {
  height: 32px;
  border-radius: 16px;
  background: var(--boot-seat);
}

[data-shell="top"] {
  display: none;
}

/* The sidebar this viewer kept collapsed (public/boot.js), as the shell opens it. */
:root[data-boot-sidebar="collapsed"] [data-shell="sidebar"] {
  display: none;
}

/* lib/config.ts SIDEBAR_COLLAPSE_PX: too narrow for the sidebar beside the thread. */
@media (max-width: 899px) {
  [data-shell="sidebar"] {
    display: none;
  }
}

/* lib/config.ts COMPACT_QUERY: a phone. No rail on the window: the column's own row. */
@media (max-width: 499px) {
  [data-shell="rail"] {
    display: none;
  }
  [data-shell="top"] {
    flex: 1;
    display: flex;
    justify-content: space-between;
    padding: 24px 16px;
  }
  [data-shell="top"] i {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--boot-seat);
  }
}