thegovind's picture
Publish the weight-space programming labs (part 2)
84bcfb1 verified
Raw History Blame Contribute Delete
19.8 kB
/* Weight-space programming lab: Blink's light paper theme. One cobalt accent, one lime flash, Geist type.
Light only: a dark system setting draws the same page. */
@font-face{font-family:"Geist";font-style:normal;font-weight:100 900;font-display:swap;src:url(fonts/geist-latin-ext-wght-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Geist";font-style:normal;font-weight:100 900;font-display:swap;src:url(fonts/geist-latin-wght-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Geist";font-style:italic;font-weight:100 900;font-display:swap;src:url(fonts/geist-latin-ext-wght-italic.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Geist";font-style:italic;font-weight:100 900;font-display:swap;src:url(fonts/geist-latin-wght-italic.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Geist Mono";font-style:normal;font-weight:100 900;font-display:swap;src:url(fonts/geist-mono-latin-ext-wght-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Geist Mono";font-style:normal;font-weight:100 900;font-display:swap;src:url(fonts/geist-mono-latin-wght-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
:root {
--color-canvas: #f5f5f5;
--color-paper: #ffffff;
--color-surface-alt: #fafafa;
--color-ink: #0a0a0a;
--color-ink-soft: #171717;
--color-mid-gray: #737373;
--color-mid-gray-canvas: #666666;
--color-hairline: #e5e5e5;
--color-accent: #2447f5;
--color-accent-hover: #1c38d0;
--color-accent-tint: #eef1fe;
--color-flash: #d4f55c;
--color-flash-ink: #0a0a0a;
--canvas: var(--color-canvas);
--paper: var(--color-paper);
--alt: var(--color-surface-alt);
--ink: var(--color-ink);
--ink-soft: var(--color-ink-soft);
--mid: var(--color-mid-gray);
--mid-c: var(--color-mid-gray-canvas);
--line: var(--color-hairline);
--line-strong: #d4d4d4;
--accent: var(--color-accent);
--accent-ink: var(--color-accent-hover);
--accent-tint: var(--color-accent-tint);
--flash: var(--color-flash);
--font-geist: Geist, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-geist-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
--text-caption: 12px;
--text-body: 14px;
--text-heading-sm: 24px;
--radius-cards: 24px;
--radius-pill: 18px;
--radius-nested: 10px;
--radius-small: 6px;
--shadow-subtle: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
--ring: 0 0 0 2px var(--color-paper), 0 0 0 4px var(--color-accent);
--ease: cubic-bezier(0.22, 0.8, 0.3, 1);
--gutter: clamp(16px, 4vw, 32px);
--top-h: 56px;
color-scheme: only light;
}
/* --- shell --------------------------------------------------------------------------- */
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
background: var(--canvas);
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
scroll-padding-top: calc(var(--top-h) + 16px);
}
body {
margin: 0;
/* a column, so a short page still puts the footer at the bottom of the window */
display: flex;
flex-direction: column;
min-height: 100vh;
min-height: 100dvh;
background: var(--canvas);
color: var(--ink);
font-family: var(--font-geist);
font-size: var(--text-body);
line-height: 1.5;
font-feature-settings: "ss01" on, "cv11" on;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
color: var(--accent);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 3px;
}
a:hover {
color: var(--accent-ink);
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
::selection {
background: var(--accent-tint);
}
.skip {
position: absolute;
left: 12px;
top: -48px;
z-index: 20;
padding: 8px 14px;
border-radius: var(--radius-pill);
background: var(--paper);
border: 1px solid var(--line);
color: var(--ink);
font-weight: 500;
text-decoration: none;
}
.skip:focus {
top: 10px;
}
/* --- top bar: frosted over the canvas ----------------------------------------------- */
.top {
position: sticky;
top: 0;
z-index: 10;
background: rgba(245, 245, 245, 0.82);
-webkit-backdrop-filter: saturate(180%) blur(12px);
backdrop-filter: saturate(180%) blur(12px);
border-bottom: 1px solid var(--line);
}
.top-in {
max-width: 1280px;
height: var(--top-h);
margin: 0 auto;
padding: 0 var(--gutter);
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.brand {
color: var(--ink);
text-decoration: none;
font-weight: 600;
font-size: 18px;
letter-spacing: -0.03em;
line-height: 1;
white-space: nowrap;
}
.brand:hover {
color: var(--ink);
}
.top-links {
display: flex;
align-items: center;
gap: 2px;
}
.top-links a {
height: 32px;
display: inline-flex;
align-items: center;
padding: 0 12px;
border-radius: var(--radius-pill);
color: var(--mid-c);
font-weight: 500;
text-decoration: none;
white-space: nowrap;
transition: background-color 0.15s ease, color 0.15s ease;
}
.top-links a:hover {
background: rgba(10, 10, 10, 0.05);
color: var(--ink);
}
/* where you are: the page (or, on a lab, the labs) on paper */
.top-links a[aria-current] {
background: var(--paper);
color: var(--ink);
box-shadow: inset 0 0 0 1px var(--line);
}
/* --- pages: one column on paper, the contents beside it ------------------------------- */
.page {
max-width: 1120px;
margin: 0 auto;
padding: 32px var(--gutter) 24px;
display: grid;
grid-template-columns: minmax(0, 1fr) 208px;
gap: 40px;
align-items: start;
}
/* a page without contents (the results table) gets the width the contents would use; text keeps its measure */
.page.solo {
grid-template-columns: minmax(0, 1fr);
}
.page.solo .prose > :is(p, ul, ol, blockquote) {
max-width: 720px;
}
.doc {
min-width: 0;
}
.prose {
background: var(--paper);
border: 1px solid var(--line);
border-radius: var(--radius-cards);
box-shadow: var(--shadow-subtle);
padding: 40px 48px 44px;
min-width: 0;
/* a bare URL as link text would otherwise push a phone screen sideways */
overflow-wrap: break-word;
}
.toc {
position: sticky;
top: calc(var(--top-h) + 32px);
max-height: calc(100vh - var(--top-h) - 64px);
overflow-y: auto;
overscroll-behavior: contain;
scrollbar-width: thin;
}
.toc-title {
margin: 4px 0 8px;
font-size: var(--text-caption);
font-weight: 500;
letter-spacing: 0.05em;
text-transform: uppercase;
color: var(--mid-c);
}
.toc ul,
.tocm ul {
list-style: none;
margin: 0;
padding: 0;
border-left: 1px solid var(--line);
}
.toc li a,
.tocm li a {
display: block;
margin-left: -1px;
padding: 4px 0 4px 12px;
border-left: 2px solid transparent;
color: var(--mid-c);
font-size: 13px;
line-height: 1.4;
text-decoration: none;
}
.toc li.l3 a,
.tocm li.l3 a {
padding-left: 24px;
font-size: 12.5px;
}
.toc li a:hover,
.tocm li a:hover {
color: var(--ink);
}
.toc li a[aria-current="location"] {
color: var(--ink);
border-left-color: var(--accent);
}
.toc code,
.tocm code {
font-family: var(--font-geist-mono);
font-size: 0.92em;
}
.toc .katex,
.tocm .katex {
font-size: 1em;
}
.tocm {
display: none;
}
.tocm > summary {
cursor: pointer;
list-style: none;
display: flex;
align-items: center;
gap: 10px;
padding: 8px 0;
font-size: 13px;
font-weight: 500;
color: var(--ink-soft);
}
.tocm > summary::-webkit-details-marker {
display: none;
}
.tocm nav {
padding: 4px 0 12px;
}
/* a lab's neighbours, under the page */
.pager {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 16px;
margin: 16px 0 0;
}
.pager a {
display: flex;
flex-direction: column;
gap: 2px;
padding: 14px 20px;
border: 1px solid var(--line);
border-radius: var(--radius-pill);
background: var(--paper);
box-shadow: var(--shadow-subtle);
color: var(--ink);
text-decoration: none;
transition: border-color 0.15s ease;
}
.pager a:hover {
border-color: var(--line-strong);
color: var(--ink);
}
.pager span {
font-size: var(--text-caption);
font-weight: 500;
color: var(--mid-c);
}
.pager b {
font-size: 14px;
font-weight: 600;
line-height: 1.4;
}
.pager .next {
grid-column: 2;
text-align: right;
}
/* --- prose ----------------------------------------------------------------------------- */
.prose > :first-child {
margin-top: 0;
}
.prose h1 {
margin: 0 0 16px;
font-size: 36px;
font-weight: 600;
line-height: 1.15;
letter-spacing: -0.04em;
color: var(--ink);
}
/* a second part of a long page starts with its own title */
.prose * + h1 {
margin-top: 56px;
padding-top: 32px;
border-top: 1px solid var(--line);
font-size: 30px;
}
.prose h2 {
margin: 44px 0 12px;
font-size: var(--text-heading-sm);
font-weight: 600;
line-height: 1.33;
letter-spacing: -0.025em;
color: var(--ink);
}
.prose h3 {
margin: 32px 0 8px;
font-size: 18px;
font-weight: 600;
line-height: 1.4;
letter-spacing: -0.015em;
color: var(--ink);
}
.prose h4 {
margin: 24px 0 6px;
font-size: 15px;
font-weight: 600;
}
.prose :is(h1, h2, h3, h4) .anchor {
margin-left: 8px;
color: var(--line-strong);
font-weight: 500;
text-decoration: none;
opacity: 0;
transition: opacity 0.15s ease;
}
.prose :is(h1, h2, h3, h4):hover .anchor,
.prose :is(h1, h2, h3, h4) .anchor:focus-visible {
opacity: 1;
}
.prose :is(h1, h2, h3, h4) .anchor:hover {
color: var(--accent);
}
.prose p,
.prose li {
font-size: 15px;
line-height: 1.7;
color: var(--ink-soft);
}
.prose p {
margin: 0 0 14px;
}
.prose :is(ul, ol) {
margin: 0 0 14px;
padding-left: 22px;
}
.prose li {
margin: 4px 0;
}
.prose li > :is(ul, ol) {
margin: 4px 0 0;
}
.prose li > p {
margin: 0 0 6px;
}
.prose li::marker {
color: var(--mid);
}
.prose strong {
font-weight: 600;
color: var(--ink);
}
.prose hr {
border: 0;
height: 1px;
background: var(--line);
margin: 32px 0;
}
.prose blockquote {
margin: 0 0 14px;
padding: 2px 0 2px 16px;
border-left: 2px solid var(--line-strong);
}
.prose blockquote p {
color: var(--mid-c);
}
.prose :not(pre) > code {
font-family: var(--font-geist-mono);
font-size: 0.86em;
padding: 1px 6px;
border-radius: var(--radius-small);
background: var(--canvas);
color: var(--ink);
overflow-wrap: anywhere;
}
.prose img {
display: block;
max-width: 100%;
height: auto;
margin: 8px 0 20px;
border-radius: var(--radius-nested);
border: 1px solid var(--line);
}
/* math: KaTeX, set a little smaller than its default so it sits with Geist */
.prose .katex {
font-size: 1.1em;
}
.math-display {
display: block;
margin: 0 0 14px;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: thin;
}
.math-display .katex-display {
margin: 0;
padding: 6px 0;
}
/* diagrams: drawn by Mermaid when the site was built, on a hairline card; a wide one scrolls rather than
shrink its labels past reading */
.prose .mermaid-svg {
margin: 4px 0 20px;
padding: 16px;
overflow-x: auto;
border: 1px solid var(--line);
border-radius: var(--radius-pill);
background: var(--paper);
scrollbar-width: thin;
}
.prose .mermaid-svg svg {
display: block;
margin: 0 auto;
width: 100%;
height: auto;
min-width: var(--mw, 0);
}
.prose .mermaid-svg p {
margin: 0;
font-size: inherit;
line-height: inherit;
color: inherit;
}
/* code: a hairline card with its language named and, with scripts on, a copy pill */
.code {
margin: 0 0 16px;
border: 1px solid var(--line);
border-radius: var(--radius-pill);
background: var(--alt);
overflow: hidden;
}
.code-head {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 36px;
padding: 4px 6px 4px 16px;
border-bottom: 1px solid var(--line);
background: var(--paper);
}
.code-lang {
font-family: var(--font-geist-mono);
font-size: 11.5px;
color: var(--mid);
}
.copy {
height: 26px;
padding: 0 10px;
border: 1px solid var(--line);
border-radius: var(--radius-pill);
background: var(--paper);
color: var(--ink-soft);
font-family: var(--font-geist);
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.15s ease, border-color 0.15s ease;
}
.copy:hover {
background: var(--alt);
border-color: var(--line-strong);
}
.copy.done {
background: var(--flash);
border-color: transparent;
color: var(--color-flash-ink);
}
.code pre {
margin: 0;
padding: 14px 16px;
overflow-x: auto;
font-family: var(--font-geist-mono);
font-size: 12.5px;
line-height: 1.65;
color: var(--ink-soft);
tab-size: 4;
}
.code code {
font-family: inherit;
}
/* code in a list sits with the item's text */
.prose li > .code {
margin: 8px 0 10px;
}
/* tables: a hairline card that scrolls sideways when the table is wider than the page */
.table-wrap {
margin: 0 0 18px;
overflow-x: auto;
border: 1px solid var(--line);
border-radius: var(--radius-pill);
background: var(--paper);
scrollbar-width: thin;
}
/* a box that scrolls sideways shows a soft shadow on the side with more to see */
.table-wrap,
.prose .mermaid-svg {
background:
linear-gradient(90deg, var(--paper) 30%, rgba(255, 255, 255, 0)) 0 0 / 40px 100% no-repeat local,
linear-gradient(270deg, var(--paper) 30%, rgba(255, 255, 255, 0)) 100% 0 / 40px 100% no-repeat local,
radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0)) 0 0 / 12px 100% no-repeat,
radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0)) 100% 0 / 12px 100% no-repeat,
var(--paper);
}
.prose table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
font-variant-numeric: tabular-nums;
}
.prose th,
.prose td {
padding: 8px 14px;
border: 0;
border-bottom: 1px solid var(--line);
text-align: left;
vertical-align: top;
line-height: 1.5;
}
.prose th {
font-size: var(--text-caption);
font-weight: 500;
color: var(--mid);
background: var(--alt);
/* headers wrap, as on GitHub: long ones ("cut answers ending in repetition %") would set the table's width */
}
.prose td {
color: var(--ink-soft);
}
/* code in a cell wraps only at a space or before a '/' (build.py marks those); a token never splits, and the table
scrolls sideways instead */
.prose code.cell {
overflow-wrap: normal;
word-break: normal;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.prose code.cell > span {
white-space: nowrap;
}
.prose tbody tr:last-child td {
border-bottom: 0;
}
/* progressive disclosure: a thin chevron that turns */
.prose details {
margin: 0 0 14px;
border-bottom: 1px solid var(--line);
}
.prose details > summary {
cursor: pointer;
list-style: none;
display: flex;
align-items: center;
gap: 10px;
padding: 12px 0;
font-size: var(--text-body);
font-weight: 500;
color: var(--ink-soft);
transition: color 0.15s ease;
}
.prose details > summary::-webkit-details-marker {
display: none;
}
.prose details > summary::before,
.tocm > summary::before {
content: "";
width: 6px;
height: 6px;
flex: none;
border-right: 1.5px solid currentColor;
border-bottom: 1.5px solid currentColor;
transform: rotate(-45deg);
transition: transform 0.2s var(--ease);
}
.prose details[open] > summary::before,
.tocm[open] > summary::before {
transform: rotate(45deg);
}
.prose details > summary:hover {
color: var(--ink);
}
.prose details[open] > summary {
margin-bottom: 4px;
}
/* --- footer ------------------------------------------------------------------------------ */
body > .top + * {
width: 100%;
margin-bottom: 48px;
}
.foot {
border-top: 1px solid var(--line);
margin-top: auto;
}
.foot-in {
max-width: 1280px;
margin: 0 auto;
padding: 20px var(--gutter) 40px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 12px 32px;
}
.foot-note {
margin: 0;
max-width: 72ch;
font-size: var(--text-caption);
line-height: 1.6;
color: var(--mid-c);
}
.foot-note a {
color: var(--mid-c);
}
.foot-note a:hover {
color: var(--ink);
}
.foot-links {
margin: 0;
display: flex;
gap: 16px;
font-size: var(--text-caption);
line-height: 1.6;
}
.foot-links a {
color: var(--mid-c);
}
.foot-links a:hover {
color: var(--ink);
}
/* --- narrower screens ---------------------------------------------------------------------- */
@media (max-width: 1080px) {
.page {
grid-template-columns: minmax(0, 1fr);
max-width: 884px;
}
.toc {
display: none;
}
.tocm {
display: block;
margin: 0 0 24px;
padding: 4px 16px;
border: 1px solid var(--line);
border-radius: var(--radius-pill);
background: var(--alt);
}
}
@media (max-width: 860px) {
.prose {
padding: 28px 24px 32px;
}
}
/* the name above, the links in a row below it that scrolls sideways when it must */
@media (max-width: 760px) {
:root {
--top-h: 88px;
}
.top-in {
height: auto;
padding-top: 10px;
padding-bottom: 6px;
flex-direction: column;
align-items: stretch;
gap: 6px;
}
.brand {
font-size: 17px;
}
.top-links {
margin: 0 calc(-1 * var(--gutter));
padding: 0 var(--gutter);
overflow-x: auto;
scrollbar-width: none;
}
.top-links::-webkit-scrollbar {
display: none;
}
}
@media (max-width: 720px) {
.top-links a {
padding: 0 9px;
}
.page {
padding-top: 16px;
}
.prose {
padding: 22px 18px 26px;
border-radius: 20px;
}
.prose h1 {
font-size: 30px;
}
.prose * + h1 {
font-size: 26px;
}
.prose h2 {
font-size: 21px;
margin-top: 36px;
}
.prose h3 {
font-size: 17px;
}
.prose p,
.prose li {
font-size: 15px;
line-height: 1.65;
}
.prose th,
.prose td {
padding: 7px 10px;
}
.prose .mermaid-svg {
padding: 12px;
}
.pager {
grid-template-columns: minmax(0, 1fr);
}
.pager .next {
grid-column: auto;
}
.foot-links {
flex-wrap: wrap;
}
}
/* a phone: all six links in one row (narrower screens scroll it sideways) */
@media (max-width: 430px) {
.top-links {
justify-content: space-between;
}
.top-links a {
padding: 0 6px;
font-size: 13px;
}
}
/* everything lands in its final state at once */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-delay: 0ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}