/* Editor layout V3: Feishu-like outline, right-side block controls and cleaner code cards. */

@media (min-width: 921px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr) 236px;
  }
}

/* Outline: keep it visible on wide screens and make the hierarchy easier to scan. */
.outline-panel {
  border-left: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface) 97%, var(--chrome-bg));
}

.outline-head {
  height: 58px;
  padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--border-soft);
}

.outline-head strong {
  color: var(--text);
  font-size: 14px;
  font-variation-settings: "wght" 650;
  font-weight: 650;
}

.outline-progress {
  height: 2px;
  background: transparent;
}

.outline-list {
  padding: 12px 10px 24px;
}

.outline-list button {
  min-height: 36px;
  margin: 2px 0;
  padding: 8px 10px 8px 24px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.outline-list button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.outline-list button.active {
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  color: var(--accent);
  font-variation-settings: "wght" 580;
  font-weight: 580;
}

.outline-list button span {
  left: 11px;
  width: 5px;
  height: 5px;
  opacity: 0.7;
}

.outline-list .level-2 {
  padding-left: 34px;
}

.outline-list .level-2 span {
  left: 21px;
}

.outline-list .level-3 {
  padding-left: 44px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.outline-list .level-3 span {
  left: 31px;
}

/* Block controls live on the right so the writing edge remains clean. */
.block-row {
  padding-right: 54px;
}

.block-row:not(.type-bullet):not(.type-numbered):not(.type-quote) {
  padding-left: 0;
}

.block-row.active,
.block-row.multi-selected {
  box-shadow: inset -2px 0 0 var(--accent);
}

.block-handle {
  right: 2px;
  left: auto;
  display: flex;
  width: 46px;
  height: 30px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-tertiary);
  font-size: 15px;
  opacity: 0;
}

.block-handle::before {
  min-width: 17px;
  color: currentColor;
  content: "T";
  font-family: var(--font-ui);
  font-size: 13px;
  font-variation-settings: "wght" 570;
  font-weight: 570;
  text-align: center;
}

.type-heading1 > .block-handle::before { content: "H1"; font-size: 10px; }
.type-heading2 > .block-handle::before { content: "H2"; font-size: 10px; }
.type-heading3 > .block-handle::before { content: "H3"; font-size: 10px; }
.type-bullet > .block-handle::before { content: "•"; font-size: 18px; }
.type-numbered > .block-handle::before { content: "1."; font-size: 11px; }
.type-quote > .block-handle::before { content: "❝"; font-size: 13px; }
.type-code > .block-handle::before { content: "</>"; font-size: 8px; }
.type-mermaid > .block-handle::before { content: "◇"; font-size: 15px; }
.type-mindmap > .block-handle::before { content: "⌘"; font-size: 12px; }

.block-row:hover > .block-handle,
.block-row.active > .block-handle,
.block-row:focus-within > .block-handle,
.block-row.multi-selected > .block-handle,
.block-handle:focus-visible {
  opacity: 1;
}

.block-handle:hover,
.block-handle:focus-visible {
  border-color: var(--border);
  background: var(--surface) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  color: var(--accent) !important;
}

.type-bullet,
.type-numbered {
  padding-right: 54px;
  padding-left: 26px;
}

.list-marker {
  left: 5px;
}

.list-marker.numbered {
  left: 2px;
}

.type-quote {
  padding-right: 54px;
  padding-left: 20px;
}

.type-quote::before {
  left: 6px;
}

/* Code cards follow the quieter reference: simple chrome and a roomy canvas. */
.code-block {
  margin: 14px 4px 20px 0;
  border-color: color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 42%, var(--surface));
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.045);
}

.code-block .special-head {
  height: 52px;
  padding: 0 16px;
  border-bottom-color: color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 75%, var(--surface));
}

.mac-code-dots {
  gap: 8px;
}

.mac-code-dots i {
  width: 12px;
  height: 12px;
}

.code-block .code-language {
  height: 30px;
  padding-right: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  font-variation-settings: "wght" 540;
  font-weight: 540;
}

.code-copy-button {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 7px;
}

.code-line-numbers {
  display: none;
}

.code-block .code-editor-wrap,
.code-block.code-is-empty .code-editor-wrap {
  min-height: 156px;
  background: color-mix(in srgb, var(--surface) 97%, var(--surface-soft));
}

.code-block .code-source,
.code-block .code-highlight,
.code-block.code-is-empty .code-source,
.code-block.code-is-empty .code-highlight {
  min-height: 156px;
  padding: 22px 24px 28px;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.9;
}

.code-block.code-is-empty .code-source {
  height: 156px;
}

/* The continuation action stays quiet and never turns into a dashed box. */
.append-block,
.append-block:hover,
.append-block:focus-visible {
  margin-left: 0;
  border: 0 !important;
  box-shadow: none;
}

@media (max-width: 920px) {
  .outline-panel {
    width: min(82vw, 300px);
  }
}

@media (max-width: 620px) {
  .block-row,
  .type-bullet,
  .type-numbered,
  .type-quote {
    padding-right: 40px;
  }

  .block-handle {
    right: 0;
    width: 36px;
    opacity: 0.55;
  }

  .block-handle::before {
    display: none;
  }

  .code-block .special-head {
    height: 48px;
  }

  .code-block .code-source,
  .code-block .code-highlight,
  .code-block.code-is-empty .code-source,
  .code-block.code-is-empty .code-highlight {
    padding: 18px 16px 24px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .outline-list button,
  .block-handle {
    transition: none;
  }
}
