/* Knowledge site (KB Platform K10). Brand values from the hub's design tokens
   (packages/shared-ui/src/styles/pma/_tokens.scss): orange #fb5110, text
   #131318, secondary #717173, Poppins. */
:root {
  --kb-orange: #fb5110;
  --kb-orange-dark: #c9410d;
  --kb-orange-tint: #feece5;
  --kb-text: #131318;
  --kb-text-secondary: #717173;
  --kb-border: #dfdfe0;
  --kb-surface: #ffffff;
  --kb-surface-alt: #f6f6f6;
  --kb-link: #0066ff;
  --kb-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Pagefind Component UI theme */
  --pf-font: var(--kb-font);
  --pf-text: var(--kb-text);
  --pf-text-secondary: var(--kb-text-secondary);
  --pf-background: var(--kb-surface);
  --pf-border: var(--kb-border);
  --pf-border-focus: var(--kb-orange);
  --pf-outline-focus: var(--kb-orange);
  /* --pf-mark is the TEXT colour of matched words (light-theme default #1a1a1a), not a background. */
  --pf-mark: var(--kb-orange-dark);
  --pf-border-radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--kb-font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--kb-text);
  background: var(--kb-surface);
}

a {
  color: var(--kb-link);
}

a:hover {
  text-decoration: underline;
}

.kb-skip {
  position: absolute;
  left: -9999px;
}

.kb-skip:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  background: var(--kb-surface);
  padding: 8px 12px;
}

/* Header */
.kb-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--kb-surface);
  border-bottom: 1px solid var(--kb-border);
}

.kb-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.kb-logo img {
  display: block;
  height: 26px;
  width: auto;
}

.kb-home {
  color: var(--kb-text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.kb-search {
  flex: 1;
  max-width: 560px;
  position: relative;
}

.kb-signin {
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--kb-orange);
  color: #ffffff;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.kb-signin:hover {
  background: var(--kb-orange-dark);
  text-decoration: none;
}

/* Layout */
.kb-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 40px;
}

/* Sidebar */
.kb-nav {
  font-size: 14px;
}

.kb-nav-toggle > summary {
  display: none;
}

.kb-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kb-nav ul ul {
  padding-left: 14px;
  border-left: 1px solid var(--kb-border);
  margin-left: 6px;
}

.kb-nav li {
  margin: 2px 0;
}

.kb-nav a {
  display: inline-block;
  padding: 2px 0;
  color: var(--kb-text);
  text-decoration: none;
}

.kb-nav a:hover {
  color: var(--kb-orange);
}

.kb-nav a[aria-current='page'] {
  color: var(--kb-orange);
  font-weight: 600;
}

.kb-nav-tree details > summary {
  cursor: pointer;
  list-style-position: outside;
}

/* Article */
.kb-main {
  min-width: 0;
}

.kb-breadcrumbs ol {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--kb-text-secondary);
}

.kb-breadcrumbs li + li::before {
  content: '/';
  margin-right: 6px;
}

.kb-breadcrumbs a {
  color: var(--kb-text-secondary);
}

/* Many articles show bare URLs as link text. Without a break opportunity they
   push the page wider than a phone screen, so links may break anywhere. */
.kb-article,
.kb-section-list {
  max-width: 780px;
  overflow-wrap: break-word;
}

.kb-article a,
.kb-section-list a {
  overflow-wrap: anywhere;
}

.kb-article h1 {
  font-size: 30px;
  line-height: 1.25;
  margin: 0 0 20px;
}

.kb-article .kb-updated {
  margin: -12px 0 20px;
  font-size: 13px;
  color: var(--kb-text-secondary);
}

.kb-article h2 {
  font-size: 21px;
  margin: 32px 0 10px;
}

.kb-article h3 {
  font-size: 17px;
  margin: 24px 0 8px;
}

.kb-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--kb-surface-alt);
  padding: 1px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.kb-article pre {
  background: var(--kb-surface-alt);
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
}

.kb-article pre code {
  background: none;
  padding: 0;
}

.kb-article table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  margin: 16px 0;
}

.kb-article th,
.kb-article td {
  border: 1px solid var(--kb-border);
  padding: 6px 10px;
  text-align: left;
}

.kb-article blockquote,
.kb-article aside {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--kb-orange);
  background: var(--kb-orange-tint);
  border-radius: 0 8px 8px 0;
}

/* R1.1 collapsible sections */
.kb-article details {
  margin: 12px 0;
  border: 1px solid var(--kb-border);
  border-radius: 8px;
  padding: 8px 16px;
}

.kb-article details > summary {
  cursor: pointer;
  font-weight: 600;
}

.kb-article details[open] > summary {
  margin-bottom: 8px;
}

.kb-article img,
.kb-article video {
  max-width: 100%;
  height: auto;
}

.kb-article audio {
  max-width: 100%;
}

/*
 * Embedded YouTube and Arcade players, at the width Zoho gave them (the width
 * attribute; 560 or 700), shrunk to fit small screens. The height follows the
 * width at 16:9, so the height attribute is not used. A player with no width
 * fills the column up to 700px, the size of most Zoho embeds.
 */
.kb-article iframe {
  display: block;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}

.kb-article iframe:not([width]) {
  width: 100%;
  max-width: 700px;
}

.kb-section-list {
  max-width: 780px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--kb-border);
}

.kb-section-list h2 {
  font-size: 17px;
}

/* Footer */
.kb-footer {
  border-top: 1px solid var(--kb-border);
  margin-top: 48px;
  font-size: 13px;
  color: var(--kb-text-secondary);
}

.kb-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.kb-footer a {
  color: var(--kb-text-secondary);
}

/* Narrow screens: the sidebar folds into a toggle above the article. */
@media (max-width: 860px) {
  .kb-header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .kb-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .kb-home {
    display: none;
  }

  .kb-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }

  /* list-item, not block: block drops the disclosure marker. */
  .kb-nav-toggle > summary {
    display: list-item;
    cursor: pointer;
    font-weight: 600;
    padding: 8px 0;
  }

  .kb-nav-toggle:not([open]) .kb-nav-tree {
    display: none;
  }

  /* Touch targets: at least 24px tall, with room between neighbours. */
  .kb-nav a {
    padding: 6px 0;
  }

  .kb-section-list li,
  .kb-breadcrumbs li {
    padding: 2px 0;
  }

  .kb-article h1 {
    font-size: 24px;
  }

  .kb-article h2 {
    font-size: 19px;
  }
}

/* Landing page (`/`), after the Zoho help center home at
   support.powermyanalytics.com: dark header and hero with the bar-chart
   background, one large search box, and topic tiles that overlap the hero. */
.kb-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.kb-header-dark {
  background: var(--kb-text);
  border-bottom-color: transparent;
}

.kb-header-dark .kb-home {
  color: #ffffff;
  padding-left: 20px;
  border-left: 1px solid rgb(255 255 255 / 20%);
}

.kb-header-dark .kb-logo img {
  height: 24px;
}

.kb-hero {
  background: var(--kb-text) url('/assets/hero.jpg') center bottom / cover no-repeat;
  color: #ffffff;
  text-align: center;
  /* Bottom padding leaves room for the topic tiles, which ride up over the hero. */
  padding: 72px 24px 152px;
}

.kb-hero-inner {
  max-width: 880px;
  margin: 0 auto;
}

.kb-hero h1 {
  margin: 0 0 12px;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.kb-hero p {
  margin: 0 auto 32px;
  max-width: 60ch;
  font-size: 16px;
  color: rgb(255 255 255 / 78%);
}

.kb-hero-search {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
  /* Pagefind's own sizing variables (defined on :root, so these win by
     inheritance): full width of this box, taller, larger text. */
  --pf-searchbox-max-width: 100%;
  --pf-input-height: 56px;
  --pf-input-font-size: 17px;
  --pf-border-radius: 10px;
  --pf-border: transparent;
}

/* Pagefind sizes the search icon and its gap for a 36px box with high-specificity
   rules, so !important is the only way to scale them for the hero. */
.kb-hero-search .pf-searchbox-input {
  padding-inline-start: 50px !important;
}

.kb-hero-search .pf-searchbox-input-wrapper::before {
  width: 20px !important;
  height: 20px !important;
  top: 18px !important;
  inset-inline-start: 18px !important;
}

.kb-hero-search pagefind-searchbox {
  display: block;
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
  border-radius: 10px;
}

.kb-home-body {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Topic tiles */
.kb-topics {
  margin-top: -88px;
  position: relative;
}

.kb-topic-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kb-topic {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 28px 20px 22px;
  text-align: center;
  color: var(--kb-text);
  text-decoration: none;
  background: var(--kb-surface);
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--kb-border), 0 2px 6px rgb(19 19 24 / 6%);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kb-topic:hover,
.kb-topic:focus-visible {
  text-decoration: none;
  box-shadow: 0 0 0 1px var(--kb-orange), 0 8px 22px rgb(19 19 24 / 14%);
  transform: translateY(-2px);
}

.kb-topic:focus-visible {
  outline: 2px solid var(--kb-orange);
  outline-offset: 3px;
}

.kb-topic-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
}

.kb-topic-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.kb-topic-desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--kb-text-secondary);
}

.kb-topic-count {
  margin-top: auto;
  padding-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--kb-orange-dark);
}

/* Popular Articles and Browse by Section, side by side */
.kb-home-lists {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 48px;
  margin-top: 56px;
}

.kb-home-lists .kb-section-list {
  max-width: none;
  margin: 0;
  padding: 0;
  border-top: 0;
}

.kb-home-lists .kb-section-list h2 {
  font-size: 20px;
  margin: 0 0 12px;
}

.kb-home-lists .kb-section-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kb-home-lists .kb-section-list li {
  border-bottom: 1px solid var(--kb-border);
}

.kb-home-lists .kb-section-list a {
  display: block;
  padding: 10px 0;
  color: var(--kb-text);
  text-decoration: none;
}

.kb-home-lists .kb-section-list a:hover {
  color: var(--kb-link);
}

/* Popular Articles flows into two columns; the section list stays one. */
.kb-home-lists .kb-section-list:first-child ul {
  column-count: 2;
  column-gap: 32px;
}

.kb-home-lists .kb-section-list:first-child li {
  break-inside: avoid;
}

/* Support call to action */
.kb-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin-top: 56px;
  padding: 28px 32px;
  background: var(--kb-surface-alt);
  border-radius: 8px;
}

.kb-help h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.kb-help p {
  margin: 0;
  color: var(--kb-text-secondary);
}

.kb-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.kb-button {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--kb-border);
  background: var(--kb-surface);
  color: var(--kb-text);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.kb-button:hover {
  text-decoration: none;
  border-color: var(--kb-text-secondary);
}

.kb-button-primary {
  background: var(--kb-orange);
  border-color: var(--kb-orange);
  color: #ffffff;
}

.kb-button-primary:hover {
  background: var(--kb-orange-dark);
  border-color: var(--kb-orange-dark);
}

/* Dark footer, as on the help center */
.kb-home-page .kb-footer {
  margin-top: 64px;
  background: var(--kb-text);
  border-top: 0;
  color: rgb(255 255 255 / 70%);
}

.kb-home-page .kb-footer a {
  color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .kb-topic {
    transition: none;
  }

  .kb-topic:hover,
  .kb-topic:focus-visible {
    transform: none;
  }
}

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

@media (max-width: 860px) {
  .kb-hero {
    padding: 40px 16px 120px;
  }

  .kb-hero h1 {
    font-size: 28px;
  }

  /* No keyboard shortcut on a phone, and the badge would cover the placeholder. */
  .kb-hero-search .pf-trigger-shortcut {
    display: none !important;
  }

  .kb-hero-search .pf-searchbox-input {
    padding-inline-end: 16px !important;
  }

  .kb-home-body {
    padding: 0 16px;
  }

  .kb-topics {
    margin-top: -72px;
  }

  .kb-home-lists {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .kb-help {
    padding: 24px 20px;
  }
}

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

  .kb-topic {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    text-align: left;
    column-gap: 14px;
    padding: 16px;
  }

  .kb-topic-icon {
    width: 40px;
    height: 40px;
    margin: 0;
  }

  .kb-topic-title {
    flex: 1;
  }

  .kb-topic-desc,
  .kb-topic-count {
    flex-basis: 100%;
    padding-left: 54px;
  }

  .kb-topic-count {
    margin-top: 4px;
    padding-top: 0;
  }

  .kb-home-lists .kb-section-list:first-child ul {
    column-count: 1;
  }
}

/* Search results link to a section (#heading-id). Land the heading below the
   sticky header, not under it, and mark which section the link pointed to. */
.kb-article :is(h2, h3, h4) {
  scroll-margin-top: 88px;
}

.kb-article :is(h2, h3, h4):target {
  box-shadow: -12px 0 0 var(--kb-surface), -16px 0 0 var(--kb-orange);
}
