/* Same palette and type as the Atlas of Distributed Algorithms. */
:root {
  --bg: #fbfaf7;
  --text: #1d1d1b;
  --muted: #66645e;
  --border: #e3e0d8;
  --accent: #b4462a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Publication types: background tint and a stronger edge colour. */
  --preprint-bg: #efeeea;
  --preprint-edge: #9a978e;
  --conference-bg: #e6f1e5;
  --conference-edge: #3f8a4f;
  --journal-bg: #efe7f4;
  --journal-edge: #7a4a99;
  /* Map behind the Atlas button. */
  --map-land: #ebe5d8;
  --map-coast: #d3c9b5;
  --map-line: #e3ddd0;
  --map-edge: #a59d8c;
  --map-node: #8d8577;
  --map-c1: #c0603f;
  --map-c2: #4a7fb3;
  --map-c3: #519a5f;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161614;
    --text: #ecebe6;
    --muted: #a19f97;
    --border: #34332f;
    --accent: #e57a5c;
    --preprint-bg: #252522;
    --preprint-edge: #7d7a72;
    --conference-bg: #1d2a1f;
    --conference-edge: #74c085;
    --journal-bg: #2a2133;
    --journal-edge: #c09ae0;
    --map-land: #262521;
    --map-coast: #3c3a34;
    --map-line: #252421;
    --map-edge: #5f5b52;
    --map-node: #77736a;
    --map-c1: #c96d50;
    --map-c2: #5b8fc2;
    --map-c3: #62a873;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 64px 16px 80px; }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }

.intro { padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.intro::after { content: ""; display: block; clear: both; }
/* Floated so the name and affiliation wrap around it, top right on every screen size. */
.portrait {
  float: right;
  width: 160px;
  height: auto;
  margin: 0 0 12px 28px;
  border-radius: 8px;
}
.intro h1 { font-size: 2.4rem; margin: 0 0 12px; }
.role { font-size: 1.1rem; margin: 0 0 12px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; font-size: 0.95rem; }

/* Atlas button: a map that fades into the page background, with the title on top.
   flow-root keeps the box beside the floated portrait instead of running under it. */
.atlas-link {
  display: flow-root;
  position: relative;
  isolation: isolate;
  margin-top: 24px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}
.atlas-map {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  /* Fade out on all four sides so the map melts into the page background. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 88%, transparent),
                      linear-gradient(to bottom, transparent, #000 22%, #000 84%, transparent);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, transparent, #000 10%, #000 88%, transparent),
                      linear-gradient(to bottom, transparent, #000 22%, #000 84%, transparent);
          mask-composite: intersect;
  transform-origin: 75% 75%;
  transition: filter 0.3s ease, transform 0.5s ease;
}
.map-grid { fill: none; stroke: var(--map-line); stroke-width: 1; stroke-dasharray: 2 5; }
.map-wave { fill: none; stroke: var(--map-coast); stroke-width: 1.4; stroke-linecap: round; }
.map-land { fill: var(--map-land); stroke: var(--map-coast); stroke-width: 1.5; }
.map-shore { fill: none; stroke: var(--map-coast); stroke-width: 1; stroke-dasharray: 3 4; }
.map-graph .edge { fill: none; stroke: var(--map-edge); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-graph .edge.matched { stroke: var(--map-c1); stroke-width: 4.5; }
.map-graph .edge.e1 { stroke: var(--map-c1); stroke-width: 3.2; }
.map-graph .edge.e2 { stroke: var(--map-c2); stroke-width: 3.2; }
.map-graph .edge.e3 { stroke: var(--map-c3); stroke-width: 3.2; }
.map-graph .node { fill: var(--map-land); stroke: var(--map-node); stroke-width: 1.8; }
.map-graph .node.in-set { fill: var(--map-c1); stroke: var(--map-c1); }
.map-graph .node.c1 { fill: var(--map-c1); stroke: var(--map-c1); }
.map-graph .node.c2 { fill: var(--map-c2); stroke: var(--map-c2); }
.map-graph .node.c3 { fill: var(--map-c3); stroke: var(--map-c3); }
/* The label sits in the top-left; the islands fill the space below and to the right of it. */
.atlas-text {
  /* A soft halo in the page colour, in case the label crosses an island on small screens. */
  text-shadow: 0 0 6px var(--bg), 0 0 14px var(--bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 168px;
  padding: 10px 0 0;
}
.atlas-title { font-family: var(--serif); font-size: 1.65rem; font-weight: 600; line-height: 1.15; }
.atlas-arrow { display: inline-block; color: var(--accent); transition: transform 0.2s ease; }
.atlas-desc { color: var(--muted); font-size: 0.95rem; }
.atlas-link:hover .atlas-map, .atlas-link:focus-visible .atlas-map { filter: brightness(1.1) saturate(1.15); transform: scale(1.03); }
.atlas-link:hover .atlas-arrow, .atlas-link:focus-visible .atlas-arrow { transform: translateX(5px); }
.atlas-link:hover .atlas-title { color: var(--accent); }
.atlas-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .atlas-map, .atlas-arrow { transition: none; }
}

h2 { font-size: 1.5rem; margin: 40px 0 16px; }

/* Section heading with the profile links on the right; the links drop below the heading on narrow screens. */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin: 40px 0 16px; }
.section-head h2 { margin: 0; }

.pub-preprint   { --pub-bg: var(--preprint-bg);   --pub-edge: var(--preprint-edge); }
.pub-conference { --pub-bg: var(--conference-bg); --pub-edge: var(--conference-edge); }
.pub-journal    { --pub-bg: var(--journal-bg);    --pub-edge: var(--journal-edge); }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 20px 0 0; padding: 0; font-size: 0.88rem; }
.legend li {
  padding: 3px 12px 3px 10px;
  background: var(--pub-bg);
  border-left: 3px solid var(--pub-edge);
  border-radius: 4px;
}

.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
  padding: 14px 18px;
  background: var(--pub-bg);
  border-left: 4px solid var(--pub-edge);
  border-radius: 6px;
}
.pubs .title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.pubs .authors { color: var(--text); }
.pubs .authors b { font-weight: 600; }
.pubs .venue { color: var(--muted); font-style: italic; }
.pubs .refs { font-size: 0.92rem; }

@media (max-width: 520px) {
  .wrap { padding-top: 40px; }
  .intro h1 { font-size: 2rem; }
  .portrait { width: 104px; margin-left: 16px; }
  .atlas-title { font-size: 1.35rem; }
  /* Narrow screens: show the whole map at full width, pinned below the label, instead of cropping its sides. */
  .atlas-text { min-height: 190px; }
  .atlas-map { top: auto; bottom: 0; height: auto; }
}

abbr[title] { text-decoration: none; cursor: help; }
