:root {
  --ink: #0a0a0a;
  --muted: #5c5c5c;
  --canvas: #ffffff;
  --surface: #f7f7f7;
  --hairline: #e5e5e5;
  --route: #00d4a4;
  --route-text: #007a5e;
  --code: #1c1c1e;
  --on-code: #ffffff;
  --on-code-muted: #b3b3b3;
  --volatile: #8a5a00;
  --volatile-bg: #fff6e0;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --doc-width: 1216px;
  --sans: "Inter", "Noto Sans TC", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.75 var(--sans);
}

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

h1 { margin: 0 0 12px; font-size: 32px; font-weight: 600; line-height: 1.3; }
h2 { margin: 56px 0 12px; font-size: 24px; font-weight: 600; line-height: 1.4; }
h3 { margin: 32px 0 8px; font-size: 19px; font-weight: 600; line-height: 1.5; }
p { margin: 0 0 16px; }
code { font-family: var(--mono); }
p code, li code, summary code, .callout code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface);
  font-size: 0.875em;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.skip { position: absolute; left: 16px; top: -48px; padding: 6px 12px; background: var(--canvas); }
.skip:focus { top: 12px; z-index: 3; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  /* Lines the brand up with the left edge of the content grid below. */
  padding: 0 max(24px, calc((100% - var(--doc-width)) / 2));
  border-bottom: 1px solid var(--hairline);
  background: var(--canvas);
}
.brand { color: var(--ink); font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.top-links { display: flex; align-items: center; gap: 20px; font-size: 14px; white-space: nowrap; }
.top-links a { color: var(--muted); text-decoration: none; }
.top-links a:hover { color: var(--route-text); text-decoration: underline; }

/* Doc page: nav / prose / table of contents */
.doc {
  display: grid;
  grid-template-columns: 240px minmax(0, 680px) 200px;
  justify-content: center;
  gap: 48px;
  padding: 0 24px;
}
.doc-nav, .toc {
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 40px 4px 40px 2px;
  font-size: 15px;
  line-height: 1.6;
}
.doc-main { min-width: 0; padding: 40px 0 96px; }
.lede { color: var(--muted); }

/* The route: one line through every step */
.route, .route ul { margin: 0; padding: 0; list-style: none; }
.route > li { position: relative; padding: 0 0 20px 24px; }
.route > li::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  top: 7px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--route);
  border-radius: 50%;
  background: var(--canvas);
}
.route > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: -7px;
  width: 2px;
  background: var(--route);
}
.route > li.passed::before { background: var(--route); }
.route > li[data-current]::before {
  background: var(--route);
  box-shadow: 0 0 0 4px rgba(0, 212, 164, 0.25);
}
.route a { color: inherit; text-decoration: none; }
.route a:hover { color: var(--route-text); text-decoration: underline; }
.route [aria-current] { color: var(--route-text); font-weight: 600; }
.route ul { margin-top: 4px; color: var(--muted); }
.route ul li { padding: 2px 0; }

.side-nav { margin-top: 8px; padding-top: 4px; border-top: 1px solid var(--hairline); }
.nav-label { margin: 12px 0 2px; color: var(--muted); font-size: 13px; font-weight: 600; }
.side-list { margin: 0; padding: 0; list-style: none; color: var(--muted); }
.side-list li { padding: 3px 0; }
.side-list a { color: var(--ink); text-decoration: none; }
.side-list a:hover { color: var(--route-text); text-decoration: underline; }
.side-list [aria-current] { color: var(--route-text); font-weight: 600; }

.nav-toggle summary { display: none; }

.toc { font-size: 14px; }
.toc h2 { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc li a { padding-top: 3px; padding-bottom: 3px; }
.toc a { display: block; padding-left: 10px; border-left: 2px solid var(--hairline); color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--route-text); text-decoration: underline; }
.toc a[aria-current] { border-left-color: var(--route); color: var(--ink); font-weight: 500; }

/* Command + what the reader should see, as one unit */
.cmd { margin: 16px 0 24px; }
.cmd-run { border-radius: 8px; background: var(--code); }
.cmd-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 16px; border-bottom: 1px solid #38383a; color: var(--on-code-muted); font: 400 12px/1.5 var(--sans); }
.cmd-run :focus-visible { outline-color: var(--route); }
.cmd-run pre {
  margin: 0;
  padding: 14px 16px;
  /* Commands stay on one line, as a terminal shows them; long ones scroll sideways. */
  overflow-x: auto;
  color: var(--on-code);
  font: 400 14px/1.5 var(--mono);
}
.cmd-run code::before { content: "$ "; color: var(--on-code-muted); }
.cmd-file code::before { content: none; }
.copy {
  min-height: 32px;
  padding: 3px 10px;
  border: 1px solid #48484a;
  border-radius: 4px;
  background: var(--code);
  color: var(--on-code);
  font: 400 13px/1.5 var(--sans);
  cursor: pointer;
}
.copy:hover { border-color: var(--on-code-muted); }
.cmd-run:has(+ .cmd-result) { border-radius: 8px 8px 0 0; }
.cmd-result {
  padding: 12px 16px 14px;
  border: 1px solid var(--hairline);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  font-size: 15px;
}
.cmd-result strong { display: block; margin-bottom: 2px; font-size: 14px; font-weight: 600; }
.cmd-result p { margin: 0; }
.cmd-result pre { margin: 0; overflow-x: auto; font: 400 13px/1.6 var(--mono); }
.cmd-result pre + p { margin-top: 8px; }

/* Values and credentials that change or expire */
.volatile {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--volatile-bg);
  color: var(--volatile);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

/* OS tabs */
.tablist { display: flex; gap: 4px; margin: 16px 0; border-bottom: 1px solid var(--hairline); }
.tablist button {
  margin-bottom: -1px;
  padding: 7px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 500 15px/1.5 var(--sans);
  cursor: pointer;
}
.tablist button:hover { color: var(--ink); }
.tablist button[aria-selected="true"] { border-bottom-color: var(--route-text); color: var(--route-text); }

details.alt { margin: 16px 0; padding: 10px 16px; border: 1px solid var(--hairline); border-radius: 8px; }
details.alt summary { font-weight: 500; cursor: pointer; }
details.alt[open] summary { margin-bottom: 8px; }
details.alt p:last-child { margin-bottom: 0; }

figure { margin: 16px 0 24px; }
figure img, figure video {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
figure .shot-small { max-width: min(320px, 100%); margin-inline: auto; }
figure:has(.shot-small) figcaption { text-align: center; }
figcaption { margin-top: 8px; color: var(--muted); font-size: 15px; }
.shot-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0 24px; }
.shot-pair figure { margin: 0; }

/* Diagrams keep their drawn size and scroll inside their own box on phones. */
.diagram { overflow-x: auto; border: 1px solid var(--hairline); border-radius: 8px; }
.diagram svg { display: block; width: 100%; min-width: 680px; }
.diagram text { font-family: var(--sans); }
.diagram .name { fill: var(--ink); font-size: 14px; font-weight: 600; }
.diagram .sub { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.diagram .note { fill: var(--muted); font-size: 12px; }
.diagram .zone, .diagram .edge { fill: var(--muted); font-size: 12px; font-weight: 500; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; }
th, td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
thead th { color: var(--muted); font-weight: 500; }
tbody th { font-weight: 600; white-space: nowrap; }

.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 64px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--hairline); border-radius: 8px; color: var(--ink); text-decoration: none; }
.pager a:hover { border-color: var(--route-text); }
.pager span { display: block; color: var(--muted); font-size: 13px; }
.pager strong { color: var(--route-text); font-weight: 500; }
.pager-next { grid-column: 2; text-align: right; }

/* Home: mobile first. The route is a tunnel, running down on narrow screens and across on wide ones. */
.home-wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.hero { padding: 40px 0 24px; border-bottom: 1px solid var(--hairline); }
.home h1 { font-size: 32px; letter-spacing: -0.01em; }
.home-head { display: grid; gap: 24px; }
.home-head .lede { margin: 0; }
.regulars { padding-top: 16px; border-top: 1px solid var(--hairline); }
.regulars h2 { margin: 0 0 6px; font-size: 16px; }
.regulars ul { margin: 0; padding: 0; list-style: none; font-size: 15px; line-height: 1.9; }

.map { margin: 40px 0 0; padding: 0; list-style: none; }
.map > li { position: relative; min-height: 88px; padding: 0 0 32px 56px; }
.map > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  bottom: -20px;
  width: 4px;
  background: var(--route);
  transform-origin: top;
}
.map-num {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--route-text);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--route-text);
  font-size: 16px;
  font-weight: 600;
}
.map h2 { margin: 2px 0 4px; font-size: 18px; line-height: 1.5; }
.map p { margin: 0 0 8px; color: var(--muted); font-size: 15px; line-height: 1.7; }

.use { padding: 40px 0 64px; scroll-margin-top: 56px; }
.use > h2 { margin: 0 0 16px; }
.ways { display: grid; gap: 16px; }
.way { min-width: 0; padding: 24px; border-radius: 8px; }
.way h3 { margin: 0 0 8px; }
.way p { margin: 0 0 12px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.way-web { display: grid; gap: 16px; background: var(--surface); }
/* The card draws its own border and corners, so the screenshot frame is dropped. */
.card-shot { margin: 0; }
.card-shot img { width: 240px; margin-inline: auto; border: 0; border-radius: 0; }
/* Buttons sit exactly on the screenshot's own Jupyter and Desktop; ::before widens the touch target. */
.card-hot { position: relative; width: min(288px, 100%); margin-inline: auto; }
.card-shot .card-hot img { width: 100%; }
.card-btn { position: absolute; top: 86.4%; width: 42.8%; height: 9.2%; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: help; }
.card-btn::before { content: ""; position: absolute; inset: -12px -5px; }
.card-btn-jupyter { left: 5.2%; }
.card-btn-desktop { left: 52%; }
.card-hint { font-size: 14px; }
/* Floats over the card while the button is hovered; pointer-events off so it vanishes as soon as the mouse leaves. */
.way-pop { position: absolute; z-index: 1; left: 0; right: 0; bottom: calc(13.6% + 10px); padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--canvas); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); color: var(--ink); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 120ms, visibility 120ms; }
.card-btn:hover + .way-pop, .card-btn:focus-visible + .way-pop { opacity: 1; visibility: visible; }
.way-pop::after { content: ""; position: absolute; bottom: -6px; width: 10px; height: 10px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: var(--canvas); transform: rotate(45deg); }
.way-pop-jupyter::after { left: calc(26.6% - 5px); }
.way-pop-desktop::after { left: calc(73.4% - 5px); }
.way-pop h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.way-pop .pros-cons { gap: 4px 10px; font-size: 13px; line-height: 1.55; }
.way-pop .pros-cons ul { padding-left: 15px; }
.way-pop p { margin: 0; font-size: 13px; line-height: 1.55; }
/* Restart and Delete sit in the card's top-right menu, so their notes open below the item. */
.card-btn-restart, .card-btn-delete { left: 70.5%; width: 24.4%; height: 8.4%; }
.card-btn-restart { top: 11%; }
.card-btn-delete { top: 19.5%; }
/* The two rows touch, so each touch target grows only away from the other. */
.card-btn-restart::before { inset: -12px -5px 0; }
.card-btn-delete::before { inset: 0 -5px -12px; }
.way-pop-restart, .way-pop-delete { bottom: auto; }
.way-pop-restart { top: calc(19.4% + 10px); }
.way-pop-delete { top: calc(27.9% + 10px); }
.way-pop-restart::after, .way-pop-delete::after { top: -6px; bottom: auto; left: calc(82.7% - 5px); transform: rotate(225deg); }
/* Pros and cons: same layout in the popovers and the SSH panel. */
.pros-cons { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 14px; line-height: 1.65; }
.pros-cons dt { font-weight: 600; }
.pros-cons dd { margin: 0; }
.pros-cons ul { margin: 0; padding-left: 18px; }
.way-ssh .pros-cons { margin-bottom: 16px; padding: 12px 0; border-top: 1px solid #48484a; border-bottom: 1px solid #48484a; }
.way-ssh li code { background: #38383a; }
/* SSH happens in a terminal, so its panel is one. */
.way-ssh { background: var(--code); color: var(--on-code); }
.way-ssh p { color: var(--on-code-muted); }
.way-ssh a { color: var(--route); }
.way-steps { margin: 0 0 16px; padding-left: 22px; columns: 2; column-gap: 32px; font-size: 15px; line-height: 2; }
.way-term { margin: 0 0 16px; padding: 12px 0; overflow-x: auto; border-top: 1px solid #48484a; border-bottom: 1px solid #48484a; font: 400 13px/1.8 var(--mono); }

@media (min-width: 900px) {
  .home-wrap { padding: 0 24px; }
  .hero { padding: 56px 0 32px; }
  .home h1 { font-size: 40px; line-height: 1.25; }
  .home-head { grid-template-columns: minmax(0, 1fr) 240px; align-items: end; gap: 48px; }
  .home-head .lede { font-size: 17px; }
  .regulars { padding: 0 0 0 20px; border-top: 0; border-left: 1px solid var(--hairline); }
  .map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 48px; }
  .map > li { min-height: 0; padding: 60px 0 24px; }
  .map > li:not(:last-child)::after {
    left: 20px;
    top: 18px;
    bottom: auto;
    width: calc(100% + 24px);
    height: 4px;
    border-radius: 0;
    transform-origin: left;
  }
  .use { padding: 56px 0 96px; }
  .ways { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .way-web { grid-template-columns: minmax(0, 1fr) 288px; align-items: start; gap: 24px; }
  .card-shot { align-self: center; }
  .card-shot img { width: 288px; }
}

@media (prefers-reduced-motion: no-preference) {
  .map > li::after { animation: draw 0.3s ease-out both; }
  .map > li:nth-child(2)::after { animation-delay: 0.3s; }
  .map > li:nth-child(3)::after { animation-delay: 0.6s; }
  @keyframes draw { from { transform: scaleY(0); } }
  @keyframes draw-across { from { transform: scaleX(0); } }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 900px) {
  .map > li::after { animation-name: draw-across; }
}

@media (max-width: 1100px) {
  :root { --doc-width: 968px; }
  .doc { grid-template-columns: 240px minmax(0, 680px); }
  .toc { display: none; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 16px; }
  .top-links { gap: 12px; }
  .home-wrap { padding: 0 16px; }
  .steps > li { padding-left: 38px; }
  .doc { display: block; padding: 0 16px; }
  .doc-nav { position: static; max-height: none; padding: 0; border-bottom: 1px solid var(--hairline); }
  .nav-toggle summary { display: block; padding: 12px 0; font-weight: 500; cursor: pointer; }
  .nav-toggle[open] summary { margin-bottom: 8px; }
  .nav-toggle .side-list { margin-bottom: 16px; }
  .doc-main { padding-top: 24px; }
  .shot-pair { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
}

body.page-home { --doc-width: 992px; }

/* Command blocks now sit inside list items, so undo the inline-code chip. */
pre code { padding: 0; background: none; font-size: inherit; font-weight: inherit; }

/* Numbered steps, drawn like the route */
.steps { margin: 24px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 32px 44px; counter-increment: step; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--route-text);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--route-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--route);
}
.steps > li > h2, .steps > li > h3 { margin: 0 0 10px; }
.steps > li > h2 { scroll-margin-top: 8px; }
/* Subheadings inside a step (after its h2 title) keep the normal h3 spacing. */
.steps > li > h2 ~ h3 { margin: 32px 0 8px; scroll-margin-top: 8px; }
.steps > li > :last-child { margin-bottom: 0; }

/* Callouts: consequence first, then what to do */
.callout { display: flex; gap: 12px; margin: 16px 0 24px; padding: 12px 16px; border: 1px solid; border-radius: 8px; font-size: 15px; line-height: 1.7; }
.callout svg { flex: none; width: 20px; height: 20px; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.callout strong { display: block; font-weight: 600; }
.callout p { margin: 0; color: var(--ink); }
.callout code { background: rgba(255, 255, 255, 0.7); }
.callout-danger { border-color: #fecdca; background: var(--danger-bg); color: var(--danger); }
.callout-volatile { border-color: #f2dfb0; background: var(--volatile-bg); color: var(--volatile); }

.prereq { margin: 24px 0 0; padding: 14px 18px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); font-size: 15px; line-height: 1.7; }
.prereq strong { display: block; margin-bottom: 4px; font-weight: 600; }
.prereq ul { margin: 0; padding-left: 20px; }
.prereq li code { background: var(--canvas); }

details.alt { font-size: 15px; }
details.alt ul { margin: 0; padding-left: 20px; }

.hero .callout { margin: 8px 0 0; }

/* Marks the control to press on a screenshot; the caption says the same in words. */
.shot-marked { position: relative; display: block; }
.shot-mark { position: absolute; border: 2px solid var(--route); border-radius: 6px; box-shadow: 0 0 0 3px rgba(0, 212, 164, 0.3); pointer-events: none; }

.tablist button, .copy, .pager a { transition: color 150ms, background-color 150ms, border-color 150ms; }
@media (prefers-reduced-motion: reduce) {
  .tablist button, .copy, .pager a { transition: none; }
}
@media (pointer: coarse) { .copy { min-height: 44px; } }
@media (max-width: 480px) {
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: auto; }
}

/* Floating cards stay open while the mouse is on them; the short hide delay lets it cross the gap from the trigger. */
.float-card { position: absolute; z-index: 2; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--canvas); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); color: var(--ink); font-size: 14px; line-height: 1.6; text-align: left; white-space: normal; opacity: 0; visibility: hidden; transition: opacity 120ms 200ms, visibility 120ms 200ms; }
/* Visibility flips at once on open: links inside must be focusable the moment Tab reaches them. */
.float-host:hover > .float-card, .float-host:has(:focus-visible) > .float-card { opacity: 1; visibility: visible; transition: opacity 120ms, visibility 0s; }
.float-card strong { display: block; font-weight: 600; }

.contact-host { position: relative; display: flex; align-items: center; }
.contact-link { display: flex; align-items: center; min-height: 44px; }
.contact-card { top: calc(100% - 2px); right: 0; width: max-content; max-width: calc(100vw - 32px); }
.contact-card p { margin: 0 0 8px; color: var(--muted); }
.contact-card dl { display: grid; grid-template-columns: auto auto; gap: 4px 12px; margin: 0; }
.contact-card dt { font-weight: 600; }
.contact-card dd { margin: 0; }
.top-links .contact-card a { color: var(--route-text); text-decoration: underline; }

.map-host { position: relative; }
.map-card { top: 100%; left: 0; display: block; width: min(320px, calc(100vw - 88px)); }
.map-card iframe { display: block; width: 100%; height: 200px; margin: 8px 0; border: 0; border-radius: 4px; background: var(--surface); }
.map-note { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
/* Touch screens have no hover: the triggers are plain links, so a tap goes straight to Google Maps or the contact section. */
@media (hover: none) { .map-card, .contact-card { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .way-pop { transition: none; }
  /* Only the fade goes; the hide delay stays so the mouse can still cross into the card. */
  .float-card, .float-host:hover > .float-card, .float-host:has(:focus-visible) > .float-card { transition-duration: 0s; }
}
