/* 1-bit-bridge docs site stylesheet.
 *
 * Shared by index.html, setup.html, features.html, troubleshooting.html,
 * and privacy.html. Pure CSS — no JS, no preprocessor, no build step.
 *
 * Design language: system fonts, Apple-flavored neutral palette, iOS blue
 * accent, automatic light/dark via prefers-color-scheme. Layout caps at
 * 720px reading width on landing/policy pages and 820px on the wider
 * detail pages (setup/features/troubleshooting) where multi-column
 * grids and code blocks need a touch more horizontal room.
 */

:root {
  --fg: #1c1c1e;
  --fg-muted: #6b6b6f;
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --bg-elev: #fafafd;
  --accent: #0a84ff;
  --accent-hover: #006edc;
  --border: #e3e3e8;
  --code-bg: #1c1c1e;
  --code-fg: #f5f5f7;
  --warn-bg: #fff8e6;
  --warn-fg: #6b5300;
  --warn-border: #f3deab;
  --ok-bg: #e8f6ec;
  --ok-fg: #0e6b3a;
  --ok-border: #b9e1c5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #f5f5f7;
    --fg-muted: #a1a1a6;
    --bg: #0a0a0c;
    --bg-soft: #17171a;
    --bg-elev: #1c1c20;
    --accent: #0a84ff;
    --accent-hover: #3da0ff;
    --border: #2c2c2e;
    --code-bg: #17171a;
    --code-fg: #f5f5f7;
    --warn-bg: #2a230f;
    --warn-fg: #f3d38a;
    --warn-border: #4a3d18;
    --ok-bg: #0f261a;
    --ok-fg: #8fd6a8;
    --ok-border: #1f4a32;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Page container — landing/privacy stay at the original 720px reading
 * width; setup/features/troubleshooting widen to 820px so step-numbered
 * lists and side-by-side grids breathe. Pages opt in via .wide on <main>. */
main { max-width: 720px; margin: 0 auto; padding: 80px 24px 96px; }
main.wide { max-width: 820px; }

/* Top nav — repeated inline on every page (no JS includes by design,
 * matches the no-build-step rule). aria-current="page" on the active
 * link drives the underlined / heavier-weight active state. */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.site-nav .brand {
  font-weight: 600;
  color: var(--fg);
  margin-right: 12px;
}
.site-nav a {
  color: var(--fg-muted);
  padding: 4px 0;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
}

/* Headings */
h1 {
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 700;
}
h2 {
  font-size: 1.35rem;
  margin: 56px 0 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h3 {
  font-size: 1.05rem;
  margin: 28px 0 8px;
  font-weight: 600;
}

p { margin: 0 0 14px; }
.lede { color: var(--fg-muted); font-size: 1.1rem; margin: 0 0 32px; }
.updated { color: var(--fg-muted); font-size: 0.95rem; margin: 0 0 24px; }

/* Crumb (back-to-home arrow on detail pages) */
.crumb {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: var(--fg-muted);
}

/* Buttons */
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 32px; }
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  color: var(--fg);
  background: var(--bg-soft);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

/* Code */
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 16px 18px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.9em; }
p code, li code, td code, dd code {
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
/* `<pre><code>` blocks land inside <li> on setup.html / index.html
 * step lists, where the descendant selector above would otherwise
 * paint a light --bg-soft background on the inner <code>, leaving
 * --code-fg (light) text on a light surface — invisible. The pre's
 * own dark background and light foreground are the canonical render
 * for fenced code; reset every inline-code styling property when the
 * code is wrapped by <pre>. */
pre code {
  background: transparent;
  padding: 0;
  border: 0;
  font-size: inherit;
  color: inherit;
}

/* Lists */
ul { padding-left: 24px; }
li { margin-bottom: 8px; }
.features li strong { font-weight: 600; }

/* Numbered steps used on setup.html. Larger custom counter, generous
 * vertical rhythm so each step reads as its own block. */
ol.steps {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
  margin: 24px 0;
}
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 16px 16px 16px 60px;
  margin-bottom: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-feature-settings: "tnum";
}
ol.steps > li h3 { margin-top: 0; }
ol.steps > li > p:last-child,
ol.steps > li > pre:last-child,
ol.steps > li > ul:last-child,
ol.steps > li > .note:last-child { margin-bottom: 0; }
ol.steps ul { padding-left: 22px; }

/* Two-column responsive grid: install panels on landing/setup, feature
 * preview cards on features.html. Falls back to single column under
 * ~640px viewport. */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.grid-2 h3 { font-size: 1rem; margin: 0 0 8px; }
.grid-2 .card { padding: 16px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; }
.grid-2 .card p { margin: 0; color: var(--fg-muted); font-size: 0.92rem; }

/* Symptom / Fix paired blocks for troubleshooting.html */
.symptom {
  margin: 32px 0 8px;
  padding: 14px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  color: var(--warn-fg);
}
.symptom strong { font-weight: 600; }
.fix {
  padding: 14px 16px 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  margin-top: -8px;
}
.fix p:first-child { margin-top: 0; }
.fix ol { padding-left: 22px; margin: 8px 0 12px; }
.fix li { margin-bottom: 6px; }
.fix li::marker { color: var(--fg-muted); font-feature-settings: "tnum"; }

/* Callouts */
.note {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.92rem;
  margin: 20px 0;
}
.note.note-ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-fg);
}
.note.note-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-fg);
}

/* Tables (used on features.html for compatibility matrix etc.) */
table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; }
/* <caption> on every <table> for screen-reader context. Browser default
 * centers it above the table at body size, which fights the site's
 * left-aligned reading rhythm — render as a quiet left-aligned subhead. */
caption {
  text-align: left;
  caption-side: top;
  padding: 0 0 6px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  font-style: italic;
}

/* Description lists (used on features.html for term/definition pairs) */
dl { margin: 12px 0 24px; }
dt { font-weight: 600; margin-top: 14px; }
dd { margin: 4px 0 8px 0; color: var(--fg-muted); }
dd p { margin: 0 0 8px; }

footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
}
footer a { color: var(--fg-muted); }

/* Reduced motion: drop smooth scroll for users who opted out at the OS
 * level. The sticky-nav backdrop-filter is OK to keep — it doesn't
 * animate. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
