/*
  RichTextCompatibility.min.css renders <hr> at rgba(0,0,0,.1), which is
  barely visible on the public project page. Darken it for legibility.
*/
.parsed-rich-text-content hr {
  border-top: 1px solid rgba(0, 0, 0, 0.3);
}

/*
  RichTextCompatibility.min.css resets <b> and <strong> to font-weight: inherit,
  which makes <b> inherit the normal weight of its parent paragraph on the
  read-only render path. Restore the expected bold rendering here.
*/
.parsed-rich-text-content b,
.parsed-rich-text-content strong {
  font-weight: bold;
}

/*
  Match Redactor editor list styling on the read-only render path.
  RichTextCompatibility.min.css resets <li> to inherit but leaves <ul>/<ol>
  at the browser default 16px, so project page list items render larger than
  they do inside the editor.
*/
.parsed-rich-text-content ul,
.parsed-rich-text-content ol,
.parsed-rich-text-content li {
  font-size: 14px;
  line-height: 21px;
}

/*
  Match Redactor editor heading styles on the read-only render path.
  RichTextCompatibility.min.css uses lighter weights and fixed pixel
  line-heights; the editor uses bold/semi-bold weights and 1.25 line-height.
*/
.parsed-rich-text-content h1 {
  font-size: 36px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.parsed-rich-text-content h2 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.parsed-rich-text-content h3 {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.parsed-rich-text-content h4,
.parsed-rich-text-content h5,
.parsed-rich-text-content h6 {
  font-size: 16px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/*
  Match Redactor editor vertical spacing on the read-only render path.
  The editor uses adjacent-sibling margins instead of paragraph margin-bottom.
*/
.parsed-rich-text-content p {
  margin-bottom: 0 !important;
}
.parsed-rich-text-content address + *,
.parsed-rich-text-content dl + *,
.parsed-rich-text-content ol + *,
.parsed-rich-text-content p + *,
.parsed-rich-text-content pre + *,
.parsed-rich-text-content ul + * {
  margin-top: 16px;
}
.parsed-rich-text-content h1 + *,
.parsed-rich-text-content h2 + *,
.parsed-rich-text-content h3 + *,
.parsed-rich-text-content h4 + *,
.parsed-rich-text-content h5 + *,
.parsed-rich-text-content h6 + * {
  margin-top: 8px;
}
.parsed-rich-text-content h1 + h2,
.parsed-rich-text-content h2 + h3,
.parsed-rich-text-content h3 + h4,
.parsed-rich-text-content h4 + h5,
.parsed-rich-text-content h5 + h6 {
  margin-top: 12px;
}
.parsed-rich-text-content address + h2,
.parsed-rich-text-content address + h3,
.parsed-rich-text-content address + h4,
.parsed-rich-text-content address + h5,
.parsed-rich-text-content address + h6,
.parsed-rich-text-content dl + h2,
.parsed-rich-text-content dl + h3,
.parsed-rich-text-content dl + h4,
.parsed-rich-text-content dl + h5,
.parsed-rich-text-content dl + h6,
.parsed-rich-text-content ol + h2,
.parsed-rich-text-content ol + h3,
.parsed-rich-text-content ol + h4,
.parsed-rich-text-content ol + h5,
.parsed-rich-text-content ol + h6,
.parsed-rich-text-content p + h2,
.parsed-rich-text-content p + h3,
.parsed-rich-text-content p + h4,
.parsed-rich-text-content p + h5,
.parsed-rich-text-content p + h6,
.parsed-rich-text-content pre + h2,
.parsed-rich-text-content pre + h3,
.parsed-rich-text-content pre + h4,
.parsed-rich-text-content pre + h5,
.parsed-rich-text-content pre + h6,
.parsed-rich-text-content ul + h2,
.parsed-rich-text-content ul + h3,
.parsed-rich-text-content ul + h4,
.parsed-rich-text-content ul + h5,
.parsed-rich-text-content ul + h6 {
  margin-top: 20px;
}

/*
  Rich-text media must never overflow its container (updates, careers,
  descriptions). Redactor's image resize writes fixed width/height, so cap
  the width and let the height follow the aspect ratio.
*/
.rich-text-content img,
.parsed-rich-text-content img,
.rich-text-content video,
.parsed-rich-text-content video {
  max-width: 100% !important;
  height: auto !important;
}
.rich-text-content figure,
.parsed-rich-text-content figure,
.rich-text-content iframe,
.parsed-rich-text-content iframe {
  max-width: 100% !important;
}

/*
  Redactor 4 to-do lists are saved as "[ ] text" / "[x] text" list items;
  parseHTML() strips the marker and tags the item with data-todo="0|1".
  Render them as checkboxes matching the editor instead of bullets.
  Not scoped to .parsed-rich-text-content: some render paths (e.g.
  ProjectUpdateNew) don't use that class, and data-todo only comes from parseHTML.
*/
ul:has(> li[data-todo]) {
  list-style: none !important;
  padding-inline-start: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
li[data-todo] {
  --todo-size: 20px;
  list-style: none !important;
  position: relative;
  padding-inline-start: calc(var(--todo-size) + 8px);
  line-height: 1.4;
  min-height: var(--todo-size);
}
li[data-todo]::marker {
  content: none;
}
li[data-todo]::before {
  content: '';
  position: absolute;
  top: max(0px, calc((1.4em - var(--todo-size)) / 2));
  inset-inline-start: 0;
  width: var(--todo-size);
  height: var(--todo-size);
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  background: #fff;
}
li[data-todo='1']::before {
  border-color: #111;
  background: #111;
}
li[data-todo='1']::after {
  content: '';
  position: absolute;
  top: calc(max(0px, calc((1.4em - var(--todo-size)) / 2)) + 4px);
  inset-inline-start: 7px;
  width: 5px;
  height: 10px;
  box-sizing: border-box;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
