/* Switchboard's website. The colours are the app's: deep navy and cyan when dark, and the
   band along the top is its colours for kinds of traffic (TLS, QUIC, DNS, remote access,
   cleartext). Light and dark follow the system unless the reader picks one. */

:root {
  color-scheme: light;
  --bg: #f6f8fb; --surface-1: #ffffff; --surface-2: #eef2f7; --surface-3: #e1e7f0;
  --border: #dae1eb; --border-strong: #c2ccda;
  --text: #0e1628; --text-muted: #46536a; --text-subtle: #67748a;
  --accent: #0b7491; --accent-hover: #095e76; --accent-strong: #08617a;
  --accent-soft: rgb(11 116 145 / 0.16); --accent-softer: #e5f3f7; --on-accent: #ffffff;
  --shot-glow: rgb(14 22 40 / 0.28);
  --tls: #0fb5c9; --quic: #8b6cf0; --dns: #2fbf71; --remote: #e8a317; --clear: #f0743b;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-7: 32px; --space-8: 44px; --space-9: 64px;
  --radius-s: 5px; --radius-m: 8px; --radius-l: 12px; --radius-xl: 18px; --radius-pill: 999px;
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.05), 0 6px 18px -6px rgb(14 22 40 / 0.16);
  --shadow-3: 0 2px 4px rgb(0 0 0 / 0.06), 0 18px 40px -12px rgb(14 22 40 / 0.3);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b16; --surface-1: #0c1222; --surface-2: #111a2e; --surface-3: #1a2540;
  --border: #1e2943; --border-strong: #2b3959;
  --text: #e4ebf6; --text-muted: #a2afc5; --text-subtle: #7b88a0;
  --accent: #3cc9ea; --accent-hover: #74dcf4; --accent-strong: #62d6f2;
  --accent-soft: rgb(60 201 234 / 0.2); --accent-softer: rgb(60 201 234 / 0.08); --on-accent: #03131b;
  --shot-glow: rgb(60 201 234 / 0.16);
  --tls: #3cdcf0; --quic: #a78bfa; --dns: #4ade80; --remote: #fbbf24; --clear: #fb923c;
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 22px -8px rgb(0 0 0 / 0.6);
  --shadow-3: 0 2px 4px rgb(0 0 0 / 0.4), 0 18px 40px -12px rgb(0 0 0 / 0.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070b16; --surface-1: #0c1222; --surface-2: #111a2e; --surface-3: #1a2540;
    --border: #1e2943; --border-strong: #2b3959;
    --text: #e4ebf6; --text-muted: #a2afc5; --text-subtle: #7b88a0;
    --accent: #3cc9ea; --accent-hover: #74dcf4; --accent-strong: #62d6f2;
    --accent-soft: rgb(60 201 234 / 0.2); --accent-softer: rgb(60 201 234 / 0.08); --on-accent: #03131b;
    --shot-glow: rgb(60 201 234 / 0.16);
    --tls: #3cdcf0; --quic: #a78bfa; --dns: #4ade80; --remote: #fbbf24; --clear: #fb923c;
    --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 22px -8px rgb(0 0 0 / 0.6);
    --shadow-3: 0 2px 4px rgb(0 0 0 / 0.4), 0 18px 40px -12px rgb(0 0 0 / 0.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15.5px/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 30;
  background: linear-gradient(90deg, var(--tls) 0 30%, var(--quic) 30% 52%, var(--dns) 52% 70%, var(--remote) 70% 85%, var(--clear) 85%);
}
a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface-1); padding: 8px 12px; z-index: 40; }
.skip:focus { left: 8px; }
img { max-width: 100%; height: auto; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4);
  height: 60px; padding: 3px var(--space-5) 0; background: color-mix(in srgb, var(--surface-1) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.brand img { border-radius: 7px; }
.brand .version { font: 500 12px var(--mono); color: var(--text-subtle); padding: 2px 6px; border: 1px solid var(--border); border-radius: var(--radius-pill); }
.search { position: relative; flex: 0 1 360px; margin-left: auto; }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-m);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface-1); }
.search kbd { position: absolute; right: 9px; top: 8px; }
.results {
  position: absolute; top: 42px; left: 0; right: 0; max-height: 70vh; overflow: auto; z-index: 30;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-3); padding: 6px;
}
.results a { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--radius-m); color: var(--text); text-decoration: none; }
.results a:hover, .results a.active { background: var(--accent-softer); }
.results strong { font-size: 14px; }
.results .where { font-size: 12px; color: var(--accent-strong); }
.results .snippet { font-size: 13px; color: var(--text-muted); }
.results .none { margin: 8px 10px; color: var(--text-muted); font-size: 14px; }
.theme { display: flex; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px; }
.theme button { border: 0; background: none; color: var(--text-muted); width: 30px; height: 26px; border-radius: var(--radius-pill); cursor: pointer; font-size: 14px; }
.theme button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.github { color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 550; }
.github:hover { color: var(--text); }
.menu-button { display: none; border: 1px solid var(--border); background: var(--surface-1); color: var(--text); border-radius: var(--radius-m); width: 36px; height: 34px; font-size: 16px; cursor: pointer; }
kbd { font: 12px var(--mono); color: var(--text-muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface-1); }

/* Layout: menu, content, and "on this page" */
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 210px; gap: var(--space-8); max-width: 1320px; margin: 0 auto; padding: 0 var(--space-6); }
.menu { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow: auto; padding: var(--space-6) 0; }
.menu-group + .menu-group { margin-top: var(--space-5); }
.menu-title { font: 600 11.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); margin: 0 0 6px 10px; }
.menu ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.menu a { display: block; padding: 5px 10px; border-radius: var(--radius-m); color: var(--text-muted); text-decoration: none; font-size: 14.5px; }
.menu a:hover { color: var(--text); background: var(--surface-2); }
.menu a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-softer); font-weight: 600; }
.toc { position: sticky; top: 60px; align-self: start; padding: var(--space-6) 0; max-height: calc(100vh - 60px); overflow: auto; font-size: 13.5px; }
.toc .menu-title { margin-left: 0; }
.toc a { display: block; padding: 3px 0; color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--accent-strong); }
.toc .l3 a { padding-left: 12px; font-size: 13px; }
.content { min-width: 0; padding: var(--space-7) 0 var(--space-9); max-width: 780px; }

/* Text */
.content h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 var(--space-5); font-weight: 700; }
.content h2 { font-size: 23px; line-height: 1.3; letter-spacing: -0.01em; margin: var(--space-8) 0 var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); font-weight: 650; }
.content h3 { font-size: 18px; margin: var(--space-6) 0 var(--space-2); font-weight: 650; }
.content h2:first-of-type { border-top: 0; }
.anchor { margin-left: 8px; color: var(--text-subtle); text-decoration: none; opacity: 0; font-weight: 400; }
:is(h2, h3, h4):hover .anchor, .anchor:focus { opacity: 1; }
.content p, .content li { color: color-mix(in srgb, var(--text) 90%, var(--text-muted)); }
.content ul, .content ol { padding-left: 1.4em; }
.content li + li { margin-top: 4px; }
code { font: 0.88em var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 1px 5px; overflow-wrap: anywhere; }
.code { position: relative; margin: var(--space-4) 0; }
pre { margin: 0; padding: 14px 16px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-l); font-size: 13.5px; line-height: 1.55; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-muted); border-radius: var(--radius-s); font: 12px var(--font); padding: 3px 8px; cursor: pointer; opacity: 0; transition: opacity 0.12s; }
.code:hover .copy, .copy:focus { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }
blockquote { margin: var(--space-4) 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-softer); border-radius: 0 var(--radius-m) var(--radius-m) 0; }
blockquote p { margin: 6px 0; }
.table-wrap { overflow-x: auto; margin: var(--space-4) 0; border: 1px solid var(--border); border-radius: var(--radius-l); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; background: var(--surface-2); color: var(--text-muted); font-size: 13px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td:first-child code { white-space: nowrap; overflow-wrap: normal; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-7) 0; }
.muted { color: var(--text-muted); }

/* Pager and footer */
.pager { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-9); }
.pager a { display: grid; gap: 2px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-l); text-decoration: none; color: var(--text); font-weight: 600; min-width: 200px; }
.pager a:hover { border-color: var(--accent); }
.pager span { font-size: 12px; font-weight: 500; color: var(--text-subtle); }
.pager .next { text-align: right; margin-left: auto; }
.foot { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--border); font-size: 13px; color: var(--text-subtle); }

/* Small screens */
@media (max-width: 1180px) { .layout { grid-template-columns: 220px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .menu-button { display: block; }
  .menu { display: none; position: fixed; inset: 60px 0 0 0; z-index: 15; background: var(--surface-1); padding: var(--space-5) 16px; max-height: none; }
  .menu-open .menu { display: block; }
  .top { gap: var(--space-3); padding: 3px 12px 0; }
  .brand .version, .github, .search kbd { display: none; }
  .search { flex: 1 1 auto; }
  .results { position: fixed; top: 60px; left: 12px; right: 12px; }
  .content h1 { font-size: 28px; }
  .pager { flex-direction: column; }
  .pager a { min-width: 0; }
}
@media (max-width: 480px) { .brand span:not(.version) { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* The home page */
.page-index .layout { grid-template-columns: 230px minmax(0, 1fr); }
.page-index .toc { display: none; }
.page-index .content { max-width: 1080px; }
.eyebrow { margin: 0 0 8px; font: 600 12px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-strong); }
.hero { padding: var(--space-6) 0 var(--space-4); }
.hero h1 { font-size: clamp(34px, 5.4vw, 58px); line-height: 1.04; letter-spacing: -0.03em; margin: 0 0 var(--space-4); }
.hero .lead { font-size: 18.5px; line-height: 1.6; color: var(--text-muted); max-width: 44em; margin: 0 0 var(--space-5); }
.install { max-width: 860px; margin: 0 0 var(--space-5); }
.install .code { margin: 0 0 var(--space-2); }
.install pre { font-size: 14px; background: var(--surface-1); border-color: var(--border-strong); padding-right: 76px; white-space: pre-wrap; overflow-wrap: anywhere; }
.install pre code { overflow-wrap: anywhere; }
.install .copy { opacity: 1; }
.install p { margin: 0; font-size: 14px; color: var(--text-muted); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--space-7); }
.button { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: var(--radius-m); border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; background: var(--surface-1); }
.button:hover { border-color: var(--accent); color: var(--text); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button.quiet { border-color: transparent; color: var(--text-muted); background: none; }
figure { margin: 0; }
figure.shot img, .gallery img {
  display: block; width: 100%; height: auto; background: #070b16; border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 22px 50px -16px var(--shot-glow);
}
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); margin: var(--space-9) 0; }
.pillars h3 { font-size: 15.5px; margin: 0 0 6px; }
.pillars p { margin: 0; font-size: 14.5px; color: var(--text-muted); }
.pillars > div { padding-top: var(--space-4); border-top: 2px solid var(--border); }
.pillars > div:nth-child(1) { border-color: var(--tls); } .pillars > div:nth-child(2) { border-color: var(--quic); }
.pillars > div:nth-child(3) { border-color: var(--dns); } .pillars > div:nth-child(4) { border-color: var(--remote); }
.section-head { max-width: 46em; }
.section-head h2, .feature h2, .closing h2 { border: 0; margin: 0 0 var(--space-3); padding: 0; font-size: 28px; letter-spacing: -0.015em; }
.section-head p, .feature p, .closing > p { color: var(--text-muted); }
.layouts { margin: var(--space-9) 0; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5) var(--space-4); margin-top: var(--space-5); }
.gallery img { aspect-ratio: 16 / 10; object-fit: cover; object-position: center; border-radius: var(--radius-l); }
.gallery figcaption { margin-top: 10px; font-size: 14px; color: var(--text-muted); line-height: 1.45; }
.gallery figcaption strong { color: var(--text); margin-right: 4px; }
.gallery figcaption kbd { margin-right: 6px; }
.feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-7); align-items: center; margin: var(--space-9) 0; }
.feature.flip .feature-text { order: 2; }
.feature .code { margin: 0; }
.feature pre { font-size: 14px; line-height: 1.75; }
.closing { margin: var(--space-9) 0 var(--space-7); }
.watches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-7); padding: 0; list-style: none; }
.content .watches li { margin: 0; padding-left: 26px; position: relative; color: var(--text-muted); }
.watches li::before { content: ""; position: absolute; left: 4px; top: 0.55em; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); }
.watches strong { color: var(--text); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.cards a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-l); text-decoration: none; background: var(--surface-1); }
.cards a:hover { border-color: var(--accent); }
.cards strong { color: var(--text); font-size: 15px; }
.cards span { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }
@media (max-width: 1180px) { .page-index .layout { grid-template-columns: 220px minmax(0, 1fr); } }
@media (max-width: 960px) {
  .feature { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .feature.flip .feature-text { order: 0; }
  .pillars, .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .page-index .layout { grid-template-columns: minmax(0, 1fr); }
  .pillars, .watches { grid-template-columns: minmax(0, 1fr); }
  .hero .lead { font-size: 17px; }
}
@media (max-width: 560px) { .gallery { grid-template-columns: minmax(0, 1fr); } .install pre { font-size: 12.5px; } }
