/* L3TH docs: the store's look (tokens, type, buttons) on a three-column docs layout. */

:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --bg-raise: #131316;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #ffffff;
  --text-2: #c4c6cc;
  --muted: #85888f;
  --blue: #1677ff;
  --blue-deep: #0646d6;
  --blue-bright: #3b98ff;
  --sky: #8fc4ff;
  --ok: #3ddc97;
  --warn: #ffc069;
  --danger: #ff6b81;
  --code-bg: #0e0f12;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 28px;
  --font-display: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --top: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f9;
  --bg-raise: #ffffff;
  --surface: rgba(12, 20, 40, .035);
  --surface-hover: rgba(12, 20, 40, .065);
  --line: rgba(12, 20, 40, .09);
  --line-strong: rgba(12, 20, 40, .16);
  --text: #0c0e13;
  --text-2: #3b404c;
  --muted: #676c78;
  --sky: #1463d6;
  --ok: #0c9a5e;
  --warn: #a65f00;
  --danger: #d22d4b;
  --code-bg: #f0f2f6;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 20px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.fill { fill: currentColor; stroke: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; color: #000; padding: 8px 14px; border-radius: 999px; }
.skip:focus { left: 12px; }

/* ---- top bar ---- */
.top {
  position: sticky; top: 0; z-index: 30;
  height: var(--top);
  background: rgba(10, 10, 12, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .top { background: rgba(245, 246, 249, .85); }
.top-inner { max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 700 18px var(--font-display); letter-spacing: .02em; text-decoration: none !important; }
.brand-docs { font-weight: 500; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line-strong); }
[data-theme="light"] .brand img { filter: invert(1) brightness(.12); }
.search-btn {
  display: flex; align-items: center; gap: 10px;
  margin-left: 24px; width: 300px; height: 40px; padding: 0 12px 0 14px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 14px;
  transition: background .2s, border-color .2s;
}
.search-btn:hover { background: var(--surface-hover); border-color: var(--muted); }
.search-btn span { flex: 1; text-align: left; }
kbd { font: 600 11px var(--font-body); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 6px; }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-link { color: var(--text-2); font-weight: 500; font-size: 14px; padding: 8px 12px; border-radius: 999px; }
.top-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
[data-theme-toggle] .moon, [data-theme-toggle] svg:last-child { display: none; }
[data-theme="light"] [data-theme-toggle] svg:first-child { display: none; }
[data-theme="light"] [data-theme-toggle] svg:last-child { display: block; }
.menu-btn { display: none; margin-left: -8px; }

/* ---- layout ---- */
.layout {
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 48px;
}
.sidebar, .toc {
  position: sticky; top: var(--top); align-self: start;
  max-height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 32px 0 40px;
}
.sidebar { scrollbar-width: thin; }
.search-btn-side { display: none; }
.nav-group { margin-bottom: 26px; }
.nav-title { margin: 0 0 8px; padding-left: 12px; font: 600 12px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sidebar a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; line-height: 1.45;
}
.sidebar a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.sidebar a[aria-current="page"] { background: rgba(22, 119, 255, .12); color: var(--text); font-weight: 600; }
/* Sub-headings inside a section (script groups): blue, with a line to the right. */
.nav-sub {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 4px; padding-left: 12px;
  font: 600 11px var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--sky);
}
.nav-sub::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.nav-title + .nav-sub { margin-top: 12px; }
.nav-extra { padding-top: 18px; border-top: 1px solid var(--line); }
.nav-extra svg { width: 16px; height: 16px; }

.toc a { display: block; padding: 4px 0 4px 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.45; }
.toc a.toc-3 { padding-left: 24px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--text); border-left-color: var(--blue); }

/* ---- page ---- */
.content { padding: 40px 0 0; min-width: 0; }
.doc { max-width: 780px; }
.eyebrow { margin: 0 0 6px; color: var(--sky); font: 600 13px var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; letter-spacing: -.01em; position: relative; }
h1 { font-size: 38px; margin: 0 0 12px; font-weight: 700; }
h2 { font-size: 24px; margin: 52px 0 14px; padding-top: 26px; border-top: 1px solid var(--line); font-weight: 700; }
h3 { font-size: 18px; margin: 32px 0 10px; font-weight: 600; }
h4 { font-size: 15px; margin: 24px 0 8px; font-weight: 600; }
.anchor { position: absolute; left: -22px; color: var(--muted); opacity: 0; font-weight: 500; text-decoration: none !important; transition: opacity .15s; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
.lead { font-size: 18px; color: var(--text-2); margin: 0 0 28px; line-height: 1.6; }
.doc p, .doc li { color: var(--text-2); }
.doc strong { color: var(--text); font-weight: 600; }
.doc p a, .doc li a { overflow-wrap: anywhere; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--muted); }
code {
  font: 0.88em var(--font-mono);
  background: rgba(255, 255, 255, .07); color: var(--text);
  padding: 2px 6px; border-radius: 6px;
  overflow-wrap: anywhere;
}
[data-theme="light"] code { background: rgba(12, 20, 40, .06); }
blockquote { margin: 18px 0; padding: 2px 18px; border-left: 3px solid var(--line-strong); }

.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 10px;
  border-radius: 999px; font: 600 12px var(--font-body);
  background: var(--surface-hover); color: var(--text-2); border: 1px solid var(--line);
}
.pill-ok { background: rgba(61, 220, 151, .1); color: var(--ok); border-color: rgba(61, 220, 151, .3); height: 20px; font-size: 11px; padding: 0 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; font-weight: 600; text-decoration: none !important; transition: transform .2s var(--ease), background .2s, box-shadow .2s; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }

/* At a glance box on script pages (from the store's specs). */
.glance { margin: 0 0 32px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.glance dl { margin: 0 0 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; }
.glance dt { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.glance dd { margin: 2px 0 0; color: var(--text); font-size: 14px; line-height: 1.5; }
.glance-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.glance dl:empty { display: none; }

/* Cards (start page). */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 20px 0 8px; }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s, background .25s;
}
.card:hover { text-decoration: none; transform: translateY(-3px); border-color: rgba(59, 152, 255, .45); background: var(--surface-hover); box-shadow: 0 14px 40px rgba(22, 119, 255, .14); }
.card strong { display: flex; align-items: center; gap: 8px; color: var(--text); font: 600 16px var(--font-display); }
.card span:not(.pill) { color: var(--muted); font-size: 14px; line-height: 1.5; }

.doc .cards-title { display: flex; align-items: center; gap: 12px; margin: 28px 0 -6px; font: 600 12px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--sky); }
.doc .cards-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Callouts: > [!NOTE] / [!TIP] / [!WARNING] / [!SUCCESS]. */
.callout { --c: var(--blue-bright); margin: 20px 0; padding: 14px 18px; border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--c) 8%, transparent); }
.callout-tip, .callout-success { --c: var(--ok); }
.callout-warning { --c: var(--warn); }
.callout-title { display: block; margin-bottom: 2px; color: var(--c) !important; font: 600 13px var(--font-display); letter-spacing: .04em; text-transform: uppercase; }
.callout > p:first-of-type { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

/* Steps: ::: steps with a ### per step. */
.steps { list-style: none; padding: 0 !important; margin: 24px 0; counter-reset: step; }
.step { position: relative; padding: 0 0 12px 52px; margin: 0 !important; counter-increment: step; }
.step::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 50%; background: linear-gradient(135deg, var(--blue-bright), var(--blue) 55%, var(--blue-deep));
  color: #fff; font: 700 14px var(--font-display);
}
.step::after { content: ''; position: absolute; left: 15.5px; top: 40px; bottom: 6px; width: 1px; background: var(--line-strong); }
.step:last-child::after { display: none; }
.step > h3 { margin: 4px 0 8px; }
.step > h3 .anchor { left: auto; right: 100%; margin-right: 52px; }
.step-body > :first-child { margin-top: 0; }

/* Tabs. */
.tabs { margin: 18px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tab-list { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { height: 34px; padding: 0 14px; border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .2s, color .2s; }
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab[aria-selected="true"] { color: var(--text); background: rgba(22, 119, 255, .16); box-shadow: inset 0 0 0 1px rgba(59, 152, 255, .4); }
.tab code { background: none; padding: 0; font-size: 13px; color: inherit; }
.tab-panel { padding: 4px 18px 6px; }
.tab-panel > .code:first-child { margin-top: 14px; }

/* Code blocks. */
.code { margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--code-bg); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .03em; }
.copy { height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; color: var(--text-2); }
.copy:hover { background: var(--surface-hover); color: var(--text); }
.copy.done { color: var(--ok); }
pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13px/1.65 var(--font-mono); tab-size: 2; }
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; color: var(--text-2); overflow-wrap: normal; }
.tok-c { color: #6f7682; font-style: italic; }
.tok-s { color: #9fe0b5; }
.tok-n { color: #ffc98a; }
.tok-k { color: #8fc4ff; }
[data-theme="light"] .tok-c { color: #7a808c; }
[data-theme="light"] .tok-s { color: #11804c; }
[data-theme="light"] .tok-n { color: #b35c00; }
[data-theme="light"] .tok-k { color: #0a4be6; }

/* Tables. */
.table { margin: 18px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font: 600 13px var(--font-display); color: var(--text); background: var(--surface); }
td { color: var(--text-2); }
tr:last-child td { border-bottom: 0; }

/* Previous / next + footer. */
.pager { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 0; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, background .2s; }
.pager a:hover { text-decoration: none; border-color: rgba(59, 152, 255, .45); background: var(--surface); }
.pager span { font-size: 12px; color: var(--muted); }
.pager strong { color: var(--text); font: 600 15px var(--font-display); }
.pager-next { grid-column: 2; text-align: right; }
.foot { max-width: 780px; margin: 40px 0 0; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.foot p { margin: 0 0 4px; }

/* ---- search ---- */
.search { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.search-box { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg-raise); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font: 16px var(--font-body); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results { overflow-y: auto; padding: 8px; }
.search-results:empty { display: none; }
.result { display: block; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text-2); }
.result:hover, .result[aria-selected="true"] { background: rgba(22, 119, 255, .14); text-decoration: none; }
.result strong { display: block; color: var(--text); font: 600 15px var(--font-display); }
.result small { display: block; font-size: 13px; color: var(--muted); line-height: 1.5; }
.result mark { background: none; color: var(--sky); font-weight: 600; }
.search-empty { padding: 18px 12px; color: var(--muted); font-size: 14px; }

/* ---- motion ---- */
.doc, .pager { animation: page-in .35s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- responsive ---- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .layout { display: block; }
  .menu-btn { display: grid; }
  .search-btn { width: auto; margin-left: auto; }
  .search-btn span, .search-btn kbd, .top-link { display: none; }
  .top-links { margin-left: 0; }
  .sidebar {
    position: fixed; z-index: 40; top: var(--top); left: 0; bottom: 0;
    width: min(320px, 86vw); max-height: none; padding: 20px 16px 40px;
    align-self: stretch; /* fill top to bottom and scroll, instead of growing past the screen */
    background: var(--bg-raise); border-right: 1px solid var(--line);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .25s var(--ease), visibility .25s;
  }
  .menu-open .sidebar { transform: none; visibility: visible; box-shadow: 30px 0 80px rgba(0, 0, 0, .45); }
  .menu-open::after { content: ''; position: fixed; inset: var(--top) 0 0 0; z-index: 35; background: rgba(0, 0, 0, .45); }
  .content { padding-top: 28px; }
  .anchor { display: none; }
}
@media (max-width: 600px) {
  .top-inner, .layout { padding: 0 16px; }
  .top-inner { gap: 6px; }
  .brand-docs { padding-left: 8px; }
  .search-btn { width: 40px; padding: 0; justify-content: center; }
  h1 { font-size: 30px; }
  h2 { font-size: 21px; margin-top: 40px; }
  .lead { font-size: 16px; }
  .step { padding-left: 44px; }
  .step::before { width: 28px; height: 28px; font-size: 13px; }
  .step::after { left: 13.5px; top: 36px; }
  .tab-panel { padding: 2px 14px 4px; }
  pre { font-size: 12.5px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
  .search { padding-top: 16px; }
}
