/* ==========================================================================
   Knowledge topics (HubDB dynamic pages): overview and one page per topic.

   Ported from the marketing kit, branch feat/kunnskapsbase at commit c0e1dd9:
   template web-18 (topic page) and the topic cards in web-16. Regular weight only, hierarchy from size and colour, 5 px
   controls and 10 px cards, spacing 4/8/16/24/32/48/64, and no tracked
   uppercase labels, left-border accents or arrows in buttons.

   Loaded after help.css, which holds the tokens, header, footer, buttons and
   breadcrumb shared by every help centre page. Every selector starts with
   .kb- so nothing reaches main.css or other templates. The block class names
   are shared with the knowledge base block catalogue, so keep them as they are.
   ========================================================================== */

.kb-tile {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-white);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kb-tile img {
  width: 32px;
  height: 32px;
}

/* ===== kb-topic-head: breadcrumb, icon, title, description, jump links ===== */
.kb-topic-head {
  padding: var(--kb-space-6) 0;
}
.kb-topic-title {
  display: flex;
  align-items: center;
  gap: var(--kb-space-4);
}
.kb-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kb-space-2);
  margin-top: var(--kb-space-5);
}
.kb-subnav a {
  display: inline-flex;
  align-items: baseline;
  gap: var(--kb-space-2);
  padding: var(--kb-space-2) var(--kb-space-3);
  border: 1px solid var(--kb-border);
  border-radius: var(--kb-radius-sm);
  background-color: var(--kb-white);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}
.kb-subnav a:hover {
  text-decoration: underline;
}
.kb-subnav span {
  color: var(--kb-indigo-70);
}

/* ===== kb-topics: the overview, one card per top-level topic ===== */
.kb-overview {
  padding-bottom: var(--kb-space-7);
}
.kb-page .kb-topics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--kb-space-4);
}
.kb-page .kb-topic {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--kb-space-3);
  padding: var(--kb-space-5);
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-white);
}
.kb-topic:focus-within {
  outline: 2px solid var(--kb-blue);
  outline-offset: 2px;
}
.kb-page .kb-topic :focus-visible {
  outline: none;
}
.kb-topic .kb-tile {
  margin-bottom: var(--kb-space-2);
  background-color: var(--kb-seashell);
}
.kb-topic h2 a {
  text-decoration: none;
}
.kb-topic h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.kb-topic:hover h2 a {
  text-decoration: underline;
}
.kb-page .kb-topic p {
  color: var(--kb-text);
}
.kb-page .kb-topic .kb-muted {
  margin-top: auto;
  color: var(--kb-indigo-70);
}

/* ===== kb-empty: the calm state before the table has rows ===== */
.kb-empty {
  max-width: 720px;
  padding: var(--kb-space-5);
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-white);
}
.kb-page .kb-empty p {
  margin: var(--kb-space-2) 0 var(--kb-space-3);
  color: var(--kb-text);
}
.kb-empty + .kb-topics {
  margin-top: var(--kb-space-5);
}
.kb-page .kb-none {
  color: var(--kb-text);
}

/* ===== kb-featured: the articles chosen for the topic, read first ===== */
.kb-featured-wrap {
  padding-bottom: var(--kb-space-7);
}
.kb-page .kb-featured-wrap h2 {
  margin-bottom: var(--kb-space-4);
}
.kb-page .kb-featured {
  counter-reset: featured;
  padding: var(--kb-space-2) var(--kb-space-5);
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-white);
}
.kb-page .kb-featured li {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  padding: var(--kb-space-4) 0;
}
.kb-page .kb-featured li + li {
  border-top: 1px solid var(--kb-border);
}
.kb-featured li::before {
  counter-increment: featured;
  content: counter(featured);
  color: var(--kb-indigo-70);
  font-size: 18px;
  line-height: 28px;
}
.kb-featured a {
  font-size: 18px;
  line-height: 28px;
  text-decoration: none;
}
.kb-featured a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.kb-featured li:hover a {
  text-decoration: underline;
}
.kb-featured li:focus-within {
  outline: 2px solid var(--kb-blue);
  outline-offset: 2px;
}
.kb-page .kb-featured :focus-visible {
  outline: none;
}
.kb-page .kb-featured p {
  margin-top: var(--kb-space-1);
  color: var(--kb-text);
}

/* ===== kb-group: every article, grouped by subtopic ===== */
.kb-groups {
  padding: var(--kb-space-7) 0;
  background-color: var(--kb-white);
}
.kb-group {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--kb-space-6);
  scroll-margin-top: var(--kb-space-4);
}
.kb-group + .kb-group {
  margin-top: var(--kb-space-7);
}
.kb-page .kb-group-head p {
  margin-top: var(--kb-space-2);
  color: var(--kb-text);
}
.kb-page .kb-group-head .kb-small {
  margin-top: var(--kb-space-3);
  color: var(--kb-indigo-70);
}
.kb-page .kb-articles li {
  position: relative;
  padding: var(--kb-space-3) 0;
  border-top: 1px solid var(--kb-border);
}
.kb-page .kb-articles li:last-child {
  border-bottom: 1px solid var(--kb-border);
}
.kb-articles a {
  text-decoration: none;
}
.kb-articles a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.kb-articles li:hover a {
  text-decoration: underline;
}
.kb-articles li:focus-within {
  outline: 2px solid var(--kb-blue);
  outline-offset: 2px;
}
.kb-page .kb-articles :focus-visible {
  outline: none;
}
.kb-page .kb-articles p {
  margin-top: var(--kb-space-1);
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-text);
}
.kb-page .kb-articles li[hidden],
.kb-group[hidden] {
  display: none;
}

/* ===== kb-filter and kb-badge: products are an article attribute ===== */
.kb-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kb-space-2);
  margin-bottom: var(--kb-space-6);
  font-size: 14px;
  line-height: 20px;
}
.kb-filter[hidden] {
  display: none;
}
.kb-filter .kb-muted {
  margin-right: var(--kb-space-2);
}
.kb-filter button {
  padding: var(--kb-space-1) var(--kb-space-3);
  border: 1px solid var(--kb-border);
  border-radius: var(--kb-radius-sm);
  background-color: var(--kb-white);
  color: var(--kb-indigo);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  cursor: pointer;
}
.kb-filter button:hover {
  text-decoration: underline;
}
.kb-filter button[aria-pressed='true'] {
  border-color: var(--kb-indigo);
  background-color: var(--kb-indigo);
  color: var(--kb-seashell);
}
.kb-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--kb-space-1) var(--kb-space-3);
}
.kb-badge {
  display: inline-block;
  padding: 0 var(--kb-space-2);
  border-radius: var(--kb-radius-sm);
  background-color: var(--kb-seashell);
  color: var(--kb-indigo-70);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
.kb-featured .kb-badge {
  position: relative;
  top: -2px;
}

/* ===== kb-contact, small layout: one line and two ways ===== */
.kb-contact-small {
  padding: var(--kb-space-7) 0;
}
.kb-contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--kb-space-4) var(--kb-space-6);
  padding: var(--kb-space-5);
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-white);
}
.kb-page .kb-contact-row p {
  margin-top: var(--kb-space-1);
  color: var(--kb-text);
}
.kb-contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kb-space-3) var(--kb-space-4);
}

@media (max-width: 1100px) {
  .kb-page .kb-topics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kb-group {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--kb-space-4);
  }
}

@media (max-width: 640px) {
  .kb-topic-head {
    padding: var(--kb-space-5) 0;
  }
  .kb-breadcrumb ol {
    margin-bottom: var(--kb-space-4);
  }
  .kb-topic-title {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--kb-space-3);
  }
  .kb-page .kb-topics {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Icon beside the text on phones, as on the front page. */
  .kb-page .kb-topic {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: var(--kb-space-1) var(--kb-space-3);
    padding: var(--kb-space-4);
  }
  .kb-topic .kb-tile {
    grid-row: span 2;
    margin-bottom: 0;
  }
  .kb-topic .kb-tile ~ * {
    grid-column: 2;
  }
  .kb-page .kb-featured {
    padding: var(--kb-space-1) var(--kb-space-4);
  }
  .kb-page .kb-featured li {
    grid-template-columns: 32px minmax(0, 1fr);
    padding: var(--kb-space-3) 0;
  }
  .kb-featured a,
  .kb-featured li::before {
    font-size: 16px;
    line-height: 26px;
  }
  .kb-featured-wrap {
    padding-bottom: var(--kb-space-6);
  }
  .kb-groups,
  .kb-contact-small {
    padding: var(--kb-space-6) 0;
  }
  .kb-group + .kb-group {
    margin-top: var(--kb-space-6);
  }
  .kb-contact-row {
    padding: var(--kb-space-4);
  }
}
