/* ==========================================================================
   Knowledge Hub — hub page (home.php) + article page (single.php)
   Tokens come from style.css :root. Measurements from the XD @1440.
   ========================================================================== */

.kh-wrap {
  max-width: 864px;
  padding-left: 0;
  padding-right: 0;
}

/* ─── Hub page ─────────────────────────────────────────────────────────── */

.kh-page .kh-section {
  padding-top: 120px;
}

/* Label → heading gap on the hub hero (XD: 8px). */
body.blog .hero-head {
  gap: 8px;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────── */

.kh-tabs {
  gap: 24px;
}

.kh-tabs .kh-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  font-family: "Source Serif 4", sans-serif;
  font-size: 18px;
  font-weight: 300;
  line-height: 35px;
  letter-spacing: var(--letter-spacing-default);
  color: var(--color-primary);
  text-align: left;
  text-decoration: none;
  border-bottom: 1px solid var(--divider-bg);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.kh-tabs .kh-tab:hover,
.kh-tabs .kh-tab.is-active {
  color: #ededed;
  border-bottom-color: #ededed;
}

.kh-tabs .kh-tab.is-active {
  font-weight: 400;
}

/* ─── List ─────────────────────────────────────────────────────────────── */

.kh-list {
  list-style: none;
  margin: 120px 0 0;
  padding: 0;
  border-bottom: 1px solid var(--divider-bg);
  transition: opacity 0.3s ease;
}

.kh-list.is-switching {
  opacity: 0.35;
  pointer-events: none;
}

.kh-row {
  border-top: 1px solid var(--divider-bg);
}

.kh-row__link {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 127px;
  padding: 24px;
  color: var(--color-primary);
  text-decoration: none;
}

.kh-row__thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.6);
}

.kh-row__thumb img,
.kh-row__thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Line icons (SVG) sit inside the tile; photos fill it. */
.kh-row__thumb img[src$=".svg"] {
  padding: 11px;
  object-fit: contain;
}

.kh-row__thumb svg {
  width: 26px;
  height: 26px;
}

.kh-row__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kh-row .kh-row__title {
  margin: 0;
  font-family: "Source Serif 4", sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1em;
  letter-spacing: var(--letter-spacing-default);
  color: var(--color-primary);
}

.kh-row__subtitle {
  font-size: 18px;
  font-weight: 300;
  line-height: 1em;
  letter-spacing: var(--letter-spacing-default);
  color: var(--color-primary);
}

.kh-row__arrow {
  flex: 0 0 auto;
  display: flex;
  color: var(--color-primary);
}

/* Arrow glyph from XD (16 × 16, fills the box) – replaces the inline SVG. */
.kh-row__arrow svg {
  display: none;
}

.kh-row__arrow::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%277.368%207.5%2016.132%2016.132%27%3E%3Cpath%20d%3D%27M%209.797%2023.105%20C%209.272%2023.631%208.42%2023.632%207.894%2023.107%20C%207.369%2022.582%207.368%2021.73%207.893%2021.204%20L%2018.91%2010.189%20L%2011.467%2010.189%20C%2010.724%2010.189%2010.122%209.587%2010.122%208.845%20C%2010.122%208.102%2010.724%207.5%2011.467%207.5%20L%2022.155%207.5%20C%2022.898%207.5%2023.5%208.102%2023.5%208.845%20L%2023.5%2019.534%20C%2023.5%2020.277%2022.898%2020.879%2022.155%2020.879%20C%2021.413%2020.879%2020.811%2020.277%2020.811%2019.534%20L%2020.811%2012.09%20L%209.797%2023.105%20Z%27%2F%3E%3C%2Fsvg%3E") center / 16px 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%277.368%207.5%2016.132%2016.132%27%3E%3Cpath%20d%3D%27M%209.797%2023.105%20C%209.272%2023.631%208.42%2023.632%207.894%2023.107%20C%207.369%2022.582%207.368%2021.73%207.893%2021.204%20L%2018.91%2010.189%20L%2011.467%2010.189%20C%2010.724%2010.189%2010.122%209.587%2010.122%208.845%20C%2010.122%208.102%2010.724%207.5%2011.467%207.5%20L%2022.155%207.5%20C%2022.898%207.5%2023.5%208.102%2023.5%208.845%20L%2023.5%2019.534%20C%2023.5%2020.277%2022.898%2020.879%2022.155%2020.879%20C%2021.413%2020.879%2020.811%2020.277%2020.811%2019.534%20L%2020.811%2012.09%20L%209.797%2023.105%20Z%27%2F%3E%3C%2Fsvg%3E") center / 16px 16px no-repeat;
}

.kh-empty {
  padding: 48px 24px;
  border-top: 1px solid var(--divider-bg);
  text-align: center;
  color: var(--color-secondry);
  font-weight: 300;
}

/* ─── Load More ────────────────────────────────────────────────────────── */

.kh-load-more-wr {
  margin-top: 40px;
}

.kh-load-more-wr[hidden],
.kh-load-more [hidden] {
  display: none !important;
}

.kh-load-more.custom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--whiteBtn-border);
  border-radius: 4px;
  background-color: var(--whiteBtn-bg);
  color: var(--text-black);
  font-family: "Source Serif 4", sans-serif;
  font-size: var(--font-size-btn);
  line-height: 22px;
  letter-spacing: var(--letter-spacing-default);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.kh-load-more.custom-btn:hover {
  background-color: var(--whiteBtn-hover-bg);
  border-color: var(--whiteBtn-hover-bg);
  color: var(--text-black);
}

.kh-load-more .btn-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.kh-load-more .btn-icon {
  color: #888888;
}

/* ─── Article page ─────────────────────────────────────────────────────── */

.kh-single__head {
  gap: 0;
}

.kh-pill {
  align-self: flex-start;
  display: inline-block;
  height: 37px;
  padding: 0 14px;
  border-radius: 4px;
  background: var(--cards-label);
  color: var(--color-secondry);
  font-size: 16px;
  font-weight: 300;
  line-height: 36px;
  white-space: nowrap;
  text-decoration: none;
}

.kh-single .kh-single__head .maintitle {
  margin: 12px 0 0;
  font-size: 60px;
  line-height: 65px;
}

.kh-single p.kh-single__subtitle {
  margin: 8px 0 0;
  font-size: 30px !important;
  line-height: 40px;
  color: var(--color-secondry);
}

.kh-single .divider {
  margin: 64px 0;
}

/* Divider above Article Updates / About the Author: 48px above and below.
   !important: style.css sets `.newclient .divider { margin: 64px 0 !important }`. */
@media (min-width: 992px) {
  .kh-single .divider:has(+ .kh-note),
  .kh-single .divider:has(+ .kh-author) {
    margin: 48px 0 !important;
  }
}

.kh-author {
  gap: 24px;
  align-items: flex-start;
}

.kh-author__image {
  flex: 0 0 109px;
  width: 109px;
  height: 109px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.6);
}

.kh-author__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kh-note {
  flex: 1 1 auto;
  min-width: 0;
}

.kh-note .kh-note__title {
  margin: 0;
  font-family: "Source Serif 4", sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 35px;
  letter-spacing: var(--letter-spacing-default);
  color: var(--color-primary);
}

.kh-note__text,
.kh-note__text p {
  margin: 0;
  font-size: 16px !important;
  font-weight: 300;
  line-height: 35px;
  color: var(--color-primary);
}

.kh-section__head {
  margin-bottom: 120px;
}

.kh-single .sectionTtile.kh-section__head {
  gap: 12px;
}

.kh-single .kh-section__head h5.subtitle,
.kh-single .kh-section__head h2.maintitle {
  line-height: 1em;
}

.kh-single .sfl-footnotes {
  border-top: 1px solid var(--divider-bg) !important;
  border-bottom: 0 !important;
  margin-top: 48px;
  padding-top: 48px;
  padding-bottom: 0;
}

/* "Footnotes" heading (first paragraph of the footnotes block).
   !important: style.css sets `.blog-txt p { margin-top: 12px !important }`. */
.kh-single .sfl-footnotes > p:first-child {
  margin: 0 !important;
  padding: 0;
  line-height: 1em;
}

/* ─── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
  .kh-page .kh-section {
    padding-top: 80px;
  }

  .kh-tabs {
    flex-wrap: nowrap;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .kh-tabs::-webkit-scrollbar {
    display: none;
  }

  .kh-tabs .kh-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .kh-list {
    margin-top: 64px;
  }

  .kh-section__head {
    margin-bottom: 64px;
  }
}

@media (max-width: 767.98px) {
  .kh-tabs {
    gap: 12px;
  }

  .kh-tabs .kh-tab {
    font-size: 15px;
    line-height: 22px;
    padding-bottom: 10px;
  }

  .kh-list {
    margin-top: 48px;
  }

  .kh-row__link {
    gap: 16px;
    min-height: 0;
    padding: 24px 8px;
  }

  .kh-row__thumb {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .kh-row .kh-row__title {
    font-size: 18px;
    line-height: 26px;
  }

  .kh-single .kh-single__head .maintitle {
    margin-top: 24px;
    font-size: 36px;
    line-height: 44px;
  }

  .kh-single p.kh-single__subtitle {
    font-size: 18px !important;
    line-height: 28px;
  }

  .kh-single .divider {
    margin: 40px 0;
  }

  .kh-author {
    flex-direction: column;
  }

  .kh-section__head {
    margin-bottom: 48px;
  }
}

/* ─── Optical sizes (match XD: "Source Serif 4 18pt" / "14pt") ─────────── */

.kh-row .kh-row__title {
  font-variation-settings: "opsz" 18;
}

.kh-tabs .kh-tab {
  font-variation-settings: "opsz" 14;
}

/* ─── Footnotes after "About the Author" / "Article Updates" ─────────────
   The line closes the notes block (like the live site), so it is there even
   when an article has no footnotes. */

.kh-single .divider.kh-divider-end {
  margin: 48px 0 !important;
}

.kh-single .kh-divider-end + .sfl-footnotes {
  border-top: 0 !important;
  margin-top: 0;
  padding-top: 0;
}

/* ─── Desktop spacing (≥992px), matched to the XD @1440 ───────────────────
   XD measures spacing to the visible text; these values allow for
   line-height so the visible gaps match the design's 4px grid. */

@media (min-width: 992px) {
  /* Hub hero: H1 → image */
  .kh-page .hero-head.mb-72 {
    margin-bottom: 76px;
  }

  /* Hub: image → tabs */
  .kh-page .kh-section {
    padding-top: 116px;
  }

  /* Tabs: text → underline spacing as in the XD */
  .kh-tabs .kh-tab {
    line-height: 31px;
  }

  /* Article "More Articles": label → heading → tabs */
  .kh-single .kh-section__head h5.subtitle {
    line-height: 24px;
  }

  .kh-single .kh-section__head {
    margin-bottom: 108px;
  }

  /* "Knowledge Hub" labels: optical alignment with the XD (2px up) */
  .kh-page .hero-head h5.subtitle,
  .kh-single .kh-section__head h5.subtitle {
    position: relative;
    top: -2px;
  }
}
