.kh-downloads-page main.wrap.section {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

.kh-downloads-page .wp-block-post-content {
  max-width: none !important;
}

.kh-downloads-page .wp-block-post-content > .kh-library {
  width: 100% !important;
  max-width: none !important;
  margin-block: 0 !important;
}

.kh-library {
  --ink: #071426;
  --navy: #081224;
  --sky: #69d7f3;
  --paper: #f3f7fb;
  --line: #dce6ef;
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Cairo, Tahoma, Arial, sans-serif;
}

.kh-library * {
  box-sizing: border-box;
}

.kh-library-shell {
  width: min(1180px, calc(100% - 64px));
  margin-inline: auto;
}

.kh-library-hero {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
  padding: 86px 0 74px;
  border-top: 1px solid #21314b;
}

.kh-library-hero::before {
  content: "";
  position: absolute;
  width: 650px;
  height: 650px;
  border-radius: 50%;
  background: radial-gradient(circle, #2a8dad55, transparent 68%);
  left: -180px;
  top: -330px;
}

.kh-library-kicker {
  position: relative;
  margin: 0 0 20px;
  color: #88e3f5;
  font: 700 12px Manrope, sans-serif;
  letter-spacing: 2.1px;
  direction: ltr;
  text-align: right;
}

.kh-library-hero h1 {
  position: relative;
  margin: 0;
  font-size: clamp(45px, 6.3vw, 83px);
  line-height: 1.4;
  letter-spacing: -2.2px;
}

.kh-library-hero h1 span {
  color: var(--sky);
}

.kh-library-lead {
  position: relative;
  max-width: 670px;
  margin: 23px 0 0;
  color: #afbed3;
  font-size: 18px;
  line-height: 2;
}

.kh-library-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 50px;
  border: 1px solid #28405f;
  border-radius: 18px;
  overflow: hidden;
  background: #28405f;
}

.kh-library-stats div {
  background: #0d1b31;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.kh-library-stats strong {
  font: 800 26px Manrope, Cairo, sans-serif;
  color: var(--sky);
}

.kh-library-stats span {
  font-size: 13px;
  color: #a9b9d0;
}

.kh-library-content {
  padding: 54px 0 100px;
}

.kh-library-tools {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  align-items: center;
  margin-bottom: 34px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 30px #18334e0c;
}

.kh-library-filters {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.kh-library-filters button {
  cursor: pointer;
  border: 1px solid #ccd9e5;
  background: #fff;
  color: #496079;
  border-radius: 999px;
  padding: 9px 17px;
  font: 600 13px Cairo, sans-serif;
  transition: 0.2s;
}

.kh-library-filters button:hover,
.kh-library-filters button.is-active {
  background: #0d2942;
  color: #fff;
  border-color: #0d2942;
}

.kh-library-search {
  width: min(330px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fbfd;
  border: 1px solid #ccd9e5;
  border-radius: 12px;
  padding: 0 15px;
}

.kh-library-search span {
  font-size: 23px;
  color: #61809b;
}

.kh-library-search input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 12px 0;
  background: transparent;
  color: #0b2036;
  font: 500 14px Cairo, sans-serif;
}

.kh-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.kh-resource-card {
  min-width: 0;
  min-height: 390px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px #18334e0c;
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
}

.kh-resource-card:hover {
  transform: translateY(-5px);
  border-color: #76cfe4;
  box-shadow: 0 18px 45px #18334e17;
}

.kh-resource-card[hidden] {
  display: none;
}

.kh-resource-kind-article {
  background: linear-gradient(145deg, #fff 0%, #fbf8ff 100%);
  border-color: #e3d7f6;
}

.kh-resource-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 26px;
}

.kh-resource-icon {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #e8f7fb;
  color: #087d9d;
  font: 800 13px Manrope, sans-serif;
  border: 1px solid #c9edf5;
}

.kh-type-xlsx,
.kh-type-xls,
.kh-type-csv {
  background: #eaf8ef;
  color: #168548;
  border-color: #c7ebd4;
}

.kh-type-pdf {
  background: #fff0f0;
  color: #c53c3c;
  border-color: #ffd3d3;
}

.kh-type-zip {
  background: #f3efff;
  color: #6e4cb8;
  border-color: #ded3fa;
}

.kh-resource-new {
  flex: 0 0 auto;
  background: #0f344d;
  color: #a4ecfa;
  border: 1px solid #2c5a72;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
}

.kh-resource-meta {
  min-height: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: #73869a;
  font: 600 10px/1.55 Manrope, Cairo, sans-serif;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.kh-resource-meta span {
  max-width: 100%;
  unicode-bidi: plaintext;
}

.kh-resource-meta span:last-child {
  direction: ltr;
  white-space: nowrap;
}

.kh-resource-card h2 {
  margin: 15px 0 9px;
  color: #0a1c30;
  font-size: 21px;
  line-height: 1.55;
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.kh-resource-card > p {
  margin: 0 0 24px;
  color: #60748a;
  font-size: 14px;
  line-height: 1.9;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.kh-resource-card > p:empty {
  display: none;
}

.kh-resource-download {
  width: 100%;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  border: 1px solid #163a59;
  border-radius: 15px;
  padding: 11px 12px 11px 20px;
  background: linear-gradient(135deg, #0d2942 0%, #123d5d 100%);
  color: #fff !important;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(8, 18, 36, 0.16);
  transform: translateX(0);
  animation: kh-cta-sway 3.8s ease-in-out infinite;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.kh-resource-download span {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sky);
  color: #071426;
  display: grid;
  place-items: center;
  font: 700 21px Arial;
  transition: transform 0.22s ease;
}

.kh-resource-download:hover {
  color: #fff !important;
  background: linear-gradient(135deg, #123d5d 0%, #0a7899 100%);
  box-shadow: 0 14px 30px rgba(8, 18, 36, 0.24);
  transform: translateY(-2px) scale(1.01);
  animation-play-state: paused;
}

.kh-resource-download:visited,
.kh-resource-download:active,
.kh-resource-download:focus {
  color: #fff !important;
}

.kh-resource-download:hover span,
.kh-resource-download:focus-visible span {
  transform: translateX(-3px);
}

.kh-resource-download:focus-visible {
  outline: 3px solid rgba(105, 215, 243, 0.55);
  outline-offset: 3px;
}

@keyframes kh-cta-sway {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

@media (prefers-reduced-motion: reduce) {
  .kh-resource-download {
    animation: none;
  }
}

.kh-library-empty {
  border: 1px dashed #a9bdcd;
  border-radius: 22px;
  background: #fff;
  text-align: center;
  padding: 70px 25px;
}

.kh-library-empty > span {
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #e1f5fa;
  color: #117796;
  font: 30px Arial;
}

.kh-library-empty h2 {
  font-size: 29px;
  margin: 0 0 10px;
}

.kh-library-empty p,
.kh-library-no-results {
  color: #61758a;
}

.kh-library-no-results {
  text-align: center;
  padding: 35px;
}

.kh-downloads-nav a {
  color: #8de5f5 !important;
}

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

  .kh-library-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .kh-library-search {
    width: 100%;
    max-width: none;
  }

  .kh-library-hero {
    padding-top: 65px;
  }
}

@media (max-width: 650px) {
  .kh-library-shell {
    width: calc(100% - 36px);
  }

  .kh-library-hero {
    padding: 48px 0 42px;
  }

  .kh-library-hero h1 {
    font-size: 44px;
    line-height: 1.5;
    letter-spacing: -1px;
  }

  .kh-library-lead {
    font-size: 15px;
  }

  .kh-library-stats {
    grid-template-columns: 1fr;
    margin-top: 34px;
  }

  .kh-library-stats div {
    padding: 15px 18px;
  }

  .kh-library-stats strong {
    font-size: 22px;
  }

  .kh-library-content {
    padding: 35px 0 75px;
  }

  .kh-library-tools {
    padding: 13px;
    border-radius: 15px;
  }

  .kh-library-grid {
    grid-template-columns: 1fr;
  }

  .kh-resource-card {
    min-height: 340px;
  }

  .kh-library-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
  }

  .kh-library-filters button {
    white-space: nowrap;
  }

  .kh-library-kicker {
    font-size: 9px;
    letter-spacing: 1.4px;
  }

  .kh-downloads-page .kh-nav {
    gap: 13px !important;
  }

  .kh-downloads-page .kh-nav p {
    font-size: 11px;
  }
}
