/* Raklet branding for the Help Center.
   Colours sampled from the current logo (assets/images/raklet-logo.png, the www.raklet.com
   header wordmark): blue #1c6ed4, yellow #f9c801, orange-red #ff4603, grey wordmark #777777.

   Every colour below goes through a --help-* token defined once per scheme: light
   ([data-md-color-scheme="default"]) and dark ([data-md-color-scheme="slate"]). Never hard-code a
   colour in a component rule; dark mode was unreadable when cards, titles and the search box did
   (ENG-2119).

   DESIGN.md tokens (ENG-1969 design review): ink #1a2233, muted #6b7589, hairline #e9ecf3 /
   #dfe3ec, card radius 12px, control radius 10px, two-tier shadow. */
:root {
  --raklet-blue: #1c6ed4;
  --raklet-yellow: #f9c801;
  --raklet-orange: #ff4603;
  --raklet-grey: #777777;

  --help-r-card: 12px;
  --help-r-control: 10px;
}

/* ---- Light ------------------------------------------------------------------------------- */
:root,
[data-md-color-scheme="default"] {
  --help-ink: #1a2233;
  --help-muted: #6b7589;
  --help-link: var(--raklet-blue);
  --help-bg: #ffffff;
  --help-surface: #ffffff;
  --help-surface-alt: #f6f7fb;
  --help-hero-bg: linear-gradient(180deg, #f3f6fc 0%, #ffffff 100%);
  --help-field: #ffffff;
  --help-field-header: #f1f3f7;
  --help-hairline: #e9ecf3;
  --help-hairline-hover: #dfe3ec;
  --help-shadow-rest: 0 1px 2px rgba(20, 30, 60, 0.04);
  --help-shadow-hover: 0 8px 24px rgba(20, 30, 60, 0.09);
  --help-shadow-panel: 0 12px 32px rgba(20, 30, 60, 0.14);
  --help-chip: #eef3fc;
}

/* ---- Dark -------------------------------------------------------------------------------- */
[data-md-color-scheme="slate"] {
  --help-ink: #e7eaf1;
  --help-muted: #a4adbf;
  --help-link: #7fb2f5;
  --help-bg: #12161e;
  --help-surface: #1a1f2a;
  --help-surface-alt: #161b24;
  --help-hero-bg: linear-gradient(180deg, #19202d 0%, #12161e 100%);
  --help-field: #1f2532;
  --help-field-header: #232a38;
  --help-hairline: #2b3240;
  --help-hairline-hover: #3a4356;
  --help-shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.3);
  --help-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.45);
  --help-shadow-panel: 0 12px 32px rgba(0, 0, 0, 0.55);
  --help-chip: #22324d;

  --md-hue: 222;
  --md-default-bg-color: var(--help-bg);
  --md-code-bg-color: #1f2532;
}

/* Map Material's variables onto the tokens (both schemes). */
[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: var(--help-surface);
  --md-primary-fg-color--light: var(--help-surface-alt);
  --md-primary-fg-color--dark: var(--help-surface-alt);
  --md-primary-bg-color: var(--help-ink);
  --md-primary-bg-color--light: var(--help-muted);
  --md-accent-fg-color: var(--raklet-orange);
  --md-default-fg-color: var(--help-ink);
  --md-default-fg-color--light: var(--help-muted);
  --md-typeset-color: var(--help-ink);
  --md-typeset-a-color: var(--help-link);
  --md-footer-bg-color: var(--help-surface-alt);
  --md-footer-bg-color--dark: var(--help-surface-alt);
  --md-footer-fg-color: var(--help-muted);
  --md-footer-fg-color--light: var(--help-muted);
  --md-footer-fg-color--lighter: var(--help-muted);
}

body {
  background-color: var(--help-bg);
}

/* ---- Header ------------------------------------------------------------------------------ */
.md-header {
  background-color: var(--help-surface);
  border-bottom: 1px solid var(--help-hairline);
  box-shadow: none;
  color: var(--help-ink);
}

.md-header__title {
  color: var(--help-muted);
  font-weight: 600;
}

/* 924x256 source shown at about 36px tall: crisp on 2x screens. */
.md-header__button.md-logo img,
.md-nav__button.md-logo img {
  height: 1.8rem;
  width: auto;
}

/* The grey wordmark needs a lift on the dark header. */
[data-md-color-scheme="slate"] .md-header__button.md-logo img {
  filter: brightness(1.45);
}

/* Material hides the header logo below 1220px; keep the brand visible on phones. */
@media screen and (max-width: 76.234375em) {
  .md-header__button.md-logo {
    display: inline-block;
    margin: 0.2rem 0;
  }
  .md-header__button.md-logo img {
    height: 1.5rem;
  }
  /* Menu button first, then the logo. */
  .md-header__inner > label[for="__drawer"] {
    order: 1;
  }
  .md-header__button.md-logo {
    order: 2;
  }
  .md-header__inner > :not(label[for="__drawer"]):not(.md-logo) {
    order: 3;
  }
}

/* On phones the wordmark already says Raklet; the title text would only be truncated. */
@media screen and (max-width: 30em) {
  .md-header__title .md-header__topic {
    visibility: hidden;
  }
}

/* Header search box. */
@media screen and (min-width: 60em) {
  .md-search__form {
    background-color: var(--help-field-header);
    border: 1px solid var(--help-hairline);
    border-radius: var(--help-r-control);
  }
  .md-search__form:hover {
    background-color: var(--help-field-header);
    border-color: var(--help-hairline-hover);
  }
  .md-search__input,
  .md-search__input::placeholder,
  .md-search__icon {
    color: var(--help-muted);
  }
  .md-search__input {
    color: var(--help-ink);
  }
}

/* Open search dialog: readable in both schemes. */
.md-search__output,
.md-search-result,
.md-search-result__meta {
  background-color: var(--help-surface);
  color: var(--help-muted);
}

.md-search__input {
  color: var(--help-ink);
}

[data-md-toggle="search"]:checked ~ .md-header .md-search__form {
  background-color: var(--help-field);
}

/* ---- Topic menu (partials/help-menu.html) ------------------------------------------------- */
.help-menu {
  background-color: var(--help-surface);
  border-bottom: 1px solid var(--help-hairline);
  position: relative;
  z-index: 3;
}

.help-menu__list {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0 0.4rem;
}

.help-menu__group {
  position: relative;
}

.help-menu__trigger {
  align-items: center;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--help-ink);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 0.2rem;
  padding: 0.75rem 0.6rem 0.65rem;
}

.help-menu__trigger--active {
  border-bottom-color: var(--raklet-blue);
  color: var(--help-link);
}

.help-menu__chevron {
  fill: currentColor;
  height: 1rem;
  opacity: 0.6;
  transition: transform 0.15s ease;
  width: 1rem;
}

.help-menu__panel {
  background-color: var(--help-surface);
  border: 1px solid var(--help-hairline);
  border-radius: var(--help-r-card);
  box-shadow: var(--help-shadow-panel);
  left: 0;
  min-width: 17rem;
  padding: 0.75rem;
  position: absolute;
  top: calc(100% - 2px);
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
}

.help-menu__group:hover .help-menu__panel,
.help-menu__group:focus-within .help-menu__panel {
  opacity: 1;
  transform: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  visibility: visible;
}

.help-menu__group:hover .help-menu__chevron,
.help-menu__group:focus-within .help-menu__chevron {
  transform: rotate(180deg);
}

.help-menu__group:hover .help-menu__trigger,
.help-menu__trigger:focus-visible {
  color: var(--help-link);
}

.help-menu__blurb {
  color: var(--help-muted);
  font-size: 0.65rem;
  line-height: 1.5;
  margin: 0 0.5rem 0.5rem;
}

.help-menu__panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.help-menu__link {
  align-items: baseline;
  border-radius: 8px;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.45rem 0.5rem;
}

.help-menu__link:hover,
.help-menu__link:focus-visible,
.help-menu__link--active {
  background-color: var(--help-chip);
}

.help-menu__title {
  color: var(--help-ink);
  font-size: 0.75rem;
  font-weight: 600;
}

.help-menu__count {
  color: var(--help-muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

/* Tablets and phones: the drawer (menu button) lists every section instead. */
@media screen and (max-width: 76.234375em) {
  .help-menu {
    display: none;
  }
}

/* Desktop sidebar: only the section you are in (the menu covers the rest). */
@media screen and (min-width: 76.25em) {
  .md-nav--primary > .md-nav__list > .md-nav__item:not(.md-nav__item--active) {
    display: none;
  }
}

/* ---- Home hero (partials/help-hero.html) --------------------------------------------------- */
.help-hero {
  background: var(--help-hero-bg);
  border-bottom: 1px solid var(--help-hairline);
}

.help-hero__inner {
  padding: 3rem 1.2rem 2.5rem;
  text-align: center;
}

.help-hero__title {
  color: var(--help-ink);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

.help-hero__lead {
  color: var(--help-muted);
  font-size: 0.85rem;
  margin: 0 auto 1.5rem;
  max-width: 34rem;
}

.help-hero__search {
  align-items: center;
  background-color: var(--help-field);
  border: 1px solid var(--help-hairline-hover);
  border-radius: 14px;
  box-shadow: var(--help-shadow-hover);
  cursor: text;
  display: flex;
  gap: 0.6rem;
  margin: 0 auto;
  max-width: 36rem;
  padding: 0.85rem 1rem;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.help-hero__search:hover,
.help-hero__search:focus-within {
  border-color: var(--raklet-blue);
  outline: none;
}

.help-hero__icon {
  fill: var(--help-muted);
  flex: none;
  height: 1.3rem;
  width: 1.3rem;
}

.help-hero__input {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  flex: 1;
  font: inherit;
  font-size: 0.85rem;
  min-width: 0;
  outline: none;
}

.help-hero__input::placeholder {
  color: var(--help-muted);
  opacity: 1;
}

.help-hero__results {
  background-color: var(--help-field);
  border: 1px solid var(--help-hairline-hover);
  border-radius: 14px;
  box-shadow: var(--help-shadow-hover);
  margin: 0.5rem auto 0;
  max-height: 22rem;
  max-width: 36rem;
  overflow-y: auto;
  text-align: left;
}

.help-hero__results[hidden] {
  display: none;
}

.help-hero__results-meta {
  color: var(--help-muted);
  font-size: 0.7rem;
  margin: 0;
  padding: 0.6rem 1rem 0;
}

.help-hero__results .md-search-result__list {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* The header input only feeds the search engine while the hero box is in use; do not show its echo. */
.help-hero-searching .md-search {
  visibility: hidden;
}

.help-hero__results .md-search-result__article h1 {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  padding: 0;
}

.help-hero__results .md-search-result__article p {
  color: var(--help-muted);
  font-size: 0.75rem;
  line-height: 1.5;
  margin: 0.15rem 0 0;
}

.help-hero__results .md-search-result__link {
  display: block;
  padding: 0.5rem 1rem;
}

.help-hero__kbd {
  border: 1px solid var(--help-hairline-hover);
  border-radius: 6px;
  color: var(--help-muted);
  font-family: inherit;
  font-size: 0.65rem;
  padding: 0.05rem 0.4rem;
}

.help-hero__popular {
  color: var(--help-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.7rem;
  gap: 0.4rem 0.5rem;
  justify-content: center;
  margin: 1.1rem auto 0;
  max-width: 36rem;
}

.help-hero__popular a {
  background-color: var(--help-chip);
  border-radius: 999px;
  color: var(--help-link);
  font-weight: 600;
  padding: 0.15rem 0.65rem;
}

/* The home page uses the full width: no sidebars, wider content column. */
.md-content__inner:has(.help-home) {
  max-width: 61rem;
}

/* ---- Typography -------------------------------------------------------------------------- */
.md-typeset {
  font-size: 0.8rem;
  line-height: 1.7;
}

.md-typeset h1 {
  color: var(--help-ink);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0 0 1.25rem;
}

.md-typeset h2 {
  color: var(--help-ink);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 2.25rem 0 0.75rem;
}

.md-typeset h3 {
  color: var(--help-ink);
  font-weight: 700;
}

/* Comfortable reading measure (about 70 characters). */
.md-content__inner {
  max-width: 44rem;
}

/* The hero carries the home page's h1; drop the one Material adds from the page title. */
.md-typeset .help-home > h1:first-child {
  display: none;
}

.md-typeset .help-home > h2:first-of-type {
  margin-top: 0.5rem;
}

/* ---- Hub pages (section index pages, .help-hub from main.html): link lists become cards. --- */
.md-typeset .help-hub > ul {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
}

.md-typeset .help-hub > ul > li {
  background: var(--help-surface);
  border: 1px solid var(--help-hairline);
  border-radius: var(--help-r-card);
  box-shadow: var(--help-shadow-rest);
  color: var(--help-muted);
  font-size: 0.75rem;
  line-height: 1.55;
  margin: 0;
  padding: 1.25rem;
  position: relative;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.md-typeset .help-hub > ul > li:hover,
.md-typeset .help-hub > ul > li:focus-within {
  border-color: var(--help-hairline-hover);
  box-shadow: var(--help-shadow-hover);
  transform: translateY(-1px);
}

.md-typeset .help-hub > ul > li > a:first-child {
  color: var(--help-ink);
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

/* The line break in the source only separates title from description in plain renders. */
.md-typeset .help-hub > ul > li br {
  display: none;
}

/* The whole card is the click target. */
.md-typeset .help-hub > ul > li > a:first-child::after {
  content: "";
  inset: 0;
  position: absolute;
}

/* ---- Home topic grid (partials/help-topics.html) ------------------------------------------ */
.help-topics {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  margin: 1rem 0 2rem;
}

.md-typeset .help-topics__group {
  background: var(--help-surface);
  border: 1px solid var(--help-hairline);
  border-radius: var(--help-r-card);
  box-shadow: var(--help-shadow-rest);
  padding: 1.1rem 1.25rem;
}

.md-typeset .help-topics__group h3 {
  font-size: 0.85rem;
  margin: 0 0 0.15rem;
}

.md-typeset .help-topics__blurb {
  color: var(--help-muted);
  font-size: 0.7rem;
  line-height: 1.5;
  margin: 0 0 0.6rem;
}

[dir] .md-typeset .help-topics__group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

[dir] .md-typeset .help-topics__group li {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0.2rem 0;
}

.md-typeset .help-topics__group li a {
  font-weight: 600;
}

.help-topics__count {
  background-color: var(--help-chip);
  border-radius: 999px;
  color: var(--help-muted);
  font-size: 0.6rem;
  padding: 0 0.5rem;
}

.md-typeset .help-contact {
  border-top: 1px solid var(--help-hairline);
  color: var(--help-muted);
  padding-top: 1rem;
}

/* ---- Content details ---------------------------------------------------------------------- */
.md-typeset img {
  border: 1px solid var(--help-hairline);
  border-radius: var(--help-r-card);
  box-shadow: var(--help-shadow-rest);
}

/* Callouts: card radius and hairline instead of Material's saturated outline. */
.md-typeset .admonition[class],
.md-typeset details[class] {
  overflow: hidden;
  border: 1px solid var(--help-hairline);
  border-radius: var(--help-r-card);
  box-shadow: var(--help-shadow-rest);
  font-size: 0.8rem;
}

.md-typeset .admonition-title,
.md-typeset summary {
  border-radius: calc(var(--help-r-card) - 1px) calc(var(--help-r-card) - 1px) 0 0;
}

/* Neutral focus ring for keyboard users. */
.md-typeset a:focus-visible,
.help-menu__trigger:focus-visible,
.help-menu__link:focus-visible,
.md-header__button:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--raklet-blue);
  outline-offset: 2px;
}

.help-updated {
  border-top: 1px solid var(--help-hairline);
  color: var(--help-muted);
  font-size: 0.75rem;
  margin-top: 2rem;
  padding-top: 1rem;
}

/* Footer: hairline-separated and quiet, not a black slab. */
.md-footer {
  border-top: 1px solid var(--help-hairline);
}

.md-footer-meta {
  background-color: var(--help-surface-alt);
}

.md-copyright {
  color: var(--help-muted);
  font-weight: 400;
}

/* ---- 404 --------------------------------------------------------------------------------- */
.help-notfound {
  padding: 4rem 0;
}

.help-notfound__code {
  color: var(--help-link);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
}

.help-notfound .md-button {
  border-radius: var(--help-r-control);
  min-height: 42px;
}

.md-typeset .md-button--primary {
  background-color: var(--raklet-blue);
  border-color: var(--raklet-blue);
  color: #fff;
}

@media screen and (max-width: 30em) {
  .md-typeset h1 {
    font-size: 1.5rem;
  }
  .help-hero__inner {
    padding: 2rem 0.8rem 1.75rem;
  }
  .help-hero__title {
    font-size: 1.6rem;
  }
  .help-hero__kbd {
    display: none;
  }
  .help-notfound {
    padding: 2.5rem 0;
  }
}
