/* Luma depth V1: clearer hierarchy, richer editor controls, and restrained motion. */
:root {
  --luma-depth-shadow: 0 18px 50px rgba(31, 35, 41, .07), 0 2px 10px rgba(31, 35, 41, .035);
  --luma-depth-line: color-mix(in srgb, var(--accent) 9%, var(--border));
}

[data-theme="dark"] {
  --luma-depth-shadow: 0 20px 52px rgba(0, 0, 0, .24), 0 2px 12px rgba(0, 0, 0, .16);
}

.main-panel {
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.topbar {
  border-bottom-color: var(--luma-depth-line);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent), 0 8px 26px rgba(31, 35, 41, .035);
}

.format-bar {
  border-bottom-color: var(--luma-depth-line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 8px 28px rgba(31, 35, 41, .04);
  backdrop-filter: blur(16px) saturate(1.1);
}

.sidebar {
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--surface) 70%, transparent), 8px 0 30px rgba(31, 35, 41, .025);
}

.outline-panel {
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--surface) 70%, transparent), -8px 0 30px rgba(31, 35, 41, .025);
}

.sidebar .note-item,
.outline-list button {
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.sidebar .note-item:hover,
.outline-list button:hover { transform: translateX(2px); }

.sidebar .note-item.active {
  box-shadow: inset 3px 0 0 var(--accent), 0 5px 16px color-mix(in srgb, var(--accent) 8%, transparent);
}

.document-scroller {
  background: var(--surface);
}

.document-page {
  position: relative;
  padding: 38px clamp(28px, 4vw, 64px) 100px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.block-row {
  transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.block-row:hover { transform: translateX(1px); }
.block-editor.drag-selecting .block-row { transform: none; }
.block-handle,
.list-marker,
.callout-mark,
.special-head { user-select: none; }
.block-editor ::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.special-block { box-shadow: 0 8px 24px rgba(31, 35, 41, .045); }

/* The code header stays useful without consuming vertical space. */
.code-block { margin-top: 6px !important; border-radius: 9px; }
.code-block .special-head { height: 27px !important; min-height: 27px; padding: 0 8px !important; gap: 6px; }
.code-block .code-language { height: 20px !important; min-width: 84px; padding-inline: 4px; font-size: 10px !important; }
.mac-code-dots { gap: 4px !important; }
.mac-code-dots i { width: 7px !important; height: 7px !important; }
.code-copy-button { width: 22px !important; height: 22px !important; flex-basis: 22px !important; }

/* Native font previews and persistent selected-font feedback. */
#fontFamily { min-width: 112px; font-family: inherit; }
#fontFamily option[value="PingFang SC"] { font-family: "PingFang SC"; }
#fontFamily option[value="Microsoft YaHei"] { font-family: "Microsoft YaHei"; }
#fontFamily option[value="Noto Sans SC"],
#fontFamily option[value="Source Han Sans SC"] { font-family: "Noto Sans SC", "Source Han Sans SC"; }
#fontFamily option[value="HarmonyOS Sans SC"] { font-family: "HarmonyOS Sans SC"; }
#fontFamily option[value="Songti SC"],
#fontFamily option[value="Source Han Serif SC"],
#fontFamily option[value="SimSun"] { font-family: "Songti SC", "Source Han Serif SC", SimSun, serif; }
#fontFamily option[value="Kaiti SC"],
#fontFamily option[value="STKaiti"] { font-family: "Kaiti SC", STKaiti; }
#fontFamily option[value="Georgia"] { font-family: Georgia, serif; }
#fontFamily option[value="Times New Roman"] { font-family: "Times New Roman", serif; }
#fontFamily option[value="Garamond"] { font-family: Garamond, serif; }
#fontFamily option[value="Courier New"] { font-family: "Courier New", monospace; }
#fontFamily option[value="Menlo"] { font-family: Menlo, monospace; }

#lineHeight { width: 102px; padding-inline: 7px; }
#lineHeight:disabled { cursor: not-allowed; opacity: .45; }

.format-bar > .multi-select-toggle,
.format-bar > .copy-selected-blocks {
  display: flex;
  width: auto;
  min-width: 64px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  white-space: nowrap;
}

.format-bar > .copy-selected-blocks {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.format-bar > .copy-selected-blocks[hidden] { display: none !important; }
.format-bar > .copy-selected-blocks:disabled { cursor: not-allowed; opacity: .5; }
.format-bar > .multi-select-toggle svg,
.format-bar > .copy-selected-blocks svg { width: 15px; height: 15px; }

.block-editor.selection-mode .block-row {
  padding-right: 38px !important;
  cursor: pointer;
  user-select: none;
}

.block-editor.selection-mode .block-row::after {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 9px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: transparent;
  content: "\2713";
  font-size: 12px;
  font-weight: 750;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.block-editor.selection-mode .block-row:hover::after { border-color: var(--accent); transform: scale(1.04); }
.block-editor.selection-mode .block-row.multi-selected::after { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Mermaid and mind-map previews can be resized and retain the chosen size. */
.diagram-layout { align-items: start; }
.diagram-preview {
  box-sizing: border-box;
  max-width: 100%;
  max-height: 900px;
  min-width: 35%;
  min-height: 180px;
  margin-inline: auto;
  resize: both;
  background-color: var(--surface);
  background-image: linear-gradient(135deg, transparent 0 48%, color-mix(in srgb, var(--text-tertiary) 55%, transparent) 49% 53%, transparent 54%);
  background-position: right 4px bottom 4px;
  background-repeat: no-repeat;
  background-size: 12px 12px;
}

.diagram-size-reset,
.diagram-source-toggle {
  height: 26px;
  padding: 0 9px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 10px;
}

.diagram-size-reset:hover,
.diagram-source-toggle:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--accent); }

@media (min-width: 921px) {
  .document-scroller { padding: 0; }
}

@media (max-width: 760px) {
  .toolbar-tip { display: none; }
  #lineHeight { width: 88px; }
  .format-bar > .multi-select-toggle span,
  .format-bar > .copy-selected-blocks span { display: inline; }
  .diagram-preview { width: 100% !important; min-width: 100%; resize: vertical; }
}

@media (max-width: 620px) {
  .document-scroller { background: var(--surface); }
  .document-page { padding: 32px 16px 80px; border: 0; border-radius: 0; box-shadow: none; }
  .code-block .special-head { height: 29px !important; min-height: 29px; }
  .format-bar > .multi-select-toggle,
  .format-bar > .copy-selected-blocks { min-width: 42px; padding-inline: 8px; }
  .format-bar > .multi-select-toggle span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar .note-item,
  .outline-list button,
  .block-row,
  .block-editor.selection-mode .block-row::after { transition: none; }
}
