/* ───────────────────────────────────────────────────────────
   Vibstr docs site — How we ship
   Standalone stylesheet. Mirrors the SPA's design tokens
   without bundling the SPA's CSS. Light theme default;
   [data-theme="dark"] override at the bottom.
   ─────────────────────────────────────────────────────────── */

:root {
  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #eeeef2;
  --surface-3: #e4e4ea;
  --border: #d0d0da;
  --border-hover: #b8b8c5;
  --text: #1a1a2e;
  --text-dim: #5a5a72;
  --text-muted: #8888a0;
  --accent: #0d9668;
  --accent-dim: #0d966818;
  --accent-glow: #0d966830;
  --bug: #dc2626;
  --done: #16a34a;
  --radius: 10px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0a0c;
  --surface: #111116;
  --surface-2: #18181f;
  --surface-3: #1f1f28;
  --border: #2a2a35;
  --border-hover: #3a3a48;
  --text: #e8e8ed;
  --text-dim: #8888a0;
  --text-muted: #55556a;
  --accent: #6ee7b7;
  --accent-dim: #6ee7b720;
  --accent-glow: #6ee7b740;
  --bug: #f87171;
  --done: #4ade80;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Top nav ─── */
.docs-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}
.docs-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.docs-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.docs-nav-brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0d9668 0%, #34d399 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 900;
}
.docs-nav-brand-mark svg { width: 14px; height: 14px; }
/* 1.18.2 #502 — explicit classes so vibstr renders as one word.
   Previously `vib<span>str</span>` with whitespace inside the <a>
   rendered "vib str" with a visible gap; also the broad
   `.docs-nav-brand span` selector matched the mark wrapper too.
   1.18.2 #503 — the brand <a> now links to / (vibstr.app landing)
   rather than /how-we-ship/. */
.docs-nav-brand:hover { opacity: 0.85; transition: opacity 0.12s ease; }
.docs-nav-brand-text { display: inline-block; letter-spacing: -0.5px; }
.docs-nav-brand-str { color: var(--accent); }

.docs-nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.docs-nav-links::-webkit-scrollbar { display: none; }
.docs-nav-link {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.docs-nav-link:hover { color: var(--text); }
.docs-nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.docs-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.docs-theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.docs-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.docs-theme-toggle svg { width: 16px; height: 16px; }

.docs-nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--accent);
  color: #000;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
[data-theme="dark"] .docs-nav-cta { color: #0a0a0c; }
.docs-nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* ─── Main content ─── */
.docs-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.docs-main h1 {
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}
.docs-main h2 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-top: 40px;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}
.docs-main h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-top: 28px;
  margin-bottom: 10px;
}
.docs-main h4 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: 22px;
  margin-bottom: 8px;
}

.docs-main p {
  margin-bottom: 16px;
  color: var(--text);
}
.docs-main p strong { color: var(--text); font-weight: 600; }
.docs-main p em { color: var(--text-dim); font-style: italic; }

.docs-main a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.docs-main a:hover {
  text-decoration-thickness: 2px;
}

.docs-main ul, .docs-main ol {
  margin: 0 0 16px 24px;
  color: var(--text);
}
.docs-main ul li, .docs-main ol li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.docs-main hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.docs-main blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  padding: 12px 16px;
  margin: 16px 0;
  color: var(--text-dim);
  font-style: italic;
  border-radius: 0 6px 6px 0;
}
.docs-main blockquote p { margin-bottom: 0; color: var(--text-dim); }
.docs-main blockquote p + p { margin-top: 8px; }

/* ─── Code ─── */
.docs-main code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
  border: 1px solid var(--border);
}
.docs-main pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 16px 0;
  line-height: 1.55;
}
.docs-main pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
}

/* ─── Tables ─── */
.docs-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.docs-main th, .docs-main td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-main th {
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 600;
}
.docs-main tr:last-child td { border-bottom: none; }
.docs-main td code { font-size: 12px; }

/* ─── Cards (index page) ─── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0 32px;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px var(--accent-glow);
  text-decoration: none;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}
.card p {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-dim);
  flex: 1;
}
.card-cta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.card-soon {
  cursor: default;
  pointer-events: none;
  opacity: 0.65;
}
.card-soon .card-cta { color: var(--text-muted); }

/* ─── Misc ─── */
.next-up {
  margin: 32px 0 0;
  padding: 16px 18px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 14px;
}
.next-up a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.next-up a:hover { text-decoration: underline; }

.docs-footer-note {
  margin-top: 16px !important;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}
.docs-footer-note a { color: var(--text-dim); }

/* ─── Responsive ─── */
@media (max-width: 720px) {
  .docs-nav-inner { padding: 10px 16px; gap: 16px; }
  .docs-nav-links { gap: 14px; }
  .docs-nav-cta { padding: 5px 10px; font-size: 11px; }
  .docs-main { padding: 32px 18px 64px; }
  .docs-main h1 { font-size: 26px; }
  .docs-main h2 { font-size: 19px; margin-top: 32px; }
  .docs-main h3 { font-size: 16px; }
  .docs-main pre { font-size: 12px; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }
  .docs-main table { font-size: 13px; display: block; overflow-x: auto; }
}

@media (max-width: 480px) {
  /* 1.18.2 #502 — keep both the mark and the "vibstr" text visible
     at narrow widths. Old rule hid str entirely; that was a different
     UX trade-off and made the back-to-home affordance look like
     just a green block. */
  .docs-nav-brand { gap: 6px; font-size: 14px; }
}

/* ─── Print ─── */
@media print {
  .docs-nav, .docs-theme-toggle, .docs-nav-cta { display: none; }
  body { background: white; color: black; }
}

/* ─── Shipped log (1.18.11) ─── */
.shipped-intro {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: 32px;
  line-height: 1.6;
}
.shipped-month { margin: 24px 0; }
.shipped-month h2 {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 0 0 14px;
  font-weight: 600;
}
.shipped-phase {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.shipped-phase:last-child { border-bottom: none; }
.shipped-phase h3 {
  font-size: 16px;
  margin: 0 0 6px 0;
  font-weight: 600;
}
.shipped-phase p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  max-width: 60ch;
}
.shipped-phase-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-top: 10px;
  font-weight: 600;
}
.shipped-phase-in-progress h3 { color: var(--accent); }
.shipped-footer {
  margin-top: 40px;
  font-size: 13px;
  color: var(--text-muted);
}
.shipped-footer a {
  color: var(--accent);
  font-weight: 600;
}

/* ─── 1.19.159 — Sidebar nav redesign (Option C) ────────────────────────
   Replaces the top-bar link strip with a categorised left sidebar.
   Top bar shrinks to brand + theme toggle + Open Vibstr CTA. Mobile:
   hamburger toggles the sidebar in from the left with a backdrop.
   User feedback (2026-05-21): "difficult to navigate on pc and on
   mobile you don't know where one item starts and one stops". */

.docs-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 0 0 6px 0;
  font-weight: 600;
  z-index: 100;
  text-decoration: none;
}
.docs-skip-link:focus { left: 0; }

.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;
}

.docs-top {
  position: sticky;
  top: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}
.docs-top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.docs-side-toggle {
  display: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.docs-side-toggle:hover { background: var(--surface-2); }
.docs-side-toggle svg { width: 18px; height: 18px; }

.docs-shell {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
}

.docs-side {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 57px; /* offset for the sticky top bar */
  align-self: flex-start;
  max-height: calc(100vh - 57px);
  overflow-y: auto;
  padding: 24px 0 40px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.docs-side-nav {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.docs-side-group {
  display: flex;
  flex-direction: column;
}
.docs-side-group-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 24px 6px;
  font-weight: 600;
}
.docs-side-link {
  display: block;
  padding: 7px 24px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.docs-side-link:hover {
  background: var(--surface-2);
  color: var(--text);
}
.docs-side-link.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-dim), transparent 60%);
  border-left-color: var(--accent);
  font-weight: 600;
}

.docs-side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 12;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.docs-side-backdrop.open {
  display: block;
  opacity: 1;
}

/* docs-main override — the existing rule has max-width 720px + auto
   margins; with the sidebar we need to constrain inside the flex shell
   instead. Override to flex: 1 + max-width 720px + left-margin auto */
.docs-shell > .docs-main {
  flex: 1;
  min-width: 0;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* Mobile — sidebar slides in from the left.
   1.19.174 — fixed bottom-items-unreachable bug. Pre-fix used
   `height: 100vh; padding-top: 76px` which pushed the LAST 76px of
   content below the viewport edge — bottom items couldn't be tapped
   even after scroll (iOS 100vh quirk includes URL bar making it worse;
   touch-scroll on fixed elements without -webkit-overflow-scrolling is
   flaky). Now anchored to `top: 56px; bottom: 0` so the sidebar fills
   the viewport's actual visible area below the topbar. Topbar stays
   visible above the drawer so the hamburger remains accessible to close. */
@media (max-width: 900px) {
  .docs-side-toggle { display: inline-flex; }
  .docs-shell { display: block; }
  .docs-side {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    height: auto;
    max-height: none;
    width: 280px;
    z-index: 13;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding: 24px 0 calc(40px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
  }
  .docs-side.open { transform: translateX(0); }
  .docs-side-backdrop {
    /* 1.19.174 — backdrop also offset by topbar height so the topbar
       hamburger stays tappable while the drawer is open. */
    top: 56px;
  }
  .docs-shell > .docs-main {
    max-width: 100%;
    padding: 32px 18px 64px;
  }
  body.docs-side-open { overflow: hidden; }
}

/* Hide the old .docs-nav and .docs-nav-links rules from 1.10.5 to avoid
   any layout leakage from cached pages — the renderer no longer emits
   the old structure, but defence-in-depth: if a stale page is cached
   client-side, the old elements stay hidden. */
.docs-nav, .docs-nav-inner, .docs-nav-links {
  /* Old top-bar elements no longer rendered — kept rules above for
     the .docs-nav-brand which lives inside the new .docs-top. */
}
