/* The Bosun help centre. Tokens are Bosunkit's, as on bosun.bot (site/src/index.css): the Dusk palette for the dark
   scheme, Day for the light one. Keep the values in step with the site. */
:root {
  color-scheme: dark;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
  --bg: #070b10;
  --bg2: #0b1117;
  --surface: #0d141b;
  --surface2: #121b24;
  --surface-elevated: #18222c;
  --border: #1f2a35;
  --border-bright: #2a3844;
  --text: #e6edf2;
  --text-dim: #8c9aa8;
  --accent: #14b8a6;
  --accent-text: var(--accent);
  --accent-dim: color-mix(in srgb, var(--accent) 10%, transparent);
  --amber: #f59e0b;
  --amber-text: var(--amber);
  --amber-dim: color-mix(in srgb, var(--amber) 10%, transparent);
  --red: #ef4444;
  --red-text: #f87171;
  --red-dim: color-mix(in srgb, var(--red) 10%, transparent);
  --blue: #3b82f6;
  --blue-dim: color-mix(in srgb, var(--blue) 10%, transparent);
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --motion-fast: 120ms;
  --easing: cubic-bezier(0.2, 0, 0, 1);
  --target: 48px;
  --focus-ring: var(--accent-text);
  --mark: color-mix(in srgb, var(--accent) 28%, transparent);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f2f3f5;
    --bg2: #e9ebee;
    --surface: #ffffff;
    --surface2: #f6f7f9;
    --surface-elevated: #ffffff;
    --border: #d5d8dd;
    --border-bright: #b9bec6;
    --text: #17181c;
    --text-dim: #5b6068;
    --accent: #0d9488;
    --accent-text: rgb(13, 100, 94);
    --accent-dim: color-mix(in srgb, var(--accent) 8%, transparent);
    --amber: #d97706;
    --amber-text: #b45309;
    --amber-dim: color-mix(in srgb, var(--amber) 8%, transparent);
    --red: #dc2626;
    --red-text: #b91c1c;
    --red-dim: color-mix(in srgb, var(--red) 8%, transparent);
    --blue: #2563eb;
    --blue-dim: color-mix(in srgb, var(--blue) 8%, transparent);
    --mark: color-mix(in srgb, var(--accent) 22%, transparent);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-family: var(--font-body); color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); line-height: 1.5; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
::selection { background: var(--mark); }
:where(a, button, input, summary):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-md); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 200; padding: 12px 16px; background: var(--surface-elevated); border: 1px solid var(--border-bright); border-radius: var(--radius-lg); color: var(--text); font-weight: 600; font-size: 14px; }
.skip-link:focus { top: 8px; text-decoration: none; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 32px); }
.container--narrow { max-width: 820px; }

.label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: var(--accent-text); }

/* Masthead: brand bar, then the search band. */
.masthead { position: relative; z-index: 2; background: radial-gradient(640px circle at 88% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%), var(--bg); }
.masthead__bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--target); color: inherit; }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--accent); flex-shrink: 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name { font-family: var(--font-mono); font-size: 14px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-text); }
.brand__tagline { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text); margin-top: 4px; }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border-bright); background: var(--surface); color: var(--text-dim); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color var(--motion-fast), border-color var(--motion-fast); }
.pill:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

.hero { position: relative; max-width: 720px; margin: 0 auto; padding: clamp(40px, 8vw, 88px) 0 clamp(48px, 8vw, 96px); text-align: center; }
.hero--compact { padding: 8px 0 28px; max-width: 760px; }
.hero__title { font-size: clamp(32px, 5.5vw, 52px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; margin: 12px 0 14px; }
.hero__sub { color: var(--text-dim); font-size: clamp(16px, 2vw, 18px); max-width: 560px; margin: 0 auto 32px; }

/* Search box and instant results. */
.search { position: relative; text-align: left; }
.search__field { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border-bright); border-radius: var(--radius-xl); transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
.search__field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.search__input { flex: 1; min-width: 0; min-height: 56px; padding: 0 18px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; }
.search--compact .search__input { min-height: var(--target); font-size: 16px; }
.search__input::placeholder { color: var(--text-dim); }
.search__input:focus { outline: none; }
.search__input::-webkit-search-cancel-button { filter: grayscale(1); }
.search__button { display: inline-flex; align-items: center; justify-content: center; width: 56px; border: 0; border-left: 1px solid var(--border); border-radius: 0 var(--radius-xl) var(--radius-xl) 0; background: transparent; color: var(--text-dim); cursor: pointer; }
.search--compact .search__button { width: var(--target); }
.search__button:hover { color: var(--accent-text); }
.search__results { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 8px); list-style: none; padding: 6px; max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface-elevated); border: 1px solid var(--border-bright); border-radius: var(--radius-xl); box-shadow: 0 18px 48px rgba(0, 0, 0, .28); }
.search__results li > a, .search__results .search__msg { display: block; padding: 10px 12px; border-radius: var(--radius-lg); color: var(--text); }
.search__results li > a:hover, .search__results li[aria-selected="true"] > a { background: var(--accent-dim); text-decoration: none; }
.search__results .s-where { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }
.search__results .s-title { display: block; font-weight: 600; margin-top: 2px; }
.search__results .s-snippet { display: block; font-size: 14px; color: var(--text-dim); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search__results .search__msg { color: var(--text-dim); font-size: 14px; }
.search__results .search__all { font-size: 14px; font-weight: 600; color: var(--accent-text); border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

/* The content band below the masthead. */
.band { flex: 1; background: var(--bg2); border-top: 1px solid var(--border); padding: clamp(32px, 6vw, 64px) 0 clamp(48px, 8vw, 88px); }

/* Home: category cards. */
.cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; padding: 40px 28px 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); color: inherit;
  transition: border-color var(--motion-fast) var(--easing), transform var(--motion-fast) var(--easing); }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.card__icon { color: var(--accent); margin-bottom: 20px; }
.card__title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.card__desc { margin-top: 8px; color: var(--text-dim); font-size: 15px; }
.card__count { margin-top: auto; padding-top: 20px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }

.section-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 16px; }
.start { margin-top: 56px; }
.article-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.article-tile { display: flex; gap: 12px; align-items: flex-start; height: 100%; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); transition: border-color var(--motion-fast); }
.article-tile:hover { border-color: var(--accent); text-decoration: none; }
.article-tile svg { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.article-tile__title { display: block; font-weight: 600; }
.article-tile__summary { display: block; margin-top: 4px; color: var(--text-dim); font-size: 14px; }

/* Contact panel. */
.contact { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 56px; padding: 24px 28px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-xl); }
.contact__title { font-size: 18px; font-weight: 600; }
.contact__text { color: var(--text-dim); margin-top: 4px; font-size: 15px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: var(--target); padding: 0 22px; border-radius: var(--radius-lg); border: 1px solid transparent; background: var(--accent-text); color: var(--bg); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: opacity var(--motion-fast), border-color var(--motion-fast); white-space: nowrap; }
.button:hover { opacity: .88; text-decoration: none; }
.button--ghost { background: var(--surface); color: var(--text); border-color: var(--border-bright); min-width: 88px; }
.button--ghost:hover { border-color: var(--accent); opacity: 1; }

/* Breadcrumbs. */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 14px; color: var(--text-dim); margin-bottom: 28px; }
.crumbs li + li::before { content: '›'; margin: 0 10px; color: var(--text-dim); }
.crumbs a { color: var(--text-dim); }
.crumbs a:hover { color: var(--accent-text); }
.crumbs [aria-current] { color: var(--text); }

/* Sidebar + main column. */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 40px; align-items: start; }
.sidebar { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; padding-right: 4px; }
.sidebar > ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sidebar details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.sidebar summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--target); padding: 0 14px; font-weight: 600; font-size: 15px; cursor: pointer; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary .chev { color: var(--text-dim); flex-shrink: 0; transition: transform var(--motion-fast) var(--easing); }
.sidebar details[open] summary .chev { transform: rotate(90deg); }
.sidebar__sections { list-style: none; padding: 0 8px 10px; }
.sidebar__sections > li > a { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: var(--radius-md); color: var(--text-dim); font-size: 14px; }
.sidebar__sections > li > a:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.sidebar__sections > li.is-current > a { color: var(--text); font-weight: 600; }
.sidebar__articles { list-style: none; margin: 2px 0 6px 10px; border-left: 1px solid var(--border-bright); }
.sidebar__articles a { display: block; padding: 7px 10px 7px 14px; font-size: 14px; color: var(--text-dim); line-height: 1.35; margin-left: -1px; border-left: 2px solid transparent; }
.sidebar__articles a:hover { color: var(--text); text-decoration: none; }
.sidebar__articles a[aria-current="page"] { color: var(--accent-text); border-left-color: var(--accent); font-weight: 500; }

.page-head { margin-bottom: 28px; }
.page-head__title { font-size: clamp(28px, 4vw, 38px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.page-head__lede { margin-top: 14px; font-size: clamp(17px, 2vw, 20px); line-height: 1.55; color: var(--text-dim); max-width: 64ch; }
.page-head__meta { margin-top: 14px; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); letter-spacing: .04em; }

/* Category page. */
.topic { padding: 24px 0; border-top: 1px solid var(--border); scroll-margin-top: 16px; }
.topic__title { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.topic__list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 24px; }
.topic__list a, .related a { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; color: var(--text); font-size: 16px; }
.topic__list a svg, .related a svg { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.topic__list a:hover span, .related a:hover span { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.topic__list a:hover, .related a:hover { text-decoration: none; }

/* Article. */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: clamp(24px, 4vw, 44px); }
.toc { margin: 0 0 28px; padding: 16px 20px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.toc__title { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.toc ol { padding-left: 20px; columns: 2 240px; column-gap: 32px; font-size: 15px; }
.toc li { padding: 3px 0; break-inside: avoid; }
.toc li::marker { color: var(--text-dim); font-size: 13px; }
.toc--letters ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
.toc--letters li { padding: 0; }
.toc--letters a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border: 1px solid var(--border-bright); border-radius: var(--radius-md); background: var(--surface); font-family: var(--font-mono); font-weight: 600; }
.toc--letters a:hover { border-color: var(--accent); text-decoration: none; }

.prose { font-size: 17px; line-height: 1.7; max-width: 72ch; }
.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 1.9em; font-size: 24px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; scroll-margin-top: 16px; }
.prose h3 { margin-top: 1.5em; font-size: 19px; font-weight: 600; line-height: 1.3; scroll-margin-top: 16px; }
.prose h4, .prose h5, .prose h6 { margin-top: 1.3em; font-size: 17px; font-weight: 600; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .5em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: .35em; }
.prose li > ul, .prose li > ol { margin-top: .35em; }
.prose li::marker { color: var(--accent); }
.prose ol > li::marker { font-family: var(--font-mono); font-size: .9em; font-weight: 600; }
.prose code { font-family: var(--font-mono); font-size: .86em; background: var(--surface2); border: 1px solid var(--border); padding: 1px 5px; border-radius: var(--radius-sm); }
.prose pre { background: var(--surface2); border: 1px solid var(--border-bright); border-radius: var(--radius-lg); padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose blockquote { border-left: 2px solid var(--border-bright); padding-left: 16px; color: var(--text-dim); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.prose th { background: var(--surface2); font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); text-align: left; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }

.callout { padding: 14px 18px; border-radius: var(--radius-lg); border: 1px solid; border-left-width: 4px; font-size: 16px; }
.callout > * + * { margin-top: .5em; }
.callout__label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.callout--note { background: var(--blue-dim); border-color: color-mix(in srgb, var(--blue) 35%, transparent); border-left-color: var(--blue); }
.callout--note .callout__label { color: var(--blue); }
.callout--tip { background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 35%, transparent); border-left-color: var(--accent); }
.callout--tip .callout__label { color: var(--accent-text); }
.callout--warning { background: var(--amber-dim); border-color: color-mix(in srgb, var(--amber) 40%, transparent); border-left-color: var(--amber); }
.callout--warning .callout__label { color: var(--amber-text); }

.article__foot { margin-top: 44px; }
.feedback { display: flex; padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); scroll-margin-top: 16px; }
.feedback__form { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; width: 100%; }
.feedback__question { font-weight: 600; }
.feedback__buttons { display: flex; gap: 10px; }
.feedback__thanks { color: var(--accent-text); font-weight: 500; }
.related { margin-top: 32px; }
.related__title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.related ul { list-style: none; }
.article .contact { margin-top: 32px; background: var(--surface2); }

/* Search results page. */
.search-heading { margin-bottom: 24px; font-size: clamp(24px, 3.4vw, 32px); }
.results { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.result { padding: 18px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.result__where { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.result__title { font-size: 18px; font-weight: 600; margin-top: 4px; }
.result__snippet { margin-top: 6px; color: var(--text-dim); font-size: 15px; }
.empty { color: var(--text-dim); }
.empty__cats { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.empty__cats a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--border-bright); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 15px; }
.empty__cats a:hover { border-color: var(--accent); text-decoration: none; }

/* Footer. */
.site-footer { background: var(--bg); border-top: 1px solid var(--border); }
.site-footer__inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px 48px; flex-wrap: wrap; padding-top: 40px; padding-bottom: 28px; }
.site-footer__logo { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); }
.site-footer__logo:hover { text-decoration: none; }
.site-footer__wordmark { display: block; font-family: var(--font-mono); font-size: 15px; font-weight: 700; letter-spacing: 2px; color: var(--text); line-height: 1.1; }
.site-footer__tagline { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); }
.site-footer__promise { margin-top: 12px; font-size: 14px; color: var(--text-dim); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.site-footer__links a { display: inline-flex; align-items: center; min-height: 40px; font-size: 14px; color: var(--text-dim); }
.site-footer__links a:hover { color: var(--text); text-decoration: none; }
.site-footer__bar { padding: 16px 0 28px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 24px; }
  /* On narrow screens the index follows the article, as a plain list, rather than pushing it down. */
  .sidebar { position: static; max-height: none; overflow: visible; order: 2; }
  .article { padding: 22px 18px; }
}
@media (max-width: 520px) {
  .masthead__bar { min-height: 64px; }
  .pill { padding: 0 14px; font-size: 13px; }
  .hero { text-align: left; }
  .hero__sub { margin-left: 0; }
  .contact { padding: 20px; }
  .contact .button { width: 100%; }
  .prose { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
