:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --fg: #1d1f23;
  --muted: #5f6672;
  --line: #e4e4e0;
  --accent: #2f5fd0;
  --kw: #7b3fb5;
  --var: #9a3412;
  --full: #c2410c;
  --partial: #0f766e;
  --neg: #c62828;
  --ok: #1a7f37;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --panel: #1b1e23;
    --fg: #e6e6e3;
    --muted: #a0a6ae;
    --line: #2c3037;
    --accent: #7aa2ff;
    --kw: #c79bff;
    --var: #ff9e64;
    --full: #ff9e64;
    --partial: #4fd6be;
    --neg: #ff6b6b;
    --ok: #3fb950;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

.top {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px max(16px, calc((100% - 960px) / 2));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.05em; color: var(--fg); text-decoration: none; font-size: 18px; }
.brand img { display: block; border-radius: 7px; }
.top nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.top nav a:hover { color: var(--fg); }
.top nav a.gh { display: inline-flex; align-items: center; gap: 6px; }
.top nav a.gh svg { display: block; }

main { max-width: 960px; margin: 0 auto; padding: 0 16px; }
section { padding: 40px 0 8px; scroll-margin-top: 56px; }

.hero { padding-top: 64px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.hero-picture { margin: 0; }
.hero-picture[hidden] { display: none; }
.hero:has(.hero-picture[hidden]) { grid-template-columns: minmax(0, 1fr); }
.hero-picture canvas { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.hero-picture figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); }
h1 { font-size: clamp(34px, 6vw, 52px); line-height: 1.1; margin: 0 0 16px; }
h1 span { display: block; font-size: 0.45em; font-weight: 500; color: var(--muted); margin-top: 6px; }
h2 { font-size: 24px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.lead { font-size: 19px; max-width: 46em; color: var(--fg); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.button {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.code {
  font: 14px/1.6 var(--mono);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
}
.code .k { color: var(--kw); font-weight: 600; }
.code .v { color: var(--var); }
.code .n { color: var(--neg); font-weight: 700; }
.code .p { color: var(--partial); font-weight: 700; }
.code .f { color: var(--full); font-weight: 700; }
.code .c { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
code { font-family: var(--mono); font-size: 0.92em; }

.authors { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.author { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.author h3 { font-size: 18px; margin: 0 0 2px; }
.author p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.author .native { margin-top: 0; font-size: 14px; }
/* In memoriam: the name in a mourning frame. */
.author.memorial { border: 3px solid var(--fg); border-radius: 0; }

/* Background: the language's history, a year to each step. */
.history { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; margin: 0; }
.history dt { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.history dd { margin: 0; }

/* New since 2004: what each year added, and what is planned. */
.new-year { margin: 22px 0 6px; color: var(--accent); font-variant-numeric: tabular-nums; }
.changes { margin: 0; padding-left: 1.3em; }
.changes li { margin: 6px 0; }
.tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 9px; font-size: 12px; font-weight: 600; vertical-align: 2px; color: var(--accent); border: 1px solid var(--accent); }

/* DLQ in Lean: each statement of the dissertation and where it stands. */
.badge img { display: inline-block; vertical-align: -2px; margin-left: 8px; font-size: 12px; font-weight: 400; }
.proofs { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 18px; }
.proofs th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); }
.proofs td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.proofs td:first-child { white-space: nowrap; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.proofs td:last-child { white-space: nowrap; padding-right: 0; }
.proofs td:last-child .tag:first-child { margin-left: 0; }
.tag.proved { color: var(--ok); border-color: var(--ok); }
.tag.planned { color: var(--muted); border-color: var(--line); }
.note { color: var(--muted); font-size: 15px; }

.pubs-title { margin: 28px 0 8px; }
.pubs { margin: 0; padding-left: 1.4em; color: var(--muted); font-size: 15px; }
.pubs li { margin: 4px 0; }

.bottom {
  max-width: 960px;
  margin: 48px auto 0;
  padding: 20px 16px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.bottom a { color: inherit; }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .hero-picture { max-width: 520px; }
}

/* Phones: the section links take a row of their own under the brand and the
   IDE button; the example runs edge to edge in a smaller face. */
@media (max-width: 600px) {
  .top { flex-wrap: wrap; row-gap: 6px; padding-top: 10px; padding-bottom: 6px; }
  .top .button { margin-left: auto; padding: 6px 14px; }
  .top nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .top nav a { font-size: 14px; padding: 4px 0; }
  .top nav a.gh span { display: none; }  /* the icon alone; the link keeps its title */
  section { padding-top: 32px; scroll-margin-top: 92px; }
  .hero { padding-top: 28px; }
  .lead { font-size: 17px; }
  .code {
    margin-left: -16px;
    margin-right: -16px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 12px 16px;
    font-size: 12.5px;
  }
  .card, .author { padding: 14px 16px; }
  .proofs thead { display: none; }
  .proofs tr { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .proofs td { padding: 0; border: 0; }
  .proofs td:last-child { grid-column: 2; white-space: normal; margin-top: 2px; }
}
