/* SRP VPN Connect documentation: one stylesheet for every page. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-code: #f3f4f6;
  --text: #1c2024;
  --text-soft: #5b636d;
  --border: #e2e5e9;
  --accent: #0b6bcb;
  --accent-soft: #e7f1fb;
  --ok: #1a7f37;
  --ok-soft: #e6f4ea;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --bad: #c2341d;
  --bad-soft: #fdecea;
  --neutral: #59636e;
  --neutral-soft: #eef0f2;
  --code-key: #8250df;
  --code-str: #0a7a3d;
  --code-num: #b35900;
  --code-com: #6e7781;
  --header-h: 56px;
  --sidebar-w: 280px;
  --toc-w: 220px;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --bg-soft: #161a20;
  --bg-code: #1b2027;
  --text: #e6e9ed;
  --text-soft: #9aa4af;
  --border: #2a3038;
  --accent: #58a6ff;
  --accent-soft: #14273d;
  --ok: #3fb950;
  --ok-soft: #12261a;
  --warn: #d29922;
  --warn-soft: #2b2312;
  --bad: #f0705a;
  --bad-soft: #2e1714;
  --neutral: #9aa4af;
  --neutral-soft: #1e242b;
  --code-key: #c297ff;
  --code-str: #7ee2a8;
  --code-num: #ffb86b;
  --code-com: #8b949e;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --bg-soft: #161a20;
    --bg-code: #1b2027;
    --text: #e6e9ed;
    --text-soft: #9aa4af;
    --border: #2a3038;
    --accent: #58a6ff;
    --accent-soft: #14273d;
    --ok: #3fb950;
    --ok-soft: #12261a;
    --warn: #d29922;
    --warn-soft: #2b2312;
    --bad: #f0705a;
    --bad-soft: #2e1714;
    --neutral: #9aa4af;
    --neutral-soft: #1e242b;
    --code-key: #c297ff;
    --code-str: #7ee2a8;
    --code-num: #ffb86b;
    --code-com: #8b949e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--bg); padding: 8px 12px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-title { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.site-title span { color: var(--text-soft); font-weight: 500; }
.header-spacer { flex: 1; }
.icon-button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  font: inherit;
  cursor: pointer;
}
.icon-button:hover { background: var(--bg-soft); }
.menu-button { display: none; }

/* Search */
.search { position: relative; width: min(360px, 40vw); }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
.search-results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 6px;
  margin: 0;
  list-style: none;
}
.search-results[hidden] { display: none; }
.search-results li a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
.search-results li a:hover, .search-results li a:focus { background: var(--accent-soft); }
.search-results small { display: block; color: var(--text-soft); }
.search-results .empty { padding: 8px 10px; color: var(--text-soft); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  min-height: calc(100vh - var(--header-h));
}
.sidebar, .toc {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 20px 16px;
}
.sidebar { border-right: 1px solid var(--border); background: var(--bg-soft); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li ul { padding-left: 12px; border-left: 1px solid var(--border); margin-left: 6px; }
.sidebar a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 15px; }
.sidebar a:hover { background: var(--accent-soft); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar details > summary { cursor: pointer; padding: 6px 8px; font-weight: 700; list-style: none; }
.sidebar details > summary::-webkit-details-marker { display: none; }
.sidebar details > summary::before { content: "\25B8"; display: inline-block; width: 1em; transition: transform 0.15s; }
.sidebar details[open] > summary::before { transform: rotate(90deg); }

.toc { font-size: 14px; }
.toc h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-soft); margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li.h3 { padding-left: 12px; }
.toc a { display: block; padding: 3px 0; color: var(--text-soft); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* Content */
.doc { padding: 32px 40px 80px; max-width: 860px; width: 100%; }
.doc h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 8px; }
.doc .lead { font-size: 1.1rem; color: var(--text-soft); margin-top: 0; }
.doc h2 { font-size: 1.45rem; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 1.15rem; margin: 28px 0 8px; }
.doc img { max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); }
.doc figure { margin: 20px 0; }
.doc .shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 260px)); gap: 20px; margin: 20px 0; }
.doc .shots figure { margin: 0; }
.doc figcaption { color: var(--text-soft); font-size: 14px; margin-top: 6px; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.doc kbd { font-family: var(--mono); font-size: 0.85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15px; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.doc th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }

/* Code */
.doc code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-code); padding: 1px 5px; border-radius: 4px; }
.code-block { position: relative; margin: 16px 0; }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.5;
}
.code-block pre code { background: none; padding: 0; font-size: 14px; }
.code-block .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 28px;
  padding: 0 10px;
  font: 13px var(--font);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  opacity: 0.85;
}
.code-block .copy:hover { opacity: 1; }
.code-block .code-label {
  display: inline-block;
  font: 12px var(--font);
  color: var(--text-soft);
  margin-bottom: 4px;
}
.tok-key { color: var(--code-key); }
.tok-str { color: var(--code-str); }
.tok-num { color: var(--code-num); }
.tok-com { color: var(--code-com); font-style: italic; }
.tok-kw { color: var(--accent); font-weight: 600; }

/* Callouts */
.callout { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); padding: 12px 16px; margin: 20px 0; background: var(--bg-soft); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title { font-weight: 700; display: block; margin-bottom: 4px; }
.callout.tip { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.warning { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.danger { border-left-color: var(--bad); background: var(--bad-soft); }
.callout.prereq { border-left-color: var(--neutral); }
.callout.verify { border-left-color: var(--ok); background: var(--ok-soft); }
.callout.evidence { border-left-color: var(--neutral); background: var(--neutral-soft); font-size: 15px; }

/* Status labels */
.status { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.status.verified { color: var(--ok); background: var(--ok-soft); }
.status.failed { color: var(--bad); background: var(--bad-soft); }
.status.partial { color: var(--warn); background: var(--warn-soft); }
.status.not-verified, .status.planned, .status.awaiting { color: var(--neutral); background: var(--neutral-soft); }

/* Cards on index pages */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 20px 0; }
.card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); background: var(--bg); }
.card:hover { border-color: var(--accent); }
.card strong { display: block; margin-bottom: 4px; }
.card span { color: var(--text-soft); font-size: 14px; }

.page-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); }
.page-nav a { text-decoration: none; }

.site-footer { color: var(--text-soft); font-size: 13px; margin-top: 40px; }

/* Tablet: no table of contents column */
@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

/* Phone: the sidebar becomes a drawer */
@media (max-width: 820px) {
  .menu-button { display: inline-block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: min(86vw, var(--sidebar-w));
    max-height: none;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.2);
  }
  body.nav-open .sidebar { transform: none; }
  .doc { padding: 20px 16px 64px; }
  .doc h1 { font-size: 1.6rem; }
  .search { width: auto; flex: 1; }
  .site-title span { display: none; }
}

.doc :not(pre) > code { overflow-wrap: anywhere; }
.doc p, .doc li, .doc td { overflow-wrap: anywhere; }
.doc pre { max-width: 100%; overflow-x: auto; }

.noscript-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.noscript-nav a { min-height: 24px; }

@media (max-width: 820px) {
  .sidebar { visibility: hidden; }
  body.nav-open .sidebar { visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .site-header, .sidebar, .toc, .copy, .page-nav { display: none !important; }
  .layout { display: block; }
}

.layout {
  max-width: 1680px;
  margin-inline: auto;
}

.doc {
  margin-inline: auto;
}

.site-header {
  padding-inline: max(16px, calc((100vw - 1680px) / 2 + 16px));
}
