/* ==========================================================================
   Somesota — static site stylesheet
   Light editorial: white ground, serif headings, navy accents.
   ========================================================================== */

:root {
  --ink:        #1c1e24;
  --ink-soft:   #4a4f5a;
  --ink-faint:  #767d8a;
  --navy:       #18225c;
  --navy-soft:  #3a4590;
  --rule:       #e2e4ea;
  --rule-soft:  #eff0f4;
  --paper:      #ffffff;
  --paper-warm: #faf9f7;
  --paper-cool: #f5f6f9;
  --amber:      #8a5a00;
  --amber-bg:   #fdf6e6;
  --red:        #9b2c2c;
  --red-bg:     #fdf0f0;
  --green:      #1f6b46;
  --green-bg:   #eef7f2;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 44rem;
  --shell:   82rem;
  --chrome-h: 80px;
}

body.has-sigbar { --chrome-h: 116px; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

a { color: var(--navy); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--navy-soft); outline-offset: 2px; border-radius: 2px;
}

/* --------------------------------------------------------------- masthead */

.masthead {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  max-width: var(--shell); margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  height: 60px; display: flex; align-items: center; gap: 1.5rem;
}
.wordmark {
  font-family: var(--serif); font-size: 1.35rem; font-weight: 600;
  letter-spacing: -.01em; color: var(--navy); white-space: nowrap;
}
.wordmark:hover { text-decoration: none; }
.wordmark span { color: var(--ink-faint); font-weight: 400; }

.masthead nav { margin-left: auto; display: flex; gap: 1.5rem; font-size: .88rem; }
.masthead nav a { color: var(--ink-soft); letter-spacing: .01em; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--navy); }

@media (max-width: 620px) {
  .masthead__inner { gap: .9rem; }
  .masthead nav { gap: .9rem; font-size: .8rem; }
}

/* ------------------------------------------------------------------ shell */

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

footer.site {
  margin-top: 5rem; border-top: 1px solid var(--rule);
  padding-block: 2.5rem; color: var(--ink-faint); font-size: .85rem;
}
footer.site .shell { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: baseline; }
footer.site .spacer { margin-left: auto; }

/* ------------------------------------------------------------------- home */

.hero { padding-block: clamp(3rem, 9vw, 6rem) 2.5rem; }
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.08;
  letter-spacing: -.02em; margin: 0 0 1.2rem; color: var(--navy);
}
.hero p { max-width: var(--measure); color: var(--ink-soft); font-size: 1.06rem; margin: 0 0 1rem; }
.hero .kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1.4rem;
}

.section-title {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
  padding-top: 3.5rem; margin-bottom: 1.5rem;
}

/* Article list: every article, newest first, one row each. Date and
   category in a narrow mono column on the left, title and one line of
   summary on the right; on narrow screens the meta sits above the title. */
.article-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.article-list__item {
  display: grid; gap: .35rem 2rem;
  padding: 1.4rem 0; border-bottom: 1px solid var(--rule);
}
@media (min-width: 760px) {
  .article-list__item { grid-template-columns: 11rem minmax(0, 1fr); padding: 1.6rem 0; }
}
.article-list__meta {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: .25rem .75rem; padding-top: .45rem;
}
@media (min-width: 760px) { .article-list__meta { flex-direction: column; } }
.article-list__meta time { color: var(--ink-soft); }
.article-list__body { max-width: var(--measure); }
.article-list__body h3 {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 600;
  line-height: 1.25; margin: 0 0 .35rem; letter-spacing: -.01em;
}
.article-list__body h3 a { color: var(--ink); }
.article-list__body h3 a:hover { color: var(--navy); }
.article-list__body p { margin: 0; color: var(--ink-soft); font-size: .95rem; line-height: 1.55; }
.article-list__body p.article-list__family {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
  color: var(--ink-faint); margin-bottom: .4rem;
}
.article-list__item:last-child { border-bottom: 0; }
.article-list__item:hover h3 a { color: var(--navy); }

/* Tags are MWDB tags, reproduced verbatim — never editorial labels invented
   for the site. The namespace prefix is dimmed so the value reads first. */
.tag {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .04em;
  padding: .2rem .5rem; border: 1px solid var(--rule);
  background: var(--paper-cool); color: var(--ink-soft); border-radius: 2px;
  white-space: nowrap;
}
.tag b { font-weight: 400; color: var(--ink-faint); }
.tag--family {
  background: var(--red-bg); border-color: #f0d4d4; color: var(--red); font-weight: 500;
}
.tag--family b { color: #bd7676; }
.tag--origin { background: var(--green-bg); border-color: #cfe6da; color: var(--green); }
.tag--origin b { color: #6ea78c; }
.tag--amber { background: var(--amber-bg); border-color: #efdfb8; color: var(--amber); }
.tag--amber b { color: #b99a54; }

/* tag block on an article page */
.tagblock { margin: 0 0 1.6rem; max-width: var(--measure); }
.tagblock__head {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: .55rem;
}
.tagblock__list { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; }
.tagblock__note { font-size: .78rem; color: var(--ink-faint); }

/* ---------------------------------------------------------------- article */

.article-layout {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  padding-top: 2.5rem; align-items: start;
}
@media (min-width: 1020px) { .article-layout { grid-template-columns: minmax(0,1fr) 15rem; } }

.article-head { padding-block: clamp(2rem, 6vw, 3.5rem) 0; }
.article-head .kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1rem;
}
.article-head h1 {
  font-family: var(--serif); font-weight: 600; color: var(--navy);
  font-size: clamp(2rem, 5.5vw, 3.1rem); line-height: 1.1;
  letter-spacing: -.02em; margin: 0 0 1rem;
}
.article-head .standfirst {
  font-family: var(--serif); font-size: 1.2rem; line-height: 1.55;
  color: var(--ink-soft); max-width: var(--measure); margin: 0 0 1.6rem;
}
.byline {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding-bottom: 1.6rem;
  font-family: var(--mono); font-size: .75rem; color: var(--ink-faint);
}
.byline b { font-weight: 500; color: var(--ink-soft); }

/* Optional header illustration (front matter `hero:`): text on the left,
   picture on the right; stacks under the text on narrow screens. */
.article-head--hero { display: grid; gap: 0 clamp(2rem, 4vw, 3.5rem); align-items: center; }
@media (min-width: 1020px) { .article-head--hero { grid-template-columns: minmax(0, 1fr) minmax(0, 32rem); } }
.article-head__hero { margin: 0 0 1.6rem; }
.article-head__hero a { display: block; cursor: zoom-in; }
.article-head__hero img { display: block; width: 100%; height: auto; }

article { min-width: 0; max-width: none; }
article > * { max-width: var(--measure); }
/* Figures, data tables and the indicator block are evidence, not prose: they
   get the full column, which on a wide screen is ~60rem rather than ~44rem. */
article > .wide,
article > figure,
article > .table-wrap,
article > details.steps,
article > .ioc,
article > .verdict,
article > .capgrid,
article > .techtable,
article > .overlaps { max-width: none; }
article > .callout { max-width: 52rem; }

/* A `#` heading inside an article opens a part, for articles that gather
   several readings. The page title stays the h1 in the article head. */
article h1 {
  font-family: var(--serif); font-weight: 600; color: var(--navy);
  font-size: 2.3rem; line-height: 1.15; letter-spacing: -.02em;
  margin: 5rem 0 1.6rem; padding-top: 1rem; border-top: 3px solid var(--navy);
  scroll-margin-top: var(--chrome-h);
}
article > h1:first-child,
article > .topnote + h1 { margin-top: 2rem; }
article h1 + h2 { margin-top: 0; padding-top: 0; border-top: 0; }

article h2 {
  font-family: var(--serif); font-weight: 600; color: var(--navy);
  font-size: 1.85rem; line-height: 1.2; letter-spacing: -.015em;
  margin: 3.5rem 0 1rem; padding-top: .8rem; border-top: 1px solid var(--rule);
  scroll-margin-top: var(--chrome-h);
}
article > h2:first-child { margin-top: 0; }
article h3 {
  font-family: var(--sans); font-weight: 650; font-size: 1.08rem;
  letter-spacing: -.005em; margin: 2.4rem 0 .7rem; color: var(--ink);
  scroll-margin-top: var(--chrome-h);
}
article h4 {
  font-family: var(--mono); font-weight: 500; font-size: .78rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint);
  margin: 2rem 0 .6rem;
}
article p { margin: 0 0 1.1rem; }
article ul, article ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
article li { margin-bottom: .5rem; }
article li::marker { color: var(--ink-faint); }
article strong { font-weight: 640; }

.lead { font-size: 1.08rem; color: var(--ink-soft); }

.anchor {
  font-family: var(--mono); font-weight: 400; font-size: .8em; color: var(--rule);
  margin-left: .45rem; opacity: 0; transition: opacity .15s;
}
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor { opacity: 1; color: var(--ink-faint); }

/* ------------------------------------------------------------ code & mono */

code, kbd, samp { font-family: var(--mono); font-size: .875em; }
:not(pre) > code {
  background: var(--paper-cool); border: 1px solid var(--rule);
  padding: .08em .34em; border-radius: 3px; color: var(--ink);
  overflow-wrap: break-word;
}
.addr { color: var(--navy-soft); }
.val  { color: var(--ink); background: var(--paper-warm); }

pre {
  font-family: var(--mono); font-size: .8rem; line-height: 1.6;
  background: var(--paper-cool); border: 1px solid var(--rule);
  border-left: 3px solid var(--navy); border-radius: 0 3px 3px 0;
  padding: 1rem 1.1rem; overflow-x: auto; margin: 0 0 1.4rem;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.codeblock { position: relative; margin-bottom: 1.4rem; }
.codeblock pre { margin: 0; }
.codeblock__label {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: .35rem 0; display: flex; align-items: center; gap: .6rem;
}
.copy {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .08em;
  text-transform: uppercase; cursor: pointer;
  background: var(--paper); color: var(--ink-faint);
  border: 1px solid var(--rule); border-radius: 3px; padding: .18rem .45rem;
}
.copy:hover { color: var(--navy); border-color: var(--navy-soft); }
.copy[data-state="done"] { color: var(--green); border-color: #cfe6da; }
.codeblock__label .copy { margin-left: auto; }

/* --------------------------------------------------------------- callouts */

.callout {
  border: 1px solid var(--rule); border-left: 3px solid var(--navy-soft);
  background: var(--paper-warm); padding: 1.1rem 1.3rem;
  margin: 0 0 1.6rem; border-radius: 0 3px 3px 0; font-size: .95rem;
}
.callout > :last-child { margin-bottom: 0; }
.callout__title {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--navy-soft);
  margin-bottom: .5rem; display: block;
}
.callout--warn  { border-left-color: var(--amber); background: var(--amber-bg); }
.callout--warn  .callout__title { color: var(--amber); }
.callout--gap   { border-left-color: var(--red); background: var(--red-bg); }
.callout--gap   .callout__title { color: var(--red); }
.callout--proof { border-left-color: var(--green); background: var(--green-bg); }
.callout--proof .callout__title { color: var(--green); }

/* `type: key` — the one-idea box that opens each section of a lesson.
   Stronger than a plain note so the eye lands on it first. */
.callout--key {
  border-left: 5px solid var(--navy); background: var(--paper-cool);
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; color: var(--ink);
}
.callout--key .callout__title { color: var(--navy); font-family: var(--mono); }

/* `/// details` with `type: check` — a self-check question; the answer stays
   folded until the reader opens it. */
details.check {
  border: 1px solid #cfe6da; border-left: 3px solid var(--green);
  background: var(--green-bg); border-radius: 0 3px 3px 0;
  margin: 0 0 2rem; max-width: 52rem; font-size: .95rem;
}
details.check summary {
  cursor: pointer; list-style: none; padding: .75rem 1.1rem;
  font-weight: 600; color: var(--ink);
}
details.check summary::-webkit-details-marker { display: none; }
details.check summary::before {
  content: "Check yourself ▸ "; display: block; margin-bottom: .2rem;
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--green);
}
details.check[open] summary::before { content: "Check yourself ▾ "; }
details.check[open] summary { border-bottom: 1px solid #cfe6da; }
details.check > :not(summary) { margin: 0; padding: .75rem 1.1rem; }

/* ----------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; margin: 0 0 1.6rem; border: 1px solid var(--rule); }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
thead th {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 500;
  text-align: left; padding: .7rem .85rem; background: var(--paper-cool);
  border-bottom: 1px solid var(--rule); white-space: nowrap;
  position: sticky; top: 0;
}
tbody td { padding: .65rem .85rem; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--paper-warm); }
td code { white-space: nowrap; }
td.wrap code { white-space: normal; overflow-wrap: anywhere; }

.state {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
}
.state--wired     { color: var(--green); }
.state--inferred  { color: var(--amber); }
.state--contested { color: var(--red); }

/* ------------------------------------------------------ search highlight */

mark { background: #fff2a8; color: inherit; padding: 0 .1em; }

/* -------------------------------------------------------------- diagrams */

figure { margin: 0 0 2.4rem; }

/* No chrome around a diagram: the SVG carries its own white ground, and a
   single hairline separates it from the page. A tinted box around it just
   competed with the drawing. */
figure .frame { position: relative; line-height: 0; }
figure .frame img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--rule); border-radius: 3px; background: #fff;
}

/* A diagram links to its own file and opens full size in a new tab. */
figure .frame a { display: block; cursor: zoom-in; }
figure .frame a:hover img { border-color: var(--navy-soft); }

/* The Hacker Ethic diff is a portrait poster (1080 x 1350): at full column
   width it runs taller than the screen, so it is shown at a reading size.
   The link still opens it full size. */
article > figure:has(img[src$="hacker-ethic-diff.svg"]) { max-width: 32rem; }
figcaption {
  font-size: .86rem; line-height: 1.6; color: var(--ink-faint);
  padding-top: .8rem; margin-top: .8rem;
  border-top: 1px solid var(--rule-soft);
  max-width: var(--measure); line-height: 1.6;
}
figcaption b { color: var(--ink-soft); font-weight: 600; }

body.is-locked { overflow: hidden; }

/* -------------------------------------------------------------- top note */

.topnote {
  border-left: 3px solid var(--navy); padding: .2rem 0 .2rem 1.1rem;
  margin: 0 0 2rem; max-width: var(--measure);
}
.topnote p { margin: 0 0 .7rem; font-size: 1.02rem; }
.topnote p:last-child { margin-bottom: 0; }
.topnote p b { color: var(--navy); font-weight: 640; }

.legend {
  display: flex; flex-wrap: wrap; gap: .3rem 1.2rem;
  margin: -.6rem 0 2.2rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule-soft);
  font-size: .8rem; color: var(--ink-faint); max-width: var(--measure);
}
.legend span b { font-weight: 500; }

details.steps { border: 1px solid var(--rule); margin: -.6rem 0 1.8rem; }
details.steps summary {
  cursor: pointer; padding: .6rem .85rem; background: var(--paper-cool);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); list-style: none;
}
details.steps summary::-webkit-details-marker { display: none; }
details.steps summary::before { content: "▸ "; color: var(--ink-faint); }
details.steps[open] summary::before { content: "▾ "; }
details.steps .table-wrap { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* -------------------------------------------------------------------- TOC */

.toc {
  position: sticky; top: var(--chrome-h); font-size: .82rem;
  max-height: calc(100vh - var(--chrome-h)); overflow-y: auto;
}
@media (max-width: 1019px) { .toc { display: none; } }
.toc__title {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  padding-bottom: .6rem; border-bottom: 1px solid var(--rule); margin-bottom: .7rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: .3rem 0 .3rem .7rem; color: var(--ink-faint);
  border-left: 2px solid var(--rule); line-height: 1.4;
}
.toc a:hover { color: var(--navy); text-decoration: none; border-left-color: var(--rule); }
.toc a.is-active { color: var(--navy); border-left-color: var(--navy); font-weight: 550; }
/* Parts: the `#` headings group the sections listed under them. */
.toc__part + .toc__part { margin-top: 1rem; }
.toc__part > a {
  padding-left: 0; border-left: 0; color: var(--ink);
  font-weight: 600; margin-bottom: .2rem;
}
.toc__part > a:hover { color: var(--navy); }


/* ----------------------------------------------------------------- search
   The index is MkDocs' own search/search_index.json; the dialog is built by
   somesota.js. Plain substring matching, so hashes, IPs and addresses match
   exactly as written. */

.search-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--sans); font-size: .82rem; line-height: 1; cursor: pointer;
  background: var(--paper-cool); color: var(--ink-faint);
  border: 1px solid var(--rule); border-radius: 3px; padding: .4rem .55rem;
}
.search-toggle:hover { color: var(--navy); border-color: var(--navy-soft); }
.search-toggle kbd {
  font-size: .68rem; color: var(--ink-faint); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 2px; padding: .05rem .3rem;
}
@media (max-width: 620px) {
  .search-toggle__label, .search-toggle kbd { display: none; }
}

.search {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(28,30,36,.45);
  display: flex; justify-content: center; align-items: flex-start;
  padding: calc(8vh + env(safe-area-inset-top, 0px)) 1rem 1rem;
}
.search__panel {
  width: 100%; max-width: 44rem; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 10px 50px rgba(24,34,92,.22);
}
.search__bar {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; border-bottom: 1px solid var(--rule);
}
.search__bar svg { flex: 0 0 auto; color: var(--ink-faint); }
.search__bar input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: none;
  font-family: var(--sans); font-size: 1rem; color: var(--ink); padding: .3rem 0;
}
.search__bar input:focus-visible { outline: 0; }
.search__bar button {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .08em;
  text-transform: uppercase; cursor: pointer;
  background: var(--paper); color: var(--ink-faint);
  border: 1px solid var(--rule); border-radius: 3px; padding: .25rem .45rem;
}
.search__bar button:hover { color: var(--navy); border-color: var(--navy-soft); }

.search__status {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .06em;
  color: var(--ink-faint); padding: .55rem .9rem;
}
.search__status:empty { display: none; }

.search__results { list-style: none; margin: 0; padding: 0 0 .4rem; overflow-y: auto; }
.search__page { border-top: 1px solid var(--rule-soft); padding: .4rem 0; }
.search__page:first-child { border-top: 0; }
.search__pagetitle {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); padding: .35rem .9rem .15rem;
}
.search__hit {
  display: block; padding: .5rem .9rem; color: var(--ink);
  border-left: 2px solid transparent;
}
.search__hit:hover, .search__hit.is-active {
  text-decoration: none; background: var(--paper-cool); border-left-color: var(--navy);
}
.search__hit b {
  display: block; font-family: var(--serif); font-weight: 600;
  font-size: 1.02rem; color: var(--navy); line-height: 1.35;
}
.search__hit span {
  display: block; font-size: .84rem; line-height: 1.5; color: var(--ink-soft);
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .search { padding: env(safe-area-inset-top, 0px) 0 0; }
  .search__panel { max-width: none; height: 100%; border: 0; border-radius: 0; }
}

/* ------------------------------------------------------------------- misc */

.totop {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 30;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft);
  cursor: pointer; font-size: .9rem; line-height: 1;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: 0 2px 10px rgba(24,34,92,.08);
}
.totop.is-shown { opacity: 1; pointer-events: auto; }
.totop:hover { color: var(--navy); border-color: var(--navy-soft); }

.footnote { font-size: .85rem; color: var(--ink-faint); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

/* --------------------------------------------------------------- sigbar
   A sticky sample-identity strip under the masthead, on malware sheets
   that declare `signature:` in front matter. */

.sigbar {
  position: sticky; top: 60px; z-index: 39;
  background: var(--paper-warm); border-bottom: 1px solid var(--rule);
}
.sigbar__inner {
  max-width: var(--shell); margin: 0 auto;
  padding: .5rem clamp(1rem, 4vw, 2.5rem);
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem;
  font-family: var(--mono); font-size: .7rem; color: var(--ink-faint);
}
.sigbar__family { display: inline-flex; align-items: center; gap: .4rem; }
.sigbar__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); display: inline-block; }
.sigbar__family b { color: var(--red); font-weight: 500; }
.sigbar code {
  font-family: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 3px; padding: .05rem .3rem;
}

/* -------------------------------------------------------------- verdict
   The fact-card grid at the top of a malware sheet, generated from the
   sheet's own Dimension/Finding table — see tools/somesota_md.py. */

.verdict__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  margin-bottom: 1.4rem;
}
.verdict__card { background: var(--paper); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.verdict__dim {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.verdict__val { font-size: .92rem; color: var(--ink); }
.verdict__card--accent { background: var(--paper-cool); box-shadow: inset 3px 0 0 var(--navy); }
.verdict__card--accent .verdict__dim { color: var(--navy); }
.verdict__card--warn { background: var(--red-bg); box-shadow: inset 3px 0 0 var(--red); }
.verdict__card--warn .verdict__dim { color: var(--red); }

/* `/// verdict` with `type: tinted`: concept cards in readings. Each card
   takes one of four light grounds in turn, with a matching label colour. */
.verdict--tinted .verdict__card:nth-child(4n+1) { background: var(--paper-cool); }
.verdict--tinted .verdict__card:nth-child(4n+1) .verdict__dim { color: var(--navy-soft); }
.verdict--tinted .verdict__card:nth-child(4n+2) { background: var(--green-bg); }
.verdict--tinted .verdict__card:nth-child(4n+2) .verdict__dim { color: var(--green); }
.verdict--tinted .verdict__card:nth-child(4n+3) { background: var(--amber-bg); }
.verdict--tinted .verdict__card:nth-child(4n+3) .verdict__dim { color: var(--amber); }
.verdict--tinted .verdict__card:nth-child(4n+4) { background: var(--paper-warm); }
.verdict--tinted .verdict__card:nth-child(4n+4) .verdict__dim { color: var(--ink-soft); }

/* -------------------------------------------------------------- capgrid
   The capability card grid under "### Capability", generated from the
   sheet's own Capability/Commands/What it does/State table. */

.capgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  margin-bottom: 1.6rem;
}
.capgrid__card { background: var(--paper); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.capgrid__title { font-weight: 650; font-size: 1rem; color: var(--ink); }
.capgrid__cmd { font-family: var(--mono); font-size: .74rem; color: var(--navy-soft); overflow-wrap: anywhere; }
.capgrid__desc { font-size: .9rem; color: var(--ink-soft); }
.capgrid__state { margin-top: auto; padding-top: .3rem; font-size: .86rem; color: var(--ink-soft); }
.capgrid__state .state {
  display: inline-block; font-size: .64rem; letter-spacing: .08em;
  text-transform: uppercase; border-radius: 2px; padding: .12rem .4rem;
  border: 1px solid transparent;
}
.capgrid__state .state--wired     { background: var(--green-bg); border-color: #cfe6da; }
.capgrid__state .state--inferred  { background: var(--amber-bg); border-color: #efdfb8; }
.capgrid__state .state--contested { background: var(--red-bg);   border-color: #f0d4d4; }

/* ------------------------------------------------------------ techtable
   The Mitre Att&ck table: a confidence-dot cluster per row and a stacked
   coverage bar above it, both computed from the rows' own labels. */

.techbar { display: flex; height: 10px; gap: 2px; margin-bottom: .6rem; }
.techbar__seg { border-radius: 2px; }
.techbar__seg--wired     { background: var(--green); }
.techbar__seg--inferred  { background: var(--amber); }
.techbar__seg--contested { background: var(--red); }
.techbar__seg--static    { background: #c3c7d2; }
.techbar__legend {
  display: flex; flex-wrap: wrap; gap: .3rem 1.2rem;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1.4rem;
}
.techbar__count--wired     { color: var(--green); }
.techbar__count--inferred  { color: var(--amber); }
.techbar__count--contested { color: var(--red); }
.techbar__legend .spacer { margin-left: auto; }

.techdots { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: .4rem; }
.techdots i { width: 5px; height: 5px; border-radius: 50%; display: inline-block; background: var(--rule); }
.techdots i.is-filled { background: currentColor; }
.techdots--wired     { color: var(--green); }
.techdots--inferred  { color: var(--amber); }
.techdots--contested { color: var(--red); }
.techdots--static    { color: var(--ink-faint); }
.techconf__text {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-faint);
}
.techtable td:last-child, .techtable th:last-child { white-space: nowrap; }

/* -------------------------------------------------------------- overlaps
   The identification-overlaps section: a stacked strength bar, then the
   rows grouped into the four tiers their own Strength column names —
   see tools/somesota_md.py. */

.overlaps__bar { display: flex; height: 10px; gap: 2px; margin-bottom: .6rem; }
.overlaps__seg { border-radius: 2px; }
.overlaps__seg--identity  { background: var(--navy); }
.overlaps__seg--family    { background: var(--navy-soft); }
.overlaps__seg--samebuild { background: var(--green); }
.overlaps__seg--none      { background: var(--rule); }
.overlaps__legend {
  display: flex; flex-wrap: wrap; gap: .3rem 1.2rem;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1.2rem;
}
.overlaps__count--identity  { color: var(--navy); }
.overlaps__count--family    { color: var(--navy-soft); }
.overlaps__count--samebuild { color: var(--green); }
.overlaps__legend .spacer { margin-left: auto; }

.overlaps__group { border: 1px solid var(--rule); margin-bottom: 1rem; }
.overlaps__group--samebuild { border-color: #cfe6da; }
.overlaps__head {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; padding: .4rem .85rem;
  color: #fff; background: var(--navy);
}
.overlaps__group--family    .overlaps__head { background: var(--navy-soft); }
.overlaps__group--samebuild .overlaps__head { background: var(--green); }
.overlaps__group--none      .overlaps__head { background: var(--paper-cool); color: var(--ink-soft); }

.overlaps__row { padding: .7rem .85rem; border-bottom: 1px solid var(--rule-soft); }
.overlaps__group > .overlaps__row:last-child { border-bottom: 0; }
.overlaps__title { font-weight: 600; margin-bottom: .2rem; }
.overlaps__num { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); margin-right: .5rem; font-weight: 400; }
.overlaps__gloss {
  font-family: var(--mono); font-size: .64rem; font-weight: 400; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint); margin-left: .4rem;
}
.overlaps__detail { font-size: .86rem; color: var(--ink-soft); }
.overlaps__detail code { font-size: .8rem; }
.overlaps__where { color: var(--ink-faint); }

@media print {
  .masthead, .sigbar, .toc, .totop, .copy, .search { display: none !important; }
  figure .frame img { border-color: #ccc; }
  body { font-size: 11pt; }
  details.steps { border: 0; }
  details.steps > summary { display: none; }
}
