/* FAQ page (/faq/): the privacy page's rhythm (heading 24px under the nav,
   720px readable column) plus the drop-down items and the editor. Colours
   come from styles.css variables only. No inline styles anywhere (CSP). */

.faq {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
  line-height: 1.6;
}

.faq-page .faq { padding-top: 24px; }

/* [hidden] must always win. Author rules such as .faq-btn { display:
   inline-flex } beat the browser's own [hidden] { display: none }, which once
   showed Edit FAQ to signed-out visitors. This guard covers every element the
   script toggles with .hidden (Edit FAQ, the list, the editor, previews). */
.faq [hidden],
.faq-header [hidden] { display: none !important; }

/* Title centred on its own row; Edit FAQ (editors only) centred beneath it,
   so the title never shifts whether or not the button is shown. */
.faq-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.faq-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  color: #fff;
  text-align: center;
  overflow-wrap: break-word;
}

/* Category tiles: the apply page's .toggle-btn.art-tile (apply.css, same
   art and selected look); here only the row's spacing and the phone layout. */
.faq-tiles { margin: 0 0 16px; }
.faq-tile { font-size: 15px; }

.faq-status { min-height: 1.6em; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.faq-status:empty { min-height: 0; margin: 0; }
.faq-status-ok { color: #6fd08c; font-weight: 600; }  /* = .form-status.is-success */
.faq-status-error { color: rgb(var(--danger-rgb)); }  /* #ff7a85 = .form-status.is-error */

.faq-empty { color: var(--muted); font-size: 15px; margin-bottom: 12px; }

/* ---- read view: <details class="faq-item"><summary>…</summary><div class="faq-answer"> */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-list[hidden] { display: none; }

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.faq-item[open] { border-color: rgba(var(--red-rgb), 0.45); }

.faq-question {
  position: relative;
  display: block;
  padding: 14px 44px 14px 18px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  list-style: none;
  border-radius: 10px;
}

.faq-question::-webkit-details-marker { display: none; }
.faq-question::marker { content: ""; }

/* Chevron: a rotated corner, turned down when open. */
.faq-question::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s;
}

.faq-item[open] > .faq-question::after { transform: translateY(-30%) rotate(-135deg); }
.faq-question:hover { background: rgba(var(--red-rgb), 0.06); }
.faq-question:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.faq-item > .faq-answer {
  padding: 0 18px 16px;
}

.faq-item[open] > .faq-answer { animation: faq-open 0.2s ease-out; }

@keyframes faq-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ---- rendered Markdown (read view and the editor preview) */
.faq-answer { color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.faq-answer > * + * { margin-top: 10px; }
.faq-answer h3 { font-size: 17px; color: #fff; margin-top: 16px; }
.faq-answer h4 { font-size: 15px; color: #fff; margin-top: 14px; }
.faq-answer ul, .faq-answer ol { padding-left: 22px; }
.faq-answer li + li { margin-top: 4px; }
.faq-answer li > ul, .faq-answer li > ol { margin-top: 4px; }
.faq-answer a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.faq-answer a:hover { color: var(--text); }
.faq-answer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}
.faq-answer pre {
  padding: 10px 12px;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.faq-answer pre code { padding: 0; background: none; white-space: pre; }
.faq-answer blockquote {
  padding-left: 12px;
  color: var(--muted);
  border-left: 3px solid rgba(var(--red-rgb), 0.6);
}
.faq-answer hr { border: 0; border-top: 1px solid var(--border); }

/* ---- buttons: one shape for every FAQ button group; only colours differ */
.faq-btn {
  display: inline-flex;   /* hidden by the .faq [hidden] guard above */
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 38px;
  margin: 0;
  padding: 8px 18px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}

/* Colours = the apply page's buttons under body.theme-applicant (Battle.net
   blue): .faq-btn = .btn-secondary (card tint, --border, --text; hover
   --accent-line border, white text, the theme glow and the 2px lift),
   .faq-btn-primary = .apply-page .btn-primary (--cta fill, --on-cta text,
   --cta-hover), .faq-btn-danger = .btn-danger (the error red and its glow). */
.faq-btn:hover:not(:disabled) { border-color: var(--accent-line); color: #fff; transform: translateY(-2px); box-shadow: var(--glow-red); }
.faq-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.faq-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.faq-btn-primary { background: var(--cta); border-color: var(--cta); color: var(--on-cta); }
.faq-btn-primary:hover:not(:disabled) { background: var(--cta-hover); border-color: var(--cta-hover); color: var(--on-cta); }

.faq-btn-danger { color: rgb(var(--danger-rgb)); border-color: rgba(var(--danger-rgb), 0.45); }
.faq-btn-danger:hover:not(:disabled) { border-color: rgb(var(--danger-rgb)); color: rgb(var(--danger-rgb)); box-shadow: var(--glow-danger); }

/* The row actions are their own group: smaller, all the same size. */
.faq-btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }

.faq-list > .faq-btn { align-self: flex-start; }

/* ---- editor */
.faq-editor { display: flex; flex-direction: column; gap: 14px; }
.faq-editor[hidden] { display: none; }

.faq-edit-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 14px 16px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.faq-edit-legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.faq-label { font-size: 13px; color: var(--muted); }

.faq-input,
.faq-select,
.faq-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.faq-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.faq-input:focus, .faq-textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; }

.faq-preview {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.faq-preview[hidden] { display: none; }

.faq-row-actions, .faq-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.faq-actions { margin-top: 0; }

@media (max-width: 600px) {
  .faq-title { font-size: 26px; }
  .faq-question { padding: 12px 40px 12px 14px; font-size: 15px; }
  .faq-item > .faq-answer { padding: 0 14px 14px; }
}

@media (max-width: 400px) {
  .faq-title { font-size: 24px; }
  .faq-tiles { flex-direction: column; }
  .faq-tiles > .toggle-btn { flex: 0 0 auto; min-height: 64px; }
}

/* The lift is motion: none with reduced motion (as .btn on the apply page). */
@media (prefers-reduced-motion: reduce) {
  .faq-btn:hover:not(:disabled) { transform: none; }
}
