/* A tree page's tab (page-view.js, docs/tree-pages.md). */
/* A bar across the top (where in the page, then ✏️, or Cancel and Done
   while editing), then the page's lines, which scroll, or its editor. */
#page-view { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font-family: var(--font); }
#page-view[hidden] { display: none; }
.page-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.page-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 13px; }
.page-crumbs::-webkit-scrollbar { display: none; }
.page-crumb { flex: none; max-width: 16em; overflow: hidden; text-overflow: ellipsis; padding: 2px 4px; border: 0; border-radius: 3px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
button.page-crumb:hover { background: var(--hover); color: var(--ink); }
.page-crumb.here { color: var(--ink); }
.page-sep { flex: none; color: var(--muted); }
.page-bar > button { flex: none; padding: 3px 10px; border: 1px solid var(--border); border-radius: 4px; background: none; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.page-bar > button:hover { background: var(--hover); }
.page-bar > .page-done { background: var(--accent); border-color: var(--accent); }
.page-bar > .page-done:hover { background: var(--accent-hover); }
#page-view:not(.page-editing) :is(.page-done, .page-cancel), #page-view.page-editing .page-edit { display: none; }
#page-view.page-editing .page-crumb { pointer-events: none; }
.page-note { flex: none; margin: 0; padding: 0 12px; font-size: 12px; color: var(--muted); }
.page-note:not(:empty) { padding: 6px 12px; }

/* The lines: each indented as in the file (--in columns past the line
   gone into), wrapping under itself, with an arrow left of a line with
   lines under it to fold them. */
.page-text { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px 40vh 26px; font-size: var(--text); line-height: var(--text-line); }
.page-line { position: relative; padding-left: calc(var(--in, 0) * 1ch); white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 3px; }
.page-line[hidden] { display: none; }
.page-line.pressing { background: var(--hover); transition: background .45s; }
.page-h { font-weight: 700; }
.page-h1 { font-size: 1.15em; }
.page-fold { position: absolute; left: calc(var(--in, 0) * 1ch - 22px); top: 0; width: 20px; height: var(--text-line); padding: 0; border: 0; background: none; cursor: pointer; }
.page-fold::before { content: ""; position: absolute; left: 6px; top: calc(var(--text-line) / 2 - 4px); width: 5px; height: 5px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: .5; transition: transform .1s; }
.page-line.folded > .page-fold::before { transform: rotate(-45deg); opacity: 1; border-color: var(--ink); }
.page-fold:hover::before { opacity: 1; }
/* A folded line says so at its end. */
.page-line.folded > .page-words::after { content: " …"; color: var(--muted); }
@media (pointer: coarse) {
  /* A long press goes into a line, so it doesn't select its words. */
  .page-text { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .page-fold { width: 28px; left: calc(var(--in, 0) * 1ch - 26px); }
}

/* Editing: the editor fills what's below the bar. */
.page-editor { height: 100%; display: flex; }
#page-view.page-editing .page-text { padding: 0; overflow: hidden; }
.page-editor > .monaco-editor { flex: 1; }
.page-box { flex: 1; width: 100%; height: 100%; min-height: 0; max-height: none; margin: 0; padding: 8px 12px 40vh; border: 0; border-radius: 0; resize: none; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--text); line-height: var(--text-line); tab-size: 4; white-space: pre-wrap; }
.page-box:focus { outline: none; }

/* A line just written in the log from the message box, for a moment. */
.page-line.page-new { background: var(--hover); transition: background 1s; }
