/* MONAS reading plane: hide Logseq product navigation and non-reading chrome.
   Shared across every MONAS site via nginx sub_filter (see the "Site: <n>"
   blocks in default.conf) -- edit only this one file, never a per-site copy.
   Pairs with debrand.js (Flashcards has no href, so it is hidden there by
   text match instead of by selector). */

/* 2026-09-11, RESEARCH-reading-measure.md §6 (DeepSeek, Perplexity, Gemini
   reconciled): ~62 characters per line is the target for dense philosophical
   prose in Inter at 16px -- above the German compound-word floor (~58 CPL),
   below the dense-argument ceiling (~66 to 68 CPL). A 640px column
   (640 - 64px padding - 40px bullet/fold gutter ~= 536px text box ~= 62.5
   CPL at Inter's measured 8.576px/char advance) lands in that reconciled
   range. Logseq's own export sets --ls-main-content-max-width: 810px
   (style.css); this overrides the default WITHOUT !important, so the
   reader's own drag (server-live-comments.js's passageHandle(), which writes
   the same variable as an inline style on the root) still wins, exactly as
   the app's own narrow/wide toggle already does.
   line-height 1.6 and ~1em paragraph spacing are the same brief's own two
   additions: WCAG's floor is 1.5, and a narrower column wants a little more
   leading because it breaks lines more often; paragraph spacing lets a
   dense argument read as structural units without a first-line indent. */
:root {
  --ls-main-content-max-width: 640px;
}
.cp__sidebar-main-content .block-content {
  line-height: 1.6;
}
/* level="1" is Logseq's own attribute for a page's top-level blocks (verified
   live in the export's DOM); each one is the reading column's paragraph
   unit. Scoped to level 1 only, so nested sub-points keep their own
   (already present) indentation rhythm rather than doubling up spacing. */
.cp__sidebar-main-content .ls-block[level="1"] {
  margin-bottom: 1em;
}

/* 2026-09-11, SPEC-COMMENT-COLUMN.md §3ter: the arrival of a comment is a
   felt, subtle event, not a silent reflow. The comment plane mounting or
   unmounting (server-live-comments.js's applyColumnFit()) changes the
   reading column's own flex-basis/width/margin as it moves between centred
   (no plane) and shared (plane present); transition those so the move
   eases over 200 to 300ms rather than snapping. The plane's own matching
   transition lives beside the rest of its geometry, in
   server-live-comments.js's injected stylesheet. prefers-reduced-motion
   drops straight to the end state -- no motion, per the spec. */
.cp__sidebar-main-content {
  transition: flex-basis .25s ease-out, margin-left .25s ease-out,
    margin-right .25s ease-out, width .25s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .cp__sidebar-main-content {
    transition: none;
  }
}

/* Left sidebar: keep the sidebar itself (page tree, favorites, journal nav);
   remove only the Logseq product-navigation links that don't belong on the
   reading plane. */
#left-sidebar a[href="#/whiteboards"],
#left-sidebar a[href="#/graph"],
#left-sidebar a[href="#/all-pages"] {
  display: none !important;
}

/* 2026-08-16: on the publish-spa (2026-07-21 deVries-route) build, "Graph"
   also renders in the top toolbar (.r.flex.drag-region), not only the left
   sidebar -- confirmed live on wilfridsellars.monas.one. Same #/graph
   product feature; hidden unconditionally rather than re-scoping the rule
   above, so this is additive and cannot change behavior anywhere the old
   selector already matched. */
a[href="#/graph"] {
  display: none !important;
}

/* ---- Right sidebar. The rule here used to be
     .toggle-right-sidebar, #right-sidebar { display: none !important }
   written 2026-08 on the reasoning that the panel had "no reading-plane
   purpose". That was wrong, and it broke two reading gestures for a month:
   shift-click on a bullet and Cmd-Enter in the search palette both open INTO
   this panel, so with the panel hidden they did nothing at all (owner,
   2026-09-09: "shift-clicking individual bullets and opening to the side
   still doesn't work").

   The layout the owner fixed on 2026-09-09 is text | comments | right sidebar:
   the sidebar shows what the reader put there. The commentary notes do not
   collide with it, being positioned per anchor block with their own width key
   (server-live-comments.js, the R34-2 note at line 103).

   So the panel and its toggle stay, and only Logseq's own product items are
   hidden. Item kinds come from the publish bundle, which builds each entry as
   div.sidebar-item.item-type-<kind>, kind one of block, page, contents, help,
   page-graph. "help" opens Logseq's docs, community, about and terms, so
   hiding it is also a debranding requirement. ---- */
.sidebar-item.item-type-help,
.sidebar-item.item-type-page-graph {
  display: none !important;
}

/* ---- Law IX / ORIENTATION: "Colour is a hover state, never a resting one."
   Logseq paints every link with its own default blue AT REST, which breaks
   that law on every MONAS site. MONAS's own designed palette
   (platform/baseline/branding/custom.css, 102 lines, Paper/Light/Night with
   proper --ls-link-* values) is loaded by ZERO live sites -- the reinject.sh
   index.html path it depended on is wiped by every raw Logseq re-export, so
   what every reader has actually been seeing all along is Logseq's raw
   default theme. Migrating that whole palette into this serve-time file is
   DESIGN-01 in BACKLOG.md and is NOT done here.
   This rule restores the law for links only, scoped to the reading plane so
   it cannot touch toolbar/sidebar affordances: ink at rest, the single
   accent on hover. The underline stays -- remove it and the reader loses
   the ability to see that a link is a link (Law I), which is not decoration.
   Falls back through the palette's own variables so it composes correctly,
   rather than being overridden, once DESIGN-01 lands. ---- */
#main-content-container a.external-link,
#main-content-container a.page-ref,
#main-content-container a.block-ref {
  color: inherit;
  text-decoration-color: var(--ls-border-color, #cfc8b8);
}

#main-content-container a.external-link:hover,
#main-content-container a.page-ref:hover,
#main-content-container a.block-ref:hover {
  color: var(--ls-link-text-hover-color, #2c4456);
  text-decoration-color: currentColor;
}

/* ---- 2026-09-08, owner: the "..." menu in the top-right corner (Export graph,
   Toggle theme) is gone from every MONAS page. On this publish build (Logseq
   0.10.15) its trigger is .toolbar-dots-btn inside #head; with the trigger
   hidden the dropdown has nothing to open from. "Export graph" was never
   authorised on a gated edition; the theme follows Logseq's own default until
   a MONAS colour scheme exists (owner, 2026-08-28). Shared file: this hides
   the menu on every site at once. ---- */
#head .toolbar-dots-btn {
  display: none !important;
}

/* ---- 2026-09-09, owner, from his phone: "I don't need all these symbols at
   the bottom. none of these!" On a phone the publish app draws its mobile
   footer (frontend.mobile.footer: div.cp__footer with four button.bottom-action:
   microphone = audio recording, search, "notes" = document mode, edit = new
   block) plus, while editing or recording, #mobile-editor-toolbar and
   #audio-record-toolbar. None of it belongs to a reading edition. Measured in
   the 0.10.15 publish bundle and style.css (cp__footer 11 rules; no ids on the
   bar or its buttons). The top header (#head) is untouched. ---- */
.cp__footer,
#mobile-editor-toolbar,
#audio-record-toolbar {
  display: none !important;
}

/* 2026-09-11: the right sidebar's default Logseq chrome has no MONAS purpose on a
   reading surface, and the header's Home button leads nowhere a reader needs. Remove
   the quick-links row (Contents / Page graph / Help) and the Home button. The sidebar
   itself stays: a block opened by shift-click still renders there with its own header.
   One unified experience (MONAS manifesto): no controls that open a separate place. */
.cp__header button[title="Home"] { display: none !important; }
/* 2026-09-17: the topbar strip is shown again. It holds the button that adds
   the Contents item, which is the workbench (renamed in debrand.js). With the
   strip hidden, a reader whose sidebar items were cleared had no way back and
   saw an empty panel, which is what the owner saw on this date. The other two
   buttons, Page graph and Help, are hidden by name in debrand.js, since CSS
   cannot select on button text. */

/* 2026-09-11: the right sidebar's default items (Contents, Help, Page graph) are Logseq
   chrome with no MONAS purpose, and a reader who clicks into them is trapped. Hide the
   items by type, the same way .item-type-page-graph is already hidden. */
/* 2026-09-17: item-type-contents is no longer hidden. It IS the workbench,
   per ZK I task 6, which already ruled that the blanket hide be replaced by
   two targeted ones, and per the owner on this date. Help stays hidden: it
   opens Logseq's docs, community and terms, which is the trap that rule was
   written for. */
.sidebar-item.item-type-help { display: none !important; }

/* 2026-09-11 REGRESSION FIX: the left sidebar is position:fixed, so the content must be
   pushed right by its width when open, which the app does with
   #main-container.is-left-sidebar-open{padding-left:var(--ls-left-sidebar-width)}. On the
   deployed layer something overrode that and the open sidebar covered the text. Force the
   app's own offset so the sidebar can never sit on top of the reading text. */

/* 2026-09-11 REGRESSION FIX, round 2: tying padding-left to var(--ls-left-sidebar-width)
   is not enough. A stale/low value left in a browser's localStorage (e.g. 160, from before
   debrand.js started clearing the legacy ls-left-sidebar-width key) makes the app render
   #left-sidebar / .left-sidebar-inner at about 217px while the var-driven padding-left
   lands at a different, desynced number: the sidebar's own rendered width and the var used
   for the content offset are not the same computation inside the app, so they can drift
   apart. A clean browser (no stale value) gives 246/246 and no overlap; a stale one does
   not. Fix (round 3, 2026-09-12): pin the sidebar's rendered width and the content offset to
   ONE variable, --ls-left-sidebar-width, with a 250px fallback. Because both read the same
   number they cannot desync, and because armSidebarHandles() in debrand.js writes that
   variable on a drag (from monas.lsbw), the reader can drag the sidebar wider or narrower and
   the content moves with it, never under it. The fallback covers the boot moment before the
   variable is set. Scoped to the OPEN state only, so the closed sidebar still collapses. */
#main-container.is-left-sidebar-open #left-sidebar,
#main-container.is-left-sidebar-open .left-sidebar-inner {
  width: var(--monas-lsbw, 250px) !important;
  min-width: var(--monas-lsbw, 250px) !important;
  max-width: var(--monas-lsbw, 250px) !important;
}
#main-container.is-left-sidebar-open {
  padding-left: var(--monas-lsbw, 250px) !important;
}

/* 2026-09-12: fullscreen reading. In document mode (t d) the top bar hides so
   the reader sees only the text. It overlays (position:fixed) rather than push,
   so the reading line never jumps when it comes and goes (Law II). It returns
   on cursor-to-top (desktop) or scroll-up (mobile), and shows briefly on entry
   so the controls stay discoverable -- debrand.js drives .monas-fs (document
   mode is on) and .monas-fs-peek (revealed). prefers-reduced-motion drops the
   slide. */
:root.monas-fs .cp__header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--ls-secondary-background-color, var(--ls-primary-background-color, #10302f));
  transform: translateY(-100%) !important;
  transition: transform 0.22s ease-out;
  will-change: transform;
}
:root.monas-fs.monas-fs-peek .cp__header {
  transform: translateY(0) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
@media (prefers-reduced-motion: reduce) {
  :root.monas-fs .cp__header {
    transition: none;
  }
}

/* 2026-09-12: read-only front. Logseq's block context menu (Card, Copy, Cut,
   Delete, Copy ref) is editing UI with no place on a read-only publish; a
   long-press raised it on mobile and confused the reader. Hidden on every site.
   The browser's own text selection and copy are separate and untouched. */
.block-context-menu-content,
.custom-context-menu:has(.block-context-menu-content) {
  display: none !important;
}
