/*
 * Post body blocks (approved share-page draft, docs/design/mockups/share).
 * Shared by the server-rendered share page and, later, the web app. Tokens: tokens.css.
 */
.ni-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  font-size: 1.0625rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.ni-body > * { margin-top: 0; margin-bottom: 0; }
.ni-short .ni-body { font-size: 1.25rem; line-height: 1.6; }

.ni-text > * { margin: 0; }
.ni-text > * + * { margin-top: 1rem; }
.ni-text > * + h2,
.ni-text > * + h3 { margin-top: 1.75rem; }
.ni-text h2,
.ni-text h3 { line-height: 1.3; letter-spacing: -0.01em; }
.ni-text h2 { font-size: 1.375rem; }
.ni-text h3,
.ni-text h4,
.ni-text h5,
.ni-text h6 { font-size: 1.125rem; }
.ni-text a { color: var(--ni-color-primary); text-decoration: underline; text-underline-offset: 0.2em; }
.ni-text blockquote {
  margin: 0;
  padding: 0.25rem 0;
  padding-inline-start: 1rem;
  border-inline-start: 3px solid var(--ni-color-secondary);
  color: var(--ni-color-text-secondary);
}
.ni-text code {
  font-family: var(--ni-font-mono);
  font-size: 0.875em;
  background: var(--ni-color-surface-2);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}
.ni-text pre {
  background: var(--ni-color-code-bg);
  color: #f9fafb;
  border-radius: var(--ni-radius-md);
  padding: 1rem;
  overflow-x: auto;
}
.ni-text pre code { background: none; padding: 0; color: inherit; }
.ni-text ul,
.ni-text ol { padding-inline-start: 1.5rem; margin: 0; }
.ni-text hr { border: 0; border-top: 1px solid var(--ni-color-border); }
.ni-text table { border-collapse: collapse; display: block; overflow-x: auto; }
.ni-text th,
.ni-text td { border: 1px solid var(--ni-color-border); padding: 0.375rem 0.625rem; }

/* todo */
.ni-todo {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--ni-color-surface-2);
  border-radius: var(--ni-radius-md);
}
.ni-todo-item label { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.5rem 0; }
.ni-todo-item + .ni-todo-item { border-top: 1px solid rgb(124 58 237 / 0.1); }
.ni-todo input {
  appearance: none;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.3rem 0 0;
  border-radius: 6px;
  border: 1.5px solid var(--ni-color-secondary);
  background: var(--ni-color-surface);
  display: grid;
  place-content: center;
}
.ni-todo input:checked { background: var(--ni-color-primary); border-color: var(--ni-color-primary); }
.ni-todo input:checked::after {
  content: "";
  width: 0.35rem;
  height: 0.65rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.ni-done span {
  color: var(--ni-color-text-secondary);
  text-decoration: line-through;
  text-decoration-color: rgb(107 114 128 / 0.6);
}

/* image: a frame as wide as the column with the image centred in it, never enlarged (its width attribute)
   and at most about one screen tall. The rest of the frame shows the image's tone (.ni-tone: an SVG fill,
   softened over the surface; older images without a tone: surface-2), also while the image loads.
   Long images (at least 3× taller than wide) show their top part with a tag; the viewer shows them whole. */
.ni-image { margin: 0; }
.ni-zoom { display: block; cursor: zoom-in; }
.ni-image .ni-zoom { position: relative; overflow: hidden; border-radius: var(--ni-radius-md); background: var(--ni-color-surface-2); }
.ni-tone { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: var(--ni-color-surface); }
.ni-tone rect { opacity: var(--ni-image-tone); }
.ni-fit { position: relative; display: block; width: fit-content; max-width: 100%; margin-inline: auto; }
.ni-fit picture { display: block; }
.ni-image img { display: block; max-width: 100%; height: auto; max-height: min(80vh, 48rem); object-fit: contain; }
.ni-image-long img { object-fit: cover; object-position: top; }
.ni-long-tag {
  position: absolute;
  bottom: 0.5rem;
  inset-inline-end: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgb(17 24 39 / 0.72);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
  pointer-events: none;
}
.ni-image figcaption {
  font-size: 0.875rem;
  color: var(--ni-color-text-secondary);
  text-align: center;
  margin-top: 0.625rem;
  padding: 0 1.25rem;
}

/* audio */
.ni-audio { margin: 0; padding: 1rem; border-radius: var(--ni-radius-md); background: var(--ni-color-surface-2); }
.ni-audio figcaption {
  padding: 0 0 0.625rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ni-audio figcaption::before {
  content: "";
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--ni-color-primary);
  mask: radial-gradient(circle at 50% 50%, #000 30%, transparent 31%), linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  flex: none;
}
.ni-audio audio { width: 100%; height: 2.5rem; display: block; }

/* phones: images run edge to edge */
@media (max-width: 47.99rem) {
  .ni-image { margin-inline: -1rem; }
  .ni-image .ni-zoom { border-radius: 0; }
}

/* NiceNote media still processing / unavailable (no broken element, keeps the reading flow). */
.ni-media-ph { margin: 0; display: grid; place-items: center; min-height: 7.5rem; border: 1px dashed var(--ni-color-border); border-radius: var(--ni-radius-md); background: var(--ni-color-hover); color: var(--ni-color-text-secondary); font-size: 0.875rem; }
.ni-media-ph-audio { min-height: 3.5rem; }
.ni-media-ph[data-state="unavailable"] { color: var(--ni-color-muted); }
.ni-empty-body { color: var(--ni-color-text-secondary); }
