/* Portal dokumentacji API — oprawa wspólna dla marek; kolor akcentu z brands/<marka>.json (--accent, --accent-dark). */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-code: #f3f4f6;
  --fg: #111827;
  --fg-muted: #4b5563;
  --border: #e5e7eb;
  --link: var(--accent);
  --focus: var(--accent);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --header: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-soft: #151b23;
    --bg-code: #161b22;
    --fg: #e6edf3;
    --fg-muted: #9aa4b0;
    --border: #2b333d;
    --link: var(--accent-dark);
    --focus: var(--accent-dark);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header) + 16px); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.65 var(--font); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: 0.875em; background: var(--bg-code); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
.muted { color: var(--fg-muted); }

.skip { position: absolute; left: 8px; top: -48px; z-index: 100; background: var(--bg); padding: 8px 12px; border: 2px solid var(--focus); border-radius: 6px; }
.skip:focus { top: 8px; }

/* Nagłówek */
.top { position: sticky; top: 0; z-index: 20; height: var(--header); display: flex; align-items: center; gap: 24px; padding: 0 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; color: var(--fg); text-decoration: none; white-space: nowrap; }
.top-nav { display: flex; gap: 18px; margin-right: auto; }
.top-nav a { color: var(--fg-muted); text-decoration: none; font-weight: 500; padding: 4px 0; }
.top-nav a[aria-current] { color: var(--fg); box-shadow: inset 0 -2px var(--link); }
.lang { display: flex; gap: 4px; font-size: 14px; font-weight: 600; }
.lang a,
.lang span { padding: 3px 8px; border-radius: 6px; text-decoration: none; color: var(--fg-muted); }
.lang span[aria-current] { background: var(--bg-code); color: var(--fg); }

/* Układ: nawigacja | treść | spis */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 220px; gap: 40px; max-width: 1360px; margin: 0 auto; padding: 0 24px; }
.side { position: sticky; top: var(--header); align-self: start; max-height: calc(100vh - var(--header)); overflow: auto; padding: 24px 0; font-size: 15px; }
.side summary { font-weight: 650; cursor: pointer; margin-bottom: 8px; list-style: none; }
.side summary::-webkit-details-marker { display: none; }
.side summary::after { content: " ▾"; color: var(--fg-muted); }
.side details:not([open]) summary::after { content: " ▸"; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--fg-muted); text-decoration: none; }
.side li a:hover { background: var(--bg-soft); color: var(--fg); }
.side li a[aria-current] { background: color-mix(in srgb, var(--link) 12%, transparent); color: var(--fg); font-weight: 600; }
.side-extra { margin-top: 16px !important; padding-top: 16px !important; border-top: 1px solid var(--border) !important; }
main { min-width: 0; padding: 32px 0 64px; outline: none; }
.toc { position: sticky; top: var(--header); align-self: start; padding: 32px 0; font-size: 14px; }
.toc h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 3px 12px; color: var(--fg-muted); text-decoration: none; }
.toc a:hover { color: var(--fg); }

/* Treść */
article { max-width: 780px; }
h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.015em; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.2em 0 0.6em; padding-top: 8px; }
h3 { font-size: 1.15rem; margin: 1.8em 0 0.5em; }
h2 .anchor,
h3 .anchor { float: left; margin-left: -1.1em; padding-right: 0.3em; color: var(--fg-muted); text-decoration: none; opacity: 0; }
h2:hover .anchor,
h3:hover .anchor { opacity: 1; }
p, ul, ol { margin: 0 0 1em; }
li + li { margin-top: 0.25em; }
.table { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { background: var(--bg-soft); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.notice { border-left: 4px solid var(--link); background: var(--bg-soft); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 15px; }

/* Kod */
.code { position: relative; margin: 0 0 1.2em; }
.code pre { margin: 0; padding: 14px 16px; overflow: auto; background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius); font: 13.5px/1.55 var(--mono); tab-size: 4; }
.code 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: 4px 9px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--fg-muted); cursor: pointer; opacity: 0.85; }
.copy:hover { opacity: 1; color: var(--fg); }
.code-tabs { margin: 0 0 1.4em; }
.code-tabs .tablist { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: -1px; }
.code-tabs [role="tab"] { font: 600 13px var(--font); padding: 7px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: none; color: var(--fg-muted); cursor: pointer; }
.code-tabs [role="tab"][aria-selected="true"] { background: var(--bg-code); border-color: var(--border); color: var(--fg); }
.code-tabs [role="tabpanel"] .code { margin: 0; }
.code-tabs [role="tabpanel"] pre { border-top-left-radius: 0; }

/* Strona główna */
.hero { max-width: 760px; padding: 24px 0 8px; }
.hero h1 { font-size: 2.5rem; }
.lead { font-size: 1.2rem; color: var(--fg-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.button { display: inline-block; padding: 10px 18px; border-radius: 8px; background: var(--link); color: #fff; font-weight: 600; text-decoration: none; }
@media (prefers-color-scheme: dark) { .button { color: #0d1117; } }
.button-ghost { background: none; color: var(--link); box-shadow: inset 0 0 0 1.5px var(--link); }
.facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0 0 12px; }
.facts dt { font-size: 13px; color: var(--fg-muted); }
.facts dd { margin: 0; }
.cards { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); text-decoration: none; }
.card span { color: var(--fg-muted); font-size: 15px; }
.card:hover { border-color: var(--link); }
.card-accent { border-color: color-mix(in srgb, var(--link) 50%, var(--border)); }
.kind-home .layout { grid-template-columns: 240px minmax(0, 1fr); }

.foot { border-top: 1px solid var(--border); padding: 20px 24px; color: var(--fg-muted); font-size: 14px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; max-width: 1360px; margin: 0 auto; }
.foot p { margin: 0; }

/* Wąskie ekrany */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .top { gap: 12px; }
  .brand span .muted { display: none; }
  .top-nav { gap: 12px; font-size: 15px; white-space: nowrap; }
  .code-tabs .tablist { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .code-tabs [role="tab"] { flex: none; }
  .layout,
  .kind-home .layout { display: block; padding: 0 16px; }
  .side { position: static; max-height: none; padding: 16px 0 0; border-bottom: 1px solid var(--border); }
  .side details:not([open]) + .side-extra { display: none; }
  .side-extra { display: none; }
  main { padding-top: 20px; }
  h1, .hero h1 { font-size: 1.8rem; }
  h2 .anchor, h3 .anchor { display: none; }
}
@media (max-width: 420px) {
  .brand > span { display: none; }
}

/* highlight.js — paleta GitHub (jasna / ciemna) */
.hljs-comment, .hljs-quote { color: #6e7781; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type, .hljs-built_in { color: #cf222e; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: #0a3069; }
.hljs-number, .hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-attribute { color: #0550ae; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #8250df; }
.hljs-meta, .hljs-symbol { color: #953800; }
.hljs-deletion { color: #82071e; }
@media (prefers-color-scheme: dark) {
  .hljs-comment, .hljs-quote { color: #8b949e; }
  .hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type, .hljs-built_in { color: #ff7b72; }
  .hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: #a5d6ff; }
  .hljs-number, .hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-attribute { color: #79c0ff; }
  .hljs-title, .hljs-title.function_, .hljs-section { color: #d2a8ff; }
  .hljs-meta, .hljs-symbol { color: #ffa657; }
  .hljs-deletion { color: #ffdcd7; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
