/* ==========================================================================
   Help centre front page.

   Ported from the marketing kit, branch feat/kunnskapsbase at commit c0e1dd9:
   template web-16 version 0.3. Loaded after help.css (tokens, header, footer,
   buttons, product cards) and topic-page.css (tiles, topic cards, the empty
   state), so this file only has what the front page adds. Same rules: regular
   weight only, no tracked uppercase labels, left-border accents or arrows in
   buttons, and every selector starts with .kb-.

   Colour: the nav, the hero and the footer are indigo. Blue is the 404's
   search button, the status dot off the band and text links, never next to
   indigo. Pink only on indigo.

   The 404 (templates/system/help-404) uses the hero and the search from this
   file too, with a visible Søk button (help-search, view "page").
   ========================================================================== */

.kb-front [hidden] {
  display: none;
}

/* The same title size as the user guides' band (help.css, kb-product-head). */
.kb-page .kb-display {
  max-width: 760px;
  font-size: 40px;
  line-height: 50px;
  text-wrap: balance;
}

/* The 404's Søk button (help-search, view "page"); the front page's own is for screen readers only. */
.kb-page .kb-button--primary {
  background-color: var(--kb-blue);
  color: var(--kb-white);
}

/* ===== kb-hero: joined to the indigo nav, the same short band as the user guides =====
   Title, one line, the search, the examples. No illustration: the topic cards
   start on the band below and carry the page's weight. */
.kb-hero {
  position: relative;
  padding: var(--kb-space-5) 0 var(--kb-space-5);
  background-color: var(--kb-indigo);
  color: var(--kb-seashell);
}
.kb-hero .kb-container {
  position: relative;
}
.kb-hero :focus-visible {
  outline-color: var(--kb-seashell);
}
.kb-page .kb-hero__lead {
  max-width: 640px;
  margin: var(--kb-space-2) 0 var(--kb-space-4);
  color: var(--kb-on-dark-muted);
}

/* ===== kb-search ===== */
.kb-search {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-white);
  color: var(--kb-indigo);
  text-align: left;
}
.kb-search:focus-within {
  outline: 2px solid var(--kb-pink);
  outline-offset: 2px;
}
.kb-search.is-open {
  border-radius: var(--kb-radius-md) var(--kb-radius-md) 0 0;
}
/* 56 px high like the guides' field, icon and "/" at the same places. */
.kb-search__field {
  display: flex;
  align-items: center;
  gap: var(--kb-space-3);
  min-height: 56px;
  padding: var(--kb-space-2) var(--kb-space-3);
}
.kb-search__icon {
  flex: none;
  color: var(--kb-indigo);
}
.kb-search__key {
  flex: none;
  padding: 0 var(--kb-space-2);
  border: 1px solid var(--kb-border);
  border-radius: var(--kb-radius-sm);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-indigo-70);
}
.kb-page .kb-search__field input {
  flex: 1;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 26px;
  color: var(--kb-indigo);
}
.kb-page .kb-search__field input::placeholder {
  color: var(--kb-indigo-70);
  opacity: 1;
}
.kb-page .kb-search__field input:focus {
  outline: none;
}
.kb-search__field input::-webkit-search-cancel-button {
  display: none;
}
/* The suggestion list opens over the content below, so the page does not jump. */
.kb-search__results {
  position: absolute;
  z-index: 5;
  left: -1px;
  right: -1px;
  top: calc(100% - var(--kb-radius-md));
  padding-top: var(--kb-space-2);
  border: 1px solid var(--kb-border);
  border-top: 0;
  border-radius: 0 0 var(--kb-radius-md) var(--kb-radius-md);
  background-color: var(--kb-white);
  box-shadow: 0 16px 32px rgba(69, 9, 90, 0.12);
}
.kb-search__inner {
  border-top: 1px solid var(--kb-border);
}
.kb-page .kb-search__group {
  padding: var(--kb-space-3) var(--kb-space-4) 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-indigo-70);
}
.kb-page .kb-search__results ul {
  padding: var(--kb-space-1) var(--kb-space-2) var(--kb-space-2);
}
.kb-search__results li a {
  display: block;
  padding: var(--kb-space-2) var(--kb-space-3);
  border-radius: var(--kb-radius-sm);
  text-decoration: none;
}
.kb-search__results li a:hover,
.kb-search__results li a[aria-selected='true'] {
  background-color: var(--kb-seashell);
}
.kb-search__title {
  display: block;
}
.kb-search__title mark {
  border-radius: 2px;
  background-color: #dbd3d1;
  color: inherit;
}
.kb-search__path {
  display: block;
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-indigo-70);
}
.kb-page .kb-search__empty {
  padding: var(--kb-space-4);
  color: var(--kb-text);
}
.kb-search__foot {
  padding: var(--kb-space-3) var(--kb-space-4);
  border-top: 1px solid var(--kb-border);
  font-size: 14px;
  line-height: 20px;
}

/* Plain links on one muted line, like the meta line under the guides' search. */
.kb-search-try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kb-space-2) var(--kb-space-4);
  margin-top: var(--kb-space-4);
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-on-dark-muted);
}
.kb-page .kb-search-try ul {
  display: contents;
}
.kb-search-try a {
  color: var(--kb-seashell);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.kb-search-try a:hover {
  text-decoration-thickness: 2px;
}

/* ===== Sections ===== */
.kb-section {
  padding: var(--kb-space-7) 0;
}
.kb-section--white {
  background-color: var(--kb-white);
}
.kb-section-head {
  margin-bottom: var(--kb-space-5);
}
.kb-page .kb-section-head p {
  margin-top: var(--kb-space-1);
}
.kb-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--kb-space-3) var(--kb-space-5);
}

/* ===== kb-section--seam: the topic cards start on the indigo band =====
   The head row sits on indigo and the band ends halfway down the first row of
   cards, as on the user guides' draft (r4), so the band and the cards read as
   one thing instead of a hero above a list. */
/* Two classes: the phone rule for .kb-section further down must not put the top padding back. */
.kb-section.kb-section--seam {
  padding-top: 0;
  overflow-x: clip;
}
/* The head row is indigo edge to edge, however many lines the status takes. */
.kb-section--seam .kb-section-head {
  margin-bottom: 0;
  padding: var(--kb-space-2) 0 var(--kb-space-4);
  background-color: var(--kb-indigo);
  box-shadow: 0 0 0 100vmax var(--kb-indigo);
  clip-path: inset(0 -100vmax);
}
/* The band's last 64 px, behind the top of the first row of cards. */
.kb-section--seam .kb-topics {
  position: relative;
  isolation: isolate;
}
.kb-section--seam .kb-topics::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  left: -100vmax;
  right: -100vmax;
  height: 64px;
  background-color: var(--kb-indigo);
}
.kb-page .kb-section--seam .kb-section-head h2 {
  font-size: 16px;
  line-height: 20px;
  color: var(--kb-pink);
}
.kb-section--seam .kb-section-head :focus-visible {
  outline-color: var(--kb-pink);
}
.kb-page .kb-section--seam .kb-status {
  color: var(--kb-on-dark-muted);
}
.kb-section--seam .kb-status .kb-textlink {
  color: var(--kb-seashell);
}
.kb-section--seam .kb-status__dot {
  background-color: var(--kb-seashell);
}
.kb-section--seam .kb-status[data-indicator='minor'] .kb-status__dot,
.kb-section--seam .kb-status[data-indicator='major'] .kb-status__dot,
.kb-section--seam .kb-status[data-indicator='maintenance'] .kb-status__dot {
  background-color: var(--kb-pink);
}

/* The card's top edge is on indigo and the rest on seashell: a pink ring
   inside an indigo one shows on both, where the topic pages' blue ring would
   sit next to indigo. */
.kb-section--seam .kb-topic:focus-within {
  outline: 3px solid var(--kb-pink);
  outline-offset: 0;
  box-shadow: 0 0 0 5px var(--kb-indigo);
}

/* ===== kb-status: told in words, the dot only repeats it ===== */
.kb-page .kb-status {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kb-space-2) var(--kb-space-3);
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-text);
}
.kb-status__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--kb-blue);
}
.kb-status[data-indicator='minor'] .kb-status__dot,
.kb-status[data-indicator='major'] .kb-status__dot,
.kb-status[data-indicator='maintenance'] .kb-status__dot {
  background-color: var(--kb-indigo);
}
.kb-status__text:empty {
  display: none;
}

/* ===== kb-topics on the front page: titles are h3 under the section head =====
   Icon beside the text (r4), so a card is one line of title under a short
   text and the six read as a grid of tasks, not as six tall boxes. */
@media (min-width: 641px) {
  .kb-front .kb-topic {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-content: start;
    gap: var(--kb-space-1) var(--kb-space-4);
    padding: var(--kb-space-4);
  }
  .kb-front .kb-topic .kb-tile {
    grid-row: span 2;
    margin-bottom: 0;
  }
  .kb-front .kb-topic > :not(.kb-tile) {
    grid-column: 2;
  }
}
.kb-topic h3 a {
  text-decoration: none;
}
.kb-topic h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.kb-topic:hover h3 a {
  text-decoration: underline;
}
.kb-page .kb-all-topics {
  margin-top: var(--kb-space-4);
}

/* ===== kb-popular: the first article as one big card, the rest numbered ===== */
.kb-page .kb-popular {
  display: grid;
  grid-template-columns: minmax(0, 5fr) repeat(2, minmax(0, 3.5fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: var(--kb-space-4);
}
.kb-page .kb-popular li {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--kb-space-4);
  padding: var(--kb-space-4);
  border-radius: var(--kb-radius-md);
  background-color: var(--kb-seashell);
}
.kb-popular li:focus-within {
  outline: 2px solid var(--kb-blue);
  outline-offset: 2px;
}
.kb-page .kb-popular :focus-visible {
  outline: none;
}
.kb-popular__no {
  font-size: 36px;
  line-height: 46px;
  color: var(--kb-indigo-70);
}
.kb-popular a {
  text-decoration: none;
}
.kb-popular a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.kb-popular li:hover a {
  text-decoration: underline;
}
.kb-popular__meta {
  display: block;
  margin-top: var(--kb-space-1);
  font-size: 14px;
  line-height: 20px;
  color: var(--kb-indigo-70);
}
/* Five small cards fill two columns; the last spans both when the count is even. */
.kb-page .kb-popular li:last-child:nth-child(even) {
  grid-column: span 2;
}
.kb-page .kb-popular .kb-popular__lead {
  grid-column: 1;
  grid-row: 1 / span 3;
  justify-content: flex-start;
  gap: var(--kb-space-5);
  padding: var(--kb-space-6) var(--kb-space-5);
  overflow: hidden;
}
.kb-page .kb-popular .kb-popular__lead:only-child {
  grid-column: 1 / -1;
  grid-row: auto;
}
.kb-page .kb-popular__lead img {
  position: absolute;
  right: var(--kb-space-4);
  bottom: var(--kb-space-3);
  width: 300px;
  height: auto;
  pointer-events: none;
}
.kb-popular__lead .kb-popular__no {
  font-size: 66px;
  line-height: 76px;
}
.kb-popular__lead .kb-popular__title {
  display: block;
  max-width: 360px;
  font-size: 34px;
  line-height: 44px;
}
.kb-popular__lead .kb-popular__meta {
  margin-top: var(--kb-space-3);
}

/* ===== kb-integrations: the ERP systems, each a search, under the product cards ===== */
.kb-page .kb-integrations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kb-space-2);
  margin-top: var(--kb-space-5);
  font-size: 14px;
  line-height: 20px;
}
.kb-integrations li:first-child {
  margin-right: var(--kb-space-2);
  color: var(--kb-indigo-70);
}
.kb-integrations a {
  display: block;
  padding: var(--kb-space-1) var(--kb-space-3);
  border: 1px solid var(--kb-border);
  border-radius: var(--kb-radius-sm);
  background: var(--kb-white);
  text-decoration: none;
}
.kb-integrations a:hover {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .kb-page .kb-popular {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Equal rows would stretch every small card to the lead card's height. */
  .kb-page .kb-popular {
    grid-auto-rows: auto;
  }
  .kb-page .kb-popular .kb-popular__lead {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}
@media (max-width: 640px) {
  /* The user guides' band title on phones (help.css, kb-product-head). */
  .kb-page .kb-display {
    font-size: 32px;
    line-height: 42px;
  }
  .kb-search__field .kb-button {
    padding: var(--kb-space-2) var(--kb-space-3);
  }
  .kb-page .kb-search__group {
    padding: var(--kb-space-3) var(--kb-space-3) 0;
  }
  .kb-search__foot {
    padding: var(--kb-space-3);
  }
  /* No keyboard to press it on. */
  .kb-search__key {
    display: none;
  }
  .kb-section {
    padding: var(--kb-space-6) 0;
  }
  .kb-page .kb-popular {
    grid-template-columns: minmax(0, 1fr);
  }
  .kb-page .kb-popular {
    gap: var(--kb-space-3);
  }
  .kb-page .kb-popular li:last-child:nth-child(even) {
    grid-column: auto;
  }
  .kb-page .kb-popular li {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--kb-space-3);
    padding: var(--kb-space-3) var(--kb-space-4);
  }
  .kb-popular__no {
    flex: none;
    width: 32px;
    font-size: 28px;
    line-height: 34px;
  }
  .kb-page .kb-popular .kb-popular__lead {
    flex-direction: column;
    padding: var(--kb-space-4);
  }
  .kb-page .kb-popular__lead img {
    position: static;
    align-self: flex-end;
    width: 140px;
    margin-top: calc(-1 * var(--kb-space-3));
  }
  .kb-popular__lead .kb-popular__no {
    font-size: 40px;
    line-height: 50px;
  }
  .kb-popular__lead .kb-popular__title {
    font-size: 24px;
    line-height: 34px;
  }
}
