/* elmts.dev/docs: header with search, sidebar, article, on-this-page. */
.top { position: sticky; top: 0; z-index: 30; height: 60px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.top .wrap { max-width: 1440px; margin: 0 auto; height: 100%; padding: 0 24px; display: flex; align-items: center; gap: 16px; }
.top .logo { font-size: 22px; }
.top .sect { font: 500 12px var(--mono); color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.search { position: relative; flex: 0 1 360px; margin-left: 32px; }
.search input { width: 100%; height: 36px; padding: 0 64px 0 34px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 400 14px var(--font); outline: none; box-shadow: var(--e1); }
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.search > svg { position: absolute; left: 12px; top: 11px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.search .kb { position: absolute; right: 8px; top: 7px; display: flex; gap: 3px; pointer-events: none; }
.search .kb kbd { height: 20px; min-width: 20px; font-size: 11px; padding: 0 5px; }
.results { position: absolute; left: 0; right: 0; top: 44px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--e3); display: none; max-height: 60vh; overflow: auto; }
.results.on { display: block; }
.results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; }
.results a:hover, .results a.hl { background: var(--sunken); }
.results a b { display: block; font-weight: 500; font-size: 14px; }
.results a small { font: 11.5px var(--mono); color: var(--muted); }
.results .none { padding: 10px; color: var(--muted); font-size: 14px; }
.top .links { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 14px; }
.top .links a:not(.btn) { color: var(--muted); text-decoration: none; } .top .links a:not(.btn):hover { color: var(--ink); }
.burger { display: none; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); place-items: center; cursor: pointer; flex: none; }
.burger svg { width: 16px; height: 16px; }

.layout { max-width: 1440px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 248px minmax(0, 1fr) 220px; gap: 48px; }
.side { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto; padding: 28px 8px 48px 0; scrollbar-width: thin; }
.side h6 { margin: 22px 0 6px 10px; font: 500 11px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.side h6:first-child { margin-top: 0; }
.side a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 14.5px; color: var(--ink-2); text-decoration: none; }
.side a:hover { background: var(--sunken); color: var(--ink); }
.side a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line), var(--e1); }
.side .badge { height: 18px; font: 500 10.5px var(--mono); margin-left: 6px; padding: 0 6px; vertical-align: 1px; }
.side .sfoot { margin: 28px 10px 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side .sfoot a { display: inline; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.side .sfoot a:hover { background: none; }

.doc { min-width: 0; max-width: 740px; padding: 36px 0 96px; }
.crumbs { font: 12px var(--mono); color: var(--muted); display: flex; gap: 8px; align-items: center; }
.doc .crumbs a { color: var(--muted); text-decoration: none !important; }
.side .close .logo { display: inline-flex; } .crumbs a:hover { color: var(--ink); }
.doc h1 { font-size: 44px; line-height: 1.05; letter-spacing: -.04em; font-weight: 600; margin: 14px 0 0; }
.doc .lede { font-size: 19px; color: var(--ink-2); margin: 14px 0 0; letter-spacing: -.01em; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.doc h2 { font-size: 26px; letter-spacing: -.03em; font-weight: 600; margin: 56px 0 0; scroll-margin-top: 84px; line-height: 1.15; }
.doc h2 a.anchor { color: var(--faint); text-decoration: none; margin-left: 8px; opacity: 0; font-weight: 400; transition: opacity var(--fast); }
.doc h2:hover a.anchor { opacity: 1; }
.doc h3 { font-size: 18px; letter-spacing: -.015em; font-weight: 600; margin: 32px 0 0; scroll-margin-top: 84px; }
.doc p, .doc li { font-size: 16px; line-height: 1.7; color: var(--ink-2); }
.doc p { margin: 14px 0 0; }
.doc ul, .doc ol { margin: 14px 0 0; padding-left: 22px; }
.doc li + li { margin-top: 6px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a:not(.btn):not(.anchor):not(.card-link) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.doc a:not(.btn):not(.anchor):not(.card-link):hover { text-decoration-color: var(--ink); }
.doc p code, .doc li code, .doc td code { font: 13.5px var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.doc kbd { vertical-align: 1px; }

.steps-ol { list-style: none; padding: 0 !important; counter-reset: s; display: grid; gap: 14px; }
.steps-ol li { counter-increment: s; position: relative; padding-left: 44px; margin: 0 !important; }
.steps-ol li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 500 12px var(--mono); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }

.callout { display: flex; gap: 12px; margin: 22px 0 0; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--e1); }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--ink); }
.callout p { margin: 0; font-size: 15px; }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.callout.warn svg { color: var(--warn); }

.codeblock { margin: 18px 0 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--e1); }
.codeblock .cb-h { display: flex; align-items: center; height: 36px; padding: 0 6px 0 14px; border-bottom: 1px solid var(--line); background: var(--bar-grad); font: 12px var(--mono); color: var(--muted); }
.codeblock .cb-h .copy { margin-left: auto; }
.copy .ok { display: none; } .copy.done .ok { display: block; } .copy.done .cp { display: none; }
.codeblock pre { margin: 0; padding: 14px 16px; font: 13px/1.7 var(--mono); color: var(--ink-2); overflow-x: auto; background: var(--surface-2); }
.codeblock pre .c { color: var(--faint); } .codeblock pre .k { color: var(--ink); font-weight: 500; } .codeblock pre .p { color: var(--faint); user-select: none; }

.tbl-wrap { margin: 18px 0 0; border-radius: var(--r-lg); border: 1px solid var(--line); overflow-x: auto; background: var(--surface); box-shadow: var(--e1); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 460px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
th { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--ink); font-weight: 500; }

/* illustrations */
.fig { margin: 22px 0 0; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: var(--sunken); background-image: radial-gradient(var(--dot) 1px, transparent 1.3px); background-size: 22px 22px; }
.fig .stage { position: relative; height: 210px; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 20px; flex-wrap: wrap; }
.fig figcaption { padding: 10px 14px; font: 12px var(--mono); color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }
.f-card { position: relative; width: 210px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid #ECEAE6; font: 12.5px -apple-system, system-ui, sans-serif; color: #1D1D1B; }
.f-card .ph { height: 64px; border-radius: 8px; background: linear-gradient(160deg, #F4EEE4, #C98A4B); margin-bottom: 8px; }
.f-card b { display: block; } .f-card small { color: #7B7974; }
.f-card .k { position: absolute; width: 12px; height: 12px; border: 2.5px solid #0A0A0A; filter: drop-shadow(0 0 1px #fff); }
.f-card .k1 { left: -6px; top: -6px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.f-card .k2 { right: -6px; top: -6px; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.f-card .k3 { left: -6px; bottom: -6px; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.f-card .k4 { right: -6px; bottom: -6px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.f-card .lbl { position: absolute; left: -6px; top: -34px; height: 24px; padding: 0 8px; border-radius: 7px; background: #0A0A0A; color: #fff; font: 500 11px/24px var(--mono); white-space: nowrap; }
.f-toast { width: 270px; background: #0A0A0A; color: #FAFAFA; border-radius: 12px; padding: 9px 10px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; align-items: center; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 12px 28px -10px rgba(0,0,0,.45); font: 12.5px var(--font); }
.f-toast .th { width: 30px; height: 22px; border-radius: 4px; background: linear-gradient(160deg, #F4EEE4, #C98A4B); }
.f-toast b { display: block; font-weight: 500; } .f-toast small { display: block; font: 11px var(--mono); color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-toast .a { display: flex; gap: 4px; } .f-toast .a span { font: 500 11.5px var(--font); padding: 3px 8px; border-radius: 6px; background: #FAFAFA; color: #0A0A0A; } .f-toast .a span.g { background: transparent; color: #FAFAFA; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.f-arrow { color: var(--faint); width: 22px; height: 22px; }

.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; }
.card-link { display: block; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--e1); text-decoration: none; transition: border-color var(--fast); }
.card-link:hover { border-color: var(--line-strong); }
.card-link small { display: block; font: 11.5px var(--mono); color: var(--muted); }
.card-link b { display: block; margin-top: 4px; font-weight: 600; font-size: 16px; color: var(--ink); }
.card-link span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
.card-link.next { text-align: right; }

.helpful { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.helpful .row { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.helpful a { color: var(--muted); text-decoration: none; } .helpful a:hover { color: var(--ink); }

.toc { position: sticky; top: 60px; align-self: start; padding: 36px 0 48px; max-height: calc(100vh - 60px); overflow-y: auto; }
.toc h6, .toc-m summary { margin: 0 0 10px; font: 500 11px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 1px solid var(--line); font-size: 13.5px; color: var(--muted); text-decoration: none; transition: color var(--fast), border-color var(--fast); }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); border-left-color: var(--ink); font-weight: 500; }
.toc .tfoot { margin-top: 20px; display: grid; gap: 8px; font-size: 13px; }
.toc .tfoot a { border: 0; padding: 0; }
.toc-m { display: none; margin: 22px 0 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e1); }
.toc-m summary { list-style: none; cursor: pointer; margin: 0; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.toc-m summary::-webkit-details-marker { display: none; }
.toc-m summary::after { content: "+"; font: 400 18px var(--mono); color: var(--muted); transition: transform var(--base) var(--ease); }
.toc-m[open] summary::after { transform: rotate(45deg); }
.toc-m nav { padding: 0 14px 12px; }
.toc-m a { display: block; padding: 6px 0; font-size: 15px; color: var(--ink-2); text-decoration: none; border-top: 1px solid var(--line); }

.scrim { display: none; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 232px minmax(0, 1fr); gap: 40px; }
  .toc { display: none; }
  .toc-m { display: block; }
}
@media (max-width: 860px) {
  .top .wrap { padding: 0 16px; gap: 10px; }
  .top .sect, .top .links .tl { display: none; }
  .search { margin-left: auto; flex: 1 1 auto; max-width: 260px; }
  .search .kb { display: none; }
  .search input { padding-right: 12px; }
  .top .links { margin-left: 0; gap: 8px; }
  .burger { display: grid; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .side { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: auto; width: min(300px, 86vw); padding: 20px 16px 40px; background: var(--bg); border-right: 1px solid var(--line); box-shadow: var(--e3); transform: translateX(-102%); transition: transform var(--base) var(--ease); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(10,10,10,.32); }
  .side .close { display: flex !important; }
  .doc { padding-top: 24px; }
  .doc h1 { font-size: 34px; }
  .doc .lede { font-size: 17px; }
  .doc h2 { font-size: 23px; margin-top: 44px; }
  .cards2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .top .logo { font-size: 20px; }
  .fig .stage { height: auto; flex-direction: column; gap: 22px; padding: 44px 16px 24px; }
  .f-arrow { transform: rotate(90deg); }
}
.side .close { display: none; align-items: center; justify-content: space-between; margin: 0 0 18px 10px; }


@media (max-width: 560px) {
  table { min-width: 0; }
  .doc td code { white-space: normal; overflow-wrap: anywhere; }
  th, td { padding: 10px 10px; }
}
