/* 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; }
/* One base size that follows the screen: about 15.5px on a laptop, 20px on
   a large monitor. Font sizes and the text column are in rem, so the whole
   page grows with it instead of leaving a narrow column on a wide screen. */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; font-size: clamp(15px, 0.6rem + 0.42vw, 20px); }
body { margin: 0; background: var(--base-100); color: var(--content); font: 400 1rem/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: 1.062rem; }
@media (min-width: 1024px) { .brand { width: calc(clamp(220px, 17vw, 18rem) - 24px); } }
.brand img { width: 28px; height: 28px; }
.brand .tag { font-size: 0.6875rem; 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: 0.875rem; 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: 0.8125rem; 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: 0.8125rem; 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: 0.875rem; text-decoration: none; background: var(--primary); color: var(--primary-content); white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: none; color: var(--content); border: 1px solid var(--base-300); }
.btn.ghost:hover { filter: none; border-color: var(--muted); }
@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(220px, 17vw, 18rem) minmax(0, 1fr); } }
@media (min-width: 1240px) { .layout { grid-template-columns: clamp(220px, 17vw, 18rem) minmax(0, 1fr) clamp(180px, 13vw, 15rem); } }

.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: 0.75rem; 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: 0.875rem; 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: 0.6875rem; 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, 2.6vw, 40px) 96px; }
/* The text takes about two thirds of a wide screen. */
.article > * { max-width: 72rem; margin-left: auto; margin-right: auto; }
.article h1 { margin: 0 0 4px; font-size: clamp(1.7rem, 1.2rem + 1.1vw, 2.45rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.updated { margin: 0 0 28px; font-size: 0.8125rem; color: var(--muted); }
.article h2 { position: relative; margin: clamp(36px, 5vw, 52px) 0 12px; font-size: clamp(1.2rem, 1rem + 0.35vw, 1.5rem); transition: color 200ms; line-height: 1.3; font-weight: 600; }
.article h3 { margin: 32px 0 8px; font-size: 1.062rem; font-weight: 600; }
.article p, .article li { color: var(--content); }
.article p { margin: 0 0 16px; }
.article .intro { font-size: 1rem; 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: 0.875rem; }
.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 0.8125rem/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: 0.875rem; }
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: 0.875rem; }
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: 0.75rem; }
.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: 0.875rem; } }
.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: 0.75rem; 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: 0.8125rem; 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: 0.8125rem; 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: 0.8125rem/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: 1.25rem; 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, .block) { opacity: 0; transform: translateY(10px); transition: opacity 420ms ease, transform 420ms ease; }
  .reveal .article > .seen { opacity: 1; transform: none; }
}

/* Task blocks: what it is for, before you start, what you should see, if
   something goes wrong. Same shape as the callout, a colour each. */
.block { margin: 0 0 24px; padding: 14px 16px; border: 1px solid var(--base-300); border-left-width: 3px; border-radius: 10px; font-size: 0.9062rem; background: var(--base-100); }
.block p, .block ul, .block dl { margin: 0; }
.block .block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; font-size: 0.8125rem; }
.block ul { padding-left: 20px; }
.block li + li { margin-top: 4px; }
.block dt { margin-top: 10px; }
.block dt:first-child { margin-top: 0; }
.block.purpose { border-left-color: var(--muted); background: var(--base-200); }
.block.before { border-left-color: #2563eb; }
.block.before .block-head svg { color: #2563eb; }
.block.result { border-left-color: #16a34a; }
.block.result .block-head svg { color: #16a34a; }
.block.trouble { border-left-color: #d97706; }
.block.trouble .block-head svg { color: #d97706; }
.callout.warn { border-color: #f5c48a; background: #fff7ec; }
.callout.warn svg { color: #d97706; }
:root[data-theme="dark"] .callout.warn { border-color: #5a3d14; background: #1f1708; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .callout.warn { border-color: #5a3d14; background: #1f1708; } }
.block pre, ol.steps pre { margin: 8px 0 4px; }

/* Screenshot legend: the numbers drawn on the picture by _src/capture. */
ol.legend { list-style: none; counter-reset: mark; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 0.875rem; }
ol.legend > li { counter-increment: mark; position: relative; padding-left: 36px; min-height: 24px; }
ol.legend > li::before { content: counter(mark); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 0.75rem/1 var(--sans); background: #e11d48; color: #fff; }

/* Home and guide index groups */
.cards-group { margin: 32px 0 12px !important; font-size: 0.8125rem !important; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
kbd { font: 0.75rem/1 var(--mono); padding: 2px 6px; border: 1px solid var(--base-300); border-bottom-width: 2px; border-radius: 5px; background: var(--base-200); }
dl.glossary dt { scroll-margin-top: 80px; }

/* Search */
.search-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; min-width: 0; width: min(280px, 28vw); border: 1px solid var(--base-300); border-radius: 8px; background: var(--base-200); color: var(--muted); font: inherit; font-size: 0.875rem; cursor: pointer; }
.search-btn:hover { border-color: var(--muted); color: var(--content); }
.search-btn span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 760px) { .search-btn { width: 36px; padding: 0; justify-content: center; } .search-btn span, .search-btn kbd { display: none; } }
dialog.search { width: min(640px, calc(100vw - 32px)); max-height: min(70vh, 640px); margin: 10vh auto auto; padding: 0; border: 1px solid var(--base-300); border-radius: 12px; background: var(--base-100); color: var(--content); box-shadow: 0 24px 64px -16px rgb(0 0 0 / 0.45); overflow: hidden; }
dialog.search[open] { display: flex; flex-direction: column; }
dialog.search::backdrop { background: rgb(9 9 11 / 0.5); }
.search-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--base-300); }
.search-head input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: inherit; font: inherit; font-size: 1rem; }
.search-head button { border: 1px solid var(--base-300); border-radius: 6px; background: var(--base-200); color: var(--muted); font: 0.75rem var(--mono); padding: 3px 7px; cursor: pointer; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--hl); }
.search-results .r-title { font-weight: 600; font-size: 0.9062rem; }
.search-results .r-page { color: var(--muted); font-weight: 400; }
.search-results .r-text { margin-top: 2px; font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }
.search-results mark { background: none; color: var(--primary); font-weight: 600; }
.search-empty { margin: 0; padding: 16px 18px 20px; font-size: 0.875rem; color: var(--muted); }
.search-empty:empty { display: none; }
.search-head input::-webkit-search-cancel-button { display: none; }
/* A cropped screenshot (one wizard section) is shown at its natural size,
   never blown up; a diagram sits on white in both themes. */
figure.shot.part > a { width: fit-content; max-width: 100%; }
figure.shot.part img { width: auto; max-width: 100%; }
figure.shot.diagram > a { background: #fff; }
