/* Shared rich-text content styles — published page (.desc-rich) and Quill editors (.portal-quill .ql-editor) */

:root {
  --portal-content-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
    "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --portal-content-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --portal-indent-step: 3em;
}

.desc-rich,
.portal-quill .ql-container,
.portal-quill .ql-editor {
  font-family: var(--portal-content-font);
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.5;
}

.portal-quill .ql-editor {
  font-family: inherit;
}

.desc-rich img,
.portal-quill .ql-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.portal-quill .ql-container.portal-quill-resizable {
  position: relative;
}

.portal-img-resize-overlay {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px solid #3b82f6;
  border-radius: 8px;
}

.portal-img-resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #3b82f6;
  border: 2px solid #fff;
  border-radius: 2px;
  cursor: nwse-resize;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

body.portal-img-resizing {
  cursor: nwse-resize;
  user-select: none;
}

body.portal-img-resizing .portal-img-resize-handle {
  cursor: nwse-resize;
}

.desc-rich p,
.portal-quill .ql-editor p {
  margin-bottom: 0.5rem;
}

.desc-rich p:last-child,
.portal-quill .ql-editor p:last-child {
  margin-bottom: 0;
}

.desc-rich h1,
.desc-rich h2,
.desc-rich h3,
.portal-quill .ql-container.ql-snow .ql-editor h1,
.portal-quill .ql-container.ql-snow .ql-editor h2,
.portal-quill .ql-container.ql-snow .ql-editor h3 {
  font-family: var(--portal-content-font);
}

.desc-rich h1,
.portal-quill .ql-container.ql-snow .ql-editor h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 1rem 0 0.5rem;
}

.desc-rich h2,
.portal-quill .ql-container.ql-snow .ql-editor h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 1rem 0 0.5rem;
}

.desc-rich h3,
.portal-quill .ql-container.ql-snow .ql-editor h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.75rem 0 0.35rem;
}

.desc-rich blockquote,
.portal-quill .ql-editor blockquote {
  border-left: 4px solid #cbd5e1;
  margin: 1rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: #475569;
}

.desc-rich pre,
.desc-rich pre.ql-syntax,
.desc-rich .ql-syntax,
.portal-quill .ql-container.ql-snow .ql-editor pre,
.portal-quill .ql-container.ql-snow .ql-editor pre.ql-syntax,
.portal-quill .ql-container.ql-snow .ql-editor .ql-syntax {
  font-family: var(--portal-content-mono);
  background: #23241f;
  color: #f8f8f2;
  border-radius: 3px;
  padding: 5px 10px;
  overflow-x: auto;
  font-size: 0.85rem;
  white-space: pre-wrap;
  margin: 5px 0 5px;
}

/* Lists — match Quill snow rendering on published page and editor */
.desc-rich ol,
.desc-rich ul,
.portal-quill .ql-editor ol,
.portal-quill .ql-editor ul {
  margin: 0 0 0.5rem;
  padding-left: 1.5em;
}

.desc-rich ol > li,
.desc-rich ul > li,
.portal-quill .ql-editor ol > li,
.portal-quill .ql-editor ul > li {
  list-style-type: none;
  padding-left: 0;
}

.desc-rich ul > li::before,
.portal-quill .ql-editor ul > li::before {
  content: '\2022';
  display: inline-block;
  white-space: nowrap;
  width: 1.2em;
  margin-left: -1.5em;
  margin-right: 0.3em;
  text-align: right;
}

.desc-rich ol,
.portal-quill .ql-editor ol {
  counter-reset: list-0;
}

.desc-rich ol > li,
.portal-quill .ql-editor ol > li {
  counter-increment: list-0;
}

.desc-rich ol > li::before,
.portal-quill .ql-editor ol > li::before {
  content: counter(list-0, decimal) '. ';
  display: inline-block;
  white-space: nowrap;
  width: 1.2em;
  margin-left: -1.5em;
  margin-right: 0.3em;
  text-align: right;
}

.desc-rich ol > li:not(.ql-direction-rtl),
.desc-rich ul > li:not(.ql-direction-rtl),
.portal-quill .ql-editor ol > li:not(.ql-direction-rtl),
.portal-quill .ql-editor ul > li:not(.ql-direction-rtl) {
  padding-left: 1.5em;
}

/* Block indentation (Quill indent toolbar) */
.desc-rich .ql-indent-1:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-1:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 1); }
.desc-rich li.ql-indent-1:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-1:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 1 + 1.5em); }

.desc-rich .ql-indent-2:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-2:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 2); }
.desc-rich li.ql-indent-2:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-2:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 2 + 1.5em); }

.desc-rich .ql-indent-3:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-3:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 3); }
.desc-rich li.ql-indent-3:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-3:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 3 + 1.5em); }

.desc-rich .ql-indent-4:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-4:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 4); }
.desc-rich li.ql-indent-4:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-4:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 4 + 1.5em); }

.desc-rich .ql-indent-5:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-5:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 5); }
.desc-rich li.ql-indent-5:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-5:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 5 + 1.5em); }

.desc-rich .ql-indent-6:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-6:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 6); }
.desc-rich li.ql-indent-6:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-6:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 6 + 1.5em); }

.desc-rich .ql-indent-7:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-7:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 7); }
.desc-rich li.ql-indent-7:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-7:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 7 + 1.5em); }

.desc-rich .ql-indent-8:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-8:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 8); }
.desc-rich li.ql-indent-8:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-8:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 8 + 1.5em); }

.desc-rich .ql-indent-9:not(.ql-direction-rtl),
.portal-quill .ql-editor .ql-indent-9:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 9); }
.desc-rich li.ql-indent-9:not(.ql-direction-rtl),
.portal-quill .ql-editor li.ql-indent-9:not(.ql-direction-rtl) { padding-left: calc(var(--portal-indent-step) * 9 + 1.5em); }

/* RTL indent */
.desc-rich .ql-indent-1.ql-direction-rtl.ql-align-right,
.portal-quill .ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right { padding-right: calc(var(--portal-indent-step) * 1); }
.desc-rich li.ql-indent-1.ql-direction-rtl.ql-align-right,
.portal-quill .ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right { padding-right: calc(var(--portal-indent-step) * 1 + 1.5em); }

.desc-rich .ql-indent-2.ql-direction-rtl.ql-align-right,
.portal-quill .ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right { padding-right: calc(var(--portal-indent-step) * 2); }
.desc-rich li.ql-indent-2.ql-direction-rtl.ql-align-right,
.portal-quill .ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right { padding-right: calc(var(--portal-indent-step) * 2 + 1.5em); }

.desc-rich .ql-indent-3.ql-direction-rtl.ql-align-right,
.portal-quill .ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right { padding-right: calc(var(--portal-indent-step) * 3); }
.desc-rich li.ql-indent-3.ql-direction-rtl.ql-align-right,
.portal-quill .ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right { padding-right: calc(var(--portal-indent-step) * 3 + 1.5em); }

/* Text alignment */
.desc-rich .ql-align-center,
.portal-quill .ql-editor .ql-align-center { text-align: center; }

.desc-rich .ql-align-right,
.portal-quill .ql-editor .ql-align-right { text-align: right; }

.desc-rich .ql-align-justify,
.portal-quill .ql-editor .ql-align-justify { text-align: justify; }

.portal-quill .ql-editor {
  min-height: 200px;
}

.portal-quill .ql-editor.ql-blank::before {
  color: #94a3b8;
  font-style: normal;
  font-family: inherit;
}
