/*
 * Help centre styles (static pages under /help).
 * Colours come only from tokens.css (loaded first as /help/assets/tokens.css), so
 * dark mode follows the .dark class that help-client.js sets on <html>.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

.help-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.help-body a {
  color: var(--accent-text);
}

.help-body a:focus-visible,
.help-body button:focus-visible,
.help-body input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Header */
.help-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.help-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.help-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.help-body a.help-logo {
  color: var(--text);
}

.help-logo-img {
  display: block;
  border-radius: 6px;
}

.help-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.help-body a.help-nav-link {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
}

.help-body a.help-nav-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.help-body a.help-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.help-body a.help-button:hover {
  background: var(--accent-text);
}

/* Search */
.help-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 420px;
}

.help-search-input {
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.help-search-input::placeholder {
  color: var(--text-3);
}

.help-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-modal);
  text-align: left;
}

.help-search-results.is-open {
  display: block;
}

.help-body a.help-search-result {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.help-body a.help-search-result:last-child {
  border-bottom: 0;
}

.help-body a.help-search-result:hover,
.help-body a.help-search-result:focus {
  background: var(--surface-hover);
  outline: none;
}

.help-body a.help-search-result:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.help-search-result-title {
  display: block;
  font-weight: 600;
}

.help-search-result-summary {
  display: block;
  font-size: 14px;
  color: var(--text-3);
}

.help-search-empty {
  margin: 0;
  padding: 12px 14px;
  color: var(--text-3);
}

.help-search-large {
  max-width: 560px;
  margin: 0 auto;
  flex: none;
  width: 100%;
}

.help-search-large .help-search-input {
  min-height: 52px;
  font-size: 17px;
  border-radius: 12px;
  padding: 0 18px;
}

/* Main area */
.help-main {
  flex: 1;
  min-width: 0;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.help-layout {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: start;
}

.help-layout .help-main {
  padding-left: 0;
  padding-right: 0;
  max-width: 760px;
}

/* Home */
.help-hero {
  text-align: center;
  padding: 40px 0 32px;
}

.help-hero-title {
  margin: 0 0 20px;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 600;
}

.help-heading {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
}

.help-sections,
.help-popular {
  margin-top: 32px;
}

.help-card-grid,
.help-popular-list,
.help-article-list,
.help-related-list,
.help-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.help-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.help-body a.help-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
}

.help-body a.help-card:hover {
  border-color: var(--accent-edge);
  background: var(--surface-2);
}

.help-card-title {
  font-weight: 600;
  font-size: 17px;
}

.help-card-description {
  color: var(--text-2);
  font-size: 15px;
}

.help-card-count {
  margin-top: auto;
  padding-top: 8px;
  color: var(--text-3);
  font-size: 13px;
}

.help-popular-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.help-popular-item {
  border-bottom: 1px solid var(--border);
}

.help-popular-item:last-child {
  border-bottom: 0;
}

.help-body a.help-popular-link {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
}

.help-body a.help-popular-link:hover {
  background: var(--surface-hover);
  color: var(--accent-text);
}

/* Breadcrumb */
.help-breadcrumb {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-3);
}

.help-breadcrumb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.help-breadcrumb-item[aria-current='page'] {
  color: var(--text-2);
}

.help-breadcrumb-sep {
  color: var(--text-3);
}

/* Titles and lists */
.help-title {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 600;
}

.help-lede {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 17px;
}

.help-article-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.help-article-item:last-child {
  border-bottom: 0;
}

.help-body a.help-article-link {
  font-weight: 600;
  font-size: 17px;
}

.help-article-summary {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 15px;
}

.help-empty {
  color: var(--text-3);
}

/* Article content */
.help-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.help-content {
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.help-content h2 {
  margin: 28px 0 8px;
  font-size: 22px;
  line-height: 1.3;
  color: var(--text);
}

.help-content h3 {
  margin: 22px 0 6px;
  font-size: 18px;
  color: var(--text);
}

.help-content p,
.help-content ul,
.help-content ol,
.help-content blockquote,
.help-content pre {
  margin: 0 0 14px;
}

.help-content ul,
.help-content ol {
  padding-left: 24px;
}

.help-content li {
  margin-bottom: 4px;
}

.help-content strong {
  color: var(--text);
}

.help-content code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.help-content pre {
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
}

.help-content pre code {
  padding: 0;
  border: 0;
  background: none;
}

.help-content blockquote {
  padding: 8px 14px;
  border-left: 3px solid var(--accent-edge);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-2);
}

.help-content blockquote p:last-child {
  margin-bottom: 0;
}

.help-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 15px;
}

.help-content th,
.help-content td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.help-content th {
  background: var(--surface-2);
  color: var(--text);
}

.help-content img,
.help-content video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 14px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.help-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* Related and still stuck */
.help-related {
  margin-top: 28px;
}

.help-related-item {
  margin-bottom: 6px;
}

.help-stuck {
  margin: 28px 0 0;
  color: var(--text-3);
  font-size: 15px;
}

/* On article pages the "Still stuck?" line under the article replaces the footer copy. */
.help-body:has(.help-stuck) .help-footer {
  display: none;
}

/* Sidebar */
.help-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin: 16px 0 0;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.help-sidebar-toggle::after {
  content: '▾';
  color: var(--text-3);
}

.help-sidebar-toggle[aria-expanded='true']::after {
  content: '▴';
}

.help-sidebar {
  display: none;
  margin: 8px 0 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.help-sidebar.is-open {
  display: block;
}

.help-sidebar-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.help-body .help-sidebar-title a {
  color: var(--text);
  text-decoration: none;
}

.help-body a.help-sidebar-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 15px;
}

.help-body a.help-sidebar-link:hover {
  background: var(--surface-hover);
}

.help-body a.help-sidebar-current {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

/* Footer */
.help-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.help-footer-text {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px;
  color: var(--text-3);
  font-size: 14px;
}

/* Tablet and up */
@media (min-width: 640px) {
  .help-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .help-article {
    padding: 28px;
  }
}

/* Desktop: sidebar sits beside the content, toggle disappears */
@media (min-width: 768px) {
  .help-layout:not(.help-layout-single) {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 40px;
  }
  .help-layout .help-sidebar-toggle {
    display: none;
  }
  .help-layout .help-sidebar,
  .help-layout .help-sidebar.is-open {
    display: block;
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 16px;
    margin-top: 24px;
  }
  .help-layout:not(.help-layout-single) .help-main {
    grid-column: 2;
    grid-row: 1;
  }
  .help-hero-title {
    font-size: 40px;
  }
}

@media (min-width: 1024px) {
  .help-card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
