/* The editor shares the reading page's surfaces and typography. */
.editor-menu-entry { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.editor-dialog {
  --editor-muted: var(--muted, #a9ada7);
  box-sizing: border-box; width: min(760px, calc(100vw - 32px)); max-width: none;
  max-height: min(900px, calc(100dvh - 48px)); padding: 0; margin: auto;
  color: var(--text, #f1f0eb); background: var(--surface, #121716);
  border: 1px solid var(--line, #303630); border-radius: 16px;
  font: 16px/1.55 var(--font-body, 'Segoe UI', sans-serif); box-shadow: 0 24px 100px #0009;
  overscroll-behavior: contain;
}
.editor-dialog[open] { display: flex; flex-direction: column; }
.editor-dialog::backdrop { background: #030706cf; backdrop-filter: blur(5px); }
.editor-dialog *, .editor-preview-bar * { box-sizing: border-box; }
.editor-dialog-wide { width: min(1180px, calc(100vw - 40px)); }
.editor-dialog-head { display: flex; align-items: center; gap: 20px; padding: 22px 28px 16px; flex: none; }
.editor-dialog-head h2 { margin: 0; flex: 1; font: 600 clamp(22px, 2vw, 28px)/1.15 var(--font-display, Bahnschrift, sans-serif); }
.editor-dialog-body { padding: 4px 28px 24px; min-height: 0; overflow-wrap: anywhere; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.editor-dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; padding: 16px 28px 22px; flex: none; border-top: 1px solid var(--line, #303630); }
.editor-dialog-body > :first-child { margin-top: 0; }
.editor-dialog-body > :last-child { margin-bottom: 0; }
.editor-close, .editor-icon-button, .editor-button {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  min-height: 44px; padding: 9px 16px; border: 1px solid var(--line, #303630); border-radius: 9px;
  background: transparent; color: var(--text, #f1f0eb); font: 600 14px/1.3 var(--font-body, 'Segoe UI', sans-serif);
  text-align: center; text-decoration: none; cursor: pointer;
}
.editor-close, .editor-icon-button { flex: none; min-width: 44px; padding: 7px; font-size: 22px; }
.editor-close { margin: -6px -10px -6px 0; border-color: transparent; }
.editor-button:hover, .editor-icon-button:hover, .editor-close:hover { background: #ffffff0a; border-color: #676c65; }
.editor-primary { background: var(--red, #ff2733); color: #fff; border-color: transparent; }
.editor-primary:hover { background: #e51f2b; border-color: transparent; }
.editor-quiet { border-color: transparent; color: var(--muted, #a9ada7); }
.editor-button:disabled, .editor-icon-button:disabled { opacity: .4; cursor: default; }
.editor-dialog :focus-visible, .editor-preview-bar :focus-visible, .editor-mode .editor-affordance:focus-visible,
.editor-badge:focus-visible, .editor-tab-actions :focus-visible, .editor-add-actions :focus-visible {
  outline: 2px solid var(--focus, #ff5861); outline-offset: 3px;
}
.editor-field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 18px; min-width: 0; }
.editor-label { font-size: 13px; font-weight: 600; color: var(--muted, #a9ada7); }
.editor-field input:not([type='file']), .editor-field textarea, .editor-field select {
  width: 100%; min-width: 0; min-height: 46px; padding: 11px 13px; color: var(--text, #f1f0eb);
  background: var(--bg, #090c0b); border: 1px solid var(--line, #303630); border-radius: 8px;
  font: inherit; line-height: 1.5; color-scheme: dark;
}
.editor-field textarea { resize: vertical; min-height: 100px; max-height: 65vh; }
.editor-field input::placeholder, .editor-field textarea::placeholder { color: #858b84; opacity: 1; }
.editor-field input[type='file'] { max-width: 100%; color: var(--muted, #a9ada7); font: inherit; }
.editor-field input[type='file']::file-selector-button { margin-right: 12px; min-height: 44px; padding: 8px 14px; border: 1px solid #4e554d; border-radius: 8px; color: var(--text, #f1f0eb); background: var(--bg, #090c0b); font: inherit; cursor: pointer; }
.editor-proposal-form { margin: 0; }
.editor-context { margin: 0 0 24px; color: var(--muted, #a9ada7); font-size: 14px; }
.editor-note, .editor-save-status { color: var(--muted, #a9ada7); font-size: 13px; line-height: 1.5; }
.editor-note { margin: 8px 0 18px; }
.editor-save-status { margin: 8px 0 0; min-height: 20px; }
.editor-error { color: #ffa6ac; white-space: pre-wrap; font-size: 14px; }
.editor-error:empty { display: none; }
.editor-honeypot { position: fixed; left: -10000px; top: -10000px; width: 1px; height: 1px; overflow: hidden; }
.editor-lead { font-size: 17px; line-height: 1.65; max-width: 60ch; margin: 12px 0 20px; }
.editor-step { color: var(--red, #ff2733); font: 500 14px var(--font-display, Bahnschrift, sans-serif); margin: 8px 0 20px; }
.editor-briefing-title { margin: 0 0 16px; font-size: 24px; line-height: 1.25; }
.editor-switch { display: inline-flex; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; font-size: 18px; }
.editor-switch input { width: 24px; height: 24px; margin: 0; accent-color: var(--red, #ff2733); }
.editor-confirm { width: min(520px, calc(100vw - 32px)); }
.editor-confirm .editor-dialog-head { padding-top: 28px; padding-bottom: 24px; }
.editor-confirm .editor-dialog-body { display: none; }
.editor-confirm .editor-dialog-actions { border-top: 0; }
.editor-item-row { display: flex; align-items: flex-start; gap: 8px; }
.editor-item-row .editor-field { flex: 1; }
.editor-item-row > .editor-icon-button { margin-top: 25px; }
.editor-link-row { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 10px; align-items: start; }
.editor-link-row > .editor-icon-button { margin-top: 25px; }
.editor-subheading { font-size: 15px; margin: 24px 0 14px; }
.editor-items { margin-bottom: 22px; }
.editor-tab-block { margin: 22px 0; padding: 22px 0 2px; border-top: 1px solid var(--line, #303630); }
.editor-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.editor-block-head h3 { flex: 1; margin: 0; font-size: 18px; }
.editor-image-preview { margin: 20px 0; }
.editor-image-preview img { display: block; max-width: 100%; width: auto; max-height: 330px; height: auto; object-fit: contain; border-radius: 9px; }
.editor-image-preview figcaption { margin-top: 8px; color: var(--muted, #a9ada7); font-size: 13px; }
.editor-image-form { margin: 28px 0 20px; }
.editor-conflict { border-left: 3px solid #ffb36c; padding: 2px 0 2px 16px; margin: 16px 0 24px; }
.editor-conflict h3 { color: #ffc183; font-size: 16px; margin: 4px 0 10px; }
.editor-conflict[hidden] { display: none; }
.editor-comparison { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; }
.editor-comparison-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.editor-comparison-column { min-width: 0; }
.editor-comparison-column h3 { margin: 0 0 16px; color: var(--muted, #a9ada7); font-size: 13px; font-weight: 600; }
.editor-diff { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.65; }
.editor-diff ins { color: #e8ffea; background: #245434b3; text-decoration: none; border-bottom: 1px solid #8ecc9c; }
.editor-diff del { color: #ffe7e9; background: #612b31a6; text-decoration-color: #ffb0b6; }
.editor-comparison-image { width: 100%; height: auto; max-height: 320px; object-fit: contain; border-radius: 8px; background: var(--bg, #090c0b); }
.editor-image-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: zoom-in; }
.editor-image-open:focus-visible { outline: 2px solid var(--focus, #ff5861); outline-offset: 3px; }
.editor-image-lightbox { width: min(1600px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); }
.editor-image-lightbox .editor-dialog-body { display: flex; flex: 1; align-items: center; justify-content: center; padding: 12px 20px; overflow: auto; }
.editor-image-lightbox-picture { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 180px); margin: auto; object-fit: contain; }
.editor-target { position: relative; cursor: pointer; outline: 1px dashed transparent; outline-offset: 5px; }
.editor-target:hover, .editor-target:focus-within { outline-color: #909c9166; }
.editor-affordance { position: absolute; z-index: 5; top: 3px; right: 3px; padding: 7px 12px; min-height: 36px;
  border: 1px solid #737d7080; border-radius: 7px; background: #111713f5; color: #f1f0eb; font: 600 12px/1.3 'Segoe UI', sans-serif;
  opacity: 0; pointer-events: none; cursor: pointer; }
.editor-target:hover > .editor-affordance, .editor-target:focus-within > .editor-affordance { opacity: 1; pointer-events: auto; }
.editor-badge { display: inline-flex; width: fit-content; align-items: center; min-height: 28px; margin: 12px 0 0; padding: 3px 8px;
  border: 0; border-radius: 5px; background: #293329; color: #d1dccf; font: 500 11px/1.4 'Segoe UI', sans-serif; }
button.editor-badge { cursor: pointer; text-decoration: underline; text-decoration-color: #a0b39a66; text-underline-offset: 3px; }
button.editor-badge:hover { background: #354333; }
.visual-media > .editor-badge { position: absolute; z-index: 4; bottom: 9px; left: 12px; background: #182219f0; }
.visual-media:has(> .editor-badge) { position: relative; }
.editor-tab-actions { margin: -4px 0 12px; }
.editor-tab-actions .editor-button, .editor-add-actions .editor-button { padding-left: 0; font-size: 13px; }
.editor-add-actions { margin: 20px 0 0; }
.editor-target-results { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 12px 0 4px; }
.editor-result-link { display: inline-flex; align-items: center; gap: 8px; }
.editor-result-link .editor-note, .editor-result-link .editor-badge { margin: 0; }
.editor-preview-bar { position: fixed; z-index: 95; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: calc(100vw - 24px); padding: 12px 16px; border: 1px solid #596052; border-radius: 12px;
  background: #101711fa; color: #f1f0eb; box-shadow: 0 12px 60px #000b; font: 14px 'Segoe UI', sans-serif; }
.editor-preview-bar strong { padding: 0 10px 0 0; font-weight: 500; color: #c4cdc0; }
.has-editor-preview { padding-bottom: 100px; }
.editor-preview-frame .editor-menu-entry, .editor-preview-frame #bookmarkButton { visibility: hidden; }
@media (max-width: 720px) {
  .editor-dialog, .editor-dialog-wide { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .editor-dialog-head { padding: 18px 18px 14px; gap: 12px; }
  .editor-dialog-body { padding: 4px 18px 20px; scrollbar-gutter: auto; }
  .editor-dialog-actions { padding: 14px 18px 18px; gap: 9px; }
  .editor-dialog-actions .editor-button { flex: 1 1 auto; }
  .editor-comparison, .editor-comparison-two { grid-template-columns: 1fr; gap: 28px; }
  .editor-comparison-column + .editor-comparison-column { padding-top: 24px; border-top: 1px solid #303630; }
  .editor-link-row { grid-template-columns: 1fr 44px; }
  .editor-link-row > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .editor-link-row > .editor-icon-button { grid-column: 2; grid-row: 1; }
  .editor-block-head { gap: 4px; flex-wrap: wrap; }
  .editor-preview-bar { bottom: 10px; gap: 8px; padding: 10px; width: calc(100vw - 20px); flex-wrap: wrap; }
  .editor-preview-bar strong { width: 100%; padding: 2px 4px; font-size: 12px; }
  .editor-preview-bar .editor-button { flex: 1; }
  .editor-field textarea { font-size: 16px; }
  .editor-affordance { min-height: 44px; }
}
@media (hover: none), (pointer: coarse) {
  .editor-target > .editor-affordance { position: static; width: fit-content; min-height: 44px; margin-top: 12px; opacity: 1; pointer-events: auto; }
  .visual-media.editor-target > .editor-affordance { position: absolute; margin-top: 0; }
  button.editor-badge { min-height: 44px; padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { .editor-dialog *, .editor-preview-bar *, .editor-target { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
