/* docs.stackhangar.com. Same colour tokens as the marketing site (site/page.css). */
:root {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #f0f2f5; --border: #e2e5ea;
  --text: #15181e; --muted: #5d6573; --accent: #2f5bea; --accent-hover: #2349c9;
  --accent-ink: #ffffff; --accent-soft: #e8eeff; --ok: #1f7a43; --ok-soft: #e4f4ea;
  --warn: #a05a00; --warn-soft: #fff3df; --code-bg: #f0f2f5;
  --radius: 12px; --top: 60px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f13; --surface: #161920; --surface-2: #1d2129; --border: #2a2f3a;
    --text: #e8eaee; --muted: #9aa3b2; --accent: #6d8dff; --accent-hover: #8aa3ff;
    --accent-ink: #0d0f13; --accent-soft: #1d2747; --ok: #4cc77d; --ok-soft: #14301f;
    --warn: #f0b04f; --warn-soft: #362812; --code-bg: #1d2129;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f13; --surface: #161920; --surface-2: #1d2129; --border: #2a2f3a;
  --text: #e8eaee; --muted: #9aa3b2; --accent: #6d8dff; --accent-hover: #8aa3ff;
  --accent-ink: #0d0f13; --accent-soft: #1d2747; --ok: #4cc77d; --ok-soft: #14301f;
  --warn: #f0b04f; --warn-soft: #362812; --code-bg: #1d2129;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 30; }
.icon { width: 20px; height: 20px; flex: none; }
.grow { flex: 1; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1440px; margin: 0 auto; padding: 0 20px; height: var(--top); display: flex; align-items: center; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 26px; height: 26px; flex: none; }
.logo-docs { font-weight: 500; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--border); }
.top-links { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 14px; }
.top-links > a:not(.btn) { color: var(--muted); font-weight: 500; }
.btn { display: inline-flex; align-items: center; font: 600 14px/1 var(--font); padding: 9px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.theme { display: inline-flex; padding: 7px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.theme:hover { color: var(--text); border-color: var(--border); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: block; }
}

/* Search */
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 38px; padding: 0 40px 0 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 15px var(--font); }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 11px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 12px var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; pointer-events: none; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(0 0 0 / .14); max-height: min(70vh, 520px); overflow: auto; z-index: 25; text-align: left; }
.results li { border-radius: 8px; }
.results a { display: block; padding: 9px 12px; color: var(--text); border-radius: 8px; }
.results a:hover { text-decoration: none; }
.results li[aria-selected="true"] a, .results a:hover { background: var(--accent-soft); }
.results .r-t { display: block; font-weight: 600; font-size: 15px; }
.results .r-s { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 8px; }
.results .r-x { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.results mark { background: none; color: var(--accent); font-weight: 600; }
.results .empty { padding: 12px; color: var(--muted); font-size: 14px; }

/* Three columns: sidebar, page, on this page */
.layout { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 272px minmax(0, 1fr) 232px; align-items: start; }
.side.wide, .toc { position: sticky; top: var(--top); max-height: calc(100vh - var(--top)); overflow: auto; }
.side { padding: 24px 12px 40px 20px; font-size: 14.5px; }
.side.wide { border-right: 1px solid var(--border); }
.side details { margin-bottom: 2px; }
.side summary { list-style: none; cursor: pointer; padding: 7px 10px; border-radius: 8px; font-weight: 650; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.side summary::-webkit-details-marker { display: none; }
.side summary::after { content: ""; width: 7px; height: 7px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(-45deg); transition: transform .12s; margin-right: 4px; }
.side details[open] > summary::after { transform: rotate(45deg); }
.side summary:hover, .side-single a:hover { background: var(--surface-2); }
.side ul { list-style: none; margin: 2px 0 10px 10px; padding: 0 0 0 8px; border-left: 1px solid var(--border); }
.side li a { display: block; padding: 5px 10px; border-radius: 7px; color: var(--muted); line-height: 1.4; }
.side li a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.side a[aria-current="page"] { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.side-single a { display: block; padding: 7px 10px; border-radius: 8px; font-weight: 650; color: var(--text); margin-bottom: 2px; }
.side-single a:hover { text-decoration: none; }
.menu { display: none; }

.page { min-width: 0; padding: 32px 48px 80px; }
.doc { max-width: 760px; margin: 0 auto; }
.crumbs { display: flex; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.doc h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 780; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; text-wrap: balance; }
.badge { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 650; letter-spacing: 0; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 32px; }
.doc h2 { font-size: 23px; letter-spacing: -0.015em; line-height: 1.25; margin: 44px 0 12px; padding-top: 4px; }
.doc h3 { font-size: 18px; line-height: 1.3; margin: 30px 0 8px; }
.doc h4 { font-size: 15px; margin: 22px 0 6px; }
.doc h2, .doc h3, .doc h4 { position: relative; }
.anchor { position: absolute; left: -22px; width: 22px; color: var(--muted); opacity: 0; font-weight: 400; }
.doc :is(h2, h3, h4):hover .anchor, .anchor:focus { opacity: 1; text-decoration: none; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 24px; }
.doc li { margin: 5px 0; }
.doc li > ul, .doc li > ol { margin: 6px 0 6px; }
.doc li > p { margin: 0 0 8px; }
.doc li > pre { margin: 8px 0 10px; }
.doc ol > li::marker { font-weight: 650; color: var(--muted); }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.doc strong { font-weight: 650; }
code { font-family: var(--mono); font-size: 0.87em; background: var(--code-bg); padding: 2px 5px; border-radius: 5px; overflow-wrap: anywhere; }
pre { position: relative; margin: 0 0 18px; padding: 14px 16px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; font-size: 14px; line-height: 1.55; }
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.copy { position: absolute; top: 8px; right: 8px; font: 600 12px var(--font); padding: 5px 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; opacity: 0; }
pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--text); }
blockquote { margin: 0 0 16px; padding: 2px 16px; border-left: 3px solid var(--border); color: var(--muted); }
.callout { margin: 0 0 18px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); border-left: 4px solid var(--accent); background: var(--accent-soft); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 0 0 4px !important; }
.callout.tip { border-left-color: var(--ok); background: var(--ok-soft); }
.callout.tip .callout-title { color: var(--ok); }
.callout.warning, .callout.important { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.warning .callout-title, .callout.important .callout-title { color: var(--warn); }
.callout code { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-size: 13px; font-weight: 650; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

.feedback { margin: 48px 0 0; padding-top: 20px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 600; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.pager .next { text-align: right; }

.toc { padding: 36px 20px 40px 8px; font-size: 13.5px; }
.toc-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); line-height: 1.4; }
.toc .l3 a { padding-left: 24px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* Cards (home and section overviews) */
.cards { list-style: none; margin: 0; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cards li { margin: 0; }
.card { display: block; height: 100%; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: border-color .12s, box-shadow .12s; }
.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 4px 16px rgb(0 0 0 / .06); }
.card-i { width: 22px; height: 22px; color: var(--accent); margin-bottom: 10px; display: block; }
.card-t { display: block; font-weight: 680; font-size: 16px; }
.card-d { display: block; font-size: 14px; color: var(--muted); line-height: 1.5; margin-top: 4px; }

/* Home */
.hero { text-align: center; padding: 72px 20px 56px; background: radial-gradient(900px 320px at 50% -40px, var(--accent-soft), transparent 70%); }
.hero h1 { font-size: clamp(32px, 5vw, 46px); font-weight: 780; letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 14px; }
.hero p { max-width: 640px; margin: 0 auto 28px; font-size: 18px; color: var(--muted); }
.hero .search { max-width: 560px; margin: 0 auto; }
.hero .search input { height: 50px; border-radius: 14px; font-size: 16px; padding-left: 44px; box-shadow: 0 6px 22px rgb(0 0 0 / .06); }
.hero .search-icon { left: 15px; }
.home-in { max-width: 1120px; margin: 0 auto; padding: 0 20px 80px; }
.group { margin-top: 40px; }
.group h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 14px; }

.foot { border-top: 1px solid var(--border); }
.foot-in { max-width: 1440px; margin: 0 auto; padding: 22px 20px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13.5px; color: var(--muted); }
.foot a { color: var(--muted); }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 252px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  .side.wide { display: none; }
  .menu { display: block; border-bottom: 1px solid var(--border); background: var(--surface); }
  .menu > summary { padding: 12px 16px; font-weight: 650; cursor: pointer; }
  .menu .side { padding: 4px 16px 16px; }
  .page { padding: 24px 16px 64px; }
  .top-in { padding: 0 16px; gap: 12px; }
  .top-links > a:not(.btn), .logo > span:not(.logo-docs), .search kbd { display: none; }
  .logo-docs { border: 0; padding: 0; color: var(--text); font-weight: 700; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .hero { padding: 48px 16px 40px; }
  .home-in { padding: 0 16px 64px; }
}
@media (max-width: 520px) {
  .top-links .btn { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
