@layer components {
  /* Editing a project's presentation: the documents' visual editor on a plain field, in the tab or on its own page. */
  /* The field is what the form sends: shown only in raw Markdown, or when the editor does not load. */
  .presentation-editor:is([data-visual-editor-mode="visual"], [data-visual-editor-mode="loading"]) .presentation-input {
    display: none;
  }
  .presentation-editor .presentation-input { min-height: 320px; height: calc(100dvh - 420px); }
  .presentation-hint {
    display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--muted-foreground); font-size: 13px;
  }
  .presentation-hint svg { flex: none; margin-top: 2px; }
  .presentation-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .presentation-count {
    margin: 0 0 0 auto; color: var(--muted-foreground); font-size: 13px; font-variant-numeric: tabular-nums;
  }
  .presentation-count.is-over { color: var(--jx-no); font-weight: 500; }
  .presentation-notice { margin: 0; }

  /* The box, its padding and the foot's buttons are the desk's; the phone's text is the screen, its bar the buttons. */
  @media (min-width: 1100px) {
    .presentation-editor .visual-editor-surface { padding: 16px 18px 20px; }
    [data-visual-editor-mode="visual"].presentation-editor .visual-editor {
      border: 1px solid var(--jx-accent); border-radius: var(--radius-md); background: var(--background);
      box-shadow: 0 0 0 3px var(--ring);
    }
    .presentation-foot .document-editor-actions { display: flex; }
  }

  @media (max-width: 1099px) {
    .presentation-editor .presentation-foot .document-editor-actions { display: none; }
    .presentation-editor .visual-editor-surface { padding: 8px var(--gutter) 16px; }
    /* The edit page is a screen of the pile: no head, no segments, the editor takes what the bar leaves. */
    .project-page--editing :is(.project-head, .project-tabs, .project-hint) { display: none; }
    .project-page--editing .project-panel,
    .project-page--editing turbo-frame#project-presentation { flex: 1; min-height: 0; display: flex; flex-direction: column; }
    .presentation-editor.document-editor--page { gap: 0; }
    .presentation-hint { display: none; }
    .presentation-notice { flex: none; margin: 8px var(--gutter) 0; }
    /* The foot is the bar's job here; the count only shows once the text is too long. */
    .document-editor--page .presentation-foot { display: block; flex: none; }
    .document-editor--page .presentation-count { display: none; margin: 8px var(--gutter) 0; }
    .document-editor--page .presentation-count.is-over { display: block; }
    .document-editor--page .presentation-input { padding: 8px var(--gutter); }
  }
}
