tfrere's picture
tfrere HF Staff
Cursor
feat: port the template's new page layout to the editor and published articles
eab9566
Raw History Blame Contribute Delete
7.25 kB
/* ============================================================================ */
/* Editor layout */
/* */
/* The article area uses the template page grid (template-layout/_grid.css). */
/* The published page makes <main> the grid of the article blocks; here the */
/* blocks are children of the ProseMirror root, so that root repeats the grid */
/* and the template's main-level placements are restated for it below. */
/* ============================================================================ */
.editor-app {
height: 100dvh; /* dvh = dynamic viewport (iOS Safari URL bar) */
display: flex;
flex-direction: column;
/* Use the page background so the editor shell matches the article content
(no greyish frame around the white canvas in light mode). */
background: var(--page-bg);
overflow: hidden;
position: relative;
}
/* ---- Article grid ---- */
.editor-app .content-grid {
padding-bottom: 32px;
}
.editor-app .content-grid > .content-grid__main {
grid-column: screen;
grid-row: 1;
min-width: 0;
}
.editor-app .content-grid__main .tiptap {
display: grid;
grid-template-columns: var(--layout-cols);
align-content: start;
max-width: none;
margin: 0;
padding: 0;
}
.editor-app .content-grid__main .tiptap > * {
grid-column: body;
min-width: 0;
}
.editor-app .content-grid__main .tiptap > :is(p, ul, ol, h2, h3, h4, blockquote) {
max-width: var(--layout-prose);
}
.editor-app .content-grid__main .tiptap :is(p, li) {
font-size: var(--layout-prose-font-size);
}
.editor-app .content-grid__main .tiptap > .node-wide {
grid-column: body-start / margin-end;
}
.editor-app .content-grid__main .tiptap > .node-fullWidth {
grid-column: screen;
}
@media (max-width: 1100px) {
.editor-app .content-grid__main .tiptap > :is(.node-wide, .node-fullWidth) {
grid-column: screen;
padding-inline: var(--layout-outer);
}
}
/* Sidenotes: inline under their block, in the margin column from 1280px on the
row of the block before them (zero height, so the text never moves). */
.editor-app .content-grid__main .tiptap > .node-sidenote {
margin: -6px 0 18px;
font-size: .85rem;
line-height: 1.5;
color: var(--muted-color);
}
.editor-app .content-grid__main .tiptap > .node-sidenote :is(p, li) {
font-size: inherit;
}
.editor-app .tiptap .node-sidenote .sidenote-wrapper-node {
border-radius: 6px;
transition: background 0.15s;
}
.editor-app .tiptap .node-sidenote .sidenote-wrapper-node:hover {
background: var(--bg-hover);
}
.editor-app .tiptap .node-sidenote .sidenote-badge {
position: absolute;
top: 2px;
right: 4px;
font-size: 10px;
color: var(--text-faint);
opacity: 0;
transition: opacity 0.15s;
pointer-events: none;
user-select: none;
}
.editor-app .tiptap .node-sidenote:hover .sidenote-badge {
opacity: 1;
}
@media (min-width: 1280px) {
.editor-app .content-grid__main .tiptap > .node-sidenote {
grid-column: margin;
height: 0;
margin: 0;
overflow: visible;
position: relative;
z-index: 4;
}
}
/* ============================================================================ */
/* Responsive */
/* */
/* <= 1100px : the TOC rail is hidden; the top bar opens the TOC drawer. */
/* <= 768px : Compact top-bar, narrower floating panels, stacked embed studio. */
/* ============================================================================ */
/* Hamburger toggle: hidden on desktop, shown below the collapse breakpoint */
.top-bar__toc-toggle { display: none; }
/* ---- TOC drawer (narrow viewports) ---- */
.toc-mobile-backdrop {
display: none;
position: fixed;
inset: 0;
z-index: calc(var(--z-overlay) + 1);
background: rgba(0,0,0,.4);
opacity: 0;
pointer-events: none;
transition: opacity 250ms ease;
}
.toc-mobile-backdrop.open {
opacity: 1;
pointer-events: auto;
}
.toc-mobile-sidebar {
display: none;
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: calc(var(--z-overlay) + 2);
width: min(320px, 85vw);
background: var(--page-bg);
border-right: 1px solid var(--border-color);
transform: translateX(-100%);
transition: transform 300ms cubic-bezier(.4,0,.2,1);
flex-direction: column;
}
.toc-mobile-sidebar.open {
transform: translateX(0);
}
.toc-mobile-sidebar__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.toc-mobile-sidebar__title {
font-weight: 700;
font-size: 15px;
color: var(--text-color);
}
.toc-mobile-sidebar__actions {
display: flex;
align-items: center;
gap: 4px;
}
.toc-mobile-sidebar__close,
.toc-mobile-sidebar__theme {
background: none;
border: none;
color: var(--muted-color);
cursor: pointer;
padding: 4px;
border-radius: 6px;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
transition: color 150ms ease, background 150ms ease;
}
.toc-mobile-sidebar__close:hover,
.toc-mobile-sidebar__theme:hover {
color: var(--text-color);
background: var(--surface-bg);
}
.toc-mobile-sidebar__body {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding: 16px;
}
/* The drawer reuses the rail's TOC, which the template hides at this width */
.toc-mobile-sidebar .table-of-contents {
display: block;
position: static;
width: auto;
margin: 0;
}
.toc-mobile-sidebar .toc-head {
display: none;
}
.toc-mobile-sidebar .toc-scroll {
max-height: none;
}
.toc-empty {
font-size: 12px;
color: var(--muted-color);
}
@media (max-width: 1100px) {
.top-bar__toc-toggle {
display: inline-flex;
margin-right: auto;
}
.editor-app .top-bar__brand { margin-right: 4px; }
.editor-app .toc-mobile-backdrop { display: block; }
.editor-app .toc-mobile-sidebar { display: flex; }
}
@media (max-width: 768px) {
/* Top bar: compact, wrap-safe */
.editor-app .top-bar {
padding: 6px 8px;
gap: 2px;
flex-wrap: wrap;
}
.editor-app .top-bar .divider-v { display: none; }
.editor-app .top-bar .sync-indicator .sync-indicator__label { display: none; }
/* Chat floating: fill width on mobile */
.editor-app .chat-floating {
width: calc(100vw - 24px);
max-width: 360px;
left: 12px;
bottom: 12px;
height: calc(100dvh - 80px);
max-height: calc(100dvh - 80px);
}
.editor-app .chat-fab {
bottom: 12px;
left: 12px;
}
/* Settings drawer: full-width on mobile */
.editor-app .drawer-panel { width: 100vw; }
/* Embed Studio: stack body vertically */
.editor-app .es-body { flex-direction: column; }
.editor-app .es-chat {
width: 100%;
min-width: 0;
max-width: none;
max-height: 45vh;
border-right: none;
border-bottom: 1px solid var(--border-color);
}
/* Citation panel: narrower on mobile */
.editor-app .citation-panel {
width: calc(100vw - 32px);
max-width: 480px;
}
}