/* ICHA V3 Knowledge Hub. Scoped to the unified archive and reader only. */
.kh-page,
.kh-reader-page {
  background: #fff;
  color: #111;
}

.kh-page .page,
.kh-reader-page .page {
  padding-top: 0;
}

.kh-hero {
  padding: clamp(88px, 10vw, 150px) 0 clamp(58px, 7vw, 96px);
  border-bottom: 1px solid #111;
}

.kh-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: clamp(44px, 7vw, 110px);
  align-items: end;
}

.kh-hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(3.4rem, 7.5vw, 7.5rem);
  line-height: .93;
  letter-spacing: -.055em;
}

.kh-hero p {
  margin: 0;
  font-size: clamp(1.05rem, 1.5vw, 1.32rem);
  line-height: 1.6;
  color: #555;
}

.kh-featured {
  padding: clamp(48px, 6vw, 82px) 0;
  border-bottom: 1px solid #d4d4d4;
}

.kh-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #111;
}

.kh-feature {
  padding: 30px clamp(24px, 3vw, 44px) 36px 0;
}

.kh-feature + .kh-feature {
  padding-left: clamp(24px, 3vw, 44px);
  border-left: 1px solid #d4d4d4;
}

.kh-feature-label,
.kh-feature-meta,
.kh-result-meta,
.kh-reader-type,
.kh-reader-meta,
.kh-comments-heading > p {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .73rem;
  font-weight: 700;
}

.kh-feature-label,
.kh-comments-heading > p {
  color: var(--ifrc-red);
}

.kh-feature-meta {
  margin: 18px 0 12px;
  color: #666;
}

.kh-feature h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.04;
  letter-spacing: -.035em;
}

.kh-feature h2 a,
.kh-result h3 a {
  color: inherit;
  text-decoration: none;
}

.kh-feature h2 a:hover,
.kh-result h3 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.kh-feature > p:not(.kh-feature-label):not(.kh-feature-meta) {
  max-width: 680px;
  margin: 20px 0 0;
  color: #555;
  line-height: 1.65;
}

.kh-feature-actions,
.kh-result-actions {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.kh-feature-actions a,
.kh-action-link {
  color: #111;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
}

.kh-feature-actions a:first-child,
.kh-action-primary {
  color: var(--ifrc-red);
}

.kh-archive {
  padding: clamp(64px, 8vw, 112px) 0;
}

.kh-archive-layout {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: clamp(42px, 6vw, 88px);
  align-items: start;
}

.kh-filters {
  position: sticky;
  top: 94px;
  border-top: 1px solid #111;
  padding-top: 22px;
}

.kh-filters h2 {
  margin: 0 0 24px;
  font-size: 1.35rem;
}

.kh-filter-field {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid #ddd;
}

.kh-filter-field:first-of-type {
  border-top: 0;
}

.kh-filter-field label,
.kh-filter-field > span {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.kh-filter-field input,
.kh-filter-field select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #888;
  border-radius: 0;
  background: transparent;
  padding: 10px 0;
  font: inherit;
  color: #111;
}

.kh-filter-field input:focus,
.kh-filter-field select:focus {
  outline: 2px solid var(--ifrc-red);
  outline-offset: 3px;
}

.kh-reset {
  margin-top: 18px;
  border: 0;
  border-bottom: 1px solid #111;
  background: transparent;
  padding: 0 0 3px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.kh-results-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: baseline;
  border-top: 1px solid #111;
  padding: 20px 0 24px;
}

.kh-results-header h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -.04em;
}

.kh-results-header span {
  color: #666;
}

.kh-result {
  display: grid;
  grid-template-columns: minmax(150px, .24fr) minmax(0, 1fr) minmax(150px, .22fr);
  gap: clamp(24px, 4vw, 54px);
  padding: clamp(28px, 4vw, 48px) 0;
  border-top: 1px solid #d6d6d6;
}

.kh-result-meta {
  display: grid;
  align-content: start;
  gap: 8px;
  color: #666;
}

.kh-result-meta span:first-child {
  color: var(--ifrc-red);
}

.kh-result h3 {
  margin: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -.03em;
}

.kh-result-main > p {
  max-width: 760px;
  margin: 18px 0 0;
  color: #555;
  line-height: 1.65;
}

.kh-result-partners {
  font-size: .82rem;
  color: #777 !important;
}

.kh-result-actions {
  align-content: start;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0;
}

.kh-empty {
  border-top: 1px solid #d6d6d6;
  padding: 50px 0;
}

.kh-empty h3 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.kh-connect {
  padding: clamp(56px, 7vw, 90px) 0;
  background: #f4f2ed;
  border-top: 1px solid #111;
}

.kh-connect-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(180px, .6fr));
  gap: 30px;
}

.kh-connect-intro h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -.04em;
}

.kh-connect-card {
  border-top: 1px solid #111;
  padding-top: 18px;
}

.kh-connect-card h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.kh-connect-card p {
  color: #555;
  line-height: 1.55;
}

.kh-connect-card a {
  color: var(--ifrc-red);
  font-weight: 700;
}

/* Unified reading view */
.kh-reader-shell {
  padding: clamp(92px, 10vw, 150px) 0 clamp(70px, 8vw, 110px);
}

.kh-reader-header {
  max-width: 1120px;
  margin: 0 auto;
  border-top: 1px solid #111;
  padding-top: 20px;
}

.kh-reader-back {
  display: inline-block;
  margin-bottom: clamp(50px, 6vw, 84px);
  color: #111;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.kh-reader-type {
  color: var(--ifrc-red);
  margin: 0 0 18px;
}

.kh-reader-header h1 {
  max-width: 1050px;
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 6rem);
  line-height: .98;
  letter-spacing: -.05em;
}

.kh-reader-deck {
  max-width: 820px;
  margin: 28px 0 0;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.6;
  color: #555;
}

.kh-reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 28px;
  color: #666;
}

.kh-reader-partners {
  margin: 18px 0 0;
  color: #666;
}

.kh-reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.kh-pdf-shell {
  max-width: 1180px;
  margin: clamp(48px, 7vw, 88px) auto 0;
  height: min(78vh, 980px);
  min-height: 640px;
  border-top: 1px solid #111;
  border-bottom: 1px solid #111;
}

.kh-pdf-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.kh-article-body {
  max-width: 820px;
  margin: clamp(54px, 8vw, 100px) auto 0;
  font-size: 1.05rem;
  line-height: 1.75;
}

.kh-article-body h2,
.kh-article-body h3 {
  margin-top: 2.2em;
  line-height: 1.15;
  letter-spacing: -.025em;
}

.kh-article-body img,
.kh-article-body figure {
  max-width: 100%;
  height: auto;
}

.kh-article-body figure {
  margin: 2.5rem 0;
}

.kh-article-body a {
  color: var(--ifrc-red);
}

.kh-comments {
  max-width: 820px;
  margin: clamp(70px, 9vw, 120px) auto 0;
  border-top: 1px solid #111;
  padding-top: 28px;
  scroll-margin-top: 120px;
}

.kh-comments-heading h2 {
  margin: 6px 0 10px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  letter-spacing: -.04em;
}

.kh-comments-heading > span {
  display: block;
  color: #666;
  line-height: 1.55;
  margin-bottom: 28px;
}

.kh-comments form {
  display: grid;
  gap: 22px;
}

.kh-comment-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.kh-comments label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.kh-comments input,
.kh-comments textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #777;
  border-radius: 0;
  padding: 12px 0;
  font: inherit;
  background: transparent;
}

.kh-comments textarea {
  min-height: 150px;
  resize: vertical;
}

.kh-comments button {
  justify-self: start;
}

.kh-comments .comment-list {
  margin-top: 34px;
}

.kh-comments .comment-list article {
  border-top: 1px solid #ddd;
  padding: 20px 0;
}

.kh-reader-missing {
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 980px) {
  .kh-hero-grid,
  .kh-archive-layout,
  .kh-connect-grid {
    grid-template-columns: 1fr;
  }
  .kh-filters {
    position: static;
  }
  .kh-result {
    grid-template-columns: minmax(130px, .28fr) minmax(0, 1fr);
  }
  .kh-result-actions {
    grid-column: 2;
    flex-direction: row;
  }
  .kh-connect-grid {
    gap: 36px;
  }
}

@media (max-width: 680px) {
  .kh-feature-grid,
  .kh-comment-fields {
    grid-template-columns: 1fr;
  }
  .kh-feature + .kh-feature {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid #d4d4d4;
  }
  .kh-result {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .kh-result-actions {
    grid-column: auto;
    flex-direction: row;
    gap: 18px;
  }
  .kh-pdf-shell {
    min-height: 520px;
  }
  .kh-reader-header h1 {
    font-size: clamp(2.5rem, 12vw, 4.6rem);
  }
}

/* ICHA V3.1 Knowledge Hub density correction.
   Adds actual PDF cover thumbnails, a compact filter bar and a scannable editorial card grid.
   Scoped only to the unified Knowledge Hub archive. */

.kh-page .kh-archive-layout {
  grid-template-columns: 1fr;
  gap: clamp(34px, 5vw, 58px);
}

.kh-page .kh-filters {
  position: static;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 24px;
  border-top: 1px solid #111;
  border-bottom: 1px solid #d6d6d6;
  padding: 20px 0 26px;
}

.kh-page .kh-filters h2 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 1.15rem;
}

.kh-page .kh-filter-field {
  gap: 5px;
  padding: 0;
  border-top: 0;
}

.kh-page .kh-filter-field:first-of-type {
  grid-column: span 2;
}

.kh-page .kh-filter-field input,
.kh-page .kh-filter-field select {
  padding: 8px 0;
}

.kh-page .kh-reset {
  align-self: end;
  justify-self: start;
  margin-top: 0;
  margin-bottom: 9px;
}

.kh-page .kh-results-header {
  padding-top: 0;
  border-top: 0;
}

.kh-page [data-kh-results] {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 58px) clamp(22px, 3vw, 36px);
  align-items: start;
}

.kh-page .kh-result {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border-top: 1px solid #111;
}

.kh-page .kh-result-cover {
  display: block;
  margin-top: 18px;
  aspect-ratio: 4 / 5.35;
  background: #f3f3f1;
  overflow: hidden;
  border: 1px solid #dedede;
}

.kh-page .kh-result-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.kh-page .kh-result-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding-top: 18px;
}

.kh-page .kh-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 13px;
}

.kh-page .kh-result-meta span {
  position: relative;
}

.kh-page .kh-result-meta span + span::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 50%;
  width: 2px;
  height: 2px;
  background: #888;
}

.kh-page .kh-result h3 {
  font-size: clamp(1.3rem, 1.8vw, 1.72rem);
  line-height: 1.12;
}

.kh-page .kh-result-main > p:not(.kh-result-partners) {
  display: -webkit-box;
  max-width: none;
  margin: 12px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: .92rem;
  line-height: 1.55;
}

.kh-page .kh-result-partners {
  display: -webkit-box;
  margin: 11px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.kh-page .kh-result-actions {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  padding-top: 22px;
  flex-wrap: wrap;
}

.kh-page .kh-result--article {
  min-height: 330px;
}

.kh-page .kh-result--article .kh-result-content {
  padding-top: 22px;
}

.kh-page .kh-feature--publication {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  gap: clamp(22px, 3vw, 34px);
}

.kh-page .kh-feature-cover {
  display: block;
  align-self: start;
  aspect-ratio: 4 / 5.35;
  background: #f3f3f1;
  border: 1px solid #dedede;
  overflow: hidden;
}

.kh-page .kh-feature-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.kh-page .kh-feature-content {
  min-width: 0;
}

.kh-page .kh-feature-content > p:not(.kh-feature-label):not(.kh-feature-meta) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

@media (max-width: 1100px) {
  .kh-page .kh-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kh-page [data-kh-results] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .kh-page .kh-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kh-page .kh-filter-field:first-of-type {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .kh-page .kh-filters {
    grid-template-columns: 1fr;
  }

  .kh-page .kh-filter-field:first-of-type {
    grid-column: auto;
  }

  .kh-page [data-kh-results] {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .kh-page .kh-result--article {
    min-height: 0;
  }

  .kh-page .kh-result-cover {
    max-width: 280px;
  }

  .kh-page .kh-feature--publication {
    grid-template-columns: minmax(90px, 125px) minmax(0, 1fr);
    gap: 20px;
  }
}

/* ICHA V3.2 Knowledge Hub shelf separation.
   Publications and articles remain independently scannable, newest first by default. */
.kh-page .kh-results-column {
  display: grid;
  gap: clamp(70px, 8vw, 112px);
  min-width: 0;
}

.kh-page .kh-shelf[hidden] {
  display: none;
}

.kh-page .kh-shelf-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: baseline;
  border-top: 1px solid #111;
  padding: 20px 0 24px;
}

.kh-page .kh-shelf-header h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -.04em;
}

.kh-page .kh-shelf-header span {
  color: #666;
}

.kh-page .kh-shelf-stage {
  position: relative;
  min-width: 0;
}

.kh-page .kh-shelf-track {
  --kh-shelf-gap: clamp(22px, 3vw, 36px);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (2 * var(--kh-shelf-gap))) / 3);
  gap: var(--kh-shelf-gap);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  padding: 0 0 12px;
}

.kh-page .kh-shelf-track::-webkit-scrollbar {
  display: none;
}

.kh-page .kh-shelf-track.is-empty {
  display: block;
  overflow: visible;
}

.kh-page .kh-shelf-track .kh-result {
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.kh-page .kh-shelf-empty {
  width: 100%;
}

.kh-page .kh-shelf-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  width: 46px;
  height: 46px;
  transform: translateY(-50%);
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  padding: 0;
  font: inherit;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.kh-page .kh-shelf-arrow:hover,
.kh-page .kh-shelf-arrow:focus-visible {
  background: #111;
  color: #fff;
}

.kh-page .kh-shelf-arrow:focus-visible {
  outline: 2px solid var(--ifrc-red);
  outline-offset: 3px;
}

.kh-page .kh-shelf-arrow[hidden] {
  display: none;
}

.kh-page .kh-shelf-arrow--prev {
  left: -23px;
}

.kh-page .kh-shelf-arrow--next {
  right: -23px;
}

@media (max-width: 1100px) {
  .kh-page .kh-shelf-track {
    grid-auto-columns: calc((100% - var(--kh-shelf-gap)) / 2);
  }
}

@media (max-width: 680px) {
  .kh-page .kh-results-column {
    gap: 64px;
  }

  .kh-page .kh-shelf-header {
    align-items: flex-end;
    padding-bottom: 20px;
  }

  .kh-page .kh-shelf-track {
    grid-auto-columns: minmax(0, 88%);
    gap: 18px;
  }

  .kh-page .kh-shelf-arrow {
    width: 42px;
    height: 42px;
  }

  .kh-page .kh-shelf-arrow--prev {
    left: 4px;
  }

  .kh-page .kh-shelf-arrow--next {
    right: 4px;
  }
}

/* ICHA KNOWLEDGE READER COMMENT BUTTON v1 */
.kh-reader-page .kh-comment-fields {
  align-items: start;
}

.kh-reader-page .kh-comment-fields .btn {
  display: inline-flex;
  width: auto;
  min-width: 0;
  max-width: max-content;
  height: auto;
  min-height: 44px;
  padding: 12px 18px;
  align-self: start;
  justify-self: start;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.2;
}
/* END ICHA KNOWLEDGE READER COMMENT BUTTON v1 */
