/* ---------------------------------------------------------------- page editor */
.page { max-width: 820px; margin: 0 auto; padding: 56px 64px 30vh; position: relative; }
.page.embedded { padding: 18px 46px 40px; max-width: none; }
@media (max-width: 860px) {
  .page { padding: 28px 18px 40vh 30px; }
  .page.embedded { padding: 12px 12px 24px 28px; }
}

.page-head { position: relative; margin-bottom: 18px; }
.page-head-tools { height: 30px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.page-head:hover .page-head-tools, .page-head:focus-within .page-head-tools { opacity: 1; }
@media (hover: none) { .page-head-tools { opacity: 1; } }
.page-icon { font-size: 54px; line-height: 1; margin: 4px 0 10px; display: block; padding: 6px; margin-left: -6px; border-radius: var(--r-m); }
.page-icon:hover { background: var(--hover); }
.page-title {
  font: 600 clamp(30px, 4.4vw, 42px)/1.15 var(--f-sans);
  letter-spacing: -.02em;
  outline: none;
  word-break: break-word;
}
.page-title:empty::before { content: attr(data-ph); color: var(--faint); }

.blocks { position: relative; }
.blk {
  position: relative;
  display: flex;
  margin-left: calc(var(--indent, 0) * 26px);
  padding: 2px 0;
  border-radius: var(--r-s);
  outline: none;
}
.blk:focus-visible { box-shadow: 0 0 0 2px var(--sel); }
.blk.dragging { opacity: .35; }
.blk-gutter {
  position: absolute; left: -50px; top: 2px;
  display: flex; gap: 0;
  opacity: 0; transition: opacity .12s;
  user-select: none;
}
.blk:hover > .blk-gutter, .blk:focus-within > .blk-gutter { opacity: 1; }
.blk-gutter button { width: 24px; height: 26px; display: grid; place-items: center; color: var(--faint); border-radius: 5px; }
.blk-gutter button:hover { background: var(--hover); color: var(--ink); }
.blk-gutter svg { width: 15px; height: 15px; }
.blk-handle { cursor: grab; touch-action: none; }
@media (max-width: 860px) {
  .blk-gutter { left: -28px; }
  .blk-add { display: none !important; }
  .blk:focus-within > .blk-gutter { opacity: 1; }
  .blk > .blk-gutter { opacity: .35; }
}
.blk-body { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 8px; }
.blk-body > .rt { flex: 1; min-width: 0; padding: 3px 2px; }

.page.lonely .blk-text .rt:empty::before,
.blk .rt:focus:empty::before { content: attr(data-ph); color: var(--faint); }
.blk-h1 .rt:empty::before, .blk-h2 .rt:empty::before, .blk-h3 .rt:empty::before { content: attr(data-ph); color: var(--faint); }

.blk-h1 { margin-top: 26px; }
.blk-h1 .rt { font: 600 29px/1.25 var(--f-sans); letter-spacing: -.015em; }
.blk-h2 { margin-top: 20px; }
.blk-h2 .rt { font: 600 22px/1.3 var(--f-sans); letter-spacing: -.01em; }
.blk-h3 { margin-top: 14px; }
.blk-h3 .rt { font: 400 11.5px/2 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.blk-h1 .blk-gutter { top: 6px; }
.blk-h2 .blk-gutter { top: 4px; }

.bullet-dot { width: 18px; height: 1.55em; position: relative; flex: none; margin-top: 3px; }
.bullet-dot::before { content: ''; position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; margin-top: -3px; background: var(--ink); border-radius: 50%; }
.blk[data-indent="1"] .bullet-dot::before, .blk[data-indent="3"] .bullet-dot::before { background: transparent; border: 1.5px solid var(--ink); }
.blk[data-indent="2"] .bullet-dot::before, .blk[data-indent="4"] .bullet-dot::before { border-radius: 1px; }
.blk-num { min-width: 18px; flex: none; text-align: right; padding: 3px 0; font: 400 13px/1.55 var(--f-mono); color: var(--muted); margin-top: 1px; }
.blk-todo .check { margin-top: 6px; }
.blk-todo.checked .rt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.due-chip { flex: none; margin-top: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); border: 1px solid var(--line); font: 10px/20px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.due-chip.late { border-color: var(--c-red); color: var(--c-red); }

.blk-quote .blk-body { border-left: 3px solid var(--ink); padding-left: 14px; }
.blk-quote .rt { font-size: 17px; }
.blk-callout .blk-body { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px 12px 10px; margin: 4px 0; }
:root[data-theme="dark"] .blk-callout .blk-body { background: var(--raised); }
.callout-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 13px var(--f-mono); }
.callout-icon:hover { filter: brightness(1.1); }
.blk-toggle .blk-body { flex-wrap: wrap; }
.toggle-arrow { width: 22px; height: 22px; margin-top: 3px; display: grid; place-items: center; color: var(--ink-2); border-radius: 4px; flex: none; }
.toggle-arrow:hover { background: var(--hover); }
.toggle-arrow svg { width: 12px; height: 12px; transition: transform .15s; }
.toggle-arrow.open svg { transform: rotate(90deg); }
.toggle-body { flex-basis: 100%; margin-left: 30px; padding: 4px 8px; border-left: 1px dashed var(--line); min-height: 1.6em; }
.toggle-body:empty::before { content: attr(data-ph); color: var(--faint); }

.blk-code .blk-body { flex-direction: column; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); margin: 6px 0; overflow: hidden; }
:root[data-theme="dark"] .blk-code .blk-body { background: #0d0d0d; }
.code-bar { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line-2); }
.code-lang { border: 0; background: none; outline: 0; font: 10px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); width: 140px; }
.blk-code .rt { width: 100%; font: 13px/1.6 var(--f-mono); padding: 12px 14px; white-space: pre; overflow-x: auto; tab-size: 2; }
.blk-meta .rt { font: 10.5px/2 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.blk-meta { margin-top: 18px; }

.blk-hr { flex: 1; border: 0; height: 1px; background: var(--line); margin: 14px 0; position: relative; overflow: visible; }
.blk-hr::after { content: ''; position: absolute; left: 0; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.blk-figure { margin: 6px 0; max-width: 100%; }
.blk-figure .img-box { position: relative; }
.blk-figure img { display: block; width: 100%; border-radius: var(--r-m); cursor: zoom-in; background: var(--panel); }
.blk-figure video { display: block; width: 100%; border-radius: var(--r-m); background: #000; max-height: 75vh; }
.img-resize { position: absolute; right: -6px; top: 50%; width: 8px; height: 44px; margin-top: -22px; border-radius: 6px; background: var(--ink); opacity: 0; cursor: ew-resize; border: 2px solid var(--bg); touch-action: none; }
.blk:hover .img-resize { opacity: .75; }
.blk-caption { font-size: 13px; color: var(--muted); padding: 6px 2px 0; min-height: 0; }
.blk-caption:empty::before { content: attr(data-ph); color: transparent; }
.blk:hover .blk-caption:empty::before, .blk-caption:focus:empty::before { color: var(--faint); }
.audio-box { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--raised); }
.audio-box audio { width: 100%; }
.blk-file, .blk-link, .blk-pagelink, .blk-table, .blk-image, .blk-video, .blk-audio { margin: 4px 0; }
.blk-file .file-chip, .link-box { flex: 1; }
.blk-body > .file-chip, .blk-body > .link-box, .blk-body > .pagelink, .blk-body > .tbl-wrap { flex: 1; min-width: 0; }
.link-box .embed-wrap { width: 100%; }
.blk-link .embed-instagram, .blk-link .embed-tiktok, .blk-link .embed-threads, .blk-link .embed-x, .blk-link .embed-pinterest { max-width: 420px; }
.blk-link .embed-instagram + .embed-meta, .blk-link .embed-tiktok + .embed-meta, .blk-link .embed-x + .embed-meta { max-width: 420px; }
.media-missing { padding: 24px; border: 1px dashed var(--line); border-radius: var(--r-m); text-align: center; color: var(--muted); font: 11px var(--f-mono); text-transform: uppercase; letter-spacing: .1em; }

.pagelink { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-m); text-decoration: none; border: 1px solid transparent; }
.pagelink:hover { background: var(--hover); border-color: var(--line); }
.pagelink .pl-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line); font-size: 14px; background: var(--card); }
.pagelink .pl-icon svg { width: 15px; height: 15px; }
.pagelink .pl-title { font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.pagelink .label { margin-left: auto; }
.pagelink > svg { width: 15px; color: var(--faint); }

.tbl-wrap { width: 100%; }
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
.tbl { border-collapse: collapse; width: 100%; min-width: 100%; }
.tbl td, .tbl th { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 0; vertical-align: top; min-width: 120px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:last-child, .tbl th:last-child { border-right: 0; }
.tbl th { background: var(--panel); text-align: left; font-weight: 600; }
.tbl .cell { padding: 7px 10px; font-size: 14px; min-height: 2.2em; }
.tbl-tools { display: flex; gap: 4px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.blk:hover .tbl-tools, .blk:focus-within .tbl-tools { opacity: 1; }
@media (hover: none) { .tbl-tools { opacity: 1; } }

.page-tail { min-height: 120px; cursor: text; }
.drop-line { position: fixed; height: 3px; background: var(--accent); border-radius: 3px; z-index: 120; pointer-events: none; box-shadow: 0 0 0 3px var(--sel); }

/* slash menu */
.slash { width: 300px; }
.slash-filter { height: 34px; margin-bottom: 6px; }
.slash-list .menu-item { min-height: 40px; }
.blk-text .rt:empty:not(:focus)::before { content: none; }
.page.lonely .blk-text .rt:empty::before { content: attr(data-ph); }
