/* Skyport documentation. Layout after docs.netbird.io (top tabs, grouped
   sidebar, "On this page" rail); zinc neutrals as on docs.authkestra.com,
   Skyport red accent and IBM Plex from the console. */

@font-face { font-family: "Plex Sans"; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --base-100: #ffffff;
  --base-200: #f4f4f5;
  --base-300: #e4e4e7;
  --content: #09090b;
  --muted: #71717a;
  --primary: #c63f38;
  --primary-content: #ffffff;
  --tint: #fdf0ef;
  --tint-line: #f4cfcc;
  --hl: rgb(198 63 56 / 0.07);
  --sans: "Plex Sans", system-ui, sans-serif;
  --mono: "Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --base-100: #09090b; --base-200: #18181b; --base-300: #27272a;
    --content: #fafafa; --muted: #a1a1aa; --primary: #e2564e; --primary-content: #ffffff;
    --tint: #1f1314; --tint-line: #4a2421; --hl: rgb(226 86 78 / 0.10);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --base-100: #09090b; --base-200: #18181b; --base-300: #27272a;
  --content: #fafafa; --muted: #a1a1aa; --primary: #e2564e; --primary-content: #ffffff;
  --tint: #1f1314; --tint-line: #4a2421; --hl: rgb(226 86 78 / 0.10);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--base-100); color: var(--content); font: 400 clamp(15px, 0.86rem + 0.18vw, 16.5px)/1.7 var(--sans); }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--base-200); border: 1px solid var(--base-300); border-radius: 5px; padding: 0 5px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 60; background: var(--base-100); padding: 8px 12px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 16px; background: var(--base-100); border-bottom: 1px solid var(--base-300); }
@media (min-width: 720px) { .topbar { padding: 0 24px; } }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 17px; }
@media (min-width: 1024px) { .brand { width: calc(clamp(232px, 19vw, 290px) - 24px); } }
.brand img { width: 28px; height: 28px; }
.brand .tag { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--primary); background: var(--tint); border: 1px solid var(--tint-line); border-radius: 6px; padding: 1px 7px; }
.tabs { display: flex; gap: 4px; }
.tabs a { position: relative; padding: 6px 10px; font-size: 14px; color: var(--muted); text-decoration: none; border-radius: 6px; }
.tabs a:hover { color: var(--content); }
.tabs a[aria-current="page"] { color: var(--content); font-weight: 500; }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -15px; height: 2px; background: var(--primary); }
@media (max-width: 640px) { .tabs { display: none; } }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.theme { display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
.theme button { background: none; border: 0; padding: 2px; color: inherit; font: inherit; cursor: pointer; }
.theme button[aria-pressed="true"] { color: var(--content); font-weight: 600; }
.theme span { opacity: 0.6; }
@media (max-width: 900px) { .theme { display: none; } }
.lang { display: inline-flex; border: 1px solid var(--base-300); border-radius: 8px; overflow: hidden; font-size: 13px; font-weight: 600; }
.lang a, .lang span { padding: 5px 10px; text-decoration: none; }
.lang span { background: var(--content); color: var(--base-100); }
.btn { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 8px; font-weight: 500; font-size: 14px; text-decoration: none; background: var(--primary); color: var(--primary-content); white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
@media (max-width: 480px) { .top-right .btn { display: none; } }
.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--base-300); border-radius: 8px; background: none; color: inherit; cursor: pointer; }
@media (min-width: 1024px) { .menu-btn { display: none; } }

/* Three columns: sidebar, article, "On this page" */
.layout { display: grid; }
@media (min-width: 1024px) { .layout { grid-template-columns: clamp(232px, 19vw, 290px) minmax(0, 1fr); } }
@media (min-width: 1240px) { .layout { grid-template-columns: clamp(232px, 19vw, 290px) minmax(0, 1fr) clamp(200px, 17vw, 260px); } }

.sidebar { border-right: 1px solid var(--base-300); padding: 20px 16px 40px; background: var(--base-100); }
@media (min-width: 1024px) { .sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; } }
@media (max-width: 1023px) {
  .sidebar { position: fixed; top: 64px; bottom: 0; left: 0; width: min(300px, 86vw); z-index: 30; overflow-y: auto; transform: translateX(-105%); transition: transform 180ms ease; }
  .menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.4); }
}
.group { margin-bottom: 18px; }
.group summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 4px 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--content); border-radius: 6px; }
.group summary::-webkit-details-marker { display: none; }
.group summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin: -3px 4px 0 0; transition: transform 150ms; }
.group:not([open]) summary::after { transform: rotate(-45deg); margin-top: 0; }
.group ul { list-style: none; margin: 8px 0 0 8px; padding: 0 0 0 12px; border-left: 1px solid var(--base-300); }
.group li > a, .group li > span { display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin-left: -13px; border-left: 2px solid transparent; font-size: 14px; color: var(--muted); text-decoration: none; border-radius: 0 6px 6px 0; }
.group li a:hover { color: var(--content); background: var(--base-200); }
.group li a[aria-current="page"] { color: var(--content); font-weight: 500; background: var(--base-200); border-left-color: var(--primary); }
.group li > span { opacity: 0.7; cursor: default; }
.soon { margin-left: auto; font-size: 11px; border: 1px solid var(--base-300); border-radius: 999px; padding: 0 7px; line-height: 1.6; }

/* Article */
.article { min-width: 0; padding: clamp(28px, 4vw, 52px) clamp(16px, 4vw, 56px) 96px; }
.article > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.article h1 { margin: 0 0 4px; font-size: clamp(27px, 1.4rem + 1.2vw, 38px); line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.updated { margin: 0 0 28px; font-size: 13px; color: var(--muted); }
.article h2 { position: relative; margin: clamp(36px, 5vw, 52px) 0 12px; font-size: clamp(19px, 1rem + 0.6vw, 23px); transition: color 200ms; line-height: 1.3; font-weight: 600; }
.article h3 { margin: 32px 0 8px; font-size: 17px; font-weight: 600; }
.article p, .article li { color: var(--content); }
.article p { margin: 0 0 16px; }
.article .intro { font-size: 16px; color: var(--muted); }
.anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

.callout { display: flex; gap: 12px; margin: 0 0 24px; padding: 14px 16px; border: 1px solid var(--tint-line); background: var(--tint); border-radius: 10px; font-size: 14px; }
.callout svg { color: var(--primary); margin-top: 3px; }
.callout p { margin: 0; }

ol.steps { list-style: none; counter-reset: step; margin: 0 0 24px; padding: 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 0 12px 18px 56px; margin-left: -12px; border-radius: 10px; transition: background 160ms; }
ol.steps > li::before { content: counter(step); position: absolute; left: 12px; top: 2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--sans); background: var(--base-200); border: 1px solid var(--base-300); transition: background 160ms, border-color 160ms, color 160ms; }
ol.steps > li::after { content: ""; position: absolute; left: 26px; top: 34px; bottom: 4px; width: 1px; background: var(--base-300); }
ol.steps > li:last-child::after { display: none; }
ol.steps strong { font-weight: 600; }
.article ul.plain { margin: 0 0 16px; padding-left: 20px; }

table.ref { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 14px; }
table.ref th { text-align: left; font-weight: 600; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--base-300); }
table.ref td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--base-300); vertical-align: top; }

.cards { display: grid; gap: 14px; margin: 0 0 24px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--base-300); border-radius: 10px; padding: 16px; text-decoration: none; }
a.card:hover { border-color: var(--muted); }
.card-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.card-head .i { color: var(--primary); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
div.card { opacity: 0.75; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--base-300); }
.pager a { display: grid; gap: 2px; text-decoration: none; padding: 10px 14px; border: 1px solid var(--base-300); border-radius: 10px; min-width: 40%; }
.pager a:hover { border-color: var(--muted); }
.pager small { color: var(--muted); font-size: 12px; }
.pager .next { margin-left: auto; text-align: right; }

/* On this page */
.rail { display: none; }
@media (min-width: 1240px) { .rail { display: block; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 48px 24px 24px 0; font-size: 14px; } }
.rail button { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.rail button:hover { color: var(--content); }
.rail-head { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 10px; font-weight: 600; }
.rail-head a { font-size: 12px; font-weight: 400; color: var(--muted); text-decoration: none; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--content); }
.toc a.active { color: var(--primary); }
.toc .sub a { padding-left: 16px; }

footer.site { border-top: 1px solid var(--base-300); padding: 20px 0 0; margin-top: 48px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--content); }

/* Screenshots */
figure.shot { margin: 8px 0 28px; }
figure.shot a { display: block; border: 1px solid var(--base-300); border-radius: 10px; overflow: hidden; background: var(--base-200); cursor: zoom-in; transition: border-color 160ms, box-shadow 160ms; }
figure.shot a:hover { border-color: var(--muted); box-shadow: 0 8px 28px -12px rgb(0 0 0 / 0.35); }
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.article dl { margin: 0 0 20px; }
.article dt { font-weight: 600; margin-top: 12px; }
.article dd { margin: 2px 0 0; color: var(--muted); }
pre { margin: 0 0 20px; padding: 14px 16px; background: var(--base-200); border: 1px solid var(--base-300); border-radius: 10px; overflow-x: auto; font: 13px/1.6 var(--mono); }
pre code { background: none; border: 0; padding: 0; }

/* Light or dark screenshot, following the docs' theme. */
figure.shot img.dark { display: none; }
:root[data-theme="dark"] figure.shot img.dark { display: block; }
:root[data-theme="dark"] figure.shot img.light:has(+ img.dark) { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) figure.shot img.dark { display: block; }
  :root:not([data-theme="light"]) figure.shot img.light:has(+ img.dark) { display: none; }
}

/* Reading highlights: the section in view, the hovered step, a followed link. */
.article h2::before { content: ""; position: absolute; left: -18px; top: 0.2em; bottom: 0.2em; width: 3px; border-radius: 3px; background: var(--primary); transform: scaleY(0); transition: transform 220ms ease; }
.article h2.reading::before { transform: scaleY(1); }
@media (max-width: 720px) { .article h2::before { left: -10px; } }
ol.steps > li:hover, ol.steps > li:focus-within { background: var(--hl); }
ol.steps > li:hover::before, ol.steps > li:focus-within::before { background: var(--primary); border-color: var(--primary); color: var(--primary-content); }
.article ul.plain > li:hover::marker { color: var(--primary); }
.article :target { animation: flash 1.6s ease-out; border-radius: 6px; }
@keyframes flash { 0%, 30% { background: var(--hl); box-shadow: 0 0 0 8px var(--hl); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }

/* Fit: tables scroll inside themselves, screenshots open full size. */
.table-wrap { overflow-x: auto; margin: 0 0 24px; }
.table-wrap table.ref { margin: 0; min-width: 480px; }
dialog.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
dialog.lightbox::backdrop { background: rgb(9 9 11 / 0.82); }
dialog.lightbox img { display: block; max-width: 96vw; max-height: 94vh; border-radius: 10px; }
dialog.lightbox button { position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #27272a; color: #fafafa; font-size: 20px; cursor: pointer; }

/* Sections ease in once. Only when the running script opts in (.reveal),
   so content is never hidden when the script is missing, stale or fails. */
@media (prefers-reduced-motion: no-preference) {
  .reveal .article > :is(h2, h3, p, ol, ul, dl, figure, pre, .callout, .cards, .table-wrap) { opacity: 0; transform: translateY(10px); transition: opacity 420ms ease, transform 420ms ease; }
  .reveal .article > .seen { opacity: 1; transform: none; }
}
