/* Lab AI docs. drewdettmer.com palette: neutral paper, Public Sans/Inter, blue links, thin rules. */
:root {
  --background: #fafafa;
  --surface: #ffffff;
  --text: #202124;
  --muted: #62656a;
  --faint: #62656a;
  --line: #e3e3e3;
  --soft: #f3f4f6;
  --link: #174ea6;
  --link-soft: #e8effb;
  --ok: #1e6b3b;
  --err: #a1261e;
  --code-bg: #14171c;
  --code-head: #1c2026;
  --code-line: #2a2f37;
  --code-text: #e6e8eb;
  --measure: 46rem;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, Menlo, monospace;
  font-family: "Public Sans", Inter, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-padding-top: 5rem; scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--text); font-size: 1rem; line-height: 1.7; }
::selection { background: #dbe8ff; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 10; padding: .45rem .7rem; background: var(--text); color: #fff; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
p { margin: 0 0 1.1rem; }
strong, b { font-weight: 650; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .85rem; color: var(--muted); }

/* ---------- Layout: article centered on the page, contents rail in the left gutter ---------- */
.layout { display: grid; grid-template-columns: 13rem minmax(0, var(--measure)); justify-content: center; column-gap: 3.5rem; max-width: 82rem; margin: 0 auto; padding: 0 1.5rem; }
.layout > .toc { grid-column: 1; width: 100%; }
.layout > main { grid-column: 2; }
main { padding: 3.25rem 0 4rem; min-width: 0; }
main.signin { max-width: calc(var(--measure) + 2.5rem); margin: 0 auto; padding: 4.5rem 1.25rem 4rem; }

.toc { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; padding: 5.6rem 0 2rem; font-size: .875rem; }
.toc-title { margin: 0 0 .7rem; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: .26rem 0 .26rem .95rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.45; transition: color .15s, border-color .15s; }
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--link); border-left-color: var(--link); font-weight: 600; }
.toc-foot { margin-top: 1.5rem; }
.toc-foot a { font-weight: 600; text-decoration: none; }

/* ---------- Page header ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1.6rem; }
.crumbs { margin: 0; font-size: .8rem; letter-spacing: .02em; color: var(--muted); }
.userbar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .55rem; font-size: .8rem; color: var(--muted); max-width: 100%; overflow-wrap: anywhere; }
.userbar strong { color: var(--text); font-weight: 600; }
.userbar a { display: inline-flex; align-items: center; min-height: 2.75rem; white-space: nowrap; padding: .12rem .6rem; color: var(--text); text-decoration: underline; font-weight: 600; }
.userbar a:hover { background: #e7e8eb; }
h1 { margin: 0 0 1.25rem; font-size: clamp(2rem, 5.5vw, 3rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.12; }
.intro { font-size: clamp(1.08rem, 2.3vw, 1.22rem); line-height: 1.62; color: #3c4043; margin: 0 0 2rem; }

/* ---------- Sections ---------- */
section { padding-top: 2.6rem; }
section.first { padding-top: .5rem; }
h2 { display: flex; align-items: center; gap: .75rem; margin: 0 0 .9rem; font-size: 1.5rem; letter-spacing: -.025em; line-height: 1.25; }
h3 { margin: 1.4rem 0 .5rem; font-size: 1.05rem; }
ul, ol { padding-left: 1.3rem; margin: 0 0 1.1rem; }
li { margin: .35rem 0; }
li::marker { color: var(--faint); }

/* Numbered steps drawn as a timeline */
.steps { position: relative; margin-top: 1rem; }
.steps > section { position: relative; padding-left: 3.25rem; padding-top: 2.4rem; }
.steps > section:first-child { padding-top: 1.6rem; }
.steps > section::before { content: ""; position: absolute; left: 1.05rem; top: 4.6rem; bottom: -2.2rem; width: 2px; background: linear-gradient(var(--line), var(--line)); }
.steps > section:first-child::before { top: 3.8rem; }
.steps > section:last-child::before { display: none; }
.num { position: absolute; left: 0; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--text); color: #fff; font-size: .9rem; font-weight: 700; letter-spacing: 0; box-shadow: 0 0 0 5px var(--background); }

/* ---------- Access choices (sign-in page) ---------- */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0 0 1rem; }
.choice { position: relative; display: flex; flex-direction: column; padding: 1.25rem 1.3rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.choice:hover { border-color: #cfd3d9; box-shadow: 0 10px 30px -18px rgba(32, 33, 36, .35); transform: translateY(-1px); }
.choice.primary { border-color: #bccbe8; background: linear-gradient(180deg, #f7f9fe, #fff 55%); }
.choice p { font-size: .93rem; color: var(--muted); }
.choice .icon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; margin-bottom: .8rem; border-radius: 10px; background: var(--soft); color: var(--text); }
.choice.primary .icon { background: var(--link-soft); color: var(--link); }
.choice .icon svg { width: 1.25rem; height: 1.25rem; }
.choice-title { margin: 0 0 .55rem !important; font-size: 1.12rem !important; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; color: var(--text) !important; }
.choice-title a { text-decoration: none; }
.choice-title a:hover { text-decoration: underline; }
.choice .actions { margin-top: auto; margin-bottom: 0; padding-top: .4rem; }
section.access { margin-top: 1.4rem; padding: 1.1rem 1.3rem .2rem; border: 1px dashed #d5d7db; border-radius: 14px; }
section.access h2 { font-size: 1.05rem; letter-spacing: -.01em; margin-bottom: .4rem; }
section.access p { color: var(--muted); font-size: .94rem; }

.aside-note { margin-top: 1.1rem; padding: .75rem 1rem; border-radius: var(--radius); background: var(--soft); color: var(--muted); font-size: .88rem; }

/* ---------- Code ---------- */
code, pre, kbd { font-family: var(--mono); }
code { font-size: .84em; background: var(--soft); border: 1px solid #e7e8eb; border-radius: 5px; padding: .06em .36em; }
kbd { font-size: .8em; border: 1px solid #d5d7db; border-bottom-width: 2px; border-radius: 5px; padding: .05em .4em; background: var(--surface); }
pre { margin: 0; }
.code { margin: .7rem 0 1.15rem; border: 1px solid var(--code-line); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; box-shadow: 0 8px 24px -18px rgba(0, 0, 0, .5); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .4rem .5rem .4rem .9rem; background: var(--code-head); border-bottom: 1px solid var(--code-line); }
.code-label { display: inline-flex; align-items: center; gap: .5rem; font: 600 .72rem/1.4 var(--mono); letter-spacing: .02em; color: #9aa3ad; }
.code-label::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #3b4350; }
.code.admin .code-label { color: #f0b46a; }
.code.admin .code-label::before { background: #f0b46a; }
.code pre { padding: .85rem 1rem .95rem; color: var(--code-text); font-size: .82rem; line-height: 1.6; white-space: pre; overflow-x: auto; }
.code pre::-webkit-scrollbar { height: 8px; }
.code pre::-webkit-scrollbar-thumb { background: #343a43; border-radius: 4px; }
.copy { flex: none; min-height: 2.75rem; padding: .3rem .65rem; border: 1px solid #626a76; border-radius: 6px; background: transparent; color: #d1d6dd; font-family: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.copy:hover { background: #2a2f37; color: #fff; }
.copy.done { color: #7fd6a0; border-color: #2f5a41; }
.code.light { background: var(--surface); border-color: var(--line); box-shadow: none; }
.code.light .code-head { background: var(--soft); border-color: var(--line); }
.code.light .code-label { color: var(--muted); }
.code.light pre { color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.code.light .copy { border-color: #d5d7db; color: var(--muted); }
.code.light .copy:hover { background: #e7e8eb; color: var(--text); }

/* ---------- Buttons ---------- */
.button, button[type="submit"] { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.05rem; border: 1px solid var(--text); border-radius: 999px; background: var(--text); color: #fff; font: inherit; font-size: .92rem; font-weight: 600; line-height: 1.3; text-decoration: none; cursor: pointer; transition: background .15s, transform .15s; }
.button:hover, button[type="submit"]:hover { background: #3c4043; text-decoration: none; transform: translateY(-1px); }
.button.secondary { background: var(--surface); color: var(--text); border-color: #d5d7db; }
.button.secondary:hover { background: var(--soft); }
.regen { margin-top: 1.4rem; }
.regen button[type="submit"] { background: transparent; color: var(--err); border-color: #e9bdb8; }
.regen button[type="submit"]:hover { background: #fbeceb; }

/* ---------- Callouts ---------- */
.ok, .note, .error { margin: 0 0 1.1rem; padding: .75rem 1rem; border-radius: var(--radius); font-size: .94rem; border: 1px solid; }
.ok { background: #f1f8f3; border-color: #cfe5d6; }
.note { background: #fbf7ee; border-color: #eedfbc; color: #4a3a12; }
.error { background: #fbeceb; border-color: #efc9c5; color: var(--err); font-weight: 600; }

/* ---------- Personal key card ---------- */
.keybox { margin: 1rem 0 1.2rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.keyline { display: flex; align-items: center; gap: .6rem; margin: .9rem 1rem; padding: .35rem .35rem .35rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.keyline code { flex: 1; min-width: 0; padding: 0; border: 0; background: none; font-size: .92rem; word-break: break-all; }
.keyline .copy { border-color: #d5d7db; color: var(--muted); background: var(--surface); }
.keyline .copy:hover { color: var(--text); background: #e7e8eb; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0; border-top: 1px solid var(--line); background: var(--line); }
.meta div { padding: .65rem 1rem; background: var(--surface); }
.meta dd[data-usage] { font-variant-numeric: tabular-nums; }
.meta dt { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.meta dd { margin: .1rem 0 0; font-size: .9rem; font-weight: 600; }

.qr { margin-top: .9rem; }
.qr svg { width: 210px; height: auto; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
details { margin: .4rem 0 1.1rem; }
summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: .94rem; }
details[open] summary { margin-bottom: .5rem; }

/* ---------- Live VPN status ---------- */
.livecheck { display: flex; gap: .85rem; align-items: flex-start; margin: 1.2rem 0 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: background .2s, border-color .2s; }
.livecheck p { margin: 0; }
.vpn-title { font-weight: 650; }
.vpn-detail { font-size: .88rem; color: var(--muted); }
.vpn-dot { flex: none; width: .7rem; height: .7rem; margin-top: .45rem; border-radius: 50%; background: #b8bcc2; box-shadow: 0 0 0 4px #eef0f2; }
.livecheck[data-state="checking"] .vpn-dot { animation: vpn-pulse 1.2s ease-in-out infinite; }
.livecheck[data-state="up"] { background: #f1f8f3; border-color: #cfe5d6; }
.livecheck[data-state="up"] .vpn-dot { background: #2f9e5b; box-shadow: 0 0 0 4px #d6efdf; animation: vpn-pulse 2.4s ease-in-out infinite; }
.livecheck[data-state="stale"] { background: #fbf7ee; border-color: #eedfbc; }
.livecheck[data-state="stale"] .vpn-dot { background: #d99a00; box-shadow: 0 0 0 4px #f6e9c8; }
.livecheck[data-state="error"] .vpn-dot { background: var(--err); box-shadow: 0 0 0 4px #f6dcda; }
@keyframes vpn-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .vpn-dot { animation: none !important; } }

/* ---------- Troubleshooting + reference ---------- */
table.ref { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 0 1.1rem; font-size: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
table.ref th, table.ref td { text-align: left; vertical-align: top; padding: .6rem 1rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
table.ref tr:last-child th, table.ref tr:last-child td { border-bottom: 0; }
table.ref th { width: 34%; color: var(--muted); font-weight: 600; }
.page-foot { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--faint); }

/* ---------- OS picker: radios are siblings of .steps, so plain CSS shows the right blocks ---------- */
.os-radio { position: absolute; width: 1px; height: 1px; opacity: 0; }
.os-picker { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; margin: 1.25rem 0 0; padding: .5rem 0; background: var(--background); border-bottom: 1px solid var(--line); font-size: .85rem; }
.os-picker > span { color: var(--muted); }
.seg { display: inline-flex; padding: .2rem; border-radius: 999px; background: #eceef1; }
.seg label { display: inline-flex; align-items: center; min-height: 2.75rem; padding: .22rem .9rem; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.seg label:hover { color: var(--text); }
#os-win:checked ~ .os-picker label[for="os-win"],
#os-mac:checked ~ .os-picker label[for="os-mac"],
#os-linux:checked ~ .os-picker label[for="os-linux"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.os-radio:focus-visible ~ .os-picker .seg { outline: 2px solid var(--link); outline-offset: 2px; }
.os { display: none; }
#os-win:checked ~ .steps .os.win,
#os-mac:checked ~ .steps .os.mac,
#os-linux:checked ~ .steps .os.linux { display: block; }

.quick-links { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-bottom: 1.75rem; }
.quick-links > a:not(.button) { padding: .45rem 0; }
.key-reveal { padding: .75rem 1rem 0; }
.key-reveal .keyline { margin: .75rem 0; flex-wrap: wrap; }
.key-reveal .keyline code { flex-basis: 12rem; }
.mobile-toc { display: none; }
summary { min-height: 2.75rem; padding: .5rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.button, button[type="submit"] { min-height: 2.75rem; }
button:disabled { cursor: not-allowed; opacity: .6; }
.steps > section, .code, .os { min-width: 0; }
pre:not(.code pre) { overflow-x: auto; padding: .75rem; background: var(--soft); }
:not(pre) > code { overflow-wrap: anywhere; }
.livecheck > div { min-width: 0; }
.qr svg { max-width: 100%; }
.credential-reset { margin-top: 1.5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 68rem) {
  .layout { grid-template-columns: minmax(0, var(--measure)); }
  .layout > main { grid-column: 1; }
  .toc { display: none; }
  .mobile-toc { display: block; }
  .mobile-toc nav { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1rem; padding-bottom: .75rem; }
  .mobile-toc nav a { padding: .4rem 0; }
}
@media (max-width: 44rem) {
  .layout { padding: 0 1rem; }
  main, main.signin { padding-top: 1.5rem; }
  .choices { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 1fr 1fr; }
  .steps > section { padding-left: 0; }
  .steps > section::before { display: none; }
  .steps h2 { padding-left: 2.8rem; min-height: 2.2rem; }
  .num { top: auto; }
  .os-picker { font-size: .8rem; }
  .seg label { padding: .22rem .75rem; }
  .code-head { gap: .4rem; padding-left: .65rem; }
  table.ref th, table.ref td { display: block; width: 100%; padding: .5rem .75rem; }
  table.ref th { border-bottom: 0; padding-bottom: 0; }
  .topbar { margin-bottom: 1.25rem; }
}
