/*
 * The written pages (web/static/core/api.html, about.html): the API pitch, the docs with their
 * endpoint cards, the request form, the playground, and the About page. Colours, type, the
 * header and the footer are in site.css, loaded first.
 *
 * These pages carry the line with them in small ways: lists are points on a line, and the
 * coloured dots are the branch colours of the topic pages.
 */

/*
 * A written page spans the same width as the header and the topic pages, and its text still keeps
 * a width that reads well: beside a list of the page's sections (API), or as cards side by side (About).
 */
.doc { max-width: 1080px; margin: 0 auto; padding: 22px var(--gutter) 40px; }
.doc > * { max-width: 800px; }
.doc.wide > * { max-width: none; }

.with-side { display: grid; grid-template-columns: minmax(0, 1fr); }
.with-side > .doc { max-width: none; margin: 0; padding-left: 0; padding-right: 0; }
.on-page { display: none; }
@media (min-width: 980px) {
  .with-side { grid-template-columns: minmax(0, 1fr) 236px; gap: 0 48px; }
  /* the page's sections as points on a line, with the one being read lit */
  .on-page { display: block; position: sticky; top: 18px; align-self: start; padding: 30px 0 20px; font-size: 14px; }
  .on-page-title { margin-bottom: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; }
  .on-page ul { margin-left: 5px; border-left: 2px solid var(--border); }
  .on-page li { position: relative; }
  .on-page li::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 11px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--faint);
  }
  .on-page a { display: block; padding: 5px 0 5px 16px; color: var(--muted); text-decoration: none; }
  .on-page a:hover { color: var(--text); }
  .on-page li:has(a[aria-current])::before { left: -8px; top: 9px; width: 14px; height: 14px; background: var(--accent); }
  .on-page a[aria-current] { color: var(--text); font-weight: 600; }
}

.two-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 28px; }
.two-up > div { display: flex; flex-direction: column; min-width: 0; }
.two-up .info-card, .two-up .contact-box, .two-up .disclaimer-box { flex: 1; }

.doc h2 { margin-top: 40px; font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
.doc h3 { margin: 30px 0 8px; font-size: 18px; font-weight: 650; }
.doc h4 { font-size: 16px; font-weight: 650; }
.doc h5 { margin: 18px 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.doc p { color: var(--soft); }
.doc p + p, .doc ul + p, .doc ol + p { margin-top: 10px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc a:not(.btn):not(.link-card):not(.cta-btn):not(.contact-btn) { color: var(--accent); }
.doc code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); font: 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* a list as points on a line */
.doc ul:not(.what-you-get), .doc ol { margin: 10px 0 0 6px; padding-left: 18px; border-left: 1px solid var(--border); color: var(--soft); }
.doc ul:not(.what-you-get) > li, .doc ol > li { position: relative; padding: 3px 0; }
.doc ul:not(.what-you-get) > li::before, .doc ol > li::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
/* numbered steps keep their numbers, on the same line */
.doc ol { counter-reset: step; }
.doc ol > li { padding-left: 6px; }
.doc ol > li::before {
  counter-increment: step;
  content: counter(step);
  left: -28px;
  top: 5px;
  width: 19px;
  height: 19px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}

/* ---------- the API page: a drawn line beside the title, in the room to its right, then the pitch ----------
   It was a full-width band under the title until Nov 15, 2026. On a narrow screen it wraps under the title. */
.line-band {
  flex: 1 1 340px;
  max-width: 600px;
  height: 76px;
  margin: 0;
  overflow: hidden;
}
.pitch-line { display: block; width: 100%; height: 100%; }
.pitch-line .l-main { fill: none; stroke: var(--line); stroke-width: 5; stroke-linecap: round; }
.pitch-line .l-branch { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.pitch-line .l-future { fill: none; stroke: var(--faint); stroke-width: 3; stroke-dasharray: 2 7; stroke-linecap: round; }
.pitch-line circle { stroke: var(--surface); stroke-width: 1.5; }
.pitch .tagline { color: var(--soft); font-size: 18px; line-height: 1.5; }
.definition { margin-top: 18px; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--text); font-weight: 500; }

.pitch-card, .info-card, .api-request-form, .api-playground, .feature-card, .link-card, .contact-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.pitch-card { margin-top: 26px; padding: 22px; }
.pitch-card h2 { margin: 0 0 8px; font-size: 21px; }
.what-you-get { margin: 16px 0 18px 4px; padding-left: 20px; border-left: 2px solid var(--line); }
.what-you-get li { position: relative; padding: 5px 0; color: var(--soft); }
.what-you-get li::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 12px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--b0);
}
.what-you-get li:nth-child(2)::before { background: var(--b1); }
.what-you-get li:nth-child(3)::before { background: var(--b2); }
.what-you-get li:nth-child(4)::before { background: var(--b3); }

.quick-links, .features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.link-card, .feature-card { display: block; padding: 16px 18px; text-decoration: none; }
.link-card:hover { border-color: var(--accent); }
.link-card h3, .feature-card h5 { display: flex; align-items: baseline; gap: 9px; margin: 0 0 4px; color: var(--text); font-size: 16px; font-weight: 650; letter-spacing: 0; }
.link-card p, .feature-card p { color: var(--muted); font-size: 14.5px; }

.status-note, .free-plan-box, .rate-limit-info, .disclaimer-box, .form-success, .form-fallback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14.5px;
}
.status-note { border: 1px dashed var(--border); }
.status-note p { color: var(--muted); }

/* ---------- the docs ---------- */
.section-title { margin-top: 44px !important; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 20px !important; scroll-margin-top: 16px; }
#docs, #what-you-get, .doc h3[id] { scroll-margin-top: 16px; }

.cta-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.cta-btn, .contact-btn, .submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.cta-btn:hover, .contact-btn:hover, .submit-btn:hover { filter: brightness(1.08); }
.cta-box .cta-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.cta-box .cta-btn:hover { border-color: var(--accent); filter: none; }

.base-url, .auth-example, .example-request, .response-fields, .results-output pre {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto;
}
.auth-example { white-space: pre; }
.example-request { white-space: pre-wrap; word-break: break-all; }
.response-fields { line-height: 1.8; }
.auth-example .keyword { color: var(--accent); font-weight: 600; }
.auth-example .string { color: var(--b1); }
.auth-example .comment { color: var(--faint); }

.rate-limit-info { background: var(--tint); }
.rate-limit-info h4 { margin-bottom: 2px; font-size: 15px; }
.free-plan-box { border: 1px solid var(--tint-edge); background: var(--tint); }
.free-plan-box p { color: var(--text); }

.endpoint-card { margin-top: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.endpoint-card:hover { border-color: var(--faint); }
.endpoint-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.method-badge { padding: 2px 8px; border-radius: 6px; background: var(--tint); color: var(--accent); font: 600 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.endpoint-name { font: 600 14.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.endpoint-category { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 12.5px; }
.endpoint-category::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--b0); }
.category-content::before { background: var(--b1); }
.category-sources::before { background: var(--b2); }
.endpoint-toggle { color: var(--faint); font-size: 11px; transition: transform 0.2s; }
.endpoint-card.expanded .endpoint-toggle { transform: rotate(180deg); }
.endpoint-body { display: none; padding: 2px 16px 16px; border-top: 1px solid var(--border); }
.endpoint-card.expanded .endpoint-body { display: block; }
.endpoint-desc { margin-top: 12px; color: var(--muted) !important; }

.params-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 14.5px; }
.params-table th { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; }
.params-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--soft); vertical-align: top; }
.params-table tr:last-child td { border-bottom: 0; }
.param-name { font: 600 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }
.param-required { margin-left: 4px; color: var(--bad); font-size: 11.5px; font-weight: 600; }
.param-type { color: var(--muted); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.faq-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.faq-item:first-child { padding-top: 0; }
.faq-item:last-child { padding-bottom: 0; border-bottom: 0; }
.faq-question { margin: 0 0 4px !important; color: var(--text) !important; font-size: 15.5px !important; letter-spacing: 0 !important; }

/* ---------- the request form and the playground ---------- */
.api-request-form, .api-playground { margin-top: 14px; padding: 20px; }
.form-description { margin-top: 4px; color: var(--muted) !important; font-size: 14.5px; }
.form-group { margin-top: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13.5px; font-weight: 600; }
.required { color: var(--bad); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.form-group textarea { min-height: 110px; resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form-group ::placeholder { color: var(--faint); }
.form-row { display: grid; grid-template-columns: 1fr; }
.param-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.submit-btn { margin-top: 16px; cursor: pointer; }
.submit-btn:disabled, .btn-loading { opacity: 0.7; pointer-events: none; }
.loading-spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-note { margin-top: 10px; color: var(--faint) !important; font-size: 13px; }
.form-success { display: none; border: 1px solid var(--tint-edge); background: var(--tint); color: var(--text); }
.form-success.show { display: block; }
.form-fallback { margin-top: 18px; border: 1px dashed var(--border); color: var(--muted); }

.api-results { display: none; margin-top: 18px; scroll-margin-top: 16px; }
.api-results.show { display: block; }
.results-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.results-header h5 { margin: 0; }
.results-meta { color: var(--muted); font-size: 13px; }
.status-success { color: var(--accent); font-weight: 600; }
.status-error { color: var(--bad); font-weight: 600; }
.results-output pre { max-height: 460px; margin: 8px 0 0; overflow: auto; white-space: pre; }
.json-key { color: var(--b4); }
.json-string { color: var(--b6); }
.json-number { color: var(--b2); }
.json-boolean { color: var(--b1); }
.json-null { color: var(--faint); }

/* ---------- About ---------- */
/* The page opens with what TopicTrace is; who makes it comes third, with a smaller photo (Nov 15, 2026). */
.about-content > .two-up:first-child h3 { margin-top: 6px; }
.about-hero { display: flex; flex-wrap: wrap; gap: 22px 28px; align-items: center; margin-top: 34px; }
.author { flex: none; width: 180px; max-width: 100%; margin: 0; }
.author-image { display: block; width: 100%; border: 1px solid var(--border); border-radius: 16px; }
/* the two line drawings that take turns beside "Who makes it" (core/about.html): one place for both */
.author-drawn { width: 440px; }
.about-scenes { display: grid; aspect-ratio: 2.4; color: var(--muted); }
.about-art { grid-area: 1 / 1; width: 100%; height: 100%; opacity: 0; transition: opacity 0.7s ease; }
.about-art.on { opacity: 1; }
.about-art * { fill: none; stroke: currentColor; stroke-width: 1.4px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.author figcaption { margin-top: 7px; color: var(--muted); font-size: 13px; text-align: center; }
.hero-text { flex: 1; min-width: 260px; max-width: 700px; }
.hero-text h3 { margin: 0 0 4px; font-size: 18px; }
.hero-text .tagline { margin-bottom: 10px; color: var(--accent); font-size: 14.5px; font-weight: 600; }
.info-card { margin-top: 12px; padding: 16px 18px; }
.contact-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 12px; padding: 16px 18px; }
.contact-text p { margin-top: 2px; color: var(--muted); font-size: 14.5px; }
.disclaimer-box { margin-top: 12px; padding: 16px 18px; border: 1px dashed var(--border); }
.disclaimer-box p { color: var(--muted); font-size: 14.5px; }

@media (max-width: 600px) {
  .pitch .tagline { font-size: 16.5px; }
  .line-band { height: 64px; }
  .endpoint-header { flex-wrap: wrap; }
  .params-table { display: block; overflow-x: auto; }
  .author { width: 60%; margin: 0 auto; }
  .author-drawn { width: 100%; }
}
