/*
 * Divit-specific layout only. No hardcoded color/spacing/radius/shadow/motion values — every
 * value here is a --ck-* token (design/tokens/README.md). CKCSS's .ck-sidebar already handles
 * the column-count collapse (single column below 48rem, two columns above); everything below
 * adds the note-list/editor pane-visibility toggle CKCSS doesn't provide out of the box.
 */

body {
  margin: 0;
  min-block-size: 100vh;
  background: var(--ck-color-surface);
  color: var(--ck-color-text);
}

/*
 * CKCSS's own layout classes (.ck-sidebar { display: grid }, .ck-stack { display: flex }, …) are
 * author-origin rules, so they win the cascade over the user-agent stylesheet's [hidden] rule
 * even though both have equal (0,1,0) specificity — author origin beats user-agent origin
 * regardless of specificity. Without this override, `<div hidden class="ck-sidebar">` stays
 * visibly displayed. Restoring [hidden]'s effect needs !important precisely because it's
 * fighting an origin-priority gap, not a specificity one.
 */
[hidden] {
  display: none !important;
}

#login-view {
  padding-block: var(--ck-space-7);
}

/*
 * Visual branding only — not a heading (see the persistent visually-hidden <h1> in index.html
 * for why). Sized/weighted to read the same as the h1 it replaces.
 */
.divit-brand {
  margin: 0;
  font-family: var(--ck-font-display);
  font-weight: var(--ck-font-weight-bold);
  color: var(--ck-color-text);
  font-size: var(--ck-font-size-xl);
}

#login-view .divit-brand {
  font-size: var(--ck-font-size-2xl);
}

.divit-app-shell {
  min-block-size: 100vh;
  align-items: stretch;
}

.divit-note-list-pane,
.divit-editor-pane {
  display: flex;
  flex-direction: column;
  gap: var(--ck-space-4);
  padding: var(--ck-space-5);
  min-block-size: 0;
}

.divit-note-list-pane {
  border-inline-end: 1px solid var(--ck-color-border);
  overflow-y: auto;
}

.divit-note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ck-space-2);
  overflow-y: auto;
}

.divit-note-list-item {
  display: block;
  width: 100%;
  text-align: start;
  padding: var(--ck-space-3);
  border: 1px solid var(--ck-color-border);
  border-radius: var(--ck-radius-md);
  background: var(--ck-color-surface-raised);
  cursor: pointer;
}

.divit-note-list-item:hover {
  background: var(--ck-color-surface-muted);
}

.divit-note-list-item[aria-current="true"] {
  border-color: var(--ck-color-primary);
  box-shadow: 0 0 0 1px var(--ck-color-primary);
}

.divit-note-list-item__title {
  display: block;
  font-weight: 600;
}

.divit-note-list-item__meta {
  display: block;
  color: var(--ck-color-text-muted);
  font-size: var(--ck-font-size-xs);
}

.divit-note-editor {
  flex: 1;
  resize: none;
  min-block-size: 60vh;
  font-family: var(--ck-font-mono, var(--ck-font-sans));
}

.divit-save-status {
  margin: 0;
  min-block-size: 1.5em;
  color: var(--ck-color-text-muted);
  font-size: var(--ck-font-size-xs);
}

.divit-save-status[data-state="error"] {
  color: var(--ck-color-danger);
}

.divit-empty-state {
  color: var(--ck-color-text-muted);
  padding: var(--ck-space-5);
  text-align: center;
}

.divit-editor-pane {
  align-items: stretch;
  justify-content: center;
}

.divit-editor-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.divit-editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--ck-space-4);
  min-block-size: 0;
}

.divit-back-button {
  display: none;
}

/* Narrow viewports: one pane at a time, toggled by #app-shell[data-pane]. Mirrors CKCSS's own
   $ck-bp-md (48rem) breakpoint so Divit's pane-visibility rule switches at the same point
   .ck-sidebar itself switches from one column to two. */
@media (max-width: 47.999rem) {
  #app-shell[data-pane="list"] .divit-editor-pane {
    display: none;
  }

  #app-shell[data-pane="editor"] .divit-note-list-pane {
    display: none;
  }

  .divit-back-button {
    display: inline-flex;
  }
}
