/* Lukla Data Studio docs: the site's tokens (style.css) plus the docs layout — page list on the left, the page,
   and "On this page" on the right (a rail whose marker follows the section you're reading, as on the Latch guides). */

body.docs { font-size: 16px; }
html:has(body.docs) { scroll-padding-top: 84px; }

/* Header */
.docs-top { display: flex; align-items: center; gap: 16px; height: 60px; padding-inline: 20px; max-width: 1480px; margin-inline: auto; }
.docs-top .brand { margin-right: 0; font-size: 16px; }
.docs-top .brand img { width: 28px; height: 28px; }
.brand-docs { color: var(--accent-ink); font-weight: 700; margin-left: 2px; }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.top-links a[aria-current="page"] { color: var(--text); }
.top-links a.btn-primary, .top-links a.btn-primary:hover { color: var(--on-accent); background: var(--accent); }
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); padding: 8px; cursor: pointer; }
.search-btn { display: flex; align-items: center; gap: 10px; width: min(380px, 40vw); margin-left: 24px; padding: 8px 10px 8px 12px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); color: var(--muted); font: 500 14px/1 var(--font-body); cursor: pointer; text-align: left; }
.search-btn:hover { border-color: var(--text); color: var(--text); }
.search-btn svg { width: 16px; height: 16px; flex: none; }
.search-btn span { flex: 1; }
.search-btn kbd { font-size: 11.5px; color: var(--muted); }

/* Shell: sidebar | page | on this page */
.docs-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 236px; max-width: 1480px; margin-inline: auto; align-items: start; }

.sidebar { position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto; padding: 26px 18px 40px 20px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.nav-group { margin-bottom: 22px; }
.nav-title { margin: 0 0 6px; padding-left: 10px; font: 700 12px/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.35; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }

/* The page */
.doc { min-width: 0; padding: 34px 56px 64px; }
.doc article { max-width: 780px; margin-inline: auto; }
.crumbs { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.doc h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 12px; }
.doc-lede { font-size: 19px; line-height: 1.5; color: var(--muted); margin-bottom: 26px; }
.doc h2 { font-size: 27px; line-height: 1.2; letter-spacing: -.015em; margin: 48px 0 14px; padding-top: 8px; position: relative; }
.doc h3 { font-size: 20px; line-height: 1.3; margin: 32px 0 10px; position: relative; }
.doc h4 { font-size: 16.5px; margin: 24px 0 8px; }
.doc .anchor { position: absolute; left: -24px; padding-right: 6px; color: var(--line-2); text-decoration: none; opacity: 0; font-weight: 500; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus { opacity: 1; }
.doc .anchor:hover { color: var(--accent-ink); }
.doc p, .doc li { line-height: 1.7; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 16px; }
.doc li { margin: 4px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0 6px; }
.doc a { text-underline-offset: 2px; }
.doc code { padding: 1px 5px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .86em; }
.doc strong { font-weight: 650; }

/* Code blocks: the app's editor colours, in both themes */
.codeblock { margin: 18px 0 22px; border-radius: 14px; overflow: hidden; background: var(--ed-bg); border: 1px solid var(--ed-line); }
.codebar { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px 7px 14px; background: var(--ed-bg-2); border-bottom: 1px solid var(--ed-line); color: var(--ed-muted); font: 600 12px/1 var(--font-body); letter-spacing: .03em; }
.codebar .copy { border: 1px solid var(--ed-line); background: transparent; color: var(--ed-muted); border-radius: 7px; padding: 4px 9px; font: 600 12px/1 var(--font-body); cursor: pointer; }
.codebar .copy:hover { color: var(--ed-text); border-color: var(--ed-muted); }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--ed-text); font: 500 13.5px/1.6 var(--font-mono); tab-size: 4; }
.codeblock code { padding: 0; background: none; border: 0; font-size: inherit; color: inherit; }
.tk { color: var(--ed-kw); } .ts { color: var(--ed-str); } .tn { color: var(--ed-num); } .tf { color: var(--ed-fn); } .tv { color: #E8C07A; } .tc { color: var(--ed-muted); font-style: italic; }

/* Screenshots */
.shot { margin: 22px 0 28px; }
.shot a.zoom { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 40px -24px rgba(0,0,0,.45); background: var(--ed-bg); cursor: zoom-in; }
.shot img { width: 100%; height: auto; }
.shot figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(5, 6, 9, .82); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: min(1600px, 100%); max-height: 100%; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lightbox[hidden] { display: none; }

/* Tables */
.table { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--line); border-radius: 12px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.doc th, .doc td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
.doc th { background: var(--surface-2); font-weight: 650; }
.doc tr:last-child td { border-bottom: 0; }

/* Callouts */
.callout { margin: 18px 0 22px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); border-left-width: 4px; background: var(--bg-alt); }
.callout p { margin: 0; }
.callout.tip { border-left-color: var(--ok); }
.callout.note { border-left-color: var(--link); }
.callout.warning, .callout.important { border-left-color: var(--accent); background: var(--accent-soft); }

/* Docs home */
.doc-group { margin-top: 34px; }
.doc-group h2 { margin-top: 0; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.doc-card { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.doc-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.doc-card h3 { font-size: 16.5px; margin: 0 0 6px; }
.doc-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 650; }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.pager .next { text-align: right; }

/* On this page (docs.js moves the marker) */
.toc-col { position: sticky; top: 61px; height: calc(100vh - 61px); }
.toc { max-height: 100%; overflow-y: auto; scrollbar-width: none; padding: 34px 20px 24px 4px; }
.toc::-webkit-scrollbar { display: none; }
.toc-title { margin: 0 0 12px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.toc-rail { position: relative; border-left: 2px solid var(--line); }
.toc-marker { position: absolute; left: -2px; top: 0; width: 2px; height: 0; background: var(--accent); border-radius: 2px; opacity: 0; transition: transform .25s ease, height .25s ease, opacity .2s; }
.toc ol, .toc-inline ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; font-size: 13.5px; line-height: 1.38; color: var(--muted); text-decoration: none; transition: color .2s; }
.toc li.sub a { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); font-weight: 650; }
.toc-inline { display: none; margin: 4px 0 24px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 14px; padding: 0 18px; }
.toc-inline summary { cursor: pointer; padding: 13px 0; font-size: 15px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 20px; line-height: 1; }
.toc-inline[open] summary::after { content: "−"; }
.toc-inline ol { padding-bottom: 12px; }
.toc-inline li.sub { padding-left: 14px; }
.toc-inline a { display: block; padding: 5px 0; color: var(--muted); text-decoration: none; font-size: 15px; }

/* Search */
.search { position: fixed; inset: 0; z-index: 80; background: rgba(5, 6, 9, .45); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.search[hidden] { display: none; }
.search-panel { width: min(720px, 100%); max-height: 78vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); overflow: hidden; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-field svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.search-field input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 17px/1.3 var(--font-body); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results { overflow-y: auto; padding: 8px; }
.search-group { margin: 6px 0 10px; }
.search-group > p { margin: 0; padding: 6px 10px; font: 700 12px/1.3 var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.result { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.result .rh { display: block; font-weight: 650; font-size: 15px; }
.result .rt { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.5; margin-top: 2px; }
.result mark { background: var(--accent-soft); color: var(--accent-ink); border-radius: 3px; padding: 0 1px; }
.result.on, .result:hover { background: var(--accent-soft); }
.search-empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.search-foot { display: flex; gap: 16px; margin: 0; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.search-foot kbd, .search-field kbd { font-size: 11px; }

/* Narrower: the page list becomes a drawer; "On this page" becomes the card under the intro */
@media (max-width: 1240px) {
  .docs-shell { grid-template-columns: 248px minmax(0, 1fr); }
  .toc-col { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; top: 61px; left: 0; z-index: 60; width: min(320px, 86vw); background: var(--bg); box-shadow: 20px 0 40px -20px rgba(0,0,0,.4); transform: translateX(-105%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  .doc { padding: 24px 18px 48px; }
  .search-btn { width: auto; margin-left: auto; }
  .search-btn span, .search-btn kbd { display: none; }
  .top-links { margin-left: 0; }
  .doc .anchor { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toc-marker, .toc a, .sidebar { transition: none; } }
.shot.clip video { display: block; width: 100%; height: auto; aspect-ratio: 1440 / 900; border-radius: 12px; border: 1px solid var(--line-2); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 40px -24px rgba(0,0,0,.45); background: var(--ed-bg); }
