/* TILIK Docs — builds on styles.css (tokens, nav, buttons, FAQ, the side frame). */
.docs-page { --docs-max: 1120px; }
.docs-page :target { scroll-margin-top: 96px; }

/* Top bar */
.docs-brand { display: flex; align-items: center; gap: 12px; }
.docs-badge { padding: 3px 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--accent-ink); background: var(--accent); border-radius: 4px; }
.docs-nav-right { display: flex; align-items: center; gap: 18px; }
.docs-navlink { font-size: 15px; color: var(--soft); }
.docs-navlink:hover { color: var(--accent); }
.docs-ask { height: 40px; padding: 0 16px; font-size: 14px; }
.docs-ask svg { width: 18px; height: 18px; }
.docs-toc-btn { display: none; height: 38px; padding: 0 12px; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
@media (max-width: 959px) {
  .docs-toc-btn { display: inline-block; }
  .docs-navlink { display: none; }
}
@media (max-width: 480px) { .docs-ask { display: none; } }

/* Hero */
.docs-hero {
  position: relative;
  max-width: var(--docs-max);
  margin: 0 auto;
  padding: 72px var(--gutter) 56px;
  text-align: center;
}
.docs-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 420px;
  z-index: -1;
  background: radial-gradient(50% 60% at 50% 0%, rgba(228, 255, 26, 0.09), transparent 70%);
  pointer-events: none;
}
.docs-hero h1 { margin: 12px auto 0; max-width: 820px; font-size: clamp(32px, 5vw, 54px); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; }
.docs-lede { margin: 18px auto 0; max-width: 640px; font-size: 18px; line-height: 1.55; color: var(--muted); }
.docs-search { position: relative; max-width: 560px; margin: 32px auto 0; }
.docs-search input {
  width: 100%;
  height: 52px;
  padding: 0 52px 0 48px;
  font: 16px var(--font);
  color: var(--text);
  background: rgba(13, 13, 13, 0.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") 17px 50% / 18px no-repeat;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.docs-search input::placeholder { color: #6f6f6f; }
.docs-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(228, 255, 26, 0.12); }
.docs-search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.docs-search-empty { margin: 14px 0 0; color: var(--muted); }
.docs-search-empty a { color: var(--accent); }
.docs-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 40px; text-align: left; }
@media (max-width: 860px) { .docs-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.quick-card { display: grid; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; transition: border-color 0.2s, transform 0.2s; }
.quick-card:hover { border-color: rgba(228, 255, 26, 0.5); transform: translateY(-2px); }
.quick-card .mono { font-size: 12px; color: var(--accent); }
.quick-card b { font-size: 17px; }
.quick-card span:last-child { font-size: 14px; color: var(--muted); }

kbd { display: inline-block; min-width: 22px; padding: 1px 6px; font: 12px var(--mono); text-align: center; color: var(--soft); background: #151515; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; }

/* Layout: contents on the left, the guide on the right */
.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; max-width: var(--docs-max); margin: 0 auto; padding: 24px var(--gutter) 96px; border-top: 1px solid var(--line); }
.docs-sidebar nav { position: sticky; top: 96px; display: grid; max-height: calc(100vh - 120px); overflow-y: auto; padding: 8px 4px 24px 0; }
.side-group { margin: 22px 0 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--accent); }
.side-group:first-child { margin-top: 8px; }
.docs-sidebar a { position: relative; padding: 7px 0 7px 14px; font-size: 14px; color: var(--muted); border-left: 1px solid var(--border); transition: color 0.15s; }
.docs-sidebar a:hover { color: var(--text); }
.docs-sidebar a[aria-current] { color: var(--text); }
.docs-sidebar a[aria-current]::before { content: ""; position: absolute; left: -2px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.docs-sidebar a.dim { opacity: 0.3; }
.docs-backdrop { display: none; }
@media (max-width: 959px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .docs-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(82vw, 300px); padding: 16px 20px; background: #050505; border-right: 1px solid var(--line); transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
  .docs-sidebar nav { position: static; max-height: none; height: 100%; }
  .docs-page.toc-open .docs-sidebar { transform: none; visibility: visible; }
  .docs-page.toc-open .docs-backdrop { position: fixed; inset: 0; z-index: 39; display: block; background: rgba(0, 0, 0, 0.6); }
}

/* Sections */
.docs-main { min-width: 0; max-width: 800px; }
.doc { padding: 48px 0 8px; scroll-margin-top: 88px; }
.doc[hidden] { display: none; }
.doc + .doc { border-top: 1px solid var(--line); margin-top: 40px; }
.doc .doc-kicker { margin: 0; font-size: 11px; line-height: 1.4; letter-spacing: 0.14em; color: var(--accent); }
.doc h2 { margin: 8px 0 16px; font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.doc h3 { margin: 32px 0 12px; font-size: 18px; }
.doc p { margin: 0 0 14px; font-size: 16px; line-height: 1.7; color: var(--soft); }
.doc b { color: var(--text); }
.doc code, .doc-table code { padding: 1px 6px; font: 13.5px var(--mono); color: #f2f2f2; background: #161616; border: 1px solid #222; border-radius: 5px; overflow-wrap: anywhere; }
.note { font-size: 14px !important; color: var(--dim) !important; }
.cite-demo { display: inline-block; min-width: 18px; padding: 0 5px; font: 11px/17px var(--mono); text-align: center; color: var(--accent); background: rgba(228, 255, 26, 0.12); border-radius: 4px; vertical-align: 2px; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 24px 0; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-row div { display: grid; gap: 4px; padding: 16px; background: radial-gradient(120% 120% at 0% 0%, rgba(228, 255, 26, 0.07), transparent 60%), var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.stat-row b { font-size: 30px; font-weight: 800; line-height: 1; color: var(--accent); }
.stat-row span { font-size: 13px; color: var(--muted); }

.callout { margin: 20px 0; padding: 16px 18px; background: #0b0b0b; border: 1px solid var(--border); border-left: 3px solid var(--soft); border-radius: 8px; }
.callout b { display: block; margin-bottom: 4px; font-size: 14px; }
.callout p { margin: 0; font-size: 15px; }
.callout.tip { border-left-color: var(--accent); }
.callout.tip b { color: var(--accent); }
.callout.warn { border-left-color: #ffcf5a; }
.callout.warn b { color: #ffcf5a; }

.steps-list { list-style: none; margin: 8px 0 24px; padding: 0; display: grid; gap: 4px; }
.steps-list li { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; padding-bottom: 18px; }
.steps-list li:not(:last-child)::before { content: ""; position: absolute; left: 17.5px; top: 40px; bottom: 2px; width: 1px; background: var(--border); }
.step-n { display: grid; place-items: center; width: 36px; height: 36px; font-size: 13px; color: var(--accent); background: #0b0b0b; border: 1px solid rgba(228, 255, 26, 0.35); border-radius: 50%; }
.steps-list b { display: block; margin-top: 6px; font-size: 16px; }
.steps-list p { margin: 4px 0 0; }
.doc-cta { margin-top: 4px; }

.table-wrap { margin: 12px 0 20px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc-table th { padding: 11px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; color: var(--dim); background: #0f0f0f; border-bottom: 1px solid var(--border); }
.doc-table td { padding: 12px 14px; vertical-align: top; color: var(--soft); border-bottom: 1px solid #1a1a1a; }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table td:first-child { color: var(--text); }
.params td:first-child { white-space: nowrap; }
.req { margin-left: 6px; font: 10px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #ff9c9c; }

.examples { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.examples li { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.ex-tag { flex: none; min-width: 74px; padding: 2px 8px; font-size: 11px; text-align: center; color: var(--accent); border: 1px solid rgba(228, 255, 26, 0.3); border-radius: 4px; }
.ex-text { flex: 1; min-width: 0; font-size: 15px; color: var(--text); }
.ex-actions { display: flex; flex: none; gap: 6px; }
.ex-actions a, .ex-actions button { padding: 6px 12px; font-size: 13px; color: var(--soft); background: #151515; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.ex-actions a:hover, .ex-actions button:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 560px) {
  .examples li { flex-wrap: wrap; }
  .ex-text { flex-basis: 100%; order: 3; }
}

.pipeline { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); align-items: stretch; margin: 20px 0; }
.pipe-step { display: grid; align-content: start; gap: 8px; padding: 18px; background: linear-gradient(180deg, #0f0f0f, #080808); border: 1px solid var(--border); border-radius: 12px; }
.pipe-step .mono { font-size: 12px; color: var(--accent); }
.pipe-step b { font-size: 17px; }
.pipe-step p { margin: 0; font-size: 14px; line-height: 1.6; }
.pipe-arrow { align-self: center; height: 1px; background: linear-gradient(90deg, var(--border), var(--accent)); position: relative; }
.pipe-arrow::after { content: ""; position: absolute; right: 0; top: -4px; border: 4.5px solid transparent; border-left: 6px solid var(--accent); border-right: 0; }
@media (max-width: 760px) {
  .pipeline { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pipe-arrow { justify-self: center; width: 1px; height: 22px; background: linear-gradient(var(--border), var(--accent)); }
  .pipe-arrow::after { right: -4px; top: auto; bottom: 0; border: 4.5px solid transparent; border-top: 6px solid var(--accent); border-bottom: 0; }
}

.status-when { font-size: 12px; color: var(--dim); }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
@media (max-width: 640px) { .source-grid { grid-template-columns: minmax(0, 1fr); } }
.source-card { display: grid; gap: 6px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.source-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.source-card b { font-size: 16px; }
.source-card p { margin: 0; font-size: 14px; line-height: 1.55; }
.src-role { font-size: 11px; color: var(--dim); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #3a3a3a; }
.dot.on { background: #8be38b; box-shadow: 0 0 8px rgba(139, 227, 139, 0.6); }
.dot.off { background: #555; }

.trust-list { display: grid; gap: 12px; margin-top: 8px; }
.trust-list > div { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tl-icon { display: grid; place-items: center; width: 44px; height: 44px; font-size: 14px; color: var(--accent); background: rgba(228, 255, 26, 0.05); border: 1px solid rgba(228, 255, 26, 0.3); border-radius: 10px; }
.trust-list p { margin: 4px 0 0; font-size: 15px; }

.bullets { margin: 8px 0 16px; padding-left: 20px; display: grid; gap: 10px; }
.bullets li { font-size: 16px; line-height: 1.65; color: var(--soft); }
.bullets li::marker { color: var(--accent); }

/* API */
.method { display: inline-block; padding: 3px 9px; font: 600 13px var(--mono); letter-spacing: 0.04em; border-radius: 5px; vertical-align: 4px; }
.method.post { color: var(--accent-ink); background: var(--accent); }
.method.get { color: #0a1f0a; background: #8be38b; }
code.endpoint, .doc h2 code.endpoint { padding: 0; font-size: 0.9em; background: none; border: 0; }
.code-tabs { margin: 18px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #070707; }
.tab-bar { display: flex; gap: 2px; padding: 6px 6px 0; background: #0d0d0d; border-bottom: 1px solid var(--border); }
.tab-bar button { padding: 8px 14px; font: 13px var(--mono); color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.tab-bar button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel .code { margin: 0; border: 0; border-radius: 0; }
.code { position: relative; margin: 16px 0; padding: 18px 20px; overflow-x: auto; font: 13.5px/1.65 var(--mono); color: #e8e8e8; background: #070707; border: 1px solid var(--border); border-radius: 12px; }
.code code { padding: 0; font: inherit; color: inherit; background: none; border: 0; white-space: pre; overflow-wrap: normal; }
.copy { position: absolute; top: 10px; right: 10px; padding: 4px 10px; font: 12px var(--mono); color: var(--muted); background: #151515; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; opacity: 0.85; }
.copy:hover { color: var(--text); opacity: 1; }
.copy.done { color: var(--accent); border-color: rgba(228, 255, 26, 0.5); }
.endpoint-list { display: grid; gap: 10px; margin: 12px 0; }
.endpoint-list > div { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 6px 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.endpoint-list p { grid-column: 1 / -1; margin: 0; font-size: 15px; }
.code-badge { display: inline-block; padding: 2px 8px; font: 600 13px var(--mono); border-radius: 5px; }
.code-badge.c4 { color: #ffcf5a; background: rgba(255, 207, 90, 0.1); }
.code-badge.c5 { color: #ff9c9c; background: rgba(255, 138, 138, 0.1); }
.limit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 16px; }
@media (max-width: 640px) { .limit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.limit-grid div { display: grid; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.limit-grid b { font: 700 24px var(--mono); color: var(--accent); }
.limit-grid span { font-size: 13px; color: var(--muted); }

.docs-faq { max-width: none; margin-top: 8px; }
.docs-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 32px; padding: 24px; background: radial-gradient(80% 140% at 100% 100%, rgba(228, 255, 26, 0.08), transparent 70%), var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.docs-end p { margin: 0; font-size: 17px; color: var(--text); }

.docs-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; max-width: var(--docs-max); margin: 0 auto; padding: 32px var(--gutter) 40px; border-top: 1px solid var(--line); }
.docs-footer .logo { font-size: 26px; }
.docs-footer p { margin: 0; font-size: 14px; color: var(--dim); }
.docs-footer a:not(.logo):hover { color: var(--accent); }

/* Search highlights a matching section briefly */
.doc.hit h2 { color: var(--accent); transition: color 0.3s; }
