/* lukepearson.com — one stylesheet, no build step.
   Palette (five values), one type family, a twelve-column grid reduced to
   a margin column and a text column. */

@font-face {
  font-family: "Libertinus Serif Display";
  src: url("fonts/LibertinusSerifDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libertinus Serif";
  src: url("fonts/LibertinusSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libertinus Serif";
  src: url("fonts/LibertinusSerif-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f8f8f6;
  --ink: #000000;
  --field: #0a2da3;
  --slate: #4b4e56;
  --mark: #ffffff;

  --serif: "Libertinus Serif", "Linux Libertine", Georgia, "Times New Roman", serif;
  --display: "Libertinus Serif Display", "Libertinus Serif", "Linux Libertine", Georgia, serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --gap: clamp(1.5rem, 4vw, 4rem);
  --measure: 62ch;
  --page: 76rem;
}

html {
  font-size: 112.5%;              /* 18px */
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
  color: var(--ink);
  overflow-x: clip;               /* the plane bleeds to the viewport edge */
}

body {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.55;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}

/* ---------- grid ---------- */

.hero,
.row {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  column-gap: var(--gap);
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}

.row {
  padding-block: 1.75rem;
}

.body {
  max-width: var(--measure);
}
.row > .body {
  grid-column: 2;
}

p {
  margin: 0 0 1em;
}
.body > p:last-child,
.entry .body > p:last-child {
  margin-bottom: 0;
}

/* ---------- type ---------- */

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.75rem, 6.6vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.008em;
  margin: 0 0 0.55rem;
  text-wrap: balance;
}

.role {
  font-size: 1.2rem;
  line-height: 1.4;
  margin: 0;
  max-width: 14em;
}

h2 {
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.55;
  margin: 0;
  color: var(--ink);
}

.lede {
  font-size: 1.2rem;
  line-height: 1.5;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.35);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.16em;
}
a:hover {
  color: var(--field);
  text-decoration-color: var(--field);
}
a:focus-visible,
.domain:focus-visible {
  outline: 2px solid var(--field);
  outline-offset: 3px;
}
.domain:focus-visible {
  outline-color: var(--mark);
}

var {
  font-style: italic;
  font-family: var(--serif);
}
sup, sub {
  font-size: 0.72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sup { top: -0.55em; }
sub { top: 0.3em; }
.formula {
  white-space: nowrap;
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  background: var(--paper);
  padding: 0.25rem 0.5rem;
  z-index: 2;
}
.skip:focus {
  top: 0.5rem;
}

/* ---------- hero ---------- */

.hero {
  padding-bottom: 2rem;
}

.hero-text {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  /* the role's last baseline sits on the readout's last baseline */
  padding-block: 2rem calc(clamp(1.25rem, 4vw, 3rem) + 0.1rem - 2px);
}

/* the figure spans two rows of the hero grid and lends them to its parts:
   the plane in the first row, beside the name; the caption in the second */
.figure {
  margin: 0;
  min-width: 0;
  grid-column: 2;
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: subgrid;
}
.plane {
  grid-row: 1;
  min-width: 0;
  /* bleed off the top and the right edge of the viewport */
  margin-right: calc(-1 * (var(--gutter) + max(0px, (100vw - var(--page)) / 2)));
  background: var(--field);
  color: var(--mark);
  padding: clamp(1.25rem, 4vw, 3rem);
  padding-top: clamp(2rem, 6vw, 4.5rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.domain {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  overflow: visible;
  align-self: center;
}
.domain .root {
  fill: var(--mark);
  stroke: none;
}
.domain .label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  fill: var(--mark);
}
.domain .label.num {
  font-style: normal;
}

/* one page-load moment: the marks appear in exponent order, ω⁰ … ω⁶³ */
@media (prefers-reduced-motion: no-preference) {
  .domain .root {
    animation: appear 320ms ease-out both;
    animation-delay: calc(var(--i) * 16ms);
    transition: fill-opacity 120ms ease-out;
  }
  @keyframes appear {
    from { fill-opacity: 0; }
    to   { fill-opacity: 1; }
  }
}

/* exploring a subgroup (set by main.js) */
.domain.is-exploring .root {
  fill-opacity: 0.45;   /* keeps ≥ 3:1 against the plane */
}
.domain.is-exploring .root.is-member {
  fill-opacity: 1;
}
.domain.has-js .root {
  cursor: pointer;
  /* an invisible stroke widens the hit area to about 20 units */
  stroke: rgba(255, 255, 255, 0);
  stroke-width: 14;
}
.domain .root.is-active {
  stroke: var(--mark);
  stroke-width: 6;
  stroke-opacity: 0.5;
  paint-order: stroke;
}

.readout {
  margin: 1.5rem 0 0;
  max-width: 100%;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--mark);
  font-variant-numeric: tabular-nums lining-nums;
}
.readout-hex {
  overflow-wrap: anywhere;
}
.readout-order {
  display: block;
  color: var(--mark);
  opacity: 0.82;
}
.hint-touch {
  display: none;
}
@media (hover: none) {
  .hint-pointer { display: none; }
  .hint-touch { display: inline; }
}

figcaption {
  grid-row: 2;
  margin-top: 1.5rem;
  color: var(--slate);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: var(--measure);
}
figcaption p:last-child {
  margin-bottom: 0;
}
figcaption var,
figcaption .formula {
  color: var(--ink);
}

/* ---------- entries (research, talks, code) ---------- */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  column-gap: var(--gap);
  row-gap: 1.25rem;
}
.entries > li {
  display: contents;
}
.year {
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--slate);
  line-height: 1.55;
}
.entry-title {
  margin-bottom: 0.15em;
}
.entry-meta {
  color: var(--slate);
  font-size: 0.92rem;
  line-height: 1.5;
}
#research h2,
#talks h2,
#code h2 {
  margin-bottom: 1.25rem;
}


/* ---------- end of page ---------- */

main {
  padding-bottom: 3.5rem;
}

/* ---------- small screens ---------- */

@media (max-width: 47.5rem) {
  .hero,
  .row,
  .entries {
    grid-template-columns: 1fr;
  }
  .row > .body {
    grid-column: 1;
  }
  .hero {
    padding-inline: 0;
  }
  .hero-text {
    grid-column: 1;
    grid-row: 1;
    padding-inline: var(--gutter);
    padding-block: 2.5rem 1.5rem;
  }
  .figure {
    grid-column: 1;
    grid-row: 2 / 4;
  }
  .plane {
    grid-row: 1;
    margin-right: 0;
    padding-inline: var(--gutter);
  }
  figcaption {
    grid-row: 2;
  }
  figcaption {
    padding-inline: var(--gutter);
  }
  .row {
    padding-block: 1.25rem;
  }
  h2 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
  }
  #research h2,
  #talks h2,
  #code h2 {
    margin-bottom: 0.75rem;
  }
  .row {
    padding-block: 1.5rem;
  }
  .entries {
    row-gap: 1.25rem;
  }
  .entries > li {
    display: grid;
    grid-template-columns: 3.75rem minmax(0, 1fr);
    column-gap: 0.75rem;
  }
}

@media print {
  .plane { background: none; color: var(--ink); padding: 0; }
  .domain .root, .domain .label { fill: var(--ink); }
  .readout { color: var(--ink); }
  .hint { display: none; }
  .entries a[href]::after,
  #contact a[href]::after { content: " (" attr(href) ")"; color: var(--slate); font-size: 0.85em; }
}
