/* ==========================================================================
   alessiomalerba.it

   Two colours and nothing in between. The interface has no greys:
   emphasis is size, weight or inversion; a quiet line is a dotted line;
   "dimmed" is a one-bit checkerboard. Swapping --ink and --paper is the
   whole light theme. Screenshots are the one exception, and only until
   someone asks for them: grey on the page, in colour on hover and in the
   viewer.
   ========================================================================== */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --ink: #fff;
  --paper: #000;
  color-scheme: dark;

  --sans: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --small: 0.9375rem;                        /* 15px */
  --body: 1.0625rem;                         /* 17px */
  --lead: clamp(1.1875rem, 1.5vw, 1.375rem); /* 19–22px */
  --title: clamp(1.25rem, 1.6vw, 1.4375rem); /* 20–23px, row titles */
  --section: clamp(2rem, 3.4vw, 2.875rem);   /* 32–46px, section titles */
  --display: clamp(2.5rem, 7.3vw, 6.75rem);  /* 40–108px, the motto */

  --sub: clamp(1.5rem, 2.2vw, 1.875rem);     /* 24–30px, titles inside a section */

  --gutter: clamp(20px, 4.2vw, 56px);
  --header-h: 58px;
  --pad: 12px;                               /* bleed of an inverting row */
  --term: 36%;                               /* width of the left-hand term column */
}

:root[data-theme="light"] {
  --ink: #000;
  --paper: #fff;
  color-scheme: light;
}

/* ── Base ───────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 28px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--body)/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--ink); color: var(--paper); }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
strong { font-weight: 700; }

a { color: inherit; }

/* Links in running text: underlined, and they invert like everything else. */
.prose a:not(.btn):not(.shot),
.site-footer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.prose a:not(.btn):not(.shot):hover,
.site-footer a:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

code,
kbd {
  font-family: var(--mono);
  font-size: 0.92em;
}

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 30;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 8px; outline-offset: -5px; outline-color: var(--paper); }

/* ── Buttons and chips ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 46px;
  padding: 0.55em 1.05em;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: 700 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--paper); }

.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--paper); color: var(--ink); }

.btn-small { min-height: 38px; padding: 0.35em 0.8em; font-size: var(--small); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 38px;
  padding: 0.3em 0.8em;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: 600 var(--small)/1.2 var(--sans);
  cursor: pointer;
  user-select: none;
}
.chip:hover { background: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"],
.opt input:checked + .chip { background: var(--ink); color: var(--paper); }
.opt input:focus-visible + .chip { outline: 2px solid var(--ink); outline-offset: 3px; }
.chip .count { font-family: var(--mono); font-weight: 400; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--header-h);
}

.wordmark {
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { background: var(--ink); color: var(--paper); }

.crumb { display: none; white-space: nowrap; }
.crumb::before { content: "/ "; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-left: auto;
}
.nav a {
  padding: 6px 10px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover,
.nav a[aria-current="true"] { background: var(--ink); color: var(--paper); }

.tools {
  display: flex;
  gap: 8px;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: 600 var(--small)/1 var(--sans);
  cursor: pointer;
}
.tool:hover { background: var(--ink); color: var(--paper); }
.tool kbd { font-size: 0.8125rem; font-weight: 400; }
.tool-narrow { display: none; }

/* Half ink, half paper: the whole theme in one glyph. */
.glyph-invert {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

@media (max-width: 860px) {
  .js .nav { display: none; }
  .js .crumb { display: block; overflow: hidden; text-overflow: ellipsis; }
  .js .tools { margin-left: auto; }
  .tool-wide,
  .tool kbd { display: none; }
  .tool-narrow { display: inline; }
  .bar { gap: 10px; }
  html:not(.js) .bar { flex-wrap: wrap; padding-block: 10px; }
  html:not(.js) .nav { margin-left: -10px; }
  html:not(.js) .site-header { position: static; }
}

.js .crumb:empty { display: none; }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero { padding-block: clamp(36px, 6vw, 80px) clamp(56px, 8vw, 104px); }

.byline {
  font-size: var(--lead);
  font-weight: 400;
  line-height: 1.3;
}
.byline strong { font-weight: 800; }

.motto {
  margin-top: clamp(20px, 3vw, 40px);
  font-size: var(--display);
  font-weight: 800;
  line-height: 0.97;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.motto span { display: block; }
.motto span + span { margin-top: 0.14em; }

.proof {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px 28px;
  margin-top: clamp(24px, 3vw, 40px);
  padding-top: 14px;
  border-top: 1px dotted var(--ink);
  font-size: var(--small);
}
.proof-note { max-width: 58ch; }

.digest {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 0 1.1ch;
  font-family: var(--mono);
  font-variant-ligatures: none;
  line-height: 1.5;
}
.digest b { font-weight: 400; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px var(--gutter);
  margin-top: clamp(40px, 5vw, 72px);
}

.lead p {
  max-width: 34em;
  font-size: var(--lead);
  line-height: 1.45;
}
.lead p + p { margin-top: 0.8em; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

/* ── Permalinks ─────────────────────────────────────────────────────────── */

.anchor {
  display: inline-block;
  margin-left: 0.25em;
  padding-inline: 0.12em;
  font-family: var(--mono);
  font-size: 0.7em;
  font-weight: 400;
  vertical-align: 0.12em;
  text-decoration: none;
  opacity: 0;
}
:hover > .anchor,
.anchor:focus-visible { opacity: 1; }
.anchor:hover { background: var(--ink); color: var(--paper); }
@media (hover: none) { .anchor { opacity: 1; } }

/* ── Ledger: short facts joined by dot leaders ──────────────────────────── */

.ledger > div {
  display: flex;
  align-items: baseline;
  padding-block: 7px;
}
.ledger dt {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
}
.ledger dt::after {
  content: "";
  flex: 1 1 auto;
  min-width: 24px;
  margin-inline: 10px;
  border-bottom: 2px dotted currentColor;
  transform: translateY(-0.28em);
}
.ledger dd {
  max-width: 68%;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ── Sections ───────────────────────────────────────────────────────────── */

.section {
  padding-block: clamp(44px, 6vw, 80px) clamp(56px, 7vw, 96px);
  border-top: 2px solid var(--ink);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: 32px var(--gutter);
  align-items: start;
}

.section-head {
  position: sticky;
  top: calc(var(--header-h) + 28px);
}
.section-head h2 {
  font-size: var(--section);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.025em;
}
.section-head .aside {
  margin-top: 20px;
  font-size: var(--small);
}
.section-head .chips { margin-top: 20px; }

.intro {
  max-width: 34em;
  font-size: var(--lead);
  line-height: 1.45;
}

.sub {
  margin-top: clamp(48px, 6vw, 72px);
  font-size: var(--sub);
  font-weight: 800;
  letter-spacing: -0.015em;
}
.sub + p { margin-top: 10px; max-width: 34em; }

.block { margin-top: clamp(24px, 3vw, 36px); }
.narrow { max-width: 40rem; }

/* ── Rows: a term on the left, what it means on the right ───────────────── */

.rows { border-bottom: 1px dotted var(--ink); }

.row {
  display: grid;
  grid-template-columns: var(--term) minmax(0, 1fr);
  gap: 8px 32px;
  padding-block: 22px;
  border-top: 1px dotted var(--ink);
}
.row h3,
.row h4,
.row dt {
  font-size: var(--title);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}
.row .billing { margin-top: 6px; font-size: var(--small); }
.row .billing + p { margin-top: 14px; }
.row .text > * + * { margin-top: 12px; }
.row .text > h4 + * { margin-top: 6px; }
.row .dashed li + li { margin-top: 6px; }
.when { font-variant-numeric: tabular-nums; }

/* Tight rows, for lists of names rather than prose. */
.rows-tight .row { padding-block: 14px; }
.rows-tight dt { font-size: var(--body); }
.rows-tight dd { font-size: var(--small); }

.keys { font-size: var(--small); }
.keys b { font-weight: 700; }

.dashed li {
  position: relative;
  padding-left: 1.4em;
}
.dashed li + li { margin-top: 10px; }
.dashed li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.74em;
  width: 0.7em;
  border-top: 2px solid currentColor;
}

/* ── Entries: rows that open ────────────────────────────────────────────── */

.entries { border-bottom: 1px dotted var(--ink); }

.entry { border-top: 1px dotted var(--ink); }

.entry > summary {
  display: grid;
  grid-template-columns: var(--term) minmax(0, 1fr) 18px;
  gap: 4px 32px;
  align-items: start;
  margin-inline: calc(var(--pad) * -1);
  padding: 20px var(--pad);
  list-style: none;
  cursor: pointer;
}
.entry > summary::-webkit-details-marker { display: none; }
.entry > summary:hover { background: var(--ink); color: var(--paper); }
.entry > summary:focus-visible { outline-offset: -2px; }

.entry h3 { font-size: var(--title); }
.entry .area { font-size: var(--small); }

/* Dated entries: the date leads, the role and its gist follow. */
.entry-dated .when { grid-column: 1; grid-row: 1 / span 2; }
.entry-dated h3 { grid-column: 2; grid-row: 1; }
.entry-dated .gist { grid-column: 2; grid-row: 2; }

/* Named entries: the name and its area lead, the gist follows. The last row
   takes up any extra height, so a long gist never pushes the area down. */
.entry-named > summary { grid-template-rows: auto auto 1fr; }
.entry-named h3 { grid-column: 1; grid-row: 1; }
.entry-named .area { grid-column: 1; grid-row: 2; }
.entry-named .gist { grid-column: 2; grid-row: 1 / -1; }

/* A plus that loses its upright when the row is open. */
.entry .marker {
  position: relative;
  grid-column: 3;
  grid-row: 1;
  width: 18px;
  height: 18px;
  margin-top: 0.3em;
}
.marker::before,
.marker::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.marker::before { left: 0; right: 0; top: 8px; height: 2px; }
.marker::after { top: 0; bottom: 0; left: 8px; width: 2px; }
.entry[open] > summary .marker::after { display: none; }

.entry-body {
  display: grid;
  grid-template-columns: var(--term) minmax(0, 1fr) 18px;
  gap: 0 32px;
  padding-block: 4px 32px;
}
.entry-body > * { grid-column: 2; }
.entry-body > * + * { margin-top: 16px; }
.entry-body > h4 { font-size: var(--body); }
.entry-body > * + h4 { margin-top: 28px; }
.entry-body > h4 + * { margin-top: 10px; }

.note { margin-top: 24px; font-size: var(--small); }

/* ── Hasher ─────────────────────────────────────────────────────────────── */

.hasher {
  margin-top: 28px;
  padding: 20px;
  border: 2px solid var(--ink);
}
.hasher > * + * { margin-top: 16px; }
.hasher h4 { margin-top: 0; font-size: var(--title); }
.hasher .digest { font-size: clamp(0.875rem, 1.25vw, 1.0625rem); }
.hasher-out { padding-block: 14px; border-block: 1px dotted var(--ink); }
.hasher-out p { margin-top: 6px; font-size: var(--small); }

/* While a file is dragged over it, the box is hatched. */
.hasher.is-over {
  background-image: repeating-linear-gradient(
    135deg,
    var(--ink) 0 1px,
    transparent 1px 8px
  );
}

.verdict[data-state="match"],
.verdict[data-state="differ"] {
  display: inline-block;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  font-weight: 700;
}
.verdict[data-state="match"] { background: var(--ink); color: var(--paper); }
.verdict[data-state="differ"] { border-style: dashed; }

/* ── Screenshots ────────────────────────────────────────────────────────── */

/* Two to a row; with an odd number, the first one takes the full width. */
.shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
.shots > li:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.shots figure { display: grid; gap: 6px; align-content: start; }
.shots figcaption { font-size: var(--small); }

.shot {
  display: block;
  border: 1px solid var(--ink);
}
.shot:hover { box-shadow: 0 0 0 1px var(--ink); }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  filter: grayscale(1);
  transition: filter 160ms ease-out;
}
.shot:hover img,
.shot:focus-visible img { filter: none; }

.viewer {
  width: min(1200px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
.viewer-inner { padding: 14px 16px 18px; }
.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.viewer-title { font-weight: 700; }
.viewer-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-figure {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 14px;
}
.viewer-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 190px);
  width: auto;
  height: auto;
  border: 1px solid var(--ink);
}
.viewer-figure figcaption { max-width: 62ch; font-size: var(--small); }

/* ── Forms ──────────────────────────────────────────────────────────────── */

label,
legend {
  display: block;
  padding: 0;
  font-weight: 700;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field { display: grid; gap: 8px; }
.field .hint { font-size: var(--small); }

input[type="text"],
textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--body)/1.45 var(--sans);
}
textarea { min-height: 5.6em; resize: vertical; }
textarea.mono,
input.mono { font-family: var(--mono); font-size: 0.9375rem; }

.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.brief {
  margin-top: 20px;
  display: grid;
  gap: 24px;
}
.brief-preview {
  padding: 16px;
  border: 1px dotted var(--ink);
  font: 400 0.9375rem/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── Command palette ────────────────────────────────────────────────────── */

.palette {
  width: min(640px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 24px));
  margin: 12vh auto auto;
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; }

/* One-bit dimming: every other pixel pair goes to paper. */
.palette::backdrop,
.viewer::backdrop {
  background: conic-gradient(#000 25%, transparent 0 50%, #000 0 75%, transparent 0) 0 0 / 4px 4px;
}
:root[data-theme="light"] .palette::backdrop,
:root[data-theme="light"] .viewer::backdrop {
  background: conic-gradient(#fff 25%, transparent 0 50%, #fff 0 75%, transparent 0) 0 0 / 4px 4px;
}

.palette-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 2px solid var(--ink);
  font-weight: 400;
}
.palette-field input {
  flex: 1;
  min-width: 0;
  padding: 16px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 1.125rem;
}

.palette-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-block: 6px;
}
.palette-group {
  padding: 12px 16px 4px;
  font-size: 0.8125rem;
  font-weight: 700;
}
.palette-list [role="option"] {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 16px;
  cursor: pointer;
}
.palette-list [role="option"][aria-selected="true"] { background: var(--ink); color: var(--paper); }
.palette-list .hint { font-size: 0.8125rem; white-space: nowrap; }
.palette-empty { padding: 16px; }

.palette-help {
  padding: 10px 16px;
  border-top: 1px dotted var(--ink);
  font-size: 0.8125rem;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  padding-block: 32px 48px;
  border-top: 2px solid var(--ink);
  font-size: var(--small);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 40px;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
.site-footer .claim { flex-basis: 100%; max-width: 62ch; }

.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.linklike:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

.print-only { display: none; }

/* ── Narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .hero-grid,
  .section-grid { grid-template-columns: minmax(0, 1fr); }
  .section-head { position: static; }
  .section-head .aside { max-width: 34em; }
}

@media (max-width: 640px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .entry > summary { grid-template-columns: minmax(0, 1fr) 18px; column-gap: 16px; }
  .entry-dated .when,
  .entry-dated h3,
  .entry-dated .gist,
  .entry-named h3,
  .entry-named .area,
  .entry-named .gist { grid-column: 1; grid-row: auto; }
  .entry .marker { grid-column: 2; }
  .entry-named .gist { margin-top: 6px; }
  .entry-body { grid-template-columns: minmax(0, 1fr); }
  .entry-body > * { grid-column: 1; }
  .proof { grid-template-columns: minmax(0, 1fr); }
  .ledger dd { max-width: 60%; }
  .hasher { margin-inline: calc(var(--pad) * -1); padding: 16px var(--pad); }
  .palette { margin-top: 12px; }
  .actions .btn { flex: 1 1 100%; }
}

/* ── Motion, contrast modes ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shot img { transition: none; }
}

@media (forced-colors: active) {
  .btn-solid,
  .chip[aria-pressed="true"],
  .opt input:checked + .chip,
  .nav a[aria-current="true"],
  .palette-list [role="option"][aria-selected="true"],
  .verdict[data-state="match"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ── Print: the page as a CV, ink on paper ──────────────────────────────── */

/* Prints as a two-page CV: name and contacts, summary, stack, experience,
   education, and one line per project. Services, rates, the brief and the
   project write-ups stay on screen. */
@media print {
  :root,
  :root[data-theme="light"] {
    --ink: #000;
    --paper: #fff;
    --body: 9pt;
    --small: 8pt;
    --lead: 10pt;
    --title: 10pt;
    --sub: 11.5pt;
    --section: 12.5pt;
    --display: 19pt;
    --gutter: 0px;
    --term: 22%;
    color-scheme: light;
  }

  @page { size: A4; margin: 14mm 15mm; }

  .site-header,
  .skip,
  .no-print,
  .palette,
  .viewer,
  .anchor,
  .marker,
  #contact,
  .site-footer,
  .section-body > .intro,
  .project .entry-body,
  .entry-dated .gist-more,
  #services .section-head,
  #services .section-body > :not(.cv) { display: none !important; }

  .print-only { display: block; }

  body { line-height: 1.38; }
  .wrap { max-width: none; padding: 0; }

  .hero { padding: 0 0 8pt; }
  .byline { font-size: 15pt; }
  .byline + .print-only { margin-top: 3pt; font-size: var(--small); }
  .motto { margin-top: 10pt; line-height: 1.02; letter-spacing: -0.02em; }
  .motto span + span { margin-top: 0.06em; }
  .hero-grid { grid-template-columns: 3fr 2fr; gap: 16pt; margin-top: 10pt; }
  .lead p { font-size: var(--lead); line-height: 1.4; }
  .lead p + p { margin-top: 5pt; }
  .ledger > div { padding-block: 2pt; }

  /* Sections stack at full width: a rule, a title, the content. */
  .section { padding: 8pt 0 3pt; border-top-width: 1pt; }
  .section-grid { display: block; }
  .section-head { position: static; margin-bottom: 2pt; }
  .section-head h2,
  #stack { font-size: var(--section); letter-spacing: 0; }
  #stack { margin: 0 0 2pt; }
  .sub { margin-top: 10pt; font-size: var(--sub); letter-spacing: 0; }
  .block { margin-top: 4pt; }

  .row { gap: 2pt 12pt; padding-block: 5pt; }
  .rows-tight .row { padding-block: 3pt; }
  .rows-tight dt,
  .rows-tight dd { font-size: var(--small); }

  .entry > summary,
  .entry-body { grid-template-columns: var(--term) minmax(0, 1fr); column-gap: 12pt; }
  .entry > summary { margin: 0; padding: 6pt 0 2pt; row-gap: 1pt; }
  .entry-body { padding-block: 2pt 6pt; }
  .entry-body > * + * { margin-top: 4pt; }
  .entry-body > * + h4 { margin-top: 7pt; }
  .entry-body > h4 + * { margin-top: 3pt; }
  .dashed li + li { margin-top: 2pt; }

  .project > summary { padding-block: 4pt; }
  .entry-named .gist { grid-row: 1; }
  .entry-named .repo { grid-column: 2; grid-row: 2; font-size: var(--small); }
  .note { margin-top: 6pt; }

  .row,
  .entry > summary,
  .ledger > div,
  .dashed li { break-inside: avoid; }
  h2, h3, h4,
  .entry-dated > summary { break-after: avoid; }
}
