/* MARK: fonts */

/* Preloaded with font-display: block, so text never swaps fonts. The fallback is Arial
   scaled to Poppins' metrics, so the layout does not jump if the font is late. */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/assets/fonts/poppins-400.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("/assets/fonts/poppins-600.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins Fallback";
  src: local("Arial"), local("Helvetica"), local("Liberation Sans");
  font-weight: 100 599;
  size-adjust: 111.16%;
  ascent-override: 94.46%;
  descent-override: 31.49%;
  line-gap-override: 9%;
}

@font-face {
  font-family: "Poppins Fallback";
  src: local("Arial Bold"), local("Helvetica Bold"), local("Liberation Sans Bold");
  font-weight: 600 900;
  size-adjust: 105.72%;
  ascent-override: 99.32%;
  descent-override: 33.11%;
  line-gap-override: 9.46%;
}

/* MARK: base */

:root {
  /* light-dark(light, dark) follows color-scheme: the system, or the theme switch */
  color-scheme: light dark;
  --text: light-dark(#1f1f1f, #dadada);
  --muted: light-dark(#5f5f5f, #9a9a9a);
  --body: light-dark(#3f3f3f, #c6c6c6);
  --line: light-dark(#d6d6d6, #4a4a4a);
  --faint: light-dark(#8f8f8f, #747474); /* the quietest an icon may be: 3:1 on the background */
  --rule: light-dark(#ececec, #333);
  --bg: light-dark(#fff, #212121);
  --soft: light-dark(#f5f5f5, #2a2a2a);
  --ink: light-dark(#353535, #dadada);
  --on-ink: light-dark(#fff, #212121);
  --ink-hover: light-dark(#000, #fff);
  --accent: #d686a0; /* too light for text: underlines and tints only */
  --accent-tint: light-dark(rgba(214, 134, 160, 0.18), rgba(214, 134, 160, 0.24));
  /* the clients in the demos: A, B, C as a quiet red, green, blue (at least 3:1 on the background) */
  --client-a: light-dark(#b9524f, #e08480);
  --client-b: light-dark(#4c8a55, #7fbf88);
  --client-c: light-dark(#4870b5, #84a6e0);
  --radius: 1.1rem;
  --width: 1080px;
  --header: 3.75rem;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 0.5rem);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation; /* no double-tap zoom; pinch zoom stays (WCAG 1.4.4) */
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  @view-transition {
    navigation: none;
  }
}

body {
  font-family: "Poppins", "Poppins Fallback", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

@view-transition {
  navigation: auto;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  color: var(--on-ink);
  background: var(--ink);
  border-radius: 0.5rem;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* MARK: header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header);
  /* % not vw: vw includes the scrollbar */
  padding: 0 max(1rem, calc((100% - var(--width)) / 2 + 1rem));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
}

.logo {
  font-size: 1.15rem;
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.site-nav > a,
.nav-group > a {
  display: block;
  padding: 0.4rem 0.8rem;
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 150ms ease;
}

.site-nav > a:hover,
.site-nav > a[aria-current],
.nav-group > a:hover,
.nav-group > a[aria-current] {
  color: var(--text);
}

/* the notes under "Notes": a dropdown on hover or keyboard focus */
.nav-group {
  position: relative;
}

.nav-sub {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 20rem;
  padding: 0.35rem;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* .closed: after a click on "Notes" or Escape, until the pointer and focus leave (main.ts) */
.nav-group:is(:hover, :focus-within):not(.closed) .nav-sub {
  display: block;
}

.nav-sub a {
  display: block;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  border-radius: 6px;
}

/* a line between the titles: two-line titles would otherwise run together */
.nav-sub li + li {
  border-top: 1px solid var(--line);
}

.nav-sub a:hover,
.nav-sub a[aria-current] {
  background: var(--accent-tint);
}

/* settings, not sections: after a thin line, as quiet as the nav links */
.switches {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.6rem;
  padding-left: 0.9rem;
  border-left: 1px solid var(--line);
}

.langs {
  display: flex;
}

.lang {
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 150ms ease;
}

.lang[aria-current] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 1.8rem;
  min-height: 1.8rem;
  justify-content: center;
  padding: 0;
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 150ms ease;
}

.theme-toggle .ico {
  width: 1.1rem;
  height: 1.1rem;
}

a.lang:hover,
.theme-toggle:hover {
  color: var(--text);
}

/* the icon and the name show what a click turns on */
.theme-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.when-dark {
  display: none;
}

:root[data-theme="dark"] .when-light {
  display: none;
}

:root[data-theme="dark"] .when-dark {
  display: revert;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-light {
    display: none;
  }

  :root:not([data-theme="light"]) .when-dark {
    display: revert;
  }
}

.burger {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.burger span {
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 200ms ease, opacity 200ms ease;
}

.burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger.open span:nth-child(2) {
  opacity: 0;
}

.burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* MARK: layout */

main,
.page-footer {
  max-width: var(--width);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

section {
  padding: 3rem 0 0.5rem;
}

.section-title {
  margin-bottom: 1.25rem;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
}

/* MARK: hero */

.hero {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding-top: 4rem;
}

.profile-pic {
  flex: none;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.75rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.role {
  margin-top: 0.25rem;
  line-height: 1.3;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--muted);
}

.intro {
  max-width: 34rem;
  margin-top: 0.9rem;
  font-size: 1.05rem;
  color: var(--body);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.4rem;
}


/* MARK: buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.3rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--on-ink);
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.btn:hover {
  background: var(--ink-hover);
}

/* MARK: about */

.about-text {
  max-width: 68ch;
  color: var(--body);
}

.about-text + .about-text {
  margin-top: 0.9rem;
}

/* MARK: experience */

.timeline > li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0 1.5rem;
  padding: 0.9rem 0;
}

.timeline > li + li {
  border-top: 1px solid var(--rule);
}

.period {
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--muted);
}

.row-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.org {
  font-size: 0.9rem;
  color: var(--muted);
}

.row-text + .row-text {
  margin-top: 0.5rem;
}

.row-text {
  max-width: 62ch;
  margin-top: 0.35rem;
  font-size: 0.93rem;
  color: var(--body);
}

/* MARK: projects */

.project-name {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.9;
}

.project-links {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

/* 24px tall at least (WCAG 2.5.8) */
.project-links a,
.tags a,
.page-footer a {
  display: inline-block;
  padding-block: 0.15rem;
}

.project-links a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.project-links a:hover {
  background: var(--accent-tint);
}

.tags {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.tags a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}

.tags a:hover {
  color: var(--text);
  text-decoration-color: var(--accent);
}

.term {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 150ms ease;
}

.term:hover {
  text-decoration-color: var(--accent);
}

abbr[title] {
  text-decoration: none;
  cursor: help;
}

/* MARK: notes */

.note-list > li {
  padding: 0.9rem 0;
}

.note-list > li + li {
  border-top: 1px solid var(--rule);
}

.note-list a {
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.note-list a:hover {
  background: var(--accent-tint);
}

.note-list p {
  max-width: 62ch;
  margin-top: 0.25rem;
  font-size: 0.93rem;
  color: var(--body);
}

.all-notes {
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.all-notes a,
.back a,
.link {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

.notes-page {
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

.notes-page > * {
  max-width: 44rem;
}

.notes-page h1 {
  margin-bottom: 1.2rem;
  font-size: clamp(1.8rem, 4.5vw, 2.4rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.back {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.untranslated {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* who wrote an article and when: it is read on its own, from a search or a link */
.byline {
  margin-top: -0.6rem;
  margin-bottom: 1.8rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.byline a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

.note-list time {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.contents {
  margin: 0 0 2rem;
  padding: 1rem 1.2rem;
  background: var(--soft);
  border-radius: 0.6rem;
}

article .contents h2 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

article .contents ol {
  margin: 0;
  padding-left: 1.3rem;
  font-size: 0.93rem;
}

.contents a {
  display: inline-block;
  padding-block: 0.1rem;
}

article {
  color: var(--body);
  line-height: 1.75;
}

article h1 {
  color: var(--text);
}

article h2 {
  margin: 2.2rem 0 0.6rem;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

article h3 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

article p,
article ul,
article ol,
article pre,
article blockquote {
  margin-bottom: 1rem;
}

article ul,
article ol {
  padding-left: 1.4rem;
}

/* a short accent dash instead of a bullet */
article ul {
  padding-left: 0;
  list-style: none;
}

article ul > li {
  position: relative;
  padding-left: 1.2rem;
}

article ul > li + li {
  margin-top: 0.35rem;
}

article ul > li::before {
  position: absolute;
  top: 0.85em;
  left: 0;
  width: 0.55rem;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  content: "";
}

article .flow-map > li {
  padding-left: 0;
}

article .flow-map > li::before {
  content: none;
}

article a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

article code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
}

article :not(pre) > code {
  padding: 0.1em 0.35em;
  background: var(--soft);
  border-radius: 0.3rem;
}

article pre {
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
  background: var(--soft);
  border-radius: 0.6rem;
}

article blockquote {
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 0.6rem;
}

article figure {
  margin: 1.5rem 0;
}

article figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* the only place on the site with other colours: the flag of Ukraine, a thin line along a section
   wrapped in <div class="flag-section"> (blank lines around the Markdown inside) */
/* the line sits in the margin, so the text stays in line with the rest of the note */
.flag-section {
  margin: 2.2rem 0 1rem calc(-0.75rem - 3px);
  padding-left: 0.75rem;
  border-left: 3px solid;
  border-image: linear-gradient(#0057b7 50%, #ffd700 50%) 1;
}

article .flag-section > :first-child {
  margin-top: 0;
}

article .flag-section > :last-child {
  margin-bottom: 0;
}

/* MARK: charts */

.chart figcaption {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.chart figcaption strong {
  display: block;
  color: var(--text);
}

.chart figcaption span {
  color: var(--muted);
}

.chart svg {
  width: 100%;
  font-family: inherit;
}

/* a narrow chart is drawn for phones, so the labels keep their size instead of shrinking */
.chart-narrow {
  display: none;
}

@media (max-width: 560px) {
  .chart-wide {
    display: none;
  }

  .chart-narrow {
    display: block;
  }
}

.chart-axis {
  font-size: 11px;
  font-weight: 600;
  fill: var(--muted);
}

.chart-line-gap {
  stroke-dasharray: 2 5;
  stroke-linecap: round;
}

.chart-grid {
  stroke: var(--rule);
}

.chart-tick {
  font-size: 11px;
  fill: var(--muted);
}

.chart-line {
  stroke: var(--text);
  stroke-width: 2;
}

.chart-dot {
  fill: var(--bg);
  stroke: var(--text);
  stroke-width: 2;
}

.chart-bar {
  fill: var(--muted);
}

.chart-hit {
  fill: transparent;
}

/* SVG paints in document order, there is no z-index: the bars and dots are drawn once, under every point;
   a point holds only its hover area, an invisible copy of its bar or dot that darkens on hover, and its tip,
   so no later bar covers the tip */
.chart-hi {
  visibility: hidden;
}

.chart-point:hover .chart-hi {
  visibility: visible;
}

.chart-point:hover .chart-bar {
  fill: var(--text);
}

.chart-point:hover .chart-dot {
  fill: var(--text);
}

.chart-tip {
  display: none;
  pointer-events: none;
}

.chart-point:hover .chart-tip {
  display: inline;
}

.chart-tip rect {
  fill: var(--ink);
}

.chart-tip text {
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--on-ink);
}

.chart-event {
  stroke: var(--accent);
  stroke-dasharray: 3 3;
}

.chart-event-dot {
  fill: var(--accent-tint);
  stroke: var(--accent);
}

.chart-event-n {
  font-size: 10px;
  font-weight: 600;
  fill: var(--text);
}

article .chart-events {
  margin: 0.75rem 0 0;
  padding-left: 1.4rem;
  list-style: decimal;
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-events time {
  color: var(--text);
  font-weight: 600;
}

/* MARK: flow diagrams */

/* steps in a row (a column on phones); pages are grey shapes, never real content */

.flow {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.1rem;
  margin: 1.5rem 0;
}

.flow-step {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

article .flow-step > p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

.flow-arrow {
  font-size: 1.4rem;
  color: var(--muted);
}

.pages {
  display: flex;
  flex: none;
  gap: 0.4rem;
}

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 58px;
  height: 78px;
  padding: 12px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.page i {
  display: block;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
}

.page i:nth-child(even) {
  width: 75%;
}

.page i.mark {
  width: 30%;
  background: var(--accent);
}

.page .row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page .row i {
  flex: 1;
}

.page b {
  font-size: 10px;
  line-height: 1;
}

.page .q {
  color: var(--muted);
}

.page.cover {
  justify-content: center;
}

.page.with-header {
  padding-top: 16px;
  border-top: 7px solid var(--accent);
}

.page .foot {
  position: absolute;
  right: 0;
  bottom: 6px;
  left: 0;
  text-align: center;
}

.stack {
  position: relative;
  width: 74px;
  height: 90px;
}

.stack .page {
  position: absolute;
}

.stack .page:nth-child(1) {
  top: 12px;
  left: 16px;
}

.stack .page:nth-child(2) {
  top: 6px;
  left: 8px;
}

article .flow-map {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .flow {
    flex-direction: column;
    align-items: flex-start;
  }

  .flow-arrow {
    margin-left: 1.5rem;
    transform: rotate(90deg);
  }

  .flow-op {
    transform: none;
  }
}

/* layers of a system, top to bottom: a box each, an arrow to the one below it talks to */
article .layers {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

article .layers > li {
  position: relative;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

article .layers > li + li::before {
  position: absolute;
  bottom: 100%;
  left: 1.2rem;
  font-size: 1.1rem;
  line-height: 1.4rem;
  color: var(--muted);
  content: "↓";
}

article .layers b {
  margin-right: 0.5rem;
}

/* a package name breaks only after its scope's slash, never at a hyphen */
article .layers a span {
  white-space: nowrap;
}

article .layers li > span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  color: var(--body);
}

/* a tree of documents: lines drawn by CSS, each name with what it holds right after it, wrapping under the name */
article .tree,
article .tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

article .tree {
  margin: 1.5rem 0;
}

article .tree li {
  position: relative;
  padding: 0.2rem 0 0.2rem 1.4rem;
  margin: 0;
}

article .tree > li {
  padding-left: 0;
}

article .tree > li::before {
  content: none;
}

/* the branch into this node: down from the parent, then across to the name */
article .tree ul > li::before {
  position: absolute;
  top: 0;
  left: 0.35rem;
  width: 0.75rem;
  height: calc(0.2rem + 0.8em);
  background: none;
  border: solid var(--muted);
  border-width: 0 0 1px 1px;
  border-radius: 0 0 0 4px;
  content: "";
}

/* the line on to the next sibling */
article .tree ul > li:not(:last-child)::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.35rem;
  border-left: 1px solid var(--muted);
  content: "";
}

article .tree b {
  margin-right: 0.35rem;
}

/* MARK: contact */

.contact {
  padding-top: 3rem;
  padding-bottom: 1rem;
}

.contact-text {
  max-width: 34rem;
  color: var(--body);
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 3rem;
  padding-top: 1.2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--accent-tint);
  font-size: 0.85rem;
  color: var(--muted);
}

.page-footer a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  list-style: none;
}

.address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 1.1rem;
}

.address a {
  font-size: 1.3rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.address a:hover {
  background: var(--accent-tint);
}

.copy {
  padding: 0.25rem 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.copy:hover {
  color: var(--text);
  border-color: var(--ink);
}

/* MARK: section links */

/* a section heading and its link (main.ts): the block takes over the heading's margins */
.heading {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.heading > h2 {
  margin: 0;
}

section > .heading {
  margin-bottom: 1.25rem;
}

article .heading {
  margin: 2.2rem 0 0.6rem;
}

/* quiet, darker on hover; shown when the heading is hovered or the link focused,
   always on a touch screen */
.section-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--faint);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease;
}

.section-link .ico {
  width: 1rem;
  height: 1rem;
}

.heading:hover > .section-link,
.section-link:focus-visible {
  opacity: 1;
}

.section-link:hover {
  color: var(--muted);
}

@media (hover: none) {
  .section-link {
    opacity: 1;
  }
}

/* MARK: 404 */

.not-found {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.not-found h1 {
  font-size: clamp(4rem, 14vw, 7rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.not-found-message {
  max-width: 34rem;
  margin-top: 2rem;
}

.not-found-message h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.not-found-message p {
  margin: 0.3rem 0 0.5rem;
  color: var(--body);
}

.not-found-message a {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin-top: 1.2rem;
}

.contacts a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25rem;
}

.contacts a:hover {
  background: var(--accent-tint);
}

.contacts .ico {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

/* MARK: small screens */

@media (max-width: 720px) {
  .burger {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.35rem 1rem 0.9rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav > a,
  .nav-group > a {
    padding: 0.7rem 0.25rem;
    font-size: 1rem;
  }

  .site-nav > a:hover,
  .site-nav > a[aria-current],
  .nav-group > a:hover,
  .nav-group > a[aria-current] {
    font-weight: 600;
  }

  /* no hover on a phone: the notes are listed under "Notes" */
  .nav-sub {
    display: block;
    position: static;
    width: auto;
    padding: 0 0 0.3rem 0.75rem;
    border: 0;
    border-left: 2px solid var(--accent-tint);
    border-radius: 0;
    box-shadow: none;
  }

  .nav-sub a {
    padding: 0.5rem 0.5rem;
  }

  .switches {
    justify-content: space-between;
    margin: 0.4rem 0 0;
    padding: 0.6rem 0.25rem 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .langs {
    margin-left: -0.4rem;
  }

  /* room for words in the phone menu */
  .theme-label {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
  }
}

@media (max-width: 560px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-top: 1.5rem;
  }

  .address {
    column-gap: 0.6rem;
  }

  .address a {
    font-size: 1.05rem;
  }

  .profile-pic {
    width: 8rem;
    height: 8rem;
  }

  .timeline > li {
    grid-template-columns: 1fr;
  }
}

/* MARK: page transitions */

/* a link to another page of the site fades into it instead of flashing white (Chrome, Safari) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* MARK: print */

@page {
  margin: 16mm 15mm;
}

@media print {
  /* paper is white whatever the theme */
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
  }

  body {
    font-size: 11pt;
  }

  /* the room between sections is for scrolling; paper needs less */
  section,
  .contact {
    padding-top: 1.5rem;
  }

  /* what only works on a screen: the menu, the switches, buttons, the demos; and the footer:
     the name is in the header, the contacts on the home page, the page's address in the browser's own footer */
  .skip-link,
  .burger,
  .site-nav,
  .back,
  .actions,
  .copy,
  .section-link,
  .sim,
  .page-footer {
    display: none !important;
  }

  .site-header {
    position: static;
    padding-block: 0 1rem;
    border: 0;
    box-shadow: none;
    background: none;
  }

  /* a link on paper says where it goes: the address after it; not after a term (its name is enough),
     nor in the narrow column of a project or the boxes of a diagram, where it would not fit */
  main a[href^="http"]:not(.term, .tags a, .project-links a, .layers a)::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    font-weight: 400;
    color: var(--muted);
    overflow-wrap: anywhere;
  }

  /* code wraps instead of scrolling sideways */
  article pre {
    overflow: visible;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* the wide chart, whatever the paper width */
  .chart-wide {
    display: block;
  }

  .chart-narrow {
    display: none;
  }

  /* a heading stays with what follows it; a figure, a code block or an entry is not cut in two */
  h1,
  h2,
  h3,
  .heading {
    break-after: avoid;
  }

  figure,
  pre,
  .flow,
  .layers,
  .tree,
  .note-list > li,
  .contents,
  .contact {
    break-inside: avoid;
  }

  /* the dashes of a list are drawn as a background, which a browser leaves out on paper by default */
  article ul > li::before {
    print-color-adjust: exact;
  }

  p {
    orphans: 3;
    widows: 3;
  }
}
