/* =========================================================
   Shipgeek Docs — shared stylesheet
   Design tokens live at the top as CSS variables so the
   developer can retheme by editing this block only.
   ========================================================= */

:root {
  /* -- Color: dark console theme (default) -- */
  --bg: #0a0e12;
  --bg-raised: #12171d;
  --bg-sunken: #171d24;
  --border: #232b33;
  --border-soft: #1a2027;
  --text: #e7ecf0;
  --text-secondary: #97a3af;
  --text-faint: #5c6773;

  --accent: #34d399;        /* signal green — "automatic / go" */
  --accent-soft: #10261e;
  --beacon: #ffb020;        /* amber — signal / active-state accent */
  --beacon-soft: #2a2010;
  --danger: #f0654f;
  --danger-soft: #2a1512;

  --code-bg: #05070a;       /* terminal black */
  --code-text: #e7ecf0;
  --terminal-bar: #171d24;

  /* -- Type -- */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* -- Layout -- */
  --sidebar-w: 272px;
  --toc-w: 220px;
  --topbar-h: 64px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* -- Color: light alternative (via theme toggle) -- */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-raised: #f6f7f9;
  --bg-sunken: #eef0f3;
  --border: #e2e5ea;
  --border-soft: #ecefF2;
  --text: #14171a;
  --text-secondary: #5b6472;
  --text-faint: #8a94a3;

  --accent: #1d6d63;
  --accent-soft: #e4f0ee;
  --beacon: #d98e2b;
  --beacon-soft: #fbf0dd;
  --danger: #b3432d;
  --danger-soft: #f8e9e5;

  --code-bg: #0f1720;
  --code-text: #e7ecf1;
  --terminal-bar: #1c2530;

  --shadow: 0 1px 2px rgba(20, 23, 26, 0.04), 0 4px 12px rgba(20, 23, 26, 0.04);
}

/* -- Reset -- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }

/* -- Anchor scroll offset --
   The topbar is fixed, so a bare #anchor jump hides the heading behind
   it. Offset every linkable element by the topbar height plus a bit of
   breathing room, so the heading lands just below the bar. */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: calc(var(--topbar-h) + 2.5rem); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.figure {
  margin: 0 0 1.4em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.figure img { border-bottom: 1px solid var(--border); }
.figure figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible {
  outline: 2px solid var(--beacon);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 0.5em;
}
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.375rem; margin-top: 2.25em; }
h3 { font-size: 1.1rem; margin-top: 1.75em; }
p { margin: 0 0 1.1em; color: var(--text); }
p.lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
}
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: 0.4em; }
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.4em;
}
pre {
  position: relative;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.1rem 1rem;
  overflow-x: auto;
  margin: 0 0 1.4em;
}
pre::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2rem;
  background-color: var(--terminal-bar);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background-image:
    radial-gradient(circle at 16px 1rem, var(--text-faint) 4px, transparent 4.5px),
    radial-gradient(circle at 32px 1rem, var(--text-faint) 4px, transparent 4.5px),
    radial-gradient(circle at 48px 1rem, var(--text-faint) 4px, transparent 4.5px);
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: inherit;
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

/* -- Skip link (a11y) -- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--beacon);
  color: #14171a;
  padding: 0.5em 1em;
  z-index: 200;
}
.skip-link:focus { left: 1em; top: 1em; }

/* -- Top bar -- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  min-width: var(--sidebar-w);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.topbar__brand:hover { text-decoration: none; }
.brand-mark {
  width: 24px; height: 24px;
  flex-shrink: 0;
  object-fit: contain;
  image-rendering: pixelated;
}
.topbar__search {
  flex: 1;
  min-width: 0;
  max-width: 480px;
  position: relative;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.7rem;
  color: var(--text-faint);
  min-width: 0;
}
.search-box input {
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  min-width: 0;
  font-size: 0.9rem;
  width: 100%;
}
.search-box kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--text-faint);
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-raised); border-color: var(--border); }
.nav-toggle { display: none; }

/* -- Shell layout -- */
.shell {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* -- Sidebar -- */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 1.5rem 1rem 3rem;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.nav-group { margin-bottom: 1.6rem; }
.nav-group__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0.6rem 0.5rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-left: 2px solid transparent;
}
.nav-link:hover {
  background: var(--bg-raised);
  text-decoration: none;
  color: var(--text);
}
.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--beacon);
}
.nav-link .beacon-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.nav-link.is-active .beacon-dot { background: var(--beacon); }

/* -- Main content -- */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 3rem;
  padding: 2.75rem 2.5rem 6rem;
  max-width: calc(100% - var(--sidebar-w));
}
.doc {
  max-width: 700px;
  width: 100%;
}
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
}
.breadcrumb a { color: var(--text-faint); }
.breadcrumb a:hover { color: var(--accent); }

/* -- Callouts -- */
.callout {
  display: flex;
  gap: 0.7rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-raised);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.4em;
  font-size: 0.92rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout--warning { border-left-color: var(--beacon); }
.callout--warning .callout__icon { color: var(--beacon); }
.callout--danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout__icon { flex-shrink: 0; margin-top: 0.15em; color: var(--accent); }

/* -- Status chips -- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-bottom: 0.6rem;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.chip--auto { color: var(--accent); background: var(--accent-soft); border-color: rgba(52,211,153,0.3); }
.chip--auto::before { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.chip--manual { color: var(--beacon); background: var(--beacon-soft); border-color: rgba(255,176,32,0.3); }
.chip--manual::before { background: var(--beacon); box-shadow: 0 0 6px var(--beacon); }
.chip--error { color: var(--danger); background: var(--danger-soft); border-color: rgba(240,101,79,0.3); }
.chip--error::before { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* -- Cards (feature/step grids) -- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.4em 0;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  background: var(--bg-raised);
}
.card h3 { margin-top: 0; font-size: 1rem; }
.card p { margin-bottom: 0; font-size: 0.9rem; color: var(--text-secondary); }

/* -- Steps -- */
.steps { list-style: none; padding-left: 0; counter-reset: step; }
.steps li {
  position: relative;
  padding-left: 2.6rem;
  margin-bottom: 1.5rem;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 1.8rem; height: 1.8rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -- Table of contents -- */
.toc {
  width: var(--toc-w);
  flex-shrink: 0;
  /* Float alongside the content instead of scrolling away with it.
     align-self is required — a stretched flex item can't stick. */
  position: sticky;
  align-self: flex-start;
  top: calc(var(--topbar-h) + 2.75rem);
  max-height: calc(100vh - var(--topbar-h) - 4.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.toc__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.7rem;
}
.toc a {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.3rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.7rem;
}
.toc a:hover { color: var(--accent); text-decoration: none; }

/* -- Prev/next footer nav -- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.page-nav__link {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  color: var(--text);
}
.page-nav__link:hover { border-color: var(--accent); text-decoration: none; }
.page-nav__link--next { text-align: right; }
.page-nav__dir {
  display: block;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-bottom: 0.2rem;
}

/* -- Search results dropdown -- */
.search-results {
  position: absolute;
  top: calc(var(--topbar-h) - 4px);
  left: 0;
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow-y: auto;
  display: none;
  z-index: 150;
}
.search-results.is-open { display: block; }
.search-results a {
  display: block;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--bg-raised); text-decoration: none; }
.search-results a small { display: block; color: var(--text-faint); font-size: 0.75rem; margin-top: 0.15rem; }
.search-empty { padding: 0.9rem; font-size: 0.85rem; color: var(--text-faint); }

/* -- Responsive -- */
@media (max-width: 1080px) {
  .toc { display: none; }
  .content { max-width: calc(100% - var(--sidebar-w)); }
}
@media (max-width: 860px) {
  .nav-toggle {
    display: flex;
    order: -1;
  }
  .topbar__brand { min-width: 0; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    z-index: 120;
  }
  .sidebar.is-open { transform: translateX(0); }
  .content { margin-left: 0; max-width: 100%; padding: 2rem 1.25rem 5rem; }
  .card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .search-box kbd { display: none; }
  .topbar { gap: 0.6rem; padding: 0 0.75rem; }
  .topbar__brand { font-size: 0.95rem; gap: 0.4rem; }
}
