/* Author profiles use the same compact type, colour hierarchy and content
   column as the rest of TulboDoctor. This file is loaded on those two pages. */
body.tcs-profile-page {
  --tcs-profile-portrait-width: 220px;
}

body.tcs-profile-page .wp-site-blocks > main {
  margin-block-start: 20px !important;
  padding-block-start: 0 !important;
}

body.tcs-profile-page .wp-site-blocks main h1.wp-block-post-title,
body.tcs-profile-page .wp-site-blocks main h1.wp-block-heading {
  font-size: 24px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  margin-block: 0 6px !important;
  padding-block: 0 !important;
  border-bottom: 0 !important;
  text-align: start !important;
  overflow-wrap: anywhere;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-group:has(> h1) {
  margin-block-start: 0 !important;
  padding-block-start: 0 !important;
  gap: 6px 16px !important;
  flex-wrap: wrap !important;
  align-items: center;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-group:has(> h1) > p {
  font-size: 13px !important;
  line-height: 1.6 !important;
  margin-block: 0 !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-title + .wp-block-post-content {
  margin-block-start: 6px !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content,
body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(p, li, blockquote) {
  font-size: 15px !important;
  line-height: 1.75 !important;
  font-weight: 400;
  overflow-wrap: anywhere;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content p {
  margin-block: 12px !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(ul, ol) {
  padding-inline-start: 22px;
  margin-block: 12px !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content li {
  margin-block: 4px !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(p, li, h1, h2, h3, h4) :is(span, strong, em, b, i) {
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Section labels hug the words and align with the existing 760px content
   column, even when WordPress places a heading directly in a wider group. */
body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(h2, h3) {
  display: block;
  box-sizing: border-box;
  width: fit-content;
  max-width: min(100%, var(--wp--style--global--content-size, 760px));
  margin-inline: max(0px, calc((100% - var(--wp--style--global--content-size, 760px)) / 2)) 0 !important;
  align-self: flex-start;
  justify-self: start;
  border-radius: 5px !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
  text-align: start !important;
  overflow-wrap: anywhere;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content h2 {
  font-size: 20px !important;
  margin-block: 22px 10px !important;
  padding: 5px 9px !important;
  background: #244a64 !important;
  color: #fff !important;
  border: 0 !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content h3 {
  font-size: 16px !important;
  margin-block: 16px 8px !important;
  padding: 4px 8px !important;
  background: #eaf3fa !important;
  color: #244a64 !important;
  border: 1px solid #d1e2ef !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content h4 {
  font-size: 15px !important;
  line-height: 1.5 !important;
  margin-block: 14px 6px !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(h2, h3) :is(a, span, strong, em) {
  color: inherit !important;
  background: transparent !important;
}

/* Reading links stay inline with the sentence. Small grey highlights wrap
   with long English labels without becoming oversized button rows. */
body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(p, li) a:not(:has(img)):not(.wp-element-button):not(.wp-block-button__link) {
  display: inline;
  padding: 1px 4px;
  border: 1px solid #e1e5e9;
  border-radius: 4px;
  background: #f5f7f9;
  color: #244a64;
  font-size: inherit !important;
  line-height: inherit !important;
  text-decoration: none !important;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content :is(p, li) a:not(:has(img)):hover {
  background: #eaf3fa;
  border-color: #bbd0e0;
  color: #175e91;
}

body.tcs-profile-page .wp-site-blocks main a:focus-visible {
  outline: 2px solid #216b9d;
  outline-offset: 2px;
}

/* The old Korean panel had a 94px minimum height and large bold text.
   Keep the wording as a quiet note, with both sentences on one row if they fit. */
body.tcs-profile-page .wp-site-blocks main .td-profile-panel,
body.tcs-profile-page .wp-site-blocks main .wp-block-post-content p[data-tcs-profile-motto] {
  box-sizing: border-box !important;
  width: min(100%, var(--wp--style--global--content-size, 760px)) !important;
  max-width: min(100%, var(--wp--style--global--content-size, 760px)) !important;
  min-height: 0 !important;
  height: auto !important;
  margin-inline: auto !important;
  margin-block: 12px !important;
  padding: 9px 12px !important;
  border: 1px solid #e1e5e9 !important;
  border-radius: 5px !important;
  background: #f5f7f9 !important;
  color: #415565 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  line-height: 1.6 !important;
}

body.tcs-profile-page .wp-site-blocks main .td-profile-panel {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 4px 12px !important;
}

body.tcs-profile-page .wp-site-blocks main .td-profile-panel :is(p, h1, h2, h3, h4) {
  display: block;
  width: auto;
  margin: 0 !important;
  padding: 0 !important;
  min-width: 0;
  background: transparent !important;
  border: 0 !important;
  color: inherit !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  line-height: 1.6 !important;
}

body.tcs-profile-page .wp-site-blocks main .td-profile-panel *,
body.tcs-profile-page .wp-site-blocks main [data-tcs-profile-motto] * {
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
}

/* Scale the portrait without cropping it or affecting subsequent images. */
body.tcs-profile-page .wp-site-blocks main .wp-block-post-content [data-tcs-profile-portrait] {
  display: block !important;
  float: none !important;
  box-sizing: border-box;
  width: min(100%, var(--tcs-profile-portrait-width)) !important;
  max-width: 100% !important;
  height: auto !important;
  margin-inline: max(0px, calc((100% - var(--wp--style--global--content-size, 760px)) / 2)) 0 !important;
  margin-block: 14px !important;
}

body.tcs-profile-page .wp-site-blocks main .wp-block-post-content [data-tcs-profile-portrait] img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

@media (max-width: 781px) {
  body.tcs-profile-page {
    --tcs-profile-portrait-width: 180px;
  }

  body.tcs-profile-page .wp-site-blocks > main {
    margin-block-start: 12px !important;
  }

  body.tcs-profile-page .wp-site-blocks main h1.wp-block-post-title,
  body.tcs-profile-page .wp-site-blocks main h1.wp-block-heading {
    font-size: 22px !important;
  }

  body.tcs-profile-page .wp-site-blocks main .wp-block-post-content h2 {
    font-size: 18px !important;
    margin-block-start: 18px !important;
  }
}
