/* Copyright (c) 2026 Brownie, LLC. All rights reserved. */

/*
 * The help site (nockbook.app/help/), on top of the home page's stylesheet
 * (css/home.css), which gives it the fonts, colors, header and footer. The
 * pages are written by scripts/help-site.ts. One layout for every screen: the
 * article first, and the list of pages beside it on a computer or under it on
 * a phone, so the steps are the first thing a person sees.
 */

.help-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: 8px;
}

.help-tab {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--color-text-body);
  font-weight: 600;
  text-decoration: none;
}

.help-tab:hover {
  background: var(--color-accent-soft);
}

.help-tab[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-link);
}

.help-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-block: 32px 56px;
}

@media (min-width: 900px) {
  .help-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }

  .help-article {
    flex: 1 1 auto;
    min-width: 0;
  }

  .help-section-list {
    flex: 0 0 260px;
    position: sticky;
    top: 24px;
  }
}

/* The article and the list of pages are cards, like the app's. */
.help-article,
.help-section-list {
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

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

.help-section-list {
  padding: 16px 18px;
}

@media (min-width: 640px) {
  .help-article {
    padding: 28px 32px 32px;
  }
}

.help-article {
  font-size: 18px;
  line-height: 1.6;
  color: var(--color-text-body);
}

.help-article h1 {
  font-family: var(--font-display);
  font-size: var(--heading-size);
  line-height: 1.1;
  color: var(--color-text);
  margin: 0 0 16px;
}

.help-article h2 {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--color-text);
  margin: 40px 0 8px;
}

.help-article h3 {
  font-size: 20px;
  color: var(--color-text);
  margin: 28px 0 4px;
}

.help-article a {
  color: var(--color-link);
}

.help-lead {
  font-size: 20px;
  color: var(--color-text-muted);
}

.help-article ol,
.help-article ul {
  padding-left: 1.4em;
}

.help-article li {
  margin: 8px 0;
}

.help-article code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--color-accent-soft);
  font-size: 0.9em;
}

/* Notes in a box: Tip, Note and Careful. */
.help-note {
  margin: 20px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--color-accent);
  border-radius: 6px;
  background: var(--color-accent-soft);
}

.help-note-careful {
  border-left-color: var(--color-ten-text);
  background: var(--color-ten-soft);
}

.help-note-note {
  border-left-color: var(--color-tournament);
}

.help-article .help-page-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.help-article .help-page-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.help-page-list a {
  font-weight: 700;
}

.help-page-list span {
  color: var(--color-text-muted);
  font-size: 16px;
}

.help-article .help-role-cards {
  display: grid;
  gap: 16px;
  list-style: none;
  margin: 24px 0 32px;
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.help-article .help-role-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.help-role-card h2 {
  margin: 0;
}

.help-role-card h2 a {
  text-decoration: none;
}

.help-role-card p {
  margin: 0 0 8px;
}

.help-section-list h2 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--color-text);
  margin: 0 0 8px;
}

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

.help-section-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--color-text-body);
  text-decoration: none;
}

.help-section-list a:hover {
  background: var(--color-accent-soft);
}

.help-section-list a[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-link);
  font-weight: 700;
}

.help-next {
  margin-top: 40px;
  font-weight: 700;
}

/* The feedback popup (a native dialog, opened by help/feedback.js). */
.help-feedback-dialog {
  box-sizing: border-box;
  width: min(32rem, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  color: var(--color-text);
}

.help-feedback-dialog::backdrop {
  background: rgb(0 0 0 / 45%);
}

.help-feedback-dialog h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.help-feedback-dialog p {
  margin: 0 0 12px;
}

.help-feedback-form label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 600;
}

.help-feedback-form textarea,
.help-feedback-form input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.help-feedback-status {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: var(--color-text-muted);
}

.help-feedback-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

button.help-feedback-open {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* In the footer it looks exactly like the links beside it (.footer-nav a, css/home.css). */
.footer-nav button.help-feedback-open {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0;
  color: #ffffff;
  text-decoration: underline;
}

.footer-nav button.help-feedback-open:hover {
  color: var(--color-footer-text);
}

.help-table {
  overflow-x: auto;
  margin: 20px 0;
}

.help-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 16px;
}

.help-table th,
.help-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.help-table th {
  color: var(--color-text);
  background: var(--color-accent-soft);
}

/* A picture of a screen, taken by `npm run help:screenshots`. */
.help-figure {
  margin: 20px 0;
}

.help-figure img {
  display: block;
  max-width: 100%;
  width: 390px;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

/* A computer-size picture fills the article's width. */
.help-figure-wide img {
  width: 100%;
}

/* A phone picture with a computer one beside it: the phone's on a phone (see markdown's figureHtml). */
@media (min-width: 640px) {
  .help-figure-pair img {
    width: 100%;
  }
}

/*
 * The search box (search.js shows it), in the header between the name and the
 * links. On a phone it takes a row of its own under them. Its label is for
 * screen readers.
 */
.help-search {
  position: relative;
  flex: 1 1 14rem;
  max-width: 24rem;
  margin-inline: auto 0;
}

@media (max-width: 639px) {
  .help-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
}

.help-search label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.help-search input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.help-search-results {
  position: absolute;
  z-index: 5;
  inset-inline: 0;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 6px 20px rgb(0 0 0 / 12%);
}

.help-search-results li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.help-search-results li:last-child {
  border-bottom: 0;
}

.help-search-results a {
  font-weight: 700;
  color: var(--color-link);
}

.help-search-results span {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* A live example (scripts/help-examples.ts): a real control in a quiet box, so it reads as something to press. */
.help-example {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 16px 0;
  padding: 12px 16px;
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.help-example-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* A walkthrough: the stage in a frame, and the link that starts it. */
.help-tour iframe {
  display: block;
  width: 100%;
  height: 280px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface, transparent);
}

.help-tour-start {
  font-weight: 600;
}
