/* ============================================================
   Knowledge Hub — Main Page
   Uses variables from variables.css
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

.kh-body {
  margin: 0;
  padding: 0;
  background-color: #f0eef8;
  font-family: 'Poppins', sans-serif;
  color: var(--Core-Base-Black);
  -webkit-font-smoothing: antialiased;
}

/* ---- Container ---- */
.kh-container {
  max-width: clamp(760px, 72vw, 1200px);
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 1000px) {
  .kh-container { max-width: 100%; }
}

/* ============================================================
   HERO
   ============================================================ */
.kh-hero {
  background: linear-gradient(0deg, #4a1fa8 0%, #6a28d4 50%, #7b2ff7 100%);
  padding: 64px 0 0;
}

.kh-hero__content {
  text-align: center;
  padding-bottom: 48px;
}

.kh-hero__title {
  font-size: clamp(28px, 3.5vw, 48px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  margin: 0 0 16px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.kh-hero__desc {
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  margin: 0 auto 32px;
  max-width: 560px;
}
p.kh-hero__desc{
  max-width: 100%;
}

/* Search */
.kh-hero__search {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}
@media(min-width: 1000px){
  .kh-hero__search { width: 75%; }
}

/* Algolia search box container */
#kh-search-box { width: 100%; }

.kh-hero__search .ais-search-box,
.kh-hero__search .ais-search-box__container { width: 100%; }

.kh-hero__search .ais-search-box--input {
  width: 100%;
  height: 52px;
  padding: 0 20px 0 50px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 300;
  outline: none;
  transition: background 0.2s;
  box-sizing: border-box;
}

.kh-hero__search .ais-search-box--input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
}

.kh-hero__search .ais-search-box--input:focus {
  background: rgba(255, 255, 255, 0.18);
}

/* Hide Algolia magnifier, show our own */
.kh-hero__search .ais-search-box--magnifier-wrapper { display: none; }

/* Search icon overlay */
.kh-hero__search::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.16667 14.3333C11.5704 14.3333 14.3333 11.5704 14.3333 8.16667C14.3333 4.76295 11.5704 2 8.16667 2C4.76295 2 2 4.76295 2 8.16667C2 11.5704 4.76295 14.3333 8.16667 14.3333Z' stroke='%23455468' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M16 16L12.8333 12.8334' stroke='%23455468' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}

/* Search results dropdown */
#kh-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(20, 10, 50, 0.22);
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}
#kh-search-results[hidden] { display: none; }
#kh-search-results .ais-hits--empty { padding: 0; }

.kh-search-noresult {
  padding: 16px 20px;
  font-size: 13px;
  color: #8b82a7;
  margin: 0;
}

.kh-search-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 20px;
  text-decoration: none;
  border-bottom: 1px solid #f0eef8;
  transition: background 0.15s;
  text-align: left;
}
.kh-search-hit:last-child { border-bottom: none; }
.kh-search-hit:hover { background: #f6f4fc; }

.kh-search-hit__title {
  font-size: 13px;
  font-weight: 500;
  color: #1a0b45;
  line-height: 1.4;
}
.kh-search-hit__title em { font-style: normal; font-weight: 700; color: var(--Core-Violet); }

.kh-search-hit__cat {
  font-size: 11px;
  font-weight: 500;
  color: #8b82a7;
  white-space: nowrap;
  flex-shrink: 0;
}

.kh-search-hit__excerpt {
  display: block;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
  margin-top: 4px;
}

/* Quick Access Bar */
.kh-quick-access {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 0;
}

.kh-quick-access__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kh-quick-access__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #fff;
  text-transform: uppercase;
}

.kh-quick-access__all {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-decoration: underline;
  transition: opacity 0.2s;
}

.kh-quick-access__all:hover {
  opacity: 0.75;
}

.kh-quick-access__items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kh-quick-access__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.kh-quick-access__item:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
}

.kh-quick-access__item-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 8px;
}

.kh-quick-access__item-label {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.kh-main {
  padding: 40px 0 60px;
}

/* ---- Shared card base ---- */
.kh-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 20px;
}

/* ---- Icon placeholder ---- */
.kh-icon-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--Core-Soft-Lavender);
  border-radius: 10px;
  flex-shrink: 0;
}

.kh-icon-placeholder { width: 28px; height: 28px; }
.kh-icon-placeholder--lg { width: 36px; height: 36px; border-radius: 12px; }
.kh-icon-placeholder--sm { width: 22px; height: 22px; border-radius: 8px; }

/* ---- Badges ---- */
.kh-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.kh-badge--orange {
  background: var(--Core-Vivid-Orange);
  color: #fff;
}

.kh-badge--amber {
  background: #F9EAD7;
  color: #997037;
  margin-bottom: 0px;
}

.kh-badge--green {
  background: #2D7A5E;
  color: #fff;
}

.kh-badge--purple {
  background: var(--Core-Soft-Lavender);
  color: var(--Core-Violet);
  margin-bottom: 0px;
}

/* ---- Links ---- */
.kh-link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.kh-link:hover { opacity: 0.7; }
.kh-link--orange { color: var(--Core-Vivid-Orange); }
.kh-link--purple { color: var(--Core-Violet); }
.kh-link--green  { color: #2D7A5E; }

/* ============================================================
   FEATURED SECTION — Performance & Recharge
   ============================================================ */
.kh-card--featured {
  background: #fdf8f2;
  border: 1px solid #f0e8dc;
}

.kh-card--green {
  background: #f0faf6;
  border: 1px solid #b8ddd1;
}

.kh-featured__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.kh-featured__title-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.kh-featured__icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 0;
}

.kh-featured__title {
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 700;
  color: var(--Core-Base-Black);
  margin: 0 0 8px;
}

.kh-featured__desc {
  font-size: 14px;
  color: var(--Core-Blue-Gray);
  line-height: 1.6;
  margin: 0;
  max-width: 580px;
}

.kh-featured__sub-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.kh-sub-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border: 1px solid #ece8f5;
  border-radius: 12px;
  text-decoration: none;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.kh-sub-card:hover {
  box-shadow: 0 4px 16px rgba(127, 0, 255, 0.08);
  border-color: var(--Core-Lavender);
}

.kh-sub-card__icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
}

.kh-sub-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--Core-Base-Black);
  margin: 0 0 6px;
}

.kh-sub-card__desc {
  font-size: 13px;
  color: var(--Core-Blue-Gray);
  line-height: 1.5;
  margin: 0;
}

/* ============================================================
   COMMUNITY — The Industry Pulse
   ============================================================ */
.kh-card--community {
  border-left: 4px solid #997037;
}
.kh-community__inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.kh-community__icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 0;
}

.kh-community__body {
  flex: 1;
}

.kh-community__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.kh-community__title {
  font-size: clamp(16px, 1.5vw, 20px);
  font-weight: 700;
  color: var(--Core-Base-Black);
  margin: 0;
}

.kh-community__desc {
  font-size: 14px;
  color: var(--Core-Blue-Gray);
  line-height: 1.5;
  margin: 0;
}

.kh-community__link {
  flex-shrink: 0;
}

/* ============================================================
   TWO-COLUMN — Glossary + HR Toolkit
   ============================================================ */
.kh-two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e4f2;
  overflow: hidden;
}

.kh-two-col__card {
  padding: 32px;
  margin-bottom: 0;
  background: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.kh-two-col {
  position: relative;
}

.kh-two-col::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 32px;
  bottom: 32px;
  width: 1px;
  background: #e8e4f2;
  pointer-events: none;
}

.kh-two-col__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kh-two-col__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kh-two-col__icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 8px;
}

.kh-two-col__title {
  font-size: clamp(16px, 1.4vw, 19px);
  font-weight: 700;
  color: var(--Core-Base-Black);
  margin: 0;
}

.kh-two-col__desc {
  font-size: 13px;
  color: var(--Core-Blue-Gray);
  line-height: 1.6;
  margin: 0;
}

/* HR Toolkit tools */
.kh-toolkit__tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.kh-toolkit__tool {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--Core-Soft-Surface);
  border: 1px solid var(--Core-Bright-Gray);
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.kh-toolkit__tool:hover {
  background: var(--Core-Soft-Lavender);
  border-color: var(--Core-Lavender);
}

.kh-toolkit__tool-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.kh-toolkit__tool-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--Core-Base-Black);
  line-height: 1.3;
}

/* ============================================================
   ESSENTIALS
   ============================================================ */
.kh-card--essentials {
  border-left: 4px solid var(--Core-Violet);
}

.kh-essentials__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.kh-essentials__title-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.kh-essentials__icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 0;
}

.kh-essentials__title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.kh-essentials__title {
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 700;
  color: var(--Core-Base-Black);
  margin: 0;
}

.kh-essentials__desc {
  font-size: 14px;
  color: var(--Core-Blue-Gray);
  line-height: 1.6;
  margin: 0;
}

.kh-essentials__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kh-essentials__cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 20px 16px;
  background: var(--Core-Soft-Surface);
  border: 1px solid var(--Core-Bright-Gray);
  border-radius: 12px;
  text-decoration: none;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.kh-essentials__cat:hover {
  box-shadow: 0 4px 16px rgba(127, 0, 255, 0.08);
  border-color: var(--Core-Lavender);
}

.kh-essentials__cat-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 12px;
}

.kh-essentials__cat-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--Core-Base-Black);
  line-height: 1.3;
}

.kh-essentials__cat-count {
  font-size: 12px;
  color: var(--Core-Blue-Gray);
  font-weight: 400;
}

/* ============================================================
   CTA
   ============================================================ */
.kh-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--Core-Dark-Violet);
  border-radius: 16px;
  padding: 36px 40px;
  margin-top: 24px;
}

.kh-cta__title {
  font-size: clamp(16px, 1.5vw, 20px);
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.kh-cta__desc {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  line-height: 1.5;
}

.kh-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  background: var(--Core-Violet);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.kh-cta__btn:hover {
  opacity: 0.9;
  box-shadow: 0 6px 20px var(--btn-purple-hover-shadow);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 960px) {
  .kh-container {
    padding: 0 24px;
  }

  .kh-hero {
    padding-top: 48px;
  }

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

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

  .kh-two-col::after {
    left: 32px;
    right: 32px;
    top: 50%;
    bottom: auto;
    width: auto;
    height: 1px;
  }

  .kh-essentials__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kh-featured__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kh-essentials__header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .kh-container {
    padding: 0 16px;
  }

  .kh-hero {
    padding-top: 36px;
  }

  .kh-hero__content {
    padding-bottom: 32px;
  }

  .kh-card {
    padding: 20px;
    border-radius: 12px;
  }

  .kh-featured__title-row {
    flex-direction: column;
  }

  .kh-community__inner {
    flex-wrap: wrap;
  }

  .kh-community__link {
    width: 100%;
    text-align: right;
  }

  .kh-essentials__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .kh-cta {
    flex-direction: column;
    text-align: center;
    padding: 28px 24px;
  }

  .kh-cta__btn {
    width: 100%;
  }

  .kh-quick-access__items {
    grid-template-columns: repeat(2, 1fr);
  }

  .kh-quick-access__bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

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

  .kh-toolkit__tool {
    width: 100%;
  }
}

/* Very small */
@media (max-width: 380px) {
  .kh-essentials__grid {
    grid-template-columns: 1fr 1fr;
  }
}
