/* Help Center — feature-owned styles (docs/design/components.md co-location)
   Tokens: www/frontend/assets/css/tokens.css
   Scope: #tab-help only (loaded with the SPA shell) */

#tab-help .help-page {
  max-width: var(--content-default);
  margin-inline: auto;
  min-height: auto;
}

#tab-help .page-title {
  color: var(--text-link);
}

#tab-help .help-search {
  margin-bottom: var(--space-8);
}

#tab-help .help-search-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-label);
  font-weight: var(--weight-label);
  line-height: var(--leading-label);
  color: var(--text-primary);
}

#tab-help .help-search-field {
  position: relative;
}

#tab-help .help-search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  width: var(--icon-md);
  height: var(--icon-md);
  color: var(--category-sky-border);
  transform: translateY(-50%);
  pointer-events: none;
}

#tab-help #help-search-input {
  padding-left: calc(var(--space-4) + var(--icon-md) + var(--space-2));
  padding-right: calc(var(--space-4) + var(--icon-md) + var(--space-2));
}

#tab-help .help-search-clear:not(.hidden) {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-8);
  height: var(--space-8);
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  transform: translateY(-50%);
  cursor: pointer;
}

#tab-help .help-search-clear:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

#tab-help .help-search-clear i,
#tab-help .help-search-clear svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

#tab-help .help-search-status {
  margin-top: var(--space-2);
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  color: var(--text-secondary);
}

#tab-help .help-category-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(calc(var(--space-16) * 2), 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

#tab-help .help-category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--space-12);
  padding: var(--space-3);
  border: var(--border-width-default) solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: var(--text-label);
  font-weight: var(--weight-label);
  line-height: var(--leading-label);
  cursor: pointer;
}

#tab-help .help-category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-12);
  height: var(--space-12);
  border-radius: var(--radius-lg);
}

#tab-help .help-category-icon i,
#tab-help .help-category-icon svg {
  width: var(--icon-md);
  height: var(--icon-md);
}

#tab-help .help-category-btn[data-category="all"] .help-category-icon {
  background: var(--brand-soft);
  color: var(--brand-primary);
}

#tab-help .help-category-btn[data-category="getting-started"] .help-category-icon {
  background: var(--category-emerald-surface);
  color: var(--category-emerald-border);
}

#tab-help .help-category-btn[data-category="search"] .help-category-icon {
  background: var(--category-sky-surface);
  color: var(--category-sky-border);
}

#tab-help .help-category-btn[data-category="packages"] .help-category-icon {
  background: var(--category-violet-surface);
  color: var(--category-violet-border);
}

#tab-help .help-category-btn[data-category="data"] .help-category-icon {
  background: var(--category-amber-surface);
  color: var(--category-amber-border);
}

#tab-help .help-category-btn[data-category="fun"] .help-category-icon {
  background: var(--category-rose-surface);
  color: var(--category-rose-border);
}

#tab-help .help-category-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

#tab-help .help-category-btn[data-category="all"]:hover:not([aria-pressed="true"]) {
  background: var(--brand-soft);
  border-color: var(--brand-primary);
}

#tab-help .help-category-btn[data-category="getting-started"]:hover:not([aria-pressed="true"]) {
  background: var(--category-emerald-surface);
  border-color: var(--category-emerald-border);
}

#tab-help .help-category-btn[data-category="search"]:hover:not([aria-pressed="true"]) {
  background: var(--category-sky-surface);
  border-color: var(--category-sky-border);
}

#tab-help .help-category-btn[data-category="packages"]:hover:not([aria-pressed="true"]) {
  background: var(--category-violet-surface);
  border-color: var(--category-violet-border);
}

#tab-help .help-category-btn[data-category="data"]:hover:not([aria-pressed="true"]) {
  background: var(--category-amber-surface);
  border-color: var(--category-amber-border);
}

#tab-help .help-category-btn[data-category="fun"]:hover:not([aria-pressed="true"]) {
  background: var(--category-rose-surface);
  border-color: var(--category-rose-border);
}

#tab-help .help-category-btn.active,
#tab-help .help-category-btn[aria-pressed="true"] {
  background: var(--surface-selected);
  border-color: var(--border-selected);
}

/* Non-color cue for the selected filter (WCAG 1.4.1): underline the label so
   the state survives forced-colors mode and hue-insensitive viewing. */
#tab-help .help-category-btn.active > span:last-child,
#tab-help .help-category-btn[aria-pressed="true"] > span:last-child {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: var(--space-1);
}

#tab-help .help-category-btn[data-category="all"][aria-pressed="true"],
#tab-help .help-category-btn[data-category="all"].active {
  background: var(--brand-soft);
  border-color: var(--brand-primary);
}

#tab-help .help-category-btn[data-category="getting-started"][aria-pressed="true"],
#tab-help .help-category-btn[data-category="getting-started"].active {
  background: var(--category-emerald-surface);
  border-color: var(--category-emerald-border);
}

#tab-help .help-category-btn[data-category="search"][aria-pressed="true"],
#tab-help .help-category-btn[data-category="search"].active {
  background: var(--category-sky-surface);
  border-color: var(--category-sky-border);
}

#tab-help .help-category-btn[data-category="packages"][aria-pressed="true"],
#tab-help .help-category-btn[data-category="packages"].active {
  background: var(--category-violet-surface);
  border-color: var(--category-violet-border);
}

#tab-help .help-category-btn[data-category="data"][aria-pressed="true"],
#tab-help .help-category-btn[data-category="data"].active {
  background: var(--category-amber-surface);
  border-color: var(--category-amber-border);
}

#tab-help .help-category-btn[data-category="fun"][aria-pressed="true"],
#tab-help .help-category-btn[data-category="fun"].active {
  background: var(--category-rose-surface);
  border-color: var(--category-rose-border);
}

#tab-help .help-faq-container:not(.hidden) {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

#tab-help .help-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  font-size: var(--text-h2);
  font-weight: var(--weight-h2);
  line-height: var(--leading-h2);
  color: var(--text-primary);
}

#tab-help .help-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-10);
  height: var(--space-10);
  border-radius: var(--radius-lg);
}

#tab-help .help-section-icon i,
#tab-help .help-section-icon svg {
  width: var(--icon-md);
  height: var(--icon-md);
}

#tab-help .faq-section[data-category="getting-started"] .help-section-icon {
  background: var(--category-emerald-surface);
  color: var(--category-emerald-border);
}

#tab-help .faq-section[data-category="search"] .help-section-icon {
  background: var(--category-sky-surface);
  color: var(--category-sky-border);
}

#tab-help .faq-section[data-category="packages"] .help-section-icon {
  background: var(--category-violet-surface);
  color: var(--category-violet-border);
}

#tab-help .faq-section[data-category="data"] .help-section-icon {
  background: var(--category-amber-surface);
  color: var(--category-amber-border);
}

#tab-help .faq-section[data-category="fun"] .help-section-icon {
  background: var(--category-rose-surface);
  color: var(--category-rose-border);
}

#tab-help .help-faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#tab-help .help-resources {
  margin-top: var(--space-3);
}

#tab-help .help-resource-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#tab-help .faq-item,
#tab-help .help-resource-item {
  background: var(--surface-raised);
  border: var(--border-width-default) solid var(--border-default);
  border-radius: var(--radius-lg);
}

#tab-help .faq-item.help-faq-match {
  border-color: var(--border-selected);
}

#tab-help .faq-item-heading {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

#tab-help .faq-toggle,
#tab-help .help-resource-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-body);
  font-weight: var(--weight-label);
  line-height: var(--leading-body);
  text-align: left;
  cursor: pointer;
}

#tab-help .faq-item.open .faq-toggle {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#tab-help .faq-toggle:hover {
  background: var(--surface-hover);
}

#tab-help .help-resource-action {
  color: var(--text-link);
  text-decoration: none;
  transition:
    color var(--transition-normal),
    background-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

#tab-help .help-resource-item {
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

#tab-help .help-resource-action:hover {
  color: var(--action-primary-hover);
  background: var(--surface-hover);
}

#tab-help .help-resource-item:hover {
  border-color: var(--text-link);
  box-shadow: 0 0 0 2px rgb(var(--color-focus-ring-rgb) / 0.45);
}

#tab-help .faq-question {
  flex: 1;
}

#tab-help .help-resource-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

#tab-help .help-resource-label i,
#tab-help .help-resource-label svg {
  flex-shrink: 0;
  width: var(--icon-sm);
  height: var(--icon-sm);
  color: currentColor;
}

#tab-help .faq-icon {
  flex-shrink: 0;
  width: var(--icon-md);
  height: var(--icon-md);
  color: var(--text-muted);
  transition: transform var(--duration-slow) var(--ease-standard);
}

#tab-help .faq-item.open .faq-icon {
  transform: rotate(180deg);
}

#tab-help .faq-answer {
  padding: 0 var(--space-4) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  max-width: var(--measure-readable);
}

#tab-help .faq-answer p + p,
#tab-help .faq-answer p + ul,
#tab-help .faq-answer p + ol,
#tab-help .faq-answer ul + p,
#tab-help .faq-answer ol + p {
  margin-top: var(--space-3);
}

#tab-help .faq-answer a {
  color: var(--text-link);
  text-decoration: underline;
}

#tab-help .help-plain-list,
#tab-help .help-step-list {
  margin: var(--space-3) 0 0;
  padding-left: var(--space-5);
}

#tab-help .help-plain-list {
  list-style: disc;
}

#tab-help .help-step-list {
  list-style: decimal;
}

#tab-help .help-plain-list li + li,
#tab-help .help-step-list li + li {
  margin-top: var(--space-2);
}

#tab-help .help-step-title {
  display: block;
  color: var(--text-primary);
  font-weight: var(--weight-label);
}

#tab-help .help-step-text {
  display: block;
}

#tab-help .help-page a.btn-primary,
#tab-help .help-page a.btn-primary:hover {
  color: var(--action-primary-foreground);
  text-decoration: none;
}

#tab-help .help-empty:not(.hidden) {
  padding: var(--space-8);
  border: var(--border-width-default) solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  text-align: center;
}

#tab-help .help-empty-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-h3);
  font-weight: var(--weight-h3);
  line-height: var(--leading-h3);
  color: var(--text-primary);
}

#tab-help .help-empty-text {
  margin: 0 0 var(--space-4);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--text-secondary);
}

#tab-help .help-contact {
  width: 100%;
  margin-top: var(--space-10);
}

/* Phone: stack the banners so the text baked into each image stays legible. */
#tab-help .help-contact-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  width: 100%;
}

#tab-help .help-contact-action {
  position: relative;
  display: block;
  flex: 0 0 auto;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: var(--border-width-default) solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--category-sky-surface);
  box-shadow: var(--elevation-1);
  text-decoration: none;
  line-height: 0;
  aspect-ratio: 2036 / 772;
}

@media (min-width: 640px) {
  #tab-help .help-contact-actions {
    flex-direction: row;
  }

  #tab-help .help-contact-action {
    flex: 1 1 0;
  }
}

#tab-help .help-contact-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

#tab-help .help-contact-action:hover {
  border-color: var(--border-hover);
}

#tab-help .help-contact-action:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

#tab-help .help-search-icon,
#tab-help .help-section-icon i,
#tab-help .help-section-icon svg,
#tab-help .help-category-icon i,
#tab-help .help-category-icon svg,
#tab-help .faq-icon {
  stroke-width: 1.75;
}

@media (prefers-reduced-motion: reduce) {
  #tab-help .faq-icon {
    transition: none;
  }

  #tab-help .faq-item.open .faq-icon {
    transform: none;
  }
}
