/* HexN's site (the landing page, the blog and its glossary, About, Resources), with
   brsm.dev as its template: brsm.dev's colours, dark only, and its page
   gutters (7vw a side, the content capped at 1680px). Reading pages keep a
   46rem measure, set at the gutter's left edge as brsm.dev sets its text.
   Chart colours are the dataviz reference palette's first four slots,
   validated against the dark surface. */
:root {
  color-scheme: dark;
  --bg: #07090c; --surface: #0d1117; --ink: #f0f2f5; --ink-2: #b4bac5; --ink-3: #8b93a1;
  --rule: #1f2630; --grid: #1f2630; --acc: #58adda; --brsm: #60a5fa; --tip-bg: #f0f2f5; --tip-ink: #07090c;
  --series-1: #399bd0; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fx: max(0px, 50vw - 840px - 7vw); --gut: calc(7vw + var(--fx));   /* brsm.dev's */
}
* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-gutter: stable; }  /* short pages keep the scrollbar's space, so the column never shifts */
body { margin: 0; color: var(--ink); font: 400 1.0625rem/1.65 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--acc); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.mast { display: flex; flex-wrap: wrap; align-items: center; column-gap: 1.6rem; row-gap: .5rem;
  padding: 1.2rem var(--gut); font: 500 .8rem var(--mono); letter-spacing: .08em; }
/* The bar: the project's colourless mark and name with its pages on the left,
   brsm.dev's own wordmark on the right. */
.mast .name { color: var(--ink); text-decoration: none; font: 700 1.05rem var(--sans); letter-spacing: -.01em; }
.mast nav { display: flex; gap: 1.1rem; margin-right: auto; }
.mast .site { color: var(--ink); text-decoration: none; font: 700 1.05rem var(--sans); letter-spacing: -.02em;
  display: inline-flex; align-items: baseline; gap: .27em; }
.mast .site .sym { font-size: 1.1667em; line-height: 1; color: var(--brsm); }   /* brsm.dev's own blue */
.mast .site .n { color: var(--brsm); }
/* On a phone, one row: the two marks without their words, the pages between them. */
@media (max-width: 40rem) {
  .mast { padding-block: 1rem .6rem; flex-wrap: nowrap; column-gap: 1rem; }
  .mast .word { display: none; }
  .mast nav { flex: 1; margin: 0; justify-content: space-around; gap: .5rem; font-size: .78rem; letter-spacing: .02em; }
  .mast .site .sym { font-size: 1.5rem; }
}
.mast nav a { color: var(--ink-3); text-decoration: none; }
.mast nav a:hover { color: var(--ink); }
main { padding: 0 var(--gut) 3rem; }
body:not(.home) main > * { max-width: 46rem; }   /* the reading measure */
.hero { padding: 3rem 0 1.5rem; border-bottom: 1px solid var(--rule); }
.hero h1 { font: 800 clamp(2.4rem, 7vw, 3.8rem)/1 var(--sans); letter-spacing: -.045em; margin: 0 0 .8rem; }
.dek { color: var(--ink-2); font-size: 1.15rem; margin: 0 0 1rem; }
.posts { list-style: none; padding: 0; margin: 1.5rem 0; }
.posts li a { display: grid; grid-template-columns: 7.5rem 1fr; gap: .1rem 1rem; padding: 1rem 0;
  border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.posts time { font: .8rem/1.9 var(--mono); color: var(--ink-3); grid-row: span 2; }
.posts .t { font-weight: 700; font-size: 1.15rem; }
.posts .s { color: var(--ink-2); grid-column: 2; }
.posts li a:hover .t { color: var(--acc); }
@media (max-width: 34rem) { .posts li a { grid-template-columns: 1fr; } .posts time { grid-row: auto; } .posts .s { grid-column: 1; } }
.post .meta { font: .8rem var(--mono); color: var(--ink-3); margin: 2.5rem 0 .4rem; }
.post h1 { font: 800 clamp(2rem, 6vw, 2.9rem)/1.05 var(--sans); letter-spacing: -.035em; margin: 0 0 .8rem; text-wrap: balance; }
.post h2 { font: 700 1.35rem/1.25 var(--sans); letter-spacing: -.015em; margin: 2.2rem 0 .6rem; }
.post h3 { font: 700 1.05rem var(--sans); margin: 1.6rem 0 .4rem; }
.post p, .post ul, .post ol { margin: 0 0 1.05rem; }
.post li { margin: .25rem 0; }
.post blockquote { margin: 1.2rem 0; padding: .1rem 0 .1rem 1rem; border-left: 2px solid var(--rule); color: var(--ink-2); }
.post code { font: .88em var(--mono); background: var(--surface); padding: .08em .3em; border-radius: 3px; }
.post pre { background: var(--surface); padding: .9rem 1rem; border-radius: 6px; overflow-x: auto; font-size: .85rem; }
.post pre code { background: none; padding: 0; }
.post table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: 1rem 0; font-variant-numeric: tabular-nums; }
.post th, .post td { text-align: left; padding: .35rem .6rem .35rem 0; border-bottom: 1px solid var(--rule); }
.post th { color: var(--ink-3); font: 500 .75rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.post .byline { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: .9rem; }
.post .footnote { font-size: .9rem; color: var(--ink-2); }
.glossary dl { margin: 1.5rem 0 0; }
.glossary dt { font-weight: 600; margin-top: 1.2rem; scroll-margin-top: 1rem; }
.glossary dd { margin: .25rem 0 0; }
.glossary dd p { margin: 0; }
.glossary .first, .glossary .earlier { color: var(--ink-3); font-size: .9rem; }
.glossary .earlier { margin-top: .3rem; }
.post .footnote hr { border: 0; border-top: 1px solid var(--rule); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 2rem 0; font: .85rem var(--mono); }
.pager .next { text-align: right; }
footer.site { margin: 0 var(--gut); padding: 1.5rem 0 3rem; color: var(--ink-3); font-size: .78rem; border-top: 1px solid var(--rule); }

/* Terms: dotted underline; the definition shows on hover, focus or tap (tips.js). */
.term { border-bottom: 1px dotted var(--ink-3); cursor: help; }
.term:hover, .term:focus { border-bottom-color: var(--acc); outline: none; }
.tip { position: absolute; z-index: 10; max-width: min(22rem, calc(100vw - 2rem)); padding: .55rem .7rem;
  background: var(--tip-bg); color: var(--tip-ink); font: 400 .85rem/1.45 var(--sans); border-radius: 6px;
  box-shadow: 0 6px 24px rgb(0 0 0 / .35); pointer-events: none; }
.tip[hidden] { display: none; }

/* Charts */
figure.chart { margin: 1.8rem 0; padding: 1rem 1rem .6rem; background: var(--surface); border-radius: 8px; }
figure.chart .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
figure.chart svg { width: 100%; min-width: 33rem; height: auto; display: block; overflow: visible; }
figure.chart figcaption { color: var(--ink-2); font-size: .9rem; margin: .6rem 0 .2rem; }
figure.chart details { font-size: .85rem; color: var(--ink-3); }
figure.chart summary { cursor: pointer; font: .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.table-note { font-size: .8rem; color: var(--ink-3); }
.viz text { font-family: var(--sans); fill: var(--ink-2); font-size: 12px; }
.viz .viz-title { fill: var(--ink); font-weight: 600; font-size: 14px; }
.viz .row-label, .viz .legend { fill: var(--ink-2); font-size: 12.5px; }
.viz .value { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.viz .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .axis-label { fill: var(--ink-3); font-size: 11px; }
.viz .grid { stroke: var(--grid); stroke-width: 1; }
.viz .zero { stroke: var(--ink-3); stroke-width: 1; }
.viz .hit { fill: transparent; }
.viz .mark:hover .hit, .viz .mark:focus .hit { fill: var(--ink); fill-opacity: .04; }
.viz .s1 { --c: var(--series-1); } .viz .s2 { --c: var(--series-2); }
.viz .s3 { --c: var(--series-3); } .viz .s4 { --c: var(--series-4); }
.viz .bar, .viz .swatch { fill: var(--c); }
.viz .dot, .viz .end { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.viz .pt { fill: var(--c); }
.viz .ci { stroke: var(--c); stroke-width: 2; stroke-linecap: round; }
.viz .ci-on-bar { stroke: var(--ink); stroke-opacity: .55; stroke-width: 1.5; }
.viz .line, .viz .key { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .wash { fill: var(--c); fill-opacity: .1; stroke: none; }
@media (forced-colors: active) { .viz .bar, .viz .dot { fill: CanvasText; } .viz .line { stroke: CanvasText; } }

/* The hex lattice: brsm.dev's board, faint and still, evenly behind the
   whole page. */
:root { --hex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48.5' height='84'%3E%3Cpath d='M24.25 0L48.5 14L48.5 42L24.25 56L0 42L0 14ZM24.25 56L24.25 84' fill='none' stroke='%238b93a1' stroke-width='1'/%3E%3C/svg%3E"); --hex-a: .09; --glow: rgb(96 165 250 / .10); }
body { position: relative; isolation: isolate; }
body::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;   /* scrolls with the page, so the hero board can sit on it */
  background: var(--hex) 50% 0 / 48.5px 84px; opacity: var(--hex-a); }
body::after { content: ""; position: absolute; inset: 0 0 auto; height: 34rem; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 70% 100% at 50% 0, var(--glow), transparent 70%); }
.mast .name { display: inline-flex; align-items: center; gap: .5rem; }
.mast .name .mark { width: 1.35rem; height: 1.35rem; display: block; color: var(--ink-2); }
@media (prefers-reduced-transparency: reduce) { body::before, body::after { display: none; } }

/* Research page links */
.links { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 0; }
.links a { font: 500 .8rem var(--mono); }
