/* ==========================================================================
   Forex Knowledge Centre — filters + expandable cards
   No animation yet; only colour/shadow transitions for hover and focus.
   ========================================================================== */

.kc {
  padding-block: clamp(56px, 7vw, 96px);
  background: var(--c-bg-soft);
  scroll-margin-top: var(--header-h);
}

.kc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}

.kc-title {
  margin: 0;
  color: var(--c-ink);
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.kc-title .accent {
  margin-left: -0.04em;
  color: var(--c-red);
}

.kc-lede {
  max-width: 34em;
  margin: 12px 0 0;
  color: var(--c-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.kc-all {
  flex: none;
}

/* Filters ------------------------------------------------------------------ */

.kc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: clamp(24px, 3vw, 36px) 0 20px;
}

.kc-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 16px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: #fff;
  color: var(--c-ink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.kc-filter:hover {
  border-color: #c9ccd2;
}

.kc-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-bg-soft);
  color: var(--c-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.kc-filter[aria-pressed="true"] {
  border-color: var(--c-ink);
  background: var(--c-ink);
  color: #fff;
}

.kc-filter[aria-pressed="true"] .kc-count {
  background: var(--c-red);
  color: #fff;
}

/* Grid --------------------------------------------------------------------- */

.kc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 18px);
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kc-item[hidden] {
  display: none;
}

/* Card ----------------------------------------------------------------------- */

.kc-card {
  display: block;
  border: 1px solid var(--c-line);
  border-radius: 20px;
  background: #fff;
  color: var(--c-ink);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kc-card:hover,
.kc-card[open],
.kc-card:focus-within {
  border-color: rgba(20, 20, 20, 0.22);
  box-shadow: 0 16px 36px -26px rgba(20, 20, 20, 0.4);
}

.kc-summary,
.kc-card--link {
  display: flex;
  flex-direction: column;
  min-height: 188px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  border-radius: 20px;
}

.kc-summary::-webkit-details-marker {
  display: none;
}

.kc-summary:focus-visible,
.kc-card--link:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
}

.kc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kc-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kc-cat .icon {
  color: var(--c-red);
}

.kc-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.kc-badge--muted { background: var(--c-bg-soft); color: var(--c-muted); }
.kc-badge--draft { background: #fff7e6; color: #8a5a00; }
.kc-badge--review { background: var(--c-red-50); color: var(--c-red-700); }
.kc-badge--source { background: #eef3ff; color: #1f3f8a; }

.kc-name {
  display: block;
  margin-top: 14px;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.kc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
}

.kc-format {
  color: var(--c-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.kc-card:hover .kc-format,
.kc-card:focus-within .kc-format {
  color: var(--c-red);
}

/* plus / minus toggle */
.kc-toggle {
  position: relative;
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-bg-soft);
}

.kc-toggle::before,
.kc-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--c-ink);
  translate: -50% -50%;
}

.kc-toggle::after {
  rotate: 90deg;
}

.kc-card[open] .kc-toggle {
  background: var(--c-ink);
}

.kc-card[open] .kc-toggle::before {
  background: #fff;
}

.kc-card[open] .kc-toggle::after {
  display: none;
}

.kc-go {
  width: 1.1em;
  height: 1.1em;
}

/* Expanded body ---------------------------------------------------------------- */

.kc-body {
  padding: 0 20px 20px;
}

.kc-body > * + * {
  margin-top: 14px;
}

.kc-text {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--c-line);
  color: var(--c-ink);
  font-size: 0.92rem;
  line-height: 1.55;
}

.kc-answer {
  padding-top: 14px;
  border-top: 1px solid var(--c-line);
}

.kc-answer .kc-text {
  padding-top: 0;
  border-top: 0;
}

.kc-answer .kc-text + .kc-text,
.kc-answer .kc-text + .kc-list {
  margin-top: 10px;
}

.kc-list {
  margin: 0;
  padding-left: 1.25em;
  color: var(--c-ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

.kc-list li + li {
  margin-top: 6px;
}

.kc-origin {
  margin: 0;
  color: var(--c-muted);
  font-size: 0.78rem;
  font-style: italic;
}

.kc-note {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--c-bg-soft);
  color: var(--c-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.kc-note .icon {
  margin-top: 2px;
}

.kc-sources-label {
  margin: 0 0 6px;
  color: var(--c-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kc-sources ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kc-sources a {
  color: var(--c-ink);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-color: var(--c-red);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.kc-sources a .icon {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-left: 5px;
  vertical-align: -0.12em;
  color: var(--c-muted);
}

.kc-enquire {
  width: 100%;
}

.kc-noscript {
  color: var(--c-muted);
}

/* Responsive ------------------------------------------------------------------ */

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

@media (max-width: 639.98px) {
  .kc-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .kc-summary,
  .kc-card--link {
    min-height: 0;
    padding: 16px 18px;
  }

  .kc-name {
    margin-top: 10px;
  }

  .kc-foot {
    padding-top: 10px;
  }

  .kc-body {
    padding: 0 18px 18px;
  }

  .kc-all {
    order: 2;
  }
}
