:root {
  --bg: #FFFFFF;
  --ink: #1A1C22;
  --muted: #5F6470;
  --rule: #E3E5EA;
  --link: #1E3FAE;
  --font: "Newsreader", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171D;
    --ink: #E8EAEF;
    --muted: #9BA1AE;
    --rule: #2A2F3A;
    --link: #8FA8FF;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.6;
  font-optical-sizing: auto;
}

.page {
  max-width: 41rem;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 88px) 24px 88px;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }

h1 {
  margin: 0 0 8px;
  font-size: clamp(2.8rem, 11vw, 4.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
}

.role { margin: 0 0 14px; color: var(--muted); font-size: 1.1rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

h2 {
  margin: 3rem 0 0.8rem;
  font-size: 1.4rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.4;
}

p { margin: 0 0 0.9rem; }
.intro { font-size: 1.15rem; line-height: 1.55; }

ul { margin: 0.4rem 0 0; padding-left: 1.15rem; }
li { margin: 0.4rem 0; }
ul.plain { margin-top: 0; }

/* Topic tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  margin: 0;
  padding: 2px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Selected work: problem, what I built, result */
.case { margin: 0 0 2.2rem; }
.case h3 { font-size: 1.12rem; }
.meta { margin: 0.1rem 0 0.6rem; color: var(--muted); font-size: 0.92rem; }
.case dl {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.55rem 1.2rem;
  margin: 0;
}
.case dt { color: var(--muted); font-size: 0.95rem; padding-top: 0.12rem; }
.case dd { margin: 0; }

/* Experience and education */
.entry { margin: 0 0 1.9rem; }
.entry.tight { margin-bottom: 0.7rem; }
.entry > h3 { margin-bottom: 0.25rem; }
.entry > p { margin-bottom: 0.2rem; }

.head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 20px;
}
.dates {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.tools { margin: 1.1rem 0 0; color: var(--muted); font-size: 0.95rem; }

footer { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem; }
footer p { margin: 0; }

/* Demonstration */
.demo { margin: 1.2rem 0 0; }
.demo canvas {
  display: block;
  width: 100%;
  height: clamp(190px, 38vw, 270px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 14px 0 4px;
  font-size: 0.95rem;
}
.controls label { white-space: nowrap; }
.controls output {
  display: inline-block;
  min-width: 2ch;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.controls input[type="range"] { flex: 1 1 200px; accent-color: var(--link); }
.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 12px 20px;
  margin: 16px 0 0;
}
.scores dt { color: var(--muted); font-size: 0.9rem; line-height: 1.35; }
.scores dd {
  margin: 2px 0 0;
  font-size: 1.9rem;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.scores .given dd { color: var(--muted); }
.scores .unseen dd { color: var(--link); }
.demo figcaption { margin-top: 1rem; color: var(--muted); font-size: 0.95rem; }

@media (max-width: 560px) {
  .case dl { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .case dd { margin-bottom: 0.6rem; }
}

@media print {
  body { font-size: 11pt; background: #fff; color: #000; }
  .page { padding: 0; max-width: none; }
  a { color: #000; }
  footer { display: none; }
  .case, .entry { break-inside: avoid; }
}
