/* AlgoPuzzle documentation (help/*.html). Plain CSS on purpose: the docs pages need layout
   pieces (sidebar, callouts, figures, steps) that the compiled Tailwind build does not contain,
   and a separate file means no `npm run build:css` is needed when a docs page changes.
   The header and footer reuse the site's existing Tailwind classes (same markup as terms.html). */

:root {
  --d-bg: #030712;
  --d-panel: #0b1220;
  --d-border: #1f2937;
  --d-border-soft: #182030;
  --d-text: #d1d5db;
  --d-text-strong: #f3f4f6;
  --d-muted: #9ca3af;
  --d-faint: #6b7280;
  --d-accent: #34d399;
  --d-accent-strong: #10b981;
  --d-warn: #fbbf24;
  --d-info: #60a5fa;
  --d-code-bg: #111827;
}

.docs-shell {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3rem;
}

/* ---------- sidebar ---------- */
.docs-nav { font-size: 0.875rem; }
.docs-nav details { position: sticky; top: 5.5rem; }
.docs-nav summary {
  display: none;
  cursor: pointer;
  list-style: none;
}
.docs-nav summary::-webkit-details-marker { display: none; }
.docs-nav-inner { max-height: calc(100vh - 7rem); overflow-y: auto; padding-right: 0.5rem; }
.docs-nav h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--d-faint);
}
.docs-nav h2:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a {
  display: block;
  padding: 0.3rem 0.75rem;
  border-left: 2px solid var(--d-border);
  color: var(--d-muted);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.docs-nav a:hover { color: var(--d-text-strong); border-left-color: var(--d-faint); }
.docs-nav a[aria-current="page"] {
  color: var(--d-accent);
  border-left-color: var(--d-accent);
  font-weight: 500;
}

/* ---------- article ---------- */
.docs-main { min-width: 0; }
.docs-crumbs { font-size: 0.8rem; color: var(--d-faint); }
.docs-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; }
.docs-crumbs li + li::before { content: "/"; margin-right: 0.4rem; color: var(--d-border); }
.docs-crumbs a { color: var(--d-muted); text-decoration: none; }
.docs-crumbs a:hover { color: var(--d-accent); }

.docs-main h1 {
  margin: 0.75rem 0 0;
  font-size: 2.1rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--d-text-strong);
}
.docs-lead { margin: 1rem 0 0; font-size: 1.1rem; line-height: 1.65; color: var(--d-muted); max-width: 70ch; }
.docs-updated { margin-top: 0.75rem; font-size: 0.8rem; color: var(--d-faint); }

.docs-body { margin-top: 2rem; color: var(--d-text); line-height: 1.75; font-size: 1rem; }
.docs-body > * { max-width: 72ch; }
.docs-body > figure, .docs-body > .table-wrap, .docs-body > .docs-cards { max-width: none; }
.docs-body h2 {
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--d-border-soft);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--d-text-strong);
  scroll-margin-top: 5rem;
}
.docs-body h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--d-text-strong);
  scroll-margin-top: 5rem;
}
.docs-body p { margin: 0.9rem 0; }
.docs-body ul, .docs-body ol { margin: 0.9rem 0; padding-left: 1.5rem; }
.docs-body ul { list-style: disc; }
.docs-body ol { list-style: decimal; }
.docs-body li { margin: 0.35rem 0; }
.docs-body li::marker { color: var(--d-faint); }
.docs-body a { color: var(--d-accent); text-decoration: underline; text-underline-offset: 2px; }
.docs-body a:hover { color: #6ee7b7; }
.docs-body strong { color: var(--d-text-strong); font-weight: 600; }
.docs-body code, .docs-body kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--d-code-bg);
  border: 1px solid var(--d-border);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  color: var(--d-text-strong);
}
.docs-body kbd { border-bottom-width: 2px; }

/* A label exactly as it appears in the product: a button, drawer or field name. */
.ui {
  font-weight: 600;
  color: var(--d-text-strong);
  white-space: nowrap;
}

/* "In short" answer box at the top of a page (quotable summary for search and AI answers). */
.docs-tldr {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--d-border);
  border-left: 3px solid var(--d-accent-strong);
  border-radius: 6px;
  background: var(--d-panel);
  max-width: 72ch;
}
.docs-tldr p { margin: 0; }
.docs-tldr p + p { margin-top: 0.5rem; }
.docs-tldr .label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--d-accent);
}

/* Callouts: note (info), tip (accent), warning (amber). */
.callout {
  margin: 1.25rem 0;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--d-border);
  border-left-width: 3px;
  border-radius: 6px;
  background: var(--d-panel);
  font-size: 0.95rem;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .label { font-weight: 600; margin-right: 0.35rem; }
.callout.note { border-left-color: var(--d-info); }
.callout.note .label { color: var(--d-info); }
.callout.tip { border-left-color: var(--d-accent-strong); }
.callout.tip .label { color: var(--d-accent); }
.callout.warning { border-left-color: var(--d-warn); }
.callout.warning .label { color: var(--d-warn); }

/* Numbered how-to steps. */
.docs-body ol.steps { list-style: none; padding-left: 0; counter-reset: step; }
.docs-body ol.steps > li {
  position: relative;
  margin: 0.9rem 0;
  padding-left: 2.6rem;
  counter-increment: step;
}
.docs-body ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: var(--d-accent);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.75rem;
  text-align: center;
}

/* Screenshots. */
.docs-body figure { margin: 1.75rem 0; }
.docs-body figure img {
  display: block;
  width: 100%;
  max-width: 60rem;
  height: auto;
  border: 1px solid var(--d-border);
  border-radius: 8px;
  background: var(--d-panel);
}
.docs-body figure.narrow img { max-width: 34rem; }
.docs-body figcaption { margin-top: 0.6rem; font-size: 0.85rem; color: var(--d-faint); max-width: 60rem; }

/* Tables. */
.table-wrap { overflow-x: auto; margin: 1.25rem 0; }
.docs-body table { border-collapse: collapse; width: 100%; max-width: 60rem; font-size: 0.92rem; }
.docs-body th, .docs-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--d-border);
}
.docs-body th { background: var(--d-code-bg); color: var(--d-text-strong); font-weight: 600; }

/* FAQ (native details). */
.docs-body details.faq {
  margin: 0.6rem 0;
  border: 1px solid var(--d-border);
  border-radius: 6px;
  background: var(--d-panel);
}
.docs-body details.faq summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--d-text-strong);
}
.docs-body details.faq[open] summary { border-bottom: 1px solid var(--d-border-soft); }
.docs-body details.faq > div { padding: 0.25rem 1rem 0.75rem; }

/* Overview cards (docs home). */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.docs-cards a {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--d-border);
  border-radius: 8px;
  background: var(--d-panel);
  text-decoration: none;
  color: var(--d-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  transition: border-color .15s, background .15s;
}
.docs-cards a:hover { border-color: var(--d-accent-strong); background: #0e1626; }
.docs-cards a strong { display: block; margin-bottom: 0.3rem; color: var(--d-text-strong); font-size: 1rem; }

/* Previous / next. */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--d-border-soft);
  max-width: 72ch;
}
.docs-pager a {
  flex: 1;
  padding: 0.8rem 1rem;
  border: 1px solid var(--d-border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--d-text-strong);
  font-weight: 500;
}
.docs-pager a:hover { border-color: var(--d-accent-strong); }
.docs-pager a span { display: block; font-size: 0.75rem; font-weight: 400; color: var(--d-faint); }
.docs-pager a.next { text-align: right; }

.docs-help {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--d-faint);
  max-width: 72ch;
}
.docs-help a { color: var(--d-accent); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding: 1.5rem 1rem 3rem; }
  .docs-nav details { position: static; border: 1px solid var(--d-border); border-radius: 8px; background: var(--d-panel); }
  .docs-nav summary {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--d-text-strong);
  }
  .docs-nav summary::after { content: "+"; color: var(--d-faint); }
  .docs-nav details[open] summary::after { content: "-"; }
  .docs-nav-inner { max-height: none; padding: 0 1rem 1rem; }
  .docs-main h1 { font-size: 1.7rem; }
}

/* Annotated screenshots: the yellow numbered markers in the image are explained by ol.marks under it. */
.docs-body figure.crop img { width: auto; max-width: 100%; }
.docs-body figcaption ol.marks {
  list-style: none;
  counter-reset: mark;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-width: 60rem;
}
.docs-body figcaption ol.marks li {
  position: relative;
  margin: 0;
  padding-left: 2rem;
  counter-increment: mark;
  color: var(--d-muted);
  line-height: 1.5;
}
.docs-body figcaption ol.marks li::before {
  content: counter(mark);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #facc15;
  color: #111827;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
}
