/* Crewstack help site, in crewstack.io's palette: slate text, white and slate-50
   surfaces, slate-200 lines, and blue only for links and focus. It is a
   knowledge base, so the page stays quiet and the articles are set for
   reading. Light is the primary theme; dark follows the system setting.

   The support inbox loads this file too (scripts/build-inbox.ts) and builds on
   its tokens and on .wrap, .top, .brand, .btn, .badge, .search-header,
   .segmented, .crumbs and .count, so keep those when tidying. */

/* Söhne is crewstack.io's licensed typeface and isn't in the repository. Drop
   the licensed web files into public/fonts/ under these names and they are
   used; until then the build leaves out the faces whose file is missing, and
   Geist (OFL, self-hosted) takes over. */
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Italic-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --font: "Söhne", "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-strong: #1e293b;
  --text-body: #334155;
  --text-2: #475569;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --link: #2563eb;
  --link-strong: #1d4ed8;
  --focus: #2563eb;

  --chip-bg: #f1f5f9;
  --chip-fg: #334155;
  --warning-bg: #fef3c7;
  --warning-fg: #78350f;
  --shadow-menu: 0 4px 16px rgba(15, 23, 42, 0.08);

  /* Used only by the inbox. */
  --badge-bg: #dbeafe;
  --badge-fg: #1e40af;
  --row-hover: #93c5fd;
  --shadow-row: 0 12px 24px rgba(59, 130, 246, 0.1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617;
    --surface: #0f172a;
    --surface-2: #1e293b;
    --card: #0f172a;
    --text: #f1f5f9;
    --text-strong: #e2e8f0;
    --text-body: #cbd5e1;
    --text-2: #cbd5e1;
    --text-3: #94a3b8;
    --text-4: #64748b;
    --border: #1e293b;
    --border-soft: #1e293b;
    --border-strong: #334155;

    --link: #60a5fa;
    --link-strong: #93c5fd;
    --focus: #60a5fa;

    --chip-bg: #1e293b;
    --chip-fg: #cbd5e1;
    --warning-bg: #fcd34d;
    --warning-fg: #422006;
    --shadow-menu: 0 4px 16px rgba(0, 0, 0, 0.5);

    --badge-bg: rgba(59, 130, 246, 0.2);
    --badge-fg: #bfdbfe;
    --row-hover: #3b82f6;
    --shadow-row: 0 12px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

/* Base */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}
img { max-width: 100%; }
a { color: var(--link); }
a:hover { color: var(--link-strong); }
h1, h2, h3 { color: var(--text); }
.icon { flex: 0 0 auto; display: block; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: clamp(16px, 4vw, 32px); padding-right: clamp(16px, 4vw, 32px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: 6px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); color: #ffffff; }
.btn-outline { border: 2px solid var(--link); color: var(--link); background: transparent; }
.btn-outline:hover { border-color: var(--link-strong); color: var(--link-strong); }

.preview-bar {
  background: var(--warning-bg); color: var(--warning-fg); text-align: center;
  font-size: 14px; font-weight: 600; padding: 8px 16px;
}

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-fg); font-size: 13px; font-weight: 500; line-height: 1.4; white-space: nowrap;
}
.badge-draft { padding: 0 8px; background: var(--warning-bg); color: var(--warning-fg); font-size: 12px; font-weight: 600; vertical-align: 1px; }

.empty, .count { color: var(--text-3); }
.count { margin: 0 0 16px; font-size: 15px; }

/* Header */

.top { border-bottom: 1px solid var(--border); }
.top-inner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 24px; padding-top: 10px; padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand picture { display: flex; }
.brand img { display: block; height: 22px; width: auto; }
.brand-rule { width: 1px; height: 20px; background: var(--border-strong); }
.brand-label { font-size: 16px; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 12px; }

.lang { position: relative; font-size: 14px; color: var(--text-2); }
.lang summary, .lang-single { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; border-radius: 6px; }
.lang summary { list-style: none; cursor: pointer; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { color: var(--text); }
.lang .icon { color: var(--text-3); }
.lang details[open] summary .icon:last-child { transform: rotate(180deg); }
.lang-menu {
  position: absolute; z-index: 40; right: 0; top: calc(100% + 4px); min-width: 160px;
  margin: 0; padding: 4px; list-style: none; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-menu);
}
.lang-menu a, .lang-current {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px;
  font-size: 15px; color: var(--text); text-decoration: none;
}
.lang-menu a:hover { background: var(--surface-2); color: var(--text); }
.lang-current { font-weight: 600; }

/* Search */

.search { position: relative; }
.search-field { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-3); cursor: text; }
.search input {
  flex: 1 1 auto; min-width: 0; border: 0; padding: 0; outline: none; background: transparent;
  font: inherit; font-size: 16px; color: var(--text); -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.search-page, .search-header {
  display: flex; align-items: center; padding: 0 14px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 8px;
}
.search-page { max-width: 560px; height: 48px; margin: 24px 0 0; }
.search-page input { height: 46px; }
.search-header { flex: 1 1 280px; max-width: 400px; height: 44px; }
.search-header input { height: 42px; }

.search-results {
  position: absolute; z-index: 30; left: -1px; right: -1px; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; text-align: left; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-menu); max-height: 60vh; overflow: auto;
}
.search-results a {
  display: block; min-height: 44px; padding: 10px 12px; border-radius: 6px;
  color: var(--text); font-weight: 500; text-decoration: none; line-height: 1.4;
}
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.search-results small { display: block; margin-top: 2px; color: var(--text-3); font-size: 14px; font-weight: 400; }
.search-results .none { padding: 10px 12px; color: var(--text-3); }

/* Page title: home, collection, article and 404 */

.home, .page { padding-top: 8px; padding-bottom: 64px; }
.home { padding-top: clamp(32px, 5vw, 56px); }
.page-title h1 { margin: 0; font-size: clamp(28px, 3.4vw, 36px); line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
.page-title .lede { margin: 8px 0 0; max-width: 640px; font-size: 18px; line-height: 1.55; color: var(--text-2); }
.page-title .meta { margin: 12px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-3); }
.meta > span + span::before { content: "·" / ""; margin: 0 8px; }

/* Home: role filter and topics */

.role-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; margin-top: 16px; font-size: 14px; color: var(--text-3); }
.role-filter span { margin-right: 6px; }
.role-filter button {
  min-height: 44px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font: inherit; font-size: 14px; line-height: 1.2; cursor: pointer;
}
.role-filter button:hover { color: var(--text); }
.role-filter button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

.topics { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px 64px; margin-top: 32px; }
@media (min-width: 760px) {
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.topic { min-width: 0; padding-top: 16px; border-top: 1px solid var(--border); }
.topic h2 { margin: 0 0 4px; font-size: 18px; line-height: 1.35; font-weight: 600; }
.topic h2 a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; }
.topic h2 a:hover { color: var(--link); }
.topic-list { margin: 0; padding: 0; list-style: none; }
/* Show the first five articles the role filter leaves (TOPIC_LINKS in src/render.ts). */
.topic-list li:not([hidden]) ~ li:not([hidden]) ~ li:not([hidden]) ~ li:not([hidden]) ~ li:not([hidden]) ~ li:not([hidden]) { display: none; }
.topic-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 2px 0; line-height: 1.4; text-decoration: none; }
.topic-list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.topic-empty { margin: 4px 0 0; font-size: 15px; color: var(--text-3); }
.topic-count { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--text-3); text-decoration: none; }
.topic-count:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* Breadcrumb */

.crumbs { margin-bottom: 8px; font-size: 14px; color: var(--text-3); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs .icon { color: var(--text-4); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current] { color: var(--text-3); padding: 11px 0; line-height: 1.6; }

/* Collection page */

.guide-rows { max-width: 720px; margin: 32px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.guide-rows li { border-bottom: 1px solid var(--border); }
.guide-row { display: block; padding: 16px 0; color: var(--text-2); text-decoration: none; }
.guide-row h2 { margin: 0; font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--link); }
.guide-row:hover { color: var(--text-2); }
.guide-row:hover h2 { text-decoration: underline; text-underline-offset: 3px; }
.guide-row p { margin: 4px 0 0; font-size: 15px; line-height: 1.55; }
.guide-row .guide-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }

.contact-line { max-width: 720px; margin: 48px 0 0; padding-top: 20px; border-top: 1px solid var(--border); font-size: 15px; color: var(--text-2); }
.guide-rows + .contact-line { margin-top: 32px; padding-top: 0; border-top: 0; }

/* Article page */

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.article { min-width: 0; max-width: 720px; }
.article .page-title { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

/* "On this page" only where there is room beside the article. */
.toc { display: none; }
@media (min-width: 1000px) {
  .article-layout { grid-template-columns: minmax(0, 720px) 220px; justify-content: space-between; gap: 64px; }
  .toc { display: block; position: sticky; top: 24px; align-self: start; margin-top: 52px; }
}
.toc h2 { margin: 0 0 4px; font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--text-3); }
.toc ul { margin: 0; padding: 0; list-style: none; font-size: 14px; border-left: 1px solid var(--border); }
.toc a {
  display: flex; align-items: center; min-height: 44px; margin-left: -1px; padding: 4px 0 4px 12px;
  border-left: 2px solid transparent; line-height: 1.4; color: var(--text-2); text-decoration: none;
}
.toc a:hover { color: var(--link); }
.toc a[aria-current] { border-left-color: var(--text); color: var(--text); font-weight: 600; }

/* Article body */

.prose { font-size: 17px; line-height: 1.75; color: var(--text-body); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 16px; }
.prose h2 { margin: 40px 0 12px; font-size: 24px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; scroll-margin-top: 24px; }
.prose h3 { margin: 28px 0 8px; font-size: 19px; line-height: 1.35; font-weight: 600; scroll-margin-top: 24px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a strong { color: inherit; }
.prose a:hover { color: var(--link-strong); text-decoration-thickness: 2px; }
.prose ul { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 0 0 8px; }
.prose li::marker { color: var(--text-3); }
.prose li > p { margin: 0 0 8px; }
.prose li > :last-child { margin-bottom: 0; }
.prose li > ul, .prose li > ol { margin-top: 8px; }

/* Numbered steps: a plain numbered disc per step. */
.prose ol { counter-reset: step; list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.prose ol > li { counter-increment: step; position: relative; min-height: 28px; margin: 0; padding-left: 40px; }
.prose ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1;
}

.prose figure { margin: 24px 0 28px; }
.prose figure img { display: block; width: auto; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }
.prose figcaption { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--text-3); }
.prose a.zoom { display: block; width: fit-content; max-width: 100%; border-radius: 8px; cursor: zoom-in; }
.prose a.zoom:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
/* A how-to clip: full column width, 16:9 reserved before it loads. */
.prose figure.video video {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}

/* The enlarged screenshot (public/zoom.js). */
.zoom-dialog {
  max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; padding: 0;
  border: 0; background: transparent; color: #f8fafc;
}
.zoom-dialog[open] { display: grid; place-items: center; }
.zoom-dialog::backdrop { background: rgba(15, 23, 42, 0.86); }
.zoom-dialog figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 95vw; }
.zoom-dialog img {
  display: block; max-width: 95vw; max-height: calc(95vh - 48px); width: auto; height: auto;
  object-fit: contain; border-radius: 8px; background: #fff;
}
.zoom-dialog figcaption { max-width: 70ch; font-size: 14px; line-height: 1.5; text-align: center; color: #e2e8f0; }
.zoom-close {
  position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 999px; background: rgba(15, 23, 42, 0.72); color: #f8fafc; cursor: pointer;
}
.zoom-close:hover { background: rgba(15, 23, 42, 0.95); }
.zoom-close:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .zoom-dialog[open] img { animation: zoom-in 160ms ease-out; }
  @keyframes zoom-in { from { opacity: 0; transform: scale(0.97); } }
}
.prose .missing-shot div {
  display: grid; place-items: center; min-height: 140px; padding: 16px; font: 13px ui-monospace, monospace;
  color: var(--text-3); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 8px;
}

.prose table { display: block; overflow-x: auto; width: 100%; margin: 0 0 20px; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.prose th, .prose td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface); color: var(--text); font-weight: 600; }
.prose code { padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text); font-size: 0.9em; }
.prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--border); }

/* Callouts: OBS / Note / Hinweis (info) and Tip (lightbulb), told apart by the icon. */
.callout {
  position: relative; display: block; margin: 0 0 16px; padding: 14px 16px 14px 46px; border-radius: 8px;
  font-size: 16px; line-height: 1.65; background: var(--surface); border: 1px solid var(--border); color: var(--text-body);
}
.callout::before {
  content: ""; position: absolute; left: 16px; top: 17px; width: 18px; height: 18px; background: var(--text-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 7.5h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 7.5h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.callout > strong:first-child { color: var(--text); }
.callout-tip::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 21h4'/%3E%3Cpath d='M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 21h4'/%3E%3Cpath d='M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
}

/* Footer */

.foot { border-top: 1px solid var(--border); }
.foot-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; padding-top: 4px; padding-bottom: 4px; font-size: 14px; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-3); text-decoration: none; }
.foot a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* Small screens */

@media (max-width: 999px) {
  .top-inner.has-search .search-header { order: 3; flex-basis: 100%; max-width: none; }
}

@media (max-width: 640px) {
  .top-inner { padding-top: 6px; padding-bottom: 10px; }
  .brand { gap: 10px; }
  .brand img { height: 20px; }
  .page-title .lede { font-size: 17px; }
  .prose { font-size: 16px; }
  .prose h2 { font-size: 22px; margin-top: 32px; }
  .callout { font-size: 15px; }
  /* On a phone the title right below repeats the current page, so the trail
     stops at its parent instead of wrapping onto a second line. */
  .article-page .crumbs li:last-child { display: none; }
}
