/* The page that writes a group's note, and the frames that show one (note-editor.js).
 *
 * Not part of the Tailwind build, like lua-editor.css: the script that adds the toolbar holds
 * class names Tailwind does not scan. The form's own fields are daisyUI classes in the template.
 *
 * This is not note.css. That one is the app's, styles whole pages, and lives only inside the
 * frame; this one lays out the site's page around it.
 */

.note-form {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

/* Side by side once there is room for two columns of text. */
@media (min-width: 1024px) {
  .note-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .note-form__preview {
    position: sticky;
    top: 1rem;
  }
}

.note-form__row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
  .note-form__row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.note-form__theirs {
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.8rem;
  padding: 0.5rem;
  background: var(--color-base-200, #f7f7f8);
}

/* The note's page, in a frame of its own. The white is note.css's paper: the frame is always light,
 * as the app's note is, whatever theme the site is in. */
.note-frame {
  display: block;
  width: 100%;
  min-height: 12rem;
  height: 70vh;
  border: 1px solid color-mix(in oklab, var(--color-base-content, #383a42) 20%, transparent);
  border-radius: 0.5rem;
  background: #fff;
}

.note-frame--preview {
  height: 75vh;
}

.note-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin: 0.25rem 0;
}

.note-toolbar__button,
.note-toolbar__select {
  min-height: 2rem;
  padding: 0 0.6rem;
  font-size: 0.9rem;
  line-height: 1;
  border: 1px solid color-mix(in oklab, var(--color-base-content, #383a42) 25%, transparent);
  border-radius: 0.375rem;
  background: var(--color-base-100, #fff);
  color: inherit;
  cursor: pointer;
}

.note-toolbar__button:hover,
.note-toolbar__select:hover {
  background: var(--color-base-200, #f7f7f8);
}

.note-toolbar__button:focus-visible,
.note-toolbar__select:focus-visible {
  outline: 2px solid var(--color-primary, #4078f2);
  outline-offset: 1px;
}

.note-toolbar__bold {
  font-weight: 700;
}

/* Where the window that adds a missing image takes a file (_note_image_dialog.html). */
.note-image-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
  padding: 1.5rem 1rem;
  text-align: center;
  border: 2px dashed color-mix(in oklab, var(--color-base-content, #383a42) 35%, transparent);
  border-radius: 0.5rem;
}

.note-image-zone--over {
  border-color: var(--color-primary, #4078f2);
  background: color-mix(in oklab, var(--color-primary, #4078f2) 10%, transparent);
}

/* An image of a note over the whole screen (_note_image_viewer.html). */
.note-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(0 0 0 / 0.92);
  color: #fff;
}

.note-viewer[open] {
  display: flex;
  flex-direction: column;
}

.note-viewer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
}

.note-viewer__caption {
  flex: 1 1 12rem;
  min-width: 0;
  font-style: italic;
}

.note-viewer__hint {
  padding: 0 0.75rem;
  font-size: 0.85rem;
  text-align: right;
}

.note-viewer__hint:empty {
  display: none;
}

.note-viewer__stage {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 0.75rem 0.75rem;
}

/* As large as the screen holds, a small one enlarged; a click shows its own size, to be scrolled. */
.note-viewer__stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.note-viewer__stage img.note-viewer__larger {
  cursor: zoom-in;
}

.note-viewer__stage img.note-viewer__zoomed {
  width: auto;
  height: auto;
  max-width: none;
  margin: auto;
  flex: none;
  cursor: zoom-out;
}

/* A field and its label, one above the other. daisyUI 5 has no `form-control` any more, so the
 * template's labels would run on in a line. */
.note-form label.form-control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
