/* Papers Café: page layout and the overrides of the editor's chrome stylesheets (loaded last). */
.canvas-pane {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.canvas-region { flex: 1 1 auto; }
.canvas-toolbar { background: var(--panel); border-bottom: 1px solid var(--border); }
.canvas-toolbar .title.cafe-brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--accent);
  text-transform: none;
}
.cafe-lang { font-size: 12px; padding: 3px 8px; }
/* The link to the third-party notices (/NOTICE.txt): small and plain, at the end of the toolbar. */
.cafe-notices { font-size: 11px; color: var(--muted); text-decoration: underline; white-space: nowrap; }
.cafe-notices:hover, .cafe-notices:focus-visible { color: var(--text); }
.canvas-frame-wrap { background: var(--bg); }
.mc-tab-strip { background: var(--panel-2); border-bottom: 1px solid var(--border); }
.mc-gallery { background: var(--bg); }
.canvas-placeholder { background: var(--bg); color: var(--muted); }
.canvas-placeholder strong { color: var(--text); }

/* Not available yet: version history, page setup, the Word download with footnotes, replacing a document by
   importing into it, spelling. Hidden here, in one class, so a later change that brings one back removes it from one row. */
.cafe-off, #er-spell { display: none !important; }

/* The rows kept only because the editor looks their ids up without a null check. */
#cafe-stubs { display: none !important; }

/* Export rows the editor adds itself; each one needs the server's .docx or PDF engine. */
#exp-opt-pdf-clean, #exp-opt-pdf-notes, #exp-opt-pdf-linked, #exp-opt-pdf-accept, #exp-opt-accept, #exp-opt-xlsx { display: none !important; }

/* A right-click menu group left empty by a row that is not drawn here keeps no divider of its own. */
.cafe-menu-off { display: none !important; }
.map-divider:has(+ .cafe-menu-off), .map-divider:has(+ .cafe-menu-off + .map-divider) { display: none; }
.map-divider:first-child, .map-divider + .map-divider { display: none; }
.cafe-menu-off:first-child + .map-divider { display: none; }

/* .docx: the Word rows and the Open button exist only where the page has the .docx engine (/docx/docx-bridge.js
   adds the class). A build without it shows neither. */
html:not(.cafe-docx-on) .cafe-docx { display: none !important; }
.cafe-open-docx svg { width: 16px; height: 16px; vertical-align: -3px; margin-inline-end: 4px; }

/* The .docx engine's status line: visible while it starts (the first time, a ~12 MB download) or works. */
.cafe-docx-status {
  position: fixed; inset-inline-start: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2147483000;
  display: flex; align-items: center; gap: 10px; max-width: min(640px, calc(100vw - 32px));
  padding: 9px 12px 9px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); box-shadow: 0 6px 24px rgba(20, 24, 32, .18); font-size: 13px;
}
[dir="rtl"] .cafe-docx-status, .cafe-docx-status[dir="rtl"] { transform: translateX(50%); }
.cafe-docx-status[hidden] { display: none; }
.cafe-docx-status .cafe-docx-text { flex: 1 1 auto; }
.cafe-docx-status .cafe-docx-meter { width: 90px; height: 6px; }
.cafe-docx-status .cafe-docx-meter[hidden] { display: none; }
.cafe-docx-status .cafe-docx-close { border: 0; background: transparent; font-size: 18px; line-height: 1; padding: 0 2px; cursor: pointer; color: inherit; }
.cafe-docx-status:not(.error) .cafe-docx-close { display: none; }
.cafe-docx-status .cafe-docx-spin {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent);
  animation: cafe-docx-spin .9s linear infinite; flex: 0 0 auto;
}
.cafe-docx-status.error { border-color: #c0392b; }
.cafe-docx-status.error .cafe-docx-spin { display: none; }
@keyframes cafe-docx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cafe-docx-status .cafe-docx-spin { animation: none; } }
