/*
 * What is Notes' own, on top of the suite's web kit (tokens.css, kit.css): the
 * list of notes, the open note and its editor. Colours, type and spacing come
 * from the kit's variables, so light, dark and the product's violet follow by
 * themselves. Logical properties (inline/block) throughout.
 */

/* --------------------------------- sidebar -------------------------------- */

.nav-gap { flex: 1; min-height: 12px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------------------------------- list ---------------------------------- */

.list-head {
  position: sticky; inset-block-start: 0; z-index: 2;
  background: var(--kit-bg); padding: 16px 16px 10px; border-block-end: 1px solid var(--kit-border);
}
.list-head__row { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.list-head__title {
  flex: 1; min-width: 0; margin: 0; font: 700 21px/1.2 var(--kit-font-display); letter-spacing: -.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-head__actions { display: flex; align-items: center; gap: 4px; }
.list-search-wrap { position: relative; margin-block-start: 10px; }
.list-search-wrap > .kit-icon {
  position: absolute; inset-inline-start: 11px; inset-block-start: 50%; translate: 0 -50%;
  width: 16px; height: 16px; color: var(--kit-muted); pointer-events: none;
}
.list-search { width: 100%; padding-inline-start: 34px; }

.note-list { padding: 6px 8px 96px; }
.note-row {
  display: grid; gap: 3px; width: 100%; text-align: start; padding: 11px 12px; margin: 0;
  border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--kit-text);
}
.note-row + .note-row { margin-block-start: 2px; }
.note-row:hover { background: var(--kit-hover); }
.note-row[aria-current="true"] { background: var(--kit-accent-soft); }
.note-row:focus-visible { outline: 2px solid var(--kit-accent); outline-offset: -2px; }
.note-row--static { cursor: default; }
.note-row--static:hover { background: none; }
.note-row__title {
  display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; min-width: 0;
}
.note-row__title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row__title .kit-icon { width: 15px; height: 15px; flex: none; color: var(--kit-muted); }
.note-row__pin { color: var(--kit-accent) !important; }
.note-row__text {
  color: var(--kit-muted); font-size: 13.5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.note-row__text mark { background: var(--kit-accent-soft); color: var(--kit-text); border-radius: 3px; padding: 0 1px; }
.note-row__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--kit-muted);
}
.note-row__meta time { font-variant-numeric: tabular-nums; }
.note-row__notebook { display: inline-flex; align-items: center; gap: 5px; }
.note-row__notebook .swatch { width: 8px; height: 8px; border-radius: 2px; }
.note-row__tag { color: var(--kit-accent); }

/* ---------------------------------- note ---------------------------------- */

.note-none { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.note { max-width: 760px; margin: 0 auto; padding: 14px 24px 120px; }
.note-head {
  position: sticky; inset-block-start: 0; z-index: 2; background: var(--kit-bg);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 0 10px; margin-block-end: 6px; border-block-end: 1px solid var(--kit-border);
}
.note-head__space { flex: 1; }
.note-notebook {
  display: inline-flex; align-items: center; gap: 7px; max-width: 50%;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--kit-border);
  background: var(--kit-panel); color: var(--kit-text); font-size: 13px; cursor: pointer;
}
.note-notebook > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-notebook .kit-icon { width: 15px; height: 15px; color: var(--kit-muted); }
.note-notebook:disabled { cursor: default; opacity: 1; }
.note-mode .kit-icon { width: 16px; height: 16px; }
.note-head .kit-icon-btn[aria-pressed="true"] { color: var(--kit-accent); background: var(--kit-accent-soft); }

.note-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.note-tags:empty { display: none; }
.note-tag {
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--kit-border); background: var(--kit-panel);
  color: var(--kit-accent); font-size: 12.5px; cursor: pointer;
}
.note-tag[aria-pressed="true"] { background: var(--kit-accent); border-color: var(--kit-accent); color: var(--kit-on-accent, #fff); }

.note-trashed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 12px; }
.note-trashed > span { flex: 1; min-width: 12ch; }

.note-body { min-height: 40vh; }
.note-body > .kit-md { font-size: 16px; }
.note-empty { color: var(--kit-muted); font-style: italic; }
.note-foot { margin-block-start: 28px; color: var(--kit-muted); font-size: 12.5px; }

/* --------------------------------- editor --------------------------------- */

.note-edit { display: grid; gap: 8px; }
.note-format {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px;
  border: 1px solid var(--kit-border); background: var(--kit-panel); width: fit-content; max-width: 100%;
}
.note-format__btn {
  min-width: 36px; height: 34px; padding: 0 8px; border: 0; border-radius: 7px; background: none;
  color: var(--kit-text); cursor: pointer; display: inline-grid; place-items: center;
}
.note-format__btn:hover { background: var(--kit-hover); }
.note-format__btn .kit-icon { width: 17px; height: 17px; }
.note-format__btn--bold { font-weight: 800; }
.note-format__btn--italic { font-style: italic; font-family: Georgia, serif; }
.note-format__btn--heading { font: 700 15px var(--kit-font-display); }
.note-format__btn--code { font: 600 12px var(--kit-font-mono); }
.note-editor {
  display: block; width: 100%; min-height: 50vh; resize: none; overflow: hidden;
  border: 0; padding: 4px 0; background: transparent; color: var(--kit-text);
  font: 15px/1.65 var(--kit-font-mono); tab-size: 2; caret-color: var(--kit-accent);
}
.note-editor:focus { outline: none; }
.note-editor::placeholder { color: var(--kit-muted); }

/* --------------------------------- dialogs -------------------------------- */

.color-choice { display: flex; flex-wrap: wrap; gap: 10px; }
.color-choice__swatch {
  width: 32px; height: 32px; border-radius: 9px; border: 2px solid transparent; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.color-choice__swatch[aria-checked="true"] { outline: 2px solid var(--kit-text); outline-offset: 2px; }
.tag-choice { display: flex; flex-wrap: wrap; gap: 6px; }
.move-row { width: 100%; border: 0; background: none; text-align: start; cursor: pointer; color: var(--kit-text); }
.move-row:hover { background: var(--kit-hover); }
.move-row[aria-current="true"] { font-weight: 600; }
.move-row .kit-icon { width: 17px; height: 17px; color: var(--kit-muted); }
.history { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 14px; min-height: 280px; }
.history-list { align-self: start; max-height: 60vh; overflow-y: auto; }
.history-list .kit-list__row { width: 100%; border: 0; background: none; text-align: start; cursor: pointer; color: var(--kit-text); }
.history-list .kit-list__row[aria-current="true"] { background: var(--kit-accent-soft); }
.history-list .kit-icon { width: 16px; height: 16px; color: var(--kit-muted); }
.history-preview { min-width: 0; max-height: 60vh; overflow-y: auto; padding: 4px 6px; }
.boot-error { margin: 24px; }

/* --------------------------------- phones --------------------------------- */

@media (max-width: 640px) {
  .list-head { padding: 12px 16px 10px; }
  .note { padding: 8px 16px 120px; }
  .note-notebook { max-width: 60%; }
  .history { grid-template-columns: 1fr; }
  .history-list { max-height: 30vh; }
}
