/* Workshop walkthrough: one scrolling page. The coloured boxes take their colours
   straight from the README's own <div style="..."> attributes. */

:root {
  --bg: #f6f5fa;
  --surface: #ffffff;
  --text: #1c1830;
  --muted: #625d78;
  --border: #e6e3ef;
  --border-strong: #d2cde0;
  --accent: #4e2a84;
  --on-accent: #ffffff;
  --ok: #2f9e5b;
  --on-ok: #ffffff;
  --cell: #e9e6f0;
  --th-bg: #f3f2f7;
  --prompt-bg: #ececf0;
  --prompt-tag: #d9d8e0;
  --prompt-tag-ink: #625d78;
  --part-bg: #f7f5fc;
  --part-border: #e2dcef;
  --part-hover: #f0ecf8;
  --verify-bar: #e5484d;
  --on-verify: #ffffff;
  --improve-bar: #f08c2e;
  --improve-bg: #ffedd6;
  --improve-border: #f5c99a;
  --improve-hover: #ffe3c2;
  --error: #b4232a;
  --shadow: rgba(30, 10, 60, .08);
  --hl-cmd: #0550ae; --hl-flag: #953800; --hl-str: #0a6b2d; --hl-var: #8250df; --hl-com: #6e7781;
  --hl-prompt: #8250df; --hl-out: #57606a; --hl-kw: #cf222e; --hl-num: #0550ae;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* dark mode (the moon button) */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #13111a; --surface: #1d1a26; --text: #ece9f5; --muted: #aaa4bf;
  --border: #2c2839; --border-strong: #433d58; --accent: #b9a2f0; --on-accent: #13111a;
  --ok: #3ec276; --on-ok: #08140d; --cell: #2a2637; --th-bg: #26222f;
  --prompt-bg: #2a2735; --prompt-tag: #3d3852; --prompt-tag-ink: #d6d0ea;
  --part-bg: #221f2d; --part-border: #352f48; --part-hover: #2b2739;
  --verify-bar: #f2555a; --on-verify: #1a0506;
  --improve-bar: #f59a45; --improve-bg: #35261a; --improve-border: #6e4a24; --improve-hover: #412f1f;
  --error: #ff8a8f; --shadow: rgba(0, 0, 0, .45);
  --hl-cmd: #79c0ff; --hl-flag: #ffa657; --hl-str: #7ee787; --hl-var: #d2a8ff; --hl-com: #8b949e;
  --hl-prompt: #d2a8ff; --hl-out: #a5aab3; --hl-kw: #ff7b72; --hl-num: #79c0ff;
}

/* high contrast (the half-circle button): black on white, with colours that stay apart for
   colour-blind readers: blue for done, vermillion for Verify, amber for Improvements */
html[data-contrast="high"] {
  --bg: #ffffff; --surface: #ffffff; --text: #000000; --muted: #1f1f1f;
  --border: #5c5c5c; --border-strong: #000000; --accent: #3a0ca3; --on-accent: #ffffff;
  --ok: #0072b2; --on-ok: #ffffff; --cell: #e3e3e3; --th-bg: #e3e3e3;
  --prompt-bg: #ebebeb; --prompt-tag: #000000; --prompt-tag-ink: #ffffff;
  --part-bg: #ffffff; --part-border: #000000; --part-hover: #ededed;
  --verify-bar: #d55e00; --on-verify: #000000;
  --improve-bar: #e69f00; --improve-bg: #fff4d6; --improve-border: #000000; --improve-hover: #ffecb8;
  --error: #a30000;
  --hl-cmd: #0050a0; --hl-flag: #a14400; --hl-str: #006b4f; --hl-var: #7a3d8c; --hl-com: #444444;
  --hl-prompt: #000000; --hl-out: #1f1f1f; --hl-kw: #a8226b; --hl-num: #0050a0;
}
html[data-theme="dark"][data-contrast="high"] {
  --bg: #000000; --surface: #000000; --text: #ffffff; --muted: #e6e6e6;
  --border: #a3a3a3; --border-strong: #ffffff; --accent: #c9b6ff; --on-accent: #000000;
  --ok: #56b4e9; --on-ok: #000000; --cell: #262626; --th-bg: #1c1c1c;
  --prompt-bg: #1f1f1f; --prompt-tag: #ffffff; --prompt-tag-ink: #000000;
  --part-bg: #000000; --part-border: #ffffff; --part-hover: #1a1a1a;
  --verify-bar: #ff8a3d; --on-verify: #000000;
  --improve-bar: #f0e442; --improve-bg: #1f1c00; --improve-border: #f0e442; --improve-hover: #2b2700;
  --error: #ff9e9e;
  --hl-cmd: #56b4e9; --hl-flag: #e69f00; --hl-str: #2ee6a6; --hl-var: #f0a6d0; --hl-com: #cfcfcf;
  --hl-prompt: #ffffff; --hl-out: #e6e6e6; --hl-kw: #f0a6d0; --hl-num: #56b4e9;
}
html[data-contrast="high"] :focus-visible { outline-width: 3px; }

/* the n of "Step n", set the way LaTeX sets a variable (Computer Modern math italic, from KaTeX's fonts) */
@font-face { font-family: "KaTeX_Math"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.11/fonts/KaTeX_Math-Italic.woff2") format("woff2"); }
@font-face { font-family: "KaTeX_Math"; font-style: italic; font-weight: 700; font-display: swap;
  src: url("https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.11/fonts/KaTeX_Math-BoldItalic.woff2") format("woff2"); }
.math { font-family: "KaTeX_Math", "Latin Modern Math", "STIX Two Math", "Cambria Math", serif; font-style: italic; font-size: 1.15em; line-height: 1; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html.need-name #whoami[hidden] { display: grid !important; }
html { -webkit-text-size-adjust: 100%; }
html.need-name { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i .solid { fill: currentColor; }

.wrap { max-width: 860px; margin: 0 auto; padding: 28px 16px 96px; font-size: calc(16px * var(--scale, 1)); }
.hero, .card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.hero { padding: 28px 30px 24px; }
.hero h1 { margin: 0 0 10px; font-size: calc(clamp(28px, 4.5vw, 38px) * var(--scale, 1)); line-height: 1.15; letter-spacing: -.02em; }
.card { margin-top: 18px; padding: 22px 30px 24px; }
.card h2 { margin: 0 0 8px; font-size: 1.25em; }
@media (max-width: 680px) {
  .hero, .card { padding-left: 18px; padding-right: 18px; }
}

/* ---------- README markdown ---------- */

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol { margin: .6em 0; }
.md ul, .md ol { padding-left: 1.35em; }
.md li { margin: .25em 0; }
.md li > ul, .md li > ol { margin: .25em 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }
.md table { width: 100%; border-collapse: collapse; font-size: .9375em; margin: .8em 0; }
.md th, .md td { text-align: left; vertical-align: top; padding: 9px 12px; border: 1px solid var(--border-strong); }
.md th { background: var(--th-bg); }
.shot { display: block; max-width: 100%; height: auto; margin: 10px 0; background: var(--cell); }
.img-missing { color: var(--error); font-size: .875em; }

/* prompts: anything quoted (>) or in backticks, with "prompt" written in the line */
.prompt { margin: 14px 0; padding: 12px 16px; background: var(--prompt-bg); border-radius: 14px; }
.prompt > :first-child { margin-top: 0; }
.prompt > :last-child { margin-bottom: 0; }
.prompt pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: .875em/1.55 var(--mono); }
.prompt-inline {
  padding: 1px 7px 1px 4px; background: var(--prompt-bg); border-radius: 8px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
/* code to run: a ``` block with a label (```bash, ```gpu_check.sh), shown with that label */
.code { margin: 14px 0; padding: 9px 14px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; }
.code-tag { display: inline-block; margin-bottom: 6px; padding: 0 7px; border-radius: 6px; background: var(--cell); color: var(--muted); font: 600 .75em/1.6 var(--mono); }
.code pre { margin: 0; overflow-x: auto; font: .8125em/1.55 var(--mono); }
/* two code blocks in a row: side by side (one above the other on narrow screens) */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; align-items: start; }
.split > .code { min-width: 0; margin: 0; }
.split .code pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75em; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
/* code colours: the command, its options, text in quotes, $VARIABLES, notes, the $ prompt, output */
.t-cmd, .t-fn { color: var(--hl-cmd); }
.t-cmd { font-weight: 700; }
.t-flag, .t-dir { color: var(--hl-flag); }
.t-dir { font-weight: 700; }
.t-str { color: var(--hl-str); }
.t-var { color: var(--hl-var); }
.t-com { color: var(--hl-com); font-style: italic; }
.t-prompt { color: var(--hl-prompt); user-select: none; -webkit-user-select: none; }   /* copy the command, not the $ */
.t-out { color: var(--hl-out); }
.t-kw, .t-op { color: var(--hl-kw); }
.t-kw { font-weight: 700; }
.t-num { color: var(--hl-num); }
.md h4 { margin: 1.5em 0 .3em; font-size: 1.0625em; }
.step-body > .md > h4:first-child { margin-top: 24px; }
.p-tag {
  display: inline-block; margin-right: 7px; padding: 0 7px; border-radius: 6px;
  background: var(--prompt-tag); color: var(--prompt-tag-ink);
  font: 600 .75em/1.6 var(--font); vertical-align: 1px;
}

/* ---------- steps ---------- */

.step { margin-top: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; scroll-margin-top: 16px; }
.step > summary, .part > summary { list-style: none; display: flex; align-items: center; cursor: pointer; }
.step > summary::-webkit-details-marker, .part > summary::-webkit-details-marker { display: none; }
.step > summary { gap: 14px; padding: 16px 20px; }
.s-title { flex: 1; font-size: 1.25em; font-weight: 700; line-height: 1.3; }
.mark {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border: 2px solid var(--border-strong); border-radius: 50%; color: transparent;
}
.mark .i { width: 15px; height: 15px; stroke-width: 3.2; }
.step.is-done .mark { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.chev { display: grid; place-items: center; color: var(--muted); transition: transform .2s; }
.chev .i { width: 20px; height: 20px; }
details[open] > summary > .chev { transform: rotate(180deg); }
.step-body { padding: 0 26px 24px 60px; }
@media (max-width: 680px) {
  .step > summary { padding: 14px 16px; gap: 12px; }
  .step-body { padding: 0 16px 20px; }
}

/* the Task box (colours come from its inline style in the README) */
.callout { color: #1c1830; }
.callout a { color: #4e2a84; }   /* the README's boxes stay light in dark mode too */

/* everything else in a step: Prompts, Tips, Verify, Improvements, success, notes */
.part { margin: 12px 0; background: var(--part-bg); border: 1px solid var(--part-border); border-radius: 12px; }
.part > summary { gap: 10px; padding: 11px 14px; border-radius: 12px; font-weight: 700; }
.part > summary:hover { background: var(--part-hover); }
.part[open] > summary { border-bottom: 1px solid var(--part-border); border-radius: 12px 12px 0 0; }
.part.verify > summary, .part.improve > summary, .part.box > summary { font-weight: 400; }
.part.verify { border-left: 8px solid var(--verify-bar); }
.part.improve { background: var(--improve-bg); border-color: var(--improve-border); border-left: 8px solid var(--improve-bar); }
.tag-mandatory {
  flex: none; padding: 1px 9px; border-radius: 999px; background: var(--verify-bar); color: var(--on-verify);
  font-size: .72em; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.part.improve > summary:hover { background: var(--improve-hover); }
.part.improve[open] > summary { border-bottom-color: var(--improve-border); }
.p-title { flex: 1; }
.part-body { padding: 12px 16px 14px; }
.part-body > .md + .tick { margin-top: 10px; }

/* ---------- check boxes ---------- */

.tick { position: relative; display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 4px; cursor: pointer; font-weight: 650; user-select: none; -webkit-user-select: none; }
.tick input { position: absolute; left: 0; width: 22px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.tick .box { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border: 2px solid var(--border-strong); border-radius: 6px; background: var(--surface); }
.tick .box .i { width: 15px; height: 15px; stroke: var(--on-ok); stroke-width: 3.2; opacity: 0; }
.tick input:checked + .box { background: var(--ok); border-color: var(--ok); }
.tick input:checked + .box .i { opacity: 1; }
.tick input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.tick input:disabled, .tick input:disabled ~ * { cursor: not-allowed; }
.tick input:disabled ~ * { opacity: .45; }

.finish { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.tick.big { display: flex; margin: 0; font-size: 1.0625em; }
.tick.big .box { width: 26px; height: 26px; border-radius: 7px; }
.tick.big input { width: 26px; height: 26px; }
.gate-hint { display: none; margin: 6px 0 0; color: var(--muted); font-size: .875em; }
.finish.locked .gate-hint { display: block; }

/* ---------- who's done ---------- */

.room { margin-top: 16px; }
.room-head { display: flex; align-items: baseline; gap: 10px; font-size: .875em; }
.room-title { font-weight: 700; }
.room-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 4px; margin-top: 8px; }
.grid:empty { display: none; }
.cell {
  height: 26px; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap;
  background: var(--cell); color: var(--muted); border-radius: 5px; font-size: .66em; font-weight: 700;
}
.cell.done { background: var(--ok); color: var(--on-ok); }

/* top right: text size, contrast and dark mode, then your name once you have checked in */
.topbar { position: fixed; top: 14px; right: 16px; z-index: 30; display: flex; align-items: center; gap: 8px; }
.display {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 4px 14px var(--shadow);
}
.disp {
  width: 32px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px;
  background: none; color: var(--text); font: 700 13px/1 var(--font); cursor: pointer;
}
.disp:hover { background: var(--part-hover); }
.disp[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.disp:disabled { opacity: .35; cursor: default; background: none; }
.disp .i { width: 16px; height: 16px; }
html[data-theme="dark"] .when-light, html:not([data-theme="dark"]) .when-dark { display: none; }
.me-tag {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: min(300px, calc(100vw - 196px)); padding: 6px 13px 6px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 4px 14px var(--shadow);
  color: var(--text); font: 650 14px/1.6 var(--font); cursor: pointer;
}
.me-tag:hover { border-color: var(--accent); }
.me-tag .i { color: var(--accent); }
.me-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 680px) { .wrap { padding-top: 64px; } }

/* ---------- the right side: the Progress box, then the timeline ---------- */

.side { position: fixed; top: 72px; left: calc(50% + 438px); z-index: 20; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }

/* who is on the website: people and bots, closed until you open it */
.stats { width: 190px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; font-size: 13.5px; }
.stats > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 12px; border-radius: 12px; cursor: pointer; font-weight: 700; }
.stats > summary::-webkit-details-marker { display: none; }
.stats > summary:hover { background: var(--part-hover); }
.stats[open] > summary { border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.stats .chev .i { width: 16px; height: 16px; }
.stats-title { flex: 1; }
.stats-body { margin: 0; padding: 6px 12px 9px; }
.stats-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0; }
.stats-row dt { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.stats-row dt .i { color: var(--accent); }
.stats-row dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 1319px) {   /* no room beside the page: it floats in the bottom right corner */
  .stats { position: fixed; right: 16px; bottom: 16px; box-shadow: 0 6px 22px var(--shadow); }
}

/* the timeline: one dot per step, green once you are done with it */
.toc ol { position: relative; margin: 0; padding: 0; list-style: none; }
.toc ol::before { content: ""; position: absolute; top: 12px; bottom: 12px; left: 11px; width: 2px; border-radius: 1px; background: var(--border-strong); }
.toc li + li { margin-top: 18px; }
.toc a {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; line-height: 24px; text-decoration: none;
}
.toc-dot {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center; border: 2px solid var(--border-strong);
  border-radius: 50%; background: var(--surface); font-size: 11.5px; font-weight: 700; transition: background .2s, border-color .2s, color .2s;
}
.toc-label { max-width: calc(50vw - 496px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-dot .i { display: none; width: 14px; height: 14px; stroke: var(--on-ok); stroke-width: 3.2; }
.toc a:hover { color: var(--text); }
.toc a:hover .toc-dot { border-color: var(--accent); color: var(--accent); }
.toc a.done .toc-dot { background: var(--ok); border-color: var(--ok); }
.toc a.done .toc-num { display: none; }
.toc a.done .toc-dot .i { display: block; }
@media (max-width: 1319px) {  /* no room beside the page for the titles: dots only, title on hover */
  .toc-label {
    position: absolute; top: 50%; right: calc(100% + 8px); max-width: none; padding: 0 9px; border-radius: 7px;
    background: var(--text); color: var(--surface); font-size: 12.5px; opacity: 0; pointer-events: none;
    transform: translateY(-50%); transition: opacity .15s;
  }
  .toc a:hover .toc-label, .toc a:focus-visible .toc-label { opacity: 1; }
}
@media (max-width: 959px) { .toc { display: none; } }   /* no room beside the page at all */
@media (prefers-reduced-motion: reduce) { .toc-dot, .toc-label { transition: none; } }

/* ---------- extra ("Step n"): after a line, closed until someone opens it ---------- */

.extra-line { margin: 80px 0 0; border: 0; border-top: 2px dashed var(--border-strong); }
.extra { margin-top: 32px; border: 2px dashed var(--border-strong); border-radius: 16px; }
.extra > summary { list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding: 16px 20px; border-radius: 14px; cursor: pointer; }
.extra > summary::-webkit-details-marker { display: none; }
.extra > summary:hover { background: var(--part-hover); }
.extra-title { font-size: 1.375em; font-weight: 800; letter-spacing: -.01em; }
.extra-what { flex: 1; color: var(--muted); }
.extra-body { padding: 0 16px 16px; }
.extra-body > .step:first-child { margin-top: 0; }
.extra-info > .step-body { padding: 0 20px 22px; }
/* a page shown inside this one (an <iframe> in the README) */
.embed { display: block; width: 100%; height: min(75vh, 720px); margin: 14px 0 4px; border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; }

/* ---------- who am I ---------- */

.whoami { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.whoami-card { width: min(420px, 100%); padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 50px rgba(30, 10, 60, .12); }
.whoami-card h2 { margin: 0 0 16px; font-size: 30px; letter-spacing: -.02em; }
.whoami-card input {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 17px; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 10px;
}
.whoami-card input:focus { outline: none; border-color: var(--accent); }
.error { margin: 8px 0 0; color: var(--error); font-size: 14px; font-weight: 600; }
.primary { width: 100%; margin-top: 14px; padding: 12px 18px; cursor: pointer; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 700; }
.primary:disabled { opacity: .6; cursor: wait; }

/* ---------- instructor (GitHub Pages version) ---------- */

.link { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: .875em; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--accent); }
.whoami-links { display: flex; justify-content: center; gap: 22px; margin-top: 16px; }
.instructor { z-index: 70; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.signed-in { margin: 0 0 4px; }
.instructor .hint { margin: 8px 0 14px; color: var(--muted); font-size: 14px; }
.primary.danger { background: #b4232a; color: #fff; }
.instructor .note { margin: 10px 0 0; color: var(--ok); font-size: 14px; font-weight: 600; }   /* not the README's notes */

/* only used when something could not be saved */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 10px; background: #b4232a; color: #fff; font-size: 14.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
