/* Note editor dialog: centered on wide screens, full screen on phones. */

.editor {
  width: min(40rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.3);
}
.editor::backdrop { background: rgb(0 0 0 / 0.45); }
.editor-form { display: flex; flex-direction: column; max-height: inherit; height: 100%; }

.editor-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.editor-head h2 { flex: 1; margin: 0; font-size: 1rem; }
.editor-head .icon-btn:hover { background: var(--hover); }

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  padding: 1rem 1.25rem;
  overflow-y: auto;
}
#editor-input {
  min-height: 8rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  resize: none;
  overflow: hidden;                  /* grows with the text; the body scrolls */
  background: var(--bg);
  color: inherit;
}
#editor-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.editor .draft { flex-wrap: wrap; overflow: visible; padding: 0.5rem 0.5rem 0 0; }
.attach-btn { display: inline-flex; align-items: center; gap: 0.5rem; align-self: flex-start; }

.editor-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}
.editor-foot .spacer { flex: 1; }

/* Phones: the editor takes the whole screen */
@media (max-width: 47.99rem) {
  .editor {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .editor-head { padding-top: calc(0.4rem + env(safe-area-inset-top)); }
  .editor-foot { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
}
